/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __reflectGet = Reflect.get;
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
var __typeError = (msg) => {
throw TypeError(msg);
};
var __pow = Math.pow;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a3, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a3, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a3, prop, b[prop]);
}
return a3;
};
var __spreadProps = (a3, b) => __defProps(a3, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve2, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
var __await = function(promise, isYieldStar) {
this[0] = promise;
this[1] = isYieldStar;
};
var __yieldStar = (value) => {
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
if (obj == null) {
obj = value[__knownSymbol("iterator")]();
method = (k) => it[k] = (x) => obj[k](x);
} else {
obj = obj.call(value);
method = (k) => it[k] = (v) => {
if (isAwait) {
isAwait = false;
if (k === "throw") throw v;
return v;
}
isAwait = true;
return {
done: false,
value: new __await(new Promise((resolve2) => {
var x = obj[k](v);
if (!(x instanceof Object)) __typeError("Object expected");
resolve2(x);
}), 1)
};
};
}
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
throw x;
}, "return" in obj && method("return"), it;
};
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
// lib/codemirror.js
var require_codemirror = __commonJS({
"lib/codemirror.js"(exports2, module3) {
"use strict";
module3.exports = CodeMirror;
}
});
// node_modules/monaco-editor/esm/vs/base/common/arrays.js
function tail(array2, n = 0) {
return array2[array2.length - (1 + n)];
}
function tail2(arr) {
if (arr.length === 0) {
throw new Error("Invalid tail call");
}
return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];
}
function equals(one, other, itemEquals2 = (a3, b) => a3 === b) {
if (one === other) {
return true;
}
if (!one || !other) {
return false;
}
if (one.length !== other.length) {
return false;
}
for (let i = 0, len = one.length; i < len; i++) {
if (!itemEquals2(one[i], other[i])) {
return false;
}
}
return true;
}
function removeFastWithoutKeepingOrder(array2, index) {
const last = array2.length - 1;
if (index < last) {
array2[index] = array2[last];
}
array2.pop();
}
function binarySearch(array2, key, comparator) {
return binarySearch2(array2.length, (i) => comparator(array2[i], key));
}
function binarySearch2(length, compareToKey) {
let low = 0, high = length - 1;
while (low <= high) {
const mid = (low + high) / 2 | 0;
const comp = compareToKey(mid);
if (comp < 0) {
low = mid + 1;
} else if (comp > 0) {
high = mid - 1;
} else {
return mid;
}
}
return -(low + 1);
}
function quickSelect(nth, data, compare2) {
nth = nth | 0;
if (nth >= data.length) {
throw new TypeError("invalid index");
}
const pivotValue = data[Math.floor(data.length * Math.random())];
const lower = [];
const higher = [];
const pivots = [];
for (const value of data) {
const val = compare2(value, pivotValue);
if (val < 0) {
lower.push(value);
} else if (val > 0) {
higher.push(value);
} else {
pivots.push(value);
}
}
if (nth < lower.length) {
return quickSelect(nth, lower, compare2);
} else if (nth < lower.length + pivots.length) {
return pivots[0];
} else {
return quickSelect(nth - (lower.length + pivots.length), higher, compare2);
}
}
function groupBy(data, compare2) {
const result = [];
let currentGroup = void 0;
for (const element of data.slice(0).sort(compare2)) {
if (!currentGroup || compare2(currentGroup[0], element) !== 0) {
currentGroup = [element];
result.push(currentGroup);
} else {
currentGroup.push(element);
}
}
return result;
}
function* groupAdjacentBy(items, shouldBeGrouped) {
let currentGroup;
let last;
for (const item of items) {
if (last !== void 0 && shouldBeGrouped(last, item)) {
currentGroup.push(item);
} else {
if (currentGroup) {
yield currentGroup;
}
currentGroup = [item];
}
last = item;
}
if (currentGroup) {
yield currentGroup;
}
}
function forEachAdjacent(arr, f3) {
for (let i = 0; i <= arr.length; i++) {
f3(i === 0 ? void 0 : arr[i - 1], i === arr.length ? void 0 : arr[i]);
}
}
function forEachWithNeighbors(arr, f3) {
for (let i = 0; i < arr.length; i++) {
f3(i === 0 ? void 0 : arr[i - 1], arr[i], i + 1 === arr.length ? void 0 : arr[i + 1]);
}
}
function coalesce(array2) {
return array2.filter((e) => !!e);
}
function coalesceInPlace(array2) {
let to = 0;
for (let i = 0; i < array2.length; i++) {
if (!!array2[i]) {
array2[to] = array2[i];
to += 1;
}
}
array2.length = to;
}
function isFalsyOrEmpty(obj) {
return !Array.isArray(obj) || obj.length === 0;
}
function isNonEmptyArray(obj) {
return Array.isArray(obj) && obj.length > 0;
}
function distinct(array2, keyFn = (value) => value) {
const seen = /* @__PURE__ */ new Set();
return array2.filter((element) => {
const key = keyFn(element);
if (seen.has(key)) {
return false;
}
seen.add(key);
return true;
});
}
function firstOrDefault(array2, notFoundValue) {
return array2.length > 0 ? array2[0] : notFoundValue;
}
function range(arg, to) {
let from = typeof to === "number" ? arg : 0;
if (typeof to === "number") {
from = arg;
} else {
from = 0;
to = arg;
}
const result = [];
if (from <= to) {
for (let i = from; i < to; i++) {
result.push(i);
}
} else {
for (let i = from; i > to; i--) {
result.push(i);
}
}
return result;
}
function arrayInsert(target, insertIndex, insertArr) {
const before = target.slice(0, insertIndex);
const after2 = target.slice(insertIndex);
return before.concat(insertArr, after2);
}
function pushToStart(arr, value) {
const index = arr.indexOf(value);
if (index > -1) {
arr.splice(index, 1);
arr.unshift(value);
}
}
function pushToEnd(arr, value) {
const index = arr.indexOf(value);
if (index > -1) {
arr.splice(index, 1);
arr.push(value);
}
}
function pushMany(arr, items) {
for (const item of items) {
arr.push(item);
}
}
function asArray(x) {
return Array.isArray(x) ? x : [x];
}
function insertInto(array2, start, newItems) {
const startIdx = getActualStartIndex(array2, start);
const originalLength = array2.length;
const newItemsLength = newItems.length;
array2.length = originalLength + newItemsLength;
for (let i = originalLength - 1; i >= startIdx; i--) {
array2[i + newItemsLength] = array2[i];
}
for (let i = 0; i < newItemsLength; i++) {
array2[i + startIdx] = newItems[i];
}
}
function splice(array2, start, deleteCount, newItems) {
const index = getActualStartIndex(array2, start);
let result = array2.splice(index, deleteCount);
if (result === void 0) {
result = [];
}
insertInto(array2, index, newItems);
return result;
}
function getActualStartIndex(array2, start) {
return start < 0 ? Math.max(start + array2.length, 0) : Math.min(start, array2.length);
}
function compareBy(selector, comparator) {
return (a3, b) => comparator(selector(a3), selector(b));
}
function tieBreakComparators(...comparators) {
return (item1, item2) => {
for (const comparator of comparators) {
const result = comparator(item1, item2);
if (!CompareResult.isNeitherLessOrGreaterThan(result)) {
return result;
}
}
return CompareResult.neitherLessOrGreaterThan;
};
}
function reverseOrder(comparator) {
return (a3, b) => -comparator(a3, b);
}
var CompareResult, numberComparator, booleanComparator, ArrayQueue, CallbackIterable, Permutation;
var init_arrays = __esm({
"node_modules/monaco-editor/esm/vs/base/common/arrays.js"() {
(function(CompareResult2) {
function isLessThan(result) {
return result < 0;
}
CompareResult2.isLessThan = isLessThan;
function isLessThanOrEqual(result) {
return result <= 0;
}
CompareResult2.isLessThanOrEqual = isLessThanOrEqual;
function isGreaterThan(result) {
return result > 0;
}
CompareResult2.isGreaterThan = isGreaterThan;
function isNeitherLessOrGreaterThan(result) {
return result === 0;
}
CompareResult2.isNeitherLessOrGreaterThan = isNeitherLessOrGreaterThan;
CompareResult2.greaterThan = 1;
CompareResult2.lessThan = -1;
CompareResult2.neitherLessOrGreaterThan = 0;
})(CompareResult || (CompareResult = {}));
numberComparator = (a3, b) => a3 - b;
booleanComparator = (a3, b) => numberComparator(a3 ? 1 : 0, b ? 1 : 0);
ArrayQueue = class {
/**
* Constructs a queue that is backed by the given array. Runtime is O(1).
*/
constructor(items) {
this.items = items;
this.firstIdx = 0;
this.lastIdx = this.items.length - 1;
}
get length() {
return this.lastIdx - this.firstIdx + 1;
}
/**
* Consumes elements from the beginning of the queue as long as the predicate returns true.
* If no elements were consumed, `null` is returned. Has a runtime of O(result.length).
*/
takeWhile(predicate) {
let startIdx = this.firstIdx;
while (startIdx < this.items.length && predicate(this.items[startIdx])) {
startIdx++;
}
const result = startIdx === this.firstIdx ? null : this.items.slice(this.firstIdx, startIdx);
this.firstIdx = startIdx;
return result;
}
/**
* Consumes elements from the end of the queue as long as the predicate returns true.
* If no elements were consumed, `null` is returned.
* The result has the same order as the underlying array!
*/
takeFromEndWhile(predicate) {
let endIdx = this.lastIdx;
while (endIdx >= 0 && predicate(this.items[endIdx])) {
endIdx--;
}
const result = endIdx === this.lastIdx ? null : this.items.slice(endIdx + 1, this.lastIdx + 1);
this.lastIdx = endIdx;
return result;
}
peek() {
if (this.length === 0) {
return void 0;
}
return this.items[this.firstIdx];
}
dequeue() {
const result = this.items[this.firstIdx];
this.firstIdx++;
return result;
}
takeCount(count) {
const result = this.items.slice(this.firstIdx, this.firstIdx + count);
this.firstIdx += count;
return result;
}
};
CallbackIterable = class _CallbackIterable {
constructor(iterate) {
this.iterate = iterate;
}
toArray() {
const result = [];
this.iterate((item) => {
result.push(item);
return true;
});
return result;
}
filter(predicate) {
return new _CallbackIterable((cb) => this.iterate((item) => predicate(item) ? cb(item) : true));
}
map(mapFn) {
return new _CallbackIterable((cb) => this.iterate((item) => cb(mapFn(item))));
}
findLast(predicate) {
let result;
this.iterate((item) => {
if (predicate(item)) {
result = item;
}
return true;
});
return result;
}
findLastMaxBy(comparator) {
let result;
let first2 = true;
this.iterate((item) => {
if (first2 || CompareResult.isGreaterThan(comparator(item, result))) {
first2 = false;
result = item;
}
return true;
});
return result;
}
};
CallbackIterable.empty = new CallbackIterable((_callback) => {
});
Permutation = class _Permutation {
constructor(_indexMap) {
this._indexMap = _indexMap;
}
/**
* Returns a permutation that sorts the given array according to the given compare function.
*/
static createSortPermutation(arr, compareFn) {
const sortIndices = Array.from(arr.keys()).sort((index1, index2) => compareFn(arr[index1], arr[index2]));
return new _Permutation(sortIndices);
}
/**
* Returns a new array with the elements of the given array re-arranged according to this permutation.
*/
apply(arr) {
return arr.map((_, index) => arr[this._indexMap[index]]);
}
/**
* Returns a new permutation that undoes the re-arrangement of this permutation.
*/
inverse() {
const inverseIndexMap = this._indexMap.slice();
for (let i = 0; i < this._indexMap.length; i++) {
inverseIndexMap[this._indexMap[i]] = i;
}
return new _Permutation(inverseIndexMap);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/types.js
function isString(str) {
return typeof str === "string";
}
function isObject(obj) {
return typeof obj === "object" && obj !== null && !Array.isArray(obj) && !(obj instanceof RegExp) && !(obj instanceof Date);
}
function isTypedArray(obj) {
const TypedArray = Object.getPrototypeOf(Uint8Array);
return typeof obj === "object" && obj instanceof TypedArray;
}
function isNumber(obj) {
return typeof obj === "number" && !isNaN(obj);
}
function isIterable(obj) {
return !!obj && typeof obj[Symbol.iterator] === "function";
}
function isBoolean(obj) {
return obj === true || obj === false;
}
function isUndefined(obj) {
return typeof obj === "undefined";
}
function isDefined(arg) {
return !isUndefinedOrNull(arg);
}
function isUndefinedOrNull(obj) {
return isUndefined(obj) || obj === null;
}
function assertType(condition, type) {
if (!condition) {
throw new Error(type ? `Unexpected type, expected '${type}'` : "Unexpected type");
}
}
function assertIsDefined(arg) {
if (isUndefinedOrNull(arg)) {
throw new Error("Assertion Failed: argument is undefined or null");
}
return arg;
}
function isFunction(obj) {
return typeof obj === "function";
}
function validateConstraints(args, constraints) {
const len = Math.min(args.length, constraints.length);
for (let i = 0; i < len; i++) {
validateConstraint(args[i], constraints[i]);
}
}
function validateConstraint(arg, constraint) {
if (isString(constraint)) {
if (typeof arg !== constraint) {
throw new Error(`argument does not match constraint: typeof ${constraint}`);
}
} else if (isFunction(constraint)) {
try {
if (arg instanceof constraint) {
return;
}
} catch (_a10) {
}
if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {
return;
}
if (constraint.length === 1 && constraint.call(void 0, arg) === true) {
return;
}
throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);
}
}
var init_types = __esm({
"node_modules/monaco-editor/esm/vs/base/common/types.js"() {
}
});
// node_modules/monaco-editor/esm/vs/base/common/objects.js
function deepClone(obj) {
if (!obj || typeof obj !== "object") {
return obj;
}
if (obj instanceof RegExp) {
return obj;
}
const result = Array.isArray(obj) ? [] : {};
Object.entries(obj).forEach(([key, value]) => {
result[key] = value && typeof value === "object" ? deepClone(value) : value;
});
return result;
}
function deepFreeze(obj) {
if (!obj || typeof obj !== "object") {
return obj;
}
const stack = [obj];
while (stack.length > 0) {
const obj2 = stack.shift();
Object.freeze(obj2);
for (const key in obj2) {
if (_hasOwnProperty.call(obj2, key)) {
const prop = obj2[key];
if (typeof prop === "object" && !Object.isFrozen(prop) && !isTypedArray(prop)) {
stack.push(prop);
}
}
}
}
return obj;
}
function cloneAndChange(obj, changer) {
return _cloneAndChange(obj, changer, /* @__PURE__ */ new Set());
}
function _cloneAndChange(obj, changer, seen) {
if (isUndefinedOrNull(obj)) {
return obj;
}
const changed = changer(obj);
if (typeof changed !== "undefined") {
return changed;
}
if (Array.isArray(obj)) {
const r1 = [];
for (const e of obj) {
r1.push(_cloneAndChange(e, changer, seen));
}
return r1;
}
if (isObject(obj)) {
if (seen.has(obj)) {
throw new Error("Cannot clone recursive data-structure");
}
seen.add(obj);
const r2 = {};
for (const i2 in obj) {
if (_hasOwnProperty.call(obj, i2)) {
r2[i2] = _cloneAndChange(obj[i2], changer, seen);
}
}
seen.delete(obj);
return r2;
}
return obj;
}
function mixin(destination, source, overwrite = true) {
if (!isObject(destination)) {
return source;
}
if (isObject(source)) {
Object.keys(source).forEach((key) => {
if (key in destination) {
if (overwrite) {
if (isObject(destination[key]) && isObject(source[key])) {
mixin(destination[key], source[key], overwrite);
} else {
destination[key] = source[key];
}
}
} else {
destination[key] = source[key];
}
});
}
return destination;
}
function equals2(one, other) {
if (one === other) {
return true;
}
if (one === null || one === void 0 || other === null || other === void 0) {
return false;
}
if (typeof one !== typeof other) {
return false;
}
if (typeof one !== "object") {
return false;
}
if (Array.isArray(one) !== Array.isArray(other)) {
return false;
}
let i;
let key;
if (Array.isArray(one)) {
if (one.length !== other.length) {
return false;
}
for (i = 0; i < one.length; i++) {
if (!equals2(one[i], other[i])) {
return false;
}
}
} else {
const oneKeys = [];
for (key in one) {
oneKeys.push(key);
}
oneKeys.sort();
const otherKeys = [];
for (key in other) {
otherKeys.push(key);
}
otherKeys.sort();
if (!equals2(oneKeys, otherKeys)) {
return false;
}
for (i = 0; i < oneKeys.length; i++) {
if (!equals2(one[oneKeys[i]], other[oneKeys[i]])) {
return false;
}
}
}
return true;
}
function getAllPropertyNames(obj) {
let res = [];
while (Object.prototype !== obj) {
res = res.concat(Object.getOwnPropertyNames(obj));
obj = Object.getPrototypeOf(obj);
}
return res;
}
function getAllMethodNames(obj) {
const methods = [];
for (const prop of getAllPropertyNames(obj)) {
if (typeof obj[prop] === "function") {
methods.push(prop);
}
}
return methods;
}
function createProxyObject(methodNames, invoke) {
const createProxyMethod = (method) => {
return function() {
const args = Array.prototype.slice.call(arguments, 0);
return invoke(method, args);
};
};
const result = {};
for (const methodName of methodNames) {
result[methodName] = createProxyMethod(methodName);
}
return result;
}
var _hasOwnProperty;
var init_objects = __esm({
"node_modules/monaco-editor/esm/vs/base/common/objects.js"() {
init_types();
_hasOwnProperty = Object.prototype.hasOwnProperty;
}
});
// node_modules/monaco-editor/esm/vs/nls.js
function _format(message, args) {
let result;
if (args.length === 0) {
result = message;
} else {
result = message.replace(/\{(\d+)\}/g, (match2, rest) => {
const index = rest[0];
const arg = args[index];
let result2 = match2;
if (typeof arg === "string") {
result2 = arg;
} else if (typeof arg === "number" || typeof arg === "boolean" || arg === void 0 || arg === null) {
result2 = String(arg);
}
return result2;
});
}
if (isPseudo) {
result = "\uFF3B" + result.replace(/[aouei]/g, "$&$&") + "\uFF3D";
}
return result;
}
function localize(data, message, ...args) {
return _format(message, args);
}
function localize2(data, message, ...args) {
const original = _format(message, args);
return {
value: original,
original
};
}
function getConfiguredDefaultLocale(_) {
return void 0;
}
var isPseudo;
var init_nls = __esm({
"node_modules/monaco-editor/esm/vs/nls.js"() {
isPseudo = typeof document !== "undefined" && document.location && document.location.hash.indexOf("pseudo=true") >= 0;
}
});
// node_modules/monaco-editor/esm/vs/base/common/platform.js
function isLittleEndian() {
if (!_isLittleEndianComputed) {
_isLittleEndianComputed = true;
const test = new Uint8Array(2);
test[0] = 1;
test[1] = 2;
const view = new Uint16Array(test.buffer);
_isLittleEndian = view[0] === (2 << 8) + 1;
}
return _isLittleEndian;
}
var _a, _b, LANGUAGE_DEFAULT, _isWindows, _isMacintosh, _isLinux, _isLinuxSnap, _isNative, _isWeb, _isElectron, _isIOS, _isCI, _isMobile, _locale, _language, _platformLocale, _translationsConfigFile, _userAgent, $globalThis, nodeProcess, isElectronProcess, isElectronRenderer, _platform, isWindows, isMacintosh, isLinux, isNative, isWeb, isWebWorker, webWorkerOrigin, isIOS, isMobile, userAgent, language, setTimeout0IsFaster, setTimeout0, OS, _isLittleEndian, _isLittleEndianComputed, isChrome, isFirefox, isSafari, isEdge, isAndroid;
var init_platform = __esm({
"node_modules/monaco-editor/esm/vs/base/common/platform.js"() {
init_nls();
LANGUAGE_DEFAULT = "en";
_isWindows = false;
_isMacintosh = false;
_isLinux = false;
_isLinuxSnap = false;
_isNative = false;
_isWeb = false;
_isElectron = false;
_isIOS = false;
_isCI = false;
_isMobile = false;
_locale = void 0;
_language = LANGUAGE_DEFAULT;
_platformLocale = LANGUAGE_DEFAULT;
_translationsConfigFile = void 0;
_userAgent = void 0;
$globalThis = globalThis;
nodeProcess = void 0;
if (typeof $globalThis.vscode !== "undefined" && typeof $globalThis.vscode.process !== "undefined") {
nodeProcess = $globalThis.vscode.process;
} else if (typeof process !== "undefined" && typeof ((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) === "string") {
nodeProcess = process;
}
isElectronProcess = typeof ((_b = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.versions) === null || _b === void 0 ? void 0 : _b.electron) === "string";
isElectronRenderer = isElectronProcess && (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.type) === "renderer";
if (typeof nodeProcess === "object") {
_isWindows = nodeProcess.platform === "win32";
_isMacintosh = nodeProcess.platform === "darwin";
_isLinux = nodeProcess.platform === "linux";
_isLinuxSnap = _isLinux && !!nodeProcess.env["SNAP"] && !!nodeProcess.env["SNAP_REVISION"];
_isElectron = isElectronProcess;
_isCI = !!nodeProcess.env["CI"] || !!nodeProcess.env["BUILD_ARTIFACTSTAGINGDIRECTORY"];
_locale = LANGUAGE_DEFAULT;
_language = LANGUAGE_DEFAULT;
const rawNlsConfig = nodeProcess.env["VSCODE_NLS_CONFIG"];
if (rawNlsConfig) {
try {
const nlsConfig = JSON.parse(rawNlsConfig);
const resolved = nlsConfig.availableLanguages["*"];
_locale = nlsConfig.locale;
_platformLocale = nlsConfig.osLocale;
_language = resolved ? resolved : LANGUAGE_DEFAULT;
_translationsConfigFile = nlsConfig._translationsConfigFile;
} catch (e) {
}
}
_isNative = true;
} else if (typeof navigator === "object" && !isElectronRenderer) {
_userAgent = navigator.userAgent;
_isWindows = _userAgent.indexOf("Windows") >= 0;
_isMacintosh = _userAgent.indexOf("Macintosh") >= 0;
_isIOS = (_userAgent.indexOf("Macintosh") >= 0 || _userAgent.indexOf("iPad") >= 0 || _userAgent.indexOf("iPhone") >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
_isLinux = _userAgent.indexOf("Linux") >= 0;
_isMobile = (_userAgent === null || _userAgent === void 0 ? void 0 : _userAgent.indexOf("Mobi")) >= 0;
_isWeb = true;
const configuredLocale = getConfiguredDefaultLocale(
// This call _must_ be done in the file that calls `nls.getConfiguredDefaultLocale`
// to ensure that the NLS AMD Loader plugin has been loaded and configured.
// This is because the loader plugin decides what the default locale is based on
// how it's able to resolve the strings.
localize({ key: "ensureLoaderPluginIsLoaded", comment: ["{Locked}"] }, "_")
);
_locale = configuredLocale || LANGUAGE_DEFAULT;
_language = _locale;
_platformLocale = navigator.language;
} else {
console.error("Unable to resolve platform.");
}
_platform = 0;
if (_isMacintosh) {
_platform = 1;
} else if (_isWindows) {
_platform = 3;
} else if (_isLinux) {
_platform = 2;
}
isWindows = _isWindows;
isMacintosh = _isMacintosh;
isLinux = _isLinux;
isNative = _isNative;
isWeb = _isWeb;
isWebWorker = _isWeb && typeof $globalThis.importScripts === "function";
webWorkerOrigin = isWebWorker ? $globalThis.origin : void 0;
isIOS = _isIOS;
isMobile = _isMobile;
userAgent = _userAgent;
language = _language;
setTimeout0IsFaster = typeof $globalThis.postMessage === "function" && !$globalThis.importScripts;
setTimeout0 = (() => {
if (setTimeout0IsFaster) {
const pending = [];
$globalThis.addEventListener("message", (e) => {
if (e.data && e.data.vscodeScheduleAsyncWork) {
for (let i = 0, len = pending.length; i < len; i++) {
const candidate = pending[i];
if (candidate.id === e.data.vscodeScheduleAsyncWork) {
pending.splice(i, 1);
candidate.callback();
return;
}
}
}
});
let lastId = 0;
return (callback) => {
const myId = ++lastId;
pending.push({
id: myId,
callback
});
$globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, "*");
};
}
return (callback) => setTimeout(callback);
})();
OS = _isMacintosh || _isIOS ? 2 : _isWindows ? 1 : 3;
_isLittleEndian = true;
_isLittleEndianComputed = false;
isChrome = !!(userAgent && userAgent.indexOf("Chrome") >= 0);
isFirefox = !!(userAgent && userAgent.indexOf("Firefox") >= 0);
isSafari = !!(!isChrome && (userAgent && userAgent.indexOf("Safari") >= 0));
isEdge = !!(userAgent && userAgent.indexOf("Edg/") >= 0);
isAndroid = !!(userAgent && userAgent.indexOf("Android") >= 0);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/textModelDefaults.js
var EDITOR_MODEL_DEFAULTS;
var init_textModelDefaults = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/textModelDefaults.js"() {
EDITOR_MODEL_DEFAULTS = {
tabSize: 4,
indentSize: 4,
insertSpaces: true,
detectIndentation: true,
trimAutoWhitespace: true,
largeFileOptimizations: true,
bracketPairColorizationOptions: {
enabled: true,
independentColorPoolPerBracketType: false
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/iterator.js
var Iterable;
var init_iterator = __esm({
"node_modules/monaco-editor/esm/vs/base/common/iterator.js"() {
(function(Iterable2) {
function is(thing) {
return thing && typeof thing === "object" && typeof thing[Symbol.iterator] === "function";
}
Iterable2.is = is;
const _empty2 = Object.freeze([]);
function empty2() {
return _empty2;
}
Iterable2.empty = empty2;
function* single(element) {
yield element;
}
Iterable2.single = single;
function wrap(iterableOrElement) {
if (is(iterableOrElement)) {
return iterableOrElement;
} else {
return single(iterableOrElement);
}
}
Iterable2.wrap = wrap;
function from(iterable) {
return iterable || _empty2;
}
Iterable2.from = from;
function* reverse(array2) {
for (let i = array2.length - 1; i >= 0; i--) {
yield array2[i];
}
}
Iterable2.reverse = reverse;
function isEmpty(iterable) {
return !iterable || iterable[Symbol.iterator]().next().done === true;
}
Iterable2.isEmpty = isEmpty;
function first2(iterable) {
return iterable[Symbol.iterator]().next().value;
}
Iterable2.first = first2;
function some(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
return true;
}
}
return false;
}
Iterable2.some = some;
function find(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
return element;
}
}
return void 0;
}
Iterable2.find = find;
function* filter(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
yield element;
}
}
}
Iterable2.filter = filter;
function* map(iterable, fn) {
let index = 0;
for (const element of iterable) {
yield fn(element, index++);
}
}
Iterable2.map = map;
function* concat3(...iterables) {
for (const iterable of iterables) {
yield* __yieldStar(iterable);
}
}
Iterable2.concat = concat3;
function reduce(iterable, reducer, initialValue) {
let value = initialValue;
for (const element of iterable) {
value = reducer(value, element);
}
return value;
}
Iterable2.reduce = reduce;
function* slice(arr, from2, to = arr.length) {
if (from2 < 0) {
from2 += arr.length;
}
if (to < 0) {
to += arr.length;
} else if (to > arr.length) {
to = arr.length;
}
for (; from2 < to; from2++) {
yield arr[from2];
}
}
Iterable2.slice = slice;
function consume(iterable, atMost = Number.POSITIVE_INFINITY) {
const consumed = [];
if (atMost === 0) {
return [consumed, iterable];
}
const iterator = iterable[Symbol.iterator]();
for (let i = 0; i < atMost; i++) {
const next = iterator.next();
if (next.done) {
return [consumed, Iterable2.empty()];
}
consumed.push(next.value);
}
return [consumed, { [Symbol.iterator]() {
return iterator;
} }];
}
Iterable2.consume = consume;
function asyncToArray(iterable) {
return __async(this, null, function* () {
const result = [];
try {
for (var iter = __forAwait(iterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
result.push(item);
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
return Promise.resolve(result);
});
}
Iterable2.asyncToArray = asyncToArray;
})(Iterable || (Iterable = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/common/linkedList.js
var Node2, LinkedList;
var init_linkedList = __esm({
"node_modules/monaco-editor/esm/vs/base/common/linkedList.js"() {
Node2 = class _Node {
constructor(element) {
this.element = element;
this.next = _Node.Undefined;
this.prev = _Node.Undefined;
}
};
Node2.Undefined = new Node2(void 0);
LinkedList = class {
constructor() {
this._first = Node2.Undefined;
this._last = Node2.Undefined;
this._size = 0;
}
get size() {
return this._size;
}
isEmpty() {
return this._first === Node2.Undefined;
}
clear() {
let node = this._first;
while (node !== Node2.Undefined) {
const next = node.next;
node.prev = Node2.Undefined;
node.next = Node2.Undefined;
node = next;
}
this._first = Node2.Undefined;
this._last = Node2.Undefined;
this._size = 0;
}
unshift(element) {
return this._insert(element, false);
}
push(element) {
return this._insert(element, true);
}
_insert(element, atTheEnd) {
const newNode = new Node2(element);
if (this._first === Node2.Undefined) {
this._first = newNode;
this._last = newNode;
} else if (atTheEnd) {
const oldLast = this._last;
this._last = newNode;
newNode.prev = oldLast;
oldLast.next = newNode;
} else {
const oldFirst = this._first;
this._first = newNode;
newNode.next = oldFirst;
oldFirst.prev = newNode;
}
this._size += 1;
let didRemove = false;
return () => {
if (!didRemove) {
didRemove = true;
this._remove(newNode);
}
};
}
shift() {
if (this._first === Node2.Undefined) {
return void 0;
} else {
const res = this._first.element;
this._remove(this._first);
return res;
}
}
pop() {
if (this._last === Node2.Undefined) {
return void 0;
} else {
const res = this._last.element;
this._remove(this._last);
return res;
}
}
_remove(node) {
if (node.prev !== Node2.Undefined && node.next !== Node2.Undefined) {
const anchor = node.prev;
anchor.next = node.next;
node.next.prev = anchor;
} else if (node.prev === Node2.Undefined && node.next === Node2.Undefined) {
this._first = Node2.Undefined;
this._last = Node2.Undefined;
} else if (node.next === Node2.Undefined) {
this._last = this._last.prev;
this._last.next = Node2.Undefined;
} else if (node.prev === Node2.Undefined) {
this._first = this._first.next;
this._first.prev = Node2.Undefined;
}
this._size -= 1;
}
*[Symbol.iterator]() {
let node = this._first;
while (node !== Node2.Undefined) {
yield node.element;
node = node.next;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/wordHelper.js
function createWordRegExp(allowInWords = "") {
let source = "(-?\\d*\\.\\d\\w*)|([^";
for (const sep2 of USUAL_WORD_SEPARATORS) {
if (allowInWords.indexOf(sep2) >= 0) {
continue;
}
source += "\\" + sep2;
}
source += "\\s]+)";
return new RegExp(source, "g");
}
function ensureValidWordDefinition(wordDefinition) {
let result = DEFAULT_WORD_REGEXP;
if (wordDefinition && wordDefinition instanceof RegExp) {
if (!wordDefinition.global) {
let flags = "g";
if (wordDefinition.ignoreCase) {
flags += "i";
}
if (wordDefinition.multiline) {
flags += "m";
}
if (wordDefinition.unicode) {
flags += "u";
}
result = new RegExp(wordDefinition.source, flags);
} else {
result = wordDefinition;
}
}
result.lastIndex = 0;
return result;
}
function getWordAtText(column, wordDefinition, text2, textOffset, config) {
wordDefinition = ensureValidWordDefinition(wordDefinition);
if (!config) {
config = Iterable.first(_defaultConfig);
}
if (text2.length > config.maxLen) {
let start = column - config.maxLen / 2;
if (start < 0) {
start = 0;
} else {
textOffset += start;
}
text2 = text2.substring(start, column + config.maxLen / 2);
return getWordAtText(column, wordDefinition, text2, textOffset, config);
}
const t1 = Date.now();
const pos = column - 1 - textOffset;
let prevRegexIndex = -1;
let match2 = null;
for (let i = 1; ; i++) {
if (Date.now() - t1 >= config.timeBudget) {
break;
}
const regexIndex = pos - config.windowSize * i;
wordDefinition.lastIndex = Math.max(0, regexIndex);
const thisMatch = _findRegexMatchEnclosingPosition(wordDefinition, text2, pos, prevRegexIndex);
if (!thisMatch && match2) {
break;
}
match2 = thisMatch;
if (regexIndex <= 0) {
break;
}
prevRegexIndex = regexIndex;
}
if (match2) {
const result = {
word: match2[0],
startColumn: textOffset + 1 + match2.index,
endColumn: textOffset + 1 + match2.index + match2[0].length
};
wordDefinition.lastIndex = 0;
return result;
}
return null;
}
function _findRegexMatchEnclosingPosition(wordDefinition, text2, pos, stopPos) {
let match2;
while (match2 = wordDefinition.exec(text2)) {
const matchIndex = match2.index || 0;
if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {
return match2;
} else if (stopPos > 0 && matchIndex > stopPos) {
return null;
}
}
return null;
}
var USUAL_WORD_SEPARATORS, DEFAULT_WORD_REGEXP, _defaultConfig;
var init_wordHelper = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/wordHelper.js"() {
init_iterator();
init_linkedList();
USUAL_WORD_SEPARATORS = "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";
DEFAULT_WORD_REGEXP = createWordRegExp();
_defaultConfig = new LinkedList();
_defaultConfig.unshift({
maxLen: 1e3,
windowSize: 15,
timeBudget: 150
});
}
});
// node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js
function applyUpdate(value, update) {
if (typeof value !== "object" || typeof update !== "object" || !value || !update) {
return new ApplyUpdateResult(update, value !== update);
}
if (Array.isArray(value) || Array.isArray(update)) {
const arrayEquals = Array.isArray(value) && Array.isArray(update) && equals(value, update);
return new ApplyUpdateResult(update, !arrayEquals);
}
let didChange = false;
for (const key in update) {
if (update.hasOwnProperty(key)) {
const result = applyUpdate(value[key], update[key]);
if (result.didChange) {
value[key] = result.newValue;
didChange = true;
}
}
}
return new ApplyUpdateResult(value, didChange);
}
function boolean(value, defaultValue) {
if (typeof value === "undefined") {
return defaultValue;
}
if (value === "false") {
return false;
}
return Boolean(value);
}
function clampedInt(value, defaultValue, minimum, maximum) {
if (typeof value === "undefined") {
return defaultValue;
}
let r = parseInt(value, 10);
if (isNaN(r)) {
return defaultValue;
}
r = Math.max(minimum, r);
r = Math.min(maximum, r);
return r | 0;
}
function clampedFloat(value, defaultValue, minimum, maximum) {
if (typeof value === "undefined") {
return defaultValue;
}
const r = EditorFloatOption.float(value, defaultValue);
return EditorFloatOption.clamp(r, minimum, maximum);
}
function stringSet(value, defaultValue, allowedValues, renamedValues) {
if (typeof value !== "string") {
return defaultValue;
}
if (renamedValues && value in renamedValues) {
return renamedValues[value];
}
if (allowedValues.indexOf(value) === -1) {
return defaultValue;
}
return value;
}
function _autoIndentFromString(autoIndent) {
switch (autoIndent) {
case "none":
return 0;
case "keep":
return 1;
case "brackets":
return 2;
case "advanced":
return 3;
case "full":
return 4;
}
}
function _cursorBlinkingStyleFromString(cursorBlinkingStyle) {
switch (cursorBlinkingStyle) {
case "blink":
return 1;
case "smooth":
return 2;
case "phase":
return 3;
case "expand":
return 4;
case "solid":
return 5;
}
}
function _cursorStyleFromString(cursorStyle) {
switch (cursorStyle) {
case "line":
return TextEditorCursorStyle.Line;
case "block":
return TextEditorCursorStyle.Block;
case "underline":
return TextEditorCursorStyle.Underline;
case "line-thin":
return TextEditorCursorStyle.LineThin;
case "block-outline":
return TextEditorCursorStyle.BlockOutline;
case "underline-thin":
return TextEditorCursorStyle.UnderlineThin;
}
}
function _multiCursorModifierFromString(multiCursorModifier) {
if (multiCursorModifier === "ctrlCmd") {
return isMacintosh ? "metaKey" : "ctrlKey";
}
return "altKey";
}
function filterValidationDecorations(options2) {
const renderValidationDecorations = options2.get(
98
/* EditorOption.renderValidationDecorations */
);
if (renderValidationDecorations === "editable") {
return options2.get(
91
/* EditorOption.readOnly */
);
}
return renderValidationDecorations === "on" ? false : true;
}
function _scrollbarVisibilityFromString(visibility, defaultValue) {
if (typeof visibility !== "string") {
return defaultValue;
}
switch (visibility) {
case "hidden":
return 2;
case "visible":
return 3;
default:
return 1;
}
}
function primitiveSet(value, defaultValue, allowedValues) {
const idx = allowedValues.indexOf(value);
if (idx === -1) {
return defaultValue;
}
return allowedValues[idx];
}
function register(option) {
editorOptionsRegistry[option.id] = option;
return option;
}
var MINIMAP_GUTTER_WIDTH, ConfigurationChangedEvent, ComputeOptionsMemory, BaseEditorOption, ApplyUpdateResult, ComputedEditorOption, SimpleEditorOption, EditorBooleanOption, EditorIntOption, EditorFloatOption, EditorStringOption, EditorStringEnumOption, EditorEnumOption, EditorAccessibilitySupport, EditorComments, TextEditorCursorStyle, EditorClassName, EditorEmptySelectionClipboard, EditorFind, EditorFontLigatures, EditorFontVariations, EditorFontInfo, EditorFontSize, EditorFontWeight, EditorGoToLocation, EditorHover, EditorLayoutInfoComputer, WrappingStrategy, ShowLightbulbIconMode, EditorLightbulb, EditorStickyScroll, EditorInlayHints, EditorLineDecorationsWidth, EditorLineHeight, EditorMinimap, EditorPadding, EditorParameterHints, EditorPixelRatio, EditorQuickSuggestions, EditorRenderLineNumbersOption, EditorRulers, ReadonlyMessage, EditorScrollbar, inUntrustedWorkspace, unicodeHighlightConfigKeys, UnicodeHighlight, InlineEditorSuggest, InlineEditorEdit, BracketPairColorization, GuideOptions, EditorSuggest, SmartSelect, WordSegmenterLocales, WrappingIndentOption, EditorWrappingInfoComputer, EditorDropIntoEditor, EditorPasteAs, DEFAULT_WINDOWS_FONT_FAMILY, DEFAULT_MAC_FONT_FAMILY, DEFAULT_LINUX_FONT_FAMILY, EDITOR_FONT_DEFAULTS, editorOptionsRegistry, EditorOptions;
var init_editorOptions = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js"() {
init_arrays();
init_objects();
init_platform();
init_textModelDefaults();
init_wordHelper();
init_nls();
MINIMAP_GUTTER_WIDTH = 8;
ConfigurationChangedEvent = class {
/**
* @internal
*/
constructor(values2) {
this._values = values2;
}
hasChanged(id) {
return this._values[id];
}
};
ComputeOptionsMemory = class {
constructor() {
this.stableMinimapLayoutInput = null;
this.stableFitMaxMinimapScale = 0;
this.stableFitRemainingWidth = 0;
}
};
BaseEditorOption = class {
constructor(id, name, defaultValue, schema) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.schema = schema;
}
applyUpdate(value, update) {
return applyUpdate(value, update);
}
compute(env2, options2, value) {
return value;
}
};
ApplyUpdateResult = class {
constructor(newValue, didChange) {
this.newValue = newValue;
this.didChange = didChange;
}
};
ComputedEditorOption = class {
constructor(id) {
this.schema = void 0;
this.id = id;
this.name = "_never_";
this.defaultValue = void 0;
}
applyUpdate(value, update) {
return applyUpdate(value, update);
}
validate(input) {
return this.defaultValue;
}
};
SimpleEditorOption = class {
constructor(id, name, defaultValue, schema) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.schema = schema;
}
applyUpdate(value, update) {
return applyUpdate(value, update);
}
validate(input) {
if (typeof input === "undefined") {
return this.defaultValue;
}
return input;
}
compute(env2, options2, value) {
return value;
}
};
EditorBooleanOption = class extends SimpleEditorOption {
constructor(id, name, defaultValue, schema = void 0) {
if (typeof schema !== "undefined") {
schema.type = "boolean";
schema.default = defaultValue;
}
super(id, name, defaultValue, schema);
}
validate(input) {
return boolean(input, this.defaultValue);
}
};
EditorIntOption = class _EditorIntOption extends SimpleEditorOption {
static clampedInt(value, defaultValue, minimum, maximum) {
return clampedInt(value, defaultValue, minimum, maximum);
}
constructor(id, name, defaultValue, minimum, maximum, schema = void 0) {
if (typeof schema !== "undefined") {
schema.type = "integer";
schema.default = defaultValue;
schema.minimum = minimum;
schema.maximum = maximum;
}
super(id, name, defaultValue, schema);
this.minimum = minimum;
this.maximum = maximum;
}
validate(input) {
return _EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);
}
};
EditorFloatOption = class _EditorFloatOption extends SimpleEditorOption {
static clamp(n, min, max) {
if (n < min) {
return min;
}
if (n > max) {
return max;
}
return n;
}
static float(value, defaultValue) {
if (typeof value === "number") {
return value;
}
if (typeof value === "undefined") {
return defaultValue;
}
const r = parseFloat(value);
return isNaN(r) ? defaultValue : r;
}
constructor(id, name, defaultValue, validationFn, schema) {
if (typeof schema !== "undefined") {
schema.type = "number";
schema.default = defaultValue;
}
super(id, name, defaultValue, schema);
this.validationFn = validationFn;
}
validate(input) {
return this.validationFn(_EditorFloatOption.float(input, this.defaultValue));
}
};
EditorStringOption = class _EditorStringOption extends SimpleEditorOption {
static string(value, defaultValue) {
if (typeof value !== "string") {
return defaultValue;
}
return value;
}
constructor(id, name, defaultValue, schema = void 0) {
if (typeof schema !== "undefined") {
schema.type = "string";
schema.default = defaultValue;
}
super(id, name, defaultValue, schema);
}
validate(input) {
return _EditorStringOption.string(input, this.defaultValue);
}
};
EditorStringEnumOption = class extends SimpleEditorOption {
constructor(id, name, defaultValue, allowedValues, schema = void 0) {
if (typeof schema !== "undefined") {
schema.type = "string";
schema.enum = allowedValues;
schema.default = defaultValue;
}
super(id, name, defaultValue, schema);
this._allowedValues = allowedValues;
}
validate(input) {
return stringSet(input, this.defaultValue, this._allowedValues);
}
};
EditorEnumOption = class extends BaseEditorOption {
constructor(id, name, defaultValue, defaultStringValue, allowedValues, convert, schema = void 0) {
if (typeof schema !== "undefined") {
schema.type = "string";
schema.enum = allowedValues;
schema.default = defaultStringValue;
}
super(id, name, defaultValue, schema);
this._allowedValues = allowedValues;
this._convert = convert;
}
validate(input) {
if (typeof input !== "string") {
return this.defaultValue;
}
if (this._allowedValues.indexOf(input) === -1) {
return this.defaultValue;
}
return this._convert(input);
}
};
EditorAccessibilitySupport = class extends BaseEditorOption {
constructor() {
super(2, "accessibilitySupport", 0, {
type: "string",
enum: ["auto", "on", "off"],
enumDescriptions: [
localize("accessibilitySupport.auto", "Use platform APIs to detect when a Screen Reader is attached."),
localize("accessibilitySupport.on", "Optimize for usage with a Screen Reader."),
localize("accessibilitySupport.off", "Assume a screen reader is not attached.")
],
default: "auto",
tags: ["accessibility"],
description: localize("accessibilitySupport", "Controls if the UI should run in a mode where it is optimized for screen readers.")
});
}
validate(input) {
switch (input) {
case "auto":
return 0;
case "off":
return 1;
case "on":
return 2;
}
return this.defaultValue;
}
compute(env2, options2, value) {
if (value === 0) {
return env2.accessibilitySupport;
}
return value;
}
};
EditorComments = class extends BaseEditorOption {
constructor() {
const defaults = {
insertSpace: true,
ignoreEmptyLines: true
};
super(23, "comments", defaults, {
"editor.comments.insertSpace": {
type: "boolean",
default: defaults.insertSpace,
description: localize("comments.insertSpace", "Controls whether a space character is inserted when commenting.")
},
"editor.comments.ignoreEmptyLines": {
type: "boolean",
default: defaults.ignoreEmptyLines,
description: localize("comments.ignoreEmptyLines", "Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
insertSpace: boolean(input.insertSpace, this.defaultValue.insertSpace),
ignoreEmptyLines: boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines)
};
}
};
(function(TextEditorCursorStyle3) {
TextEditorCursorStyle3[TextEditorCursorStyle3["Line"] = 1] = "Line";
TextEditorCursorStyle3[TextEditorCursorStyle3["Block"] = 2] = "Block";
TextEditorCursorStyle3[TextEditorCursorStyle3["Underline"] = 3] = "Underline";
TextEditorCursorStyle3[TextEditorCursorStyle3["LineThin"] = 4] = "LineThin";
TextEditorCursorStyle3[TextEditorCursorStyle3["BlockOutline"] = 5] = "BlockOutline";
TextEditorCursorStyle3[TextEditorCursorStyle3["UnderlineThin"] = 6] = "UnderlineThin";
})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));
EditorClassName = class extends ComputedEditorOption {
constructor() {
super(
142
/* EditorOption.editorClassName */
);
}
compute(env2, options2, _) {
const classNames = ["monaco-editor"];
if (options2.get(
39
/* EditorOption.extraEditorClassName */
)) {
classNames.push(options2.get(
39
/* EditorOption.extraEditorClassName */
));
}
if (env2.extraEditorClassName) {
classNames.push(env2.extraEditorClassName);
}
if (options2.get(
74
/* EditorOption.mouseStyle */
) === "default") {
classNames.push("mouse-default");
} else if (options2.get(
74
/* EditorOption.mouseStyle */
) === "copy") {
classNames.push("mouse-copy");
}
if (options2.get(
111
/* EditorOption.showUnused */
)) {
classNames.push("showUnused");
}
if (options2.get(
140
/* EditorOption.showDeprecated */
)) {
classNames.push("showDeprecated");
}
return classNames.join(" ");
}
};
EditorEmptySelectionClipboard = class extends EditorBooleanOption {
constructor() {
super(37, "emptySelectionClipboard", true, { description: localize("emptySelectionClipboard", "Controls whether copying without a selection copies the current line.") });
}
compute(env2, options2, value) {
return value && env2.emptySelectionClipboard;
}
};
EditorFind = class extends BaseEditorOption {
constructor() {
const defaults = {
cursorMoveOnType: true,
seedSearchStringFromSelection: "always",
autoFindInSelection: "never",
globalFindClipboard: false,
addExtraSpaceOnTop: true,
loop: true
};
super(41, "find", defaults, {
"editor.find.cursorMoveOnType": {
type: "boolean",
default: defaults.cursorMoveOnType,
description: localize("find.cursorMoveOnType", "Controls whether the cursor should jump to find matches while typing.")
},
"editor.find.seedSearchStringFromSelection": {
type: "string",
enum: ["never", "always", "selection"],
default: defaults.seedSearchStringFromSelection,
enumDescriptions: [
localize("editor.find.seedSearchStringFromSelection.never", "Never seed search string from the editor selection."),
localize("editor.find.seedSearchStringFromSelection.always", "Always seed search string from the editor selection, including word at cursor position."),
localize("editor.find.seedSearchStringFromSelection.selection", "Only seed search string from the editor selection.")
],
description: localize("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: defaults.autoFindInSelection,
enumDescriptions: [
localize("editor.find.autoFindInSelection.never", "Never turn on Find in Selection automatically (default)."),
localize("editor.find.autoFindInSelection.always", "Always turn on Find in Selection automatically."),
localize("editor.find.autoFindInSelection.multiline", "Turn on Find in Selection automatically when multiple lines of content are selected.")
],
description: localize("find.autoFindInSelection", "Controls the condition for turning on Find in Selection automatically.")
},
"editor.find.globalFindClipboard": {
type: "boolean",
default: defaults.globalFindClipboard,
description: localize("find.globalFindClipboard", "Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),
included: isMacintosh
},
"editor.find.addExtraSpaceOnTop": {
type: "boolean",
default: defaults.addExtraSpaceOnTop,
description: 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.")
},
"editor.find.loop": {
type: "boolean",
default: defaults.loop,
description: localize("find.loop", "Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
cursorMoveOnType: boolean(input.cursorMoveOnType, this.defaultValue.cursorMoveOnType),
seedSearchStringFromSelection: typeof _input.seedSearchStringFromSelection === "boolean" ? _input.seedSearchStringFromSelection ? "always" : "never" : stringSet(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection, ["never", "always", "selection"]),
autoFindInSelection: typeof _input.autoFindInSelection === "boolean" ? _input.autoFindInSelection ? "always" : "never" : stringSet(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ["never", "always", "multiline"]),
globalFindClipboard: boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),
addExtraSpaceOnTop: boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop),
loop: boolean(input.loop, this.defaultValue.loop)
};
}
};
EditorFontLigatures = class _EditorFontLigatures extends BaseEditorOption {
constructor() {
super(51, "fontLigatures", _EditorFontLigatures.OFF, {
anyOf: [
{
type: "boolean",
description: 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.")
},
{
type: "string",
description: localize("fontFeatureSettings", "Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")
}
],
description: 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."),
default: false
});
}
validate(input) {
if (typeof input === "undefined") {
return this.defaultValue;
}
if (typeof input === "string") {
if (input === "false" || input.length === 0) {
return _EditorFontLigatures.OFF;
}
if (input === "true") {
return _EditorFontLigatures.ON;
}
return input;
}
if (Boolean(input)) {
return _EditorFontLigatures.ON;
}
return _EditorFontLigatures.OFF;
}
};
EditorFontLigatures.OFF = '"liga" off, "calt" off';
EditorFontLigatures.ON = '"liga" on, "calt" on';
EditorFontVariations = class _EditorFontVariations extends BaseEditorOption {
constructor() {
super(54, "fontVariations", _EditorFontVariations.OFF, {
anyOf: [
{
type: "boolean",
description: 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.")
},
{
type: "string",
description: 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.")
}
],
description: 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."),
default: false
});
}
validate(input) {
if (typeof input === "undefined") {
return this.defaultValue;
}
if (typeof input === "string") {
if (input === "false") {
return _EditorFontVariations.OFF;
}
if (input === "true") {
return _EditorFontVariations.TRANSLATE;
}
return input;
}
if (Boolean(input)) {
return _EditorFontVariations.TRANSLATE;
}
return _EditorFontVariations.OFF;
}
compute(env2, options2, value) {
return env2.fontInfo.fontVariationSettings;
}
};
EditorFontVariations.OFF = "normal";
EditorFontVariations.TRANSLATE = "translate";
EditorFontInfo = class extends ComputedEditorOption {
constructor() {
super(
50
/* EditorOption.fontInfo */
);
}
compute(env2, options2, _) {
return env2.fontInfo;
}
};
EditorFontSize = class extends SimpleEditorOption {
constructor() {
super(52, "fontSize", EDITOR_FONT_DEFAULTS.fontSize, {
type: "number",
minimum: 6,
maximum: 100,
default: EDITOR_FONT_DEFAULTS.fontSize,
description: localize("fontSize", "Controls the font size in pixels.")
});
}
validate(input) {
const r = EditorFloatOption.float(input, this.defaultValue);
if (r === 0) {
return EDITOR_FONT_DEFAULTS.fontSize;
}
return EditorFloatOption.clamp(r, 6, 100);
}
compute(env2, options2, value) {
return env2.fontInfo.fontSize;
}
};
EditorFontWeight = class _EditorFontWeight extends BaseEditorOption {
constructor() {
super(53, "fontWeight", EDITOR_FONT_DEFAULTS.fontWeight, {
anyOf: [
{
type: "number",
minimum: _EditorFontWeight.MINIMUM_VALUE,
maximum: _EditorFontWeight.MAXIMUM_VALUE,
errorMessage: localize("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: _EditorFontWeight.SUGGESTION_VALUES
}
],
default: EDITOR_FONT_DEFAULTS.fontWeight,
description: localize("fontWeight", 'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')
});
}
validate(input) {
if (input === "normal" || input === "bold") {
return input;
}
return String(EditorIntOption.clampedInt(input, EDITOR_FONT_DEFAULTS.fontWeight, _EditorFontWeight.MINIMUM_VALUE, _EditorFontWeight.MAXIMUM_VALUE));
}
};
EditorFontWeight.SUGGESTION_VALUES = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
EditorFontWeight.MINIMUM_VALUE = 1;
EditorFontWeight.MAXIMUM_VALUE = 1e3;
EditorGoToLocation = class extends BaseEditorOption {
constructor() {
const defaults = {
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: ""
};
const jsonSubset = {
type: "string",
enum: ["peek", "gotoAndPeek", "goto"],
default: defaults.multiple,
enumDescriptions: [
localize("editor.gotoLocation.multiple.peek", "Show Peek view of the results (default)"),
localize("editor.gotoLocation.multiple.gotoAndPeek", "Go to the primary result and show a Peek view"),
localize("editor.gotoLocation.multiple.goto", "Go to the primary result and enable Peek-less navigation to others")
]
};
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"];
super(58, "gotoLocation", defaults, {
"editor.gotoLocation.multiple": {
deprecationMessage: localize("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": __spreadValues({
description: localize("editor.editor.gotoLocation.multipleDefinitions", "Controls the behavior the 'Go to Definition'-command when multiple target locations exist.")
}, jsonSubset),
"editor.gotoLocation.multipleTypeDefinitions": __spreadValues({
description: localize("editor.editor.gotoLocation.multipleTypeDefinitions", "Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.")
}, jsonSubset),
"editor.gotoLocation.multipleDeclarations": __spreadValues({
description: localize("editor.editor.gotoLocation.multipleDeclarations", "Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.")
}, jsonSubset),
"editor.gotoLocation.multipleImplementations": __spreadValues({
description: localize("editor.editor.gotoLocation.multipleImplemenattions", "Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.")
}, jsonSubset),
"editor.gotoLocation.multipleReferences": __spreadValues({
description: localize("editor.editor.gotoLocation.multipleReferences", "Controls the behavior the 'Go to References'-command when multiple target locations exist.")
}, jsonSubset),
"editor.gotoLocation.alternativeDefinitionCommand": {
type: "string",
default: defaults.alternativeDefinitionCommand,
enum: alternativeCommandOptions,
description: localize("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: defaults.alternativeTypeDefinitionCommand,
enum: alternativeCommandOptions,
description: localize("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: defaults.alternativeDeclarationCommand,
enum: alternativeCommandOptions,
description: localize("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: defaults.alternativeImplementationCommand,
enum: alternativeCommandOptions,
description: localize("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: defaults.alternativeReferenceCommand,
enum: alternativeCommandOptions,
description: localize("alternativeReferenceCommand", "Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")
}
});
}
validate(_input) {
var _a10, _b4, _c2, _d2, _e2;
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
multiple: stringSet(input.multiple, this.defaultValue.multiple, ["peek", "gotoAndPeek", "goto"]),
multipleDefinitions: (_a10 = input.multipleDefinitions) !== null && _a10 !== void 0 ? _a10 : stringSet(input.multipleDefinitions, "peek", ["peek", "gotoAndPeek", "goto"]),
multipleTypeDefinitions: (_b4 = input.multipleTypeDefinitions) !== null && _b4 !== void 0 ? _b4 : stringSet(input.multipleTypeDefinitions, "peek", ["peek", "gotoAndPeek", "goto"]),
multipleDeclarations: (_c2 = input.multipleDeclarations) !== null && _c2 !== void 0 ? _c2 : stringSet(input.multipleDeclarations, "peek", ["peek", "gotoAndPeek", "goto"]),
multipleImplementations: (_d2 = input.multipleImplementations) !== null && _d2 !== void 0 ? _d2 : stringSet(input.multipleImplementations, "peek", ["peek", "gotoAndPeek", "goto"]),
multipleReferences: (_e2 = input.multipleReferences) !== null && _e2 !== void 0 ? _e2 : stringSet(input.multipleReferences, "peek", ["peek", "gotoAndPeek", "goto"]),
alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand),
alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand),
alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand),
alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand),
alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand)
};
}
};
EditorHover = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: true,
delay: 300,
hidingDelay: 300,
sticky: true,
above: true
};
super(60, "hover", defaults, {
"editor.hover.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("hover.enabled", "Controls whether the hover is shown.")
},
"editor.hover.delay": {
type: "number",
default: defaults.delay,
minimum: 0,
maximum: 1e4,
description: localize("hover.delay", "Controls the delay in milliseconds after which the hover is shown.")
},
"editor.hover.sticky": {
type: "boolean",
default: defaults.sticky,
description: localize("hover.sticky", "Controls whether the hover should remain visible when mouse is moved over it.")
},
"editor.hover.hidingDelay": {
type: "integer",
minimum: 0,
default: defaults.hidingDelay,
description: localize("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: defaults.above,
description: localize("hover.above", "Prefer showing hovers above the line, if there's space.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 1e4),
sticky: boolean(input.sticky, this.defaultValue.sticky),
hidingDelay: EditorIntOption.clampedInt(input.hidingDelay, this.defaultValue.hidingDelay, 0, 6e5),
above: boolean(input.above, this.defaultValue.above)
};
}
};
EditorLayoutInfoComputer = class _EditorLayoutInfoComputer extends ComputedEditorOption {
constructor() {
super(
145
/* EditorOption.layoutInfo */
);
}
compute(env2, options2, _) {
return _EditorLayoutInfoComputer.computeLayout(options2, {
memory: env2.memory,
outerWidth: env2.outerWidth,
outerHeight: env2.outerHeight,
isDominatedByLongLines: env2.isDominatedByLongLines,
lineHeight: env2.fontInfo.lineHeight,
viewLineCount: env2.viewLineCount,
lineNumbersDigitCount: env2.lineNumbersDigitCount,
typicalHalfwidthCharacterWidth: env2.fontInfo.typicalHalfwidthCharacterWidth,
maxDigitWidth: env2.fontInfo.maxDigitWidth,
pixelRatio: env2.pixelRatio,
glyphMarginDecorationLaneCount: env2.glyphMarginDecorationLaneCount
});
}
static computeContainedMinimapLineCount(input) {
const typicalViewportLineCount = input.height / input.lineHeight;
const extraLinesBeforeFirstLine = Math.floor(input.paddingTop / input.lineHeight);
let extraLinesBeyondLastLine = Math.floor(input.paddingBottom / input.lineHeight);
if (input.scrollBeyondLastLine) {
extraLinesBeyondLastLine = Math.max(extraLinesBeyondLastLine, typicalViewportLineCount - 1);
}
const desiredRatio = (extraLinesBeforeFirstLine + input.viewLineCount + extraLinesBeyondLastLine) / (input.pixelRatio * input.height);
const minimapLineCount = Math.floor(input.viewLineCount / desiredRatio);
return { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount };
}
static _computeMinimapLayout(input, memory) {
const outerWidth = input.outerWidth;
const outerHeight = input.outerHeight;
const pixelRatio = input.pixelRatio;
if (!input.minimap.enabled) {
return {
renderMinimap: 0,
minimapLeft: 0,
minimapWidth: 0,
minimapHeightIsEditorHeight: false,
minimapIsSampling: false,
minimapScale: 1,
minimapLineHeight: 1,
minimapCanvasInnerWidth: 0,
minimapCanvasInnerHeight: Math.floor(pixelRatio * outerHeight),
minimapCanvasOuterWidth: 0,
minimapCanvasOuterHeight: outerHeight
};
}
const stableMinimapLayoutInput = memory.stableMinimapLayoutInput;
const couldUseMemory = stableMinimapLayoutInput && input.outerHeight === stableMinimapLayoutInput.outerHeight && input.lineHeight === stableMinimapLayoutInput.lineHeight && input.typicalHalfwidthCharacterWidth === stableMinimapLayoutInput.typicalHalfwidthCharacterWidth && input.pixelRatio === stableMinimapLayoutInput.pixelRatio && input.scrollBeyondLastLine === stableMinimapLayoutInput.scrollBeyondLastLine && input.paddingTop === stableMinimapLayoutInput.paddingTop && input.paddingBottom === stableMinimapLayoutInput.paddingBottom && input.minimap.enabled === stableMinimapLayoutInput.minimap.enabled && input.minimap.side === stableMinimapLayoutInput.minimap.side && input.minimap.size === stableMinimapLayoutInput.minimap.size && input.minimap.showSlider === stableMinimapLayoutInput.minimap.showSlider && input.minimap.renderCharacters === stableMinimapLayoutInput.minimap.renderCharacters && input.minimap.maxColumn === stableMinimapLayoutInput.minimap.maxColumn && input.minimap.scale === stableMinimapLayoutInput.minimap.scale && input.verticalScrollbarWidth === stableMinimapLayoutInput.verticalScrollbarWidth && input.isViewportWrapping === stableMinimapLayoutInput.isViewportWrapping;
const lineHeight = input.lineHeight;
const typicalHalfwidthCharacterWidth = input.typicalHalfwidthCharacterWidth;
const scrollBeyondLastLine = input.scrollBeyondLastLine;
const minimapRenderCharacters = input.minimap.renderCharacters;
let minimapScale = pixelRatio >= 2 ? Math.round(input.minimap.scale * 2) : input.minimap.scale;
const minimapMaxColumn = input.minimap.maxColumn;
const minimapSize = input.minimap.size;
const minimapSide = input.minimap.side;
const verticalScrollbarWidth = input.verticalScrollbarWidth;
const viewLineCount = input.viewLineCount;
const remainingWidth = input.remainingWidth;
const isViewportWrapping = input.isViewportWrapping;
const baseCharHeight = minimapRenderCharacters ? 2 : 3;
let minimapCanvasInnerHeight = Math.floor(pixelRatio * outerHeight);
const minimapCanvasOuterHeight = minimapCanvasInnerHeight / pixelRatio;
let minimapHeightIsEditorHeight = false;
let minimapIsSampling = false;
let minimapLineHeight = baseCharHeight * minimapScale;
let minimapCharWidth = minimapScale / pixelRatio;
let minimapWidthMultiplier = 1;
if (minimapSize === "fill" || minimapSize === "fit") {
const { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = _EditorLayoutInfoComputer.computeContainedMinimapLineCount({
viewLineCount,
scrollBeyondLastLine,
paddingTop: input.paddingTop,
paddingBottom: input.paddingBottom,
height: outerHeight,
lineHeight,
pixelRatio
});
const ratio = viewLineCount / minimapLineCount;
if (ratio > 1) {
minimapHeightIsEditorHeight = true;
minimapIsSampling = true;
minimapScale = 1;
minimapLineHeight = 1;
minimapCharWidth = minimapScale / pixelRatio;
} else {
let fitBecomesFill = false;
let maxMinimapScale = minimapScale + 1;
if (minimapSize === "fit") {
const effectiveMinimapHeight = Math.ceil((extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);
if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {
fitBecomesFill = true;
maxMinimapScale = memory.stableFitMaxMinimapScale;
} else {
fitBecomesFill = effectiveMinimapHeight > minimapCanvasInnerHeight;
}
}
if (minimapSize === "fill" || fitBecomesFill) {
minimapHeightIsEditorHeight = true;
const configuredMinimapScale = minimapScale;
minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));
if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {
maxMinimapScale = memory.stableFitMaxMinimapScale;
}
minimapScale = Math.min(maxMinimapScale, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight)));
if (minimapScale > configuredMinimapScale) {
minimapWidthMultiplier = Math.min(2, minimapScale / configuredMinimapScale);
}
minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier;
minimapCanvasInnerHeight = Math.ceil(Math.max(typicalViewportLineCount, extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);
if (isViewportWrapping) {
memory.stableMinimapLayoutInput = input;
memory.stableFitRemainingWidth = remainingWidth;
memory.stableFitMaxMinimapScale = minimapScale;
} else {
memory.stableMinimapLayoutInput = null;
memory.stableFitRemainingWidth = 0;
}
}
}
}
const minimapMaxWidth = Math.floor(minimapMaxColumn * minimapCharWidth);
const minimapWidth = Math.min(minimapMaxWidth, Math.max(0, Math.floor((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH);
let minimapCanvasInnerWidth = Math.floor(pixelRatio * minimapWidth);
const minimapCanvasOuterWidth = minimapCanvasInnerWidth / pixelRatio;
minimapCanvasInnerWidth = Math.floor(minimapCanvasInnerWidth * minimapWidthMultiplier);
const renderMinimap = minimapRenderCharacters ? 1 : 2;
const minimapLeft = minimapSide === "left" ? 0 : outerWidth - minimapWidth - verticalScrollbarWidth;
return {
renderMinimap,
minimapLeft,
minimapWidth,
minimapHeightIsEditorHeight,
minimapIsSampling,
minimapScale,
minimapLineHeight,
minimapCanvasInnerWidth,
minimapCanvasInnerHeight,
minimapCanvasOuterWidth,
minimapCanvasOuterHeight
};
}
static computeLayout(options2, env2) {
const outerWidth = env2.outerWidth | 0;
const outerHeight = env2.outerHeight | 0;
const lineHeight = env2.lineHeight | 0;
const lineNumbersDigitCount = env2.lineNumbersDigitCount | 0;
const typicalHalfwidthCharacterWidth = env2.typicalHalfwidthCharacterWidth;
const maxDigitWidth = env2.maxDigitWidth;
const pixelRatio = env2.pixelRatio;
const viewLineCount = env2.viewLineCount;
const wordWrapOverride2 = options2.get(
137
/* EditorOption.wordWrapOverride2 */
);
const wordWrapOverride1 = wordWrapOverride2 === "inherit" ? options2.get(
136
/* EditorOption.wordWrapOverride1 */
) : wordWrapOverride2;
const wordWrap = wordWrapOverride1 === "inherit" ? options2.get(
132
/* EditorOption.wordWrap */
) : wordWrapOverride1;
const wordWrapColumn = options2.get(
135
/* EditorOption.wordWrapColumn */
);
const isDominatedByLongLines = env2.isDominatedByLongLines;
const showGlyphMargin = options2.get(
57
/* EditorOption.glyphMargin */
);
const showLineNumbers = options2.get(
68
/* EditorOption.lineNumbers */
).renderType !== 0;
const lineNumbersMinChars = options2.get(
69
/* EditorOption.lineNumbersMinChars */
);
const scrollBeyondLastLine = options2.get(
105
/* EditorOption.scrollBeyondLastLine */
);
const padding = options2.get(
84
/* EditorOption.padding */
);
const minimap = options2.get(
73
/* EditorOption.minimap */
);
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
const verticalScrollbarWidth = scrollbar.verticalScrollbarSize;
const verticalScrollbarHasArrows = scrollbar.verticalHasArrows;
const scrollbarArrowSize = scrollbar.arrowSize;
const horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize;
const folding = options2.get(
43
/* EditorOption.folding */
);
const showFoldingDecoration = options2.get(
110
/* EditorOption.showFoldingControls */
) !== "never";
let lineDecorationsWidth = options2.get(
66
/* EditorOption.lineDecorationsWidth */
);
if (folding && showFoldingDecoration) {
lineDecorationsWidth += 16;
}
let lineNumbersWidth = 0;
if (showLineNumbers) {
const digitCount2 = Math.max(lineNumbersDigitCount, lineNumbersMinChars);
lineNumbersWidth = Math.round(digitCount2 * maxDigitWidth);
}
let glyphMarginWidth = 0;
if (showGlyphMargin) {
glyphMarginWidth = lineHeight * env2.glyphMarginDecorationLaneCount;
}
let glyphMarginLeft = 0;
let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
let decorationsLeft = lineNumbersLeft + lineNumbersWidth;
let contentLeft = decorationsLeft + lineDecorationsWidth;
const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;
let isWordWrapMinified = false;
let isViewportWrapping = false;
let wrappingColumn = -1;
if (wordWrapOverride1 === "inherit" && isDominatedByLongLines) {
isWordWrapMinified = true;
isViewportWrapping = true;
} else if (wordWrap === "on" || wordWrap === "bounded") {
isViewportWrapping = true;
} else if (wordWrap === "wordWrapColumn") {
wrappingColumn = wordWrapColumn;
}
const minimapLayout = _EditorLayoutInfoComputer._computeMinimapLayout({
outerWidth,
outerHeight,
lineHeight,
typicalHalfwidthCharacterWidth,
pixelRatio,
scrollBeyondLastLine,
paddingTop: padding.top,
paddingBottom: padding.bottom,
minimap,
verticalScrollbarWidth,
viewLineCount,
remainingWidth,
isViewportWrapping
}, env2.memory || new ComputeOptionsMemory());
if (minimapLayout.renderMinimap !== 0 && minimapLayout.minimapLeft === 0) {
glyphMarginLeft += minimapLayout.minimapWidth;
lineNumbersLeft += minimapLayout.minimapWidth;
decorationsLeft += minimapLayout.minimapWidth;
contentLeft += minimapLayout.minimapWidth;
}
const contentWidth = remainingWidth - minimapLayout.minimapWidth;
const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));
const verticalArrowSize = verticalScrollbarHasArrows ? scrollbarArrowSize : 0;
if (isViewportWrapping) {
wrappingColumn = Math.max(1, viewportColumn);
if (wordWrap === "bounded") {
wrappingColumn = Math.min(wrappingColumn, wordWrapColumn);
}
}
return {
width: outerWidth,
height: outerHeight,
glyphMarginLeft,
glyphMarginWidth,
glyphMarginDecorationLaneCount: env2.glyphMarginDecorationLaneCount,
lineNumbersLeft,
lineNumbersWidth,
decorationsLeft,
decorationsWidth: lineDecorationsWidth,
contentLeft,
contentWidth,
minimap: minimapLayout,
viewportColumn,
isWordWrapMinified,
isViewportWrapping,
wrappingColumn,
verticalScrollbarWidth,
horizontalScrollbarHeight,
overviewRuler: {
top: verticalArrowSize,
width: verticalScrollbarWidth,
height: outerHeight - 2 * verticalArrowSize,
right: 0
}
};
}
};
WrappingStrategy = class extends BaseEditorOption {
constructor() {
super(139, "wrappingStrategy", "simple", {
"editor.wrappingStrategy": {
enumDescriptions: [
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."),
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.")
],
type: "string",
enum: ["simple", "advanced"],
default: "simple",
description: localize("wrappingStrategy", "Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")
}
});
}
validate(input) {
return stringSet(input, "simple", ["simple", "advanced"]);
}
compute(env2, options2, value) {
const accessibilitySupport = options2.get(
2
/* EditorOption.accessibilitySupport */
);
if (accessibilitySupport === 2) {
return "advanced";
}
return value;
}
};
(function(ShowLightbulbIconMode3) {
ShowLightbulbIconMode3["Off"] = "off";
ShowLightbulbIconMode3["OnCode"] = "onCode";
ShowLightbulbIconMode3["On"] = "on";
})(ShowLightbulbIconMode || (ShowLightbulbIconMode = {}));
EditorLightbulb = class extends BaseEditorOption {
constructor() {
const defaults = { enabled: ShowLightbulbIconMode.On };
super(65, "lightbulb", defaults, {
"editor.lightbulb.enabled": {
type: "string",
tags: ["experimental"],
enum: [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On],
default: defaults.enabled,
enumDescriptions: [
localize("editor.lightbulb.enabled.off", "Disable the code action menu."),
localize("editor.lightbulb.enabled.onCode", "Show the code action menu when the cursor is on lines with code."),
localize("editor.lightbulb.enabled.on", "Show the code action menu when the cursor is on lines with code or on empty lines.")
],
description: localize("enabled", "Enables the Code Action lightbulb in the editor.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: stringSet(input.enabled, this.defaultValue.enabled, [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On])
};
}
};
EditorStickyScroll = class extends BaseEditorOption {
constructor() {
const defaults = { enabled: true, maxLineCount: 5, defaultModel: "outlineModel", scrollWithEditor: true };
super(115, "stickyScroll", defaults, {
"editor.stickyScroll.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("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: defaults.maxLineCount,
minimum: 1,
maximum: 20,
description: localize("editor.stickyScroll.maxLineCount", "Defines the maximum number of sticky lines to show.")
},
"editor.stickyScroll.defaultModel": {
type: "string",
enum: ["outlineModel", "foldingProviderModel", "indentationModel"],
default: defaults.defaultModel,
description: 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.")
},
"editor.stickyScroll.scrollWithEditor": {
type: "boolean",
default: defaults.scrollWithEditor,
description: localize("editor.stickyScroll.scrollWithEditor", "Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
maxLineCount: EditorIntOption.clampedInt(input.maxLineCount, this.defaultValue.maxLineCount, 1, 20),
defaultModel: stringSet(input.defaultModel, this.defaultValue.defaultModel, ["outlineModel", "foldingProviderModel", "indentationModel"]),
scrollWithEditor: boolean(input.scrollWithEditor, this.defaultValue.scrollWithEditor)
};
}
};
EditorInlayHints = class extends BaseEditorOption {
constructor() {
const defaults = { enabled: "on", fontSize: 0, fontFamily: "", padding: false };
super(141, "inlayHints", defaults, {
"editor.inlayHints.enabled": {
type: "string",
default: defaults.enabled,
description: localize("inlayHints.enable", "Enables the inlay hints in the editor."),
enum: ["on", "onUnlessPressed", "offUnlessPressed", "off"],
markdownEnumDescriptions: [
localize("editor.inlayHints.on", "Inlay hints are enabled"),
localize("editor.inlayHints.onUnlessPressed", "Inlay hints are showing by default and hide when holding {0}", isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),
localize("editor.inlayHints.offUnlessPressed", "Inlay hints are hidden by default and show when holding {0}", isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),
localize("editor.inlayHints.off", "Inlay hints are disabled")
]
},
"editor.inlayHints.fontSize": {
type: "number",
default: defaults.fontSize,
markdownDescription: 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`")
},
"editor.inlayHints.fontFamily": {
type: "string",
default: defaults.fontFamily,
markdownDescription: localize("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: defaults.padding,
description: localize("inlayHints.padding", "Enables the padding around the inlay hints in the editor.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
if (typeof input.enabled === "boolean") {
input.enabled = input.enabled ? "on" : "off";
}
return {
enabled: stringSet(input.enabled, this.defaultValue.enabled, ["on", "off", "offUnlessPressed", "onUnlessPressed"]),
fontSize: EditorIntOption.clampedInt(input.fontSize, this.defaultValue.fontSize, 0, 100),
fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),
padding: boolean(input.padding, this.defaultValue.padding)
};
}
};
EditorLineDecorationsWidth = class extends BaseEditorOption {
constructor() {
super(66, "lineDecorationsWidth", 10);
}
validate(input) {
if (typeof input === "string" && /^\d+(\.\d+)?ch$/.test(input)) {
const multiple = parseFloat(input.substring(0, input.length - 2));
return -multiple;
} else {
return EditorIntOption.clampedInt(input, this.defaultValue, 0, 1e3);
}
}
compute(env2, options2, value) {
if (value < 0) {
return EditorIntOption.clampedInt(-value * env2.fontInfo.typicalHalfwidthCharacterWidth, this.defaultValue, 0, 1e3);
} else {
return value;
}
}
};
EditorLineHeight = class extends EditorFloatOption {
constructor() {
super(67, "lineHeight", EDITOR_FONT_DEFAULTS.lineHeight, (x) => EditorFloatOption.clamp(x, 0, 150), { markdownDescription: 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.") });
}
compute(env2, options2, value) {
return env2.fontInfo.lineHeight;
}
};
EditorMinimap = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: true,
size: "proportional",
side: "right",
showSlider: "mouseover",
autohide: false,
renderCharacters: true,
maxColumn: 120,
scale: 1,
showRegionSectionHeaders: true,
showMarkSectionHeaders: true,
sectionHeaderFontSize: 9,
sectionHeaderLetterSpacing: 1
};
super(73, "minimap", defaults, {
"editor.minimap.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("minimap.enabled", "Controls whether the minimap is shown.")
},
"editor.minimap.autohide": {
type: "boolean",
default: defaults.autohide,
description: localize("minimap.autohide", "Controls whether the minimap is hidden automatically.")
},
"editor.minimap.size": {
type: "string",
enum: ["proportional", "fill", "fit"],
enumDescriptions: [
localize("minimap.size.proportional", "The minimap has the same size as the editor contents (and might scroll)."),
localize("minimap.size.fill", "The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),
localize("minimap.size.fit", "The minimap will shrink as necessary to never be larger than the editor (no scrolling).")
],
default: defaults.size,
description: localize("minimap.size", "Controls the size of the minimap.")
},
"editor.minimap.side": {
type: "string",
enum: ["left", "right"],
default: defaults.side,
description: localize("minimap.side", "Controls the side where to render the minimap.")
},
"editor.minimap.showSlider": {
type: "string",
enum: ["always", "mouseover"],
default: defaults.showSlider,
description: localize("minimap.showSlider", "Controls when the minimap slider is shown.")
},
"editor.minimap.scale": {
type: "number",
default: defaults.scale,
minimum: 1,
maximum: 3,
enum: [1, 2, 3],
description: localize("minimap.scale", "Scale of content drawn in the minimap: 1, 2 or 3.")
},
"editor.minimap.renderCharacters": {
type: "boolean",
default: defaults.renderCharacters,
description: localize("minimap.renderCharacters", "Render the actual characters on a line as opposed to color blocks.")
},
"editor.minimap.maxColumn": {
type: "number",
default: defaults.maxColumn,
description: localize("minimap.maxColumn", "Limit the width of the minimap to render at most a certain number of columns.")
},
"editor.minimap.showRegionSectionHeaders": {
type: "boolean",
default: defaults.showRegionSectionHeaders,
description: localize("minimap.showRegionSectionHeaders", "Controls whether named regions are shown as section headers in the minimap.")
},
"editor.minimap.showMarkSectionHeaders": {
type: "boolean",
default: defaults.showMarkSectionHeaders,
description: localize("minimap.showMarkSectionHeaders", "Controls whether MARK: comments are shown as section headers in the minimap.")
},
"editor.minimap.sectionHeaderFontSize": {
type: "number",
default: defaults.sectionHeaderFontSize,
description: localize("minimap.sectionHeaderFontSize", "Controls the font size of section headers in the minimap.")
},
"editor.minimap.sectionHeaderLetterSpacing": {
type: "number",
default: defaults.sectionHeaderLetterSpacing,
description: localize("minimap.sectionHeaderLetterSpacing", "Controls the amount of space (in pixels) between characters of section header. This helps the readability of the header in small font sizes.")
}
});
}
validate(_input) {
var _a10, _b4;
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
autohide: boolean(input.autohide, this.defaultValue.autohide),
size: stringSet(input.size, this.defaultValue.size, ["proportional", "fill", "fit"]),
side: stringSet(input.side, this.defaultValue.side, ["right", "left"]),
showSlider: stringSet(input.showSlider, this.defaultValue.showSlider, ["always", "mouseover"]),
renderCharacters: boolean(input.renderCharacters, this.defaultValue.renderCharacters),
scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),
maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 1e4),
showRegionSectionHeaders: boolean(input.showRegionSectionHeaders, this.defaultValue.showRegionSectionHeaders),
showMarkSectionHeaders: boolean(input.showMarkSectionHeaders, this.defaultValue.showMarkSectionHeaders),
sectionHeaderFontSize: EditorFloatOption.clamp((_a10 = input.sectionHeaderFontSize) !== null && _a10 !== void 0 ? _a10 : this.defaultValue.sectionHeaderFontSize, 4, 32),
sectionHeaderLetterSpacing: EditorFloatOption.clamp((_b4 = input.sectionHeaderLetterSpacing) !== null && _b4 !== void 0 ? _b4 : this.defaultValue.sectionHeaderLetterSpacing, 0, 5)
};
}
};
EditorPadding = class extends BaseEditorOption {
constructor() {
super(84, "padding", { top: 0, bottom: 0 }, {
"editor.padding.top": {
type: "number",
default: 0,
minimum: 0,
maximum: 1e3,
description: localize("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: localize("padding.bottom", "Controls the amount of space between the bottom edge of the editor and the last line.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
top: EditorIntOption.clampedInt(input.top, 0, 0, 1e3),
bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1e3)
};
}
};
EditorParameterHints = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: true,
cycle: true
};
super(86, "parameterHints", defaults, {
"editor.parameterHints.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("parameterHints.enabled", "Enables a pop-up that shows parameter documentation and type information as you type.")
},
"editor.parameterHints.cycle": {
type: "boolean",
default: defaults.cycle,
description: localize("parameterHints.cycle", "Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
cycle: boolean(input.cycle, this.defaultValue.cycle)
};
}
};
EditorPixelRatio = class extends ComputedEditorOption {
constructor() {
super(
143
/* EditorOption.pixelRatio */
);
}
compute(env2, options2, _) {
return env2.pixelRatio;
}
};
EditorQuickSuggestions = class extends BaseEditorOption {
constructor() {
const defaults = {
other: "on",
comments: "off",
strings: "off"
};
const types = [
{ type: "boolean" },
{
type: "string",
enum: ["on", "inline", "off"],
enumDescriptions: [localize("on", "Quick suggestions show inside the suggest widget"), localize("inline", "Quick suggestions show as ghost text"), localize("off", "Quick suggestions are disabled")]
}
];
super(89, "quickSuggestions", defaults, {
type: "object",
additionalProperties: false,
properties: {
strings: {
anyOf: types,
default: defaults.strings,
description: localize("quickSuggestions.strings", "Enable quick suggestions inside strings.")
},
comments: {
anyOf: types,
default: defaults.comments,
description: localize("quickSuggestions.comments", "Enable quick suggestions inside comments.")
},
other: {
anyOf: types,
default: defaults.other,
description: localize("quickSuggestions.other", "Enable quick suggestions outside of strings and comments.")
}
},
default: defaults,
markdownDescription: 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#`)
});
this.defaultValue = defaults;
}
validate(input) {
if (typeof input === "boolean") {
const value = input ? "on" : "off";
return { comments: value, strings: value, other: value };
}
if (!input || typeof input !== "object") {
return this.defaultValue;
}
const { other, comments, strings } = input;
const allowedValues = ["on", "inline", "off"];
let validatedOther;
let validatedComments;
let validatedStrings;
if (typeof other === "boolean") {
validatedOther = other ? "on" : "off";
} else {
validatedOther = stringSet(other, this.defaultValue.other, allowedValues);
}
if (typeof comments === "boolean") {
validatedComments = comments ? "on" : "off";
} else {
validatedComments = stringSet(comments, this.defaultValue.comments, allowedValues);
}
if (typeof strings === "boolean") {
validatedStrings = strings ? "on" : "off";
} else {
validatedStrings = stringSet(strings, this.defaultValue.strings, allowedValues);
}
return {
other: validatedOther,
comments: validatedComments,
strings: validatedStrings
};
}
};
EditorRenderLineNumbersOption = class extends BaseEditorOption {
constructor() {
super(68, "lineNumbers", { renderType: 1, renderFn: null }, {
type: "string",
enum: ["off", "on", "relative", "interval"],
enumDescriptions: [
localize("lineNumbers.off", "Line numbers are not rendered."),
localize("lineNumbers.on", "Line numbers are rendered as absolute number."),
localize("lineNumbers.relative", "Line numbers are rendered as distance in lines to cursor position."),
localize("lineNumbers.interval", "Line numbers are rendered every 10 lines.")
],
default: "on",
description: localize("lineNumbers", "Controls the display of line numbers.")
});
}
validate(lineNumbers) {
let renderType = this.defaultValue.renderType;
let renderFn = this.defaultValue.renderFn;
if (typeof lineNumbers !== "undefined") {
if (typeof lineNumbers === "function") {
renderType = 4;
renderFn = lineNumbers;
} else if (lineNumbers === "interval") {
renderType = 3;
} else if (lineNumbers === "relative") {
renderType = 2;
} else if (lineNumbers === "on") {
renderType = 1;
} else {
renderType = 0;
}
}
return {
renderType,
renderFn
};
}
};
EditorRulers = class extends BaseEditorOption {
constructor() {
const defaults = [];
const columnSchema = { type: "number", description: localize("rulers.size", "Number of monospace characters at which this editor ruler will render.") };
super(102, "rulers", defaults, {
type: "array",
items: {
anyOf: [
columnSchema,
{
type: [
"object"
],
properties: {
column: columnSchema,
color: {
type: "string",
description: localize("rulers.color", "Color of this editor ruler."),
format: "color-hex"
}
}
}
]
},
default: defaults,
description: 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.")
});
}
validate(input) {
if (Array.isArray(input)) {
const rulers = [];
for (const _element of input) {
if (typeof _element === "number") {
rulers.push({
column: EditorIntOption.clampedInt(_element, 0, 0, 1e4),
color: null
});
} else if (_element && typeof _element === "object") {
const element = _element;
rulers.push({
column: EditorIntOption.clampedInt(element.column, 0, 0, 1e4),
color: element.color
});
}
}
rulers.sort((a3, b) => a3.column - b.column);
return rulers;
}
return this.defaultValue;
}
};
ReadonlyMessage = class extends BaseEditorOption {
constructor() {
const defaults = void 0;
super(92, "readOnlyMessage", defaults);
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
return _input;
}
};
EditorScrollbar = class extends BaseEditorOption {
constructor() {
const defaults = {
vertical: 1,
horizontal: 1,
arrowSize: 11,
useShadows: true,
verticalHasArrows: false,
horizontalHasArrows: false,
horizontalScrollbarSize: 12,
horizontalSliderSize: 12,
verticalScrollbarSize: 14,
verticalSliderSize: 14,
handleMouseWheel: true,
alwaysConsumeMouseWheel: true,
scrollByPage: false,
ignoreHorizontalScrollbarInContentHeight: false
};
super(103, "scrollbar", defaults, {
"editor.scrollbar.vertical": {
type: "string",
enum: ["auto", "visible", "hidden"],
enumDescriptions: [
localize("scrollbar.vertical.auto", "The vertical scrollbar will be visible only when necessary."),
localize("scrollbar.vertical.visible", "The vertical scrollbar will always be visible."),
localize("scrollbar.vertical.fit", "The vertical scrollbar will always be hidden.")
],
default: "auto",
description: localize("scrollbar.vertical", "Controls the visibility of the vertical scrollbar.")
},
"editor.scrollbar.horizontal": {
type: "string",
enum: ["auto", "visible", "hidden"],
enumDescriptions: [
localize("scrollbar.horizontal.auto", "The horizontal scrollbar will be visible only when necessary."),
localize("scrollbar.horizontal.visible", "The horizontal scrollbar will always be visible."),
localize("scrollbar.horizontal.fit", "The horizontal scrollbar will always be hidden.")
],
default: "auto",
description: localize("scrollbar.horizontal", "Controls the visibility of the horizontal scrollbar.")
},
"editor.scrollbar.verticalScrollbarSize": {
type: "number",
default: defaults.verticalScrollbarSize,
description: localize("scrollbar.verticalScrollbarSize", "The width of the vertical scrollbar.")
},
"editor.scrollbar.horizontalScrollbarSize": {
type: "number",
default: defaults.horizontalScrollbarSize,
description: localize("scrollbar.horizontalScrollbarSize", "The height of the horizontal scrollbar.")
},
"editor.scrollbar.scrollByPage": {
type: "boolean",
default: defaults.scrollByPage,
description: localize("scrollbar.scrollByPage", "Controls whether clicks scroll by page or jump to click position.")
},
"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight": {
type: "boolean",
default: defaults.ignoreHorizontalScrollbarInContentHeight,
description: localize("scrollbar.ignoreHorizontalScrollbarInContentHeight", "When set, the horizontal scrollbar will not increase the size of the editor's content.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
const horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1e3);
const verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1e3);
return {
arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1e3),
vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),
horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),
useShadows: boolean(input.useShadows, this.defaultValue.useShadows),
verticalHasArrows: boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),
horizontalHasArrows: boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),
handleMouseWheel: boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),
alwaysConsumeMouseWheel: boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),
horizontalScrollbarSize,
horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1e3),
verticalScrollbarSize,
verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1e3),
scrollByPage: boolean(input.scrollByPage, this.defaultValue.scrollByPage),
ignoreHorizontalScrollbarInContentHeight: boolean(input.ignoreHorizontalScrollbarInContentHeight, this.defaultValue.ignoreHorizontalScrollbarInContentHeight)
};
}
};
inUntrustedWorkspace = "inUntrustedWorkspace";
unicodeHighlightConfigKeys = {
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"
};
UnicodeHighlight = class extends BaseEditorOption {
constructor() {
const defaults = {
nonBasicASCII: inUntrustedWorkspace,
invisibleCharacters: true,
ambiguousCharacters: true,
includeComments: inUntrustedWorkspace,
includeStrings: true,
allowedCharacters: {},
allowedLocales: { _os: true, _vscode: true }
};
super(125, "unicodeHighlight", defaults, {
[unicodeHighlightConfigKeys.nonBasicASCII]: {
restricted: true,
type: ["boolean", "string"],
enum: [true, false, inUntrustedWorkspace],
default: defaults.nonBasicASCII,
description: 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.")
},
[unicodeHighlightConfigKeys.invisibleCharacters]: {
restricted: true,
type: "boolean",
default: defaults.invisibleCharacters,
description: localize("unicodeHighlight.invisibleCharacters", "Controls whether characters that just reserve space or have no width at all are highlighted.")
},
[unicodeHighlightConfigKeys.ambiguousCharacters]: {
restricted: true,
type: "boolean",
default: defaults.ambiguousCharacters,
description: 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.")
},
[unicodeHighlightConfigKeys.includeComments]: {
restricted: true,
type: ["boolean", "string"],
enum: [true, false, inUntrustedWorkspace],
default: defaults.includeComments,
description: localize("unicodeHighlight.includeComments", "Controls whether characters in comments should also be subject to Unicode highlighting.")
},
[unicodeHighlightConfigKeys.includeStrings]: {
restricted: true,
type: ["boolean", "string"],
enum: [true, false, inUntrustedWorkspace],
default: defaults.includeStrings,
description: localize("unicodeHighlight.includeStrings", "Controls whether characters in strings should also be subject to Unicode highlighting.")
},
[unicodeHighlightConfigKeys.allowedCharacters]: {
restricted: true,
type: "object",
default: defaults.allowedCharacters,
description: localize("unicodeHighlight.allowedCharacters", "Defines allowed characters that are not being highlighted."),
additionalProperties: {
type: "boolean"
}
},
[unicodeHighlightConfigKeys.allowedLocales]: {
restricted: true,
type: "object",
additionalProperties: {
type: "boolean"
},
default: defaults.allowedLocales,
description: localize("unicodeHighlight.allowedLocales", "Unicode characters that are common in allowed locales are not being highlighted.")
}
});
}
applyUpdate(value, update) {
let didChange = false;
if (update.allowedCharacters && value) {
if (!equals2(value.allowedCharacters, update.allowedCharacters)) {
value = __spreadProps(__spreadValues({}, value), { allowedCharacters: update.allowedCharacters });
didChange = true;
}
}
if (update.allowedLocales && value) {
if (!equals2(value.allowedLocales, update.allowedLocales)) {
value = __spreadProps(__spreadValues({}, value), { allowedLocales: update.allowedLocales });
didChange = true;
}
}
const result = super.applyUpdate(value, update);
if (didChange) {
return new ApplyUpdateResult(result.newValue, true);
}
return result;
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
nonBasicASCII: primitiveSet(input.nonBasicASCII, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),
invisibleCharacters: boolean(input.invisibleCharacters, this.defaultValue.invisibleCharacters),
ambiguousCharacters: boolean(input.ambiguousCharacters, this.defaultValue.ambiguousCharacters),
includeComments: primitiveSet(input.includeComments, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),
includeStrings: primitiveSet(input.includeStrings, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),
allowedCharacters: this.validateBooleanMap(_input.allowedCharacters, this.defaultValue.allowedCharacters),
allowedLocales: this.validateBooleanMap(_input.allowedLocales, this.defaultValue.allowedLocales)
};
}
validateBooleanMap(map, defaultValue) {
if (typeof map !== "object" || !map) {
return defaultValue;
}
const result = {};
for (const [key, value] of Object.entries(map)) {
if (value === true) {
result[key] = true;
}
}
return result;
}
};
InlineEditorSuggest = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: true,
mode: "subwordSmart",
showToolbar: "onHover",
suppressSuggestions: false,
keepOnBlur: false,
fontFamily: "default"
};
super(62, "inlineSuggest", defaults, {
"editor.inlineSuggest.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("inlineSuggest.enabled", "Controls whether to automatically show inline suggestions in the editor.")
},
"editor.inlineSuggest.showToolbar": {
type: "string",
default: defaults.showToolbar,
enum: ["always", "onHover", "never"],
enumDescriptions: [
localize("inlineSuggest.showToolbar.always", "Show the inline suggestion toolbar whenever an inline suggestion is shown."),
localize("inlineSuggest.showToolbar.onHover", "Show the inline suggestion toolbar when hovering over an inline suggestion."),
localize("inlineSuggest.showToolbar.never", "Never show the inline suggestion toolbar.")
],
description: localize("inlineSuggest.showToolbar", "Controls when to show the inline suggestion toolbar.")
},
"editor.inlineSuggest.suppressSuggestions": {
type: "boolean",
default: defaults.suppressSuggestions,
description: 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.")
},
"editor.inlineSuggest.fontFamily": {
type: "string",
default: defaults.fontFamily,
description: localize("inlineSuggest.fontFamily", "Controls the font family of the inline suggestions.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
mode: stringSet(input.mode, this.defaultValue.mode, ["prefix", "subword", "subwordSmart"]),
showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ["always", "onHover", "never"]),
suppressSuggestions: boolean(input.suppressSuggestions, this.defaultValue.suppressSuggestions),
keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),
fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily)
};
}
};
InlineEditorEdit = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: false,
showToolbar: "onHover",
fontFamily: "default",
keepOnBlur: false,
backgroundColoring: false
};
super(63, "experimentalInlineEdit", defaults, {
"editor.experimentalInlineEdit.enabled": {
type: "boolean",
default: defaults.enabled,
description: localize("inlineEdit.enabled", "Controls whether to show inline edits in the editor.")
},
"editor.experimentalInlineEdit.showToolbar": {
type: "string",
default: defaults.showToolbar,
enum: ["always", "onHover", "never"],
enumDescriptions: [
localize("inlineEdit.showToolbar.always", "Show the inline edit toolbar whenever an inline suggestion is shown."),
localize("inlineEdit.showToolbar.onHover", "Show the inline edit toolbar when hovering over an inline suggestion."),
localize("inlineEdit.showToolbar.never", "Never show the inline edit toolbar.")
],
description: localize("inlineEdit.showToolbar", "Controls when to show the inline edit toolbar.")
},
"editor.experimentalInlineEdit.fontFamily": {
type: "string",
default: defaults.fontFamily,
description: localize("inlineEdit.fontFamily", "Controls the font family of the inline edit.")
},
"editor.experimentalInlineEdit.backgroundColoring": {
type: "boolean",
default: defaults.backgroundColoring,
description: localize("inlineEdit.backgroundColoring", "Controls whether to color the background of inline edits.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ["always", "onHover", "never"]),
fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),
keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),
backgroundColoring: boolean(input.backgroundColoring, this.defaultValue.backgroundColoring)
};
}
};
BracketPairColorization = class extends BaseEditorOption {
constructor() {
const defaults = {
enabled: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.enabled,
independentColorPoolPerBracketType: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.independentColorPoolPerBracketType
};
super(15, "bracketPairColorization", defaults, {
"editor.bracketPairColorization.enabled": {
type: "boolean",
default: defaults.enabled,
markdownDescription: localize("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: defaults.independentColorPoolPerBracketType,
description: localize("bracketPairColorization.independentColorPoolPerBracketType", "Controls whether each bracket type has its own independent color pool.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
independentColorPoolPerBracketType: boolean(input.independentColorPoolPerBracketType, this.defaultValue.independentColorPoolPerBracketType)
};
}
};
GuideOptions = class extends BaseEditorOption {
constructor() {
const defaults = {
bracketPairs: false,
bracketPairsHorizontal: "active",
highlightActiveBracketPair: true,
indentation: true,
highlightActiveIndentation: true
};
super(16, "guides", defaults, {
"editor.guides.bracketPairs": {
type: ["boolean", "string"],
enum: [true, "active", false],
enumDescriptions: [
localize("editor.guides.bracketPairs.true", "Enables bracket pair guides."),
localize("editor.guides.bracketPairs.active", "Enables bracket pair guides only for the active bracket pair."),
localize("editor.guides.bracketPairs.false", "Disables bracket pair guides.")
],
default: defaults.bracketPairs,
description: localize("editor.guides.bracketPairs", "Controls whether bracket pair guides are enabled or not.")
},
"editor.guides.bracketPairsHorizontal": {
type: ["boolean", "string"],
enum: [true, "active", false],
enumDescriptions: [
localize("editor.guides.bracketPairsHorizontal.true", "Enables horizontal guides as addition to vertical bracket pair guides."),
localize("editor.guides.bracketPairsHorizontal.active", "Enables horizontal guides only for the active bracket pair."),
localize("editor.guides.bracketPairsHorizontal.false", "Disables horizontal bracket pair guides.")
],
default: defaults.bracketPairsHorizontal,
description: localize("editor.guides.bracketPairsHorizontal", "Controls whether horizontal bracket pair guides are enabled or not.")
},
"editor.guides.highlightActiveBracketPair": {
type: "boolean",
default: defaults.highlightActiveBracketPair,
description: localize("editor.guides.highlightActiveBracketPair", "Controls whether the editor should highlight the active bracket pair.")
},
"editor.guides.indentation": {
type: "boolean",
default: defaults.indentation,
description: localize("editor.guides.indentation", "Controls whether the editor should render indent guides.")
},
"editor.guides.highlightActiveIndentation": {
type: ["boolean", "string"],
enum: [true, "always", false],
enumDescriptions: [
localize("editor.guides.highlightActiveIndentation.true", "Highlights the active indent guide."),
localize("editor.guides.highlightActiveIndentation.always", "Highlights the active indent guide even if bracket guides are highlighted."),
localize("editor.guides.highlightActiveIndentation.false", "Do not highlight the active indent guide.")
],
default: defaults.highlightActiveIndentation,
description: localize("editor.guides.highlightActiveIndentation", "Controls whether the editor should highlight the active indent guide.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
bracketPairs: primitiveSet(input.bracketPairs, this.defaultValue.bracketPairs, [true, false, "active"]),
bracketPairsHorizontal: primitiveSet(input.bracketPairsHorizontal, this.defaultValue.bracketPairsHorizontal, [true, false, "active"]),
highlightActiveBracketPair: boolean(input.highlightActiveBracketPair, this.defaultValue.highlightActiveBracketPair),
indentation: boolean(input.indentation, this.defaultValue.indentation),
highlightActiveIndentation: primitiveSet(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation, [true, false, "always"])
};
}
};
EditorSuggest = class extends BaseEditorOption {
constructor() {
const defaults = {
insertMode: "insert",
filterGraceful: true,
snippetsPreventQuickSuggestions: false,
localityBonus: false,
shareSuggestSelections: false,
selectionMode: "always",
showIcons: true,
showStatusBar: false,
preview: false,
previewMode: "subwordSmart",
showInlineDetails: true,
showMethods: true,
showFunctions: true,
showConstructors: true,
showDeprecated: true,
matchOnWordStartOnly: true,
showFields: true,
showVariables: true,
showClasses: true,
showStructs: true,
showInterfaces: true,
showModules: true,
showProperties: true,
showEvents: true,
showOperators: true,
showUnits: true,
showValues: true,
showConstants: true,
showEnums: true,
showEnumMembers: true,
showKeywords: true,
showWords: true,
showColors: true,
showFiles: true,
showReferences: true,
showFolders: true,
showTypeParameters: true,
showSnippets: true,
showUsers: true,
showIssues: true
};
super(118, "suggest", defaults, {
"editor.suggest.insertMode": {
type: "string",
enum: ["insert", "replace"],
enumDescriptions: [
localize("suggest.insertMode.insert", "Insert suggestion without overwriting text right of the cursor."),
localize("suggest.insertMode.replace", "Insert suggestion and overwrite text right of the cursor.")
],
default: defaults.insertMode,
description: localize("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: defaults.filterGraceful,
description: localize("suggest.filterGraceful", "Controls whether filtering and sorting suggestions accounts for small typos.")
},
"editor.suggest.localityBonus": {
type: "boolean",
default: defaults.localityBonus,
description: localize("suggest.localityBonus", "Controls whether sorting favors words that appear close to the cursor.")
},
"editor.suggest.shareSuggestSelections": {
type: "boolean",
default: defaults.shareSuggestSelections,
markdownDescription: localize("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: [
localize("suggest.insertMode.always", "Always select a suggestion when automatically triggering IntelliSense."),
localize("suggest.insertMode.never", "Never select a suggestion when automatically triggering IntelliSense."),
localize("suggest.insertMode.whenTriggerCharacter", "Select a suggestion only when triggering IntelliSense from a trigger character."),
localize("suggest.insertMode.whenQuickSuggestion", "Select a suggestion only when triggering IntelliSense as you type.")
],
default: defaults.selectionMode,
markdownDescription: 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`.")
},
"editor.suggest.snippetsPreventQuickSuggestions": {
type: "boolean",
default: defaults.snippetsPreventQuickSuggestions,
description: localize("suggest.snippetsPreventQuickSuggestions", "Controls whether an active snippet prevents quick suggestions.")
},
"editor.suggest.showIcons": {
type: "boolean",
default: defaults.showIcons,
description: localize("suggest.showIcons", "Controls whether to show or hide icons in suggestions.")
},
"editor.suggest.showStatusBar": {
type: "boolean",
default: defaults.showStatusBar,
description: localize("suggest.showStatusBar", "Controls the visibility of the status bar at the bottom of the suggest widget.")
},
"editor.suggest.preview": {
type: "boolean",
default: defaults.preview,
description: localize("suggest.preview", "Controls whether to preview the suggestion outcome in the editor.")
},
"editor.suggest.showInlineDetails": {
type: "boolean",
default: defaults.showInlineDetails,
description: localize("suggest.showInlineDetails", "Controls whether suggest details show inline with the label or only in the details widget.")
},
"editor.suggest.maxVisibleSuggestions": {
type: "number",
deprecationMessage: localize("suggest.maxVisibleSuggestions.dep", "This setting is deprecated. The suggest widget can now be resized.")
},
"editor.suggest.filteredTypes": {
type: "object",
deprecationMessage: localize("deprecated", "This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")
},
"editor.suggest.showMethods": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showMethods", "When enabled IntelliSense shows `method`-suggestions.")
},
"editor.suggest.showFunctions": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showFunctions", "When enabled IntelliSense shows `function`-suggestions.")
},
"editor.suggest.showConstructors": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showConstructors", "When enabled IntelliSense shows `constructor`-suggestions.")
},
"editor.suggest.showDeprecated": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showDeprecated", "When enabled IntelliSense shows `deprecated`-suggestions.")
},
"editor.suggest.matchOnWordStartOnly": {
type: "boolean",
default: true,
markdownDescription: 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.")
},
"editor.suggest.showFields": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showFields", "When enabled IntelliSense shows `field`-suggestions.")
},
"editor.suggest.showVariables": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showVariables", "When enabled IntelliSense shows `variable`-suggestions.")
},
"editor.suggest.showClasses": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showClasss", "When enabled IntelliSense shows `class`-suggestions.")
},
"editor.suggest.showStructs": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showStructs", "When enabled IntelliSense shows `struct`-suggestions.")
},
"editor.suggest.showInterfaces": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showInterfaces", "When enabled IntelliSense shows `interface`-suggestions.")
},
"editor.suggest.showModules": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showModules", "When enabled IntelliSense shows `module`-suggestions.")
},
"editor.suggest.showProperties": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showPropertys", "When enabled IntelliSense shows `property`-suggestions.")
},
"editor.suggest.showEvents": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showEvents", "When enabled IntelliSense shows `event`-suggestions.")
},
"editor.suggest.showOperators": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showOperators", "When enabled IntelliSense shows `operator`-suggestions.")
},
"editor.suggest.showUnits": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showUnits", "When enabled IntelliSense shows `unit`-suggestions.")
},
"editor.suggest.showValues": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showValues", "When enabled IntelliSense shows `value`-suggestions.")
},
"editor.suggest.showConstants": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showConstants", "When enabled IntelliSense shows `constant`-suggestions.")
},
"editor.suggest.showEnums": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showEnums", "When enabled IntelliSense shows `enum`-suggestions.")
},
"editor.suggest.showEnumMembers": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showEnumMembers", "When enabled IntelliSense shows `enumMember`-suggestions.")
},
"editor.suggest.showKeywords": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showKeywords", "When enabled IntelliSense shows `keyword`-suggestions.")
},
"editor.suggest.showWords": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showTexts", "When enabled IntelliSense shows `text`-suggestions.")
},
"editor.suggest.showColors": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showColors", "When enabled IntelliSense shows `color`-suggestions.")
},
"editor.suggest.showFiles": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showFiles", "When enabled IntelliSense shows `file`-suggestions.")
},
"editor.suggest.showReferences": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showReferences", "When enabled IntelliSense shows `reference`-suggestions.")
},
"editor.suggest.showCustomcolors": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showCustomcolors", "When enabled IntelliSense shows `customcolor`-suggestions.")
},
"editor.suggest.showFolders": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showFolders", "When enabled IntelliSense shows `folder`-suggestions.")
},
"editor.suggest.showTypeParameters": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showTypeParameters", "When enabled IntelliSense shows `typeParameter`-suggestions.")
},
"editor.suggest.showSnippets": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showSnippets", "When enabled IntelliSense shows `snippet`-suggestions.")
},
"editor.suggest.showUsers": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showUsers", "When enabled IntelliSense shows `user`-suggestions.")
},
"editor.suggest.showIssues": {
type: "boolean",
default: true,
markdownDescription: localize("editor.suggest.showIssues", "When enabled IntelliSense shows `issues`-suggestions.")
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ["insert", "replace"]),
filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),
snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),
localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),
shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),
selectionMode: stringSet(input.selectionMode, this.defaultValue.selectionMode, ["always", "never", "whenQuickSuggestion", "whenTriggerCharacter"]),
showIcons: boolean(input.showIcons, this.defaultValue.showIcons),
showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),
preview: boolean(input.preview, this.defaultValue.preview),
previewMode: stringSet(input.previewMode, this.defaultValue.previewMode, ["prefix", "subword", "subwordSmart"]),
showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),
showMethods: boolean(input.showMethods, this.defaultValue.showMethods),
showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),
showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors),
showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated),
matchOnWordStartOnly: boolean(input.matchOnWordStartOnly, this.defaultValue.matchOnWordStartOnly),
showFields: boolean(input.showFields, this.defaultValue.showFields),
showVariables: boolean(input.showVariables, this.defaultValue.showVariables),
showClasses: boolean(input.showClasses, this.defaultValue.showClasses),
showStructs: boolean(input.showStructs, this.defaultValue.showStructs),
showInterfaces: boolean(input.showInterfaces, this.defaultValue.showInterfaces),
showModules: boolean(input.showModules, this.defaultValue.showModules),
showProperties: boolean(input.showProperties, this.defaultValue.showProperties),
showEvents: boolean(input.showEvents, this.defaultValue.showEvents),
showOperators: boolean(input.showOperators, this.defaultValue.showOperators),
showUnits: boolean(input.showUnits, this.defaultValue.showUnits),
showValues: boolean(input.showValues, this.defaultValue.showValues),
showConstants: boolean(input.showConstants, this.defaultValue.showConstants),
showEnums: boolean(input.showEnums, this.defaultValue.showEnums),
showEnumMembers: boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),
showKeywords: boolean(input.showKeywords, this.defaultValue.showKeywords),
showWords: boolean(input.showWords, this.defaultValue.showWords),
showColors: boolean(input.showColors, this.defaultValue.showColors),
showFiles: boolean(input.showFiles, this.defaultValue.showFiles),
showReferences: boolean(input.showReferences, this.defaultValue.showReferences),
showFolders: boolean(input.showFolders, this.defaultValue.showFolders),
showTypeParameters: boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),
showSnippets: boolean(input.showSnippets, this.defaultValue.showSnippets),
showUsers: boolean(input.showUsers, this.defaultValue.showUsers),
showIssues: boolean(input.showIssues, this.defaultValue.showIssues)
};
}
};
SmartSelect = class extends BaseEditorOption {
constructor() {
super(113, "smartSelect", {
selectLeadingAndTrailingWhitespace: true,
selectSubwords: true
}, {
"editor.smartSelect.selectLeadingAndTrailingWhitespace": {
description: localize("selectLeadingAndTrailingWhitespace", "Whether leading and trailing whitespace should always be selected."),
default: true,
type: "boolean"
},
"editor.smartSelect.selectSubwords": {
description: localize("selectSubwords", "Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),
default: true,
type: "boolean"
}
});
}
validate(input) {
if (!input || typeof input !== "object") {
return this.defaultValue;
}
return {
selectLeadingAndTrailingWhitespace: boolean(input.selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace),
selectSubwords: boolean(input.selectSubwords, this.defaultValue.selectSubwords)
};
}
};
WordSegmenterLocales = class extends BaseEditorOption {
constructor() {
const defaults = [];
super(130, "wordSegmenterLocales", defaults, {
anyOf: [
{
description: 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.)."),
type: "string"
},
{
description: 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.)."),
type: "array",
items: {
type: "string"
}
}
]
});
}
validate(input) {
if (typeof input === "string") {
input = [input];
}
if (Array.isArray(input)) {
const validLocales = [];
for (const locale of input) {
if (typeof locale === "string") {
try {
if (Intl.Segmenter.supportedLocalesOf(locale).length > 0) {
validLocales.push(locale);
}
} catch (_a10) {
}
}
}
return validLocales;
}
return this.defaultValue;
}
};
WrappingIndentOption = class extends BaseEditorOption {
constructor() {
super(138, "wrappingIndent", 1, {
"editor.wrappingIndent": {
type: "string",
enum: ["none", "same", "indent", "deepIndent"],
enumDescriptions: [
localize("wrappingIndent.none", "No indentation. Wrapped lines begin at column 1."),
localize("wrappingIndent.same", "Wrapped lines get the same indentation as the parent."),
localize("wrappingIndent.indent", "Wrapped lines get +1 indentation toward the parent."),
localize("wrappingIndent.deepIndent", "Wrapped lines get +2 indentation toward the parent.")
],
description: localize("wrappingIndent", "Controls the indentation of wrapped lines."),
default: "same"
}
});
}
validate(input) {
switch (input) {
case "none":
return 0;
case "same":
return 1;
case "indent":
return 2;
case "deepIndent":
return 3;
}
return 1;
}
compute(env2, options2, value) {
const accessibilitySupport = options2.get(
2
/* EditorOption.accessibilitySupport */
);
if (accessibilitySupport === 2) {
return 0;
}
return value;
}
};
EditorWrappingInfoComputer = class extends ComputedEditorOption {
constructor() {
super(
146
/* EditorOption.wrappingInfo */
);
}
compute(env2, options2, _) {
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
return {
isDominatedByLongLines: env2.isDominatedByLongLines,
isWordWrapMinified: layoutInfo.isWordWrapMinified,
isViewportWrapping: layoutInfo.isViewportWrapping,
wrappingColumn: layoutInfo.wrappingColumn
};
}
};
EditorDropIntoEditor = class extends BaseEditorOption {
constructor() {
const defaults = { enabled: true, showDropSelector: "afterDrop" };
super(36, "dropIntoEditor", defaults, {
"editor.dropIntoEditor.enabled": {
type: "boolean",
default: defaults.enabled,
markdownDescription: 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).")
},
"editor.dropIntoEditor.showDropSelector": {
type: "string",
markdownDescription: 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."),
enum: [
"afterDrop",
"never"
],
enumDescriptions: [
localize("dropIntoEditor.showDropSelector.afterDrop", "Show the drop selector widget after a file is dropped into the editor."),
localize("dropIntoEditor.showDropSelector.never", "Never show the drop selector widget. Instead the default drop provider is always used.")
],
default: "afterDrop"
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
showDropSelector: stringSet(input.showDropSelector, this.defaultValue.showDropSelector, ["afterDrop", "never"])
};
}
};
EditorPasteAs = class extends BaseEditorOption {
constructor() {
const defaults = { enabled: true, showPasteSelector: "afterPaste" };
super(85, "pasteAs", defaults, {
"editor.pasteAs.enabled": {
type: "boolean",
default: defaults.enabled,
markdownDescription: localize("pasteAs.enabled", "Controls whether you can paste content in different ways.")
},
"editor.pasteAs.showPasteSelector": {
type: "string",
markdownDescription: 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."),
enum: [
"afterPaste",
"never"
],
enumDescriptions: [
localize("pasteAs.showPasteSelector.afterPaste", "Show the paste selector widget after content is pasted into the editor."),
localize("pasteAs.showPasteSelector.never", "Never show the paste selector widget. Instead the default pasting behavior is always used.")
],
default: "afterPaste"
}
});
}
validate(_input) {
if (!_input || typeof _input !== "object") {
return this.defaultValue;
}
const input = _input;
return {
enabled: boolean(input.enabled, this.defaultValue.enabled),
showPasteSelector: stringSet(input.showPasteSelector, this.defaultValue.showPasteSelector, ["afterPaste", "never"])
};
}
};
DEFAULT_WINDOWS_FONT_FAMILY = "Consolas, 'Courier New', monospace";
DEFAULT_MAC_FONT_FAMILY = "Menlo, Monaco, 'Courier New', monospace";
DEFAULT_LINUX_FONT_FAMILY = "'Droid Sans Mono', 'monospace', monospace";
EDITOR_FONT_DEFAULTS = {
fontFamily: isMacintosh ? DEFAULT_MAC_FONT_FAMILY : isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY,
fontWeight: "normal",
fontSize: isMacintosh ? 12 : 14,
lineHeight: 0,
letterSpacing: 0
};
editorOptionsRegistry = [];
EditorOptions = {
acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(0, "acceptSuggestionOnCommitCharacter", true, { markdownDescription: 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.") })),
acceptSuggestionOnEnter: register(new EditorStringEnumOption(1, "acceptSuggestionOnEnter", "on", ["on", "smart", "off"], {
markdownEnumDescriptions: [
"",
localize("acceptSuggestionOnEnterSmart", "Only accept a suggestion with `Enter` when it makes a textual change."),
""
],
markdownDescription: 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.")
})),
accessibilitySupport: register(new EditorAccessibilitySupport()),
accessibilityPageSize: register(new EditorIntOption(3, "accessibilityPageSize", 10, 1, 1073741824, {
description: 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."),
tags: ["accessibility"]
})),
ariaLabel: register(new EditorStringOption(4, "ariaLabel", localize("editorViewAccessibleLabel", "Editor content"))),
ariaRequired: register(new EditorBooleanOption(5, "ariaRequired", false, void 0)),
screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(8, "screenReaderAnnounceInlineSuggestion", true, {
description: localize("screenReaderAnnounceInlineSuggestion", "Control whether inline suggestions are announced by a screen reader."),
tags: ["accessibility"]
})),
autoClosingBrackets: register(new EditorStringEnumOption(6, "autoClosingBrackets", "languageDefined", ["always", "languageDefined", "beforeWhitespace", "never"], {
enumDescriptions: [
"",
localize("editor.autoClosingBrackets.languageDefined", "Use language configurations to determine when to autoclose brackets."),
localize("editor.autoClosingBrackets.beforeWhitespace", "Autoclose brackets only when the cursor is to the left of whitespace."),
""
],
description: localize("autoClosingBrackets", "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")
})),
autoClosingComments: register(new EditorStringEnumOption(7, "autoClosingComments", "languageDefined", ["always", "languageDefined", "beforeWhitespace", "never"], {
enumDescriptions: [
"",
localize("editor.autoClosingComments.languageDefined", "Use language configurations to determine when to autoclose comments."),
localize("editor.autoClosingComments.beforeWhitespace", "Autoclose comments only when the cursor is to the left of whitespace."),
""
],
description: localize("autoClosingComments", "Controls whether the editor should automatically close comments after the user adds an opening comment.")
})),
autoClosingDelete: register(new EditorStringEnumOption(9, "autoClosingDelete", "auto", ["always", "auto", "never"], {
enumDescriptions: [
"",
localize("editor.autoClosingDelete.auto", "Remove adjacent closing quotes or brackets only if they were automatically inserted."),
""
],
description: localize("autoClosingDelete", "Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")
})),
autoClosingOvertype: register(new EditorStringEnumOption(10, "autoClosingOvertype", "auto", ["always", "auto", "never"], {
enumDescriptions: [
"",
localize("editor.autoClosingOvertype.auto", "Type over closing quotes or brackets only if they were automatically inserted."),
""
],
description: localize("autoClosingOvertype", "Controls whether the editor should type over closing quotes or brackets.")
})),
autoClosingQuotes: register(new EditorStringEnumOption(11, "autoClosingQuotes", "languageDefined", ["always", "languageDefined", "beforeWhitespace", "never"], {
enumDescriptions: [
"",
localize("editor.autoClosingQuotes.languageDefined", "Use language configurations to determine when to autoclose quotes."),
localize("editor.autoClosingQuotes.beforeWhitespace", "Autoclose quotes only when the cursor is to the left of whitespace."),
""
],
description: localize("autoClosingQuotes", "Controls whether the editor should automatically close quotes after the user adds an opening quote.")
})),
autoIndent: register(new EditorEnumOption(12, "autoIndent", 4, "full", ["none", "keep", "brackets", "advanced", "full"], _autoIndentFromString, {
enumDescriptions: [
localize("editor.autoIndent.none", "The editor will not insert indentation automatically."),
localize("editor.autoIndent.keep", "The editor will keep the current line's indentation."),
localize("editor.autoIndent.brackets", "The editor will keep the current line's indentation and honor language defined brackets."),
localize("editor.autoIndent.advanced", "The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),
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.")
],
description: localize("autoIndent", "Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")
})),
automaticLayout: register(new EditorBooleanOption(13, "automaticLayout", false)),
autoSurround: register(new EditorStringEnumOption(14, "autoSurround", "languageDefined", ["languageDefined", "quotes", "brackets", "never"], {
enumDescriptions: [
localize("editor.autoSurround.languageDefined", "Use language configurations to determine when to automatically surround selections."),
localize("editor.autoSurround.quotes", "Surround with quotes but not brackets."),
localize("editor.autoSurround.brackets", "Surround with brackets but not quotes."),
""
],
description: localize("autoSurround", "Controls whether the editor should automatically surround selections when typing quotes or brackets.")
})),
bracketPairColorization: register(new BracketPairColorization()),
bracketPairGuides: register(new GuideOptions()),
stickyTabStops: register(new EditorBooleanOption(116, "stickyTabStops", false, { description: localize("stickyTabStops", "Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.") })),
codeLens: register(new EditorBooleanOption(17, "codeLens", true, { description: localize("codeLens", "Controls whether the editor shows CodeLens.") })),
codeLensFontFamily: register(new EditorStringOption(18, "codeLensFontFamily", "", { description: localize("codeLensFontFamily", "Controls the font family for CodeLens.") })),
codeLensFontSize: register(new EditorIntOption(19, "codeLensFontSize", 0, 0, 100, {
type: "number",
default: 0,
minimum: 0,
maximum: 100,
markdownDescription: localize("codeLensFontSize", "Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")
})),
colorDecorators: register(new EditorBooleanOption(20, "colorDecorators", true, { description: localize("colorDecorators", "Controls whether the editor should render the inline color decorators and color picker.") })),
colorDecoratorActivatedOn: register(new EditorStringEnumOption(148, "colorDecoratorsActivatedOn", "clickAndHover", ["clickAndHover", "hover", "click"], {
enumDescriptions: [
localize("editor.colorDecoratorActivatedOn.clickAndHover", "Make the color picker appear both on click and hover of the color decorator"),
localize("editor.colorDecoratorActivatedOn.hover", "Make the color picker appear on hover of the color decorator"),
localize("editor.colorDecoratorActivatedOn.click", "Make the color picker appear on click of the color decorator")
],
description: localize("colorDecoratorActivatedOn", "Controls the condition to make a color picker appear from a color decorator")
})),
colorDecoratorsLimit: register(new EditorIntOption(21, "colorDecoratorsLimit", 500, 1, 1e6, {
markdownDescription: localize("colorDecoratorsLimit", "Controls the max number of color decorators that can be rendered in an editor at once.")
})),
columnSelection: register(new EditorBooleanOption(22, "columnSelection", false, { description: localize("columnSelection", "Enable that the selection with the mouse and keys is doing column selection.") })),
comments: register(new EditorComments()),
contextmenu: register(new EditorBooleanOption(24, "contextmenu", true)),
copyWithSyntaxHighlighting: register(new EditorBooleanOption(25, "copyWithSyntaxHighlighting", true, { description: localize("copyWithSyntaxHighlighting", "Controls whether syntax highlighting should be copied into the clipboard.") })),
cursorBlinking: register(new EditorEnumOption(26, "cursorBlinking", 1, "blink", ["blink", "smooth", "phase", "expand", "solid"], _cursorBlinkingStyleFromString, { description: localize("cursorBlinking", "Control the cursor animation style.") })),
cursorSmoothCaretAnimation: register(new EditorStringEnumOption(27, "cursorSmoothCaretAnimation", "off", ["off", "explicit", "on"], {
enumDescriptions: [
localize("cursorSmoothCaretAnimation.off", "Smooth caret animation is disabled."),
localize("cursorSmoothCaretAnimation.explicit", "Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),
localize("cursorSmoothCaretAnimation.on", "Smooth caret animation is always enabled.")
],
description: localize("cursorSmoothCaretAnimation", "Controls whether the smooth caret animation should be enabled.")
})),
cursorStyle: register(new EditorEnumOption(28, "cursorStyle", TextEditorCursorStyle.Line, "line", ["line", "block", "underline", "line-thin", "block-outline", "underline-thin"], _cursorStyleFromString, { description: localize("cursorStyle", "Controls the cursor style.") })),
cursorSurroundingLines: register(new EditorIntOption(29, "cursorSurroundingLines", 0, 0, 1073741824, { description: 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.") })),
cursorSurroundingLinesStyle: register(new EditorStringEnumOption(30, "cursorSurroundingLinesStyle", "default", ["default", "all"], {
enumDescriptions: [
localize("cursorSurroundingLinesStyle.default", "`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),
localize("cursorSurroundingLinesStyle.all", "`cursorSurroundingLines` is enforced always.")
],
markdownDescription: localize("cursorSurroundingLinesStyle", "Controls when `#editor.cursorSurroundingLines#` should be enforced.")
})),
cursorWidth: register(new EditorIntOption(31, "cursorWidth", 0, 0, 1073741824, { markdownDescription: localize("cursorWidth", "Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.") })),
disableLayerHinting: register(new EditorBooleanOption(32, "disableLayerHinting", false)),
disableMonospaceOptimizations: register(new EditorBooleanOption(33, "disableMonospaceOptimizations", false)),
domReadOnly: register(new EditorBooleanOption(34, "domReadOnly", false)),
dragAndDrop: register(new EditorBooleanOption(35, "dragAndDrop", true, { description: localize("dragAndDrop", "Controls whether the editor should allow moving selections via drag and drop.") })),
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
dropIntoEditor: register(new EditorDropIntoEditor()),
stickyScroll: register(new EditorStickyScroll()),
experimentalWhitespaceRendering: register(new EditorStringEnumOption(38, "experimentalWhitespaceRendering", "svg", ["svg", "font", "off"], {
enumDescriptions: [
localize("experimentalWhitespaceRendering.svg", "Use a new rendering method with svgs."),
localize("experimentalWhitespaceRendering.font", "Use a new rendering method with font characters."),
localize("experimentalWhitespaceRendering.off", "Use the stable rendering method.")
],
description: localize("experimentalWhitespaceRendering", "Controls whether whitespace is rendered with a new, experimental method.")
})),
extraEditorClassName: register(new EditorStringOption(39, "extraEditorClassName", "")),
fastScrollSensitivity: register(new EditorFloatOption(40, "fastScrollSensitivity", 5, (x) => x <= 0 ? 5 : x, { markdownDescription: localize("fastScrollSensitivity", "Scrolling speed multiplier when pressing `Alt`.") })),
find: register(new EditorFind()),
fixedOverflowWidgets: register(new EditorBooleanOption(42, "fixedOverflowWidgets", false)),
folding: register(new EditorBooleanOption(43, "folding", true, { description: localize("folding", "Controls whether the editor has code folding enabled.") })),
foldingStrategy: register(new EditorStringEnumOption(44, "foldingStrategy", "auto", ["auto", "indentation"], {
enumDescriptions: [
localize("foldingStrategy.auto", "Use a language-specific folding strategy if available, else the indentation-based one."),
localize("foldingStrategy.indentation", "Use the indentation-based folding strategy.")
],
description: localize("foldingStrategy", "Controls the strategy for computing folding ranges.")
})),
foldingHighlight: register(new EditorBooleanOption(45, "foldingHighlight", true, { description: localize("foldingHighlight", "Controls whether the editor should highlight folded ranges.") })),
foldingImportsByDefault: register(new EditorBooleanOption(46, "foldingImportsByDefault", false, { description: localize("foldingImportsByDefault", "Controls whether the editor automatically collapses import ranges.") })),
foldingMaximumRegions: register(new EditorIntOption(
47,
"foldingMaximumRegions",
5e3,
10,
65e3,
// limit must be less than foldingRanges MAX_FOLDING_REGIONS
{ description: 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.") }
)),
unfoldOnClickAfterEndOfLine: register(new EditorBooleanOption(48, "unfoldOnClickAfterEndOfLine", false, { description: localize("unfoldOnClickAfterEndOfLine", "Controls whether clicking on the empty content after a folded line will unfold the line.") })),
fontFamily: register(new EditorStringOption(49, "fontFamily", EDITOR_FONT_DEFAULTS.fontFamily, { description: localize("fontFamily", "Controls the font family.") })),
fontInfo: register(new EditorFontInfo()),
fontLigatures2: register(new EditorFontLigatures()),
fontSize: register(new EditorFontSize()),
fontWeight: register(new EditorFontWeight()),
fontVariations: register(new EditorFontVariations()),
formatOnPaste: register(new EditorBooleanOption(55, "formatOnPaste", false, { description: 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.") })),
formatOnType: register(new EditorBooleanOption(56, "formatOnType", false, { description: localize("formatOnType", "Controls whether the editor should automatically format the line after typing.") })),
glyphMargin: register(new EditorBooleanOption(57, "glyphMargin", true, { description: localize("glyphMargin", "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.") })),
gotoLocation: register(new EditorGoToLocation()),
hideCursorInOverviewRuler: register(new EditorBooleanOption(59, "hideCursorInOverviewRuler", false, { description: localize("hideCursorInOverviewRuler", "Controls whether the cursor should be hidden in the overview ruler.") })),
hover: register(new EditorHover()),
inDiffEditor: register(new EditorBooleanOption(61, "inDiffEditor", false)),
letterSpacing: register(new EditorFloatOption(64, "letterSpacing", EDITOR_FONT_DEFAULTS.letterSpacing, (x) => EditorFloatOption.clamp(x, -5, 20), { description: localize("letterSpacing", "Controls the letter spacing in pixels.") })),
lightbulb: register(new EditorLightbulb()),
lineDecorationsWidth: register(new EditorLineDecorationsWidth()),
lineHeight: register(new EditorLineHeight()),
lineNumbers: register(new EditorRenderLineNumbersOption()),
lineNumbersMinChars: register(new EditorIntOption(69, "lineNumbersMinChars", 5, 1, 300)),
linkedEditing: register(new EditorBooleanOption(70, "linkedEditing", false, { description: localize("linkedEditing", "Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.") })),
links: register(new EditorBooleanOption(71, "links", true, { description: localize("links", "Controls whether the editor should detect links and make them clickable.") })),
matchBrackets: register(new EditorStringEnumOption(72, "matchBrackets", "always", ["always", "near", "never"], { description: localize("matchBrackets", "Highlight matching brackets.") })),
minimap: register(new EditorMinimap()),
mouseStyle: register(new EditorStringEnumOption(74, "mouseStyle", "text", ["text", "default", "copy"])),
mouseWheelScrollSensitivity: register(new EditorFloatOption(75, "mouseWheelScrollSensitivity", 1, (x) => x === 0 ? 1 : x, { markdownDescription: localize("mouseWheelScrollSensitivity", "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.") })),
mouseWheelZoom: register(new EditorBooleanOption(76, "mouseWheelZoom", false, {
markdownDescription: isMacintosh ? localize("mouseWheelZoom.mac", "Zoom the font of the editor when using mouse wheel and holding `Cmd`.") : localize("mouseWheelZoom", "Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")
})),
multiCursorMergeOverlapping: register(new EditorBooleanOption(77, "multiCursorMergeOverlapping", true, { description: localize("multiCursorMergeOverlapping", "Merge multiple cursors when they are overlapping.") })),
multiCursorModifier: register(new EditorEnumOption(78, "multiCursorModifier", "altKey", "alt", ["ctrlCmd", "alt"], _multiCursorModifierFromString, {
markdownEnumDescriptions: [
localize("multiCursorModifier.ctrlCmd", "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
localize("multiCursorModifier.alt", "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
],
markdownDescription: localize({
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: register(new EditorStringEnumOption(79, "multiCursorPaste", "spread", ["spread", "full"], {
markdownEnumDescriptions: [
localize("multiCursorPaste.spread", "Each cursor pastes a single line of the text."),
localize("multiCursorPaste.full", "Each cursor pastes the full text.")
],
markdownDescription: localize("multiCursorPaste", "Controls pasting when the line count of the pasted text matches the cursor count.")
})),
multiCursorLimit: register(new EditorIntOption(80, "multiCursorLimit", 1e4, 1, 1e5, {
markdownDescription: localize("multiCursorLimit", "Controls the max number of cursors that can be in an active editor at once.")
})),
occurrencesHighlight: register(new EditorStringEnumOption(81, "occurrencesHighlight", "singleFile", ["off", "singleFile", "multiFile"], {
markdownEnumDescriptions: [
localize("occurrencesHighlight.off", "Does not highlight occurrences."),
localize("occurrencesHighlight.singleFile", "Highlights occurrences only in the current file."),
localize("occurrencesHighlight.multiFile", "Experimental: Highlights occurrences across all valid open files.")
],
markdownDescription: localize("occurrencesHighlight", "Controls whether occurrences should be highlighted across open files.")
})),
overviewRulerBorder: register(new EditorBooleanOption(82, "overviewRulerBorder", true, { description: localize("overviewRulerBorder", "Controls whether a border should be drawn around the overview ruler.") })),
overviewRulerLanes: register(new EditorIntOption(83, "overviewRulerLanes", 3, 0, 3)),
padding: register(new EditorPadding()),
pasteAs: register(new EditorPasteAs()),
parameterHints: register(new EditorParameterHints()),
peekWidgetDefaultFocus: register(new EditorStringEnumOption(87, "peekWidgetDefaultFocus", "tree", ["tree", "editor"], {
enumDescriptions: [
localize("peekWidgetDefaultFocus.tree", "Focus the tree when opening peek"),
localize("peekWidgetDefaultFocus.editor", "Focus the editor when opening peek")
],
description: localize("peekWidgetDefaultFocus", "Controls whether to focus the inline editor or the tree in the peek widget.")
})),
definitionLinkOpensInPeek: register(new EditorBooleanOption(88, "definitionLinkOpensInPeek", false, { description: localize("definitionLinkOpensInPeek", "Controls whether the Go to Definition mouse gesture always opens the peek widget.") })),
quickSuggestions: register(new EditorQuickSuggestions()),
quickSuggestionsDelay: register(new EditorIntOption(90, "quickSuggestionsDelay", 10, 0, 1073741824, { description: localize("quickSuggestionsDelay", "Controls the delay in milliseconds after which quick suggestions will show up.") })),
readOnly: register(new EditorBooleanOption(91, "readOnly", false)),
readOnlyMessage: register(new ReadonlyMessage()),
renameOnType: register(new EditorBooleanOption(93, "renameOnType", false, { description: localize("renameOnType", "Controls whether the editor auto renames on type."), markdownDeprecationMessage: localize("renameOnTypeDeprecate", "Deprecated, use `editor.linkedEditing` instead.") })),
renderControlCharacters: register(new EditorBooleanOption(94, "renderControlCharacters", true, { description: localize("renderControlCharacters", "Controls whether the editor should render control characters."), restricted: true })),
renderFinalNewline: register(new EditorStringEnumOption(95, "renderFinalNewline", isLinux ? "dimmed" : "on", ["off", "on", "dimmed"], { description: localize("renderFinalNewline", "Render last line number when the file ends with a newline.") })),
renderLineHighlight: register(new EditorStringEnumOption(96, "renderLineHighlight", "line", ["none", "gutter", "line", "all"], {
enumDescriptions: [
"",
"",
"",
localize("renderLineHighlight.all", "Highlights both the gutter and the current line.")
],
description: localize("renderLineHighlight", "Controls how the editor should render the current line highlight.")
})),
renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(97, "renderLineHighlightOnlyWhenFocus", false, { description: localize("renderLineHighlightOnlyWhenFocus", "Controls if the editor should render the current line highlight only when the editor is focused.") })),
renderValidationDecorations: register(new EditorStringEnumOption(98, "renderValidationDecorations", "editable", ["editable", "on", "off"])),
renderWhitespace: register(new EditorStringEnumOption(99, "renderWhitespace", "selection", ["none", "boundary", "selection", "trailing", "all"], {
enumDescriptions: [
"",
localize("renderWhitespace.boundary", "Render whitespace characters except for single spaces between words."),
localize("renderWhitespace.selection", "Render whitespace characters only on selected text."),
localize("renderWhitespace.trailing", "Render only trailing whitespace characters."),
""
],
description: localize("renderWhitespace", "Controls how the editor should render whitespace characters.")
})),
revealHorizontalRightPadding: register(new EditorIntOption(100, "revealHorizontalRightPadding", 15, 0, 1e3)),
roundedSelection: register(new EditorBooleanOption(101, "roundedSelection", true, { description: localize("roundedSelection", "Controls whether selections should have rounded corners.") })),
rulers: register(new EditorRulers()),
scrollbar: register(new EditorScrollbar()),
scrollBeyondLastColumn: register(new EditorIntOption(104, "scrollBeyondLastColumn", 4, 0, 1073741824, { description: localize("scrollBeyondLastColumn", "Controls the number of extra characters beyond which the editor will scroll horizontally.") })),
scrollBeyondLastLine: register(new EditorBooleanOption(105, "scrollBeyondLastLine", true, { description: localize("scrollBeyondLastLine", "Controls whether the editor will scroll beyond the last line.") })),
scrollPredominantAxis: register(new EditorBooleanOption(106, "scrollPredominantAxis", true, { description: 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.") })),
selectionClipboard: register(new EditorBooleanOption(107, "selectionClipboard", true, {
description: localize("selectionClipboard", "Controls whether the Linux primary clipboard should be supported."),
included: isLinux
})),
selectionHighlight: register(new EditorBooleanOption(108, "selectionHighlight", true, { description: localize("selectionHighlight", "Controls whether the editor should highlight matches similar to the selection.") })),
selectOnLineNumbers: register(new EditorBooleanOption(109, "selectOnLineNumbers", true)),
showFoldingControls: register(new EditorStringEnumOption(110, "showFoldingControls", "mouseover", ["always", "never", "mouseover"], {
enumDescriptions: [
localize("showFoldingControls.always", "Always show the folding controls."),
localize("showFoldingControls.never", "Never show the folding controls and reduce the gutter size."),
localize("showFoldingControls.mouseover", "Only show the folding controls when the mouse is over the gutter.")
],
description: localize("showFoldingControls", "Controls when the folding controls on the gutter are shown.")
})),
showUnused: register(new EditorBooleanOption(111, "showUnused", true, { description: localize("showUnused", "Controls fading out of unused code.") })),
showDeprecated: register(new EditorBooleanOption(140, "showDeprecated", true, { description: localize("showDeprecated", "Controls strikethrough deprecated variables.") })),
inlayHints: register(new EditorInlayHints()),
snippetSuggestions: register(new EditorStringEnumOption(112, "snippetSuggestions", "inline", ["top", "bottom", "inline", "none"], {
enumDescriptions: [
localize("snippetSuggestions.top", "Show snippet suggestions on top of other suggestions."),
localize("snippetSuggestions.bottom", "Show snippet suggestions below other suggestions."),
localize("snippetSuggestions.inline", "Show snippets suggestions with other suggestions."),
localize("snippetSuggestions.none", "Do not show snippet suggestions.")
],
description: localize("snippetSuggestions", "Controls whether snippets are shown with other suggestions and how they are sorted.")
})),
smartSelect: register(new SmartSelect()),
smoothScrolling: register(new EditorBooleanOption(114, "smoothScrolling", false, { description: localize("smoothScrolling", "Controls whether the editor will scroll using an animation.") })),
stopRenderingLineAfter: register(new EditorIntOption(
117,
"stopRenderingLineAfter",
1e4,
-1,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
)),
suggest: register(new EditorSuggest()),
inlineSuggest: register(new InlineEditorSuggest()),
inlineEdit: register(new InlineEditorEdit()),
inlineCompletionsAccessibilityVerbose: register(new EditorBooleanOption(149, "inlineCompletionsAccessibilityVerbose", false, { description: localize("inlineCompletionsAccessibilityVerbose", "Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.") })),
suggestFontSize: register(new EditorIntOption(119, "suggestFontSize", 0, 0, 1e3, { markdownDescription: localize("suggestFontSize", "Font size for the suggest widget. When set to {0}, the value of {1} is used.", "`0`", "`#editor.fontSize#`") })),
suggestLineHeight: register(new EditorIntOption(120, "suggestLineHeight", 0, 0, 1e3, { markdownDescription: 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#`") })),
suggestOnTriggerCharacters: register(new EditorBooleanOption(121, "suggestOnTriggerCharacters", true, { description: localize("suggestOnTriggerCharacters", "Controls whether suggestions should automatically show up when typing trigger characters.") })),
suggestSelection: register(new EditorStringEnumOption(122, "suggestSelection", "first", ["first", "recentlyUsed", "recentlyUsedByPrefix"], {
markdownEnumDescriptions: [
localize("suggestSelection.first", "Always select the first suggestion."),
localize("suggestSelection.recentlyUsed", "Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),
localize("suggestSelection.recentlyUsedByPrefix", "Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")
],
description: localize("suggestSelection", "Controls how suggestions are pre-selected when showing the suggest list.")
})),
tabCompletion: register(new EditorStringEnumOption(123, "tabCompletion", "off", ["on", "off", "onlySnippets"], {
enumDescriptions: [
localize("tabCompletion.on", "Tab complete will insert the best matching suggestion when pressing tab."),
localize("tabCompletion.off", "Disable tab completions."),
localize("tabCompletion.onlySnippets", "Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")
],
description: localize("tabCompletion", "Enables tab completions.")
})),
tabIndex: register(new EditorIntOption(
124,
"tabIndex",
0,
-1,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
)),
unicodeHighlight: register(new UnicodeHighlight()),
unusualLineTerminators: register(new EditorStringEnumOption(126, "unusualLineTerminators", "prompt", ["auto", "off", "prompt"], {
enumDescriptions: [
localize("unusualLineTerminators.auto", "Unusual line terminators are automatically removed."),
localize("unusualLineTerminators.off", "Unusual line terminators are ignored."),
localize("unusualLineTerminators.prompt", "Unusual line terminators prompt to be removed.")
],
description: localize("unusualLineTerminators", "Remove unusual line terminators that might cause problems.")
})),
useShadowDOM: register(new EditorBooleanOption(127, "useShadowDOM", true)),
useTabStops: register(new EditorBooleanOption(128, "useTabStops", true, { description: localize("useTabStops", "Spaces and tabs are inserted and deleted in alignment with tab stops.") })),
wordBreak: register(new EditorStringEnumOption(129, "wordBreak", "normal", ["normal", "keepAll"], {
markdownEnumDescriptions: [
localize("wordBreak.normal", "Use the default line break rule."),
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.")
],
description: localize("wordBreak", "Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")
})),
wordSegmenterLocales: register(new WordSegmenterLocales()),
wordSeparators: register(new EditorStringOption(131, "wordSeparators", USUAL_WORD_SEPARATORS, { description: localize("wordSeparators", "Characters that will be used as word separators when doing word related navigations or operations.") })),
wordWrap: register(new EditorStringEnumOption(132, "wordWrap", "off", ["off", "on", "wordWrapColumn", "bounded"], {
markdownEnumDescriptions: [
localize("wordWrap.off", "Lines will never wrap."),
localize("wordWrap.on", "Lines will wrap at the viewport width."),
localize({
key: "wordWrap.wordWrapColumn",
comment: [
"- `editor.wordWrapColumn` refers to a different setting and should not be localized."
]
}, "Lines will wrap at `#editor.wordWrapColumn#`."),
localize({
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: localize({
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: register(new EditorStringOption(
133,
"wordWrapBreakAfterCharacters",
// allow-any-unicode-next-line
" })]?|/&.,;\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: register(new EditorStringOption(
134,
"wordWrapBreakBeforeCharacters",
// allow-any-unicode-next-line
"([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B"
)),
wordWrapColumn: register(new EditorIntOption(135, "wordWrapColumn", 80, 1, 1073741824, {
markdownDescription: localize({
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: register(new EditorStringEnumOption(136, "wordWrapOverride1", "inherit", ["off", "on", "inherit"])),
wordWrapOverride2: register(new EditorStringEnumOption(137, "wordWrapOverride2", "inherit", ["off", "on", "inherit"])),
// Leave these at the end (because they have dependencies!)
editorClassName: register(new EditorClassName()),
defaultColorDecorators: register(new EditorBooleanOption(147, "defaultColorDecorators", false, { markdownDescription: localize("defaultColorDecorators", "Controls whether inline color decorations should be shown using the default document color provider") })),
pixelRatio: register(new EditorPixelRatio()),
tabFocusMode: register(new EditorBooleanOption(144, "tabFocusMode", false, { markdownDescription: localize("tabFocusMode", "Controls whether the editor receives tabs or defers them to the workbench for navigation.") })),
layoutInfo: register(new EditorLayoutInfoComputer()),
wrappingInfo: register(new EditorWrappingInfoComputer()),
wrappingIndent: register(new WrappingIndentOption()),
wrappingStrategy: register(new WrappingStrategy())
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/errors.js
function onUnexpectedError(e) {
if (!isCancellationError(e)) {
errorHandler.onUnexpectedError(e);
}
return void 0;
}
function onUnexpectedExternalError(e) {
if (!isCancellationError(e)) {
errorHandler.onUnexpectedExternalError(e);
}
return void 0;
}
function transformErrorForSerialization(error) {
if (error instanceof Error) {
const { name, message } = error;
const stack = error.stacktrace || error.stack;
return {
$isError: true,
name,
message,
stack,
noTelemetry: ErrorNoTelemetry.isErrorNoTelemetry(error)
};
}
return error;
}
function isCancellationError(error) {
if (error instanceof CancellationError) {
return true;
}
return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
function canceled() {
const error = new Error(canceledName);
error.name = error.message;
return error;
}
function illegalArgument(name) {
if (name) {
return new Error(`Illegal argument: ${name}`);
} else {
return new Error("Illegal argument");
}
}
function illegalState(name) {
if (name) {
return new Error(`Illegal state: ${name}`);
} else {
return new Error("Illegal state");
}
}
var ErrorHandler, errorHandler, canceledName, CancellationError, NotSupportedError, ErrorNoTelemetry, BugIndicatingError;
var init_errors = __esm({
"node_modules/monaco-editor/esm/vs/base/common/errors.js"() {
ErrorHandler = class {
constructor() {
this.listeners = [];
this.unexpectedErrorHandler = function(e) {
setTimeout(() => {
if (e.stack) {
if (ErrorNoTelemetry.isErrorNoTelemetry(e)) {
throw new ErrorNoTelemetry(e.message + "\n\n" + e.stack);
}
throw new Error(e.message + "\n\n" + e.stack);
}
throw e;
}, 0);
};
}
emit(e) {
this.listeners.forEach((listener) => {
listener(e);
});
}
onUnexpectedError(e) {
this.unexpectedErrorHandler(e);
this.emit(e);
}
// For external errors, we don't want the listeners to be called
onUnexpectedExternalError(e) {
this.unexpectedErrorHandler(e);
}
};
errorHandler = new ErrorHandler();
canceledName = "Canceled";
CancellationError = class extends Error {
constructor() {
super(canceledName);
this.name = this.message;
}
};
NotSupportedError = class extends Error {
constructor(message) {
super("NotSupported");
if (message) {
this.message = message;
}
}
};
ErrorNoTelemetry = class _ErrorNoTelemetry extends Error {
constructor(msg) {
super(msg);
this.name = "CodeExpectedError";
}
static fromError(err) {
if (err instanceof _ErrorNoTelemetry) {
return err;
}
const result = new _ErrorNoTelemetry();
result.message = err.message;
result.stack = err.stack;
return result;
}
static isErrorNoTelemetry(err) {
return err.name === "CodeExpectedError";
}
};
BugIndicatingError = class _BugIndicatingError extends Error {
constructor(message) {
super(message || "An unexpected bug occurred.");
Object.setPrototypeOf(this, _BugIndicatingError.prototype);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/functional.js
function createSingleCallFunction(fn, fnDidRunCallback) {
const _this = this;
let didCall = false;
let result;
return function() {
if (didCall) {
return result;
}
didCall = true;
if (fnDidRunCallback) {
try {
result = fn.apply(_this, arguments);
} finally {
fnDidRunCallback();
}
} else {
result = fn.apply(_this, arguments);
}
return result;
};
}
var init_functional = __esm({
"node_modules/monaco-editor/esm/vs/base/common/functional.js"() {
}
});
// node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
function setDisposableTracker(tracker) {
disposableTracker = tracker;
}
function trackDisposable(x) {
disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.trackDisposable(x);
return x;
}
function markAsDisposed(disposable) {
disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsDisposed(disposable);
}
function setParentOfDisposable(child, parent) {
disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.setParent(child, parent);
}
function setParentOfDisposables(children, parent) {
if (!disposableTracker) {
return;
}
for (const child of children) {
disposableTracker.setParent(child, parent);
}
}
function markAsSingleton(singleton) {
disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsSingleton(singleton);
return singleton;
}
function isDisposable(thing) {
return typeof thing === "object" && thing !== null && typeof thing.dispose === "function" && thing.dispose.length === 0;
}
function dispose(arg) {
if (Iterable.is(arg)) {
const errors = [];
for (const d of arg) {
if (d) {
try {
d.dispose();
} catch (e) {
errors.push(e);
}
}
}
if (errors.length === 1) {
throw errors[0];
} else if (errors.length > 1) {
throw new AggregateError(errors, "Encountered errors while disposing of store");
}
return Array.isArray(arg) ? [] : arg;
} else if (arg) {
arg.dispose();
return arg;
}
}
function combinedDisposable(...disposables) {
const parent = toDisposable(() => dispose(disposables));
setParentOfDisposables(disposables, parent);
return parent;
}
function toDisposable(fn) {
const self2 = trackDisposable({
dispose: createSingleCallFunction(() => {
markAsDisposed(self2);
fn();
})
});
return self2;
}
var TRACK_DISPOSABLES, disposableTracker, DisposableStore, Disposable, MutableDisposable, RefCountedDisposable, ImmortalReference, DisposableMap;
var init_lifecycle = __esm({
"node_modules/monaco-editor/esm/vs/base/common/lifecycle.js"() {
init_functional();
init_iterator();
TRACK_DISPOSABLES = false;
disposableTracker = null;
if (TRACK_DISPOSABLES) {
const __is_disposable_tracked__ = "__is_disposable_tracked__";
setDisposableTracker(new class {
trackDisposable(x) {
const stack = new Error("Potentially leaked disposable").stack;
setTimeout(() => {
if (!x[__is_disposable_tracked__]) {
console.log(stack);
}
}, 3e3);
}
setParent(child, parent) {
if (child && child !== Disposable.None) {
try {
child[__is_disposable_tracked__] = true;
} catch (_a10) {
}
}
}
markAsDisposed(disposable) {
if (disposable && disposable !== Disposable.None) {
try {
disposable[__is_disposable_tracked__] = true;
} catch (_a10) {
}
}
}
markAsSingleton(disposable) {
}
}());
}
DisposableStore = class _DisposableStore {
constructor() {
this._toDispose = /* @__PURE__ */ new Set();
this._isDisposed = false;
trackDisposable(this);
}
/**
* Dispose of all registered disposables and mark this object as disposed.
*
* Any future disposables added to this object will be disposed of on `add`.
*/
dispose() {
if (this._isDisposed) {
return;
}
markAsDisposed(this);
this._isDisposed = true;
this.clear();
}
/**
* @return `true` if this object has been disposed of.
*/
get isDisposed() {
return this._isDisposed;
}
/**
* Dispose of all registered disposables but do not mark this object as disposed.
*/
clear() {
if (this._toDispose.size === 0) {
return;
}
try {
dispose(this._toDispose);
} finally {
this._toDispose.clear();
}
}
/**
* Add a new {@link IDisposable disposable} to the collection.
*/
add(o) {
if (!o) {
return o;
}
if (o === this) {
throw new Error("Cannot register a disposable on itself!");
}
setParentOfDisposable(o, this);
if (this._isDisposed) {
if (!_DisposableStore.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);
}
} else {
this._toDispose.add(o);
}
return o;
}
/**
* Deletes the value from the store, but does not dispose it.
*/
deleteAndLeak(o) {
if (!o) {
return;
}
if (this._toDispose.has(o)) {
this._toDispose.delete(o);
setParentOfDisposable(o, null);
}
}
};
DisposableStore.DISABLE_DISPOSED_WARNING = false;
Disposable = class {
constructor() {
this._store = new DisposableStore();
trackDisposable(this);
setParentOfDisposable(this._store, this);
}
dispose() {
markAsDisposed(this);
this._store.dispose();
}
/**
* Adds `o` to the collection of disposables managed by this object.
*/
_register(o) {
if (o === this) {
throw new Error("Cannot register a disposable on itself!");
}
return this._store.add(o);
}
};
Disposable.None = Object.freeze({ dispose() {
} });
MutableDisposable = class {
constructor() {
this._isDisposed = false;
trackDisposable(this);
}
get value() {
return this._isDisposed ? void 0 : this._value;
}
set value(value) {
var _a10;
if (this._isDisposed || value === this._value) {
return;
}
(_a10 = this._value) === null || _a10 === void 0 ? void 0 : _a10.dispose();
if (value) {
setParentOfDisposable(value, this);
}
this._value = value;
}
/**
* Resets the stored value and disposed of the previously stored value.
*/
clear() {
this.value = void 0;
}
dispose() {
var _a10;
this._isDisposed = true;
markAsDisposed(this);
(_a10 = this._value) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this._value = void 0;
}
};
RefCountedDisposable = class {
constructor(_disposable) {
this._disposable = _disposable;
this._counter = 1;
}
acquire() {
this._counter++;
return this;
}
release() {
if (--this._counter === 0) {
this._disposable.dispose();
}
return this;
}
};
ImmortalReference = class {
constructor(object) {
this.object = object;
}
dispose() {
}
};
DisposableMap = class {
constructor() {
this._store = /* @__PURE__ */ new Map();
this._isDisposed = false;
trackDisposable(this);
}
/**
* Disposes of all stored values and mark this object as disposed.
*
* Trying to use this object after it has been disposed of is an error.
*/
dispose() {
markAsDisposed(this);
this._isDisposed = true;
this.clearAndDisposeAll();
}
/**
* Disposes of all stored values and clear the map, but DO NOT mark this object as disposed.
*/
clearAndDisposeAll() {
if (!this._store.size) {
return;
}
try {
dispose(this._store.values());
} finally {
this._store.clear();
}
}
get(key) {
return this._store.get(key);
}
set(key, value, skipDisposeOnOverwrite = false) {
var _a10;
if (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);
}
if (!skipDisposeOnOverwrite) {
(_a10 = this._store.get(key)) === null || _a10 === void 0 ? void 0 : _a10.dispose();
}
this._store.set(key, value);
}
/**
* Delete the value stored for `key` from this map and also dispose of it.
*/
deleteAndDispose(key) {
var _a10;
(_a10 = this._store.get(key)) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this._store.delete(key);
}
[Symbol.iterator]() {
return this._store[Symbol.iterator]();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/stopwatch.js
var hasPerformanceNow, StopWatch;
var init_stopwatch = __esm({
"node_modules/monaco-editor/esm/vs/base/common/stopwatch.js"() {
hasPerformanceNow = globalThis.performance && typeof globalThis.performance.now === "function";
StopWatch = class _StopWatch {
static create(highResolution) {
return new _StopWatch(highResolution);
}
constructor(highResolution) {
this._now = hasPerformanceNow && highResolution === false ? 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() {
if (this._stopTime !== -1) {
return this._stopTime - this._startTime;
}
return this._now() - this._startTime;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/event.js
var _enableListenerGCedWarning, _enableDisposeWithListenerWarning, _enableSnapshotPotentialLeakWarning, Event, EventProfiling, _globalLeakWarningThreshold, LeakageMonitor, Stacktrace, ListenerLeakError, ListenerRefusalError, UniqueContainer, compactionThreshold, forEachListener, _listenerFinalizers, Emitter, createEventDeliveryQueue, EventDeliveryQueuePrivate, PauseableEmitter, DebounceEmitter, MicrotaskEmitter, EventMultiplexer, EventBufferer, Relay;
var init_event = __esm({
"node_modules/monaco-editor/esm/vs/base/common/event.js"() {
init_errors();
init_functional();
init_lifecycle();
init_linkedList();
init_stopwatch();
_enableListenerGCedWarning = false;
_enableDisposeWithListenerWarning = false;
_enableSnapshotPotentialLeakWarning = false;
(function(Event2) {
Event2.None = () => Disposable.None;
function _addLeakageTraceLogic(options2) {
if (_enableSnapshotPotentialLeakWarning) {
const { onDidAddListener: origListenerDidAdd } = options2;
const stack = Stacktrace.create();
let count = 0;
options2.onDidAddListener = () => {
if (++count === 2) {
console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here");
stack.print();
}
origListenerDidAdd === null || origListenerDidAdd === void 0 ? void 0 : origListenerDidAdd();
};
}
}
function defer(event, disposable) {
return debounce(event, () => void 0, 0, void 0, true, void 0, disposable);
}
Event2.defer = defer;
function once(event) {
return (listener, thisArgs = null, disposables) => {
let didFire = false;
let result = void 0;
result = event((e) => {
if (didFire) {
return;
} else if (result) {
result.dispose();
} else {
didFire = true;
}
return listener.call(thisArgs, e);
}, null, disposables);
if (didFire) {
result.dispose();
}
return result;
};
}
Event2.once = once;
function map(event, map2, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event((i) => listener.call(thisArgs, map2(i)), null, disposables), disposable);
}
Event2.map = map;
function forEach(event, each, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event((i) => {
each(i);
listener.call(thisArgs, i);
}, null, disposables), disposable);
}
Event2.forEach = forEach;
function filter(event, filter2, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event((e) => filter2(e) && listener.call(thisArgs, e), null, disposables), disposable);
}
Event2.filter = filter;
function signal(event) {
return event;
}
Event2.signal = signal;
function any(...events) {
return (listener, thisArgs = null, disposables) => {
const disposable = combinedDisposable(...events.map((event) => event((e) => listener.call(thisArgs, e))));
return addAndReturnDisposable(disposable, disposables);
};
}
Event2.any = any;
function reduce(event, merge, initial, disposable) {
let output = initial;
return map(event, (e) => {
output = merge(output, e);
return output;
}, disposable);
}
Event2.reduce = reduce;
function snapshot(event, disposable) {
let listener;
const options2 = {
onWillAddFirstListener() {
listener = event(emitter.fire, emitter);
},
onDidRemoveLastListener() {
listener === null || listener === void 0 ? void 0 : listener.dispose();
}
};
if (!disposable) {
_addLeakageTraceLogic(options2);
}
const emitter = new Emitter(options2);
disposable === null || disposable === void 0 ? void 0 : disposable.add(emitter);
return emitter.event;
}
function addAndReturnDisposable(d, store) {
if (store instanceof Array) {
store.push(d);
} else if (store) {
store.add(d);
}
return d;
}
function debounce(event, merge, delay = 100, leading = false, flushOnListenerRemove = false, leakWarningThreshold, disposable) {
let subscription;
let output = void 0;
let handle = void 0;
let numDebouncedCalls = 0;
let doFire;
const options2 = {
leakWarningThreshold,
onWillAddFirstListener() {
subscription = event((cur) => {
numDebouncedCalls++;
output = merge(output, cur);
if (leading && !handle) {
emitter.fire(output);
output = void 0;
}
doFire = () => {
const _output = output;
output = void 0;
handle = void 0;
if (!leading || numDebouncedCalls > 1) {
emitter.fire(_output);
}
numDebouncedCalls = 0;
};
if (typeof delay === "number") {
clearTimeout(handle);
handle = setTimeout(doFire, delay);
} else {
if (handle === void 0) {
handle = 0;
queueMicrotask(doFire);
}
}
});
},
onWillRemoveListener() {
if (flushOnListenerRemove && numDebouncedCalls > 0) {
doFire === null || doFire === void 0 ? void 0 : doFire();
}
},
onDidRemoveLastListener() {
doFire = void 0;
subscription.dispose();
}
};
if (!disposable) {
_addLeakageTraceLogic(options2);
}
const emitter = new Emitter(options2);
disposable === null || disposable === void 0 ? void 0 : disposable.add(emitter);
return emitter.event;
}
Event2.debounce = debounce;
function accumulate(event, delay = 0, disposable) {
return Event2.debounce(event, (last, e) => {
if (!last) {
return [e];
}
last.push(e);
return last;
}, delay, void 0, true, void 0, disposable);
}
Event2.accumulate = accumulate;
function latch(event, equals4 = (a3, b) => a3 === b, disposable) {
let firstCall = true;
let cache;
return filter(event, (value) => {
const shouldEmit = firstCall || !equals4(value, cache);
firstCall = false;
cache = value;
return shouldEmit;
}, disposable);
}
Event2.latch = latch;
function split(event, isT, disposable) {
return [
Event2.filter(event, isT, disposable),
Event2.filter(event, (e) => !isT(e), disposable)
];
}
Event2.split = split;
function buffer(event, flushAfterTimeout = false, _buffer = [], disposable) {
let buffer2 = _buffer.slice();
let listener = event((e) => {
if (buffer2) {
buffer2.push(e);
} else {
emitter.fire(e);
}
});
if (disposable) {
disposable.add(listener);
}
const flush = () => {
buffer2 === null || buffer2 === void 0 ? void 0 : buffer2.forEach((e) => emitter.fire(e));
buffer2 = null;
};
const emitter = new Emitter({
onWillAddFirstListener() {
if (!listener) {
listener = event((e) => emitter.fire(e));
if (disposable) {
disposable.add(listener);
}
}
},
onDidAddFirstListener() {
if (buffer2) {
if (flushAfterTimeout) {
setTimeout(flush);
} else {
flush();
}
}
},
onDidRemoveLastListener() {
if (listener) {
listener.dispose();
}
listener = null;
}
});
if (disposable) {
disposable.add(emitter);
}
return emitter.event;
}
Event2.buffer = buffer;
function chain(event, sythensize) {
const fn = (listener, thisArgs, disposables) => {
const cs = sythensize(new ChainableSynthesis());
return event(function(value) {
const result = cs.evaluate(value);
if (result !== HaltChainable) {
listener.call(thisArgs, result);
}
}, void 0, disposables);
};
return fn;
}
Event2.chain = chain;
const HaltChainable = Symbol("HaltChainable");
class ChainableSynthesis {
constructor() {
this.steps = [];
}
map(fn) {
this.steps.push(fn);
return this;
}
forEach(fn) {
this.steps.push((v) => {
fn(v);
return v;
});
return this;
}
filter(fn) {
this.steps.push((v) => fn(v) ? v : HaltChainable);
return this;
}
reduce(merge, initial) {
let last = initial;
this.steps.push((v) => {
last = merge(last, v);
return last;
});
return this;
}
latch(equals4 = (a3, b) => a3 === b) {
let firstCall = true;
let cache;
this.steps.push((value) => {
const shouldEmit = firstCall || !equals4(value, cache);
firstCall = false;
cache = value;
return shouldEmit ? value : HaltChainable;
});
return this;
}
evaluate(value) {
for (const step of this.steps) {
value = step(value);
if (value === HaltChainable) {
break;
}
}
return value;
}
}
function fromNodeEventEmitter(emitter, eventName, map2 = (id) => id) {
const fn = (...args) => result.fire(map2(...args));
const onFirstListenerAdd = () => emitter.on(eventName, fn);
const onLastListenerRemove = () => emitter.removeListener(eventName, fn);
const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });
return result.event;
}
Event2.fromNodeEventEmitter = fromNodeEventEmitter;
function fromDOMEventEmitter(emitter, eventName, map2 = (id) => id) {
const fn = (...args) => result.fire(map2(...args));
const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);
const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);
const result = new Emitter({ onWillAddFirstListener: onFirstListenerAdd, onDidRemoveLastListener: onLastListenerRemove });
return result.event;
}
Event2.fromDOMEventEmitter = fromDOMEventEmitter;
function toPromise(event) {
return new Promise((resolve2) => once(event)(resolve2));
}
Event2.toPromise = toPromise;
function fromPromise(promise) {
const result = new Emitter();
promise.then((res) => {
result.fire(res);
}, () => {
result.fire(void 0);
}).finally(() => {
result.dispose();
});
return result.event;
}
Event2.fromPromise = fromPromise;
function runAndSubscribe(event, handler, initial) {
handler(initial);
return event((e) => handler(e));
}
Event2.runAndSubscribe = runAndSubscribe;
class EmitterObserver {
constructor(_observable, store) {
this._observable = _observable;
this._counter = 0;
this._hasChanged = false;
const options2 = {
onWillAddFirstListener: () => {
_observable.addObserver(this);
},
onDidRemoveLastListener: () => {
_observable.removeObserver(this);
}
};
if (!store) {
_addLeakageTraceLogic(options2);
}
this.emitter = new Emitter(options2);
if (store) {
store.add(this.emitter);
}
}
beginUpdate(_observable) {
this._counter++;
}
handlePossibleChange(_observable) {
}
handleChange(_observable, _change) {
this._hasChanged = true;
}
endUpdate(_observable) {
this._counter--;
if (this._counter === 0) {
this._observable.reportChanges();
if (this._hasChanged) {
this._hasChanged = false;
this.emitter.fire(this._observable.get());
}
}
}
}
function fromObservable(obs, store) {
const observer = new EmitterObserver(obs, store);
return observer.emitter.event;
}
Event2.fromObservable = fromObservable;
function fromObservableLight(observable) {
return (listener, thisArgs, disposables) => {
let count = 0;
let didChange = false;
const observer = {
beginUpdate() {
count++;
},
endUpdate() {
count--;
if (count === 0) {
observable.reportChanges();
if (didChange) {
didChange = false;
listener.call(thisArgs);
}
}
},
handlePossibleChange() {
},
handleChange() {
didChange = true;
}
};
observable.addObserver(observer);
observable.reportChanges();
const disposable = {
dispose() {
observable.removeObserver(observer);
}
};
if (disposables instanceof DisposableStore) {
disposables.add(disposable);
} else if (Array.isArray(disposables)) {
disposables.push(disposable);
}
return disposable;
};
}
Event2.fromObservableLight = fromObservableLight;
})(Event || (Event = {}));
EventProfiling = class _EventProfiling {
constructor(name) {
this.listenerCount = 0;
this.invocationCount = 0;
this.elapsedOverall = 0;
this.durations = [];
this.name = `${name}_${_EventProfiling._idPool++}`;
_EventProfiling.all.add(this);
}
start(listenerCount) {
this._stopWatch = new StopWatch();
this.listenerCount = listenerCount;
}
stop() {
if (this._stopWatch) {
const elapsed = this._stopWatch.elapsed();
this.durations.push(elapsed);
this.elapsedOverall += elapsed;
this.invocationCount += 1;
this._stopWatch = void 0;
}
}
};
EventProfiling.all = /* @__PURE__ */ new Set();
EventProfiling._idPool = 0;
_globalLeakWarningThreshold = -1;
LeakageMonitor = class {
constructor(_errorHandler, threshold, name = Math.random().toString(18).slice(2, 5)) {
this._errorHandler = _errorHandler;
this.threshold = threshold;
this.name = name;
this._warnCountdown = 0;
}
dispose() {
var _a10;
(_a10 = this._stacks) === null || _a10 === void 0 ? void 0 : _a10.clear();
}
check(stack, listenerCount) {
const threshold = this.threshold;
if (threshold <= 0 || listenerCount < threshold) {
return void 0;
}
if (!this._stacks) {
this._stacks = /* @__PURE__ */ new Map();
}
const count = this._stacks.get(stack.value) || 0;
this._stacks.set(stack.value, count + 1);
this._warnCountdown -= 1;
if (this._warnCountdown <= 0) {
this._warnCountdown = threshold * 0.5;
const [topStack, topCount] = this.getMostFrequentStack();
const message = `[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`;
console.warn(message);
console.warn(topStack);
const error = new ListenerLeakError(message, topStack);
this._errorHandler(error);
}
return () => {
const count2 = this._stacks.get(stack.value) || 0;
this._stacks.set(stack.value, count2 - 1);
};
}
getMostFrequentStack() {
if (!this._stacks) {
return void 0;
}
let topStack;
let topCount = 0;
for (const [stack, count] of this._stacks) {
if (!topStack || topCount < count) {
topStack = [stack, count];
topCount = count;
}
}
return topStack;
}
};
Stacktrace = class _Stacktrace {
static create() {
var _a10;
const err = new Error();
return new _Stacktrace((_a10 = err.stack) !== null && _a10 !== void 0 ? _a10 : "");
}
constructor(value) {
this.value = value;
}
print() {
console.warn(this.value.split("\n").slice(2).join("\n"));
}
};
ListenerLeakError = class extends Error {
constructor(message, stack) {
super(message);
this.name = "ListenerLeakError";
this.stack = stack;
}
};
ListenerRefusalError = class extends Error {
constructor(message, stack) {
super(message);
this.name = "ListenerRefusalError";
this.stack = stack;
}
};
UniqueContainer = class {
constructor(value) {
this.value = value;
}
};
compactionThreshold = 2;
forEachListener = (listeners, fn) => {
if (listeners instanceof UniqueContainer) {
fn(listeners);
} else {
for (let i = 0; i < listeners.length; i++) {
const l = listeners[i];
if (l) {
fn(l);
}
}
}
};
_listenerFinalizers = _enableListenerGCedWarning ? new FinalizationRegistry((heldValue) => {
if (typeof heldValue === "string") {
console.warn("[LEAKING LISTENER] GC'ed a listener that was NOT yet disposed. This is where is was created:");
console.warn(heldValue);
}
}) : void 0;
Emitter = class {
constructor(options2) {
var _a10, _b4, _c2, _d2, _e2, _f3;
this._size = 0;
this._options = options2;
this._leakageMon = _globalLeakWarningThreshold > 0 || ((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.leakWarningThreshold) ? new LeakageMonitor((_b4 = options2 === null || options2 === void 0 ? void 0 : options2.onListenerError) !== null && _b4 !== void 0 ? _b4 : onUnexpectedError, (_d2 = (_c2 = this._options) === null || _c2 === void 0 ? void 0 : _c2.leakWarningThreshold) !== null && _d2 !== void 0 ? _d2 : _globalLeakWarningThreshold) : void 0;
this._perfMon = ((_e2 = this._options) === null || _e2 === void 0 ? void 0 : _e2._profName) ? new EventProfiling(this._options._profName) : void 0;
this._deliveryQueue = (_f3 = this._options) === null || _f3 === void 0 ? void 0 : _f3.deliveryQueue;
}
dispose() {
var _a10, _b4, _c2, _d2;
if (!this._disposed) {
this._disposed = true;
if (((_a10 = this._deliveryQueue) === null || _a10 === void 0 ? void 0 : _a10.current) === this) {
this._deliveryQueue.reset();
}
if (this._listeners) {
if (_enableDisposeWithListenerWarning) {
const listeners = this._listeners;
queueMicrotask(() => {
forEachListener(listeners, (l) => {
var _a11;
return (_a11 = l.stack) === null || _a11 === void 0 ? void 0 : _a11.print();
});
});
}
this._listeners = void 0;
this._size = 0;
}
(_c2 = (_b4 = this._options) === null || _b4 === void 0 ? void 0 : _b4.onDidRemoveLastListener) === null || _c2 === void 0 ? void 0 : _c2.call(_b4);
(_d2 = this._leakageMon) === null || _d2 === void 0 ? void 0 : _d2.dispose();
}
}
/**
* For the public to allow to subscribe
* to events from this Emitter
*/
get event() {
var _a10;
(_a10 = this._event) !== null && _a10 !== void 0 ? _a10 : this._event = (callback, thisArgs, disposables) => {
var _a11, _b4, _c2, _d2, _e2, _f3, _g2;
if (this._leakageMon && this._size > __pow(this._leakageMon.threshold, 2)) {
const message = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;
console.warn(message);
const tuple = (_a11 = this._leakageMon.getMostFrequentStack()) !== null && _a11 !== void 0 ? _a11 : ["UNKNOWN stack", -1];
const error = new ListenerRefusalError(`${message}. HINT: Stack shows most frequent listener (${tuple[1]}-times)`, tuple[0]);
const errorHandler2 = ((_b4 = this._options) === null || _b4 === void 0 ? void 0 : _b4.onListenerError) || onUnexpectedError;
errorHandler2(error);
return Disposable.None;
}
if (this._disposed) {
return Disposable.None;
}
if (thisArgs) {
callback = callback.bind(thisArgs);
}
const contained = new UniqueContainer(callback);
let removeMonitor;
let stack;
if (this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * 0.2)) {
contained.stack = Stacktrace.create();
removeMonitor = this._leakageMon.check(contained.stack, this._size + 1);
}
if (_enableDisposeWithListenerWarning) {
contained.stack = stack !== null && stack !== void 0 ? stack : Stacktrace.create();
}
if (!this._listeners) {
(_d2 = (_c2 = this._options) === null || _c2 === void 0 ? void 0 : _c2.onWillAddFirstListener) === null || _d2 === void 0 ? void 0 : _d2.call(_c2, this);
this._listeners = contained;
(_f3 = (_e2 = this._options) === null || _e2 === void 0 ? void 0 : _e2.onDidAddFirstListener) === null || _f3 === void 0 ? void 0 : _f3.call(_e2, this);
} else if (this._listeners instanceof UniqueContainer) {
(_g2 = this._deliveryQueue) !== null && _g2 !== void 0 ? _g2 : this._deliveryQueue = new EventDeliveryQueuePrivate();
this._listeners = [this._listeners, contained];
} else {
this._listeners.push(contained);
}
this._size++;
const result = toDisposable(() => {
_listenerFinalizers === null || _listenerFinalizers === void 0 ? void 0 : _listenerFinalizers.unregister(result);
removeMonitor === null || removeMonitor === void 0 ? void 0 : removeMonitor();
this._removeListener(contained);
});
if (disposables instanceof DisposableStore) {
disposables.add(result);
} else if (Array.isArray(disposables)) {
disposables.push(result);
}
if (_listenerFinalizers) {
const stack2 = new Error().stack.split("\n").slice(2).join("\n").trim();
_listenerFinalizers.register(result, stack2, result);
}
return result;
};
return this._event;
}
_removeListener(listener) {
var _a10, _b4, _c2, _d2;
(_b4 = (_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.onWillRemoveListener) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this);
if (!this._listeners) {
return;
}
if (this._size === 1) {
this._listeners = void 0;
(_d2 = (_c2 = this._options) === null || _c2 === void 0 ? void 0 : _c2.onDidRemoveLastListener) === null || _d2 === void 0 ? void 0 : _d2.call(_c2, this);
this._size = 0;
return;
}
const listeners = this._listeners;
const index = listeners.indexOf(listener);
if (index === -1) {
console.log("disposed?", this._disposed);
console.log("size?", this._size);
console.log("arr?", JSON.stringify(this._listeners));
throw new Error("Attempted to dispose unknown listener");
}
this._size--;
listeners[index] = void 0;
const adjustDeliveryQueue = this._deliveryQueue.current === this;
if (this._size * compactionThreshold <= listeners.length) {
let n = 0;
for (let i = 0; i < listeners.length; i++) {
if (listeners[i]) {
listeners[n++] = listeners[i];
} else if (adjustDeliveryQueue) {
this._deliveryQueue.end--;
if (n < this._deliveryQueue.i) {
this._deliveryQueue.i--;
}
}
}
listeners.length = n;
}
}
_deliver(listener, value) {
var _a10;
if (!listener) {
return;
}
const errorHandler2 = ((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.onListenerError) || onUnexpectedError;
if (!errorHandler2) {
listener.value(value);
return;
}
try {
listener.value(value);
} catch (e) {
errorHandler2(e);
}
}
/** Delivers items in the queue. Assumes the queue is ready to go. */
_deliverQueue(dq) {
const listeners = dq.current._listeners;
while (dq.i < dq.end) {
this._deliver(listeners[dq.i++], dq.value);
}
dq.reset();
}
/**
* To be kept private to fire an event to
* subscribers
*/
fire(event) {
var _a10, _b4, _c2, _d2;
if ((_a10 = this._deliveryQueue) === null || _a10 === void 0 ? void 0 : _a10.current) {
this._deliverQueue(this._deliveryQueue);
(_b4 = this._perfMon) === null || _b4 === void 0 ? void 0 : _b4.stop();
}
(_c2 = this._perfMon) === null || _c2 === void 0 ? void 0 : _c2.start(this._size);
if (!this._listeners) {
} else if (this._listeners instanceof UniqueContainer) {
this._deliver(this._listeners, event);
} else {
const dq = this._deliveryQueue;
dq.enqueue(this, event, this._listeners.length);
this._deliverQueue(dq);
}
(_d2 = this._perfMon) === null || _d2 === void 0 ? void 0 : _d2.stop();
}
hasListeners() {
return this._size > 0;
}
};
createEventDeliveryQueue = () => new EventDeliveryQueuePrivate();
EventDeliveryQueuePrivate = class {
constructor() {
this.i = -1;
this.end = 0;
}
enqueue(emitter, value, end) {
this.i = 0;
this.end = end;
this.current = emitter;
this.value = value;
}
reset() {
this.i = this.end;
this.current = void 0;
this.value = void 0;
}
};
PauseableEmitter = class extends Emitter {
constructor(options2) {
super(options2);
this._isPaused = 0;
this._eventQueue = new LinkedList();
this._mergeFn = options2 === null || options2 === void 0 ? void 0 : options2.merge;
}
pause() {
this._isPaused++;
}
resume() {
if (this._isPaused !== 0 && --this._isPaused === 0) {
if (this._mergeFn) {
if (this._eventQueue.size > 0) {
const events = Array.from(this._eventQueue);
this._eventQueue.clear();
super.fire(this._mergeFn(events));
}
} else {
while (!this._isPaused && this._eventQueue.size !== 0) {
super.fire(this._eventQueue.shift());
}
}
}
}
fire(event) {
if (this._size) {
if (this._isPaused !== 0) {
this._eventQueue.push(event);
} else {
super.fire(event);
}
}
}
};
DebounceEmitter = class extends PauseableEmitter {
constructor(options2) {
var _a10;
super(options2);
this._delay = (_a10 = options2.delay) !== null && _a10 !== void 0 ? _a10 : 100;
}
fire(event) {
if (!this._handle) {
this.pause();
this._handle = setTimeout(() => {
this._handle = void 0;
this.resume();
}, this._delay);
}
super.fire(event);
}
};
MicrotaskEmitter = class extends Emitter {
constructor(options2) {
super(options2);
this._queuedEvents = [];
this._mergeFn = options2 === null || options2 === void 0 ? void 0 : options2.merge;
}
fire(event) {
if (!this.hasListeners()) {
return;
}
this._queuedEvents.push(event);
if (this._queuedEvents.length === 1) {
queueMicrotask(() => {
if (this._mergeFn) {
super.fire(this._mergeFn(this._queuedEvents));
} else {
this._queuedEvents.forEach((e) => super.fire(e));
}
this._queuedEvents = [];
});
}
}
};
EventMultiplexer = class {
constructor() {
this.hasListeners = false;
this.events = [];
this.emitter = new Emitter({
onWillAddFirstListener: () => this.onFirstListenerAdd(),
onDidRemoveLastListener: () => this.onLastListenerRemove()
});
}
get event() {
return this.emitter.event;
}
add(event) {
const e = { event, listener: null };
this.events.push(e);
if (this.hasListeners) {
this.hook(e);
}
const dispose2 = () => {
if (this.hasListeners) {
this.unhook(e);
}
const idx = this.events.indexOf(e);
this.events.splice(idx, 1);
};
return toDisposable(createSingleCallFunction(dispose2));
}
onFirstListenerAdd() {
this.hasListeners = true;
this.events.forEach((e) => this.hook(e));
}
onLastListenerRemove() {
this.hasListeners = false;
this.events.forEach((e) => this.unhook(e));
}
hook(e) {
e.listener = e.event((r) => this.emitter.fire(r));
}
unhook(e) {
var _a10;
(_a10 = e.listener) === null || _a10 === void 0 ? void 0 : _a10.dispose();
e.listener = null;
}
dispose() {
var _a10;
this.emitter.dispose();
for (const e of this.events) {
(_a10 = e.listener) === null || _a10 === void 0 ? void 0 : _a10.dispose();
}
this.events = [];
}
};
EventBufferer = class {
constructor() {
this.data = [];
}
wrapEvent(event, reduce, initial) {
return (listener, thisArgs, disposables) => {
return event((i) => {
var _a10;
const data = this.data[this.data.length - 1];
if (!reduce) {
if (data) {
data.buffers.push(() => listener.call(thisArgs, i));
} else {
listener.call(thisArgs, i);
}
return;
}
const reduceData = data;
if (!reduceData) {
listener.call(thisArgs, reduce(initial, i));
return;
}
(_a10 = reduceData.items) !== null && _a10 !== void 0 ? _a10 : reduceData.items = [];
reduceData.items.push(i);
if (reduceData.buffers.length === 0) {
data.buffers.push(() => {
var _a11;
(_a11 = reduceData.reducedResult) !== null && _a11 !== void 0 ? _a11 : reduceData.reducedResult = initial ? reduceData.items.reduce(reduce, initial) : reduceData.items.reduce(reduce);
listener.call(thisArgs, reduceData.reducedResult);
});
}
}, void 0, disposables);
};
}
bufferEvents(fn) {
const data = { buffers: new Array() };
this.data.push(data);
const r = fn();
this.data.pop();
data.buffers.forEach((flush) => flush());
return r;
}
};
Relay = class {
constructor() {
this.listening = false;
this.inputEvent = Event.None;
this.inputEventListener = Disposable.None;
this.emitter = new Emitter({
onDidAddFirstListener: () => {
this.listening = true;
this.inputEventListener = this.inputEvent(this.emitter.fire, this.emitter);
},
onDidRemoveLastListener: () => {
this.listening = false;
this.inputEventListener.dispose();
}
});
this.event = this.emitter.event;
}
set input(event) {
this.inputEvent = event;
if (this.listening) {
this.inputEventListener.dispose();
this.inputEventListener = event(this.emitter.fire, this.emitter);
}
}
dispose() {
this.inputEventListener.dispose();
this.emitter.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/cancellation.js
function cancelOnDispose(store) {
const source = new CancellationTokenSource();
store.add({ dispose() {
source.cancel();
} });
return source.token;
}
var shortcutEvent, CancellationToken, MutableToken, CancellationTokenSource;
var init_cancellation = __esm({
"node_modules/monaco-editor/esm/vs/base/common/cancellation.js"() {
init_event();
shortcutEvent = Object.freeze(function(callback, context) {
const handle = setTimeout(callback.bind(context), 0);
return { dispose() {
clearTimeout(handle);
} };
});
(function(CancellationToken2) {
function isCancellationToken(thing) {
if (thing === CancellationToken2.None || thing === CancellationToken2.Cancelled) {
return true;
}
if (thing instanceof MutableToken) {
return true;
}
if (!thing || typeof thing !== "object") {
return false;
}
return typeof thing.isCancellationRequested === "boolean" && typeof thing.onCancellationRequested === "function";
}
CancellationToken2.isCancellationToken = isCancellationToken;
CancellationToken2.None = Object.freeze({
isCancellationRequested: false,
onCancellationRequested: Event.None
});
CancellationToken2.Cancelled = Object.freeze({
isCancellationRequested: true,
onCancellationRequested: shortcutEvent
});
})(CancellationToken || (CancellationToken = {}));
MutableToken = class {
constructor() {
this._isCancelled = false;
this._emitter = null;
}
cancel() {
if (!this._isCancelled) {
this._isCancelled = true;
if (this._emitter) {
this._emitter.fire(void 0);
this.dispose();
}
}
}
get isCancellationRequested() {
return this._isCancelled;
}
get onCancellationRequested() {
if (this._isCancelled) {
return shortcutEvent;
}
if (!this._emitter) {
this._emitter = new Emitter();
}
return this._emitter.event;
}
dispose() {
if (this._emitter) {
this._emitter.dispose();
this._emitter = null;
}
}
};
CancellationTokenSource = class {
constructor(parent) {
this._token = void 0;
this._parentListener = void 0;
this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);
}
get token() {
if (!this._token) {
this._token = new MutableToken();
}
return this._token;
}
cancel() {
if (!this._token) {
this._token = CancellationToken.Cancelled;
} else if (this._token instanceof MutableToken) {
this._token.cancel();
}
}
dispose(cancel = false) {
var _a10;
if (cancel) {
this.cancel();
}
(_a10 = this._parentListener) === null || _a10 === void 0 ? void 0 : _a10.dispose();
if (!this._token) {
this._token = CancellationToken.None;
} else if (this._token instanceof MutableToken) {
this._token.dispose();
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/keyCodes.js
function KeyChord(firstPart, secondPart) {
const chordPart = (secondPart & 65535) << 16 >>> 0;
return (firstPart | chordPart) >>> 0;
}
var KeyCodeStrMap, uiMap, userSettingsUSMap, userSettingsGeneralMap, EVENT_KEY_CODE_MAP, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE, scanCodeIntToStr, scanCodeStrToInt, scanCodeLowerCaseStrToInt, IMMUTABLE_CODE_TO_KEY_CODE, IMMUTABLE_KEY_CODE_TO_CODE, KeyCodeUtils;
var init_keyCodes = __esm({
"node_modules/monaco-editor/esm/vs/base/common/keyCodes.js"() {
KeyCodeStrMap = class {
constructor() {
this._keyCodeToStr = [];
this._strToKeyCode = /* @__PURE__ */ Object.create(null);
}
define(keyCode, str) {
this._keyCodeToStr[keyCode] = str;
this._strToKeyCode[str.toLowerCase()] = keyCode;
}
keyCodeToStr(keyCode) {
return this._keyCodeToStr[keyCode];
}
strToKeyCode(str) {
return this._strToKeyCode[str.toLowerCase()] || 0;
}
};
uiMap = new KeyCodeStrMap();
userSettingsUSMap = new KeyCodeStrMap();
userSettingsGeneralMap = new KeyCodeStrMap();
EVENT_KEY_CODE_MAP = new Array(230);
NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE = {};
scanCodeIntToStr = [];
scanCodeStrToInt = /* @__PURE__ */ Object.create(null);
scanCodeLowerCaseStrToInt = /* @__PURE__ */ Object.create(null);
IMMUTABLE_CODE_TO_KEY_CODE = [];
IMMUTABLE_KEY_CODE_TO_CODE = [];
for (let i = 0; i <= 193; i++) {
IMMUTABLE_CODE_TO_KEY_CODE[i] = -1;
}
for (let i = 0; i <= 132; i++) {
IMMUTABLE_KEY_CODE_TO_CODE[i] = -1;
}
(function() {
const empty2 = "";
const mappings = [
// immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel
[1, 0, "None", 0, "unknown", 0, "VK_UNKNOWN", empty2, empty2],
[1, 1, "Hyper", 0, empty2, 0, empty2, empty2, empty2],
[1, 2, "Super", 0, empty2, 0, empty2, empty2, empty2],
[1, 3, "Fn", 0, empty2, 0, empty2, empty2, empty2],
[1, 4, "FnLock", 0, empty2, 0, empty2, empty2, empty2],
[1, 5, "Suspend", 0, empty2, 0, empty2, empty2, empty2],
[1, 6, "Resume", 0, empty2, 0, empty2, empty2, empty2],
[1, 7, "Turbo", 0, empty2, 0, empty2, empty2, empty2],
[1, 8, "Sleep", 0, empty2, 0, "VK_SLEEP", empty2, empty2],
[1, 9, "WakeUp", 0, empty2, 0, empty2, empty2, empty2],
[0, 10, "KeyA", 31, "A", 65, "VK_A", empty2, empty2],
[0, 11, "KeyB", 32, "B", 66, "VK_B", empty2, empty2],
[0, 12, "KeyC", 33, "C", 67, "VK_C", empty2, empty2],
[0, 13, "KeyD", 34, "D", 68, "VK_D", empty2, empty2],
[0, 14, "KeyE", 35, "E", 69, "VK_E", empty2, empty2],
[0, 15, "KeyF", 36, "F", 70, "VK_F", empty2, empty2],
[0, 16, "KeyG", 37, "G", 71, "VK_G", empty2, empty2],
[0, 17, "KeyH", 38, "H", 72, "VK_H", empty2, empty2],
[0, 18, "KeyI", 39, "I", 73, "VK_I", empty2, empty2],
[0, 19, "KeyJ", 40, "J", 74, "VK_J", empty2, empty2],
[0, 20, "KeyK", 41, "K", 75, "VK_K", empty2, empty2],
[0, 21, "KeyL", 42, "L", 76, "VK_L", empty2, empty2],
[0, 22, "KeyM", 43, "M", 77, "VK_M", empty2, empty2],
[0, 23, "KeyN", 44, "N", 78, "VK_N", empty2, empty2],
[0, 24, "KeyO", 45, "O", 79, "VK_O", empty2, empty2],
[0, 25, "KeyP", 46, "P", 80, "VK_P", empty2, empty2],
[0, 26, "KeyQ", 47, "Q", 81, "VK_Q", empty2, empty2],
[0, 27, "KeyR", 48, "R", 82, "VK_R", empty2, empty2],
[0, 28, "KeyS", 49, "S", 83, "VK_S", empty2, empty2],
[0, 29, "KeyT", 50, "T", 84, "VK_T", empty2, empty2],
[0, 30, "KeyU", 51, "U", 85, "VK_U", empty2, empty2],
[0, 31, "KeyV", 52, "V", 86, "VK_V", empty2, empty2],
[0, 32, "KeyW", 53, "W", 87, "VK_W", empty2, empty2],
[0, 33, "KeyX", 54, "X", 88, "VK_X", empty2, empty2],
[0, 34, "KeyY", 55, "Y", 89, "VK_Y", empty2, empty2],
[0, 35, "KeyZ", 56, "Z", 90, "VK_Z", empty2, empty2],
[0, 36, "Digit1", 22, "1", 49, "VK_1", empty2, empty2],
[0, 37, "Digit2", 23, "2", 50, "VK_2", empty2, empty2],
[0, 38, "Digit3", 24, "3", 51, "VK_3", empty2, empty2],
[0, 39, "Digit4", 25, "4", 52, "VK_4", empty2, empty2],
[0, 40, "Digit5", 26, "5", 53, "VK_5", empty2, empty2],
[0, 41, "Digit6", 27, "6", 54, "VK_6", empty2, empty2],
[0, 42, "Digit7", 28, "7", 55, "VK_7", empty2, empty2],
[0, 43, "Digit8", 29, "8", 56, "VK_8", empty2, empty2],
[0, 44, "Digit9", 30, "9", 57, "VK_9", empty2, empty2],
[0, 45, "Digit0", 21, "0", 48, "VK_0", empty2, empty2],
[1, 46, "Enter", 3, "Enter", 13, "VK_RETURN", empty2, empty2],
[1, 47, "Escape", 9, "Escape", 27, "VK_ESCAPE", empty2, empty2],
[1, 48, "Backspace", 1, "Backspace", 8, "VK_BACK", empty2, empty2],
[1, 49, "Tab", 2, "Tab", 9, "VK_TAB", empty2, empty2],
[1, 50, "Space", 10, "Space", 32, "VK_SPACE", empty2, empty2],
[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, empty2, 0, empty2, empty2, empty2],
// has been dropped from the w3c spec
[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", empty2, empty2],
[1, 64, "F1", 59, "F1", 112, "VK_F1", empty2, empty2],
[1, 65, "F2", 60, "F2", 113, "VK_F2", empty2, empty2],
[1, 66, "F3", 61, "F3", 114, "VK_F3", empty2, empty2],
[1, 67, "F4", 62, "F4", 115, "VK_F4", empty2, empty2],
[1, 68, "F5", 63, "F5", 116, "VK_F5", empty2, empty2],
[1, 69, "F6", 64, "F6", 117, "VK_F6", empty2, empty2],
[1, 70, "F7", 65, "F7", 118, "VK_F7", empty2, empty2],
[1, 71, "F8", 66, "F8", 119, "VK_F8", empty2, empty2],
[1, 72, "F9", 67, "F9", 120, "VK_F9", empty2, empty2],
[1, 73, "F10", 68, "F10", 121, "VK_F10", empty2, empty2],
[1, 74, "F11", 69, "F11", 122, "VK_F11", empty2, empty2],
[1, 75, "F12", 70, "F12", 123, "VK_F12", empty2, empty2],
[1, 76, "PrintScreen", 0, empty2, 0, empty2, empty2, empty2],
[1, 77, "ScrollLock", 84, "ScrollLock", 145, "VK_SCROLL", empty2, empty2],
[1, 78, "Pause", 7, "PauseBreak", 19, "VK_PAUSE", empty2, empty2],
[1, 79, "Insert", 19, "Insert", 45, "VK_INSERT", empty2, empty2],
[1, 80, "Home", 14, "Home", 36, "VK_HOME", empty2, empty2],
[1, 81, "PageUp", 11, "PageUp", 33, "VK_PRIOR", empty2, empty2],
[1, 82, "Delete", 20, "Delete", 46, "VK_DELETE", empty2, empty2],
[1, 83, "End", 13, "End", 35, "VK_END", empty2, empty2],
[1, 84, "PageDown", 12, "PageDown", 34, "VK_NEXT", empty2, empty2],
[1, 85, "ArrowRight", 17, "RightArrow", 39, "VK_RIGHT", "Right", empty2],
[1, 86, "ArrowLeft", 15, "LeftArrow", 37, "VK_LEFT", "Left", empty2],
[1, 87, "ArrowDown", 18, "DownArrow", 40, "VK_DOWN", "Down", empty2],
[1, 88, "ArrowUp", 16, "UpArrow", 38, "VK_UP", "Up", empty2],
[1, 89, "NumLock", 83, "NumLock", 144, "VK_NUMLOCK", empty2, empty2],
[1, 90, "NumpadDivide", 113, "NumPad_Divide", 111, "VK_DIVIDE", empty2, empty2],
[1, 91, "NumpadMultiply", 108, "NumPad_Multiply", 106, "VK_MULTIPLY", empty2, empty2],
[1, 92, "NumpadSubtract", 111, "NumPad_Subtract", 109, "VK_SUBTRACT", empty2, empty2],
[1, 93, "NumpadAdd", 109, "NumPad_Add", 107, "VK_ADD", empty2, empty2],
[1, 94, "NumpadEnter", 3, empty2, 0, empty2, empty2, empty2],
[1, 95, "Numpad1", 99, "NumPad1", 97, "VK_NUMPAD1", empty2, empty2],
[1, 96, "Numpad2", 100, "NumPad2", 98, "VK_NUMPAD2", empty2, empty2],
[1, 97, "Numpad3", 101, "NumPad3", 99, "VK_NUMPAD3", empty2, empty2],
[1, 98, "Numpad4", 102, "NumPad4", 100, "VK_NUMPAD4", empty2, empty2],
[1, 99, "Numpad5", 103, "NumPad5", 101, "VK_NUMPAD5", empty2, empty2],
[1, 100, "Numpad6", 104, "NumPad6", 102, "VK_NUMPAD6", empty2, empty2],
[1, 101, "Numpad7", 105, "NumPad7", 103, "VK_NUMPAD7", empty2, empty2],
[1, 102, "Numpad8", 106, "NumPad8", 104, "VK_NUMPAD8", empty2, empty2],
[1, 103, "Numpad9", 107, "NumPad9", 105, "VK_NUMPAD9", empty2, empty2],
[1, 104, "Numpad0", 98, "NumPad0", 96, "VK_NUMPAD0", empty2, empty2],
[1, 105, "NumpadDecimal", 112, "NumPad_Decimal", 110, "VK_DECIMAL", empty2, empty2],
[0, 106, "IntlBackslash", 97, "OEM_102", 226, "VK_OEM_102", empty2, empty2],
[1, 107, "ContextMenu", 58, "ContextMenu", 93, empty2, empty2, empty2],
[1, 108, "Power", 0, empty2, 0, empty2, empty2, empty2],
[1, 109, "NumpadEqual", 0, empty2, 0, empty2, empty2, empty2],
[1, 110, "F13", 71, "F13", 124, "VK_F13", empty2, empty2],
[1, 111, "F14", 72, "F14", 125, "VK_F14", empty2, empty2],
[1, 112, "F15", 73, "F15", 126, "VK_F15", empty2, empty2],
[1, 113, "F16", 74, "F16", 127, "VK_F16", empty2, empty2],
[1, 114, "F17", 75, "F17", 128, "VK_F17", empty2, empty2],
[1, 115, "F18", 76, "F18", 129, "VK_F18", empty2, empty2],
[1, 116, "F19", 77, "F19", 130, "VK_F19", empty2, empty2],
[1, 117, "F20", 78, "F20", 131, "VK_F20", empty2, empty2],
[1, 118, "F21", 79, "F21", 132, "VK_F21", empty2, empty2],
[1, 119, "F22", 80, "F22", 133, "VK_F22", empty2, empty2],
[1, 120, "F23", 81, "F23", 134, "VK_F23", empty2, empty2],
[1, 121, "F24", 82, "F24", 135, "VK_F24", empty2, empty2],
[1, 122, "Open", 0, empty2, 0, empty2, empty2, empty2],
[1, 123, "Help", 0, empty2, 0, empty2, empty2, empty2],
[1, 124, "Select", 0, empty2, 0, empty2, empty2, empty2],
[1, 125, "Again", 0, empty2, 0, empty2, empty2, empty2],
[1, 126, "Undo", 0, empty2, 0, empty2, empty2, empty2],
[1, 127, "Cut", 0, empty2, 0, empty2, empty2, empty2],
[1, 128, "Copy", 0, empty2, 0, empty2, empty2, empty2],
[1, 129, "Paste", 0, empty2, 0, empty2, empty2, empty2],
[1, 130, "Find", 0, empty2, 0, empty2, empty2, empty2],
[1, 131, "AudioVolumeMute", 117, "AudioVolumeMute", 173, "VK_VOLUME_MUTE", empty2, empty2],
[1, 132, "AudioVolumeUp", 118, "AudioVolumeUp", 175, "VK_VOLUME_UP", empty2, empty2],
[1, 133, "AudioVolumeDown", 119, "AudioVolumeDown", 174, "VK_VOLUME_DOWN", empty2, empty2],
[1, 134, "NumpadComma", 110, "NumPad_Separator", 108, "VK_SEPARATOR", empty2, empty2],
[0, 135, "IntlRo", 115, "ABNT_C1", 193, "VK_ABNT_C1", empty2, empty2],
[1, 136, "KanaMode", 0, empty2, 0, empty2, empty2, empty2],
[0, 137, "IntlYen", 0, empty2, 0, empty2, empty2, empty2],
[1, 138, "Convert", 0, empty2, 0, empty2, empty2, empty2],
[1, 139, "NonConvert", 0, empty2, 0, empty2, empty2, empty2],
[1, 140, "Lang1", 0, empty2, 0, empty2, empty2, empty2],
[1, 141, "Lang2", 0, empty2, 0, empty2, empty2, empty2],
[1, 142, "Lang3", 0, empty2, 0, empty2, empty2, empty2],
[1, 143, "Lang4", 0, empty2, 0, empty2, empty2, empty2],
[1, 144, "Lang5", 0, empty2, 0, empty2, empty2, empty2],
[1, 145, "Abort", 0, empty2, 0, empty2, empty2, empty2],
[1, 146, "Props", 0, empty2, 0, empty2, empty2, empty2],
[1, 147, "NumpadParenLeft", 0, empty2, 0, empty2, empty2, empty2],
[1, 148, "NumpadParenRight", 0, empty2, 0, empty2, empty2, empty2],
[1, 149, "NumpadBackspace", 0, empty2, 0, empty2, empty2, empty2],
[1, 150, "NumpadMemoryStore", 0, empty2, 0, empty2, empty2, empty2],
[1, 151, "NumpadMemoryRecall", 0, empty2, 0, empty2, empty2, empty2],
[1, 152, "NumpadMemoryClear", 0, empty2, 0, empty2, empty2, empty2],
[1, 153, "NumpadMemoryAdd", 0, empty2, 0, empty2, empty2, empty2],
[1, 154, "NumpadMemorySubtract", 0, empty2, 0, empty2, empty2, empty2],
[1, 155, "NumpadClear", 131, "Clear", 12, "VK_CLEAR", empty2, empty2],
[1, 156, "NumpadClearEntry", 0, empty2, 0, empty2, empty2, empty2],
[1, 0, empty2, 5, "Ctrl", 17, "VK_CONTROL", empty2, empty2],
[1, 0, empty2, 4, "Shift", 16, "VK_SHIFT", empty2, empty2],
[1, 0, empty2, 6, "Alt", 18, "VK_MENU", empty2, empty2],
[1, 0, empty2, 57, "Meta", 91, "VK_COMMAND", empty2, empty2],
[1, 157, "ControlLeft", 5, empty2, 0, "VK_LCONTROL", empty2, empty2],
[1, 158, "ShiftLeft", 4, empty2, 0, "VK_LSHIFT", empty2, empty2],
[1, 159, "AltLeft", 6, empty2, 0, "VK_LMENU", empty2, empty2],
[1, 160, "MetaLeft", 57, empty2, 0, "VK_LWIN", empty2, empty2],
[1, 161, "ControlRight", 5, empty2, 0, "VK_RCONTROL", empty2, empty2],
[1, 162, "ShiftRight", 4, empty2, 0, "VK_RSHIFT", empty2, empty2],
[1, 163, "AltRight", 6, empty2, 0, "VK_RMENU", empty2, empty2],
[1, 164, "MetaRight", 57, empty2, 0, "VK_RWIN", empty2, empty2],
[1, 165, "BrightnessUp", 0, empty2, 0, empty2, empty2, empty2],
[1, 166, "BrightnessDown", 0, empty2, 0, empty2, empty2, empty2],
[1, 167, "MediaPlay", 0, empty2, 0, empty2, empty2, empty2],
[1, 168, "MediaRecord", 0, empty2, 0, empty2, empty2, empty2],
[1, 169, "MediaFastForward", 0, empty2, 0, empty2, empty2, empty2],
[1, 170, "MediaRewind", 0, empty2, 0, empty2, empty2, empty2],
[1, 171, "MediaTrackNext", 124, "MediaTrackNext", 176, "VK_MEDIA_NEXT_TRACK", empty2, empty2],
[1, 172, "MediaTrackPrevious", 125, "MediaTrackPrevious", 177, "VK_MEDIA_PREV_TRACK", empty2, empty2],
[1, 173, "MediaStop", 126, "MediaStop", 178, "VK_MEDIA_STOP", empty2, empty2],
[1, 174, "Eject", 0, empty2, 0, empty2, empty2, empty2],
[1, 175, "MediaPlayPause", 127, "MediaPlayPause", 179, "VK_MEDIA_PLAY_PAUSE", empty2, empty2],
[1, 176, "MediaSelect", 128, "LaunchMediaPlayer", 181, "VK_MEDIA_LAUNCH_MEDIA_SELECT", empty2, empty2],
[1, 177, "LaunchMail", 129, "LaunchMail", 180, "VK_MEDIA_LAUNCH_MAIL", empty2, empty2],
[1, 178, "LaunchApp2", 130, "LaunchApp2", 183, "VK_MEDIA_LAUNCH_APP2", empty2, empty2],
[1, 179, "LaunchApp1", 0, empty2, 0, "VK_MEDIA_LAUNCH_APP1", empty2, empty2],
[1, 180, "SelectTask", 0, empty2, 0, empty2, empty2, empty2],
[1, 181, "LaunchScreenSaver", 0, empty2, 0, empty2, empty2, empty2],
[1, 182, "BrowserSearch", 120, "BrowserSearch", 170, "VK_BROWSER_SEARCH", empty2, empty2],
[1, 183, "BrowserHome", 121, "BrowserHome", 172, "VK_BROWSER_HOME", empty2, empty2],
[1, 184, "BrowserBack", 122, "BrowserBack", 166, "VK_BROWSER_BACK", empty2, empty2],
[1, 185, "BrowserForward", 123, "BrowserForward", 167, "VK_BROWSER_FORWARD", empty2, empty2],
[1, 186, "BrowserStop", 0, empty2, 0, "VK_BROWSER_STOP", empty2, empty2],
[1, 187, "BrowserRefresh", 0, empty2, 0, "VK_BROWSER_REFRESH", empty2, empty2],
[1, 188, "BrowserFavorites", 0, empty2, 0, "VK_BROWSER_FAVORITES", empty2, empty2],
[1, 189, "ZoomToggle", 0, empty2, 0, empty2, empty2, empty2],
[1, 190, "MailReply", 0, empty2, 0, empty2, empty2, empty2],
[1, 191, "MailForward", 0, empty2, 0, empty2, empty2, empty2],
[1, 192, "MailSend", 0, empty2, 0, empty2, empty2, empty2],
// See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
// If an Input Method Editor is processing key input and the event is keydown, return 229.
[1, 0, empty2, 114, "KeyInComposition", 229, empty2, empty2, empty2],
[1, 0, empty2, 116, "ABNT_C2", 194, "VK_ABNT_C2", empty2, empty2],
[1, 0, empty2, 96, "OEM_8", 223, "VK_OEM_8", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_KANA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HANGUL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_JUNJA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_FINAL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HANJA", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_KANJI", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_CONVERT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_NONCONVERT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ACCEPT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_MODECHANGE", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_SELECT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PRINT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EXECUTE", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_SNAPSHOT", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_HELP", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_APPS", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PROCESSKEY", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PACKET", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_DBE_SBCSCHAR", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_DBE_DBCSCHAR", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ATTN", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_CRSEL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EXSEL", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_EREOF", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PLAY", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_ZOOM", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_NONAME", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_PA1", empty2, empty2],
[1, 0, empty2, 0, empty2, 0, "VK_OEM_CLEAR", empty2, empty2]
];
const seenKeyCode = [];
const seenScanCode = [];
for (const mapping of mappings) {
const [immutable, scanCode, scanCodeStr, keyCode, keyCodeStr, eventKeyCode, vkey, usUserSettingsLabel, generalUserSettingsLabel] = mapping;
if (!seenScanCode[scanCode]) {
seenScanCode[scanCode] = true;
scanCodeIntToStr[scanCode] = scanCodeStr;
scanCodeStrToInt[scanCodeStr] = scanCode;
scanCodeLowerCaseStrToInt[scanCodeStr.toLowerCase()] = scanCode;
if (immutable) {
IMMUTABLE_CODE_TO_KEY_CODE[scanCode] = keyCode;
if (keyCode !== 0 && keyCode !== 3 && keyCode !== 5 && keyCode !== 4 && keyCode !== 6 && keyCode !== 57) {
IMMUTABLE_KEY_CODE_TO_CODE[keyCode] = scanCode;
}
}
}
if (!seenKeyCode[keyCode]) {
seenKeyCode[keyCode] = true;
if (!keyCodeStr) {
throw new Error(`String representation missing for key code ${keyCode} around scan code ${scanCodeStr}`);
}
uiMap.define(keyCode, keyCodeStr);
userSettingsUSMap.define(keyCode, usUserSettingsLabel || keyCodeStr);
userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel || usUserSettingsLabel || keyCodeStr);
}
if (eventKeyCode) {
EVENT_KEY_CODE_MAP[eventKeyCode] = keyCode;
}
if (vkey) {
NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[vkey] = keyCode;
}
}
IMMUTABLE_KEY_CODE_TO_CODE[
3
/* KeyCode.Enter */
] = 46;
})();
(function(KeyCodeUtils2) {
function toString(keyCode) {
return uiMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toString = toString;
function fromString(key) {
return uiMap.strToKeyCode(key);
}
KeyCodeUtils2.fromString = fromString;
function toUserSettingsUS(keyCode) {
return userSettingsUSMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toUserSettingsUS = toUserSettingsUS;
function toUserSettingsGeneral(keyCode) {
return userSettingsGeneralMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toUserSettingsGeneral = toUserSettingsGeneral;
function fromUserSettings(key) {
return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);
}
KeyCodeUtils2.fromUserSettings = fromUserSettings;
function toElectronAccelerator(keyCode) {
if (keyCode >= 98 && keyCode <= 113) {
return null;
}
switch (keyCode) {
case 16:
return "Up";
case 18:
return "Down";
case 15:
return "Left";
case 17:
return "Right";
}
return uiMap.keyCodeToStr(keyCode);
}
KeyCodeUtils2.toElectronAccelerator = toElectronAccelerator;
})(KeyCodeUtils || (KeyCodeUtils = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/common/process.js
var safeProcess, vscodeGlobal, cwd, env, platform;
var init_process = __esm({
"node_modules/monaco-editor/esm/vs/base/common/process.js"() {
init_platform();
vscodeGlobal = globalThis.vscode;
if (typeof vscodeGlobal !== "undefined" && typeof vscodeGlobal.process !== "undefined") {
const sandboxProcess = vscodeGlobal.process;
safeProcess = {
get platform() {
return sandboxProcess.platform;
},
get arch() {
return sandboxProcess.arch;
},
get env() {
return sandboxProcess.env;
},
cwd() {
return sandboxProcess.cwd();
}
};
} else if (typeof process !== "undefined") {
safeProcess = {
get platform() {
return process.platform;
},
get arch() {
return process.arch;
},
get env() {
return process.env;
},
cwd() {
return process.env["VSCODE_CWD"] || process.cwd();
}
};
} else {
safeProcess = {
// Supported
get platform() {
return isWindows ? "win32" : isMacintosh ? "darwin" : "linux";
},
get arch() {
return void 0;
},
// Unsupported
get env() {
return {};
},
cwd() {
return "/";
}
};
}
cwd = safeProcess.cwd;
env = safeProcess.env;
platform = safeProcess.platform;
}
});
// node_modules/monaco-editor/esm/vs/base/common/path.js
function validateObject(pathObject, name) {
if (pathObject === null || typeof pathObject !== "object") {
throw new ErrorInvalidArgType(name, "Object", pathObject);
}
}
function validateString(value, name) {
if (typeof value !== "string") {
throw new ErrorInvalidArgType(name, "string", value);
}
}
function isPathSeparator(code) {
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
}
function isPosixPathSeparator(code) {
return code === CHAR_FORWARD_SLASH;
}
function isWindowsDeviceRoot(code) {
return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z || code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;
}
function normalizeString(path, allowAboveRoot, separator, isPathSeparator3) {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let code = 0;
for (let i = 0; i <= path.length; ++i) {
if (i < path.length) {
code = path.charCodeAt(i);
} else if (isPathSeparator3(code)) {
break;
} else {
code = CHAR_FORWARD_SLASH;
}
if (isPathSeparator3(code)) {
if (lastSlash === i - 1 || dots === 1) {
} else if (dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf(separator);
if (lastSlashIndex === -1) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);
}
lastSlash = i;
dots = 0;
continue;
} else if (res.length !== 0) {
res = "";
lastSegmentLength = 0;
lastSlash = i;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
res += res.length > 0 ? `${separator}..` : "..";
lastSegmentLength = 2;
}
} else {
if (res.length > 0) {
res += `${separator}${path.slice(lastSlash + 1, i)}`;
} else {
res = path.slice(lastSlash + 1, i);
}
lastSegmentLength = i - lastSlash - 1;
}
lastSlash = i;
dots = 0;
} else if (code === CHAR_DOT && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
function _format2(sep2, pathObject) {
validateObject(pathObject, "pathObject");
const dir = pathObject.dir || pathObject.root;
const base = pathObject.base || `${pathObject.name || ""}${pathObject.ext || ""}`;
if (!dir) {
return base;
}
return dir === pathObject.root ? `${dir}${base}` : `${dir}${sep2}${base}`;
}
var CHAR_UPPERCASE_A, CHAR_LOWERCASE_A, CHAR_UPPERCASE_Z, CHAR_LOWERCASE_Z, CHAR_DOT, CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_QUESTION_MARK, ErrorInvalidArgType, platformIsWin32, win32, posixCwd, posix, normalize, resolve, relative, dirname, basename, extname, sep;
var init_path = __esm({
"node_modules/monaco-editor/esm/vs/base/common/path.js"() {
init_process();
CHAR_UPPERCASE_A = 65;
CHAR_LOWERCASE_A = 97;
CHAR_UPPERCASE_Z = 90;
CHAR_LOWERCASE_Z = 122;
CHAR_DOT = 46;
CHAR_FORWARD_SLASH = 47;
CHAR_BACKWARD_SLASH = 92;
CHAR_COLON = 58;
CHAR_QUESTION_MARK = 63;
ErrorInvalidArgType = class extends Error {
constructor(name, expected, actual) {
let determiner;
if (typeof expected === "string" && expected.indexOf("not ") === 0) {
determiner = "must not be";
expected = expected.replace(/^not /, "");
} else {
determiner = "must be";
}
const type = name.indexOf(".") !== -1 ? "property" : "argument";
let msg = `The "${name}" ${type} ${determiner} of type ${expected}`;
msg += `. Received type ${typeof actual}`;
super(msg);
this.code = "ERR_INVALID_ARG_TYPE";
}
};
platformIsWin32 = platform === "win32";
win32 = {
// path.resolve([from ...], to)
resolve(...pathSegments) {
let resolvedDevice = "";
let resolvedTail = "";
let resolvedAbsolute = false;
for (let i = pathSegments.length - 1; i >= -1; i--) {
let path;
if (i >= 0) {
path = pathSegments[i];
validateString(path, "path");
if (path.length === 0) {
continue;
}
} else if (resolvedDevice.length === 0) {
path = cwd();
} else {
path = env[`=${resolvedDevice}`] || cwd();
if (path === void 0 || path.slice(0, 2).toLowerCase() !== resolvedDevice.toLowerCase() && path.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
path = `${resolvedDevice}\\`;
}
}
const len = path.length;
let rootEnd = 0;
let device = "";
let isAbsolute = false;
const code = path.charCodeAt(0);
if (len === 1) {
if (isPathSeparator(code)) {
rootEnd = 1;
isAbsolute = true;
}
} else if (isPathSeparator(code)) {
isAbsolute = true;
if (isPathSeparator(path.charCodeAt(1))) {
let j = 2;
let last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
const firstPart = path.slice(last, j);
last = j;
while (j < len && isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j === len || j !== last) {
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
rootEnd = j;
}
}
}
} else {
rootEnd = 1;
}
} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {
device = path.slice(0, 2);
rootEnd = 2;
if (len > 2 && isPathSeparator(path.charCodeAt(2))) {
isAbsolute = true;
rootEnd = 3;
}
}
if (device.length > 0) {
if (resolvedDevice.length > 0) {
if (device.toLowerCase() !== resolvedDevice.toLowerCase()) {
continue;
}
} else {
resolvedDevice = device;
}
}
if (resolvedAbsolute) {
if (resolvedDevice.length > 0) {
break;
}
} else {
resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`;
resolvedAbsolute = isAbsolute;
if (isAbsolute && resolvedDevice.length > 0) {
break;
}
}
}
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
return resolvedAbsolute ? `${resolvedDevice}\\${resolvedTail}` : `${resolvedDevice}${resolvedTail}` || ".";
},
normalize(path) {
validateString(path, "path");
const len = path.length;
if (len === 0) {
return ".";
}
let rootEnd = 0;
let device;
let isAbsolute = false;
const code = path.charCodeAt(0);
if (len === 1) {
return isPosixPathSeparator(code) ? "\\" : path;
}
if (isPathSeparator(code)) {
isAbsolute = true;
if (isPathSeparator(path.charCodeAt(1))) {
let j = 2;
let last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
const firstPart = path.slice(last, j);
last = j;
while (j < len && isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j === len) {
return `\\\\${firstPart}\\${path.slice(last)}\\`;
}
if (j !== last) {
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
rootEnd = j;
}
}
}
} else {
rootEnd = 1;
}
} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {
device = path.slice(0, 2);
rootEnd = 2;
if (len > 2 && isPathSeparator(path.charCodeAt(2))) {
isAbsolute = true;
rootEnd = 3;
}
}
let tail3 = rootEnd < len ? normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator) : "";
if (tail3.length === 0 && !isAbsolute) {
tail3 = ".";
}
if (tail3.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
tail3 += "\\";
}
if (device === void 0) {
return isAbsolute ? `\\${tail3}` : tail3;
}
return isAbsolute ? `${device}\\${tail3}` : `${device}${tail3}`;
},
isAbsolute(path) {
validateString(path, "path");
const len = path.length;
if (len === 0) {
return false;
}
const code = path.charCodeAt(0);
return isPathSeparator(code) || // Possible device root
len > 2 && isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON && isPathSeparator(path.charCodeAt(2));
},
join(...paths) {
if (paths.length === 0) {
return ".";
}
let joined;
let firstPart;
for (let i = 0; i < paths.length; ++i) {
const arg = paths[i];
validateString(arg, "path");
if (arg.length > 0) {
if (joined === void 0) {
joined = firstPart = arg;
} else {
joined += `\\${arg}`;
}
}
}
if (joined === void 0) {
return ".";
}
let needsReplace = true;
let slashCount = 0;
if (typeof firstPart === "string" && isPathSeparator(firstPart.charCodeAt(0))) {
++slashCount;
const firstLen = firstPart.length;
if (firstLen > 1 && isPathSeparator(firstPart.charCodeAt(1))) {
++slashCount;
if (firstLen > 2) {
if (isPathSeparator(firstPart.charCodeAt(2))) {
++slashCount;
} else {
needsReplace = false;
}
}
}
}
if (needsReplace) {
while (slashCount < joined.length && isPathSeparator(joined.charCodeAt(slashCount))) {
slashCount++;
}
if (slashCount >= 2) {
joined = `\\${joined.slice(slashCount)}`;
}
}
return win32.normalize(joined);
},
// It will solve the relative path from `from` to `to`, for instance:
// from = 'C:\\orandea\\test\\aaa'
// to = 'C:\\orandea\\impl\\bbb'
// The output of the function should be: '..\\..\\impl\\bbb'
relative(from, to) {
validateString(from, "from");
validateString(to, "to");
if (from === to) {
return "";
}
const fromOrig = win32.resolve(from);
const toOrig = win32.resolve(to);
if (fromOrig === toOrig) {
return "";
}
from = fromOrig.toLowerCase();
to = toOrig.toLowerCase();
if (from === to) {
return "";
}
let fromStart = 0;
while (fromStart < from.length && from.charCodeAt(fromStart) === CHAR_BACKWARD_SLASH) {
fromStart++;
}
let fromEnd = from.length;
while (fromEnd - 1 > fromStart && from.charCodeAt(fromEnd - 1) === CHAR_BACKWARD_SLASH) {
fromEnd--;
}
const fromLen = fromEnd - fromStart;
let toStart = 0;
while (toStart < to.length && to.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
toStart++;
}
let toEnd = to.length;
while (toEnd - 1 > toStart && to.charCodeAt(toEnd - 1) === CHAR_BACKWARD_SLASH) {
toEnd--;
}
const toLen = toEnd - toStart;
const length = fromLen < toLen ? fromLen : toLen;
let lastCommonSep = -1;
let i = 0;
for (; i < length; i++) {
const fromCode = from.charCodeAt(fromStart + i);
if (fromCode !== to.charCodeAt(toStart + i)) {
break;
} else if (fromCode === CHAR_BACKWARD_SLASH) {
lastCommonSep = i;
}
}
if (i !== length) {
if (lastCommonSep === -1) {
return toOrig;
}
} else {
if (toLen > length) {
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
return toOrig.slice(toStart + i + 1);
}
if (i === 2) {
return toOrig.slice(toStart + i);
}
}
if (fromLen > length) {
if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
lastCommonSep = i;
} else if (i === 2) {
lastCommonSep = 3;
}
}
if (lastCommonSep === -1) {
lastCommonSep = 0;
}
}
let out = "";
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
out += out.length === 0 ? ".." : "\\..";
}
}
toStart += lastCommonSep;
if (out.length > 0) {
return `${out}${toOrig.slice(toStart, toEnd)}`;
}
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
++toStart;
}
return toOrig.slice(toStart, toEnd);
},
toNamespacedPath(path) {
if (typeof path !== "string" || path.length === 0) {
return path;
}
const resolvedPath = win32.resolve(path);
if (resolvedPath.length <= 2) {
return path;
}
if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
const code = resolvedPath.charCodeAt(2);
if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
return `\\\\?\\UNC\\${resolvedPath.slice(2)}`;
}
}
} else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0)) && resolvedPath.charCodeAt(1) === CHAR_COLON && resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
return `\\\\?\\${resolvedPath}`;
}
return path;
},
dirname(path) {
validateString(path, "path");
const len = path.length;
if (len === 0) {
return ".";
}
let rootEnd = -1;
let offset = 0;
const code = path.charCodeAt(0);
if (len === 1) {
return isPathSeparator(code) ? path : ".";
}
if (isPathSeparator(code)) {
rootEnd = offset = 1;
if (isPathSeparator(path.charCodeAt(1))) {
let j = 2;
let last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j === len) {
return path;
}
if (j !== last) {
rootEnd = offset = j + 1;
}
}
}
}
} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {
rootEnd = len > 2 && isPathSeparator(path.charCodeAt(2)) ? 3 : 2;
offset = rootEnd;
}
let end = -1;
let matchedSlash = true;
for (let i = len - 1; i >= offset; --i) {
if (isPathSeparator(path.charCodeAt(i))) {
if (!matchedSlash) {
end = i;
break;
}
} else {
matchedSlash = false;
}
}
if (end === -1) {
if (rootEnd === -1) {
return ".";
}
end = rootEnd;
}
return path.slice(0, end);
},
basename(path, ext) {
if (ext !== void 0) {
validateString(ext, "ext");
}
validateString(path, "path");
let start = 0;
let end = -1;
let matchedSlash = true;
let i;
if (path.length >= 2 && isWindowsDeviceRoot(path.charCodeAt(0)) && path.charCodeAt(1) === CHAR_COLON) {
start = 2;
}
if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
if (ext === path) {
return "";
}
let extIdx = ext.length - 1;
let firstNonSlashEnd = -1;
for (i = path.length - 1; i >= start; --i) {
const code = path.charCodeAt(i);
if (isPathSeparator(code)) {
if (!matchedSlash) {
start = i + 1;
break;
}
} else {
if (firstNonSlashEnd === -1) {
matchedSlash = false;
firstNonSlashEnd = i + 1;
}
if (extIdx >= 0) {
if (code === ext.charCodeAt(extIdx)) {
if (--extIdx === -1) {
end = i;
}
} else {
extIdx = -1;
end = firstNonSlashEnd;
}
}
}
}
if (start === end) {
end = firstNonSlashEnd;
} else if (end === -1) {
end = path.length;
}
return path.slice(start, end);
}
for (i = path.length - 1; i >= start; --i) {
if (isPathSeparator(path.charCodeAt(i))) {
if (!matchedSlash) {
start = i + 1;
break;
}
} else if (end === -1) {
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) {
return "";
}
return path.slice(start, end);
},
extname(path) {
validateString(path, "path");
let start = 0;
let startDot = -1;
let startPart = 0;
let end = -1;
let matchedSlash = true;
let preDotState = 0;
if (path.length >= 2 && path.charCodeAt(1) === CHAR_COLON && isWindowsDeviceRoot(path.charCodeAt(0))) {
start = startPart = 2;
}
for (let i = path.length - 1; i >= start; --i) {
const code = path.charCodeAt(i);
if (isPathSeparator(code)) {
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (startDot === -1) {
startDot = i;
} else if (preDotState !== 1) {
preDotState = 1;
}
} else if (startDot !== -1) {
preDotState = -1;
}
}
if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
return "";
}
return path.slice(startDot, end);
},
format: _format2.bind(null, "\\"),
parse(path) {
validateString(path, "path");
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
if (path.length === 0) {
return ret;
}
const len = path.length;
let rootEnd = 0;
let code = path.charCodeAt(0);
if (len === 1) {
if (isPathSeparator(code)) {
ret.root = ret.dir = path;
return ret;
}
ret.base = ret.name = path;
return ret;
}
if (isPathSeparator(code)) {
rootEnd = 1;
if (isPathSeparator(path.charCodeAt(1))) {
let j = 2;
let last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j < len && j !== last) {
last = j;
while (j < len && !isPathSeparator(path.charCodeAt(j))) {
j++;
}
if (j === len) {
rootEnd = j;
} else if (j !== last) {
rootEnd = j + 1;
}
}
}
}
} else if (isWindowsDeviceRoot(code) && path.charCodeAt(1) === CHAR_COLON) {
if (len <= 2) {
ret.root = ret.dir = path;
return ret;
}
rootEnd = 2;
if (isPathSeparator(path.charCodeAt(2))) {
if (len === 3) {
ret.root = ret.dir = path;
return ret;
}
rootEnd = 3;
}
}
if (rootEnd > 0) {
ret.root = path.slice(0, rootEnd);
}
let startDot = -1;
let startPart = rootEnd;
let end = -1;
let matchedSlash = true;
let i = path.length - 1;
let preDotState = 0;
for (; i >= rootEnd; --i) {
code = path.charCodeAt(i);
if (isPathSeparator(code)) {
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (startDot === -1) {
startDot = i;
} else if (preDotState !== 1) {
preDotState = 1;
}
} else if (startDot !== -1) {
preDotState = -1;
}
}
if (end !== -1) {
if (startDot === -1 || // We saw a non-dot character immediately before the dot
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
ret.base = ret.name = path.slice(startPart, end);
} else {
ret.name = path.slice(startPart, startDot);
ret.base = path.slice(startPart, end);
ret.ext = path.slice(startDot, end);
}
}
if (startPart > 0 && startPart !== rootEnd) {
ret.dir = path.slice(0, startPart - 1);
} else {
ret.dir = ret.root;
}
return ret;
},
sep: "\\",
delimiter: ";",
win32: null,
posix: null
};
posixCwd = (() => {
if (platformIsWin32) {
const regexp = /\\/g;
return () => {
const cwd2 = cwd().replace(regexp, "/");
return cwd2.slice(cwd2.indexOf("/"));
};
}
return () => cwd();
})();
posix = {
// path.resolve([from ...], to)
resolve(...pathSegments) {
let resolvedPath = "";
let resolvedAbsolute = false;
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
const path = i >= 0 ? pathSegments[i] : posixCwd();
validateString(path, "path");
if (path.length === 0) {
continue;
}
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
}
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
if (resolvedAbsolute) {
return `/${resolvedPath}`;
}
return resolvedPath.length > 0 ? resolvedPath : ".";
},
normalize(path) {
validateString(path, "path");
if (path.length === 0) {
return ".";
}
const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
const trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;
path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
if (path.length === 0) {
if (isAbsolute) {
return "/";
}
return trailingSeparator ? "./" : ".";
}
if (trailingSeparator) {
path += "/";
}
return isAbsolute ? `/${path}` : path;
},
isAbsolute(path) {
validateString(path, "path");
return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;
},
join(...paths) {
if (paths.length === 0) {
return ".";
}
let joined;
for (let i = 0; i < paths.length; ++i) {
const arg = paths[i];
validateString(arg, "path");
if (arg.length > 0) {
if (joined === void 0) {
joined = arg;
} else {
joined += `/${arg}`;
}
}
}
if (joined === void 0) {
return ".";
}
return posix.normalize(joined);
},
relative(from, to) {
validateString(from, "from");
validateString(to, "to");
if (from === to) {
return "";
}
from = posix.resolve(from);
to = posix.resolve(to);
if (from === to) {
return "";
}
const fromStart = 1;
const fromEnd = from.length;
const fromLen = fromEnd - fromStart;
const toStart = 1;
const toLen = to.length - toStart;
const length = fromLen < toLen ? fromLen : toLen;
let lastCommonSep = -1;
let i = 0;
for (; i < length; i++) {
const fromCode = from.charCodeAt(fromStart + i);
if (fromCode !== to.charCodeAt(toStart + i)) {
break;
} else if (fromCode === CHAR_FORWARD_SLASH) {
lastCommonSep = i;
}
}
if (i === length) {
if (toLen > length) {
if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {
return to.slice(toStart + i + 1);
}
if (i === 0) {
return to.slice(toStart + i);
}
} else if (fromLen > length) {
if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {
lastCommonSep = i;
} else if (i === 0) {
lastCommonSep = 0;
}
}
}
let out = "";
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {
out += out.length === 0 ? ".." : "/..";
}
}
return `${out}${to.slice(toStart + lastCommonSep)}`;
},
toNamespacedPath(path) {
return path;
},
dirname(path) {
validateString(path, "path");
if (path.length === 0) {
return ".";
}
const hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
let end = -1;
let matchedSlash = true;
for (let i = path.length - 1; i >= 1; --i) {
if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
end = i;
break;
}
} else {
matchedSlash = false;
}
}
if (end === -1) {
return hasRoot ? "/" : ".";
}
if (hasRoot && end === 1) {
return "//";
}
return path.slice(0, end);
},
basename(path, ext) {
if (ext !== void 0) {
validateString(ext, "ext");
}
validateString(path, "path");
let start = 0;
let end = -1;
let matchedSlash = true;
let i;
if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
if (ext === path) {
return "";
}
let extIdx = ext.length - 1;
let firstNonSlashEnd = -1;
for (i = path.length - 1; i >= 0; --i) {
const code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
start = i + 1;
break;
}
} else {
if (firstNonSlashEnd === -1) {
matchedSlash = false;
firstNonSlashEnd = i + 1;
}
if (extIdx >= 0) {
if (code === ext.charCodeAt(extIdx)) {
if (--extIdx === -1) {
end = i;
}
} else {
extIdx = -1;
end = firstNonSlashEnd;
}
}
}
}
if (start === end) {
end = firstNonSlashEnd;
} else if (end === -1) {
end = path.length;
}
return path.slice(start, end);
}
for (i = path.length - 1; i >= 0; --i) {
if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
start = i + 1;
break;
}
} else if (end === -1) {
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) {
return "";
}
return path.slice(start, end);
},
extname(path) {
validateString(path, "path");
let startDot = -1;
let startPart = 0;
let end = -1;
let matchedSlash = true;
let preDotState = 0;
for (let i = path.length - 1; i >= 0; --i) {
const code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (startDot === -1) {
startDot = i;
} else if (preDotState !== 1) {
preDotState = 1;
}
} else if (startDot !== -1) {
preDotState = -1;
}
}
if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
return "";
}
return path.slice(startDot, end);
},
format: _format2.bind(null, "/"),
parse(path) {
validateString(path, "path");
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
if (path.length === 0) {
return ret;
}
const isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
let start;
if (isAbsolute) {
ret.root = "/";
start = 1;
} else {
start = 0;
}
let startDot = -1;
let startPart = 0;
let end = -1;
let matchedSlash = true;
let i = path.length - 1;
let preDotState = 0;
for (; i >= start; --i) {
const code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
if (startDot === -1) {
startDot = i;
} else if (preDotState !== 1) {
preDotState = 1;
}
} else if (startDot !== -1) {
preDotState = -1;
}
}
if (end !== -1) {
const start2 = startPart === 0 && isAbsolute ? 1 : startPart;
if (startDot === -1 || // We saw a non-dot character immediately before the dot
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
ret.base = ret.name = path.slice(start2, end);
} else {
ret.name = path.slice(start2, startDot);
ret.base = path.slice(start2, end);
ret.ext = path.slice(startDot, end);
}
}
if (startPart > 0) {
ret.dir = path.slice(0, startPart - 1);
} else if (isAbsolute) {
ret.dir = "/";
}
return ret;
},
sep: "/",
delimiter: ":",
win32: null,
posix: null
};
posix.win32 = win32.win32 = win32;
posix.posix = win32.posix = posix;
normalize = platformIsWin32 ? win32.normalize : posix.normalize;
resolve = platformIsWin32 ? win32.resolve : posix.resolve;
relative = platformIsWin32 ? win32.relative : posix.relative;
dirname = platformIsWin32 ? win32.dirname : posix.dirname;
basename = platformIsWin32 ? win32.basename : posix.basename;
extname = platformIsWin32 ? win32.extname : posix.extname;
sep = platformIsWin32 ? win32.sep : posix.sep;
}
});
// node_modules/monaco-editor/esm/vs/base/common/uri.js
function _validateUri(ret, _strict) {
if (!ret.scheme && _strict) {
throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${ret.authority}", path: "${ret.path}", query: "${ret.query}", fragment: "${ret.fragment}"}`);
}
if (ret.scheme && !_schemePattern.test(ret.scheme)) {
throw new Error("[UriError]: Scheme contains illegal characters.");
}
if (ret.path) {
if (ret.authority) {
if (!_singleSlashStart.test(ret.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 (_doubleSlashStart.test(ret.path)) {
throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
}
}
}
}
function _schemeFix(scheme, _strict) {
if (!scheme && !_strict) {
return "file";
}
return scheme;
}
function _referenceResolution(scheme, path) {
switch (scheme) {
case "https":
case "http":
case "file":
if (!path) {
path = _slash;
} else if (path[0] !== _slash) {
path = _slash + path;
}
break;
}
return path;
}
function encodeURIComponentFast(uriComponent, isPath, isAuthority) {
let res = void 0;
let nativeEncodePos = -1;
for (let pos = 0; pos < uriComponent.length; pos++) {
const code = uriComponent.charCodeAt(pos);
if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 45 || code === 46 || code === 95 || code === 126 || isPath && code === 47 || isAuthority && code === 91 || isAuthority && code === 93 || isAuthority && code === 58) {
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
nativeEncodePos = -1;
}
if (res !== void 0) {
res += uriComponent.charAt(pos);
}
} else {
if (res === void 0) {
res = uriComponent.substr(0, pos);
}
const escaped = encodeTable[code];
if (escaped !== void 0) {
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
nativeEncodePos = -1;
}
res += escaped;
} else if (nativeEncodePos === -1) {
nativeEncodePos = pos;
}
}
}
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos));
}
return res !== void 0 ? res : uriComponent;
}
function encodeURIComponentMinimal(path) {
let res = void 0;
for (let pos = 0; pos < path.length; pos++) {
const code = path.charCodeAt(pos);
if (code === 35 || code === 63) {
if (res === void 0) {
res = path.substr(0, pos);
}
res += encodeTable[code];
} else {
if (res !== void 0) {
res += path[pos];
}
}
}
return res !== void 0 ? res : path;
}
function uriToFsPath(uri, keepDriveLetterCasing) {
let value;
if (uri.authority && uri.path.length > 1 && uri.scheme === "file") {
value = `//${uri.authority}${uri.path}`;
} else if (uri.path.charCodeAt(0) === 47 && (uri.path.charCodeAt(1) >= 65 && uri.path.charCodeAt(1) <= 90 || uri.path.charCodeAt(1) >= 97 && uri.path.charCodeAt(1) <= 122) && uri.path.charCodeAt(2) === 58) {
if (!keepDriveLetterCasing) {
value = uri.path[1].toLowerCase() + uri.path.substr(2);
} else {
value = uri.path.substr(1);
}
} else {
value = uri.path;
}
if (isWindows) {
value = value.replace(/\//g, "\\");
}
return value;
}
function _asFormatted(uri, skipEncoding) {
const encoder = !skipEncoding ? encodeURIComponentFast : encodeURIComponentMinimal;
let res = "";
let { scheme, authority, path, query, fragment } = uri;
if (scheme) {
res += scheme;
res += ":";
}
if (authority || scheme === "file") {
res += _slash;
res += _slash;
}
if (authority) {
let idx = authority.indexOf("@");
if (idx !== -1) {
const userinfo = authority.substr(0, idx);
authority = authority.substr(idx + 1);
idx = userinfo.lastIndexOf(":");
if (idx === -1) {
res += encoder(userinfo, false, false);
} else {
res += encoder(userinfo.substr(0, idx), false, false);
res += ":";
res += encoder(userinfo.substr(idx + 1), false, true);
}
res += "@";
}
authority = authority.toLowerCase();
idx = authority.lastIndexOf(":");
if (idx === -1) {
res += encoder(authority, false, true);
} else {
res += encoder(authority.substr(0, idx), false, true);
res += authority.substr(idx);
}
}
if (path) {
if (path.length >= 3 && path.charCodeAt(0) === 47 && path.charCodeAt(2) === 58) {
const code = path.charCodeAt(1);
if (code >= 65 && code <= 90) {
path = `/${String.fromCharCode(code + 32)}:${path.substr(3)}`;
}
} else if (path.length >= 2 && path.charCodeAt(1) === 58) {
const code = path.charCodeAt(0);
if (code >= 65 && code <= 90) {
path = `${String.fromCharCode(code + 32)}:${path.substr(2)}`;
}
}
res += encoder(path, true, false);
}
if (query) {
res += "?";
res += encoder(query, false, false);
}
if (fragment) {
res += "#";
res += !skipEncoding ? encodeURIComponentFast(fragment, false, false) : fragment;
}
return res;
}
function decodeURIComponentGraceful(str) {
try {
return decodeURIComponent(str);
} catch (_a10) {
if (str.length > 3) {
return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));
} else {
return str;
}
}
}
function percentDecode(str) {
if (!str.match(_rEncodedAsHex)) {
return str;
}
return str.replace(_rEncodedAsHex, (match2) => decodeURIComponentGraceful(match2));
}
var _schemePattern, _singleSlashStart, _doubleSlashStart, _empty, _slash, _regexp, URI, _pathSepMarker, Uri, encodeTable, _rEncodedAsHex;
var init_uri = __esm({
"node_modules/monaco-editor/esm/vs/base/common/uri.js"() {
init_path();
init_platform();
_schemePattern = /^\w[\w\d+.-]*$/;
_singleSlashStart = /^\//;
_doubleSlashStart = /^\/\//;
_empty = "";
_slash = "/";
_regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
URI = class _URI {
static isUri(thing) {
if (thing instanceof _URI) {
return true;
}
if (!thing) {
return false;
}
return typeof thing.authority === "string" && typeof thing.fragment === "string" && typeof thing.path === "string" && typeof thing.query === "string" && typeof thing.scheme === "string" && typeof thing.fsPath === "string" && typeof thing.with === "function" && typeof thing.toString === "function";
}
/**
* @internal
*/
constructor(schemeOrData, authority, path, query, fragment, _strict = false) {
if (typeof schemeOrData === "object") {
this.scheme = schemeOrData.scheme || _empty;
this.authority = schemeOrData.authority || _empty;
this.path = schemeOrData.path || _empty;
this.query = schemeOrData.query || _empty;
this.fragment = schemeOrData.fragment || _empty;
} else {
this.scheme = _schemeFix(schemeOrData, _strict);
this.authority = authority || _empty;
this.path = _referenceResolution(this.scheme, path || _empty);
this.query = query || _empty;
this.fragment = fragment || _empty;
_validateUri(this, _strict);
}
}
// ---- filesystem path -----------------------
/**
* Returns a string representing the corresponding file system path of this URI.
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
* platform specific path separator.
*
* * Will *not* validate the path for invalid characters and semantics.
* * Will *not* look at the scheme of this URI.
* * The result shall *not* be used for display purposes but for accessing a file on disk.
*
*
* The *difference* to `URI#path` is the use of the platform specific separator and the handling
* of UNC paths. See the below sample of a file-uri with an authority (UNC path).
*
* ```ts
const u = URI.parse('file://server/c$/folder/file.txt')
u.authority === 'server'
u.path === '/shares/c$/file.txt'
u.fsPath === '\\server\c$\folder\file.txt'
```
*
* Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
* namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
* with URIs that represent files on disk (`file` scheme).
*/
get fsPath() {
return uriToFsPath(this, false);
}
// ---- modify to new -------------------------
with(change) {
if (!change) {
return this;
}
let { scheme, authority, path, query, fragment } = change;
if (scheme === void 0) {
scheme = this.scheme;
} else if (scheme === null) {
scheme = _empty;
}
if (authority === void 0) {
authority = this.authority;
} else if (authority === null) {
authority = _empty;
}
if (path === void 0) {
path = this.path;
} else if (path === null) {
path = _empty;
}
if (query === void 0) {
query = this.query;
} else if (query === null) {
query = _empty;
}
if (fragment === void 0) {
fragment = this.fragment;
} else if (fragment === null) {
fragment = _empty;
}
if (scheme === this.scheme && authority === this.authority && path === this.path && query === this.query && fragment === this.fragment) {
return this;
}
return new Uri(scheme, authority, path, query, fragment);
}
// ---- parse & validate ------------------------
/**
* Creates a new URI from a string, e.g. `http://www.example.com/some/path`,
* `file:///usr/home`, or `scheme:with/path`.
*
* @param value A string which represents an URI (see `URI#toString`).
*/
static parse(value, _strict = false) {
const match2 = _regexp.exec(value);
if (!match2) {
return new Uri(_empty, _empty, _empty, _empty, _empty);
}
return new Uri(match2[2] || _empty, percentDecode(match2[4] || _empty), percentDecode(match2[5] || _empty), percentDecode(match2[7] || _empty), percentDecode(match2[9] || _empty), _strict);
}
/**
* Creates a new URI from a file system path, e.g. `c:\my\files`,
* `/usr/home`, or `\\server\share\some\path`.
*
* The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
* as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
* `URI.parse('file://' + path)` because the path might contain characters that are
* interpreted (# and ?). See the following sample:
* ```ts
const good = URI.file('/coding/c#/project1');
good.scheme === 'file';
good.path === '/coding/c#/project1';
good.fragment === '';
const bad = URI.parse('file://' + '/coding/c#/project1');
bad.scheme === 'file';
bad.path === '/coding/c'; // path is now broken
bad.fragment === '/project1';
```
*
* @param path A file system path (see `URI#fsPath`)
*/
static file(path) {
let authority = _empty;
if (isWindows) {
path = path.replace(/\\/g, _slash);
}
if (path[0] === _slash && path[1] === _slash) {
const idx = path.indexOf(_slash, 2);
if (idx === -1) {
authority = path.substring(2);
path = _slash;
} else {
authority = path.substring(2, idx);
path = path.substring(idx) || _slash;
}
}
return new Uri("file", authority, path, _empty, _empty);
}
/**
* Creates new URI from uri components.
*
* Unless `strict` is `true` the scheme is defaults to be `file`. This function performs
* validation and should be used for untrusted uri components retrieved from storage,
* user input, command arguments etc
*/
static from(components, strict) {
const result = new Uri(components.scheme, components.authority, components.path, components.query, components.fragment, strict);
return result;
}
/**
* Join a URI path with path fragments and normalizes the resulting path.
*
* @param uri The input URI.
* @param pathFragment The path fragment to add to the URI path.
* @returns The resulting URI.
*/
static joinPath(uri, ...pathFragment) {
if (!uri.path) {
throw new Error(`[UriError]: cannot call joinPath on URI without path`);
}
let newPath;
if (isWindows && uri.scheme === "file") {
newPath = _URI.file(win32.join(uriToFsPath(uri, true), ...pathFragment)).path;
} else {
newPath = posix.join(uri.path, ...pathFragment);
}
return uri.with({ path: newPath });
}
// ---- printing/externalize ---------------------------
/**
* Creates a string representation for this URI. It's guaranteed that calling
* `URI.parse` with the result of this function creates an URI which is equal
* to this URI.
*
* * The result shall *not* be used for display purposes but for externalization or transport.
* * The result will be encoded using the percentage encoding and encoding happens mostly
* ignore the scheme-specific encoding rules.
*
* @param skipEncoding Do not encode the result, default is `false`
*/
toString(skipEncoding = false) {
return _asFormatted(this, skipEncoding);
}
toJSON() {
return this;
}
static revive(data) {
var _a10, _b4;
if (!data) {
return data;
} else if (data instanceof _URI) {
return data;
} else {
const result = new Uri(data);
result._formatted = (_a10 = data.external) !== null && _a10 !== void 0 ? _a10 : null;
result._fsPath = data._sep === _pathSepMarker ? (_b4 = data.fsPath) !== null && _b4 !== void 0 ? _b4 : null : null;
return result;
}
}
};
_pathSepMarker = isWindows ? 1 : void 0;
Uri = class extends URI {
constructor() {
super(...arguments);
this._formatted = null;
this._fsPath = null;
}
get fsPath() {
if (!this._fsPath) {
this._fsPath = uriToFsPath(this, false);
}
return this._fsPath;
}
toString(skipEncoding = false) {
if (!skipEncoding) {
if (!this._formatted) {
this._formatted = _asFormatted(this, false);
}
return this._formatted;
} else {
return _asFormatted(this, true);
}
}
toJSON() {
const res = {
$mid: 1
/* MarshalledId.Uri */
};
if (this._fsPath) {
res.fsPath = this._fsPath;
res._sep = _pathSepMarker;
}
if (this._formatted) {
res.external = this._formatted;
}
if (this.path) {
res.path = this.path;
}
if (this.scheme) {
res.scheme = this.scheme;
}
if (this.authority) {
res.authority = this.authority;
}
if (this.query) {
res.query = this.query;
}
if (this.fragment) {
res.fragment = this.fragment;
}
return res;
}
};
encodeTable = {
[
58
/* CharCode.Colon */
]: "%3A",
// gen-delims
[
47
/* CharCode.Slash */
]: "%2F",
[
63
/* CharCode.QuestionMark */
]: "%3F",
[
35
/* CharCode.Hash */
]: "%23",
[
91
/* CharCode.OpenSquareBracket */
]: "%5B",
[
93
/* CharCode.CloseSquareBracket */
]: "%5D",
[
64
/* CharCode.AtSign */
]: "%40",
[
33
/* CharCode.ExclamationMark */
]: "%21",
// sub-delims
[
36
/* CharCode.DollarSign */
]: "%24",
[
38
/* CharCode.Ampersand */
]: "%26",
[
39
/* CharCode.SingleQuote */
]: "%27",
[
40
/* CharCode.OpenParen */
]: "%28",
[
41
/* CharCode.CloseParen */
]: "%29",
[
42
/* CharCode.Asterisk */
]: "%2A",
[
43
/* CharCode.Plus */
]: "%2B",
[
44
/* CharCode.Comma */
]: "%2C",
[
59
/* CharCode.Semicolon */
]: "%3B",
[
61
/* CharCode.Equals */
]: "%3D",
[
32
/* CharCode.Space */
]: "%20"
};
_rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/position.js
var Position;
var init_position = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/position.js"() {
Position = class _Position {
constructor(lineNumber, column) {
this.lineNumber = lineNumber;
this.column = column;
}
/**
* Create a new position from this position.
*
* @param newLineNumber new line number
* @param newColumn new column
*/
with(newLineNumber = this.lineNumber, newColumn = this.column) {
if (newLineNumber === this.lineNumber && newColumn === this.column) {
return this;
} else {
return new _Position(newLineNumber, newColumn);
}
}
/**
* Derive a new position from this position.
*
* @param deltaLineNumber line number delta
* @param deltaColumn column delta
*/
delta(deltaLineNumber = 0, deltaColumn = 0) {
return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);
}
/**
* Test if this position equals other position
*/
equals(other) {
return _Position.equals(this, other);
}
/**
* Test if position `a` equals position `b`
*/
static equals(a3, b) {
if (!a3 && !b) {
return true;
}
return !!a3 && !!b && a3.lineNumber === b.lineNumber && a3.column === b.column;
}
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be false.
*/
isBefore(other) {
return _Position.isBefore(this, other);
}
/**
* Test if position `a` is before position `b`.
* If the two positions are equal, the result will be false.
*/
static isBefore(a3, b) {
if (a3.lineNumber < b.lineNumber) {
return true;
}
if (b.lineNumber < a3.lineNumber) {
return false;
}
return a3.column < b.column;
}
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be true.
*/
isBeforeOrEqual(other) {
return _Position.isBeforeOrEqual(this, other);
}
/**
* Test if position `a` is before position `b`.
* If the two positions are equal, the result will be true.
*/
static isBeforeOrEqual(a3, b) {
if (a3.lineNumber < b.lineNumber) {
return true;
}
if (b.lineNumber < a3.lineNumber) {
return false;
}
return a3.column <= b.column;
}
/**
* A function that compares positions, useful for sorting
*/
static compare(a3, b) {
const aLineNumber = a3.lineNumber | 0;
const bLineNumber = b.lineNumber | 0;
if (aLineNumber === bLineNumber) {
const aColumn = a3.column | 0;
const bColumn = b.column | 0;
return aColumn - bColumn;
}
return aLineNumber - bLineNumber;
}
/**
* Clone this position.
*/
clone() {
return new _Position(this.lineNumber, this.column);
}
/**
* Convert to a human-readable representation.
*/
toString() {
return "(" + this.lineNumber + "," + this.column + ")";
}
// ---
/**
* Create a `Position` from an `IPosition`.
*/
static lift(pos) {
return new _Position(pos.lineNumber, pos.column);
}
/**
* Test if `obj` is an `IPosition`.
*/
static isIPosition(obj) {
return obj && typeof obj.lineNumber === "number" && typeof obj.column === "number";
}
toJSON() {
return {
lineNumber: this.lineNumber,
column: this.column
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var Range;
var init_range = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/range.js"() {
init_position();
Range = class _Range {
constructor(startLineNumber, startColumn, endLineNumber, endColumn) {
if (startLineNumber > endLineNumber || startLineNumber === endLineNumber && startColumn > endColumn) {
this.startLineNumber = endLineNumber;
this.startColumn = endColumn;
this.endLineNumber = startLineNumber;
this.endColumn = startColumn;
} else {
this.startLineNumber = startLineNumber;
this.startColumn = startColumn;
this.endLineNumber = endLineNumber;
this.endColumn = endColumn;
}
}
/**
* Test if this range is empty.
*/
isEmpty() {
return _Range.isEmpty(this);
}
/**
* Test if `range` is empty.
*/
static isEmpty(range2) {
return range2.startLineNumber === range2.endLineNumber && range2.startColumn === range2.endColumn;
}
/**
* Test if position is in this range. If the position is at the edges, will return true.
*/
containsPosition(position) {
return _Range.containsPosition(this, position);
}
/**
* Test if `position` is in `range`. If the position is at the edges, will return true.
*/
static containsPosition(range2, position) {
if (position.lineNumber < range2.startLineNumber || position.lineNumber > range2.endLineNumber) {
return false;
}
if (position.lineNumber === range2.startLineNumber && position.column < range2.startColumn) {
return false;
}
if (position.lineNumber === range2.endLineNumber && position.column > range2.endColumn) {
return false;
}
return true;
}
/**
* Test if `position` is in `range`. If the position is at the edges, will return false.
* @internal
*/
static strictContainsPosition(range2, position) {
if (position.lineNumber < range2.startLineNumber || position.lineNumber > range2.endLineNumber) {
return false;
}
if (position.lineNumber === range2.startLineNumber && position.column <= range2.startColumn) {
return false;
}
if (position.lineNumber === range2.endLineNumber && position.column >= range2.endColumn) {
return false;
}
return true;
}
/**
* Test if range is in this range. If the range is equal to this range, will return true.
*/
containsRange(range2) {
return _Range.containsRange(this, range2);
}
/**
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/
static containsRange(range2, otherRange) {
if (otherRange.startLineNumber < range2.startLineNumber || otherRange.endLineNumber < range2.startLineNumber) {
return false;
}
if (otherRange.startLineNumber > range2.endLineNumber || otherRange.endLineNumber > range2.endLineNumber) {
return false;
}
if (otherRange.startLineNumber === range2.startLineNumber && otherRange.startColumn < range2.startColumn) {
return false;
}
if (otherRange.endLineNumber === range2.endLineNumber && otherRange.endColumn > range2.endColumn) {
return false;
}
return true;
}
/**
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
*/
strictContainsRange(range2) {
return _Range.strictContainsRange(this, range2);
}
/**
* Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
*/
static strictContainsRange(range2, otherRange) {
if (otherRange.startLineNumber < range2.startLineNumber || otherRange.endLineNumber < range2.startLineNumber) {
return false;
}
if (otherRange.startLineNumber > range2.endLineNumber || otherRange.endLineNumber > range2.endLineNumber) {
return false;
}
if (otherRange.startLineNumber === range2.startLineNumber && otherRange.startColumn <= range2.startColumn) {
return false;
}
if (otherRange.endLineNumber === range2.endLineNumber && otherRange.endColumn >= range2.endColumn) {
return false;
}
return true;
}
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
plusRange(range2) {
return _Range.plusRange(this, range2);
}
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
static plusRange(a3, b) {
let startLineNumber;
let startColumn;
let endLineNumber;
let endColumn;
if (b.startLineNumber < a3.startLineNumber) {
startLineNumber = b.startLineNumber;
startColumn = b.startColumn;
} else if (b.startLineNumber === a3.startLineNumber) {
startLineNumber = b.startLineNumber;
startColumn = Math.min(b.startColumn, a3.startColumn);
} else {
startLineNumber = a3.startLineNumber;
startColumn = a3.startColumn;
}
if (b.endLineNumber > a3.endLineNumber) {
endLineNumber = b.endLineNumber;
endColumn = b.endColumn;
} else if (b.endLineNumber === a3.endLineNumber) {
endLineNumber = b.endLineNumber;
endColumn = Math.max(b.endColumn, a3.endColumn);
} else {
endLineNumber = a3.endLineNumber;
endColumn = a3.endColumn;
}
return new _Range(startLineNumber, startColumn, endLineNumber, endColumn);
}
/**
* A intersection of the two ranges.
*/
intersectRanges(range2) {
return _Range.intersectRanges(this, range2);
}
/**
* A intersection of the two ranges.
*/
static intersectRanges(a3, b) {
let resultStartLineNumber = a3.startLineNumber;
let resultStartColumn = a3.startColumn;
let resultEndLineNumber = a3.endLineNumber;
let resultEndColumn = a3.endColumn;
const otherStartLineNumber = b.startLineNumber;
const otherStartColumn = b.startColumn;
const otherEndLineNumber = b.endLineNumber;
const otherEndColumn = b.endColumn;
if (resultStartLineNumber < otherStartLineNumber) {
resultStartLineNumber = otherStartLineNumber;
resultStartColumn = otherStartColumn;
} else if (resultStartLineNumber === otherStartLineNumber) {
resultStartColumn = Math.max(resultStartColumn, otherStartColumn);
}
if (resultEndLineNumber > otherEndLineNumber) {
resultEndLineNumber = otherEndLineNumber;
resultEndColumn = otherEndColumn;
} else if (resultEndLineNumber === otherEndLineNumber) {
resultEndColumn = Math.min(resultEndColumn, otherEndColumn);
}
if (resultStartLineNumber > resultEndLineNumber) {
return null;
}
if (resultStartLineNumber === resultEndLineNumber && resultStartColumn > resultEndColumn) {
return null;
}
return new _Range(resultStartLineNumber, resultStartColumn, resultEndLineNumber, resultEndColumn);
}
/**
* Test if this range equals other.
*/
equalsRange(other) {
return _Range.equalsRange(this, other);
}
/**
* Test if range `a` equals `b`.
*/
static equalsRange(a3, b) {
if (!a3 && !b) {
return true;
}
return !!a3 && !!b && a3.startLineNumber === b.startLineNumber && a3.startColumn === b.startColumn && a3.endLineNumber === b.endLineNumber && a3.endColumn === b.endColumn;
}
/**
* Return the end position (which will be after or equal to the start position)
*/
getEndPosition() {
return _Range.getEndPosition(this);
}
/**
* Return the end position (which will be after or equal to the start position)
*/
static getEndPosition(range2) {
return new Position(range2.endLineNumber, range2.endColumn);
}
/**
* Return the start position (which will be before or equal to the end position)
*/
getStartPosition() {
return _Range.getStartPosition(this);
}
/**
* Return the start position (which will be before or equal to the end position)
*/
static getStartPosition(range2) {
return new Position(range2.startLineNumber, range2.startColumn);
}
/**
* Transform to a user presentable string representation.
*/
toString() {
return "[" + this.startLineNumber + "," + this.startColumn + " -> " + this.endLineNumber + "," + this.endColumn + "]";
}
/**
* Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
*/
setEndPosition(endLineNumber, endColumn) {
return new _Range(this.startLineNumber, this.startColumn, endLineNumber, endColumn);
}
/**
* Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
*/
setStartPosition(startLineNumber, startColumn) {
return new _Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);
}
/**
* Create a new empty range using this range's start position.
*/
collapseToStart() {
return _Range.collapseToStart(this);
}
/**
* Create a new empty range using this range's start position.
*/
static collapseToStart(range2) {
return new _Range(range2.startLineNumber, range2.startColumn, range2.startLineNumber, range2.startColumn);
}
/**
* Create a new empty range using this range's end position.
*/
collapseToEnd() {
return _Range.collapseToEnd(this);
}
/**
* Create a new empty range using this range's end position.
*/
static collapseToEnd(range2) {
return new _Range(range2.endLineNumber, range2.endColumn, range2.endLineNumber, range2.endColumn);
}
/**
* Moves the range by the given amount of lines.
*/
delta(lineCount) {
return new _Range(this.startLineNumber + lineCount, this.startColumn, this.endLineNumber + lineCount, this.endColumn);
}
// ---
static fromPositions(start, end = start) {
return new _Range(start.lineNumber, start.column, end.lineNumber, end.column);
}
static lift(range2) {
if (!range2) {
return null;
}
return new _Range(range2.startLineNumber, range2.startColumn, range2.endLineNumber, range2.endColumn);
}
/**
* Test if `obj` is an `IRange`.
*/
static isIRange(obj) {
return obj && typeof obj.startLineNumber === "number" && typeof obj.startColumn === "number" && typeof obj.endLineNumber === "number" && typeof obj.endColumn === "number";
}
/**
* Test if the two ranges are touching in any way.
*/
static areIntersectingOrTouching(a3, b) {
if (a3.endLineNumber < b.startLineNumber || a3.endLineNumber === b.startLineNumber && a3.endColumn < b.startColumn) {
return false;
}
if (b.endLineNumber < a3.startLineNumber || b.endLineNumber === a3.startLineNumber && b.endColumn < a3.startColumn) {
return false;
}
return true;
}
/**
* Test if the two ranges are intersecting. If the ranges are touching it returns true.
*/
static areIntersecting(a3, b) {
if (a3.endLineNumber < b.startLineNumber || a3.endLineNumber === b.startLineNumber && a3.endColumn <= b.startColumn) {
return false;
}
if (b.endLineNumber < a3.startLineNumber || b.endLineNumber === a3.startLineNumber && b.endColumn <= a3.startColumn) {
return false;
}
return true;
}
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the startPosition and then on the endPosition
*/
static compareRangesUsingStarts(a3, b) {
if (a3 && b) {
const aStartLineNumber = a3.startLineNumber | 0;
const bStartLineNumber = b.startLineNumber | 0;
if (aStartLineNumber === bStartLineNumber) {
const aStartColumn = a3.startColumn | 0;
const bStartColumn = b.startColumn | 0;
if (aStartColumn === bStartColumn) {
const aEndLineNumber = a3.endLineNumber | 0;
const bEndLineNumber = b.endLineNumber | 0;
if (aEndLineNumber === bEndLineNumber) {
const aEndColumn = a3.endColumn | 0;
const bEndColumn = b.endColumn | 0;
return aEndColumn - bEndColumn;
}
return aEndLineNumber - bEndLineNumber;
}
return aStartColumn - bStartColumn;
}
return aStartLineNumber - bStartLineNumber;
}
const aExists = a3 ? 1 : 0;
const bExists = b ? 1 : 0;
return aExists - bExists;
}
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the endPosition and then on the startPosition
*/
static compareRangesUsingEnds(a3, b) {
if (a3.endLineNumber === b.endLineNumber) {
if (a3.endColumn === b.endColumn) {
if (a3.startLineNumber === b.startLineNumber) {
return a3.startColumn - b.startColumn;
}
return a3.startLineNumber - b.startLineNumber;
}
return a3.endColumn - b.endColumn;
}
return a3.endLineNumber - b.endLineNumber;
}
/**
* Test if the range spans multiple lines.
*/
static spansMultipleLines(range2) {
return range2.endLineNumber > range2.startLineNumber;
}
toJSON() {
return this;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/selection.js
var Selection;
var init_selection = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/selection.js"() {
init_position();
init_range();
Selection = class _Selection extends Range {
constructor(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {
super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);
this.selectionStartLineNumber = selectionStartLineNumber;
this.selectionStartColumn = selectionStartColumn;
this.positionLineNumber = positionLineNumber;
this.positionColumn = positionColumn;
}
/**
* Transform to a human-readable representation.
*/
toString() {
return "[" + this.selectionStartLineNumber + "," + this.selectionStartColumn + " -> " + this.positionLineNumber + "," + this.positionColumn + "]";
}
/**
* Test if equals other selection.
*/
equalsSelection(other) {
return _Selection.selectionsEqual(this, other);
}
/**
* Test if the two selections are equal.
*/
static selectionsEqual(a3, b) {
return a3.selectionStartLineNumber === b.selectionStartLineNumber && a3.selectionStartColumn === b.selectionStartColumn && a3.positionLineNumber === b.positionLineNumber && a3.positionColumn === b.positionColumn;
}
/**
* Get directions (LTR or RTL).
*/
getDirection() {
if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {
return 0;
}
return 1;
}
/**
* Create a new selection with a different `positionLineNumber` and `positionColumn`.
*/
setEndPosition(endLineNumber, endColumn) {
if (this.getDirection() === 0) {
return new _Selection(this.startLineNumber, this.startColumn, endLineNumber, endColumn);
}
return new _Selection(endLineNumber, endColumn, this.startLineNumber, this.startColumn);
}
/**
* Get the position at `positionLineNumber` and `positionColumn`.
*/
getPosition() {
return new Position(this.positionLineNumber, this.positionColumn);
}
/**
* Get the position at the start of the selection.
*/
getSelectionStart() {
return new Position(this.selectionStartLineNumber, this.selectionStartColumn);
}
/**
* Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
*/
setStartPosition(startLineNumber, startColumn) {
if (this.getDirection() === 0) {
return new _Selection(startLineNumber, startColumn, this.endLineNumber, this.endColumn);
}
return new _Selection(this.endLineNumber, this.endColumn, startLineNumber, startColumn);
}
// ----
/**
* Create a `Selection` from one or two positions
*/
static fromPositions(start, end = start) {
return new _Selection(start.lineNumber, start.column, end.lineNumber, end.column);
}
/**
* Creates a `Selection` from a range, given a direction.
*/
static fromRange(range2, direction) {
if (direction === 0) {
return new _Selection(range2.startLineNumber, range2.startColumn, range2.endLineNumber, range2.endColumn);
} else {
return new _Selection(range2.endLineNumber, range2.endColumn, range2.startLineNumber, range2.startColumn);
}
}
/**
* Create a `Selection` from an `ISelection`.
*/
static liftSelection(sel) {
return new _Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);
}
/**
* `a` equals `b`.
*/
static selectionsArrEqual(a3, b) {
if (a3 && !b || !a3 && b) {
return false;
}
if (!a3 && !b) {
return true;
}
if (a3.length !== b.length) {
return false;
}
for (let i = 0, len = a3.length; i < len; i++) {
if (!this.selectionsEqual(a3[i], b[i])) {
return false;
}
}
return true;
}
/**
* Test if `obj` is an `ISelection`.
*/
static isISelection(obj) {
return obj && typeof obj.selectionStartLineNumber === "number" && typeof obj.selectionStartColumn === "number" && typeof obj.positionLineNumber === "number" && typeof obj.positionColumn === "number";
}
/**
* Create with a direction.
*/
static createWithDirection(startLineNumber, startColumn, endLineNumber, endColumn, direction) {
if (direction === 0) {
return new _Selection(startLineNumber, startColumn, endLineNumber, endColumn);
}
return new _Selection(endLineNumber, endColumn, startLineNumber, startColumn);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js
function register2(id, fontCharacter) {
if (isString(fontCharacter)) {
const val = _codiconFontCharacters[fontCharacter];
if (val === void 0) {
throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);
}
fontCharacter = val;
}
_codiconFontCharacters[id] = fontCharacter;
return { id };
}
function getCodiconFontCharacters() {
return _codiconFontCharacters;
}
var _codiconFontCharacters;
var init_codiconsUtil = __esm({
"node_modules/monaco-editor/esm/vs/base/common/codiconsUtil.js"() {
init_types();
_codiconFontCharacters = /* @__PURE__ */ Object.create(null);
}
});
// node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js
var codiconsLibrary;
var init_codiconsLibrary = __esm({
"node_modules/monaco-editor/esm/vs/base/common/codiconsLibrary.js"() {
init_codiconsUtil();
codiconsLibrary = {
add: register2("add", 6e4),
plus: register2("plus", 6e4),
gistNew: register2("gist-new", 6e4),
repoCreate: register2("repo-create", 6e4),
lightbulb: register2("lightbulb", 60001),
lightBulb: register2("light-bulb", 60001),
repo: register2("repo", 60002),
repoDelete: register2("repo-delete", 60002),
gistFork: register2("gist-fork", 60003),
repoForked: register2("repo-forked", 60003),
gitPullRequest: register2("git-pull-request", 60004),
gitPullRequestAbandoned: register2("git-pull-request-abandoned", 60004),
recordKeys: register2("record-keys", 60005),
keyboard: register2("keyboard", 60005),
tag: register2("tag", 60006),
gitPullRequestLabel: register2("git-pull-request-label", 60006),
tagAdd: register2("tag-add", 60006),
tagRemove: register2("tag-remove", 60006),
person: register2("person", 60007),
personFollow: register2("person-follow", 60007),
personOutline: register2("person-outline", 60007),
personFilled: register2("person-filled", 60007),
gitBranch: register2("git-branch", 60008),
gitBranchCreate: register2("git-branch-create", 60008),
gitBranchDelete: register2("git-branch-delete", 60008),
sourceControl: register2("source-control", 60008),
mirror: register2("mirror", 60009),
mirrorPublic: register2("mirror-public", 60009),
star: register2("star", 60010),
starAdd: register2("star-add", 60010),
starDelete: register2("star-delete", 60010),
starEmpty: register2("star-empty", 60010),
comment: register2("comment", 60011),
commentAdd: register2("comment-add", 60011),
alert: register2("alert", 60012),
warning: register2("warning", 60012),
search: register2("search", 60013),
searchSave: register2("search-save", 60013),
logOut: register2("log-out", 60014),
signOut: register2("sign-out", 60014),
logIn: register2("log-in", 60015),
signIn: register2("sign-in", 60015),
eye: register2("eye", 60016),
eyeUnwatch: register2("eye-unwatch", 60016),
eyeWatch: register2("eye-watch", 60016),
circleFilled: register2("circle-filled", 60017),
primitiveDot: register2("primitive-dot", 60017),
closeDirty: register2("close-dirty", 60017),
debugBreakpoint: register2("debug-breakpoint", 60017),
debugBreakpointDisabled: register2("debug-breakpoint-disabled", 60017),
debugHint: register2("debug-hint", 60017),
terminalDecorationSuccess: register2("terminal-decoration-success", 60017),
primitiveSquare: register2("primitive-square", 60018),
edit: register2("edit", 60019),
pencil: register2("pencil", 60019),
info: register2("info", 60020),
issueOpened: register2("issue-opened", 60020),
gistPrivate: register2("gist-private", 60021),
gitForkPrivate: register2("git-fork-private", 60021),
lock: register2("lock", 60021),
mirrorPrivate: register2("mirror-private", 60021),
close: register2("close", 60022),
removeClose: register2("remove-close", 60022),
x: register2("x", 60022),
repoSync: register2("repo-sync", 60023),
sync: register2("sync", 60023),
clone: register2("clone", 60024),
desktopDownload: register2("desktop-download", 60024),
beaker: register2("beaker", 60025),
microscope: register2("microscope", 60025),
vm: register2("vm", 60026),
deviceDesktop: register2("device-desktop", 60026),
file: register2("file", 60027),
fileText: register2("file-text", 60027),
more: register2("more", 60028),
ellipsis: register2("ellipsis", 60028),
kebabHorizontal: register2("kebab-horizontal", 60028),
mailReply: register2("mail-reply", 60029),
reply: register2("reply", 60029),
organization: register2("organization", 60030),
organizationFilled: register2("organization-filled", 60030),
organizationOutline: register2("organization-outline", 60030),
newFile: register2("new-file", 60031),
fileAdd: register2("file-add", 60031),
newFolder: register2("new-folder", 60032),
fileDirectoryCreate: register2("file-directory-create", 60032),
trash: register2("trash", 60033),
trashcan: register2("trashcan", 60033),
history: register2("history", 60034),
clock: register2("clock", 60034),
folder: register2("folder", 60035),
fileDirectory: register2("file-directory", 60035),
symbolFolder: register2("symbol-folder", 60035),
logoGithub: register2("logo-github", 60036),
markGithub: register2("mark-github", 60036),
github: register2("github", 60036),
terminal: register2("terminal", 60037),
console: register2("console", 60037),
repl: register2("repl", 60037),
zap: register2("zap", 60038),
symbolEvent: register2("symbol-event", 60038),
error: register2("error", 60039),
stop: register2("stop", 60039),
variable: register2("variable", 60040),
symbolVariable: register2("symbol-variable", 60040),
array: register2("array", 60042),
symbolArray: register2("symbol-array", 60042),
symbolModule: register2("symbol-module", 60043),
symbolPackage: register2("symbol-package", 60043),
symbolNamespace: register2("symbol-namespace", 60043),
symbolObject: register2("symbol-object", 60043),
symbolMethod: register2("symbol-method", 60044),
symbolFunction: register2("symbol-function", 60044),
symbolConstructor: register2("symbol-constructor", 60044),
symbolBoolean: register2("symbol-boolean", 60047),
symbolNull: register2("symbol-null", 60047),
symbolNumeric: register2("symbol-numeric", 60048),
symbolNumber: register2("symbol-number", 60048),
symbolStructure: register2("symbol-structure", 60049),
symbolStruct: register2("symbol-struct", 60049),
symbolParameter: register2("symbol-parameter", 60050),
symbolTypeParameter: register2("symbol-type-parameter", 60050),
symbolKey: register2("symbol-key", 60051),
symbolText: register2("symbol-text", 60051),
symbolReference: register2("symbol-reference", 60052),
goToFile: register2("go-to-file", 60052),
symbolEnum: register2("symbol-enum", 60053),
symbolValue: register2("symbol-value", 60053),
symbolRuler: register2("symbol-ruler", 60054),
symbolUnit: register2("symbol-unit", 60054),
activateBreakpoints: register2("activate-breakpoints", 60055),
archive: register2("archive", 60056),
arrowBoth: register2("arrow-both", 60057),
arrowDown: register2("arrow-down", 60058),
arrowLeft: register2("arrow-left", 60059),
arrowRight: register2("arrow-right", 60060),
arrowSmallDown: register2("arrow-small-down", 60061),
arrowSmallLeft: register2("arrow-small-left", 60062),
arrowSmallRight: register2("arrow-small-right", 60063),
arrowSmallUp: register2("arrow-small-up", 60064),
arrowUp: register2("arrow-up", 60065),
bell: register2("bell", 60066),
bold: register2("bold", 60067),
book: register2("book", 60068),
bookmark: register2("bookmark", 60069),
debugBreakpointConditionalUnverified: register2("debug-breakpoint-conditional-unverified", 60070),
debugBreakpointConditional: register2("debug-breakpoint-conditional", 60071),
debugBreakpointConditionalDisabled: register2("debug-breakpoint-conditional-disabled", 60071),
debugBreakpointDataUnverified: register2("debug-breakpoint-data-unverified", 60072),
debugBreakpointData: register2("debug-breakpoint-data", 60073),
debugBreakpointDataDisabled: register2("debug-breakpoint-data-disabled", 60073),
debugBreakpointLogUnverified: register2("debug-breakpoint-log-unverified", 60074),
debugBreakpointLog: register2("debug-breakpoint-log", 60075),
debugBreakpointLogDisabled: register2("debug-breakpoint-log-disabled", 60075),
briefcase: register2("briefcase", 60076),
broadcast: register2("broadcast", 60077),
browser: register2("browser", 60078),
bug: register2("bug", 60079),
calendar: register2("calendar", 60080),
caseSensitive: register2("case-sensitive", 60081),
check: register2("check", 60082),
checklist: register2("checklist", 60083),
chevronDown: register2("chevron-down", 60084),
chevronLeft: register2("chevron-left", 60085),
chevronRight: register2("chevron-right", 60086),
chevronUp: register2("chevron-up", 60087),
chromeClose: register2("chrome-close", 60088),
chromeMaximize: register2("chrome-maximize", 60089),
chromeMinimize: register2("chrome-minimize", 60090),
chromeRestore: register2("chrome-restore", 60091),
circleOutline: register2("circle-outline", 60092),
circle: register2("circle", 60092),
debugBreakpointUnverified: register2("debug-breakpoint-unverified", 60092),
terminalDecorationIncomplete: register2("terminal-decoration-incomplete", 60092),
circleSlash: register2("circle-slash", 60093),
circuitBoard: register2("circuit-board", 60094),
clearAll: register2("clear-all", 60095),
clippy: register2("clippy", 60096),
closeAll: register2("close-all", 60097),
cloudDownload: register2("cloud-download", 60098),
cloudUpload: register2("cloud-upload", 60099),
code: register2("code", 60100),
collapseAll: register2("collapse-all", 60101),
colorMode: register2("color-mode", 60102),
commentDiscussion: register2("comment-discussion", 60103),
creditCard: register2("credit-card", 60105),
dash: register2("dash", 60108),
dashboard: register2("dashboard", 60109),
database: register2("database", 60110),
debugContinue: register2("debug-continue", 60111),
debugDisconnect: register2("debug-disconnect", 60112),
debugPause: register2("debug-pause", 60113),
debugRestart: register2("debug-restart", 60114),
debugStart: register2("debug-start", 60115),
debugStepInto: register2("debug-step-into", 60116),
debugStepOut: register2("debug-step-out", 60117),
debugStepOver: register2("debug-step-over", 60118),
debugStop: register2("debug-stop", 60119),
debug: register2("debug", 60120),
deviceCameraVideo: register2("device-camera-video", 60121),
deviceCamera: register2("device-camera", 60122),
deviceMobile: register2("device-mobile", 60123),
diffAdded: register2("diff-added", 60124),
diffIgnored: register2("diff-ignored", 60125),
diffModified: register2("diff-modified", 60126),
diffRemoved: register2("diff-removed", 60127),
diffRenamed: register2("diff-renamed", 60128),
diff: register2("diff", 60129),
diffSidebyside: register2("diff-sidebyside", 60129),
discard: register2("discard", 60130),
editorLayout: register2("editor-layout", 60131),
emptyWindow: register2("empty-window", 60132),
exclude: register2("exclude", 60133),
extensions: register2("extensions", 60134),
eyeClosed: register2("eye-closed", 60135),
fileBinary: register2("file-binary", 60136),
fileCode: register2("file-code", 60137),
fileMedia: register2("file-media", 60138),
filePdf: register2("file-pdf", 60139),
fileSubmodule: register2("file-submodule", 60140),
fileSymlinkDirectory: register2("file-symlink-directory", 60141),
fileSymlinkFile: register2("file-symlink-file", 60142),
fileZip: register2("file-zip", 60143),
files: register2("files", 60144),
filter: register2("filter", 60145),
flame: register2("flame", 60146),
foldDown: register2("fold-down", 60147),
foldUp: register2("fold-up", 60148),
fold: register2("fold", 60149),
folderActive: register2("folder-active", 60150),
folderOpened: register2("folder-opened", 60151),
gear: register2("gear", 60152),
gift: register2("gift", 60153),
gistSecret: register2("gist-secret", 60154),
gist: register2("gist", 60155),
gitCommit: register2("git-commit", 60156),
gitCompare: register2("git-compare", 60157),
compareChanges: register2("compare-changes", 60157),
gitMerge: register2("git-merge", 60158),
githubAction: register2("github-action", 60159),
githubAlt: register2("github-alt", 60160),
globe: register2("globe", 60161),
grabber: register2("grabber", 60162),
graph: register2("graph", 60163),
gripper: register2("gripper", 60164),
heart: register2("heart", 60165),
home: register2("home", 60166),
horizontalRule: register2("horizontal-rule", 60167),
hubot: register2("hubot", 60168),
inbox: register2("inbox", 60169),
issueReopened: register2("issue-reopened", 60171),
issues: register2("issues", 60172),
italic: register2("italic", 60173),
jersey: register2("jersey", 60174),
json: register2("json", 60175),
kebabVertical: register2("kebab-vertical", 60176),
key: register2("key", 60177),
law: register2("law", 60178),
lightbulbAutofix: register2("lightbulb-autofix", 60179),
linkExternal: register2("link-external", 60180),
link: register2("link", 60181),
listOrdered: register2("list-ordered", 60182),
listUnordered: register2("list-unordered", 60183),
liveShare: register2("live-share", 60184),
loading: register2("loading", 60185),
location: register2("location", 60186),
mailRead: register2("mail-read", 60187),
mail: register2("mail", 60188),
markdown: register2("markdown", 60189),
megaphone: register2("megaphone", 60190),
mention: register2("mention", 60191),
milestone: register2("milestone", 60192),
gitPullRequestMilestone: register2("git-pull-request-milestone", 60192),
mortarBoard: register2("mortar-board", 60193),
move: register2("move", 60194),
multipleWindows: register2("multiple-windows", 60195),
mute: register2("mute", 60196),
noNewline: register2("no-newline", 60197),
note: register2("note", 60198),
octoface: register2("octoface", 60199),
openPreview: register2("open-preview", 60200),
package: register2("package", 60201),
paintcan: register2("paintcan", 60202),
pin: register2("pin", 60203),
play: register2("play", 60204),
run: register2("run", 60204),
plug: register2("plug", 60205),
preserveCase: register2("preserve-case", 60206),
preview: register2("preview", 60207),
project: register2("project", 60208),
pulse: register2("pulse", 60209),
question: register2("question", 60210),
quote: register2("quote", 60211),
radioTower: register2("radio-tower", 60212),
reactions: register2("reactions", 60213),
references: register2("references", 60214),
refresh: register2("refresh", 60215),
regex: register2("regex", 60216),
remoteExplorer: register2("remote-explorer", 60217),
remote: register2("remote", 60218),
remove: register2("remove", 60219),
replaceAll: register2("replace-all", 60220),
replace: register2("replace", 60221),
repoClone: register2("repo-clone", 60222),
repoForcePush: register2("repo-force-push", 60223),
repoPull: register2("repo-pull", 60224),
repoPush: register2("repo-push", 60225),
report: register2("report", 60226),
requestChanges: register2("request-changes", 60227),
rocket: register2("rocket", 60228),
rootFolderOpened: register2("root-folder-opened", 60229),
rootFolder: register2("root-folder", 60230),
rss: register2("rss", 60231),
ruby: register2("ruby", 60232),
saveAll: register2("save-all", 60233),
saveAs: register2("save-as", 60234),
save: register2("save", 60235),
screenFull: register2("screen-full", 60236),
screenNormal: register2("screen-normal", 60237),
searchStop: register2("search-stop", 60238),
server: register2("server", 60240),
settingsGear: register2("settings-gear", 60241),
settings: register2("settings", 60242),
shield: register2("shield", 60243),
smiley: register2("smiley", 60244),
sortPrecedence: register2("sort-precedence", 60245),
splitHorizontal: register2("split-horizontal", 60246),
splitVertical: register2("split-vertical", 60247),
squirrel: register2("squirrel", 60248),
starFull: register2("star-full", 60249),
starHalf: register2("star-half", 60250),
symbolClass: register2("symbol-class", 60251),
symbolColor: register2("symbol-color", 60252),
symbolConstant: register2("symbol-constant", 60253),
symbolEnumMember: register2("symbol-enum-member", 60254),
symbolField: register2("symbol-field", 60255),
symbolFile: register2("symbol-file", 60256),
symbolInterface: register2("symbol-interface", 60257),
symbolKeyword: register2("symbol-keyword", 60258),
symbolMisc: register2("symbol-misc", 60259),
symbolOperator: register2("symbol-operator", 60260),
symbolProperty: register2("symbol-property", 60261),
wrench: register2("wrench", 60261),
wrenchSubaction: register2("wrench-subaction", 60261),
symbolSnippet: register2("symbol-snippet", 60262),
tasklist: register2("tasklist", 60263),
telescope: register2("telescope", 60264),
textSize: register2("text-size", 60265),
threeBars: register2("three-bars", 60266),
thumbsdown: register2("thumbsdown", 60267),
thumbsup: register2("thumbsup", 60268),
tools: register2("tools", 60269),
triangleDown: register2("triangle-down", 60270),
triangleLeft: register2("triangle-left", 60271),
triangleRight: register2("triangle-right", 60272),
triangleUp: register2("triangle-up", 60273),
twitter: register2("twitter", 60274),
unfold: register2("unfold", 60275),
unlock: register2("unlock", 60276),
unmute: register2("unmute", 60277),
unverified: register2("unverified", 60278),
verified: register2("verified", 60279),
versions: register2("versions", 60280),
vmActive: register2("vm-active", 60281),
vmOutline: register2("vm-outline", 60282),
vmRunning: register2("vm-running", 60283),
watch: register2("watch", 60284),
whitespace: register2("whitespace", 60285),
wholeWord: register2("whole-word", 60286),
window: register2("window", 60287),
wordWrap: register2("word-wrap", 60288),
zoomIn: register2("zoom-in", 60289),
zoomOut: register2("zoom-out", 60290),
listFilter: register2("list-filter", 60291),
listFlat: register2("list-flat", 60292),
listSelection: register2("list-selection", 60293),
selection: register2("selection", 60293),
listTree: register2("list-tree", 60294),
debugBreakpointFunctionUnverified: register2("debug-breakpoint-function-unverified", 60295),
debugBreakpointFunction: register2("debug-breakpoint-function", 60296),
debugBreakpointFunctionDisabled: register2("debug-breakpoint-function-disabled", 60296),
debugStackframeActive: register2("debug-stackframe-active", 60297),
circleSmallFilled: register2("circle-small-filled", 60298),
debugStackframeDot: register2("debug-stackframe-dot", 60298),
terminalDecorationMark: register2("terminal-decoration-mark", 60298),
debugStackframe: register2("debug-stackframe", 60299),
debugStackframeFocused: register2("debug-stackframe-focused", 60299),
debugBreakpointUnsupported: register2("debug-breakpoint-unsupported", 60300),
symbolString: register2("symbol-string", 60301),
debugReverseContinue: register2("debug-reverse-continue", 60302),
debugStepBack: register2("debug-step-back", 60303),
debugRestartFrame: register2("debug-restart-frame", 60304),
debugAlt: register2("debug-alt", 60305),
callIncoming: register2("call-incoming", 60306),
callOutgoing: register2("call-outgoing", 60307),
menu: register2("menu", 60308),
expandAll: register2("expand-all", 60309),
feedback: register2("feedback", 60310),
gitPullRequestReviewer: register2("git-pull-request-reviewer", 60310),
groupByRefType: register2("group-by-ref-type", 60311),
ungroupByRefType: register2("ungroup-by-ref-type", 60312),
account: register2("account", 60313),
gitPullRequestAssignee: register2("git-pull-request-assignee", 60313),
bellDot: register2("bell-dot", 60314),
debugConsole: register2("debug-console", 60315),
library: register2("library", 60316),
output: register2("output", 60317),
runAll: register2("run-all", 60318),
syncIgnored: register2("sync-ignored", 60319),
pinned: register2("pinned", 60320),
githubInverted: register2("github-inverted", 60321),
serverProcess: register2("server-process", 60322),
serverEnvironment: register2("server-environment", 60323),
pass: register2("pass", 60324),
issueClosed: register2("issue-closed", 60324),
stopCircle: register2("stop-circle", 60325),
playCircle: register2("play-circle", 60326),
record: register2("record", 60327),
debugAltSmall: register2("debug-alt-small", 60328),
vmConnect: register2("vm-connect", 60329),
cloud: register2("cloud", 60330),
merge: register2("merge", 60331),
export: register2("export", 60332),
graphLeft: register2("graph-left", 60333),
magnet: register2("magnet", 60334),
notebook: register2("notebook", 60335),
redo: register2("redo", 60336),
checkAll: register2("check-all", 60337),
pinnedDirty: register2("pinned-dirty", 60338),
passFilled: register2("pass-filled", 60339),
circleLargeFilled: register2("circle-large-filled", 60340),
circleLarge: register2("circle-large", 60341),
circleLargeOutline: register2("circle-large-outline", 60341),
combine: register2("combine", 60342),
gather: register2("gather", 60342),
table: register2("table", 60343),
variableGroup: register2("variable-group", 60344),
typeHierarchy: register2("type-hierarchy", 60345),
typeHierarchySub: register2("type-hierarchy-sub", 60346),
typeHierarchySuper: register2("type-hierarchy-super", 60347),
gitPullRequestCreate: register2("git-pull-request-create", 60348),
runAbove: register2("run-above", 60349),
runBelow: register2("run-below", 60350),
notebookTemplate: register2("notebook-template", 60351),
debugRerun: register2("debug-rerun", 60352),
workspaceTrusted: register2("workspace-trusted", 60353),
workspaceUntrusted: register2("workspace-untrusted", 60354),
workspaceUnknown: register2("workspace-unknown", 60355),
terminalCmd: register2("terminal-cmd", 60356),
terminalDebian: register2("terminal-debian", 60357),
terminalLinux: register2("terminal-linux", 60358),
terminalPowershell: register2("terminal-powershell", 60359),
terminalTmux: register2("terminal-tmux", 60360),
terminalUbuntu: register2("terminal-ubuntu", 60361),
terminalBash: register2("terminal-bash", 60362),
arrowSwap: register2("arrow-swap", 60363),
copy: register2("copy", 60364),
personAdd: register2("person-add", 60365),
filterFilled: register2("filter-filled", 60366),
wand: register2("wand", 60367),
debugLineByLine: register2("debug-line-by-line", 60368),
inspect: register2("inspect", 60369),
layers: register2("layers", 60370),
layersDot: register2("layers-dot", 60371),
layersActive: register2("layers-active", 60372),
compass: register2("compass", 60373),
compassDot: register2("compass-dot", 60374),
compassActive: register2("compass-active", 60375),
azure: register2("azure", 60376),
issueDraft: register2("issue-draft", 60377),
gitPullRequestClosed: register2("git-pull-request-closed", 60378),
gitPullRequestDraft: register2("git-pull-request-draft", 60379),
debugAll: register2("debug-all", 60380),
debugCoverage: register2("debug-coverage", 60381),
runErrors: register2("run-errors", 60382),
folderLibrary: register2("folder-library", 60383),
debugContinueSmall: register2("debug-continue-small", 60384),
beakerStop: register2("beaker-stop", 60385),
graphLine: register2("graph-line", 60386),
graphScatter: register2("graph-scatter", 60387),
pieChart: register2("pie-chart", 60388),
bracket: register2("bracket", 60175),
bracketDot: register2("bracket-dot", 60389),
bracketError: register2("bracket-error", 60390),
lockSmall: register2("lock-small", 60391),
azureDevops: register2("azure-devops", 60392),
verifiedFilled: register2("verified-filled", 60393),
newline: register2("newline", 60394),
layout: register2("layout", 60395),
layoutActivitybarLeft: register2("layout-activitybar-left", 60396),
layoutActivitybarRight: register2("layout-activitybar-right", 60397),
layoutPanelLeft: register2("layout-panel-left", 60398),
layoutPanelCenter: register2("layout-panel-center", 60399),
layoutPanelJustify: register2("layout-panel-justify", 60400),
layoutPanelRight: register2("layout-panel-right", 60401),
layoutPanel: register2("layout-panel", 60402),
layoutSidebarLeft: register2("layout-sidebar-left", 60403),
layoutSidebarRight: register2("layout-sidebar-right", 60404),
layoutStatusbar: register2("layout-statusbar", 60405),
layoutMenubar: register2("layout-menubar", 60406),
layoutCentered: register2("layout-centered", 60407),
target: register2("target", 60408),
indent: register2("indent", 60409),
recordSmall: register2("record-small", 60410),
errorSmall: register2("error-small", 60411),
terminalDecorationError: register2("terminal-decoration-error", 60411),
arrowCircleDown: register2("arrow-circle-down", 60412),
arrowCircleLeft: register2("arrow-circle-left", 60413),
arrowCircleRight: register2("arrow-circle-right", 60414),
arrowCircleUp: register2("arrow-circle-up", 60415),
layoutSidebarRightOff: register2("layout-sidebar-right-off", 60416),
layoutPanelOff: register2("layout-panel-off", 60417),
layoutSidebarLeftOff: register2("layout-sidebar-left-off", 60418),
blank: register2("blank", 60419),
heartFilled: register2("heart-filled", 60420),
map: register2("map", 60421),
mapHorizontal: register2("map-horizontal", 60421),
foldHorizontal: register2("fold-horizontal", 60421),
mapFilled: register2("map-filled", 60422),
mapHorizontalFilled: register2("map-horizontal-filled", 60422),
foldHorizontalFilled: register2("fold-horizontal-filled", 60422),
circleSmall: register2("circle-small", 60423),
bellSlash: register2("bell-slash", 60424),
bellSlashDot: register2("bell-slash-dot", 60425),
commentUnresolved: register2("comment-unresolved", 60426),
gitPullRequestGoToChanges: register2("git-pull-request-go-to-changes", 60427),
gitPullRequestNewChanges: register2("git-pull-request-new-changes", 60428),
searchFuzzy: register2("search-fuzzy", 60429),
commentDraft: register2("comment-draft", 60430),
send: register2("send", 60431),
sparkle: register2("sparkle", 60432),
insert: register2("insert", 60433),
mic: register2("mic", 60434),
thumbsdownFilled: register2("thumbsdown-filled", 60435),
thumbsupFilled: register2("thumbsup-filled", 60436),
coffee: register2("coffee", 60437),
snake: register2("snake", 60438),
game: register2("game", 60439),
vr: register2("vr", 60440),
chip: register2("chip", 60441),
piano: register2("piano", 60442),
music: register2("music", 60443),
micFilled: register2("mic-filled", 60444),
repoFetch: register2("repo-fetch", 60445),
copilot: register2("copilot", 60446),
lightbulbSparkle: register2("lightbulb-sparkle", 60447),
robot: register2("robot", 60448),
sparkleFilled: register2("sparkle-filled", 60449),
diffSingle: register2("diff-single", 60450),
diffMultiple: register2("diff-multiple", 60451),
surroundWith: register2("surround-with", 60452),
share: register2("share", 60453),
gitStash: register2("git-stash", 60454),
gitStashApply: register2("git-stash-apply", 60455),
gitStashPop: register2("git-stash-pop", 60456),
vscode: register2("vscode", 60457),
vscodeInsiders: register2("vscode-insiders", 60458),
codeOss: register2("code-oss", 60459),
runCoverage: register2("run-coverage", 60460),
runAllCoverage: register2("run-all-coverage", 60461),
coverage: register2("coverage", 60462),
githubProject: register2("github-project", 60463),
mapVertical: register2("map-vertical", 60464),
foldVertical: register2("fold-vertical", 60464),
mapVerticalFilled: register2("map-vertical-filled", 60465),
foldVerticalFilled: register2("fold-vertical-filled", 60465),
goToSearch: register2("go-to-search", 60466),
percentage: register2("percentage", 60467),
sortPercentage: register2("sort-percentage", 60467),
attach: register2("attach", 60468)
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/codicons.js
var codiconsDerived, Codicon;
var init_codicons = __esm({
"node_modules/monaco-editor/esm/vs/base/common/codicons.js"() {
init_codiconsUtil();
init_codiconsLibrary();
codiconsDerived = {
dialogError: register2("dialog-error", "error"),
dialogWarning: register2("dialog-warning", "warning"),
dialogInfo: register2("dialog-info", "info"),
dialogClose: register2("dialog-close", "close"),
treeItemExpanded: register2("tree-item-expanded", "chevron-down"),
// collapsed is done with rotation
treeFilterOnTypeOn: register2("tree-filter-on-type-on", "list-filter"),
treeFilterOnTypeOff: register2("tree-filter-on-type-off", "list-selection"),
treeFilterClear: register2("tree-filter-clear", "close"),
treeItemLoading: register2("tree-item-loading", "loading"),
menuSelection: register2("menu-selection", "check"),
menuSubmenu: register2("menu-submenu", "chevron-right"),
menuBarMore: register2("menubar-more", "more"),
scrollbarButtonLeft: register2("scrollbar-button-left", "triangle-left"),
scrollbarButtonRight: register2("scrollbar-button-right", "triangle-right"),
scrollbarButtonUp: register2("scrollbar-button-up", "triangle-up"),
scrollbarButtonDown: register2("scrollbar-button-down", "triangle-down"),
toolBarMore: register2("toolbar-more", "more"),
quickInputBack: register2("quick-input-back", "arrow-left"),
dropDownButton: register2("drop-down-button", 60084),
symbolCustomColor: register2("symbol-customcolor", 60252),
exportIcon: register2("export", 60332),
workspaceUnspecified: register2("workspace-unspecified", 60355),
newLine: register2("newline", 60394),
thumbsDownFilled: register2("thumbsdown-filled", 60435),
thumbsUpFilled: register2("thumbsup-filled", 60436),
gitFetch: register2("git-fetch", 60445),
lightbulbSparkleAutofix: register2("lightbulb-sparkle-autofix", 60447),
debugBreakpointPending: register2("debug-breakpoint-pending", 60377)
};
Codicon = __spreadValues(__spreadValues({}, codiconsLibrary), codiconsDerived);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokenizationRegistry.js
var TokenizationRegistry, TokenizationSupportFactoryData;
var init_tokenizationRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokenizationRegistry.js"() {
init_event();
init_lifecycle();
TokenizationRegistry = class {
constructor() {
this._tokenizationSupports = /* @__PURE__ */ new Map();
this._factories = /* @__PURE__ */ new Map();
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
this._colorMap = null;
}
handleChange(languageIds) {
this._onDidChange.fire({
changedLanguages: languageIds,
changedColorMap: false
});
}
register(languageId, support) {
this._tokenizationSupports.set(languageId, support);
this.handleChange([languageId]);
return toDisposable(() => {
if (this._tokenizationSupports.get(languageId) !== support) {
return;
}
this._tokenizationSupports.delete(languageId);
this.handleChange([languageId]);
});
}
get(languageId) {
return this._tokenizationSupports.get(languageId) || null;
}
registerFactory(languageId, factory) {
var _a10;
(_a10 = this._factories.get(languageId)) === null || _a10 === void 0 ? void 0 : _a10.dispose();
const myData = new TokenizationSupportFactoryData(this, languageId, factory);
this._factories.set(languageId, myData);
return toDisposable(() => {
const v = this._factories.get(languageId);
if (!v || v !== myData) {
return;
}
this._factories.delete(languageId);
v.dispose();
});
}
getOrCreate(languageId) {
return __async(this, null, function* () {
const tokenizationSupport = this.get(languageId);
if (tokenizationSupport) {
return tokenizationSupport;
}
const factory = this._factories.get(languageId);
if (!factory || factory.isResolved) {
return null;
}
yield factory.resolve();
return this.get(languageId);
});
}
isResolved(languageId) {
const tokenizationSupport = this.get(languageId);
if (tokenizationSupport) {
return true;
}
const factory = this._factories.get(languageId);
if (!factory || factory.isResolved) {
return true;
}
return false;
}
setColorMap(colorMap) {
this._colorMap = colorMap;
this._onDidChange.fire({
changedLanguages: Array.from(this._tokenizationSupports.keys()),
changedColorMap: true
});
}
getColorMap() {
return this._colorMap;
}
getDefaultBackground() {
if (this._colorMap && this._colorMap.length > 2) {
return this._colorMap[
2
/* ColorId.DefaultBackground */
];
}
return null;
}
};
TokenizationSupportFactoryData = class extends Disposable {
get isResolved() {
return this._isResolved;
}
constructor(_registry2, _languageId, _factory) {
super();
this._registry = _registry2;
this._languageId = _languageId;
this._factory = _factory;
this._isDisposed = false;
this._resolvePromise = null;
this._isResolved = false;
}
dispose() {
this._isDisposed = true;
super.dispose();
}
resolve() {
return __async(this, null, function* () {
if (!this._resolvePromise) {
this._resolvePromise = this._create();
}
return this._resolvePromise;
});
}
_create() {
return __async(this, null, function* () {
const value = yield this._factory.tokenizationSupport;
this._isResolved = true;
if (value && !this._isDisposed) {
this._register(this._registry.register(this._languageId, value));
}
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages.js
function isLocationLink(thing) {
return thing && URI.isUri(thing.uri) && Range.isIRange(thing.range) && (Range.isIRange(thing.originSelectionRange) || Range.isIRange(thing.targetSelectionRange));
}
function getAriaLabelForSymbol(symbolName, kind) {
return localize("symbolAriaLabel", "{0} ({1})", symbolName, symbolKindNames[kind]);
}
var Token, TokenizationResult, EncodedTokenizationResult, HoverVerbosityAction, CompletionItemKinds, InlineCompletionTriggerKind, SelectedSuggestionInfo, DocumentPasteTriggerKind, SignatureHelpTriggerKind, DocumentHighlightKind, symbolKindNames, SymbolKinds, FoldingRangeKind, NewSymbolNameTag, NewSymbolNameTriggerKind, Command, InlayHintKind, LazyTokenizationSupport, TokenizationRegistry2, InlineEditTriggerKind;
var init_languages = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages.js"() {
init_codicons();
init_uri();
init_range();
init_tokenizationRegistry();
init_nls();
Token = class {
constructor(offset, type, language82) {
this.offset = offset;
this.type = type;
this.language = language82;
this._tokenBrand = void 0;
}
toString() {
return "(" + this.offset + ", " + this.type + ")";
}
};
TokenizationResult = class {
constructor(tokens, endState) {
this.tokens = tokens;
this.endState = endState;
this._tokenizationResultBrand = void 0;
}
};
EncodedTokenizationResult = class {
constructor(tokens, endState) {
this.tokens = tokens;
this.endState = endState;
this._encodedTokenizationResultBrand = void 0;
}
};
(function(HoverVerbosityAction3) {
HoverVerbosityAction3[HoverVerbosityAction3["Increase"] = 0] = "Increase";
HoverVerbosityAction3[HoverVerbosityAction3["Decrease"] = 1] = "Decrease";
})(HoverVerbosityAction || (HoverVerbosityAction = {}));
(function(CompletionItemKinds2) {
const byKind = /* @__PURE__ */ new Map();
byKind.set(0, Codicon.symbolMethod);
byKind.set(1, Codicon.symbolFunction);
byKind.set(2, Codicon.symbolConstructor);
byKind.set(3, Codicon.symbolField);
byKind.set(4, Codicon.symbolVariable);
byKind.set(5, Codicon.symbolClass);
byKind.set(6, Codicon.symbolStruct);
byKind.set(7, Codicon.symbolInterface);
byKind.set(8, Codicon.symbolModule);
byKind.set(9, Codicon.symbolProperty);
byKind.set(10, Codicon.symbolEvent);
byKind.set(11, Codicon.symbolOperator);
byKind.set(12, Codicon.symbolUnit);
byKind.set(13, Codicon.symbolValue);
byKind.set(15, Codicon.symbolEnum);
byKind.set(14, Codicon.symbolConstant);
byKind.set(15, Codicon.symbolEnum);
byKind.set(16, Codicon.symbolEnumMember);
byKind.set(17, Codicon.symbolKeyword);
byKind.set(27, Codicon.symbolSnippet);
byKind.set(18, Codicon.symbolText);
byKind.set(19, Codicon.symbolColor);
byKind.set(20, Codicon.symbolFile);
byKind.set(21, Codicon.symbolReference);
byKind.set(22, Codicon.symbolCustomColor);
byKind.set(23, Codicon.symbolFolder);
byKind.set(24, Codicon.symbolTypeParameter);
byKind.set(25, Codicon.account);
byKind.set(26, Codicon.issues);
function toIcon(kind) {
let codicon = byKind.get(kind);
if (!codicon) {
console.info("No codicon found for CompletionItemKind " + kind);
codicon = Codicon.symbolProperty;
}
return codicon;
}
CompletionItemKinds2.toIcon = toIcon;
const data = /* @__PURE__ */ new Map();
data.set(
"method",
0
/* CompletionItemKind.Method */
);
data.set(
"function",
1
/* CompletionItemKind.Function */
);
data.set(
"constructor",
2
/* CompletionItemKind.Constructor */
);
data.set(
"field",
3
/* CompletionItemKind.Field */
);
data.set(
"variable",
4
/* CompletionItemKind.Variable */
);
data.set(
"class",
5
/* CompletionItemKind.Class */
);
data.set(
"struct",
6
/* CompletionItemKind.Struct */
);
data.set(
"interface",
7
/* CompletionItemKind.Interface */
);
data.set(
"module",
8
/* CompletionItemKind.Module */
);
data.set(
"property",
9
/* CompletionItemKind.Property */
);
data.set(
"event",
10
/* CompletionItemKind.Event */
);
data.set(
"operator",
11
/* CompletionItemKind.Operator */
);
data.set(
"unit",
12
/* CompletionItemKind.Unit */
);
data.set(
"value",
13
/* CompletionItemKind.Value */
);
data.set(
"constant",
14
/* CompletionItemKind.Constant */
);
data.set(
"enum",
15
/* CompletionItemKind.Enum */
);
data.set(
"enum-member",
16
/* CompletionItemKind.EnumMember */
);
data.set(
"enumMember",
16
/* CompletionItemKind.EnumMember */
);
data.set(
"keyword",
17
/* CompletionItemKind.Keyword */
);
data.set(
"snippet",
27
/* CompletionItemKind.Snippet */
);
data.set(
"text",
18
/* CompletionItemKind.Text */
);
data.set(
"color",
19
/* CompletionItemKind.Color */
);
data.set(
"file",
20
/* CompletionItemKind.File */
);
data.set(
"reference",
21
/* CompletionItemKind.Reference */
);
data.set(
"customcolor",
22
/* CompletionItemKind.Customcolor */
);
data.set(
"folder",
23
/* CompletionItemKind.Folder */
);
data.set(
"type-parameter",
24
/* CompletionItemKind.TypeParameter */
);
data.set(
"typeParameter",
24
/* CompletionItemKind.TypeParameter */
);
data.set(
"account",
25
/* CompletionItemKind.User */
);
data.set(
"issue",
26
/* CompletionItemKind.Issue */
);
function fromString(value, strict) {
let res = data.get(value);
if (typeof res === "undefined" && !strict) {
res = 9;
}
return res;
}
CompletionItemKinds2.fromString = fromString;
})(CompletionItemKinds || (CompletionItemKinds = {}));
(function(InlineCompletionTriggerKind9) {
InlineCompletionTriggerKind9[InlineCompletionTriggerKind9["Automatic"] = 0] = "Automatic";
InlineCompletionTriggerKind9[InlineCompletionTriggerKind9["Explicit"] = 1] = "Explicit";
})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));
SelectedSuggestionInfo = class {
constructor(range2, text2, completionKind, isSnippetText) {
this.range = range2;
this.text = text2;
this.completionKind = completionKind;
this.isSnippetText = isSnippetText;
}
equals(other) {
return Range.lift(this.range).equalsRange(other.range) && this.text === other.text && this.completionKind === other.completionKind && this.isSnippetText === other.isSnippetText;
}
};
(function(DocumentPasteTriggerKind2) {
DocumentPasteTriggerKind2[DocumentPasteTriggerKind2["Automatic"] = 0] = "Automatic";
DocumentPasteTriggerKind2[DocumentPasteTriggerKind2["PasteAs"] = 1] = "PasteAs";
})(DocumentPasteTriggerKind || (DocumentPasteTriggerKind = {}));
(function(SignatureHelpTriggerKind3) {
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["Invoke"] = 1] = "Invoke";
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["TriggerCharacter"] = 2] = "TriggerCharacter";
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["ContentChange"] = 3] = "ContentChange";
})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));
(function(DocumentHighlightKind9) {
DocumentHighlightKind9[DocumentHighlightKind9["Text"] = 0] = "Text";
DocumentHighlightKind9[DocumentHighlightKind9["Read"] = 1] = "Read";
DocumentHighlightKind9[DocumentHighlightKind9["Write"] = 2] = "Write";
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
symbolKindNames = {
[
17
/* SymbolKind.Array */
]: localize("Array", "array"),
[
16
/* SymbolKind.Boolean */
]: localize("Boolean", "boolean"),
[
4
/* SymbolKind.Class */
]: localize("Class", "class"),
[
13
/* SymbolKind.Constant */
]: localize("Constant", "constant"),
[
8
/* SymbolKind.Constructor */
]: localize("Constructor", "constructor"),
[
9
/* SymbolKind.Enum */
]: localize("Enum", "enumeration"),
[
21
/* SymbolKind.EnumMember */
]: localize("EnumMember", "enumeration member"),
[
23
/* SymbolKind.Event */
]: localize("Event", "event"),
[
7
/* SymbolKind.Field */
]: localize("Field", "field"),
[
0
/* SymbolKind.File */
]: localize("File", "file"),
[
11
/* SymbolKind.Function */
]: localize("Function", "function"),
[
10
/* SymbolKind.Interface */
]: localize("Interface", "interface"),
[
19
/* SymbolKind.Key */
]: localize("Key", "key"),
[
5
/* SymbolKind.Method */
]: localize("Method", "method"),
[
1
/* SymbolKind.Module */
]: localize("Module", "module"),
[
2
/* SymbolKind.Namespace */
]: localize("Namespace", "namespace"),
[
20
/* SymbolKind.Null */
]: localize("Null", "null"),
[
15
/* SymbolKind.Number */
]: localize("Number", "number"),
[
18
/* SymbolKind.Object */
]: localize("Object", "object"),
[
24
/* SymbolKind.Operator */
]: localize("Operator", "operator"),
[
3
/* SymbolKind.Package */
]: localize("Package", "package"),
[
6
/* SymbolKind.Property */
]: localize("Property", "property"),
[
14
/* SymbolKind.String */
]: localize("String", "string"),
[
22
/* SymbolKind.Struct */
]: localize("Struct", "struct"),
[
25
/* SymbolKind.TypeParameter */
]: localize("TypeParameter", "type parameter"),
[
12
/* SymbolKind.Variable */
]: localize("Variable", "variable")
};
(function(SymbolKinds2) {
const byKind = /* @__PURE__ */ new Map();
byKind.set(0, Codicon.symbolFile);
byKind.set(1, Codicon.symbolModule);
byKind.set(2, Codicon.symbolNamespace);
byKind.set(3, Codicon.symbolPackage);
byKind.set(4, Codicon.symbolClass);
byKind.set(5, Codicon.symbolMethod);
byKind.set(6, Codicon.symbolProperty);
byKind.set(7, Codicon.symbolField);
byKind.set(8, Codicon.symbolConstructor);
byKind.set(9, Codicon.symbolEnum);
byKind.set(10, Codicon.symbolInterface);
byKind.set(11, Codicon.symbolFunction);
byKind.set(12, Codicon.symbolVariable);
byKind.set(13, Codicon.symbolConstant);
byKind.set(14, Codicon.symbolString);
byKind.set(15, Codicon.symbolNumber);
byKind.set(16, Codicon.symbolBoolean);
byKind.set(17, Codicon.symbolArray);
byKind.set(18, Codicon.symbolObject);
byKind.set(19, Codicon.symbolKey);
byKind.set(20, Codicon.symbolNull);
byKind.set(21, Codicon.symbolEnumMember);
byKind.set(22, Codicon.symbolStruct);
byKind.set(23, Codicon.symbolEvent);
byKind.set(24, Codicon.symbolOperator);
byKind.set(25, Codicon.symbolTypeParameter);
function toIcon(kind) {
let icon = byKind.get(kind);
if (!icon) {
console.info("No codicon found for SymbolKind " + kind);
icon = Codicon.symbolProperty;
}
return icon;
}
SymbolKinds2.toIcon = toIcon;
})(SymbolKinds || (SymbolKinds = {}));
FoldingRangeKind = class _FoldingRangeKind {
/**
* Returns a {@link FoldingRangeKind} for the given value.
*
* @param value of the kind.
*/
static fromValue(value) {
switch (value) {
case "comment":
return _FoldingRangeKind.Comment;
case "imports":
return _FoldingRangeKind.Imports;
case "region":
return _FoldingRangeKind.Region;
}
return new _FoldingRangeKind(value);
}
/**
* Creates a new {@link FoldingRangeKind}.
*
* @param value of the kind.
*/
constructor(value) {
this.value = value;
}
};
FoldingRangeKind.Comment = new FoldingRangeKind("comment");
FoldingRangeKind.Imports = new FoldingRangeKind("imports");
FoldingRangeKind.Region = new FoldingRangeKind("region");
(function(NewSymbolNameTag3) {
NewSymbolNameTag3[NewSymbolNameTag3["AIGenerated"] = 1] = "AIGenerated";
})(NewSymbolNameTag || (NewSymbolNameTag = {}));
(function(NewSymbolNameTriggerKind3) {
NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Invoke"] = 0] = "Invoke";
NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Automatic"] = 1] = "Automatic";
})(NewSymbolNameTriggerKind || (NewSymbolNameTriggerKind = {}));
(function(Command9) {
function is(obj) {
if (!obj || typeof obj !== "object") {
return false;
}
return typeof obj.id === "string" && typeof obj.title === "string";
}
Command9.is = is;
})(Command || (Command = {}));
(function(InlayHintKind9) {
InlayHintKind9[InlayHintKind9["Type"] = 1] = "Type";
InlayHintKind9[InlayHintKind9["Parameter"] = 2] = "Parameter";
})(InlayHintKind || (InlayHintKind = {}));
LazyTokenizationSupport = class {
constructor(createSupport) {
this.createSupport = createSupport;
this._tokenizationSupport = null;
}
dispose() {
if (this._tokenizationSupport) {
this._tokenizationSupport.then((support) => {
if (support) {
support.dispose();
}
});
}
}
get tokenizationSupport() {
if (!this._tokenizationSupport) {
this._tokenizationSupport = this.createSupport();
}
return this._tokenizationSupport;
}
};
TokenizationRegistry2 = new TokenizationRegistry();
(function(InlineEditTriggerKind3) {
InlineEditTriggerKind3[InlineEditTriggerKind3["Invoke"] = 0] = "Invoke";
InlineEditTriggerKind3[InlineEditTriggerKind3["Automatic"] = 1] = "Automatic";
})(InlineEditTriggerKind || (InlineEditTriggerKind = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js
var AccessibilitySupport, CodeActionTriggerType, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemTag, CompletionTriggerKind, ContentWidgetPositionPreference, CursorChangeReason, DefaultEndOfLine, DocumentHighlightKind2, EditorAutoIndentStrategy, EditorOption, EndOfLinePreference, EndOfLineSequence, GlyphMarginLane, HoverVerbosityAction2, IndentAction, InjectedTextCursorStops, InlayHintKind2, InlineCompletionTriggerKind2, InlineEditTriggerKind2, KeyCode, MarkerSeverity, MarkerTag, MinimapPosition, MinimapSectionHeaderStyle, MouseTargetType, NewSymbolNameTag2, NewSymbolNameTriggerKind2, OverlayWidgetPositionPreference, OverviewRulerLane, PartialAcceptTriggerKind, PositionAffinity, RenderLineNumbersType, RenderMinimap, ScrollType, ScrollbarVisibility, SelectionDirection, ShowLightbulbIconMode2, SignatureHelpTriggerKind2, SymbolKind, SymbolTag, TextEditorCursorBlinkingStyle, TextEditorCursorStyle2, TrackedRangeStickiness, WrappingIndent;
var init_standaloneEnums = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js"() {
(function(AccessibilitySupport2) {
AccessibilitySupport2[AccessibilitySupport2["Unknown"] = 0] = "Unknown";
AccessibilitySupport2[AccessibilitySupport2["Disabled"] = 1] = "Disabled";
AccessibilitySupport2[AccessibilitySupport2["Enabled"] = 2] = "Enabled";
})(AccessibilitySupport || (AccessibilitySupport = {}));
(function(CodeActionTriggerType2) {
CodeActionTriggerType2[CodeActionTriggerType2["Invoke"] = 1] = "Invoke";
CodeActionTriggerType2[CodeActionTriggerType2["Auto"] = 2] = "Auto";
})(CodeActionTriggerType || (CodeActionTriggerType = {}));
(function(CompletionItemInsertTextRule2) {
CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["None"] = 0] = "None";
CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["KeepWhitespace"] = 1] = "KeepWhitespace";
CompletionItemInsertTextRule2[CompletionItemInsertTextRule2["InsertAsSnippet"] = 4] = "InsertAsSnippet";
})(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));
(function(CompletionItemKind8) {
CompletionItemKind8[CompletionItemKind8["Method"] = 0] = "Method";
CompletionItemKind8[CompletionItemKind8["Function"] = 1] = "Function";
CompletionItemKind8[CompletionItemKind8["Constructor"] = 2] = "Constructor";
CompletionItemKind8[CompletionItemKind8["Field"] = 3] = "Field";
CompletionItemKind8[CompletionItemKind8["Variable"] = 4] = "Variable";
CompletionItemKind8[CompletionItemKind8["Class"] = 5] = "Class";
CompletionItemKind8[CompletionItemKind8["Struct"] = 6] = "Struct";
CompletionItemKind8[CompletionItemKind8["Interface"] = 7] = "Interface";
CompletionItemKind8[CompletionItemKind8["Module"] = 8] = "Module";
CompletionItemKind8[CompletionItemKind8["Property"] = 9] = "Property";
CompletionItemKind8[CompletionItemKind8["Event"] = 10] = "Event";
CompletionItemKind8[CompletionItemKind8["Operator"] = 11] = "Operator";
CompletionItemKind8[CompletionItemKind8["Unit"] = 12] = "Unit";
CompletionItemKind8[CompletionItemKind8["Value"] = 13] = "Value";
CompletionItemKind8[CompletionItemKind8["Constant"] = 14] = "Constant";
CompletionItemKind8[CompletionItemKind8["Enum"] = 15] = "Enum";
CompletionItemKind8[CompletionItemKind8["EnumMember"] = 16] = "EnumMember";
CompletionItemKind8[CompletionItemKind8["Keyword"] = 17] = "Keyword";
CompletionItemKind8[CompletionItemKind8["Text"] = 18] = "Text";
CompletionItemKind8[CompletionItemKind8["Color"] = 19] = "Color";
CompletionItemKind8[CompletionItemKind8["File"] = 20] = "File";
CompletionItemKind8[CompletionItemKind8["Reference"] = 21] = "Reference";
CompletionItemKind8[CompletionItemKind8["Customcolor"] = 22] = "Customcolor";
CompletionItemKind8[CompletionItemKind8["Folder"] = 23] = "Folder";
CompletionItemKind8[CompletionItemKind8["TypeParameter"] = 24] = "TypeParameter";
CompletionItemKind8[CompletionItemKind8["User"] = 25] = "User";
CompletionItemKind8[CompletionItemKind8["Issue"] = 26] = "Issue";
CompletionItemKind8[CompletionItemKind8["Snippet"] = 27] = "Snippet";
})(CompletionItemKind || (CompletionItemKind = {}));
(function(CompletionItemTag8) {
CompletionItemTag8[CompletionItemTag8["Deprecated"] = 1] = "Deprecated";
})(CompletionItemTag || (CompletionItemTag = {}));
(function(CompletionTriggerKind2) {
CompletionTriggerKind2[CompletionTriggerKind2["Invoke"] = 0] = "Invoke";
CompletionTriggerKind2[CompletionTriggerKind2["TriggerCharacter"] = 1] = "TriggerCharacter";
CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 2] = "TriggerForIncompleteCompletions";
})(CompletionTriggerKind || (CompletionTriggerKind = {}));
(function(ContentWidgetPositionPreference2) {
ContentWidgetPositionPreference2[ContentWidgetPositionPreference2["EXACT"] = 0] = "EXACT";
ContentWidgetPositionPreference2[ContentWidgetPositionPreference2["ABOVE"] = 1] = "ABOVE";
ContentWidgetPositionPreference2[ContentWidgetPositionPreference2["BELOW"] = 2] = "BELOW";
})(ContentWidgetPositionPreference || (ContentWidgetPositionPreference = {}));
(function(CursorChangeReason2) {
CursorChangeReason2[CursorChangeReason2["NotSet"] = 0] = "NotSet";
CursorChangeReason2[CursorChangeReason2["ContentFlush"] = 1] = "ContentFlush";
CursorChangeReason2[CursorChangeReason2["RecoverFromMarkers"] = 2] = "RecoverFromMarkers";
CursorChangeReason2[CursorChangeReason2["Explicit"] = 3] = "Explicit";
CursorChangeReason2[CursorChangeReason2["Paste"] = 4] = "Paste";
CursorChangeReason2[CursorChangeReason2["Undo"] = 5] = "Undo";
CursorChangeReason2[CursorChangeReason2["Redo"] = 6] = "Redo";
})(CursorChangeReason || (CursorChangeReason = {}));
(function(DefaultEndOfLine2) {
DefaultEndOfLine2[DefaultEndOfLine2["LF"] = 1] = "LF";
DefaultEndOfLine2[DefaultEndOfLine2["CRLF"] = 2] = "CRLF";
})(DefaultEndOfLine || (DefaultEndOfLine = {}));
(function(DocumentHighlightKind9) {
DocumentHighlightKind9[DocumentHighlightKind9["Text"] = 0] = "Text";
DocumentHighlightKind9[DocumentHighlightKind9["Read"] = 1] = "Read";
DocumentHighlightKind9[DocumentHighlightKind9["Write"] = 2] = "Write";
})(DocumentHighlightKind2 || (DocumentHighlightKind2 = {}));
(function(EditorAutoIndentStrategy2) {
EditorAutoIndentStrategy2[EditorAutoIndentStrategy2["None"] = 0] = "None";
EditorAutoIndentStrategy2[EditorAutoIndentStrategy2["Keep"] = 1] = "Keep";
EditorAutoIndentStrategy2[EditorAutoIndentStrategy2["Brackets"] = 2] = "Brackets";
EditorAutoIndentStrategy2[EditorAutoIndentStrategy2["Advanced"] = 3] = "Advanced";
EditorAutoIndentStrategy2[EditorAutoIndentStrategy2["Full"] = 4] = "Full";
})(EditorAutoIndentStrategy || (EditorAutoIndentStrategy = {}));
(function(EditorOption2) {
EditorOption2[EditorOption2["acceptSuggestionOnCommitCharacter"] = 0] = "acceptSuggestionOnCommitCharacter";
EditorOption2[EditorOption2["acceptSuggestionOnEnter"] = 1] = "acceptSuggestionOnEnter";
EditorOption2[EditorOption2["accessibilitySupport"] = 2] = "accessibilitySupport";
EditorOption2[EditorOption2["accessibilityPageSize"] = 3] = "accessibilityPageSize";
EditorOption2[EditorOption2["ariaLabel"] = 4] = "ariaLabel";
EditorOption2[EditorOption2["ariaRequired"] = 5] = "ariaRequired";
EditorOption2[EditorOption2["autoClosingBrackets"] = 6] = "autoClosingBrackets";
EditorOption2[EditorOption2["autoClosingComments"] = 7] = "autoClosingComments";
EditorOption2[EditorOption2["screenReaderAnnounceInlineSuggestion"] = 8] = "screenReaderAnnounceInlineSuggestion";
EditorOption2[EditorOption2["autoClosingDelete"] = 9] = "autoClosingDelete";
EditorOption2[EditorOption2["autoClosingOvertype"] = 10] = "autoClosingOvertype";
EditorOption2[EditorOption2["autoClosingQuotes"] = 11] = "autoClosingQuotes";
EditorOption2[EditorOption2["autoIndent"] = 12] = "autoIndent";
EditorOption2[EditorOption2["automaticLayout"] = 13] = "automaticLayout";
EditorOption2[EditorOption2["autoSurround"] = 14] = "autoSurround";
EditorOption2[EditorOption2["bracketPairColorization"] = 15] = "bracketPairColorization";
EditorOption2[EditorOption2["guides"] = 16] = "guides";
EditorOption2[EditorOption2["codeLens"] = 17] = "codeLens";
EditorOption2[EditorOption2["codeLensFontFamily"] = 18] = "codeLensFontFamily";
EditorOption2[EditorOption2["codeLensFontSize"] = 19] = "codeLensFontSize";
EditorOption2[EditorOption2["colorDecorators"] = 20] = "colorDecorators";
EditorOption2[EditorOption2["colorDecoratorsLimit"] = 21] = "colorDecoratorsLimit";
EditorOption2[EditorOption2["columnSelection"] = 22] = "columnSelection";
EditorOption2[EditorOption2["comments"] = 23] = "comments";
EditorOption2[EditorOption2["contextmenu"] = 24] = "contextmenu";
EditorOption2[EditorOption2["copyWithSyntaxHighlighting"] = 25] = "copyWithSyntaxHighlighting";
EditorOption2[EditorOption2["cursorBlinking"] = 26] = "cursorBlinking";
EditorOption2[EditorOption2["cursorSmoothCaretAnimation"] = 27] = "cursorSmoothCaretAnimation";
EditorOption2[EditorOption2["cursorStyle"] = 28] = "cursorStyle";
EditorOption2[EditorOption2["cursorSurroundingLines"] = 29] = "cursorSurroundingLines";
EditorOption2[EditorOption2["cursorSurroundingLinesStyle"] = 30] = "cursorSurroundingLinesStyle";
EditorOption2[EditorOption2["cursorWidth"] = 31] = "cursorWidth";
EditorOption2[EditorOption2["disableLayerHinting"] = 32] = "disableLayerHinting";
EditorOption2[EditorOption2["disableMonospaceOptimizations"] = 33] = "disableMonospaceOptimizations";
EditorOption2[EditorOption2["domReadOnly"] = 34] = "domReadOnly";
EditorOption2[EditorOption2["dragAndDrop"] = 35] = "dragAndDrop";
EditorOption2[EditorOption2["dropIntoEditor"] = 36] = "dropIntoEditor";
EditorOption2[EditorOption2["emptySelectionClipboard"] = 37] = "emptySelectionClipboard";
EditorOption2[EditorOption2["experimentalWhitespaceRendering"] = 38] = "experimentalWhitespaceRendering";
EditorOption2[EditorOption2["extraEditorClassName"] = 39] = "extraEditorClassName";
EditorOption2[EditorOption2["fastScrollSensitivity"] = 40] = "fastScrollSensitivity";
EditorOption2[EditorOption2["find"] = 41] = "find";
EditorOption2[EditorOption2["fixedOverflowWidgets"] = 42] = "fixedOverflowWidgets";
EditorOption2[EditorOption2["folding"] = 43] = "folding";
EditorOption2[EditorOption2["foldingStrategy"] = 44] = "foldingStrategy";
EditorOption2[EditorOption2["foldingHighlight"] = 45] = "foldingHighlight";
EditorOption2[EditorOption2["foldingImportsByDefault"] = 46] = "foldingImportsByDefault";
EditorOption2[EditorOption2["foldingMaximumRegions"] = 47] = "foldingMaximumRegions";
EditorOption2[EditorOption2["unfoldOnClickAfterEndOfLine"] = 48] = "unfoldOnClickAfterEndOfLine";
EditorOption2[EditorOption2["fontFamily"] = 49] = "fontFamily";
EditorOption2[EditorOption2["fontInfo"] = 50] = "fontInfo";
EditorOption2[EditorOption2["fontLigatures"] = 51] = "fontLigatures";
EditorOption2[EditorOption2["fontSize"] = 52] = "fontSize";
EditorOption2[EditorOption2["fontWeight"] = 53] = "fontWeight";
EditorOption2[EditorOption2["fontVariations"] = 54] = "fontVariations";
EditorOption2[EditorOption2["formatOnPaste"] = 55] = "formatOnPaste";
EditorOption2[EditorOption2["formatOnType"] = 56] = "formatOnType";
EditorOption2[EditorOption2["glyphMargin"] = 57] = "glyphMargin";
EditorOption2[EditorOption2["gotoLocation"] = 58] = "gotoLocation";
EditorOption2[EditorOption2["hideCursorInOverviewRuler"] = 59] = "hideCursorInOverviewRuler";
EditorOption2[EditorOption2["hover"] = 60] = "hover";
EditorOption2[EditorOption2["inDiffEditor"] = 61] = "inDiffEditor";
EditorOption2[EditorOption2["inlineSuggest"] = 62] = "inlineSuggest";
EditorOption2[EditorOption2["inlineEdit"] = 63] = "inlineEdit";
EditorOption2[EditorOption2["letterSpacing"] = 64] = "letterSpacing";
EditorOption2[EditorOption2["lightbulb"] = 65] = "lightbulb";
EditorOption2[EditorOption2["lineDecorationsWidth"] = 66] = "lineDecorationsWidth";
EditorOption2[EditorOption2["lineHeight"] = 67] = "lineHeight";
EditorOption2[EditorOption2["lineNumbers"] = 68] = "lineNumbers";
EditorOption2[EditorOption2["lineNumbersMinChars"] = 69] = "lineNumbersMinChars";
EditorOption2[EditorOption2["linkedEditing"] = 70] = "linkedEditing";
EditorOption2[EditorOption2["links"] = 71] = "links";
EditorOption2[EditorOption2["matchBrackets"] = 72] = "matchBrackets";
EditorOption2[EditorOption2["minimap"] = 73] = "minimap";
EditorOption2[EditorOption2["mouseStyle"] = 74] = "mouseStyle";
EditorOption2[EditorOption2["mouseWheelScrollSensitivity"] = 75] = "mouseWheelScrollSensitivity";
EditorOption2[EditorOption2["mouseWheelZoom"] = 76] = "mouseWheelZoom";
EditorOption2[EditorOption2["multiCursorMergeOverlapping"] = 77] = "multiCursorMergeOverlapping";
EditorOption2[EditorOption2["multiCursorModifier"] = 78] = "multiCursorModifier";
EditorOption2[EditorOption2["multiCursorPaste"] = 79] = "multiCursorPaste";
EditorOption2[EditorOption2["multiCursorLimit"] = 80] = "multiCursorLimit";
EditorOption2[EditorOption2["occurrencesHighlight"] = 81] = "occurrencesHighlight";
EditorOption2[EditorOption2["overviewRulerBorder"] = 82] = "overviewRulerBorder";
EditorOption2[EditorOption2["overviewRulerLanes"] = 83] = "overviewRulerLanes";
EditorOption2[EditorOption2["padding"] = 84] = "padding";
EditorOption2[EditorOption2["pasteAs"] = 85] = "pasteAs";
EditorOption2[EditorOption2["parameterHints"] = 86] = "parameterHints";
EditorOption2[EditorOption2["peekWidgetDefaultFocus"] = 87] = "peekWidgetDefaultFocus";
EditorOption2[EditorOption2["definitionLinkOpensInPeek"] = 88] = "definitionLinkOpensInPeek";
EditorOption2[EditorOption2["quickSuggestions"] = 89] = "quickSuggestions";
EditorOption2[EditorOption2["quickSuggestionsDelay"] = 90] = "quickSuggestionsDelay";
EditorOption2[EditorOption2["readOnly"] = 91] = "readOnly";
EditorOption2[EditorOption2["readOnlyMessage"] = 92] = "readOnlyMessage";
EditorOption2[EditorOption2["renameOnType"] = 93] = "renameOnType";
EditorOption2[EditorOption2["renderControlCharacters"] = 94] = "renderControlCharacters";
EditorOption2[EditorOption2["renderFinalNewline"] = 95] = "renderFinalNewline";
EditorOption2[EditorOption2["renderLineHighlight"] = 96] = "renderLineHighlight";
EditorOption2[EditorOption2["renderLineHighlightOnlyWhenFocus"] = 97] = "renderLineHighlightOnlyWhenFocus";
EditorOption2[EditorOption2["renderValidationDecorations"] = 98] = "renderValidationDecorations";
EditorOption2[EditorOption2["renderWhitespace"] = 99] = "renderWhitespace";
EditorOption2[EditorOption2["revealHorizontalRightPadding"] = 100] = "revealHorizontalRightPadding";
EditorOption2[EditorOption2["roundedSelection"] = 101] = "roundedSelection";
EditorOption2[EditorOption2["rulers"] = 102] = "rulers";
EditorOption2[EditorOption2["scrollbar"] = 103] = "scrollbar";
EditorOption2[EditorOption2["scrollBeyondLastColumn"] = 104] = "scrollBeyondLastColumn";
EditorOption2[EditorOption2["scrollBeyondLastLine"] = 105] = "scrollBeyondLastLine";
EditorOption2[EditorOption2["scrollPredominantAxis"] = 106] = "scrollPredominantAxis";
EditorOption2[EditorOption2["selectionClipboard"] = 107] = "selectionClipboard";
EditorOption2[EditorOption2["selectionHighlight"] = 108] = "selectionHighlight";
EditorOption2[EditorOption2["selectOnLineNumbers"] = 109] = "selectOnLineNumbers";
EditorOption2[EditorOption2["showFoldingControls"] = 110] = "showFoldingControls";
EditorOption2[EditorOption2["showUnused"] = 111] = "showUnused";
EditorOption2[EditorOption2["snippetSuggestions"] = 112] = "snippetSuggestions";
EditorOption2[EditorOption2["smartSelect"] = 113] = "smartSelect";
EditorOption2[EditorOption2["smoothScrolling"] = 114] = "smoothScrolling";
EditorOption2[EditorOption2["stickyScroll"] = 115] = "stickyScroll";
EditorOption2[EditorOption2["stickyTabStops"] = 116] = "stickyTabStops";
EditorOption2[EditorOption2["stopRenderingLineAfter"] = 117] = "stopRenderingLineAfter";
EditorOption2[EditorOption2["suggest"] = 118] = "suggest";
EditorOption2[EditorOption2["suggestFontSize"] = 119] = "suggestFontSize";
EditorOption2[EditorOption2["suggestLineHeight"] = 120] = "suggestLineHeight";
EditorOption2[EditorOption2["suggestOnTriggerCharacters"] = 121] = "suggestOnTriggerCharacters";
EditorOption2[EditorOption2["suggestSelection"] = 122] = "suggestSelection";
EditorOption2[EditorOption2["tabCompletion"] = 123] = "tabCompletion";
EditorOption2[EditorOption2["tabIndex"] = 124] = "tabIndex";
EditorOption2[EditorOption2["unicodeHighlighting"] = 125] = "unicodeHighlighting";
EditorOption2[EditorOption2["unusualLineTerminators"] = 126] = "unusualLineTerminators";
EditorOption2[EditorOption2["useShadowDOM"] = 127] = "useShadowDOM";
EditorOption2[EditorOption2["useTabStops"] = 128] = "useTabStops";
EditorOption2[EditorOption2["wordBreak"] = 129] = "wordBreak";
EditorOption2[EditorOption2["wordSegmenterLocales"] = 130] = "wordSegmenterLocales";
EditorOption2[EditorOption2["wordSeparators"] = 131] = "wordSeparators";
EditorOption2[EditorOption2["wordWrap"] = 132] = "wordWrap";
EditorOption2[EditorOption2["wordWrapBreakAfterCharacters"] = 133] = "wordWrapBreakAfterCharacters";
EditorOption2[EditorOption2["wordWrapBreakBeforeCharacters"] = 134] = "wordWrapBreakBeforeCharacters";
EditorOption2[EditorOption2["wordWrapColumn"] = 135] = "wordWrapColumn";
EditorOption2[EditorOption2["wordWrapOverride1"] = 136] = "wordWrapOverride1";
EditorOption2[EditorOption2["wordWrapOverride2"] = 137] = "wordWrapOverride2";
EditorOption2[EditorOption2["wrappingIndent"] = 138] = "wrappingIndent";
EditorOption2[EditorOption2["wrappingStrategy"] = 139] = "wrappingStrategy";
EditorOption2[EditorOption2["showDeprecated"] = 140] = "showDeprecated";
EditorOption2[EditorOption2["inlayHints"] = 141] = "inlayHints";
EditorOption2[EditorOption2["editorClassName"] = 142] = "editorClassName";
EditorOption2[EditorOption2["pixelRatio"] = 143] = "pixelRatio";
EditorOption2[EditorOption2["tabFocusMode"] = 144] = "tabFocusMode";
EditorOption2[EditorOption2["layoutInfo"] = 145] = "layoutInfo";
EditorOption2[EditorOption2["wrappingInfo"] = 146] = "wrappingInfo";
EditorOption2[EditorOption2["defaultColorDecorators"] = 147] = "defaultColorDecorators";
EditorOption2[EditorOption2["colorDecoratorsActivatedOn"] = 148] = "colorDecoratorsActivatedOn";
EditorOption2[EditorOption2["inlineCompletionsAccessibilityVerbose"] = 149] = "inlineCompletionsAccessibilityVerbose";
})(EditorOption || (EditorOption = {}));
(function(EndOfLinePreference2) {
EndOfLinePreference2[EndOfLinePreference2["TextDefined"] = 0] = "TextDefined";
EndOfLinePreference2[EndOfLinePreference2["LF"] = 1] = "LF";
EndOfLinePreference2[EndOfLinePreference2["CRLF"] = 2] = "CRLF";
})(EndOfLinePreference || (EndOfLinePreference = {}));
(function(EndOfLineSequence2) {
EndOfLineSequence2[EndOfLineSequence2["LF"] = 0] = "LF";
EndOfLineSequence2[EndOfLineSequence2["CRLF"] = 1] = "CRLF";
})(EndOfLineSequence || (EndOfLineSequence = {}));
(function(GlyphMarginLane3) {
GlyphMarginLane3[GlyphMarginLane3["Left"] = 1] = "Left";
GlyphMarginLane3[GlyphMarginLane3["Center"] = 2] = "Center";
GlyphMarginLane3[GlyphMarginLane3["Right"] = 3] = "Right";
})(GlyphMarginLane || (GlyphMarginLane = {}));
(function(HoverVerbosityAction3) {
HoverVerbosityAction3[HoverVerbosityAction3["Increase"] = 0] = "Increase";
HoverVerbosityAction3[HoverVerbosityAction3["Decrease"] = 1] = "Decrease";
})(HoverVerbosityAction2 || (HoverVerbosityAction2 = {}));
(function(IndentAction3) {
IndentAction3[IndentAction3["None"] = 0] = "None";
IndentAction3[IndentAction3["Indent"] = 1] = "Indent";
IndentAction3[IndentAction3["IndentOutdent"] = 2] = "IndentOutdent";
IndentAction3[IndentAction3["Outdent"] = 3] = "Outdent";
})(IndentAction || (IndentAction = {}));
(function(InjectedTextCursorStops3) {
InjectedTextCursorStops3[InjectedTextCursorStops3["Both"] = 0] = "Both";
InjectedTextCursorStops3[InjectedTextCursorStops3["Right"] = 1] = "Right";
InjectedTextCursorStops3[InjectedTextCursorStops3["Left"] = 2] = "Left";
InjectedTextCursorStops3[InjectedTextCursorStops3["None"] = 3] = "None";
})(InjectedTextCursorStops || (InjectedTextCursorStops = {}));
(function(InlayHintKind9) {
InlayHintKind9[InlayHintKind9["Type"] = 1] = "Type";
InlayHintKind9[InlayHintKind9["Parameter"] = 2] = "Parameter";
})(InlayHintKind2 || (InlayHintKind2 = {}));
(function(InlineCompletionTriggerKind9) {
InlineCompletionTriggerKind9[InlineCompletionTriggerKind9["Automatic"] = 0] = "Automatic";
InlineCompletionTriggerKind9[InlineCompletionTriggerKind9["Explicit"] = 1] = "Explicit";
})(InlineCompletionTriggerKind2 || (InlineCompletionTriggerKind2 = {}));
(function(InlineEditTriggerKind3) {
InlineEditTriggerKind3[InlineEditTriggerKind3["Invoke"] = 0] = "Invoke";
InlineEditTriggerKind3[InlineEditTriggerKind3["Automatic"] = 1] = "Automatic";
})(InlineEditTriggerKind2 || (InlineEditTriggerKind2 = {}));
(function(KeyCode3) {
KeyCode3[KeyCode3["DependsOnKbLayout"] = -1] = "DependsOnKbLayout";
KeyCode3[KeyCode3["Unknown"] = 0] = "Unknown";
KeyCode3[KeyCode3["Backspace"] = 1] = "Backspace";
KeyCode3[KeyCode3["Tab"] = 2] = "Tab";
KeyCode3[KeyCode3["Enter"] = 3] = "Enter";
KeyCode3[KeyCode3["Shift"] = 4] = "Shift";
KeyCode3[KeyCode3["Ctrl"] = 5] = "Ctrl";
KeyCode3[KeyCode3["Alt"] = 6] = "Alt";
KeyCode3[KeyCode3["PauseBreak"] = 7] = "PauseBreak";
KeyCode3[KeyCode3["CapsLock"] = 8] = "CapsLock";
KeyCode3[KeyCode3["Escape"] = 9] = "Escape";
KeyCode3[KeyCode3["Space"] = 10] = "Space";
KeyCode3[KeyCode3["PageUp"] = 11] = "PageUp";
KeyCode3[KeyCode3["PageDown"] = 12] = "PageDown";
KeyCode3[KeyCode3["End"] = 13] = "End";
KeyCode3[KeyCode3["Home"] = 14] = "Home";
KeyCode3[KeyCode3["LeftArrow"] = 15] = "LeftArrow";
KeyCode3[KeyCode3["UpArrow"] = 16] = "UpArrow";
KeyCode3[KeyCode3["RightArrow"] = 17] = "RightArrow";
KeyCode3[KeyCode3["DownArrow"] = 18] = "DownArrow";
KeyCode3[KeyCode3["Insert"] = 19] = "Insert";
KeyCode3[KeyCode3["Delete"] = 20] = "Delete";
KeyCode3[KeyCode3["Digit0"] = 21] = "Digit0";
KeyCode3[KeyCode3["Digit1"] = 22] = "Digit1";
KeyCode3[KeyCode3["Digit2"] = 23] = "Digit2";
KeyCode3[KeyCode3["Digit3"] = 24] = "Digit3";
KeyCode3[KeyCode3["Digit4"] = 25] = "Digit4";
KeyCode3[KeyCode3["Digit5"] = 26] = "Digit5";
KeyCode3[KeyCode3["Digit6"] = 27] = "Digit6";
KeyCode3[KeyCode3["Digit7"] = 28] = "Digit7";
KeyCode3[KeyCode3["Digit8"] = 29] = "Digit8";
KeyCode3[KeyCode3["Digit9"] = 30] = "Digit9";
KeyCode3[KeyCode3["KeyA"] = 31] = "KeyA";
KeyCode3[KeyCode3["KeyB"] = 32] = "KeyB";
KeyCode3[KeyCode3["KeyC"] = 33] = "KeyC";
KeyCode3[KeyCode3["KeyD"] = 34] = "KeyD";
KeyCode3[KeyCode3["KeyE"] = 35] = "KeyE";
KeyCode3[KeyCode3["KeyF"] = 36] = "KeyF";
KeyCode3[KeyCode3["KeyG"] = 37] = "KeyG";
KeyCode3[KeyCode3["KeyH"] = 38] = "KeyH";
KeyCode3[KeyCode3["KeyI"] = 39] = "KeyI";
KeyCode3[KeyCode3["KeyJ"] = 40] = "KeyJ";
KeyCode3[KeyCode3["KeyK"] = 41] = "KeyK";
KeyCode3[KeyCode3["KeyL"] = 42] = "KeyL";
KeyCode3[KeyCode3["KeyM"] = 43] = "KeyM";
KeyCode3[KeyCode3["KeyN"] = 44] = "KeyN";
KeyCode3[KeyCode3["KeyO"] = 45] = "KeyO";
KeyCode3[KeyCode3["KeyP"] = 46] = "KeyP";
KeyCode3[KeyCode3["KeyQ"] = 47] = "KeyQ";
KeyCode3[KeyCode3["KeyR"] = 48] = "KeyR";
KeyCode3[KeyCode3["KeyS"] = 49] = "KeyS";
KeyCode3[KeyCode3["KeyT"] = 50] = "KeyT";
KeyCode3[KeyCode3["KeyU"] = 51] = "KeyU";
KeyCode3[KeyCode3["KeyV"] = 52] = "KeyV";
KeyCode3[KeyCode3["KeyW"] = 53] = "KeyW";
KeyCode3[KeyCode3["KeyX"] = 54] = "KeyX";
KeyCode3[KeyCode3["KeyY"] = 55] = "KeyY";
KeyCode3[KeyCode3["KeyZ"] = 56] = "KeyZ";
KeyCode3[KeyCode3["Meta"] = 57] = "Meta";
KeyCode3[KeyCode3["ContextMenu"] = 58] = "ContextMenu";
KeyCode3[KeyCode3["F1"] = 59] = "F1";
KeyCode3[KeyCode3["F2"] = 60] = "F2";
KeyCode3[KeyCode3["F3"] = 61] = "F3";
KeyCode3[KeyCode3["F4"] = 62] = "F4";
KeyCode3[KeyCode3["F5"] = 63] = "F5";
KeyCode3[KeyCode3["F6"] = 64] = "F6";
KeyCode3[KeyCode3["F7"] = 65] = "F7";
KeyCode3[KeyCode3["F8"] = 66] = "F8";
KeyCode3[KeyCode3["F9"] = 67] = "F9";
KeyCode3[KeyCode3["F10"] = 68] = "F10";
KeyCode3[KeyCode3["F11"] = 69] = "F11";
KeyCode3[KeyCode3["F12"] = 70] = "F12";
KeyCode3[KeyCode3["F13"] = 71] = "F13";
KeyCode3[KeyCode3["F14"] = 72] = "F14";
KeyCode3[KeyCode3["F15"] = 73] = "F15";
KeyCode3[KeyCode3["F16"] = 74] = "F16";
KeyCode3[KeyCode3["F17"] = 75] = "F17";
KeyCode3[KeyCode3["F18"] = 76] = "F18";
KeyCode3[KeyCode3["F19"] = 77] = "F19";
KeyCode3[KeyCode3["F20"] = 78] = "F20";
KeyCode3[KeyCode3["F21"] = 79] = "F21";
KeyCode3[KeyCode3["F22"] = 80] = "F22";
KeyCode3[KeyCode3["F23"] = 81] = "F23";
KeyCode3[KeyCode3["F24"] = 82] = "F24";
KeyCode3[KeyCode3["NumLock"] = 83] = "NumLock";
KeyCode3[KeyCode3["ScrollLock"] = 84] = "ScrollLock";
KeyCode3[KeyCode3["Semicolon"] = 85] = "Semicolon";
KeyCode3[KeyCode3["Equal"] = 86] = "Equal";
KeyCode3[KeyCode3["Comma"] = 87] = "Comma";
KeyCode3[KeyCode3["Minus"] = 88] = "Minus";
KeyCode3[KeyCode3["Period"] = 89] = "Period";
KeyCode3[KeyCode3["Slash"] = 90] = "Slash";
KeyCode3[KeyCode3["Backquote"] = 91] = "Backquote";
KeyCode3[KeyCode3["BracketLeft"] = 92] = "BracketLeft";
KeyCode3[KeyCode3["Backslash"] = 93] = "Backslash";
KeyCode3[KeyCode3["BracketRight"] = 94] = "BracketRight";
KeyCode3[KeyCode3["Quote"] = 95] = "Quote";
KeyCode3[KeyCode3["OEM_8"] = 96] = "OEM_8";
KeyCode3[KeyCode3["IntlBackslash"] = 97] = "IntlBackslash";
KeyCode3[KeyCode3["Numpad0"] = 98] = "Numpad0";
KeyCode3[KeyCode3["Numpad1"] = 99] = "Numpad1";
KeyCode3[KeyCode3["Numpad2"] = 100] = "Numpad2";
KeyCode3[KeyCode3["Numpad3"] = 101] = "Numpad3";
KeyCode3[KeyCode3["Numpad4"] = 102] = "Numpad4";
KeyCode3[KeyCode3["Numpad5"] = 103] = "Numpad5";
KeyCode3[KeyCode3["Numpad6"] = 104] = "Numpad6";
KeyCode3[KeyCode3["Numpad7"] = 105] = "Numpad7";
KeyCode3[KeyCode3["Numpad8"] = 106] = "Numpad8";
KeyCode3[KeyCode3["Numpad9"] = 107] = "Numpad9";
KeyCode3[KeyCode3["NumpadMultiply"] = 108] = "NumpadMultiply";
KeyCode3[KeyCode3["NumpadAdd"] = 109] = "NumpadAdd";
KeyCode3[KeyCode3["NUMPAD_SEPARATOR"] = 110] = "NUMPAD_SEPARATOR";
KeyCode3[KeyCode3["NumpadSubtract"] = 111] = "NumpadSubtract";
KeyCode3[KeyCode3["NumpadDecimal"] = 112] = "NumpadDecimal";
KeyCode3[KeyCode3["NumpadDivide"] = 113] = "NumpadDivide";
KeyCode3[KeyCode3["KEY_IN_COMPOSITION"] = 114] = "KEY_IN_COMPOSITION";
KeyCode3[KeyCode3["ABNT_C1"] = 115] = "ABNT_C1";
KeyCode3[KeyCode3["ABNT_C2"] = 116] = "ABNT_C2";
KeyCode3[KeyCode3["AudioVolumeMute"] = 117] = "AudioVolumeMute";
KeyCode3[KeyCode3["AudioVolumeUp"] = 118] = "AudioVolumeUp";
KeyCode3[KeyCode3["AudioVolumeDown"] = 119] = "AudioVolumeDown";
KeyCode3[KeyCode3["BrowserSearch"] = 120] = "BrowserSearch";
KeyCode3[KeyCode3["BrowserHome"] = 121] = "BrowserHome";
KeyCode3[KeyCode3["BrowserBack"] = 122] = "BrowserBack";
KeyCode3[KeyCode3["BrowserForward"] = 123] = "BrowserForward";
KeyCode3[KeyCode3["MediaTrackNext"] = 124] = "MediaTrackNext";
KeyCode3[KeyCode3["MediaTrackPrevious"] = 125] = "MediaTrackPrevious";
KeyCode3[KeyCode3["MediaStop"] = 126] = "MediaStop";
KeyCode3[KeyCode3["MediaPlayPause"] = 127] = "MediaPlayPause";
KeyCode3[KeyCode3["LaunchMediaPlayer"] = 128] = "LaunchMediaPlayer";
KeyCode3[KeyCode3["LaunchMail"] = 129] = "LaunchMail";
KeyCode3[KeyCode3["LaunchApp2"] = 130] = "LaunchApp2";
KeyCode3[KeyCode3["Clear"] = 131] = "Clear";
KeyCode3[KeyCode3["MAX_VALUE"] = 132] = "MAX_VALUE";
})(KeyCode || (KeyCode = {}));
(function(MarkerSeverity4) {
MarkerSeverity4[MarkerSeverity4["Hint"] = 1] = "Hint";
MarkerSeverity4[MarkerSeverity4["Info"] = 2] = "Info";
MarkerSeverity4[MarkerSeverity4["Warning"] = 4] = "Warning";
MarkerSeverity4[MarkerSeverity4["Error"] = 8] = "Error";
})(MarkerSeverity || (MarkerSeverity = {}));
(function(MarkerTag3) {
MarkerTag3[MarkerTag3["Unnecessary"] = 1] = "Unnecessary";
MarkerTag3[MarkerTag3["Deprecated"] = 2] = "Deprecated";
})(MarkerTag || (MarkerTag = {}));
(function(MinimapPosition2) {
MinimapPosition2[MinimapPosition2["Inline"] = 1] = "Inline";
MinimapPosition2[MinimapPosition2["Gutter"] = 2] = "Gutter";
})(MinimapPosition || (MinimapPosition = {}));
(function(MinimapSectionHeaderStyle2) {
MinimapSectionHeaderStyle2[MinimapSectionHeaderStyle2["Normal"] = 1] = "Normal";
MinimapSectionHeaderStyle2[MinimapSectionHeaderStyle2["Underlined"] = 2] = "Underlined";
})(MinimapSectionHeaderStyle || (MinimapSectionHeaderStyle = {}));
(function(MouseTargetType2) {
MouseTargetType2[MouseTargetType2["UNKNOWN"] = 0] = "UNKNOWN";
MouseTargetType2[MouseTargetType2["TEXTAREA"] = 1] = "TEXTAREA";
MouseTargetType2[MouseTargetType2["GUTTER_GLYPH_MARGIN"] = 2] = "GUTTER_GLYPH_MARGIN";
MouseTargetType2[MouseTargetType2["GUTTER_LINE_NUMBERS"] = 3] = "GUTTER_LINE_NUMBERS";
MouseTargetType2[MouseTargetType2["GUTTER_LINE_DECORATIONS"] = 4] = "GUTTER_LINE_DECORATIONS";
MouseTargetType2[MouseTargetType2["GUTTER_VIEW_ZONE"] = 5] = "GUTTER_VIEW_ZONE";
MouseTargetType2[MouseTargetType2["CONTENT_TEXT"] = 6] = "CONTENT_TEXT";
MouseTargetType2[MouseTargetType2["CONTENT_EMPTY"] = 7] = "CONTENT_EMPTY";
MouseTargetType2[MouseTargetType2["CONTENT_VIEW_ZONE"] = 8] = "CONTENT_VIEW_ZONE";
MouseTargetType2[MouseTargetType2["CONTENT_WIDGET"] = 9] = "CONTENT_WIDGET";
MouseTargetType2[MouseTargetType2["OVERVIEW_RULER"] = 10] = "OVERVIEW_RULER";
MouseTargetType2[MouseTargetType2["SCROLLBAR"] = 11] = "SCROLLBAR";
MouseTargetType2[MouseTargetType2["OVERLAY_WIDGET"] = 12] = "OVERLAY_WIDGET";
MouseTargetType2[MouseTargetType2["OUTSIDE_EDITOR"] = 13] = "OUTSIDE_EDITOR";
})(MouseTargetType || (MouseTargetType = {}));
(function(NewSymbolNameTag3) {
NewSymbolNameTag3[NewSymbolNameTag3["AIGenerated"] = 1] = "AIGenerated";
})(NewSymbolNameTag2 || (NewSymbolNameTag2 = {}));
(function(NewSymbolNameTriggerKind3) {
NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Invoke"] = 0] = "Invoke";
NewSymbolNameTriggerKind3[NewSymbolNameTriggerKind3["Automatic"] = 1] = "Automatic";
})(NewSymbolNameTriggerKind2 || (NewSymbolNameTriggerKind2 = {}));
(function(OverlayWidgetPositionPreference2) {
OverlayWidgetPositionPreference2[OverlayWidgetPositionPreference2["TOP_RIGHT_CORNER"] = 0] = "TOP_RIGHT_CORNER";
OverlayWidgetPositionPreference2[OverlayWidgetPositionPreference2["BOTTOM_RIGHT_CORNER"] = 1] = "BOTTOM_RIGHT_CORNER";
OverlayWidgetPositionPreference2[OverlayWidgetPositionPreference2["TOP_CENTER"] = 2] = "TOP_CENTER";
})(OverlayWidgetPositionPreference || (OverlayWidgetPositionPreference = {}));
(function(OverviewRulerLane3) {
OverviewRulerLane3[OverviewRulerLane3["Left"] = 1] = "Left";
OverviewRulerLane3[OverviewRulerLane3["Center"] = 2] = "Center";
OverviewRulerLane3[OverviewRulerLane3["Right"] = 4] = "Right";
OverviewRulerLane3[OverviewRulerLane3["Full"] = 7] = "Full";
})(OverviewRulerLane || (OverviewRulerLane = {}));
(function(PartialAcceptTriggerKind2) {
PartialAcceptTriggerKind2[PartialAcceptTriggerKind2["Word"] = 0] = "Word";
PartialAcceptTriggerKind2[PartialAcceptTriggerKind2["Line"] = 1] = "Line";
PartialAcceptTriggerKind2[PartialAcceptTriggerKind2["Suggest"] = 2] = "Suggest";
})(PartialAcceptTriggerKind || (PartialAcceptTriggerKind = {}));
(function(PositionAffinity2) {
PositionAffinity2[PositionAffinity2["Left"] = 0] = "Left";
PositionAffinity2[PositionAffinity2["Right"] = 1] = "Right";
PositionAffinity2[PositionAffinity2["None"] = 2] = "None";
PositionAffinity2[PositionAffinity2["LeftOfInjectedText"] = 3] = "LeftOfInjectedText";
PositionAffinity2[PositionAffinity2["RightOfInjectedText"] = 4] = "RightOfInjectedText";
})(PositionAffinity || (PositionAffinity = {}));
(function(RenderLineNumbersType2) {
RenderLineNumbersType2[RenderLineNumbersType2["Off"] = 0] = "Off";
RenderLineNumbersType2[RenderLineNumbersType2["On"] = 1] = "On";
RenderLineNumbersType2[RenderLineNumbersType2["Relative"] = 2] = "Relative";
RenderLineNumbersType2[RenderLineNumbersType2["Interval"] = 3] = "Interval";
RenderLineNumbersType2[RenderLineNumbersType2["Custom"] = 4] = "Custom";
})(RenderLineNumbersType || (RenderLineNumbersType = {}));
(function(RenderMinimap2) {
RenderMinimap2[RenderMinimap2["None"] = 0] = "None";
RenderMinimap2[RenderMinimap2["Text"] = 1] = "Text";
RenderMinimap2[RenderMinimap2["Blocks"] = 2] = "Blocks";
})(RenderMinimap || (RenderMinimap = {}));
(function(ScrollType2) {
ScrollType2[ScrollType2["Smooth"] = 0] = "Smooth";
ScrollType2[ScrollType2["Immediate"] = 1] = "Immediate";
})(ScrollType || (ScrollType = {}));
(function(ScrollbarVisibility2) {
ScrollbarVisibility2[ScrollbarVisibility2["Auto"] = 1] = "Auto";
ScrollbarVisibility2[ScrollbarVisibility2["Hidden"] = 2] = "Hidden";
ScrollbarVisibility2[ScrollbarVisibility2["Visible"] = 3] = "Visible";
})(ScrollbarVisibility || (ScrollbarVisibility = {}));
(function(SelectionDirection3) {
SelectionDirection3[SelectionDirection3["LTR"] = 0] = "LTR";
SelectionDirection3[SelectionDirection3["RTL"] = 1] = "RTL";
})(SelectionDirection || (SelectionDirection = {}));
(function(ShowLightbulbIconMode3) {
ShowLightbulbIconMode3["Off"] = "off";
ShowLightbulbIconMode3["OnCode"] = "onCode";
ShowLightbulbIconMode3["On"] = "on";
})(ShowLightbulbIconMode2 || (ShowLightbulbIconMode2 = {}));
(function(SignatureHelpTriggerKind3) {
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["Invoke"] = 1] = "Invoke";
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["TriggerCharacter"] = 2] = "TriggerCharacter";
SignatureHelpTriggerKind3[SignatureHelpTriggerKind3["ContentChange"] = 3] = "ContentChange";
})(SignatureHelpTriggerKind2 || (SignatureHelpTriggerKind2 = {}));
(function(SymbolKind8) {
SymbolKind8[SymbolKind8["File"] = 0] = "File";
SymbolKind8[SymbolKind8["Module"] = 1] = "Module";
SymbolKind8[SymbolKind8["Namespace"] = 2] = "Namespace";
SymbolKind8[SymbolKind8["Package"] = 3] = "Package";
SymbolKind8[SymbolKind8["Class"] = 4] = "Class";
SymbolKind8[SymbolKind8["Method"] = 5] = "Method";
SymbolKind8[SymbolKind8["Property"] = 6] = "Property";
SymbolKind8[SymbolKind8["Field"] = 7] = "Field";
SymbolKind8[SymbolKind8["Constructor"] = 8] = "Constructor";
SymbolKind8[SymbolKind8["Enum"] = 9] = "Enum";
SymbolKind8[SymbolKind8["Interface"] = 10] = "Interface";
SymbolKind8[SymbolKind8["Function"] = 11] = "Function";
SymbolKind8[SymbolKind8["Variable"] = 12] = "Variable";
SymbolKind8[SymbolKind8["Constant"] = 13] = "Constant";
SymbolKind8[SymbolKind8["String"] = 14] = "String";
SymbolKind8[SymbolKind8["Number"] = 15] = "Number";
SymbolKind8[SymbolKind8["Boolean"] = 16] = "Boolean";
SymbolKind8[SymbolKind8["Array"] = 17] = "Array";
SymbolKind8[SymbolKind8["Object"] = 18] = "Object";
SymbolKind8[SymbolKind8["Key"] = 19] = "Key";
SymbolKind8[SymbolKind8["Null"] = 20] = "Null";
SymbolKind8[SymbolKind8["EnumMember"] = 21] = "EnumMember";
SymbolKind8[SymbolKind8["Struct"] = 22] = "Struct";
SymbolKind8[SymbolKind8["Event"] = 23] = "Event";
SymbolKind8[SymbolKind8["Operator"] = 24] = "Operator";
SymbolKind8[SymbolKind8["TypeParameter"] = 25] = "TypeParameter";
})(SymbolKind || (SymbolKind = {}));
(function(SymbolTag8) {
SymbolTag8[SymbolTag8["Deprecated"] = 1] = "Deprecated";
})(SymbolTag || (SymbolTag = {}));
(function(TextEditorCursorBlinkingStyle2) {
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Hidden"] = 0] = "Hidden";
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Blink"] = 1] = "Blink";
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Smooth"] = 2] = "Smooth";
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Phase"] = 3] = "Phase";
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Expand"] = 4] = "Expand";
TextEditorCursorBlinkingStyle2[TextEditorCursorBlinkingStyle2["Solid"] = 5] = "Solid";
})(TextEditorCursorBlinkingStyle || (TextEditorCursorBlinkingStyle = {}));
(function(TextEditorCursorStyle3) {
TextEditorCursorStyle3[TextEditorCursorStyle3["Line"] = 1] = "Line";
TextEditorCursorStyle3[TextEditorCursorStyle3["Block"] = 2] = "Block";
TextEditorCursorStyle3[TextEditorCursorStyle3["Underline"] = 3] = "Underline";
TextEditorCursorStyle3[TextEditorCursorStyle3["LineThin"] = 4] = "LineThin";
TextEditorCursorStyle3[TextEditorCursorStyle3["BlockOutline"] = 5] = "BlockOutline";
TextEditorCursorStyle3[TextEditorCursorStyle3["UnderlineThin"] = 6] = "UnderlineThin";
})(TextEditorCursorStyle2 || (TextEditorCursorStyle2 = {}));
(function(TrackedRangeStickiness2) {
TrackedRangeStickiness2[TrackedRangeStickiness2["AlwaysGrowsWhenTypingAtEdges"] = 0] = "AlwaysGrowsWhenTypingAtEdges";
TrackedRangeStickiness2[TrackedRangeStickiness2["NeverGrowsWhenTypingAtEdges"] = 1] = "NeverGrowsWhenTypingAtEdges";
TrackedRangeStickiness2[TrackedRangeStickiness2["GrowsOnlyWhenTypingBefore"] = 2] = "GrowsOnlyWhenTypingBefore";
TrackedRangeStickiness2[TrackedRangeStickiness2["GrowsOnlyWhenTypingAfter"] = 3] = "GrowsOnlyWhenTypingAfter";
})(TrackedRangeStickiness || (TrackedRangeStickiness = {}));
(function(WrappingIndent2) {
WrappingIndent2[WrappingIndent2["None"] = 0] = "None";
WrappingIndent2[WrappingIndent2["Same"] = 1] = "Same";
WrappingIndent2[WrappingIndent2["Indent"] = 2] = "Indent";
WrappingIndent2[WrappingIndent2["DeepIndent"] = 3] = "DeepIndent";
})(WrappingIndent || (WrappingIndent = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/editorBaseApi.js
function createMonacoBaseAPI() {
return {
editor: void 0,
// undefined override expected here
languages: void 0,
// undefined override expected here
CancellationTokenSource,
Emitter,
KeyCode,
KeyMod,
Position,
Range,
Selection,
SelectionDirection,
MarkerSeverity,
MarkerTag,
Uri: URI,
Token
};
}
var KeyMod;
var init_editorBaseApi = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/editorBaseApi.js"() {
init_cancellation();
init_event();
init_keyCodes();
init_uri();
init_position();
init_range();
init_selection();
init_languages();
init_standaloneEnums();
KeyMod = class {
static chord(firstPart, secondPart) {
return KeyChord(firstPart, secondPart);
}
};
KeyMod.CtrlCmd = 2048;
KeyMod.Shift = 1024;
KeyMod.Alt = 512;
KeyMod.WinCtrl = 256;
}
});
// node_modules/monaco-editor/esm/vs/base/browser/window.js
function ensureCodeWindow(targetWindow, fallbackWindowId) {
const codeWindow = targetWindow;
if (typeof codeWindow.vscodeWindowId !== "number") {
Object.defineProperty(codeWindow, "vscodeWindowId", {
get: () => fallbackWindowId
});
}
}
var mainWindow;
var init_window = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/window.js"() {
mainWindow = window;
}
});
// node_modules/monaco-editor/esm/vs/base/common/cache.js
function identity(t4) {
return t4;
}
var LRUCachedFunction, CachedFunction;
var init_cache = __esm({
"node_modules/monaco-editor/esm/vs/base/common/cache.js"() {
LRUCachedFunction = class {
constructor(arg1, arg2) {
this.lastCache = void 0;
this.lastArgKey = void 0;
if (typeof arg1 === "function") {
this._fn = arg1;
this._computeKey = identity;
} else {
this._fn = arg2;
this._computeKey = arg1.getCacheKey;
}
}
get(arg) {
const key = this._computeKey(arg);
if (this.lastArgKey !== key) {
this.lastArgKey = key;
this.lastCache = this._fn(arg);
}
return this.lastCache;
}
};
CachedFunction = class {
get cachedValues() {
return this._map;
}
constructor(arg1, arg2) {
this._map = /* @__PURE__ */ new Map();
this._map2 = /* @__PURE__ */ new Map();
if (typeof arg1 === "function") {
this._fn = arg1;
this._computeKey = identity;
} else {
this._fn = arg2;
this._computeKey = arg1.getCacheKey;
}
}
get(arg) {
const key = this._computeKey(arg);
if (this._map2.has(key)) {
return this._map2.get(key);
}
const value = this._fn(arg);
this._map.set(arg, value);
this._map2.set(key, value);
return value;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/lazy.js
var Lazy;
var init_lazy = __esm({
"node_modules/monaco-editor/esm/vs/base/common/lazy.js"() {
Lazy = class {
constructor(executor) {
this.executor = executor;
this._didRun = false;
}
/**
* Get the wrapped value.
*
* This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only
* resolved once. `getValue` will re-throw exceptions that are hit while resolving the value
*/
get value() {
if (!this._didRun) {
try {
this._value = this.executor();
} catch (err) {
this._error = err;
} finally {
this._didRun = true;
}
}
if (this._error) {
throw this._error;
}
return this._value;
}
/**
* Get the wrapped value without forcing evaluation.
*/
get rawValue() {
return this._value;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/strings.js
function isFalsyOrWhitespace(str) {
if (!str || typeof str !== "string") {
return true;
}
return str.trim().length === 0;
}
function format(value, ...args) {
if (args.length === 0) {
return value;
}
return value.replace(_formatRegexp, function(match2, group) {
const idx = parseInt(group, 10);
return isNaN(idx) || idx < 0 || idx >= args.length ? match2 : args[idx];
});
}
function htmlAttributeEncodeValue(value) {
return value.replace(/[<>"'&]/g, (ch) => {
switch (ch) {
case "<":
return "<";
case ">":
return ">";
case '"':
return """;
case "'":
return "'";
case "&":
return "&";
}
return ch;
});
}
function escape(html2) {
return html2.replace(/[<>&]/g, function(match2) {
switch (match2) {
case "<":
return "<";
case ">":
return ">";
case "&":
return "&";
default:
return match2;
}
});
}
function escapeRegExpCharacters(value) {
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, "\\$&");
}
function trim(haystack, needle = " ") {
const trimmed = ltrim(haystack, needle);
return rtrim(trimmed, needle);
}
function ltrim(haystack, needle) {
if (!haystack || !needle) {
return haystack;
}
const needleLen = needle.length;
if (needleLen === 0 || haystack.length === 0) {
return haystack;
}
let offset = 0;
while (haystack.indexOf(needle, offset) === offset) {
offset = offset + needleLen;
}
return haystack.substring(offset);
}
function rtrim(haystack, needle) {
if (!haystack || !needle) {
return haystack;
}
const needleLen = needle.length, haystackLen = haystack.length;
if (needleLen === 0 || haystackLen === 0) {
return haystack;
}
let offset = haystackLen, idx = -1;
while (true) {
idx = haystack.lastIndexOf(needle, offset - 1);
if (idx === -1 || idx + needleLen !== offset) {
break;
}
if (idx === 0) {
return "";
}
offset = idx;
}
return haystack.substring(0, offset);
}
function convertSimple2RegExpPattern(pattern) {
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&").replace(/[\*]/g, ".*");
}
function stripWildcards(pattern) {
return pattern.replace(/\*/g, "");
}
function createRegExp(searchString, isRegex, options2 = {}) {
if (!searchString) {
throw new Error("Cannot create regex from empty string");
}
if (!isRegex) {
searchString = escapeRegExpCharacters(searchString);
}
if (options2.wholeWord) {
if (!/\B/.test(searchString.charAt(0))) {
searchString = "\\b" + searchString;
}
if (!/\B/.test(searchString.charAt(searchString.length - 1))) {
searchString = searchString + "\\b";
}
}
let modifiers = "";
if (options2.global) {
modifiers += "g";
}
if (!options2.matchCase) {
modifiers += "i";
}
if (options2.multiline) {
modifiers += "m";
}
if (options2.unicode) {
modifiers += "u";
}
return new RegExp(searchString, modifiers);
}
function regExpLeadsToEndlessLoop(regexp) {
if (regexp.source === "^" || regexp.source === "^$" || regexp.source === "$" || regexp.source === "^\\s*$") {
return false;
}
const match2 = regexp.exec("");
return !!(match2 && regexp.lastIndex === 0);
}
function splitLines(str) {
return str.split(/\r\n|\r|\n/);
}
function splitLinesIncludeSeparators(str) {
var _b4;
const linesWithSeparators = [];
const splitLinesAndSeparators = str.split(/(\r\n|\r|\n)/);
for (let i = 0; i < Math.ceil(splitLinesAndSeparators.length / 2); i++) {
linesWithSeparators.push(splitLinesAndSeparators[2 * i] + ((_b4 = splitLinesAndSeparators[2 * i + 1]) !== null && _b4 !== void 0 ? _b4 : ""));
}
return linesWithSeparators;
}
function firstNonWhitespaceIndex(str) {
for (let i = 0, len = str.length; i < len; i++) {
const chCode = str.charCodeAt(i);
if (chCode !== 32 && chCode !== 9) {
return i;
}
}
return -1;
}
function getLeadingWhitespace(str, start = 0, end = str.length) {
for (let i = start; i < end; i++) {
const chCode = str.charCodeAt(i);
if (chCode !== 32 && chCode !== 9) {
return str.substring(start, i);
}
}
return str.substring(start, end);
}
function lastNonWhitespaceIndex(str, startIndex = str.length - 1) {
for (let i = startIndex; i >= 0; i--) {
const chCode = str.charCodeAt(i);
if (chCode !== 32 && chCode !== 9) {
return i;
}
}
return -1;
}
function compare(a3, b) {
if (a3 < b) {
return -1;
} else if (a3 > b) {
return 1;
} else {
return 0;
}
}
function compareSubstring(a3, b, aStart = 0, aEnd = a3.length, bStart = 0, bEnd = b.length) {
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
const codeA = a3.charCodeAt(aStart);
const codeB = b.charCodeAt(bStart);
if (codeA < codeB) {
return -1;
} else if (codeA > codeB) {
return 1;
}
}
const aLen = aEnd - aStart;
const bLen = bEnd - bStart;
if (aLen < bLen) {
return -1;
} else if (aLen > bLen) {
return 1;
}
return 0;
}
function compareIgnoreCase(a3, b) {
return compareSubstringIgnoreCase(a3, b, 0, a3.length, 0, b.length);
}
function compareSubstringIgnoreCase(a3, b, aStart = 0, aEnd = a3.length, bStart = 0, bEnd = b.length) {
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
let codeA = a3.charCodeAt(aStart);
let codeB = b.charCodeAt(bStart);
if (codeA === codeB) {
continue;
}
if (codeA >= 128 || codeB >= 128) {
return compareSubstring(a3.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);
}
if (isLowerAsciiLetter(codeA)) {
codeA -= 32;
}
if (isLowerAsciiLetter(codeB)) {
codeB -= 32;
}
const diff = codeA - codeB;
if (diff === 0) {
continue;
}
return diff;
}
const aLen = aEnd - aStart;
const bLen = bEnd - bStart;
if (aLen < bLen) {
return -1;
} else if (aLen > bLen) {
return 1;
}
return 0;
}
function isAsciiDigit(code) {
return code >= 48 && code <= 57;
}
function isLowerAsciiLetter(code) {
return code >= 97 && code <= 122;
}
function isUpperAsciiLetter(code) {
return code >= 65 && code <= 90;
}
function equalsIgnoreCase(a3, b) {
return a3.length === b.length && compareSubstringIgnoreCase(a3, b) === 0;
}
function startsWithIgnoreCase(str, candidate) {
const candidateLength = candidate.length;
if (candidate.length > str.length) {
return false;
}
return compareSubstringIgnoreCase(str, candidate, 0, candidateLength) === 0;
}
function commonPrefixLength(a3, b) {
const len = Math.min(a3.length, b.length);
let i;
for (i = 0; i < len; i++) {
if (a3.charCodeAt(i) !== b.charCodeAt(i)) {
return i;
}
}
return len;
}
function commonSuffixLength(a3, b) {
const len = Math.min(a3.length, b.length);
let i;
const aLastIndex = a3.length - 1;
const bLastIndex = b.length - 1;
for (i = 0; i < len; i++) {
if (a3.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {
return i;
}
}
return len;
}
function isHighSurrogate(charCode) {
return 55296 <= charCode && charCode <= 56319;
}
function isLowSurrogate(charCode) {
return 56320 <= charCode && charCode <= 57343;
}
function computeCodePoint(highSurrogate, lowSurrogate) {
return (highSurrogate - 55296 << 10) + (lowSurrogate - 56320) + 65536;
}
function getNextCodePoint(str, len, offset) {
const charCode = str.charCodeAt(offset);
if (isHighSurrogate(charCode) && offset + 1 < len) {
const nextCharCode = str.charCodeAt(offset + 1);
if (isLowSurrogate(nextCharCode)) {
return computeCodePoint(charCode, nextCharCode);
}
}
return charCode;
}
function getPrevCodePoint(str, offset) {
const charCode = str.charCodeAt(offset - 1);
if (isLowSurrogate(charCode) && offset > 1) {
const prevCharCode = str.charCodeAt(offset - 2);
if (isHighSurrogate(prevCharCode)) {
return computeCodePoint(prevCharCode, charCode);
}
}
return charCode;
}
function nextCharLength(str, initialOffset) {
const iterator = new GraphemeIterator(str, initialOffset);
return iterator.nextGraphemeLength();
}
function prevCharLength(str, initialOffset) {
const iterator = new GraphemeIterator(str, initialOffset);
return iterator.prevGraphemeLength();
}
function getCharContainingOffset(str, offset) {
if (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) {
offset--;
}
const endOffset = offset + nextCharLength(str, offset);
const startOffset = endOffset - prevCharLength(str, endOffset);
return [startOffset, endOffset];
}
function makeContainsRtl() {
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 containsRTL(str) {
if (!CONTAINS_RTL) {
CONTAINS_RTL = makeContainsRtl();
}
return CONTAINS_RTL.test(str);
}
function isBasicASCII(str) {
return IS_BASIC_ASCII.test(str);
}
function containsUnusualLineTerminators(str) {
return UNUSUAL_LINE_TERMINATORS.test(str);
}
function isFullWidthCharacter(charCode) {
return charCode >= 11904 && charCode <= 55215 || charCode >= 63744 && charCode <= 64255 || charCode >= 65281 && charCode <= 65374;
}
function isEmojiImprecise(x) {
return x >= 127462 && x <= 127487 || x === 8986 || x === 8987 || x === 9200 || x === 9203 || x >= 9728 && x <= 10175 || x === 11088 || x === 11093 || x >= 127744 && x <= 128591 || x >= 128640 && x <= 128764 || x >= 128992 && x <= 129008 || x >= 129280 && x <= 129535 || x >= 129648 && x <= 129782;
}
function startsWithUTF8BOM(str) {
return !!(str && str.length > 0 && str.charCodeAt(0) === 65279);
}
function containsUppercaseCharacter(target, ignoreEscapedChars = false) {
if (!target) {
return false;
}
if (ignoreEscapedChars) {
target = target.replace(/\\./g, "");
}
return target.toLowerCase() !== target;
}
function singleLetterHash(n) {
const LETTERS_CNT = 90 - 65 + 1;
n = n % (2 * LETTERS_CNT);
if (n < LETTERS_CNT) {
return String.fromCharCode(97 + n);
}
return String.fromCharCode(65 + n - LETTERS_CNT);
}
function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {
if (breakTypeA === 0) {
return breakTypeB !== 5 && breakTypeB !== 7;
}
if (breakTypeA === 2) {
if (breakTypeB === 3) {
return false;
}
}
if (breakTypeA === 4 || breakTypeA === 2 || breakTypeA === 3) {
return true;
}
if (breakTypeB === 4 || breakTypeB === 2 || breakTypeB === 3) {
return true;
}
if (breakTypeA === 8) {
if (breakTypeB === 8 || breakTypeB === 9 || breakTypeB === 11 || breakTypeB === 12) {
return false;
}
}
if (breakTypeA === 11 || breakTypeA === 9) {
if (breakTypeB === 9 || breakTypeB === 10) {
return false;
}
}
if (breakTypeA === 12 || breakTypeA === 10) {
if (breakTypeB === 10) {
return false;
}
}
if (breakTypeB === 5 || breakTypeB === 13) {
return false;
}
if (breakTypeB === 7) {
return false;
}
if (breakTypeA === 1) {
return false;
}
if (breakTypeA === 13 && breakTypeB === 14) {
return false;
}
if (breakTypeA === 6 && breakTypeB === 6) {
return false;
}
return true;
}
function getGraphemeBreakRawData() {
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 getLeftDeleteOffset(offset, str) {
if (offset === 0) {
return 0;
}
const emojiOffset = getOffsetBeforeLastEmojiComponent(offset, str);
if (emojiOffset !== void 0) {
return emojiOffset;
}
const iterator = new CodePointIterator(str, offset);
iterator.prevCodePoint();
return iterator.offset;
}
function getOffsetBeforeLastEmojiComponent(initialOffset, str) {
const iterator = new CodePointIterator(str, initialOffset);
let codePoint = iterator.prevCodePoint();
while (isEmojiModifier(codePoint) || codePoint === 65039 || codePoint === 8419) {
if (iterator.offset === 0) {
return void 0;
}
codePoint = iterator.prevCodePoint();
}
if (!isEmojiImprecise(codePoint)) {
return void 0;
}
let resultOffset = iterator.offset;
if (resultOffset > 0) {
const optionalZwjCodePoint = iterator.prevCodePoint();
if (optionalZwjCodePoint === 8205) {
resultOffset = iterator.offset;
}
}
return resultOffset;
}
function isEmojiModifier(codePoint) {
return 127995 <= codePoint && codePoint <= 127999;
}
var _a2, _formatRegexp, CodePointIterator, GraphemeIterator, CONTAINS_RTL, IS_BASIC_ASCII, UNUSUAL_LINE_TERMINATORS, UTF8_BOM_CHARACTER, GraphemeBreakTree, noBreakWhitespace, AmbiguousCharacters, InvisibleCharacters;
var init_strings = __esm({
"node_modules/monaco-editor/esm/vs/base/common/strings.js"() {
init_cache();
init_lazy();
_formatRegexp = /{(\d+)}/g;
CodePointIterator = class {
get offset() {
return this._offset;
}
constructor(str, offset = 0) {
this._str = str;
this._len = str.length;
this._offset = offset;
}
setOffset(offset) {
this._offset = offset;
}
prevCodePoint() {
const codePoint = getPrevCodePoint(this._str, this._offset);
this._offset -= codePoint >= 65536 ? 2 : 1;
return codePoint;
}
nextCodePoint() {
const codePoint = getNextCodePoint(this._str, this._len, this._offset);
this._offset += codePoint >= 65536 ? 2 : 1;
return codePoint;
}
eol() {
return this._offset >= this._len;
}
};
GraphemeIterator = class {
get offset() {
return this._iterator.offset;
}
constructor(str, offset = 0) {
this._iterator = new CodePointIterator(str, offset);
}
nextGraphemeLength() {
const graphemeBreakTree = GraphemeBreakTree.getInstance();
const iterator = this._iterator;
const initialOffset = iterator.offset;
let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());
while (!iterator.eol()) {
const offset = iterator.offset;
const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.nextCodePoint());
if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {
iterator.setOffset(offset);
break;
}
graphemeBreakType = nextGraphemeBreakType;
}
return iterator.offset - initialOffset;
}
prevGraphemeLength() {
const graphemeBreakTree = GraphemeBreakTree.getInstance();
const iterator = this._iterator;
const initialOffset = iterator.offset;
let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());
while (iterator.offset > 0) {
const offset = iterator.offset;
const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(iterator.prevCodePoint());
if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {
iterator.setOffset(offset);
break;
}
graphemeBreakType = prevGraphemeBreakType;
}
return initialOffset - iterator.offset;
}
eol() {
return this._iterator.eol();
}
};
CONTAINS_RTL = void 0;
IS_BASIC_ASCII = /^[\t\n\r\x20-\x7E]*$/;
UNUSUAL_LINE_TERMINATORS = /[\u2028\u2029]/;
UTF8_BOM_CHARACTER = String.fromCharCode(
65279
/* CharCode.UTF8_BOM */
);
GraphemeBreakTree = class _GraphemeBreakTree {
static getInstance() {
if (!_GraphemeBreakTree._INSTANCE) {
_GraphemeBreakTree._INSTANCE = new _GraphemeBreakTree();
}
return _GraphemeBreakTree._INSTANCE;
}
constructor() {
this._data = getGraphemeBreakRawData();
}
getGraphemeBreakType(codePoint) {
if (codePoint < 32) {
if (codePoint === 10) {
return 3;
}
if (codePoint === 13) {
return 2;
}
return 4;
}
if (codePoint < 127) {
return 0;
}
const data = this._data;
const nodeCount = data.length / 3;
let nodeIndex = 1;
while (nodeIndex <= nodeCount) {
if (codePoint < data[3 * nodeIndex]) {
nodeIndex = 2 * nodeIndex;
} else if (codePoint > data[3 * nodeIndex + 1]) {
nodeIndex = 2 * nodeIndex + 1;
} else {
return data[3 * nodeIndex + 2];
}
}
return 0;
}
};
GraphemeBreakTree._INSTANCE = null;
noBreakWhitespace = "\xA0";
AmbiguousCharacters = class {
static getInstance(locales) {
return _a2.cache.get(Array.from(locales));
}
static getLocales() {
return _a2._locales.value;
}
constructor(confusableDictionary) {
this.confusableDictionary = confusableDictionary;
}
isAmbiguous(codePoint) {
return this.confusableDictionary.has(codePoint);
}
/**
* Returns the non basic ASCII code point that the given code point can be confused,
* or undefined if such code point does note exist.
*/
getPrimaryConfusable(codePoint) {
return this.confusableDictionary.get(codePoint);
}
getConfusableCodePoints() {
return new Set(this.confusableDictionary.keys());
}
};
_a2 = AmbiguousCharacters;
AmbiguousCharacters.ambiguousCharacterData = new Lazy(() => {
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]}');
});
AmbiguousCharacters.cache = new LRUCachedFunction({ getCacheKey: JSON.stringify }, (locales) => {
function arrayToMap(arr) {
const result = /* @__PURE__ */ new Map();
for (let i = 0; i < arr.length; i += 2) {
result.set(arr[i], arr[i + 1]);
}
return result;
}
function mergeMaps(map1, map2) {
const result = new Map(map1);
for (const [key, value] of map2) {
result.set(key, value);
}
return result;
}
function intersectMaps(map1, map2) {
if (!map1) {
return map2;
}
const result = /* @__PURE__ */ new Map();
for (const [key, value] of map1) {
if (map2.has(key)) {
result.set(key, value);
}
}
return result;
}
const data = _a2.ambiguousCharacterData.value;
let filteredLocales = locales.filter((l) => !l.startsWith("_") && l in data);
if (filteredLocales.length === 0) {
filteredLocales = ["_default"];
}
let languageSpecificMap = void 0;
for (const locale of filteredLocales) {
const map2 = arrayToMap(data[locale]);
languageSpecificMap = intersectMaps(languageSpecificMap, map2);
}
const commonMap = arrayToMap(data["_common"]);
const map = mergeMaps(commonMap, languageSpecificMap);
return new _a2(map);
});
AmbiguousCharacters._locales = new Lazy(() => Object.keys(_a2.ambiguousCharacterData.value).filter((k) => !k.startsWith("_")));
InvisibleCharacters = class _InvisibleCharacters {
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() {
if (!this._data) {
this._data = new Set(_InvisibleCharacters.getRawData());
}
return this._data;
}
static isInvisibleCharacter(codePoint) {
return _InvisibleCharacters.getData().has(codePoint);
}
static get codePoints() {
return _InvisibleCharacters.getData();
}
};
InvisibleCharacters._data = void 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standalone-tokens.css
var init_standalone_tokens = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standalone-tokens.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/browser.js
function addMatchMediaChangeListener(targetWindow, query, callback) {
if (typeof query === "string") {
query = targetWindow.matchMedia(query);
}
query.addEventListener("change", callback);
}
function getZoomFactor(targetWindow) {
return WindowManager.INSTANCE.getZoomFactor(targetWindow);
}
function isStandalone() {
return standalone;
}
var WindowManager, userAgent2, isFirefox2, isWebKit, isChrome2, isSafari2, isWebkitWebView, isElectron, isAndroid2, standalone;
var init_browser = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/browser.js"() {
init_window();
WindowManager = class {
constructor() {
this.mapWindowIdToZoomFactor = /* @__PURE__ */ new Map();
}
getZoomFactor(targetWindow) {
var _a10;
return (_a10 = this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow))) !== null && _a10 !== void 0 ? _a10 : 1;
}
getWindowId(targetWindow) {
return targetWindow.vscodeWindowId;
}
};
WindowManager.INSTANCE = new WindowManager();
userAgent2 = navigator.userAgent;
isFirefox2 = userAgent2.indexOf("Firefox") >= 0;
isWebKit = userAgent2.indexOf("AppleWebKit") >= 0;
isChrome2 = userAgent2.indexOf("Chrome") >= 0;
isSafari2 = !isChrome2 && userAgent2.indexOf("Safari") >= 0;
isWebkitWebView = !isChrome2 && !isSafari2 && isWebKit;
isElectron = userAgent2.indexOf("Electron/") >= 0;
isAndroid2 = userAgent2.indexOf("Android") >= 0;
standalone = false;
if (typeof mainWindow.matchMedia === "function") {
const standaloneMatchMedia = mainWindow.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)");
const fullScreenMatchMedia = mainWindow.matchMedia("(display-mode: fullscreen)");
standalone = standaloneMatchMedia.matches;
addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches: matches2 }) => {
if (standalone && fullScreenMatchMedia.matches) {
return;
}
standalone = matches2;
});
}
}
});
// node_modules/monaco-editor/esm/vs/base/browser/canIUse.js
var BrowserFeatures;
var init_canIUse = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/canIUse.js"() {
init_browser();
init_window();
init_platform();
BrowserFeatures = {
clipboard: {
writeText: isNative || document.queryCommandSupported && document.queryCommandSupported("copy") || !!(navigator && navigator.clipboard && navigator.clipboard.writeText),
readText: isNative || !!(navigator && navigator.clipboard && navigator.clipboard.readText)
},
keyboard: (() => {
if (isNative || isStandalone()) {
return 0;
}
if (navigator.keyboard || isSafari2) {
return 1;
}
return 2;
})(),
// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
touch: "ontouchstart" in mainWindow || navigator.maxTouchPoints > 0,
pointerEvents: mainWindow.PointerEvent && ("ontouchstart" in mainWindow || navigator.maxTouchPoints > 0)
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/keybindings.js
function decodeKeybinding(keybinding, OS2) {
if (typeof keybinding === "number") {
if (keybinding === 0) {
return null;
}
const firstChord = (keybinding & 65535) >>> 0;
const secondChord = (keybinding & 4294901760) >>> 16;
if (secondChord !== 0) {
return new Keybinding([
createSimpleKeybinding(firstChord, OS2),
createSimpleKeybinding(secondChord, OS2)
]);
}
return new Keybinding([createSimpleKeybinding(firstChord, OS2)]);
} else {
const chords = [];
for (let i = 0; i < keybinding.length; i++) {
chords.push(createSimpleKeybinding(keybinding[i], OS2));
}
return new Keybinding(chords);
}
}
function createSimpleKeybinding(keybinding, OS2) {
const ctrlCmd = keybinding & 2048 ? true : false;
const winCtrl = keybinding & 256 ? true : false;
const ctrlKey = OS2 === 2 ? winCtrl : ctrlCmd;
const shiftKey = keybinding & 1024 ? true : false;
const altKey = keybinding & 512 ? true : false;
const metaKey = OS2 === 2 ? ctrlCmd : winCtrl;
const keyCode = keybinding & 255;
return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);
}
var KeyCodeChord, Keybinding, ResolvedChord, ResolvedKeybinding;
var init_keybindings = __esm({
"node_modules/monaco-editor/esm/vs/base/common/keybindings.js"() {
init_errors();
KeyCodeChord = class _KeyCodeChord {
constructor(ctrlKey, shiftKey, altKey, metaKey, keyCode) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyCode = keyCode;
}
equals(other) {
return other instanceof _KeyCodeChord && this.ctrlKey === other.ctrlKey && this.shiftKey === other.shiftKey && this.altKey === other.altKey && this.metaKey === other.metaKey && this.keyCode === other.keyCode;
}
isModifierKey() {
return this.keyCode === 0 || this.keyCode === 5 || this.keyCode === 57 || this.keyCode === 6 || this.keyCode === 4;
}
/**
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
*/
isDuplicateModifierCase() {
return this.ctrlKey && this.keyCode === 5 || this.shiftKey && this.keyCode === 4 || this.altKey && this.keyCode === 6 || this.metaKey && this.keyCode === 57;
}
};
Keybinding = class {
constructor(chords) {
if (chords.length === 0) {
throw illegalArgument(`chords`);
}
this.chords = chords;
}
};
ResolvedChord = class {
constructor(ctrlKey, shiftKey, altKey, metaKey, keyLabel, keyAriaLabel) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyLabel = keyLabel;
this.keyAriaLabel = keyAriaLabel;
}
};
ResolvedKeybinding = class {
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js
function extractKeyCode(e) {
if (e.charCode) {
const char = String.fromCharCode(e.charCode).toUpperCase();
return KeyCodeUtils.fromString(char);
}
const keyCode = e.keyCode;
if (keyCode === 3) {
return 7;
} else if (isFirefox2) {
switch (keyCode) {
case 59:
return 85;
case 60:
if (isLinux) {
return 97;
}
break;
case 61:
return 86;
// based on: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#numpad_keys
case 107:
return 109;
case 109:
return 111;
case 173:
return 88;
case 224:
if (isMacintosh) {
return 57;
}
break;
}
} else if (isWebKit) {
if (isMacintosh && keyCode === 93) {
return 57;
} else if (!isMacintosh && keyCode === 92) {
return 57;
}
}
return EVENT_KEY_CODE_MAP[keyCode] || 0;
}
var ctrlKeyMod, altKeyMod, shiftKeyMod, metaKeyMod, StandardKeyboardEvent;
var init_keyboardEvent = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js"() {
init_browser();
init_keyCodes();
init_keybindings();
init_platform();
ctrlKeyMod = isMacintosh ? 256 : 2048;
altKeyMod = 512;
shiftKeyMod = 1024;
metaKeyMod = isMacintosh ? 2048 : 256;
StandardKeyboardEvent = class {
constructor(source) {
var _a10;
this._standardKeyboardEventBrand = true;
const e = source;
this.browserEvent = e;
this.target = e.target;
this.ctrlKey = e.ctrlKey;
this.shiftKey = e.shiftKey;
this.altKey = e.altKey;
this.metaKey = e.metaKey;
this.altGraphKey = (_a10 = e.getModifierState) === null || _a10 === void 0 ? void 0 : _a10.call(e, "AltGraph");
this.keyCode = extractKeyCode(e);
this.code = e.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() {
if (this.browserEvent && this.browserEvent.preventDefault) {
this.browserEvent.preventDefault();
}
}
stopPropagation() {
if (this.browserEvent && this.browserEvent.stopPropagation) {
this.browserEvent.stopPropagation();
}
}
toKeyCodeChord() {
return this._asKeyCodeChord;
}
equals(other) {
return this._asKeybinding === other;
}
_computeKeybinding() {
let key = 0;
if (this.keyCode !== 5 && this.keyCode !== 4 && this.keyCode !== 6 && this.keyCode !== 57) {
key = this.keyCode;
}
let result = 0;
if (this.ctrlKey) {
result |= ctrlKeyMod;
}
if (this.altKey) {
result |= altKeyMod;
}
if (this.shiftKey) {
result |= shiftKeyMod;
}
if (this.metaKey) {
result |= metaKeyMod;
}
result |= key;
return result;
}
_computeKeyCodeChord() {
let key = 0;
if (this.keyCode !== 5 && this.keyCode !== 4 && this.keyCode !== 6 && this.keyCode !== 57) {
key = this.keyCode;
}
return new KeyCodeChord(this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/iframe.js
function getParentWindowIfSameOrigin(w) {
if (!w.parent || w.parent === w) {
return null;
}
try {
const location = w.location;
const parentLocation = w.parent.location;
if (location.origin !== "null" && parentLocation.origin !== "null" && location.origin !== parentLocation.origin) {
return null;
}
} catch (e) {
return null;
}
return w.parent;
}
var sameOriginWindowChainCache, IframeUtils;
var init_iframe = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/iframe.js"() {
sameOriginWindowChainCache = /* @__PURE__ */ new WeakMap();
IframeUtils = class {
/**
* Returns a chain of embedded windows with the same origin (which can be accessed programmatically).
* 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.
*/
static getSameOriginWindowChain(targetWindow) {
let windowChainCache = sameOriginWindowChainCache.get(targetWindow);
if (!windowChainCache) {
windowChainCache = [];
sameOriginWindowChainCache.set(targetWindow, windowChainCache);
let w = targetWindow;
let parent;
do {
parent = getParentWindowIfSameOrigin(w);
if (parent) {
windowChainCache.push({
window: new WeakRef(w),
iframeElement: w.frameElement || null
});
} else {
windowChainCache.push({
window: new WeakRef(w),
iframeElement: null
});
}
w = parent;
} while (w);
}
return windowChainCache.slice(0);
}
/**
* Returns the position of `childWindow` relative to `ancestorWindow`
*/
static getPositionOfChildWindowRelativeToAncestorWindow(childWindow, ancestorWindow) {
var _a10, _b4;
if (!ancestorWindow || childWindow === ancestorWindow) {
return {
top: 0,
left: 0
};
}
let top = 0, left = 0;
const windowChain = this.getSameOriginWindowChain(childWindow);
for (const windowChainEl of windowChain) {
const windowInChain = windowChainEl.window.deref();
top += (_a10 = windowInChain === null || windowInChain === void 0 ? void 0 : windowInChain.scrollY) !== null && _a10 !== void 0 ? _a10 : 0;
left += (_b4 = windowInChain === null || windowInChain === void 0 ? void 0 : windowInChain.scrollX) !== null && _b4 !== void 0 ? _b4 : 0;
if (windowInChain === ancestorWindow) {
break;
}
if (!windowChainEl.iframeElement) {
break;
}
const boundingRect = windowChainEl.iframeElement.getBoundingClientRect();
top += boundingRect.top;
left += boundingRect.left;
}
return {
top,
left
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js
var StandardMouseEvent, StandardWheelEvent;
var init_mouseEvent = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js"() {
init_browser();
init_iframe();
init_platform();
StandardMouseEvent = class {
constructor(targetWindow, e) {
this.timestamp = Date.now();
this.browserEvent = e;
this.leftButton = e.button === 0;
this.middleButton = e.button === 1;
this.rightButton = e.button === 2;
this.buttons = e.buttons;
this.target = e.target;
this.detail = e.detail || 1;
if (e.type === "dblclick") {
this.detail = 2;
}
this.ctrlKey = e.ctrlKey;
this.shiftKey = e.shiftKey;
this.altKey = e.altKey;
this.metaKey = e.metaKey;
if (typeof e.pageX === "number") {
this.posx = e.pageX;
this.posy = e.pageY;
} else {
this.posx = e.clientX + this.target.ownerDocument.body.scrollLeft + this.target.ownerDocument.documentElement.scrollLeft;
this.posy = e.clientY + this.target.ownerDocument.body.scrollTop + this.target.ownerDocument.documentElement.scrollTop;
}
const iframeOffsets = IframeUtils.getPositionOfChildWindowRelativeToAncestorWindow(targetWindow, e.view);
this.posx -= iframeOffsets.left;
this.posy -= iframeOffsets.top;
}
preventDefault() {
this.browserEvent.preventDefault();
}
stopPropagation() {
this.browserEvent.stopPropagation();
}
};
StandardWheelEvent = class {
constructor(e, deltaX = 0, deltaY = 0) {
var _a10;
this.browserEvent = e || null;
this.target = e ? e.target || e.targetNode || e.srcElement : null;
this.deltaY = deltaY;
this.deltaX = deltaX;
let shouldFactorDPR = false;
if (isChrome2) {
const chromeVersionMatch = navigator.userAgent.match(/Chrome\/(\d+)/);
const chromeMajorVersion = chromeVersionMatch ? parseInt(chromeVersionMatch[1]) : 123;
shouldFactorDPR = chromeMajorVersion <= 122;
}
if (e) {
const e1 = e;
const e2 = e;
const devicePixelRatio = ((_a10 = e.view) === null || _a10 === void 0 ? void 0 : _a10.devicePixelRatio) || 1;
if (typeof e1.wheelDeltaY !== "undefined") {
if (shouldFactorDPR) {
this.deltaY = e1.wheelDeltaY / (120 * devicePixelRatio);
} else {
this.deltaY = e1.wheelDeltaY / 120;
}
} else if (typeof e2.VERTICAL_AXIS !== "undefined" && e2.axis === e2.VERTICAL_AXIS) {
this.deltaY = -e2.detail / 3;
} else if (e.type === "wheel") {
const ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
if (isFirefox2 && !isMacintosh) {
this.deltaY = -e.deltaY / 3;
} else {
this.deltaY = -e.deltaY;
}
} else {
this.deltaY = -e.deltaY / 40;
}
}
if (typeof e1.wheelDeltaX !== "undefined") {
if (isSafari2 && isWindows) {
this.deltaX = -(e1.wheelDeltaX / 120);
} else if (shouldFactorDPR) {
this.deltaX = e1.wheelDeltaX / (120 * devicePixelRatio);
} else {
this.deltaX = e1.wheelDeltaX / 120;
}
} else if (typeof e2.HORIZONTAL_AXIS !== "undefined" && e2.axis === e2.HORIZONTAL_AXIS) {
this.deltaX = -e.detail / 3;
} else if (e.type === "wheel") {
const ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
if (isFirefox2 && !isMacintosh) {
this.deltaX = -e.deltaX / 3;
} else {
this.deltaX = -e.deltaX;
}
} else {
this.deltaX = -e.deltaX / 40;
}
}
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
if (shouldFactorDPR) {
this.deltaY = e.wheelDelta / (120 * devicePixelRatio);
} else {
this.deltaY = e.wheelDelta / 120;
}
}
}
}
preventDefault() {
var _a10;
(_a10 = this.browserEvent) === null || _a10 === void 0 ? void 0 : _a10.preventDefault();
}
stopPropagation() {
var _a10;
(_a10 = this.browserEvent) === null || _a10 === void 0 ? void 0 : _a10.stopPropagation();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/symbols.js
var MicrotaskDelay;
var init_symbols = __esm({
"node_modules/monaco-editor/esm/vs/base/common/symbols.js"() {
MicrotaskDelay = Symbol("MicrotaskDelay");
}
});
// node_modules/monaco-editor/esm/vs/base/common/async.js
function isThenable(obj) {
return !!obj && typeof obj.then === "function";
}
function createCancelablePromise(callback) {
const source = new CancellationTokenSource();
const thenable = callback(source.token);
const promise = new Promise((resolve2, reject) => {
const subscription = source.token.onCancellationRequested(() => {
subscription.dispose();
reject(new CancellationError());
});
Promise.resolve(thenable).then((value) => {
subscription.dispose();
source.dispose();
resolve2(value);
}, (err) => {
subscription.dispose();
source.dispose();
reject(err);
});
});
return new class {
cancel() {
source.cancel();
source.dispose();
}
then(resolve2, reject) {
return promise.then(resolve2, reject);
}
catch(reject) {
return this.then(void 0, reject);
}
finally(onfinally) {
return promise.finally(onfinally);
}
}();
}
function raceCancellation(promise, token, defaultValue) {
return new Promise((resolve2, reject) => {
const ref = token.onCancellationRequested(() => {
ref.dispose();
resolve2(defaultValue);
});
promise.then(resolve2, reject).finally(() => ref.dispose());
});
}
function timeout(millis, token) {
if (!token) {
return createCancelablePromise((token2) => timeout(millis, token2));
}
return new Promise((resolve2, reject) => {
const handle = setTimeout(() => {
disposable.dispose();
resolve2();
}, millis);
const disposable = token.onCancellationRequested(() => {
clearTimeout(handle);
disposable.dispose();
reject(new CancellationError());
});
});
}
function disposableTimeout(handler, timeout2 = 0, store) {
const timer = setTimeout(() => {
handler();
if (store) {
disposable.dispose();
}
}, timeout2);
const disposable = toDisposable(() => {
clearTimeout(timer);
store === null || store === void 0 ? void 0 : store.deleteAndLeak(disposable);
});
store === null || store === void 0 ? void 0 : store.add(disposable);
return disposable;
}
function first(promiseFactories, shouldStop = (t4) => !!t4, defaultValue = null) {
let index = 0;
const len = promiseFactories.length;
const loop = () => {
if (index >= len) {
return Promise.resolve(defaultValue);
}
const factory = promiseFactories[index++];
const promise = Promise.resolve(factory());
return promise.then((result) => {
if (shouldStop(result)) {
return Promise.resolve(result);
}
return loop();
});
};
return loop();
}
function createCancelableAsyncIterable(callback) {
const source = new CancellationTokenSource();
const innerIterable = callback(source.token);
return new CancelableAsyncIterableObject(source, (emitter) => __async(this, null, function* () {
const subscription = source.token.onCancellationRequested(() => {
subscription.dispose();
source.dispose();
emitter.reject(new CancellationError());
});
try {
try {
for (var iter = __forAwait(innerIterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
if (source.token.isCancellationRequested) {
return;
}
emitter.emitOne(item);
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
subscription.dispose();
source.dispose();
} catch (err) {
subscription.dispose();
source.dispose();
emitter.reject(err);
}
}));
}
var Throttler, timeoutDeferred, microtaskDeferred, Delayer, ThrottledDelayer, TimeoutTimer, IntervalTimer, RunOnceScheduler, runWhenGlobalIdle, _runWhenIdle, AbstractIdleValue, GlobalIdleValue, DeferredPromise, Promises, AsyncIterableObject, CancelableAsyncIterableObject;
var init_async = __esm({
"node_modules/monaco-editor/esm/vs/base/common/async.js"() {
init_cancellation();
init_errors();
init_event();
init_lifecycle();
init_platform();
init_symbols();
Throttler = class {
constructor() {
this.isDisposed = false;
this.activePromise = null;
this.queuedPromise = null;
this.queuedPromiseFactory = null;
}
queue(promiseFactory) {
if (this.isDisposed) {
return Promise.reject(new Error("Throttler is disposed"));
}
if (this.activePromise) {
this.queuedPromiseFactory = promiseFactory;
if (!this.queuedPromise) {
const onComplete = () => {
this.queuedPromise = null;
if (this.isDisposed) {
return;
}
const result = this.queue(this.queuedPromiseFactory);
this.queuedPromiseFactory = null;
return result;
};
this.queuedPromise = new Promise((resolve2) => {
this.activePromise.then(onComplete, onComplete).then(resolve2);
});
}
return new Promise((resolve2, reject) => {
this.queuedPromise.then(resolve2, reject);
});
}
this.activePromise = promiseFactory();
return new Promise((resolve2, reject) => {
this.activePromise.then((result) => {
this.activePromise = null;
resolve2(result);
}, (err) => {
this.activePromise = null;
reject(err);
});
});
}
dispose() {
this.isDisposed = true;
}
};
timeoutDeferred = (timeout2, fn) => {
let scheduled = true;
const handle = setTimeout(() => {
scheduled = false;
fn();
}, timeout2);
return {
isTriggered: () => scheduled,
dispose: () => {
clearTimeout(handle);
scheduled = false;
}
};
};
microtaskDeferred = (fn) => {
let scheduled = true;
queueMicrotask(() => {
if (scheduled) {
scheduled = false;
fn();
}
});
return {
isTriggered: () => scheduled,
dispose: () => {
scheduled = false;
}
};
};
Delayer = class {
constructor(defaultDelay) {
this.defaultDelay = defaultDelay;
this.deferred = null;
this.completionPromise = null;
this.doResolve = null;
this.doReject = null;
this.task = null;
}
trigger(task, delay = this.defaultDelay) {
this.task = task;
this.cancelTimeout();
if (!this.completionPromise) {
this.completionPromise = new Promise((resolve2, reject) => {
this.doResolve = resolve2;
this.doReject = reject;
}).then(() => {
this.completionPromise = null;
this.doResolve = null;
if (this.task) {
const task2 = this.task;
this.task = null;
return task2();
}
return void 0;
});
}
const fn = () => {
var _a10;
this.deferred = null;
(_a10 = this.doResolve) === null || _a10 === void 0 ? void 0 : _a10.call(this, null);
};
this.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);
return this.completionPromise;
}
isTriggered() {
var _a10;
return !!((_a10 = this.deferred) === null || _a10 === void 0 ? void 0 : _a10.isTriggered());
}
cancel() {
var _a10;
this.cancelTimeout();
if (this.completionPromise) {
(_a10 = this.doReject) === null || _a10 === void 0 ? void 0 : _a10.call(this, new CancellationError());
this.completionPromise = null;
}
}
cancelTimeout() {
var _a10;
(_a10 = this.deferred) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this.deferred = null;
}
dispose() {
this.cancel();
}
};
ThrottledDelayer = class {
constructor(defaultDelay) {
this.delayer = new Delayer(defaultDelay);
this.throttler = new Throttler();
}
trigger(promiseFactory, delay) {
return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay);
}
cancel() {
this.delayer.cancel();
}
dispose() {
this.delayer.dispose();
this.throttler.dispose();
}
};
TimeoutTimer = class {
constructor(runner, timeout2) {
this._isDisposed = false;
this._token = -1;
if (typeof runner === "function" && typeof timeout2 === "number") {
this.setIfNotSet(runner, timeout2);
}
}
dispose() {
this.cancel();
this._isDisposed = true;
}
cancel() {
if (this._token !== -1) {
clearTimeout(this._token);
this._token = -1;
}
}
cancelAndSet(runner, timeout2) {
if (this._isDisposed) {
throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);
}
this.cancel();
this._token = setTimeout(() => {
this._token = -1;
runner();
}, timeout2);
}
setIfNotSet(runner, timeout2) {
if (this._isDisposed) {
throw new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);
}
if (this._token !== -1) {
return;
}
this._token = setTimeout(() => {
this._token = -1;
runner();
}, timeout2);
}
};
IntervalTimer = class {
constructor() {
this.disposable = void 0;
this.isDisposed = false;
}
cancel() {
var _a10;
(_a10 = this.disposable) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this.disposable = void 0;
}
cancelAndSet(runner, interval, context = globalThis) {
if (this.isDisposed) {
throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);
}
this.cancel();
const handle = context.setInterval(() => {
runner();
}, interval);
this.disposable = toDisposable(() => {
context.clearInterval(handle);
this.disposable = void 0;
});
}
dispose() {
this.cancel();
this.isDisposed = true;
}
};
RunOnceScheduler = class {
constructor(runner, delay) {
this.timeoutToken = -1;
this.runner = runner;
this.timeout = delay;
this.timeoutHandler = this.onTimeout.bind(this);
}
/**
* Dispose RunOnceScheduler
*/
dispose() {
this.cancel();
this.runner = null;
}
/**
* Cancel current scheduled runner (if any).
*/
cancel() {
if (this.isScheduled()) {
clearTimeout(this.timeoutToken);
this.timeoutToken = -1;
}
}
/**
* Cancel previous runner (if any) & schedule a new runner.
*/
schedule(delay = this.timeout) {
this.cancel();
this.timeoutToken = setTimeout(this.timeoutHandler, delay);
}
get delay() {
return this.timeout;
}
set delay(value) {
this.timeout = value;
}
/**
* Returns true if scheduled.
*/
isScheduled() {
return this.timeoutToken !== -1;
}
onTimeout() {
this.timeoutToken = -1;
if (this.runner) {
this.doRun();
}
}
doRun() {
var _a10;
(_a10 = this.runner) === null || _a10 === void 0 ? void 0 : _a10.call(this);
}
};
(function() {
if (typeof globalThis.requestIdleCallback !== "function" || typeof globalThis.cancelIdleCallback !== "function") {
_runWhenIdle = (_targetWindow, runner) => {
setTimeout0(() => {
if (disposed) {
return;
}
const end = Date.now() + 15;
const deadline = {
didTimeout: true,
timeRemaining() {
return Math.max(0, end - Date.now());
}
};
runner(Object.freeze(deadline));
});
let disposed = false;
return {
dispose() {
if (disposed) {
return;
}
disposed = true;
}
};
};
} else {
_runWhenIdle = (targetWindow, runner, timeout2) => {
const handle = targetWindow.requestIdleCallback(runner, typeof timeout2 === "number" ? { timeout: timeout2 } : void 0);
let disposed = false;
return {
dispose() {
if (disposed) {
return;
}
disposed = true;
targetWindow.cancelIdleCallback(handle);
}
};
};
}
runWhenGlobalIdle = (runner) => _runWhenIdle(globalThis, runner);
})();
AbstractIdleValue = class {
constructor(targetWindow, executor) {
this._didRun = false;
this._executor = () => {
try {
this._value = executor();
} catch (err) {
this._error = err;
} finally {
this._didRun = true;
}
};
this._handle = _runWhenIdle(targetWindow, () => this._executor());
}
dispose() {
this._handle.dispose();
}
get value() {
if (!this._didRun) {
this._handle.dispose();
this._executor();
}
if (this._error) {
throw this._error;
}
return this._value;
}
get isInitialized() {
return this._didRun;
}
};
GlobalIdleValue = class extends AbstractIdleValue {
constructor(executor) {
super(globalThis, executor);
}
};
DeferredPromise = class {
get isRejected() {
var _a10;
return ((_a10 = this.outcome) === null || _a10 === void 0 ? void 0 : _a10.outcome) === 1;
}
get isSettled() {
return !!this.outcome;
}
constructor() {
this.p = new Promise((c, e) => {
this.completeCallback = c;
this.errorCallback = e;
});
}
complete(value) {
return new Promise((resolve2) => {
this.completeCallback(value);
this.outcome = { outcome: 0, value };
resolve2();
});
}
error(err) {
return new Promise((resolve2) => {
this.errorCallback(err);
this.outcome = { outcome: 1, value: err };
resolve2();
});
}
cancel() {
return this.error(new CancellationError());
}
};
(function(Promises2) {
function settled(promises) {
return __async(this, null, function* () {
let firstError = void 0;
const result = yield Promise.all(promises.map((promise) => promise.then((value) => value, (error) => {
if (!firstError) {
firstError = error;
}
return void 0;
})));
if (typeof firstError !== "undefined") {
throw firstError;
}
return result;
});
}
Promises2.settled = settled;
function withAsyncBody(bodyFn) {
return new Promise((resolve2, reject) => __async(this, null, function* () {
try {
yield bodyFn(resolve2, reject);
} catch (error) {
reject(error);
}
}));
}
Promises2.withAsyncBody = withAsyncBody;
})(Promises || (Promises = {}));
AsyncIterableObject = class _AsyncIterableObject {
static fromArray(items) {
return new _AsyncIterableObject((writer) => {
writer.emitMany(items);
});
}
static fromPromise(promise) {
return new _AsyncIterableObject((emitter) => __async(this, null, function* () {
emitter.emitMany(yield promise);
}));
}
static fromPromises(promises) {
return new _AsyncIterableObject((emitter) => __async(this, null, function* () {
yield Promise.all(promises.map((p) => __async(this, null, function* () {
return emitter.emitOne(yield p);
})));
}));
}
static merge(iterables) {
return new _AsyncIterableObject((emitter) => __async(this, null, function* () {
yield Promise.all(iterables.map((iterable) => __async(this, null, function* () {
try {
for (var iter = __forAwait(iterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
emitter.emitOne(item);
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
})));
}));
}
constructor(executor, onReturn) {
this._state = 0;
this._results = [];
this._error = null;
this._onReturn = onReturn;
this._onStateChanged = new Emitter();
queueMicrotask(() => __async(this, null, function* () {
const writer = {
emitOne: (item) => this.emitOne(item),
emitMany: (items) => this.emitMany(items),
reject: (error) => this.reject(error)
};
try {
yield Promise.resolve(executor(writer));
this.resolve();
} catch (err) {
this.reject(err);
} finally {
writer.emitOne = void 0;
writer.emitMany = void 0;
writer.reject = void 0;
}
}));
}
[Symbol.asyncIterator]() {
let i = 0;
return {
next: () => __async(this, null, function* () {
do {
if (this._state === 2) {
throw this._error;
}
if (i < this._results.length) {
return { done: false, value: this._results[i++] };
}
if (this._state === 1) {
return { done: true, value: void 0 };
}
yield Event.toPromise(this._onStateChanged.event);
} while (true);
}),
return: () => __async(this, null, function* () {
var _a10;
(_a10 = this._onReturn) === null || _a10 === void 0 ? void 0 : _a10.call(this);
return { done: true, value: void 0 };
})
};
}
static map(iterable, mapFn) {
return new _AsyncIterableObject((emitter) => __async(this, null, function* () {
try {
for (var iter = __forAwait(iterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
emitter.emitOne(mapFn(item));
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
}));
}
map(mapFn) {
return _AsyncIterableObject.map(this, mapFn);
}
static filter(iterable, filterFn) {
return new _AsyncIterableObject((emitter) => __async(this, null, function* () {
try {
for (var iter = __forAwait(iterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
if (filterFn(item)) {
emitter.emitOne(item);
}
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
}));
}
filter(filterFn) {
return _AsyncIterableObject.filter(this, filterFn);
}
static coalesce(iterable) {
return _AsyncIterableObject.filter(iterable, (item) => !!item);
}
coalesce() {
return _AsyncIterableObject.coalesce(this);
}
static toPromise(iterable) {
return __async(this, null, function* () {
const result = [];
try {
for (var iter = __forAwait(iterable), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
const item = temp.value;
result.push(item);
}
} catch (temp) {
error = [temp];
} finally {
try {
more && (temp = iter.return) && (yield temp.call(iter));
} finally {
if (error)
throw error[0];
}
}
return result;
});
}
toPromise() {
return _AsyncIterableObject.toPromise(this);
}
/**
* The value will be appended at the end.
*
* **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
*/
emitOne(value) {
if (this._state !== 0) {
return;
}
this._results.push(value);
this._onStateChanged.fire();
}
/**
* The values will be appended at the end.
*
* **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
*/
emitMany(values2) {
if (this._state !== 0) {
return;
}
this._results = this._results.concat(values2);
this._onStateChanged.fire();
}
/**
* Calling `resolve()` will mark the result array as complete.
*
* **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.
* **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
*/
resolve() {
if (this._state !== 0) {
return;
}
this._state = 1;
this._onStateChanged.fire();
}
/**
* Writing an error will permanently invalidate this iterable.
* The current users will receive an error thrown, as will all future users.
*
* **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
*/
reject(error) {
if (this._state !== 0) {
return;
}
this._state = 2;
this._error = error;
this._onStateChanged.fire();
}
};
AsyncIterableObject.EMPTY = AsyncIterableObject.fromArray([]);
CancelableAsyncIterableObject = class extends AsyncIterableObject {
constructor(_source, executor) {
super(executor);
this._source = _source;
}
cancel() {
this._source.cancel();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js
function unapply(func) {
return function(thisArg) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return apply(func, thisArg, args);
};
}
function unconstruct(func) {
return function() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return construct(func, args);
};
}
function addToSet(set, array2, transformCaseFunc) {
var _transformCaseFunc;
transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
if (setPrototypeOf) {
setPrototypeOf(set, null);
}
let l = array2.length;
while (l--) {
let element = array2[l];
if (typeof element === "string") {
const lcElement = transformCaseFunc(element);
if (lcElement !== element) {
if (!isFrozen(array2)) {
array2[l] = lcElement;
}
element = lcElement;
}
}
set[element] = true;
}
return set;
}
function clone(object) {
const newObject = create(null);
for (const [property, value] of entries(object)) {
newObject[property] = value;
}
return newObject;
}
function lookupGetter(object, prop) {
while (object !== null) {
const desc = getOwnPropertyDescriptor(object, prop);
if (desc) {
if (desc.get) {
return unapply(desc.get);
}
if (typeof desc.value === "function") {
return unapply(desc.value);
}
}
object = getPrototypeOf(object);
}
function fallbackValue(element) {
console.warn("fallback value for", element);
return null;
}
return fallbackValue;
}
function createDOMPurify() {
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
const DOMPurify = (root) => createDOMPurify(root);
DOMPurify.version = "3.0.5";
DOMPurify.removed = [];
if (!window2 || !window2.document || window2.document.nodeType !== 9) {
DOMPurify.isSupported = false;
return DOMPurify;
}
const originalDocument = window2.document;
const currentScript = originalDocument.currentScript;
let {
document: document2
} = window2;
const {
DocumentFragment,
HTMLTemplateElement,
Node: Node6,
Element: Element3,
NodeFilter,
NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
HTMLFormElement,
DOMParser: DOMParser2,
trustedTypes
} = window2;
const ElementPrototype = Element3.prototype;
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
if (typeof HTMLTemplateElement === "function") {
const template = document2.createElement("template");
if (template.content && template.content.ownerDocument) {
document2 = template.content.ownerDocument;
}
}
let trustedTypesPolicy;
let emptyHTML = "";
const {
implementation,
createNodeIterator,
createDocumentFragment,
getElementsByTagName
} = document2;
const {
importNode
} = originalDocument;
let hooks = {};
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
const {
MUSTACHE_EXPR: MUSTACHE_EXPR2,
ERB_EXPR: ERB_EXPR2,
TMPLIT_EXPR: TMPLIT_EXPR2,
DATA_ATTR: DATA_ATTR2,
ARIA_ATTR: ARIA_ATTR2,
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
ATTR_WHITESPACE: ATTR_WHITESPACE2
} = EXPRESSIONS;
let {
IS_ALLOWED_URI: IS_ALLOWED_URI$1
} = EXPRESSIONS;
let ALLOWED_TAGS = null;
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
let ALLOWED_ATTR = null;
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
let CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
tagNameCheck: {
writable: true,
configurable: false,
enumerable: true,
value: null
},
attributeNameCheck: {
writable: true,
configurable: false,
enumerable: true,
value: null
},
allowCustomizedBuiltInElements: {
writable: true,
configurable: false,
enumerable: true,
value: false
}
}));
let FORBID_TAGS = null;
let FORBID_ATTR = null;
let ALLOW_ARIA_ATTR = true;
let ALLOW_DATA_ATTR = true;
let ALLOW_UNKNOWN_PROTOCOLS = false;
let ALLOW_SELF_CLOSE_IN_ATTR = true;
let SAFE_FOR_TEMPLATES = false;
let WHOLE_DOCUMENT = false;
let SET_CONFIG = false;
let FORCE_BODY = false;
let RETURN_DOM = false;
let RETURN_DOM_FRAGMENT = false;
let RETURN_TRUSTED_TYPE = false;
let SANITIZE_DOM = true;
let SANITIZE_NAMED_PROPS = false;
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
let KEEP_CONTENT = true;
let IN_PLACE = false;
let USE_PROFILES = {};
let FORBID_CONTENTS = null;
const 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"]);
let DATA_URI_TAGS = null;
const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
let URI_SAFE_ATTRIBUTES = null;
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
let NAMESPACE = HTML_NAMESPACE;
let IS_EMPTY_INPUT = false;
let ALLOWED_NAMESPACES = null;
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
let PARSER_MEDIA_TYPE;
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
let transformCaseFunc;
let CONFIG = null;
const formElement = document2.createElement("form");
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
return testValue instanceof RegExp || testValue instanceof Function;
};
const _parseConfig = function _parseConfig2(cfg) {
if (CONFIG && CONFIG === cfg) {
return;
}
if (!cfg || typeof cfg !== "object") {
cfg = {};
}
cfg = clone(cfg);
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
ALLOWED_NAMESPACES = "ALLOWED_NAMESPACES" in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet(
clone(DEFAULT_URI_SAFE_ATTRIBUTES),
// eslint-disable-line indent
cfg.ADD_URI_SAFE_ATTR,
// eslint-disable-line indent
transformCaseFunc
// eslint-disable-line indent
) : DEFAULT_URI_SAFE_ATTRIBUTES;
DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet(
clone(DEFAULT_DATA_URI_TAGS),
// eslint-disable-line indent
cfg.ADD_DATA_URI_TAGS,
// eslint-disable-line indent
transformCaseFunc
// eslint-disable-line indent
) : DEFAULT_DATA_URI_TAGS;
FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false;
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
RETURN_DOM = cfg.RETURN_DOM || false;
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
FORCE_BODY = cfg.FORCE_BODY || false;
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
IN_PLACE = cfg.IN_PLACE || false;
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
}
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
}
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
}
if (SAFE_FOR_TEMPLATES) {
ALLOW_DATA_ATTR = false;
}
if (RETURN_DOM_FRAGMENT) {
RETURN_DOM = true;
}
if (USE_PROFILES) {
ALLOWED_TAGS = addToSet({}, [...text]);
ALLOWED_ATTR = [];
if (USE_PROFILES.html === true) {
addToSet(ALLOWED_TAGS, html$1);
addToSet(ALLOWED_ATTR, html);
}
if (USE_PROFILES.svg === true) {
addToSet(ALLOWED_TAGS, svg$1);
addToSet(ALLOWED_ATTR, svg);
addToSet(ALLOWED_ATTR, xml);
}
if (USE_PROFILES.svgFilters === true) {
addToSet(ALLOWED_TAGS, svgFilters);
addToSet(ALLOWED_ATTR, svg);
addToSet(ALLOWED_ATTR, xml);
}
if (USE_PROFILES.mathMl === true) {
addToSet(ALLOWED_TAGS, mathMl$1);
addToSet(ALLOWED_ATTR, mathMl);
addToSet(ALLOWED_ATTR, xml);
}
}
if (cfg.ADD_TAGS) {
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
ALLOWED_TAGS = clone(ALLOWED_TAGS);
}
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
}
if (cfg.ADD_ATTR) {
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
ALLOWED_ATTR = clone(ALLOWED_ATTR);
}
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
}
if (cfg.ADD_URI_SAFE_ATTR) {
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
}
if (cfg.FORBID_CONTENTS) {
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
FORBID_CONTENTS = clone(FORBID_CONTENTS);
}
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
}
if (KEEP_CONTENT) {
ALLOWED_TAGS["#text"] = true;
}
if (WHOLE_DOCUMENT) {
addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
}
if (ALLOWED_TAGS.table) {
addToSet(ALLOWED_TAGS, ["tbody"]);
delete FORBID_TAGS.tbody;
}
if (cfg.TRUSTED_TYPES_POLICY) {
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
}
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
}
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
emptyHTML = trustedTypesPolicy.createHTML("");
} else {
if (trustedTypesPolicy === void 0) {
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
}
if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
emptyHTML = trustedTypesPolicy.createHTML("");
}
}
if (freeze) {
freeze(cfg);
}
CONFIG = cfg;
};
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]);
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
const ALL_SVG_TAGS = addToSet({}, svg$1);
addToSet(ALL_SVG_TAGS, svgFilters);
addToSet(ALL_SVG_TAGS, svgDisallowed);
const ALL_MATHML_TAGS = addToSet({}, mathMl$1);
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
const _checkValidNamespace = function _checkValidNamespace2(element) {
let parent = getParentNode(element);
if (!parent || !parent.tagName) {
parent = {
namespaceURI: NAMESPACE,
tagName: "template"
};
}
const tagName = stringToLowerCase(element.tagName);
const parentTagName = stringToLowerCase(parent.tagName);
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
return false;
}
if (element.namespaceURI === SVG_NAMESPACE) {
if (parent.namespaceURI === HTML_NAMESPACE) {
return tagName === "svg";
}
if (parent.namespaceURI === MATHML_NAMESPACE) {
return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
}
return Boolean(ALL_SVG_TAGS[tagName]);
}
if (element.namespaceURI === MATHML_NAMESPACE) {
if (parent.namespaceURI === HTML_NAMESPACE) {
return tagName === "math";
}
if (parent.namespaceURI === SVG_NAMESPACE) {
return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
}
return Boolean(ALL_MATHML_TAGS[tagName]);
}
if (element.namespaceURI === HTML_NAMESPACE) {
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
return false;
}
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
return false;
}
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
}
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
return true;
}
return false;
};
const _forceRemove = function _forceRemove2(node) {
arrayPush(DOMPurify.removed, {
element: node
});
try {
node.parentNode.removeChild(node);
} catch (_) {
node.remove();
}
};
const _removeAttribute = function _removeAttribute2(name, node) {
try {
arrayPush(DOMPurify.removed, {
attribute: node.getAttributeNode(name),
from: node
});
} catch (_) {
arrayPush(DOMPurify.removed, {
attribute: null,
from: node
});
}
node.removeAttribute(name);
if (name === "is" && !ALLOWED_ATTR[name]) {
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
try {
_forceRemove(node);
} catch (_) {
}
} else {
try {
node.setAttribute(name, "");
} catch (_) {
}
}
}
};
const _initDocument = function _initDocument2(dirty) {
let doc;
let leadingWhitespace;
if (FORCE_BODY) {
dirty = "" + dirty;
} else {
const matches2 = stringMatch(dirty, /^[\r\n\t ]+/);
leadingWhitespace = matches2 && matches2[0];
}
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
dirty = '
' + dirty + "";
}
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
if (NAMESPACE === HTML_NAMESPACE) {
try {
doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
} catch (_) {
}
}
if (!doc || !doc.documentElement) {
doc = implementation.createDocument(NAMESPACE, "template", null);
try {
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
} catch (_) {
}
}
const body = doc.body || doc.documentElement;
if (dirty && leadingWhitespace) {
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
}
if (NAMESPACE === HTML_NAMESPACE) {
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
}
return WHOLE_DOCUMENT ? doc.documentElement : body;
};
const _createIterator = function _createIterator2(root) {
return createNodeIterator.call(
root.ownerDocument || root,
root,
// eslint-disable-next-line no-bitwise
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
null,
false
);
};
const _isClobbered = function _isClobbered2(elm) {
return 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");
};
const _isNode = function _isNode2(object) {
return typeof Node6 === "object" ? object instanceof Node6 : object && typeof object === "object" && typeof object.nodeType === "number" && typeof object.nodeName === "string";
};
const _executeHook = function _executeHook2(entryPoint, currentNode, data) {
if (!hooks[entryPoint]) {
return;
}
arrayForEach(hooks[entryPoint], (hook) => {
hook.call(DOMPurify, currentNode, data, CONFIG);
});
};
const _sanitizeElements = function _sanitizeElements2(currentNode) {
let content;
_executeHook("beforeSanitizeElements", currentNode, null);
if (_isClobbered(currentNode)) {
_forceRemove(currentNode);
return true;
}
const tagName = transformCaseFunc(currentNode.nodeName);
_executeHook("uponSanitizeElement", currentNode, {
tagName,
allowedTags: ALLOWED_TAGS
});
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
_forceRemove(currentNode);
return true;
}
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
}
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
if (childNodes && parentNode) {
const childCount = childNodes.length;
for (let i = childCount - 1; i >= 0; --i) {
parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
}
}
}
_forceRemove(currentNode);
return true;
}
if (currentNode instanceof Element3 && !_checkValidNamespace(currentNode)) {
_forceRemove(currentNode);
return true;
}
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
_forceRemove(currentNode);
return true;
}
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
content = currentNode.textContent;
content = stringReplace(content, MUSTACHE_EXPR2, " ");
content = stringReplace(content, ERB_EXPR2, " ");
content = stringReplace(content, TMPLIT_EXPR2, " ");
if (currentNode.textContent !== content) {
arrayPush(DOMPurify.removed, {
element: currentNode.cloneNode()
});
currentNode.textContent = content;
}
}
_executeHook("afterSanitizeElements", currentNode, null);
return false;
};
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
return false;
}
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
if (
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
_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
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
lcName === "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 {
return false;
}
} else if (URI_SAFE_ATTRIBUTES[lcName]) ;
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
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_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
else if (value) {
return false;
} else ;
return true;
};
const _basicCustomElementTest = function _basicCustomElementTest2(tagName) {
return tagName.indexOf("-") > 0;
};
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
let attr;
let value;
let lcName;
let l;
_executeHook("beforeSanitizeAttributes", currentNode, null);
const {
attributes
} = currentNode;
if (!attributes) {
return;
}
const hookEvent = {
attrName: "",
attrValue: "",
keepAttr: true,
allowedAttributes: ALLOWED_ATTR
};
l = attributes.length;
while (l--) {
attr = attributes[l];
const {
name,
namespaceURI
} = attr;
value = name === "value" ? attr.value : stringTrim(attr.value);
lcName = transformCaseFunc(name);
hookEvent.attrName = lcName;
hookEvent.attrValue = value;
hookEvent.keepAttr = true;
hookEvent.forceKeepAttr = void 0;
_executeHook("uponSanitizeAttribute", currentNode, hookEvent);
value = hookEvent.attrValue;
if (hookEvent.forceKeepAttr) {
continue;
}
_removeAttribute(name, currentNode);
if (!hookEvent.keepAttr) {
continue;
}
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
_removeAttribute(name, currentNode);
continue;
}
if (SAFE_FOR_TEMPLATES) {
value = stringReplace(value, MUSTACHE_EXPR2, " ");
value = stringReplace(value, ERB_EXPR2, " ");
value = stringReplace(value, TMPLIT_EXPR2, " ");
}
const lcTag = transformCaseFunc(currentNode.nodeName);
if (!_isValidAttribute(lcTag, lcName, value)) {
continue;
}
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
_removeAttribute(name, currentNode);
value = SANITIZE_NAMED_PROPS_PREFIX + value;
}
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
if (namespaceURI) ;
else {
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
case "TrustedHTML": {
value = trustedTypesPolicy.createHTML(value);
break;
}
case "TrustedScriptURL": {
value = trustedTypesPolicy.createScriptURL(value);
break;
}
}
}
}
try {
if (namespaceURI) {
currentNode.setAttributeNS(namespaceURI, name, value);
} else {
currentNode.setAttribute(name, value);
}
arrayPop(DOMPurify.removed);
} catch (_) {
}
}
_executeHook("afterSanitizeAttributes", currentNode, null);
};
const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
let shadowNode;
const shadowIterator = _createIterator(fragment);
_executeHook("beforeSanitizeShadowDOM", fragment, null);
while (shadowNode = shadowIterator.nextNode()) {
_executeHook("uponSanitizeShadowNode", shadowNode, null);
if (_sanitizeElements(shadowNode)) {
continue;
}
if (shadowNode.content instanceof DocumentFragment) {
_sanitizeShadowDOM2(shadowNode.content);
}
_sanitizeAttributes(shadowNode);
}
_executeHook("afterSanitizeShadowDOM", fragment, null);
};
DOMPurify.sanitize = function(dirty) {
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let body;
let importedNode;
let currentNode;
let returnNode;
IS_EMPTY_INPUT = !dirty;
if (IS_EMPTY_INPUT) {
dirty = "";
}
if (typeof dirty !== "string" && !_isNode(dirty)) {
if (typeof dirty.toString === "function") {
dirty = dirty.toString();
if (typeof dirty !== "string") {
throw typeErrorCreate("dirty is not a string, aborting");
}
} else {
throw typeErrorCreate("toString is not a function");
}
}
if (!DOMPurify.isSupported) {
return dirty;
}
if (!SET_CONFIG) {
_parseConfig(cfg);
}
DOMPurify.removed = [];
if (typeof dirty === "string") {
IN_PLACE = false;
}
if (IN_PLACE) {
if (dirty.nodeName) {
const tagName = transformCaseFunc(dirty.nodeName);
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
}
}
} else if (dirty instanceof Node6) {
body = _initDocument("");
importedNode = body.ownerDocument.importNode(dirty, true);
if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") {
body = importedNode;
} else if (importedNode.nodeName === "HTML") {
body = importedNode;
} else {
body.appendChild(importedNode);
}
} else {
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
dirty.indexOf("<") === -1) {
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
}
body = _initDocument(dirty);
if (!body) {
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
}
}
if (body && FORCE_BODY) {
_forceRemove(body.firstChild);
}
const nodeIterator = _createIterator(IN_PLACE ? dirty : body);
while (currentNode = nodeIterator.nextNode()) {
if (_sanitizeElements(currentNode)) {
continue;
}
if (currentNode.content instanceof DocumentFragment) {
_sanitizeShadowDOM(currentNode.content);
}
_sanitizeAttributes(currentNode);
}
if (IN_PLACE) {
return dirty;
}
if (RETURN_DOM) {
if (RETURN_DOM_FRAGMENT) {
returnNode = createDocumentFragment.call(body.ownerDocument);
while (body.firstChild) {
returnNode.appendChild(body.firstChild);
}
} else {
returnNode = body;
}
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
returnNode = importNode.call(originalDocument, returnNode, true);
}
return returnNode;
}
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
serializedHTML = "\n" + serializedHTML;
}
if (SAFE_FOR_TEMPLATES) {
serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR2, " ");
serializedHTML = stringReplace(serializedHTML, ERB_EXPR2, " ");
serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR2, " ");
}
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
};
DOMPurify.setConfig = function(cfg) {
_parseConfig(cfg);
SET_CONFIG = true;
};
DOMPurify.clearConfig = function() {
CONFIG = null;
SET_CONFIG = false;
};
DOMPurify.isValidAttribute = function(tag, attr, value) {
if (!CONFIG) {
_parseConfig({});
}
const lcTag = transformCaseFunc(tag);
const lcName = transformCaseFunc(attr);
return _isValidAttribute(lcTag, lcName, value);
};
DOMPurify.addHook = function(entryPoint, hookFunction) {
if (typeof hookFunction !== "function") {
return;
}
hooks[entryPoint] = hooks[entryPoint] || [];
arrayPush(hooks[entryPoint], hookFunction);
};
DOMPurify.removeHook = function(entryPoint) {
if (hooks[entryPoint]) {
return arrayPop(hooks[entryPoint]);
}
};
DOMPurify.removeHooks = function(entryPoint) {
if (hooks[entryPoint]) {
hooks[entryPoint] = [];
}
};
DOMPurify.removeAllHooks = function() {
hooks = {};
};
return DOMPurify;
}
var entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor, freeze, seal, create, apply, construct, arrayForEach, arrayPop, arrayPush, stringToLowerCase, stringToString, stringMatch, stringReplace, stringIndexOf, stringTrim, regExpTest, typeErrorCreate, html$1, svg$1, svgFilters, svgDisallowed, mathMl$1, mathMlDisallowed, text, html, svg, mathMl, xml, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, EXPRESSIONS, getGlobal, _createTrustedTypesPolicy, purify, version, isSupported, sanitize, setConfig, clearConfig, isValidAttribute, addHook, removeHook, removeHooks, removeAllHooks;
var init_dompurify = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js"() {
({
entries,
setPrototypeOf,
isFrozen,
getPrototypeOf,
getOwnPropertyDescriptor
} = Object);
({
freeze,
seal,
create
} = Object);
({
apply,
construct
} = typeof Reflect !== "undefined" && Reflect);
if (!apply) {
apply = function apply2(fun, thisValue, args) {
return fun.apply(thisValue, args);
};
}
if (!freeze) {
freeze = function freeze3(x) {
return x;
};
}
if (!seal) {
seal = function seal2(x) {
return x;
};
}
if (!construct) {
construct = function construct2(Func, args) {
return new Func(...args);
};
}
arrayForEach = unapply(Array.prototype.forEach);
arrayPop = unapply(Array.prototype.pop);
arrayPush = unapply(Array.prototype.push);
stringToLowerCase = unapply(String.prototype.toLowerCase);
stringToString = unapply(String.prototype.toString);
stringMatch = unapply(String.prototype.match);
stringReplace = unapply(String.prototype.replace);
stringIndexOf = unapply(String.prototype.indexOf);
stringTrim = unapply(String.prototype.trim);
regExpTest = unapply(RegExp.prototype.test);
typeErrorCreate = unconstruct(TypeError);
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$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"]);
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"]);
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"]);
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"]);
mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
text = freeze(["#text"]);
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"]);
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"]);
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"]);
xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
ARIA_ATTR = seal(/^aria-[\-\w]+$/);
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
);
IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
ATTR_WHITESPACE = seal(
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
// eslint-disable-line no-control-regex
);
DOCTYPE_NAME = seal(/^html$/i);
EXPRESSIONS = /* @__PURE__ */ Object.freeze({
__proto__: null,
MUSTACHE_EXPR,
ERB_EXPR,
TMPLIT_EXPR,
DATA_ATTR,
ARIA_ATTR,
IS_ALLOWED_URI,
IS_SCRIPT_OR_DATA,
ATTR_WHITESPACE,
DOCTYPE_NAME
});
getGlobal = () => typeof window === "undefined" ? null : window;
_createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
return null;
}
let suffix = null;
const ATTR_NAME = "data-tt-policy-suffix";
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
suffix = purifyHostElement.getAttribute(ATTR_NAME);
}
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
try {
return trustedTypes.createPolicy(policyName, {
createHTML(html2) {
return html2;
},
createScriptURL(scriptUrl) {
return scriptUrl;
}
});
} catch (_) {
console.warn("TrustedTypes policy " + policyName + " could not be created.");
return null;
}
};
purify = createDOMPurify();
version = purify.version;
isSupported = purify.isSupported;
sanitize = purify.sanitize;
setConfig = purify.setConfig;
clearConfig = purify.clearConfig;
isValidAttribute = purify.isValidAttribute;
addHook = purify.addHook;
removeHook = purify.removeHook;
removeHooks = purify.removeHooks;
removeAllHooks = purify.removeAllHooks;
}
});
// node_modules/monaco-editor/esm/vs/base/common/network.js
function matchesScheme(target, scheme) {
if (URI.isUri(target)) {
return equalsIgnoreCase(target.scheme, scheme);
} else {
return startsWithIgnoreCase(target, scheme + ":");
}
}
function matchesSomeScheme(target, ...schemes) {
return schemes.some((scheme) => matchesScheme(target, scheme));
}
var Schemas, connectionTokenQueryName, RemoteAuthoritiesImpl, RemoteAuthorities, VSCODE_AUTHORITY, FileAccessImpl, FileAccess, COI;
var init_network = __esm({
"node_modules/monaco-editor/esm/vs/base/common/network.js"() {
init_errors();
init_platform();
init_strings();
init_uri();
init_path();
(function(Schemas2) {
Schemas2.inMemory = "inmemory";
Schemas2.vscode = "vscode";
Schemas2.internal = "private";
Schemas2.walkThrough = "walkThrough";
Schemas2.walkThroughSnippet = "walkThroughSnippet";
Schemas2.http = "http";
Schemas2.https = "https";
Schemas2.file = "file";
Schemas2.mailto = "mailto";
Schemas2.untitled = "untitled";
Schemas2.data = "data";
Schemas2.command = "command";
Schemas2.vscodeRemote = "vscode-remote";
Schemas2.vscodeRemoteResource = "vscode-remote-resource";
Schemas2.vscodeManagedRemoteResource = "vscode-managed-remote-resource";
Schemas2.vscodeUserData = "vscode-userdata";
Schemas2.vscodeCustomEditor = "vscode-custom-editor";
Schemas2.vscodeNotebookCell = "vscode-notebook-cell";
Schemas2.vscodeNotebookCellMetadata = "vscode-notebook-cell-metadata";
Schemas2.vscodeNotebookCellOutput = "vscode-notebook-cell-output";
Schemas2.vscodeInteractiveInput = "vscode-interactive-input";
Schemas2.vscodeSettings = "vscode-settings";
Schemas2.vscodeWorkspaceTrust = "vscode-workspace-trust";
Schemas2.vscodeTerminal = "vscode-terminal";
Schemas2.vscodeChatCodeBlock = "vscode-chat-code-block";
Schemas2.vscodeCopilotBackingChatCodeBlock = "vscode-copilot-chat-code-block";
Schemas2.vscodeChatCodeCompareBlock = "vscode-chat-code-compare-block";
Schemas2.vscodeChatSesssion = "vscode-chat-editor";
Schemas2.webviewPanel = "webview-panel";
Schemas2.vscodeWebview = "vscode-webview";
Schemas2.extension = "extension";
Schemas2.vscodeFileResource = "vscode-file";
Schemas2.tmp = "tmp";
Schemas2.vsls = "vsls";
Schemas2.vscodeSourceControl = "vscode-scm";
Schemas2.commentsInput = "comment";
Schemas2.codeSetting = "code-setting";
})(Schemas || (Schemas = {}));
connectionTokenQueryName = "tkn";
RemoteAuthoritiesImpl = class {
constructor() {
this._hosts = /* @__PURE__ */ Object.create(null);
this._ports = /* @__PURE__ */ Object.create(null);
this._connectionTokens = /* @__PURE__ */ Object.create(null);
this._preferredWebSchema = "http";
this._delegate = null;
this._serverRootPath = "/";
}
setPreferredWebSchema(schema) {
this._preferredWebSchema = schema;
}
get _remoteResourcesPath() {
return posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);
}
rewrite(uri) {
if (this._delegate) {
try {
return this._delegate(uri);
} catch (err) {
onUnexpectedError(err);
return uri;
}
}
const authority = uri.authority;
let host = this._hosts[authority];
if (host && host.indexOf(":") !== -1 && host.indexOf("[") === -1) {
host = `[${host}]`;
}
const port = this._ports[authority];
const connectionToken = this._connectionTokens[authority];
let query = `path=${encodeURIComponent(uri.path)}`;
if (typeof connectionToken === "string") {
query += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;
}
return URI.from({
scheme: isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
authority: `${host}:${port}`,
path: this._remoteResourcesPath,
query
});
}
};
RemoteAuthorities = new RemoteAuthoritiesImpl();
VSCODE_AUTHORITY = "vscode-app";
FileAccessImpl = class _FileAccessImpl {
/**
* Returns a URI to use in contexts where the browser is responsible
* for loading (e.g. fetch()) or when used within the DOM.
*
* **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.
*/
uriToBrowserUri(uri) {
if (uri.scheme === Schemas.vscodeRemote) {
return RemoteAuthorities.rewrite(uri);
}
if (
// ...only ever for `file` resources
uri.scheme === Schemas.file && // ...and we run in native environments
(isNative || // ...or web worker extensions on desktop
webWorkerOrigin === `${Schemas.vscodeFileResource}://${_FileAccessImpl.FALLBACK_AUTHORITY}`)
) {
return uri.with({
scheme: Schemas.vscodeFileResource,
// We need to provide an authority here so that it can serve
// as origin for network and loading matters in chromium.
// If the URI is not coming with an authority already, we
// add our own
authority: uri.authority || _FileAccessImpl.FALLBACK_AUTHORITY,
query: null,
fragment: null
});
}
return uri;
}
};
FileAccessImpl.FALLBACK_AUTHORITY = VSCODE_AUTHORITY;
FileAccess = new FileAccessImpl();
(function(COI2) {
const coiHeaders = /* @__PURE__ */ 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" }]
]);
COI2.CoopAndCoep = Object.freeze(coiHeaders.get("3"));
const coiSearchParamName = "vscode-coi";
function getHeadersFromQuery(url) {
let params;
if (typeof url === "string") {
params = new URL(url).searchParams;
} else if (url instanceof URL) {
params = url.searchParams;
} else if (URI.isUri(url)) {
params = new URL(url.toString(true)).searchParams;
}
const value = params === null || params === void 0 ? void 0 : params.get(coiSearchParamName);
if (!value) {
return void 0;
}
return coiHeaders.get(value);
}
COI2.getHeadersFromQuery = getHeadersFromQuery;
function addSearchParam(urlOrSearch, coop, coep) {
if (!globalThis.crossOriginIsolated) {
return;
}
const value = coop && coep ? "3" : coep ? "2" : "1";
if (urlOrSearch instanceof URLSearchParams) {
urlOrSearch.set(coiSearchParamName, value);
} else {
urlOrSearch[coiSearchParamName] = value;
}
}
COI2.addSearchParam = addSearchParam;
})(COI || (COI = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/common/hash.js
function hash(obj) {
return doHash(obj, 0);
}
function doHash(obj, hashVal) {
switch (typeof obj) {
case "object":
if (obj === null) {
return numberHash(349, hashVal);
} else if (Array.isArray(obj)) {
return arrayHash(obj, hashVal);
}
return objectHash(obj, hashVal);
case "string":
return stringHash(obj, hashVal);
case "boolean":
return booleanHash(obj, hashVal);
case "number":
return numberHash(obj, hashVal);
case "undefined":
return numberHash(937, hashVal);
default:
return numberHash(617, hashVal);
}
}
function numberHash(val, initialHashVal) {
return (initialHashVal << 5) - initialHashVal + val | 0;
}
function booleanHash(b, initialHashVal) {
return numberHash(b ? 433 : 863, initialHashVal);
}
function stringHash(s, hashVal) {
hashVal = numberHash(149417, hashVal);
for (let i = 0, length = s.length; i < length; i++) {
hashVal = numberHash(s.charCodeAt(i), hashVal);
}
return hashVal;
}
function arrayHash(arr, initialHashVal) {
initialHashVal = numberHash(104579, initialHashVal);
return arr.reduce((hashVal, item) => doHash(item, hashVal), initialHashVal);
}
function objectHash(obj, initialHashVal) {
initialHashVal = numberHash(181387, initialHashVal);
return Object.keys(obj).sort().reduce((hashVal, key) => {
hashVal = stringHash(key, hashVal);
return doHash(obj[key], hashVal);
}, initialHashVal);
}
function leftRotate(value, bits, totalBits = 32) {
const delta = totalBits - bits;
const mask = ~((1 << delta) - 1);
return (value << bits | (mask & value) >>> delta) >>> 0;
}
function fill(dest, index = 0, count = dest.byteLength, value = 0) {
for (let i = 0; i < count; i++) {
dest[index + i] = value;
}
}
function leftPad(value, length, char = "0") {
while (value.length < length) {
value = char + value;
}
return value;
}
function toHexString(bufferOrValue, bitsize = 32) {
if (bufferOrValue instanceof ArrayBuffer) {
return Array.from(new Uint8Array(bufferOrValue)).map((b) => b.toString(16).padStart(2, "0")).join("");
}
return leftPad((bufferOrValue >>> 0).toString(16), bitsize / 4);
}
var StringSHA1;
var init_hash = __esm({
"node_modules/monaco-editor/esm/vs/base/common/hash.js"() {
init_strings();
StringSHA1 = class _StringSHA1 {
constructor() {
this._h0 = 1732584193;
this._h1 = 4023233417;
this._h2 = 2562383102;
this._h3 = 271733878;
this._h4 = 3285377520;
this._buff = new Uint8Array(
64 + 3
/* to fit any utf-8 */
);
this._buffDV = new DataView(this._buff.buffer);
this._buffLen = 0;
this._totalLen = 0;
this._leftoverHighSurrogate = 0;
this._finished = false;
}
update(str) {
const strLen = str.length;
if (strLen === 0) {
return;
}
const buff = this._buff;
let buffLen = this._buffLen;
let leftoverHighSurrogate = this._leftoverHighSurrogate;
let charCode;
let offset;
if (leftoverHighSurrogate !== 0) {
charCode = leftoverHighSurrogate;
offset = -1;
leftoverHighSurrogate = 0;
} else {
charCode = str.charCodeAt(0);
offset = 0;
}
while (true) {
let codePoint = charCode;
if (isHighSurrogate(charCode)) {
if (offset + 1 < strLen) {
const nextCharCode = str.charCodeAt(offset + 1);
if (isLowSurrogate(nextCharCode)) {
offset++;
codePoint = computeCodePoint(charCode, nextCharCode);
} else {
codePoint = 65533;
}
} else {
leftoverHighSurrogate = charCode;
break;
}
} else if (isLowSurrogate(charCode)) {
codePoint = 65533;
}
buffLen = this._push(buff, buffLen, codePoint);
offset++;
if (offset < strLen) {
charCode = str.charCodeAt(offset);
} else {
break;
}
}
this._buffLen = buffLen;
this._leftoverHighSurrogate = leftoverHighSurrogate;
}
_push(buff, buffLen, codePoint) {
if (codePoint < 128) {
buff[buffLen++] = codePoint;
} else if (codePoint < 2048) {
buff[buffLen++] = 192 | (codePoint & 1984) >>> 6;
buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
} else if (codePoint < 65536) {
buff[buffLen++] = 224 | (codePoint & 61440) >>> 12;
buff[buffLen++] = 128 | (codePoint & 4032) >>> 6;
buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
} else {
buff[buffLen++] = 240 | (codePoint & 1835008) >>> 18;
buff[buffLen++] = 128 | (codePoint & 258048) >>> 12;
buff[buffLen++] = 128 | (codePoint & 4032) >>> 6;
buff[buffLen++] = 128 | (codePoint & 63) >>> 0;
}
if (buffLen >= 64) {
this._step();
buffLen -= 64;
this._totalLen += 64;
buff[0] = buff[64 + 0];
buff[1] = buff[64 + 1];
buff[2] = buff[64 + 2];
}
return buffLen;
}
digest() {
if (!this._finished) {
this._finished = true;
if (this._leftoverHighSurrogate) {
this._leftoverHighSurrogate = 0;
this._buffLen = this._push(
this._buff,
this._buffLen,
65533
/* SHA1Constant.UNICODE_REPLACEMENT */
);
}
this._totalLen += this._buffLen;
this._wrapUp();
}
return toHexString(this._h0) + toHexString(this._h1) + toHexString(this._h2) + toHexString(this._h3) + toHexString(this._h4);
}
_wrapUp() {
this._buff[this._buffLen++] = 128;
fill(this._buff, this._buffLen);
if (this._buffLen > 56) {
this._step();
fill(this._buff);
}
const ml = 8 * this._totalLen;
this._buffDV.setUint32(56, Math.floor(ml / 4294967296), false);
this._buffDV.setUint32(60, ml % 4294967296, false);
this._step();
}
_step() {
const bigBlock32 = _StringSHA1._bigBlock32;
const data = this._buffDV;
for (let j = 0; j < 64; j += 4) {
bigBlock32.setUint32(j, data.getUint32(j, false), false);
}
for (let j = 64; j < 320; j += 4) {
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);
}
let a3 = this._h0;
let b = this._h1;
let c = this._h2;
let d = this._h3;
let e = this._h4;
let f3, k;
let temp;
for (let j = 0; j < 80; j++) {
if (j < 20) {
f3 = b & c | ~b & d;
k = 1518500249;
} else if (j < 40) {
f3 = b ^ c ^ d;
k = 1859775393;
} else if (j < 60) {
f3 = b & c | b & d | c & d;
k = 2400959708;
} else {
f3 = b ^ c ^ d;
k = 3395469782;
}
temp = leftRotate(a3, 5) + f3 + e + k + bigBlock32.getUint32(j * 4, false) & 4294967295;
e = d;
d = c;
c = leftRotate(b, 30);
b = a3;
a3 = temp;
}
this._h0 = this._h0 + a3 & 4294967295;
this._h1 = this._h1 + b & 4294967295;
this._h2 = this._h2 + c & 4294967295;
this._h3 = this._h3 + d & 4294967295;
this._h4 = this._h4 + e & 4294967295;
}
};
StringSHA1._bigBlock32 = new DataView(new ArrayBuffer(320));
}
});
// node_modules/monaco-editor/esm/vs/base/browser/dom.js
function clearNode(node) {
while (node.firstChild) {
node.firstChild.remove();
}
}
function addDisposableListener(node, type, handler, useCaptureOrOptions) {
return new DomListener(node, type, handler, useCaptureOrOptions);
}
function _wrapAsStandardMouseEvent(targetWindow, handler) {
return function(e) {
return handler(new StandardMouseEvent(targetWindow, e));
};
}
function _wrapAsStandardKeyboardEvent(handler) {
return function(e) {
return handler(new StandardKeyboardEvent(e));
};
}
function addDisposableGenericMouseDownListener(node, handler, useCapture) {
return addDisposableListener(node, isIOS && BrowserFeatures.pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);
}
function runWhenWindowIdle(targetWindow, callback, timeout2) {
return _runWhenIdle(targetWindow, callback, timeout2);
}
function getComputedStyle(el) {
return getWindow(el).getComputedStyle(el, null);
}
function getClientArea(element, fallback2) {
const elWindow = getWindow(element);
const elDocument = elWindow.document;
if (element !== elDocument.body) {
return new Dimension(element.clientWidth, element.clientHeight);
}
if (isIOS && (elWindow === null || elWindow === void 0 ? void 0 : elWindow.visualViewport)) {
return new Dimension(elWindow.visualViewport.width, elWindow.visualViewport.height);
}
if ((elWindow === null || elWindow === void 0 ? void 0 : elWindow.innerWidth) && elWindow.innerHeight) {
return new Dimension(elWindow.innerWidth, elWindow.innerHeight);
}
if (elDocument.body && elDocument.body.clientWidth && elDocument.body.clientHeight) {
return new Dimension(elDocument.body.clientWidth, elDocument.body.clientHeight);
}
if (elDocument.documentElement && elDocument.documentElement.clientWidth && elDocument.documentElement.clientHeight) {
return new Dimension(elDocument.documentElement.clientWidth, elDocument.documentElement.clientHeight);
}
if (fallback2) {
return getClientArea(fallback2);
}
throw new Error("Unable to figure out browser width and height");
}
function getTopLeftOffset(element) {
let offsetParent = element.offsetParent;
let top = element.offsetTop;
let left = element.offsetLeft;
while ((element = element.parentNode) !== null && element !== element.ownerDocument.body && element !== element.ownerDocument.documentElement) {
top -= element.scrollTop;
const c = isShadowRoot(element) ? null : getComputedStyle(element);
if (c) {
left -= c.direction !== "rtl" ? element.scrollLeft : -element.scrollLeft;
}
if (element === offsetParent) {
left += SizeUtils.getBorderLeftWidth(element);
top += SizeUtils.getBorderTopWidth(element);
top += element.offsetTop;
left += element.offsetLeft;
offsetParent = element.offsetParent;
}
}
return {
left,
top
};
}
function size(element, width2, height) {
if (typeof width2 === "number") {
element.style.width = `${width2}px`;
}
if (typeof height === "number") {
element.style.height = `${height}px`;
}
}
function getDomNodePagePosition(domNode) {
const bb = domNode.getBoundingClientRect();
const window2 = getWindow(domNode);
return {
left: bb.left + window2.scrollX,
top: bb.top + window2.scrollY,
width: bb.width,
height: bb.height
};
}
function getDomNodeZoomLevel(domNode) {
let testElement = domNode;
let zoom = 1;
do {
const elementZoomLevel = getComputedStyle(testElement).zoom;
if (elementZoomLevel !== null && elementZoomLevel !== void 0 && elementZoomLevel !== "1") {
zoom *= elementZoomLevel;
}
testElement = testElement.parentElement;
} while (testElement !== null && testElement !== testElement.ownerDocument.documentElement);
return zoom;
}
function getTotalWidth(element) {
const margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);
return element.offsetWidth + margin;
}
function getContentWidth(element) {
const border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);
const padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);
return element.offsetWidth - border - padding;
}
function getContentHeight(element) {
const border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);
const padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);
return element.offsetHeight - border - padding;
}
function getTotalHeight(element) {
const margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);
return element.offsetHeight + margin;
}
function isAncestor(testChild, testAncestor) {
return Boolean(testAncestor === null || testAncestor === void 0 ? void 0 : testAncestor.contains(testChild));
}
function findParentWithClass(node, clazz, stopAtClazzOrNode) {
while (node && node.nodeType === node.ELEMENT_NODE) {
if (node.classList.contains(clazz)) {
return node;
}
if (stopAtClazzOrNode) {
if (typeof stopAtClazzOrNode === "string") {
if (node.classList.contains(stopAtClazzOrNode)) {
return null;
}
} else {
if (node === stopAtClazzOrNode) {
return null;
}
}
}
node = node.parentNode;
}
return null;
}
function hasParentWithClass(node, clazz, stopAtClazzOrNode) {
return !!findParentWithClass(node, clazz, stopAtClazzOrNode);
}
function isShadowRoot(node) {
return node && !!node.host && !!node.mode;
}
function isInShadowDOM(domNode) {
return !!getShadowRoot(domNode);
}
function getShadowRoot(domNode) {
var _a10;
while (domNode.parentNode) {
if (domNode === ((_a10 = domNode.ownerDocument) === null || _a10 === void 0 ? void 0 : _a10.body)) {
return null;
}
domNode = domNode.parentNode;
}
return isShadowRoot(domNode) ? domNode : null;
}
function getActiveElement() {
let result = getActiveDocument().activeElement;
while (result === null || result === void 0 ? void 0 : result.shadowRoot) {
result = result.shadowRoot.activeElement;
}
return result;
}
function isActiveElement(element) {
return getActiveElement() === element;
}
function isAncestorOfActiveElement(ancestor) {
return isAncestor(getActiveElement(), ancestor);
}
function getActiveDocument() {
var _a10;
if (getWindowsCount() <= 1) {
return mainWindow.document;
}
const documents = Array.from(getWindows()).map(({ window: window2 }) => window2.document);
return (_a10 = documents.find((doc) => doc.hasFocus())) !== null && _a10 !== void 0 ? _a10 : mainWindow.document;
}
function getActiveWindow() {
var _a10, _b4;
const document2 = getActiveDocument();
return (_b4 = (_a10 = document2.defaultView) === null || _a10 === void 0 ? void 0 : _a10.window) !== null && _b4 !== void 0 ? _b4 : mainWindow;
}
function createStyleSheet2() {
return new WrappedStyleElement();
}
function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) {
const style = document.createElement("style");
style.type = "text/css";
style.media = "screen";
beforeAppend === null || beforeAppend === void 0 ? void 0 : beforeAppend(style);
container.appendChild(style);
if (disposableStore) {
disposableStore.add(toDisposable(() => container.removeChild(style)));
}
if (container === mainWindow.document.head) {
const globalStylesheetClones = /* @__PURE__ */ new Set();
globalStylesheets.set(style, globalStylesheetClones);
for (const { window: targetWindow, disposables } of getWindows()) {
if (targetWindow === mainWindow) {
continue;
}
const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));
disposableStore === null || disposableStore === void 0 ? void 0 : disposableStore.add(cloneDisposable);
}
}
return style;
}
function cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, targetWindow) {
var _a10, _b4;
const disposables = new DisposableStore();
const clone2 = globalStylesheet.cloneNode(true);
targetWindow.document.head.appendChild(clone2);
disposables.add(toDisposable(() => targetWindow.document.head.removeChild(clone2)));
for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {
(_a10 = clone2.sheet) === null || _a10 === void 0 ? void 0 : _a10.insertRule(rule.cssText, (_b4 = clone2.sheet) === null || _b4 === void 0 ? void 0 : _b4.cssRules.length);
}
disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {
clone2.textContent = globalStylesheet.textContent;
}));
globalStylesheetClones.add(clone2);
disposables.add(toDisposable(() => globalStylesheetClones.delete(clone2)));
return disposables;
}
function getSharedStyleSheet() {
if (!_sharedStyleSheet) {
_sharedStyleSheet = createStyleSheet();
}
return _sharedStyleSheet;
}
function getDynamicStyleSheetRules(style) {
var _a10, _b4;
if ((_a10 = style === null || style === void 0 ? void 0 : style.sheet) === null || _a10 === void 0 ? void 0 : _a10.rules) {
return style.sheet.rules;
}
if ((_b4 = style === null || style === void 0 ? void 0 : style.sheet) === null || _b4 === void 0 ? void 0 : _b4.cssRules) {
return style.sheet.cssRules;
}
return [];
}
function createCSSRule(selector, cssText, style = getSharedStyleSheet()) {
var _a10, _b4;
if (!style || !cssText) {
return;
}
(_a10 = style.sheet) === null || _a10 === void 0 ? void 0 : _a10.insertRule(`${selector} {${cssText}}`, 0);
for (const clonedGlobalStylesheet of (_b4 = globalStylesheets.get(style)) !== null && _b4 !== void 0 ? _b4 : []) {
createCSSRule(selector, cssText, clonedGlobalStylesheet);
}
}
function removeCSSRulesContainingSelector(ruleName, style = getSharedStyleSheet()) {
var _a10, _b4;
if (!style) {
return;
}
const rules = getDynamicStyleSheetRules(style);
const toDelete = [];
for (let i = 0; i < rules.length; i++) {
const rule = rules[i];
if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {
toDelete.push(i);
}
}
for (let i = toDelete.length - 1; i >= 0; i--) {
(_a10 = style.sheet) === null || _a10 === void 0 ? void 0 : _a10.deleteRule(toDelete[i]);
}
for (const clonedGlobalStylesheet of (_b4 = globalStylesheets.get(style)) !== null && _b4 !== void 0 ? _b4 : []) {
removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);
}
}
function isCSSStyleRule(rule) {
return typeof rule.selectorText === "string";
}
function isHTMLElement(e) {
return e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement;
}
function isHTMLAnchorElement(e) {
return e instanceof HTMLAnchorElement || e instanceof getWindow(e).HTMLAnchorElement;
}
function isMouseEvent(e) {
return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent;
}
function isKeyboardEvent(e) {
return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;
}
function isEventLike(obj) {
const candidate = obj;
return !!(candidate && typeof candidate.preventDefault === "function" && typeof candidate.stopPropagation === "function");
}
function saveParentsScrollTop(node) {
const r = [];
for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
r[i] = node.scrollTop;
node = node.parentNode;
}
return r;
}
function restoreParentsScrollTop(node, state) {
for (let i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
if (node.scrollTop !== state[i]) {
node.scrollTop = state[i];
}
node = node.parentNode;
}
}
function trackFocus(element) {
return new FocusTracker(element);
}
function after(sibling, child) {
sibling.after(child);
return child;
}
function append(parent, ...children) {
parent.append(...children);
if (children.length === 1 && typeof children[0] !== "string") {
return children[0];
}
}
function prepend(parent, child) {
parent.insertBefore(child, parent.firstChild);
return child;
}
function reset(parent, ...children) {
parent.innerText = "";
append(parent, ...children);
}
function _$(namespace, description, attrs, ...children) {
const match2 = SELECTOR_REGEX.exec(description);
if (!match2) {
throw new Error("Bad use of emmet");
}
const tagName = match2[1] || "div";
let result;
if (namespace !== Namespace.HTML) {
result = document.createElementNS(namespace, tagName);
} else {
result = document.createElement(tagName);
}
if (match2[3]) {
result.id = match2[3];
}
if (match2[4]) {
result.className = match2[4].replace(/\./g, " ").trim();
}
if (attrs) {
Object.entries(attrs).forEach(([name, value]) => {
if (typeof value === "undefined") {
return;
}
if (/^on\w+$/.test(name)) {
result[name] = value;
} else if (name === "selected") {
if (value) {
result.setAttribute(name, "true");
}
} else {
result.setAttribute(name, value);
}
});
}
result.append(...children);
return result;
}
function $(description, attrs, ...children) {
return _$(Namespace.HTML, description, attrs, ...children);
}
function setVisibility(visible, ...elements) {
if (visible) {
show(...elements);
} else {
hide(...elements);
}
}
function show(...elements) {
for (const element of elements) {
element.style.display = "";
element.removeAttribute("aria-hidden");
}
}
function hide(...elements) {
for (const element of elements) {
element.style.display = "none";
element.setAttribute("aria-hidden", "true");
}
}
function computeScreenAwareSize(window2, cssPx) {
const screenPx = window2.devicePixelRatio * cssPx;
return Math.max(1, Math.floor(screenPx)) / window2.devicePixelRatio;
}
function windowOpenNoOpener(url) {
mainWindow.open(url, "_blank", "noopener");
}
function animate(targetWindow, fn) {
const step = () => {
fn();
stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);
};
let stepDisposable = scheduleAtNextAnimationFrame(targetWindow, step);
return toDisposable(() => stepDisposable.dispose());
}
function asCSSUrl(uri) {
if (!uri) {
return `url('')`;
}
return `url('${FileAccess.uriToBrowserUri(uri).toString(true).replace(/'/g, "%27")}')`;
}
function asCSSPropertyValue(value) {
return `'${value.replace(/'/g, "%27")}'`;
}
function asCssValueWithDefault(cssPropertyValue, dflt) {
if (cssPropertyValue !== void 0) {
const variableMatch = cssPropertyValue.match(/^\s*var\((.+)\)$/);
if (variableMatch) {
const varArguments = variableMatch[1].split(",", 2);
if (varArguments.length === 2) {
dflt = asCssValueWithDefault(varArguments[1].trim(), dflt);
}
return `var(${varArguments[0]}, ${dflt})`;
}
return cssPropertyValue;
}
return dflt;
}
function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) {
const anchor = document.createElement("a");
addHook("afterSanitizeAttributes", (node) => {
for (const attr of ["href", "src"]) {
if (node.hasAttribute(attr)) {
const attrValue = node.getAttribute(attr);
if (attr === "href" && attrValue.startsWith("#")) {
continue;
}
anchor.href = attrValue;
if (!allowedProtocols.includes(anchor.protocol.replace(/:$/, ""))) {
if (allowDataImages && attr === "src" && anchor.href.startsWith("data:")) {
continue;
}
node.removeAttribute(attr);
}
}
}
});
return toDisposable(() => {
removeHook("afterSanitizeAttributes");
});
}
function h(tag, ...args) {
let attributes;
let children;
if (Array.isArray(args[0])) {
attributes = {};
children = args[0];
} else {
attributes = args[0] || {};
children = args[1];
}
const match2 = H_REGEX.exec(tag);
if (!match2 || !match2.groups) {
throw new Error("Bad use of h");
}
const tagName = match2.groups["tag"] || "div";
const el = document.createElement(tagName);
if (match2.groups["id"]) {
el.id = match2.groups["id"];
}
const classNames = [];
if (match2.groups["class"]) {
for (const className of match2.groups["class"].split(".")) {
if (className !== "") {
classNames.push(className);
}
}
}
if (attributes.className !== void 0) {
for (const className of attributes.className.split(".")) {
if (className !== "") {
classNames.push(className);
}
}
}
if (classNames.length > 0) {
el.className = classNames.join(" ");
}
const result = {};
if (match2.groups["name"]) {
result[match2.groups["name"]] = el;
}
if (children) {
for (const c of children) {
if (isHTMLElement(c)) {
el.appendChild(c);
} else if (typeof c === "string") {
el.append(c);
} else if ("root" in c) {
Object.assign(result, c);
el.appendChild(c.root);
}
}
}
for (const [key, value] of Object.entries(attributes)) {
if (key === "className") {
continue;
} else if (key === "style") {
for (const [cssKey, cssValue] of Object.entries(value)) {
el.style.setProperty(camelCaseToHyphenCase(cssKey), typeof cssValue === "number" ? cssValue + "px" : "" + cssValue);
}
} else if (key === "tabIndex") {
el.tabIndex = value;
} else {
el.setAttribute(camelCaseToHyphenCase(key), value.toString());
}
}
result["root"] = el;
return result;
}
function camelCaseToHyphenCase(str) {
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
}
var registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow, DomListener, addStandardDisposableListener, addStandardDisposableGenericMouseDownListener, WindowIdleValue, runAtThisOrScheduleAtNextAnimationFrame, scheduleAtNextAnimationFrame, WindowIntervalTimer, AnimationFrameQueueItem, SizeUtils, Dimension, globalStylesheets, WrappedStyleElement, sharedMutationObserver, _sharedStyleSheet, EventType, EventHelper, FocusTracker, SELECTOR_REGEX, Namespace, basicMarkupHtmlTags, defaultDomPurifyConfig, ModifierKeyEmitter, DragAndDropObserver, H_REGEX;
var init_dom = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/dom.js"() {
init_browser();
init_canIUse();
init_keyboardEvent();
init_mouseEvent();
init_async();
init_errors();
init_event();
init_dompurify();
init_lifecycle();
init_network();
init_platform();
init_hash();
init_window();
({ registerWindow, getWindow, getDocument, getWindows, getWindowsCount, getWindowId, getWindowById, hasWindow, onDidRegisterWindow, onWillUnregisterWindow, onDidUnregisterWindow } = function() {
const windows = /* @__PURE__ */ new Map();
ensureCodeWindow(mainWindow, 1);
const mainWindowRegistration = { window: mainWindow, disposables: new DisposableStore() };
windows.set(mainWindow.vscodeWindowId, mainWindowRegistration);
const onDidRegisterWindow2 = new Emitter();
const onDidUnregisterWindow2 = new Emitter();
const onWillUnregisterWindow2 = new Emitter();
function getWindowById2(windowId, fallbackToMain) {
const window2 = typeof windowId === "number" ? windows.get(windowId) : void 0;
return window2 !== null && window2 !== void 0 ? window2 : fallbackToMain ? mainWindowRegistration : void 0;
}
return {
onDidRegisterWindow: onDidRegisterWindow2.event,
onWillUnregisterWindow: onWillUnregisterWindow2.event,
onDidUnregisterWindow: onDidUnregisterWindow2.event,
registerWindow(window2) {
if (windows.has(window2.vscodeWindowId)) {
return Disposable.None;
}
const disposables = new DisposableStore();
const registeredWindow = {
window: window2,
disposables: disposables.add(new DisposableStore())
};
windows.set(window2.vscodeWindowId, registeredWindow);
disposables.add(toDisposable(() => {
windows.delete(window2.vscodeWindowId);
onDidUnregisterWindow2.fire(window2);
}));
disposables.add(addDisposableListener(window2, EventType.BEFORE_UNLOAD, () => {
onWillUnregisterWindow2.fire(window2);
}));
onDidRegisterWindow2.fire(registeredWindow);
return disposables;
},
getWindows() {
return windows.values();
},
getWindowsCount() {
return windows.size;
},
getWindowId(targetWindow) {
return targetWindow.vscodeWindowId;
},
hasWindow(windowId) {
return windows.has(windowId);
},
getWindowById: getWindowById2,
getWindow(e) {
var _a10;
const candidateNode = e;
if ((_a10 = candidateNode === null || candidateNode === void 0 ? void 0 : candidateNode.ownerDocument) === null || _a10 === void 0 ? void 0 : _a10.defaultView) {
return candidateNode.ownerDocument.defaultView.window;
}
const candidateEvent = e;
if (candidateEvent === null || candidateEvent === void 0 ? void 0 : candidateEvent.view) {
return candidateEvent.view.window;
}
return mainWindow;
},
getDocument(e) {
const candidateNode = e;
return getWindow(candidateNode).document;
}
};
}());
DomListener = class {
constructor(node, type, handler, options2) {
this._node = node;
this._type = type;
this._handler = handler;
this._options = options2 || false;
this._node.addEventListener(this._type, this._handler, this._options);
}
dispose() {
if (!this._handler) {
return;
}
this._node.removeEventListener(this._type, this._handler, this._options);
this._node = null;
this._handler = null;
}
};
addStandardDisposableListener = function addStandardDisposableListener2(node, type, handler, useCapture) {
let wrapHandler = handler;
if (type === "click" || type === "mousedown" || type === "contextmenu") {
wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);
} else if (type === "keydown" || type === "keypress" || type === "keyup") {
wrapHandler = _wrapAsStandardKeyboardEvent(handler);
}
return addDisposableListener(node, type, wrapHandler, useCapture);
};
addStandardDisposableGenericMouseDownListener = function addStandardDisposableListener3(node, handler, useCapture) {
const wrapHandler = _wrapAsStandardMouseEvent(getWindow(node), handler);
return addDisposableGenericMouseDownListener(node, wrapHandler, useCapture);
};
WindowIdleValue = class extends AbstractIdleValue {
constructor(targetWindow, executor) {
super(targetWindow, executor);
}
};
WindowIntervalTimer = class extends IntervalTimer {
/**
*
* @param node The optional node from which the target window is determined
*/
constructor(node) {
super();
this.defaultTarget = node && getWindow(node);
}
cancelAndSet(runner, interval, targetWindow) {
return super.cancelAndSet(runner, interval, targetWindow !== null && targetWindow !== void 0 ? targetWindow : this.defaultTarget);
}
};
AnimationFrameQueueItem = class {
constructor(runner, priority = 0) {
this._runner = runner;
this.priority = priority;
this._canceled = false;
}
dispose() {
this._canceled = true;
}
execute() {
if (this._canceled) {
return;
}
try {
this._runner();
} catch (e) {
onUnexpectedError(e);
}
}
// Sort by priority (largest to lowest)
static sort(a3, b) {
return b.priority - a3.priority;
}
};
(function() {
const NEXT_QUEUE = /* @__PURE__ */ new Map();
const CURRENT_QUEUE = /* @__PURE__ */ new Map();
const animFrameRequested = /* @__PURE__ */ new Map();
const inAnimationFrameRunner = /* @__PURE__ */ new Map();
const animationFrameRunner = (targetWindowId) => {
var _a10;
animFrameRequested.set(targetWindowId, false);
const currentQueue = (_a10 = NEXT_QUEUE.get(targetWindowId)) !== null && _a10 !== void 0 ? _a10 : [];
CURRENT_QUEUE.set(targetWindowId, currentQueue);
NEXT_QUEUE.set(targetWindowId, []);
inAnimationFrameRunner.set(targetWindowId, true);
while (currentQueue.length > 0) {
currentQueue.sort(AnimationFrameQueueItem.sort);
const top = currentQueue.shift();
top.execute();
}
inAnimationFrameRunner.set(targetWindowId, false);
};
scheduleAtNextAnimationFrame = (targetWindow, runner, priority = 0) => {
const targetWindowId = getWindowId(targetWindow);
const item = new AnimationFrameQueueItem(runner, priority);
let nextQueue = NEXT_QUEUE.get(targetWindowId);
if (!nextQueue) {
nextQueue = [];
NEXT_QUEUE.set(targetWindowId, nextQueue);
}
nextQueue.push(item);
if (!animFrameRequested.get(targetWindowId)) {
animFrameRequested.set(targetWindowId, true);
targetWindow.requestAnimationFrame(() => animationFrameRunner(targetWindowId));
}
return item;
};
runAtThisOrScheduleAtNextAnimationFrame = (targetWindow, runner, priority) => {
const targetWindowId = getWindowId(targetWindow);
if (inAnimationFrameRunner.get(targetWindowId)) {
const item = new AnimationFrameQueueItem(runner, priority);
let currentQueue = CURRENT_QUEUE.get(targetWindowId);
if (!currentQueue) {
currentQueue = [];
CURRENT_QUEUE.set(targetWindowId, currentQueue);
}
currentQueue.push(item);
return item;
} else {
return scheduleAtNextAnimationFrame(targetWindow, runner, priority);
}
};
})();
SizeUtils = class _SizeUtils {
// Adapted from WinJS
// Converts a CSS positioning string for the specified element to pixels.
static convertToPixels(element, value) {
return parseFloat(value) || 0;
}
static getDimension(element, cssPropertyName, jsPropertyName) {
const computedStyle = getComputedStyle(element);
const value = computedStyle ? computedStyle.getPropertyValue(cssPropertyName) : "0";
return _SizeUtils.convertToPixels(element, value);
}
static getBorderLeftWidth(element) {
return _SizeUtils.getDimension(element, "border-left-width", "borderLeftWidth");
}
static getBorderRightWidth(element) {
return _SizeUtils.getDimension(element, "border-right-width", "borderRightWidth");
}
static getBorderTopWidth(element) {
return _SizeUtils.getDimension(element, "border-top-width", "borderTopWidth");
}
static getBorderBottomWidth(element) {
return _SizeUtils.getDimension(element, "border-bottom-width", "borderBottomWidth");
}
static getPaddingLeft(element) {
return _SizeUtils.getDimension(element, "padding-left", "paddingLeft");
}
static getPaddingRight(element) {
return _SizeUtils.getDimension(element, "padding-right", "paddingRight");
}
static getPaddingTop(element) {
return _SizeUtils.getDimension(element, "padding-top", "paddingTop");
}
static getPaddingBottom(element) {
return _SizeUtils.getDimension(element, "padding-bottom", "paddingBottom");
}
static getMarginLeft(element) {
return _SizeUtils.getDimension(element, "margin-left", "marginLeft");
}
static getMarginTop(element) {
return _SizeUtils.getDimension(element, "margin-top", "marginTop");
}
static getMarginRight(element) {
return _SizeUtils.getDimension(element, "margin-right", "marginRight");
}
static getMarginBottom(element) {
return _SizeUtils.getDimension(element, "margin-bottom", "marginBottom");
}
};
Dimension = class _Dimension {
constructor(width2, height) {
this.width = width2;
this.height = height;
}
with(width2 = this.width, height = this.height) {
if (width2 !== this.width || height !== this.height) {
return new _Dimension(width2, height);
} else {
return this;
}
}
static is(obj) {
return typeof obj === "object" && typeof obj.height === "number" && typeof obj.width === "number";
}
static lift(obj) {
if (obj instanceof _Dimension) {
return obj;
} else {
return new _Dimension(obj.width, obj.height);
}
}
static equals(a3, b) {
if (a3 === b) {
return true;
}
if (!a3 || !b) {
return false;
}
return a3.width === b.width && a3.height === b.height;
}
};
Dimension.None = new Dimension(0, 0);
globalStylesheets = /* @__PURE__ */ new Map();
WrappedStyleElement = class {
constructor() {
this._currentCssStyle = "";
this._styleSheet = void 0;
}
setStyle(cssStyle) {
if (cssStyle === this._currentCssStyle) {
return;
}
this._currentCssStyle = cssStyle;
if (!this._styleSheet) {
this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);
} else {
this._styleSheet.innerText = cssStyle;
}
}
dispose() {
if (this._styleSheet) {
this._styleSheet.remove();
this._styleSheet = void 0;
}
}
};
sharedMutationObserver = new class {
constructor() {
this.mutationObservers = /* @__PURE__ */ new Map();
}
observe(target, disposables, options2) {
let mutationObserversPerTarget = this.mutationObservers.get(target);
if (!mutationObserversPerTarget) {
mutationObserversPerTarget = /* @__PURE__ */ new Map();
this.mutationObservers.set(target, mutationObserversPerTarget);
}
const optionsHash = hash(options2);
let mutationObserverPerOptions = mutationObserversPerTarget.get(optionsHash);
if (!mutationObserverPerOptions) {
const onDidMutate = new Emitter();
const observer = new MutationObserver((mutations) => onDidMutate.fire(mutations));
observer.observe(target, options2);
const resolvedMutationObserverPerOptions = mutationObserverPerOptions = {
users: 1,
observer,
onDidMutate: onDidMutate.event
};
disposables.add(toDisposable(() => {
resolvedMutationObserverPerOptions.users -= 1;
if (resolvedMutationObserverPerOptions.users === 0) {
onDidMutate.dispose();
observer.disconnect();
mutationObserversPerTarget === null || mutationObserversPerTarget === void 0 ? void 0 : mutationObserversPerTarget.delete(optionsHash);
if ((mutationObserversPerTarget === null || mutationObserversPerTarget === void 0 ? void 0 : mutationObserversPerTarget.size) === 0) {
this.mutationObservers.delete(target);
}
}
}));
mutationObserversPerTarget.set(optionsHash, mutationObserverPerOptions);
} else {
mutationObserverPerOptions.users += 1;
}
return mutationObserverPerOptions.onDidMutate;
}
}();
_sharedStyleSheet = null;
EventType = {
// Mouse
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",
// Keyboard
KEY_DOWN: "keydown",
KEY_PRESS: "keypress",
KEY_UP: "keyup",
// HTML Document
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",
// Form
SELECT: "select",
CHANGE: "change",
SUBMIT: "submit",
RESET: "reset",
FOCUS: "focus",
FOCUS_IN: "focusin",
FOCUS_OUT: "focusout",
BLUR: "blur",
INPUT: "input",
// Local Storage
STORAGE: "storage",
// Drag
DRAG_START: "dragstart",
DRAG: "drag",
DRAG_ENTER: "dragenter",
DRAG_LEAVE: "dragleave",
DRAG_OVER: "dragover",
DROP: "drop",
DRAG_END: "dragend",
// Animation
ANIMATION_START: isWebKit ? "webkitAnimationStart" : "animationstart",
ANIMATION_END: isWebKit ? "webkitAnimationEnd" : "animationend",
ANIMATION_ITERATION: isWebKit ? "webkitAnimationIteration" : "animationiteration"
};
EventHelper = {
stop: (e, cancelBubble) => {
e.preventDefault();
if (cancelBubble) {
e.stopPropagation();
}
return e;
}
};
FocusTracker = class _FocusTracker extends Disposable {
static hasFocusWithin(element) {
if (isHTMLElement(element)) {
const shadowRoot = getShadowRoot(element);
const activeElement = shadowRoot ? shadowRoot.activeElement : element.ownerDocument.activeElement;
return isAncestor(activeElement, element);
} else {
const window2 = element;
return isAncestor(window2.document.activeElement, window2.document);
}
}
constructor(element) {
super();
this._onDidFocus = this._register(new Emitter());
this.onDidFocus = this._onDidFocus.event;
this._onDidBlur = this._register(new Emitter());
this.onDidBlur = this._onDidBlur.event;
let hasFocus = _FocusTracker.hasFocusWithin(element);
let loosingFocus = false;
const onFocus = () => {
loosingFocus = false;
if (!hasFocus) {
hasFocus = true;
this._onDidFocus.fire();
}
};
const onBlur = () => {
if (hasFocus) {
loosingFocus = true;
(isHTMLElement(element) ? getWindow(element) : element).setTimeout(() => {
if (loosingFocus) {
loosingFocus = false;
hasFocus = false;
this._onDidBlur.fire();
}
}, 0);
}
};
this._refreshStateHandler = () => {
const currentNodeHasFocus = _FocusTracker.hasFocusWithin(element);
if (currentNodeHasFocus !== hasFocus) {
if (hasFocus) {
onBlur();
} else {
onFocus();
}
}
};
this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));
this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));
if (isHTMLElement(element)) {
this._register(addDisposableListener(element, EventType.FOCUS_IN, () => this._refreshStateHandler()));
this._register(addDisposableListener(element, EventType.FOCUS_OUT, () => this._refreshStateHandler()));
}
}
};
SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;
(function(Namespace3) {
Namespace3["HTML"] = "http://www.w3.org/1999/xhtml";
Namespace3["SVG"] = "http://www.w3.org/2000/svg";
})(Namespace || (Namespace = {}));
$.SVG = function(description, attrs, ...children) {
return _$(Namespace.SVG, description, attrs, ...children);
};
RemoteAuthorities.setPreferredWebSchema(/^https:/.test(mainWindow.location.href) ? "https" : "http");
basicMarkupHtmlTags = 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"
]);
defaultDomPurifyConfig = 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: false,
RETURN_DOM_FRAGMENT: false,
RETURN_TRUSTED_TYPE: true
});
ModifierKeyEmitter = class _ModifierKeyEmitter extends Emitter {
constructor() {
super();
this._subscriptions = new DisposableStore();
this._keyStatus = {
altKey: false,
shiftKey: false,
ctrlKey: false,
metaKey: false
};
this._subscriptions.add(Event.runAndSubscribe(onDidRegisterWindow, ({ window: window2, disposables }) => this.registerListeners(window2, disposables), { window: mainWindow, disposables: this._subscriptions }));
}
registerListeners(window2, disposables) {
disposables.add(addDisposableListener(window2, "keydown", (e) => {
if (e.defaultPrevented) {
return;
}
const event = new StandardKeyboardEvent(e);
if (event.keyCode === 6 && e.repeat) {
return;
}
if (e.altKey && !this._keyStatus.altKey) {
this._keyStatus.lastKeyPressed = "alt";
} else if (e.ctrlKey && !this._keyStatus.ctrlKey) {
this._keyStatus.lastKeyPressed = "ctrl";
} else if (e.metaKey && !this._keyStatus.metaKey) {
this._keyStatus.lastKeyPressed = "meta";
} else if (e.shiftKey && !this._keyStatus.shiftKey) {
this._keyStatus.lastKeyPressed = "shift";
} else if (event.keyCode !== 6) {
this._keyStatus.lastKeyPressed = void 0;
} else {
return;
}
this._keyStatus.altKey = e.altKey;
this._keyStatus.ctrlKey = e.ctrlKey;
this._keyStatus.metaKey = e.metaKey;
this._keyStatus.shiftKey = e.shiftKey;
if (this._keyStatus.lastKeyPressed) {
this._keyStatus.event = e;
this.fire(this._keyStatus);
}
}, true));
disposables.add(addDisposableListener(window2, "keyup", (e) => {
if (e.defaultPrevented) {
return;
}
if (!e.altKey && this._keyStatus.altKey) {
this._keyStatus.lastKeyReleased = "alt";
} else if (!e.ctrlKey && this._keyStatus.ctrlKey) {
this._keyStatus.lastKeyReleased = "ctrl";
} else if (!e.metaKey && this._keyStatus.metaKey) {
this._keyStatus.lastKeyReleased = "meta";
} else if (!e.shiftKey && this._keyStatus.shiftKey) {
this._keyStatus.lastKeyReleased = "shift";
} else {
this._keyStatus.lastKeyReleased = void 0;
}
if (this._keyStatus.lastKeyPressed !== this._keyStatus.lastKeyReleased) {
this._keyStatus.lastKeyPressed = void 0;
}
this._keyStatus.altKey = e.altKey;
this._keyStatus.ctrlKey = e.ctrlKey;
this._keyStatus.metaKey = e.metaKey;
this._keyStatus.shiftKey = e.shiftKey;
if (this._keyStatus.lastKeyReleased) {
this._keyStatus.event = e;
this.fire(this._keyStatus);
}
}, true));
disposables.add(addDisposableListener(window2.document.body, "mousedown", () => {
this._keyStatus.lastKeyPressed = void 0;
}, true));
disposables.add(addDisposableListener(window2.document.body, "mouseup", () => {
this._keyStatus.lastKeyPressed = void 0;
}, true));
disposables.add(addDisposableListener(window2.document.body, "mousemove", (e) => {
if (e.buttons) {
this._keyStatus.lastKeyPressed = void 0;
}
}, true));
disposables.add(addDisposableListener(window2, "blur", () => {
this.resetKeyStatus();
}));
}
get keyStatus() {
return this._keyStatus;
}
/**
* Allows to explicitly reset the key status based on more knowledge (#109062)
*/
resetKeyStatus() {
this.doResetKeyStatus();
this.fire(this._keyStatus);
}
doResetKeyStatus() {
this._keyStatus = {
altKey: false,
shiftKey: false,
ctrlKey: false,
metaKey: false
};
}
static getInstance() {
if (!_ModifierKeyEmitter.instance) {
_ModifierKeyEmitter.instance = new _ModifierKeyEmitter();
}
return _ModifierKeyEmitter.instance;
}
dispose() {
super.dispose();
this._subscriptions.dispose();
}
};
DragAndDropObserver = class extends Disposable {
constructor(element, callbacks) {
super();
this.element = element;
this.callbacks = callbacks;
this.counter = 0;
this.dragStartTime = 0;
this.registerListeners();
}
registerListeners() {
if (this.callbacks.onDragStart) {
this._register(addDisposableListener(this.element, EventType.DRAG_START, (e) => {
var _a10, _b4;
(_b4 = (_a10 = this.callbacks).onDragStart) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}));
}
if (this.callbacks.onDrag) {
this._register(addDisposableListener(this.element, EventType.DRAG, (e) => {
var _a10, _b4;
(_b4 = (_a10 = this.callbacks).onDrag) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}));
}
this._register(addDisposableListener(this.element, EventType.DRAG_ENTER, (e) => {
var _a10, _b4;
this.counter++;
this.dragStartTime = e.timeStamp;
(_b4 = (_a10 = this.callbacks).onDragEnter) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}));
this._register(addDisposableListener(this.element, EventType.DRAG_OVER, (e) => {
var _a10, _b4;
e.preventDefault();
(_b4 = (_a10 = this.callbacks).onDragOver) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e, e.timeStamp - this.dragStartTime);
}));
this._register(addDisposableListener(this.element, EventType.DRAG_LEAVE, (e) => {
var _a10, _b4;
this.counter--;
if (this.counter === 0) {
this.dragStartTime = 0;
(_b4 = (_a10 = this.callbacks).onDragLeave) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}
}));
this._register(addDisposableListener(this.element, EventType.DRAG_END, (e) => {
var _a10, _b4;
this.counter = 0;
this.dragStartTime = 0;
(_b4 = (_a10 = this.callbacks).onDragEnd) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}));
this._register(addDisposableListener(this.element, EventType.DROP, (e) => {
var _a10, _b4;
this.counter = 0;
this.dragStartTime = 0;
(_b4 = (_a10 = this.callbacks).onDrop) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, e);
}));
}
};
H_REGEX = new RegExp("(?[\\w\\-]+)?(?:#(?[\\w\\-]+))?(?(?:\\.(?:[\\w\\-]+))*)(?:@(?(?:[\\w\\_])+))?");
}
});
// node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js
var DevicePixelRatioMonitor, PixelRatioMonitorImpl, PixelRatioMonitorFacade, PixelRatio;
var init_pixelRatio = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/pixelRatio.js"() {
init_dom();
init_event();
init_lifecycle();
DevicePixelRatioMonitor = class extends Disposable {
constructor(targetWindow) {
super();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._listener = () => this._handleChange(targetWindow, true);
this._mediaQueryList = null;
this._handleChange(targetWindow, false);
}
_handleChange(targetWindow, fireEvent) {
var _a10;
(_a10 = this._mediaQueryList) === null || _a10 === void 0 ? void 0 : _a10.removeEventListener("change", this._listener);
this._mediaQueryList = targetWindow.matchMedia(`(resolution: ${targetWindow.devicePixelRatio}dppx)`);
this._mediaQueryList.addEventListener("change", this._listener);
if (fireEvent) {
this._onDidChange.fire();
}
}
};
PixelRatioMonitorImpl = class extends Disposable {
get value() {
return this._value;
}
constructor(targetWindow) {
super();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._value = this._getPixelRatio(targetWindow);
const dprMonitor = this._register(new DevicePixelRatioMonitor(targetWindow));
this._register(dprMonitor.onDidChange(() => {
this._value = this._getPixelRatio(targetWindow);
this._onDidChange.fire(this._value);
}));
}
_getPixelRatio(targetWindow) {
const ctx = document.createElement("canvas").getContext("2d");
const dpr = targetWindow.devicePixelRatio || 1;
const bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
return dpr / bsr;
}
};
PixelRatioMonitorFacade = class {
constructor() {
this.mapWindowIdToPixelRatioMonitor = /* @__PURE__ */ new Map();
}
_getOrCreatePixelRatioMonitor(targetWindow) {
const targetWindowId = getWindowId(targetWindow);
let pixelRatioMonitor = this.mapWindowIdToPixelRatioMonitor.get(targetWindowId);
if (!pixelRatioMonitor) {
pixelRatioMonitor = markAsSingleton(new PixelRatioMonitorImpl(targetWindow));
this.mapWindowIdToPixelRatioMonitor.set(targetWindowId, pixelRatioMonitor);
markAsSingleton(Event.once(onDidUnregisterWindow)(({ vscodeWindowId }) => {
if (vscodeWindowId === targetWindowId) {
pixelRatioMonitor === null || pixelRatioMonitor === void 0 ? void 0 : pixelRatioMonitor.dispose();
this.mapWindowIdToPixelRatioMonitor.delete(targetWindowId);
}
}));
}
return pixelRatioMonitor;
}
getInstance(targetWindow) {
return this._getOrCreatePixelRatioMonitor(targetWindow);
}
};
PixelRatio = new PixelRatioMonitorFacade();
}
});
// node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js
function numberAsPixels(value) {
return typeof value === "number" ? `${value}px` : value;
}
function createFastDomNode(domNode) {
return new FastDomNode(domNode);
}
var FastDomNode;
var init_fastDomNode = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js"() {
FastDomNode = class {
constructor(domNode) {
this.domNode = domNode;
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 = false;
this._contain = "none";
this._boxShadow = "";
}
setMaxWidth(_maxWidth) {
const maxWidth = numberAsPixels(_maxWidth);
if (this._maxWidth === maxWidth) {
return;
}
this._maxWidth = maxWidth;
this.domNode.style.maxWidth = this._maxWidth;
}
setWidth(_width) {
const width2 = numberAsPixels(_width);
if (this._width === width2) {
return;
}
this._width = width2;
this.domNode.style.width = this._width;
}
setHeight(_height) {
const height = numberAsPixels(_height);
if (this._height === height) {
return;
}
this._height = height;
this.domNode.style.height = this._height;
}
setTop(_top) {
const top = numberAsPixels(_top);
if (this._top === top) {
return;
}
this._top = top;
this.domNode.style.top = this._top;
}
setLeft(_left) {
const left = numberAsPixels(_left);
if (this._left === left) {
return;
}
this._left = left;
this.domNode.style.left = this._left;
}
setBottom(_bottom) {
const bottom = numberAsPixels(_bottom);
if (this._bottom === bottom) {
return;
}
this._bottom = bottom;
this.domNode.style.bottom = this._bottom;
}
setRight(_right) {
const right = numberAsPixels(_right);
if (this._right === right) {
return;
}
this._right = right;
this.domNode.style.right = this._right;
}
setPaddingLeft(_paddingLeft) {
const paddingLeft = numberAsPixels(_paddingLeft);
if (this._paddingLeft === paddingLeft) {
return;
}
this._paddingLeft = paddingLeft;
this.domNode.style.paddingLeft = this._paddingLeft;
}
setFontFamily(fontFamily) {
if (this._fontFamily === fontFamily) {
return;
}
this._fontFamily = fontFamily;
this.domNode.style.fontFamily = this._fontFamily;
}
setFontWeight(fontWeight) {
if (this._fontWeight === fontWeight) {
return;
}
this._fontWeight = fontWeight;
this.domNode.style.fontWeight = this._fontWeight;
}
setFontSize(_fontSize) {
const fontSize = numberAsPixels(_fontSize);
if (this._fontSize === fontSize) {
return;
}
this._fontSize = fontSize;
this.domNode.style.fontSize = this._fontSize;
}
setFontStyle(fontStyle) {
if (this._fontStyle === fontStyle) {
return;
}
this._fontStyle = fontStyle;
this.domNode.style.fontStyle = this._fontStyle;
}
setFontFeatureSettings(fontFeatureSettings) {
if (this._fontFeatureSettings === fontFeatureSettings) {
return;
}
this._fontFeatureSettings = fontFeatureSettings;
this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;
}
setFontVariationSettings(fontVariationSettings) {
if (this._fontVariationSettings === fontVariationSettings) {
return;
}
this._fontVariationSettings = fontVariationSettings;
this.domNode.style.fontVariationSettings = this._fontVariationSettings;
}
setTextDecoration(textDecoration) {
if (this._textDecoration === textDecoration) {
return;
}
this._textDecoration = textDecoration;
this.domNode.style.textDecoration = this._textDecoration;
}
setLineHeight(_lineHeight) {
const lineHeight = numberAsPixels(_lineHeight);
if (this._lineHeight === lineHeight) {
return;
}
this._lineHeight = lineHeight;
this.domNode.style.lineHeight = this._lineHeight;
}
setLetterSpacing(_letterSpacing) {
const letterSpacing = numberAsPixels(_letterSpacing);
if (this._letterSpacing === letterSpacing) {
return;
}
this._letterSpacing = letterSpacing;
this.domNode.style.letterSpacing = this._letterSpacing;
}
setClassName(className) {
if (this._className === className) {
return;
}
this._className = className;
this.domNode.className = this._className;
}
toggleClassName(className, shouldHaveIt) {
this.domNode.classList.toggle(className, shouldHaveIt);
this._className = this.domNode.className;
}
setDisplay(display) {
if (this._display === display) {
return;
}
this._display = display;
this.domNode.style.display = this._display;
}
setPosition(position) {
if (this._position === position) {
return;
}
this._position = position;
this.domNode.style.position = this._position;
}
setVisibility(visibility) {
if (this._visibility === visibility) {
return;
}
this._visibility = visibility;
this.domNode.style.visibility = this._visibility;
}
setColor(color) {
if (this._color === color) {
return;
}
this._color = color;
this.domNode.style.color = this._color;
}
setBackgroundColor(backgroundColor) {
if (this._backgroundColor === backgroundColor) {
return;
}
this._backgroundColor = backgroundColor;
this.domNode.style.backgroundColor = this._backgroundColor;
}
setLayerHinting(layerHint) {
if (this._layerHint === layerHint) {
return;
}
this._layerHint = layerHint;
this.domNode.style.transform = this._layerHint ? "translate3d(0px, 0px, 0px)" : "";
}
setBoxShadow(boxShadow) {
if (this._boxShadow === boxShadow) {
return;
}
this._boxShadow = boxShadow;
this.domNode.style.boxShadow = boxShadow;
}
setContain(contain) {
if (this._contain === contain) {
return;
}
this._contain = contain;
this.domNode.style.contain = this._contain;
}
setAttribute(name, value) {
this.domNode.setAttribute(name, value);
}
removeAttribute(name) {
this.domNode.removeAttribute(name);
}
appendChild(child) {
this.domNode.appendChild(child.domNode);
}
removeChild(child) {
this.domNode.removeChild(child.domNode);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/domFontInfo.js
function applyFontInfo(domNode, fontInfo) {
if (domNode instanceof FastDomNode) {
domNode.setFontFamily(fontInfo.getMassagedFontFamily());
domNode.setFontWeight(fontInfo.fontWeight);
domNode.setFontSize(fontInfo.fontSize);
domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);
domNode.setFontVariationSettings(fontInfo.fontVariationSettings);
domNode.setLineHeight(fontInfo.lineHeight);
domNode.setLetterSpacing(fontInfo.letterSpacing);
} else {
domNode.style.fontFamily = fontInfo.getMassagedFontFamily();
domNode.style.fontWeight = fontInfo.fontWeight;
domNode.style.fontSize = fontInfo.fontSize + "px";
domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;
domNode.style.fontVariationSettings = fontInfo.fontVariationSettings;
domNode.style.lineHeight = fontInfo.lineHeight + "px";
domNode.style.letterSpacing = fontInfo.letterSpacing + "px";
}
}
var init_domFontInfo = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/domFontInfo.js"() {
init_fastDomNode();
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/charWidthReader.js
function readCharWidths(targetWindow, bareFontInfo, requests) {
const reader = new DomCharWidthReader(bareFontInfo, requests);
reader.read(targetWindow);
}
var CharWidthRequest, DomCharWidthReader;
var init_charWidthReader = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/charWidthReader.js"() {
init_domFontInfo();
CharWidthRequest = class {
constructor(chr, type) {
this.chr = chr;
this.type = type;
this.width = 0;
}
fulfill(width2) {
this.width = width2;
}
};
DomCharWidthReader = class _DomCharWidthReader {
constructor(bareFontInfo, requests) {
this._bareFontInfo = bareFontInfo;
this._requests = requests;
this._container = null;
this._testElements = null;
}
read(targetWindow) {
this._createDomElements();
targetWindow.document.body.appendChild(this._container);
this._readFromDomElements();
targetWindow.document.body.removeChild(this._container);
this._container = null;
this._testElements = null;
}
_createDomElements() {
const container = document.createElement("div");
container.style.position = "absolute";
container.style.top = "-50000px";
container.style.width = "50000px";
const regularDomNode = document.createElement("div");
applyFontInfo(regularDomNode, this._bareFontInfo);
container.appendChild(regularDomNode);
const boldDomNode = document.createElement("div");
applyFontInfo(boldDomNode, this._bareFontInfo);
boldDomNode.style.fontWeight = "bold";
container.appendChild(boldDomNode);
const italicDomNode = document.createElement("div");
applyFontInfo(italicDomNode, this._bareFontInfo);
italicDomNode.style.fontStyle = "italic";
container.appendChild(italicDomNode);
const testElements = [];
for (const request of this._requests) {
let parent;
if (request.type === 0) {
parent = regularDomNode;
}
if (request.type === 2) {
parent = boldDomNode;
}
if (request.type === 1) {
parent = italicDomNode;
}
parent.appendChild(document.createElement("br"));
const testElement = document.createElement("span");
_DomCharWidthReader._render(testElement, request);
parent.appendChild(testElement);
testElements.push(testElement);
}
this._container = container;
this._testElements = testElements;
}
static _render(testElement, request) {
if (request.chr === " ") {
let htmlString = "\xA0";
for (let i = 0; i < 8; i++) {
htmlString += htmlString;
}
testElement.innerText = htmlString;
} else {
let testString = request.chr;
for (let i = 0; i < 8; i++) {
testString += testString;
}
testElement.textContent = testString;
}
}
_readFromDomElements() {
for (let i = 0, len = this._requests.length; i < len; i++) {
const request = this._requests[i];
const testElement = this._testElements[i];
request.fulfill(testElement.offsetWidth / 256);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/config/editorZoom.js
var EditorZoom;
var init_editorZoom = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/config/editorZoom.js"() {
init_event();
EditorZoom = new class {
constructor() {
this._zoomLevel = 0;
this._onDidChangeZoomLevel = new Emitter();
this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
}
getZoomLevel() {
return this._zoomLevel;
}
setZoomLevel(zoomLevel) {
zoomLevel = Math.min(Math.max(-5, zoomLevel), 20);
if (this._zoomLevel === zoomLevel) {
return;
}
this._zoomLevel = zoomLevel;
this._onDidChangeZoomLevel.fire(this._zoomLevel);
}
}();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js
var GOLDEN_LINE_HEIGHT_RATIO, MINIMUM_LINE_HEIGHT, BareFontInfo, SERIALIZED_FONT_INFO_VERSION, FontInfo;
var init_fontInfo = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js"() {
init_platform();
init_editorOptions();
init_editorZoom();
GOLDEN_LINE_HEIGHT_RATIO = isMacintosh ? 1.5 : 1.35;
MINIMUM_LINE_HEIGHT = 8;
BareFontInfo = class _BareFontInfo {
/**
* @internal
*/
static createFromValidatedSettings(options2, pixelRatio, ignoreEditorZoom) {
const fontFamily = options2.get(
49
/* EditorOption.fontFamily */
);
const fontWeight = options2.get(
53
/* EditorOption.fontWeight */
);
const fontSize = options2.get(
52
/* EditorOption.fontSize */
);
const fontFeatureSettings = options2.get(
51
/* EditorOption.fontLigatures */
);
const fontVariationSettings = options2.get(
54
/* EditorOption.fontVariations */
);
const lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
const letterSpacing = options2.get(
64
/* EditorOption.letterSpacing */
);
return _BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);
}
/**
* @internal
*/
static _create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom) {
if (lineHeight === 0) {
lineHeight = GOLDEN_LINE_HEIGHT_RATIO * fontSize;
} else if (lineHeight < MINIMUM_LINE_HEIGHT) {
lineHeight = lineHeight * fontSize;
}
lineHeight = Math.round(lineHeight);
if (lineHeight < MINIMUM_LINE_HEIGHT) {
lineHeight = MINIMUM_LINE_HEIGHT;
}
const editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);
fontSize *= editorZoomLevelMultiplier;
lineHeight *= editorZoomLevelMultiplier;
if (fontVariationSettings === EditorFontVariations.TRANSLATE) {
if (fontWeight === "normal" || fontWeight === "bold") {
fontVariationSettings = EditorFontVariations.OFF;
} else {
const fontWeightAsNumber = parseInt(fontWeight, 10);
fontVariationSettings = `'wght' ${fontWeightAsNumber}`;
fontWeight = "normal";
}
}
return new _BareFontInfo({
pixelRatio,
fontFamily,
fontWeight,
fontSize,
fontFeatureSettings,
fontVariationSettings,
lineHeight,
letterSpacing
});
}
/**
* @internal
*/
constructor(opts) {
this._bareFontInfoBrand = void 0;
this.pixelRatio = opts.pixelRatio;
this.fontFamily = String(opts.fontFamily);
this.fontWeight = String(opts.fontWeight);
this.fontSize = opts.fontSize;
this.fontFeatureSettings = opts.fontFeatureSettings;
this.fontVariationSettings = opts.fontVariationSettings;
this.lineHeight = opts.lineHeight | 0;
this.letterSpacing = opts.letterSpacing;
}
/**
* @internal
*/
getId() {
return `${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`;
}
/**
* @internal
*/
getMassagedFontFamily() {
const fallbackFontFamily = EDITOR_FONT_DEFAULTS.fontFamily;
const fontFamily = _BareFontInfo._wrapInQuotes(this.fontFamily);
if (fallbackFontFamily && this.fontFamily !== fallbackFontFamily) {
return `${fontFamily}, ${fallbackFontFamily}`;
}
return fontFamily;
}
static _wrapInQuotes(fontFamily) {
if (/[,"']/.test(fontFamily)) {
return fontFamily;
}
if (/[+ ]/.test(fontFamily)) {
return `"${fontFamily}"`;
}
return fontFamily;
}
};
SERIALIZED_FONT_INFO_VERSION = 2;
FontInfo = class extends BareFontInfo {
/**
* @internal
*/
constructor(opts, isTrusted) {
super(opts);
this._editorStylingBrand = void 0;
this.version = SERIALIZED_FONT_INFO_VERSION;
this.isTrusted = isTrusted;
this.isMonospace = opts.isMonospace;
this.typicalHalfwidthCharacterWidth = opts.typicalHalfwidthCharacterWidth;
this.typicalFullwidthCharacterWidth = opts.typicalFullwidthCharacterWidth;
this.canUseHalfwidthRightwardsArrow = opts.canUseHalfwidthRightwardsArrow;
this.spaceWidth = opts.spaceWidth;
this.middotWidth = opts.middotWidth;
this.wsmiddotWidth = opts.wsmiddotWidth;
this.maxDigitWidth = opts.maxDigitWidth;
}
/**
* @internal
*/
equals(other) {
return this.fontFamily === other.fontFamily && this.fontWeight === other.fontWeight && this.fontSize === other.fontSize && this.fontFeatureSettings === other.fontFeatureSettings && this.fontVariationSettings === other.fontVariationSettings && this.lineHeight === other.lineHeight && this.letterSpacing === other.letterSpacing && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth && this.typicalFullwidthCharacterWidth === other.typicalFullwidthCharacterWidth && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.spaceWidth === other.spaceWidth && this.middotWidth === other.middotWidth && this.wsmiddotWidth === other.wsmiddotWidth && this.maxDigitWidth === other.maxDigitWidth;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/fontMeasurements.js
var FontMeasurementsImpl, FontMeasurementsCache, FontMeasurements;
var init_fontMeasurements = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/fontMeasurements.js"() {
init_dom();
init_pixelRatio();
init_event();
init_lifecycle();
init_charWidthReader();
init_editorOptions();
init_fontInfo();
FontMeasurementsImpl = class extends Disposable {
constructor() {
super(...arguments);
this._cache = /* @__PURE__ */ new Map();
this._evictUntrustedReadingsTimeout = -1;
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
}
dispose() {
if (this._evictUntrustedReadingsTimeout !== -1) {
clearTimeout(this._evictUntrustedReadingsTimeout);
this._evictUntrustedReadingsTimeout = -1;
}
super.dispose();
}
/**
* Clear all cached font information and trigger a change event.
*/
clearAllFontInfos() {
this._cache.clear();
this._onDidChange.fire();
}
_ensureCache(targetWindow) {
const windowId = getWindowId(targetWindow);
let cache = this._cache.get(windowId);
if (!cache) {
cache = new FontMeasurementsCache();
this._cache.set(windowId, cache);
}
return cache;
}
_writeToCache(targetWindow, item, value) {
const cache = this._ensureCache(targetWindow);
cache.put(item, value);
if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {
this._evictUntrustedReadingsTimeout = targetWindow.setTimeout(() => {
this._evictUntrustedReadingsTimeout = -1;
this._evictUntrustedReadings(targetWindow);
}, 5e3);
}
}
_evictUntrustedReadings(targetWindow) {
const cache = this._ensureCache(targetWindow);
const values2 = cache.getValues();
let somethingRemoved = false;
for (const item of values2) {
if (!item.isTrusted) {
somethingRemoved = true;
cache.remove(item);
}
}
if (somethingRemoved) {
this._onDidChange.fire();
}
}
/**
* Read font information.
*/
readFontInfo(targetWindow, bareFontInfo) {
const cache = this._ensureCache(targetWindow);
if (!cache.has(bareFontInfo)) {
let readConfig = this._actualReadFontInfo(targetWindow, bareFontInfo);
if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {
readConfig = new FontInfo({
pixelRatio: PixelRatio.getInstance(targetWindow).value,
fontFamily: readConfig.fontFamily,
fontWeight: readConfig.fontWeight,
fontSize: readConfig.fontSize,
fontFeatureSettings: readConfig.fontFeatureSettings,
fontVariationSettings: readConfig.fontVariationSettings,
lineHeight: readConfig.lineHeight,
letterSpacing: readConfig.letterSpacing,
isMonospace: readConfig.isMonospace,
typicalHalfwidthCharacterWidth: Math.max(readConfig.typicalHalfwidthCharacterWidth, 5),
typicalFullwidthCharacterWidth: Math.max(readConfig.typicalFullwidthCharacterWidth, 5),
canUseHalfwidthRightwardsArrow: readConfig.canUseHalfwidthRightwardsArrow,
spaceWidth: Math.max(readConfig.spaceWidth, 5),
middotWidth: Math.max(readConfig.middotWidth, 5),
wsmiddotWidth: Math.max(readConfig.wsmiddotWidth, 5),
maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5)
}, false);
}
this._writeToCache(targetWindow, bareFontInfo, readConfig);
}
return cache.get(bareFontInfo);
}
_createRequest(chr, type, all, monospace) {
const result = new CharWidthRequest(chr, type);
all.push(result);
monospace === null || monospace === void 0 ? void 0 : monospace.push(result);
return result;
}
_actualReadFontInfo(targetWindow, bareFontInfo) {
const all = [];
const monospace = [];
const typicalHalfwidthCharacter = this._createRequest("n", 0, all, monospace);
const typicalFullwidthCharacter = this._createRequest("\uFF4D", 0, all, null);
const space = this._createRequest(" ", 0, all, monospace);
const digit0 = this._createRequest("0", 0, all, monospace);
const digit1 = this._createRequest("1", 0, all, monospace);
const digit2 = this._createRequest("2", 0, all, monospace);
const digit3 = this._createRequest("3", 0, all, monospace);
const digit4 = this._createRequest("4", 0, all, monospace);
const digit5 = this._createRequest("5", 0, all, monospace);
const digit6 = this._createRequest("6", 0, all, monospace);
const digit7 = this._createRequest("7", 0, all, monospace);
const digit8 = this._createRequest("8", 0, all, monospace);
const digit9 = this._createRequest("9", 0, all, monospace);
const rightwardsArrow = this._createRequest("\u2192", 0, all, monospace);
const halfwidthRightwardsArrow = this._createRequest("\uFFEB", 0, all, null);
const middot = this._createRequest("\xB7", 0, all, monospace);
const wsmiddotWidth = this._createRequest(String.fromCharCode(11825), 0, all, null);
const monospaceTestChars = "|/-_ilm%";
for (let i = 0, len = monospaceTestChars.length; i < len; i++) {
this._createRequest(monospaceTestChars.charAt(i), 0, all, monospace);
this._createRequest(monospaceTestChars.charAt(i), 1, all, monospace);
this._createRequest(monospaceTestChars.charAt(i), 2, all, monospace);
}
readCharWidths(targetWindow, bareFontInfo, all);
const maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);
let isMonospace = bareFontInfo.fontFeatureSettings === EditorFontLigatures.OFF;
const referenceWidth = monospace[0].width;
for (let i = 1, len = monospace.length; isMonospace && i < len; i++) {
const diff = referenceWidth - monospace[i].width;
if (diff < -1e-3 || diff > 1e-3) {
isMonospace = false;
break;
}
}
let canUseHalfwidthRightwardsArrow = true;
if (isMonospace && halfwidthRightwardsArrow.width !== referenceWidth) {
canUseHalfwidthRightwardsArrow = false;
}
if (halfwidthRightwardsArrow.width > rightwardsArrow.width) {
canUseHalfwidthRightwardsArrow = false;
}
return new FontInfo({
pixelRatio: PixelRatio.getInstance(targetWindow).value,
fontFamily: bareFontInfo.fontFamily,
fontWeight: bareFontInfo.fontWeight,
fontSize: bareFontInfo.fontSize,
fontFeatureSettings: bareFontInfo.fontFeatureSettings,
fontVariationSettings: bareFontInfo.fontVariationSettings,
lineHeight: bareFontInfo.lineHeight,
letterSpacing: bareFontInfo.letterSpacing,
isMonospace,
typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,
typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,
canUseHalfwidthRightwardsArrow,
spaceWidth: space.width,
middotWidth: middot.width,
wsmiddotWidth: wsmiddotWidth.width,
maxDigitWidth
}, true);
}
};
FontMeasurementsCache = class {
constructor() {
this._keys = /* @__PURE__ */ Object.create(null);
this._values = /* @__PURE__ */ Object.create(null);
}
has(item) {
const itemId = item.getId();
return !!this._values[itemId];
}
get(item) {
const itemId = item.getId();
return this._values[itemId];
}
put(item, value) {
const itemId = item.getId();
this._keys[itemId] = item;
this._values[itemId] = value;
}
remove(item) {
const itemId = item.getId();
delete this._keys[itemId];
delete this._values[itemId];
}
getValues() {
return Object.keys(this._keys).map((id) => this._values[id]);
}
};
FontMeasurements = new FontMeasurementsImpl();
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js
function storeServiceDependency(id, target, index) {
if (target[_util.DI_TARGET] === target) {
target[_util.DI_DEPENDENCIES].push({ id, index });
} else {
target[_util.DI_DEPENDENCIES] = [{ id, index }];
target[_util.DI_TARGET] = target;
}
}
function createDecorator(serviceId) {
if (_util.serviceIds.has(serviceId)) {
return _util.serviceIds.get(serviceId);
}
const id = function(target, key, index) {
if (arguments.length !== 3) {
throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
}
storeServiceDependency(id, target, index);
};
id.toString = () => serviceId;
_util.serviceIds.set(serviceId, id);
return id;
}
var _util, IInstantiationService;
var init_instantiation = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js"() {
(function(_util2) {
_util2.serviceIds = /* @__PURE__ */ new Map();
_util2.DI_TARGET = "$di$target";
_util2.DI_DEPENDENCIES = "$di$dependencies";
function getServiceDependencies(ctor) {
return ctor[_util2.DI_DEPENDENCIES] || [];
}
_util2.getServiceDependencies = getServiceDependencies;
})(_util || (_util = {}));
IInstantiationService = createDecorator("instantiationService");
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js
var ICodeEditorService;
var init_codeEditorService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js"() {
init_instantiation();
ICodeEditorService = createDecorator("codeEditorService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/model.js
var IModelService;
var init_model = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/model.js"() {
init_instantiation();
IModelService = createDecorator("modelService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/resolverService.js
var ITextModelService;
var init_resolverService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/resolverService.js"() {
init_instantiation();
ITextModelService = createDecorator("textModelService");
}
});
// node_modules/monaco-editor/esm/vs/base/common/actions.js
function toAction(props) {
var _a10, _b4;
return {
id: props.id,
label: props.label,
tooltip: (_a10 = props.tooltip) !== null && _a10 !== void 0 ? _a10 : props.label,
class: props.class,
enabled: (_b4 = props.enabled) !== null && _b4 !== void 0 ? _b4 : true,
checked: props.checked,
run: (...args) => __async(this, null, function* () {
return props.run(...args);
})
};
}
var Action, ActionRunner, Separator, SubmenuAction, EmptySubmenuAction;
var init_actions = __esm({
"node_modules/monaco-editor/esm/vs/base/common/actions.js"() {
init_event();
init_lifecycle();
init_nls();
Action = class extends Disposable {
constructor(id, label = "", cssClass = "", enabled = true, actionCallback) {
super();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._enabled = true;
this._id = id;
this._label = label;
this._cssClass = cssClass;
this._enabled = enabled;
this._actionCallback = actionCallback;
}
get id() {
return this._id;
}
get label() {
return this._label;
}
set label(value) {
this._setLabel(value);
}
_setLabel(value) {
if (this._label !== value) {
this._label = value;
this._onDidChange.fire({ label: value });
}
}
get tooltip() {
return this._tooltip || "";
}
set tooltip(value) {
this._setTooltip(value);
}
_setTooltip(value) {
if (this._tooltip !== value) {
this._tooltip = value;
this._onDidChange.fire({ tooltip: value });
}
}
get class() {
return this._cssClass;
}
set class(value) {
this._setClass(value);
}
_setClass(value) {
if (this._cssClass !== value) {
this._cssClass = value;
this._onDidChange.fire({ class: value });
}
}
get enabled() {
return this._enabled;
}
set enabled(value) {
this._setEnabled(value);
}
_setEnabled(value) {
if (this._enabled !== value) {
this._enabled = value;
this._onDidChange.fire({ enabled: value });
}
}
get checked() {
return this._checked;
}
set checked(value) {
this._setChecked(value);
}
_setChecked(value) {
if (this._checked !== value) {
this._checked = value;
this._onDidChange.fire({ checked: value });
}
}
run(event, data) {
return __async(this, null, function* () {
if (this._actionCallback) {
yield this._actionCallback(event);
}
});
}
};
ActionRunner = class extends Disposable {
constructor() {
super(...arguments);
this._onWillRun = this._register(new Emitter());
this.onWillRun = this._onWillRun.event;
this._onDidRun = this._register(new Emitter());
this.onDidRun = this._onDidRun.event;
}
run(action, context) {
return __async(this, null, function* () {
if (!action.enabled) {
return;
}
this._onWillRun.fire({ action });
let error = void 0;
try {
yield this.runAction(action, context);
} catch (e) {
error = e;
}
this._onDidRun.fire({ action, error });
});
}
runAction(action, context) {
return __async(this, null, function* () {
yield action.run(context);
});
}
};
Separator = class _Separator {
constructor() {
this.id = _Separator.ID;
this.label = "";
this.tooltip = "";
this.class = "separator";
this.enabled = false;
this.checked = false;
}
/**
* Joins all non-empty lists of actions with separators.
*/
static join(...actionLists) {
let out = [];
for (const list of actionLists) {
if (!list.length) {
} else if (out.length) {
out = [...out, new _Separator(), ...list];
} else {
out = list;
}
}
return out;
}
run() {
return __async(this, null, function* () {
});
}
};
Separator.ID = "vs.actions.separator";
SubmenuAction = class {
get actions() {
return this._actions;
}
constructor(id, label, actions, cssClass) {
this.tooltip = "";
this.enabled = true;
this.checked = void 0;
this.id = id;
this.label = label;
this.class = cssClass;
this._actions = actions;
}
run() {
return __async(this, null, function* () {
});
}
};
EmptySubmenuAction = class _EmptySubmenuAction extends Action {
constructor() {
super(_EmptySubmenuAction.ID, localize("submenu.empty", "(empty)"), void 0, false);
}
};
EmptySubmenuAction.ID = "vs.actions.empty";
}
});
// node_modules/monaco-editor/esm/vs/base/common/themables.js
var ThemeColor, ThemeIcon;
var init_themables = __esm({
"node_modules/monaco-editor/esm/vs/base/common/themables.js"() {
init_codicons();
(function(ThemeColor2) {
function isThemeColor(obj) {
return obj && typeof obj === "object" && typeof obj.id === "string";
}
ThemeColor2.isThemeColor = isThemeColor;
})(ThemeColor || (ThemeColor = {}));
(function(ThemeIcon2) {
ThemeIcon2.iconNameSegment = "[A-Za-z0-9]+";
ThemeIcon2.iconNameExpression = "[A-Za-z0-9-]+";
ThemeIcon2.iconModifierExpression = "~[A-Za-z]+";
ThemeIcon2.iconNameCharacter = "[A-Za-z0-9~-]";
const ThemeIconIdRegex = new RegExp(`^(${ThemeIcon2.iconNameExpression})(${ThemeIcon2.iconModifierExpression})?$`);
function asClassNameArray(icon) {
const match2 = ThemeIconIdRegex.exec(icon.id);
if (!match2) {
return asClassNameArray(Codicon.error);
}
const [, id, modifier] = match2;
const classNames = ["codicon", "codicon-" + id];
if (modifier) {
classNames.push("codicon-modifier-" + modifier.substring(1));
}
return classNames;
}
ThemeIcon2.asClassNameArray = asClassNameArray;
function asClassName(icon) {
return asClassNameArray(icon).join(" ");
}
ThemeIcon2.asClassName = asClassName;
function asCSSSelector(icon) {
return "." + asClassNameArray(icon).join(".");
}
ThemeIcon2.asCSSSelector = asCSSSelector;
function isThemeIcon(obj) {
return obj && typeof obj === "object" && typeof obj.id === "string" && (typeof obj.color === "undefined" || ThemeColor.isThemeColor(obj.color));
}
ThemeIcon2.isThemeIcon = isThemeIcon;
const _regexFromString = new RegExp(`^\\$\\((${ThemeIcon2.iconNameExpression}(?:${ThemeIcon2.iconModifierExpression})?)\\)$`);
function fromString(str) {
const match2 = _regexFromString.exec(str);
if (!match2) {
return void 0;
}
const [, name] = match2;
return { id: name };
}
ThemeIcon2.fromString = fromString;
function fromId(id) {
return { id };
}
ThemeIcon2.fromId = fromId;
function modify(icon, modifier) {
let id = icon.id;
const tildeIndex = id.lastIndexOf("~");
if (tildeIndex !== -1) {
id = id.substring(0, tildeIndex);
}
if (modifier) {
id = `${id}~${modifier}`;
}
return { id };
}
ThemeIcon2.modify = modify;
function getModifier(icon) {
const tildeIndex = icon.id.lastIndexOf("~");
if (tildeIndex !== -1) {
return icon.id.substring(tildeIndex + 1);
}
return void 0;
}
ThemeIcon2.getModifier = getModifier;
function isEqual2(ti1, ti2) {
var _a10, _b4;
return ti1.id === ti2.id && ((_a10 = ti1.color) === null || _a10 === void 0 ? void 0 : _a10.id) === ((_b4 = ti2.color) === null || _b4 === void 0 ? void 0 : _b4.id);
}
ThemeIcon2.isEqual = isEqual2;
})(ThemeIcon || (ThemeIcon = {}));
}
});
// node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js
var ICommandService, CommandsRegistry;
var init_commands = __esm({
"node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js"() {
init_event();
init_iterator();
init_lifecycle();
init_linkedList();
init_types();
init_instantiation();
ICommandService = createDecorator("commandService");
CommandsRegistry = new class {
constructor() {
this._commands = /* @__PURE__ */ new Map();
this._onDidRegisterCommand = new Emitter();
this.onDidRegisterCommand = this._onDidRegisterCommand.event;
}
registerCommand(idOrCommand, handler) {
if (!idOrCommand) {
throw new Error(`invalid command`);
}
if (typeof idOrCommand === "string") {
if (!handler) {
throw new Error(`invalid command`);
}
return this.registerCommand({ id: idOrCommand, handler });
}
if (idOrCommand.metadata && Array.isArray(idOrCommand.metadata.args)) {
const constraints = [];
for (const arg of idOrCommand.metadata.args) {
constraints.push(arg.constraint);
}
const actualHandler = idOrCommand.handler;
idOrCommand.handler = function(accessor, ...args) {
validateConstraints(args, constraints);
return actualHandler(accessor, ...args);
};
}
const { id } = idOrCommand;
let commands = this._commands.get(id);
if (!commands) {
commands = new LinkedList();
this._commands.set(id, commands);
}
const removeFn = commands.unshift(idOrCommand);
const ret = toDisposable(() => {
removeFn();
const command = this._commands.get(id);
if (command === null || command === void 0 ? void 0 : command.isEmpty()) {
this._commands.delete(id);
}
});
this._onDidRegisterCommand.fire(id);
return ret;
}
registerCommandAlias(oldId, newId) {
return CommandsRegistry.registerCommand(oldId, (accessor, ...args) => accessor.get(ICommandService).executeCommand(newId, ...args));
}
getCommand(id) {
const list = this._commands.get(id);
if (!list || list.isEmpty()) {
return void 0;
}
return Iterable.first(list);
}
getCommands() {
const result = /* @__PURE__ */ new Map();
for (const key of this._commands.keys()) {
const command = this.getCommand(key);
if (command) {
result.set(key, command);
}
}
return result;
}
}();
CommandsRegistry.registerCommand("noop", () => {
});
}
});
// node_modules/monaco-editor/esm/vs/platform/contextkey/common/scanner.js
function hintDidYouMean(...meant) {
switch (meant.length) {
case 1:
return localize("contextkey.scanner.hint.didYouMean1", "Did you mean {0}?", meant[0]);
case 2:
return localize("contextkey.scanner.hint.didYouMean2", "Did you mean {0} or {1}?", meant[0], meant[1]);
case 3:
return localize("contextkey.scanner.hint.didYouMean3", "Did you mean {0}, {1} or {2}?", meant[0], meant[1], meant[2]);
default:
return void 0;
}
}
var hintDidYouForgetToOpenOrCloseQuote, hintDidYouForgetToEscapeSlash, Scanner;
var init_scanner = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextkey/common/scanner.js"() {
init_errors();
init_nls();
hintDidYouForgetToOpenOrCloseQuote = localize("contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote", "Did you forget to open or close the quote?");
hintDidYouForgetToEscapeSlash = localize("contextkey.scanner.hint.didYouForgetToEscapeSlash", "Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'.");
Scanner = class _Scanner {
constructor() {
this._input = "";
this._start = 0;
this._current = 0;
this._tokens = [];
this._errors = [];
this.stringRe = /[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy;
}
static getLexeme(token) {
switch (token.type) {
case 0:
return "(";
case 1:
return ")";
case 2:
return "!";
case 3:
return token.isTripleEq ? "===" : "==";
case 4:
return token.isTripleEq ? "!==" : "!=";
case 5:
return "<";
case 6:
return "<=";
case 7:
return ">=";
case 8:
return ">=";
case 9:
return "=~";
case 10:
return token.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 token.lexeme;
case 18:
return token.lexeme;
case 19:
return token.lexeme;
case 20:
return "EOF";
default:
throw illegalState(`unhandled token type: ${JSON.stringify(token)}; have you forgotten to add a case?`);
}
}
reset(value) {
this._input = value;
this._start = 0;
this._current = 0;
this._tokens = [];
this._errors = [];
return this;
}
scan() {
while (!this._isAtEnd()) {
this._start = this._current;
const ch = this._advance();
switch (ch) {
case 40:
this._addToken(
0
/* TokenType.LParen */
);
break;
case 41:
this._addToken(
1
/* TokenType.RParen */
);
break;
case 33:
if (this._match(
61
/* CharCode.Equals */
)) {
const isTripleEq = this._match(
61
/* CharCode.Equals */
);
this._tokens.push({ type: 4, offset: this._start, isTripleEq });
} else {
this._addToken(
2
/* TokenType.Neg */
);
}
break;
case 39:
this._quotedString();
break;
case 47:
this._regex();
break;
case 61:
if (this._match(
61
/* CharCode.Equals */
)) {
const isTripleEq = this._match(
61
/* CharCode.Equals */
);
this._tokens.push({ type: 3, offset: this._start, isTripleEq });
} else if (this._match(
126
/* CharCode.Tilde */
)) {
this._addToken(
9
/* TokenType.RegexOp */
);
} else {
this._error(hintDidYouMean("==", "=~"));
}
break;
case 60:
this._addToken(
this._match(
61
/* CharCode.Equals */
) ? 6 : 5
/* TokenType.Lt */
);
break;
case 62:
this._addToken(
this._match(
61
/* CharCode.Equals */
) ? 8 : 7
/* TokenType.Gt */
);
break;
case 38:
if (this._match(
38
/* CharCode.Ampersand */
)) {
this._addToken(
15
/* TokenType.And */
);
} else {
this._error(hintDidYouMean("&&"));
}
break;
case 124:
if (this._match(
124
/* CharCode.Pipe */
)) {
this._addToken(
16
/* TokenType.Or */
);
} else {
this._error(hintDidYouMean("||"));
}
break;
// TODO@ulugbekna: 1) rewrite using a regex 2) reconsider what characters are considered whitespace, including unicode, nbsp, etc.
case 32:
case 13:
case 9:
case 10:
case 160:
break;
default:
this._string();
}
}
this._start = this._current;
this._addToken(
20
/* TokenType.EOF */
);
return Array.from(this._tokens);
}
_match(expected) {
if (this._isAtEnd()) {
return false;
}
if (this._input.charCodeAt(this._current) !== expected) {
return false;
}
this._current++;
return true;
}
_advance() {
return this._input.charCodeAt(this._current++);
}
_peek() {
return this._isAtEnd() ? 0 : this._input.charCodeAt(this._current);
}
_addToken(type) {
this._tokens.push({ type, offset: this._start });
}
_error(additional) {
const offset = this._start;
const lexeme = this._input.substring(this._start, this._current);
const errToken = { type: 19, offset: this._start, lexeme };
this._errors.push({ offset, lexeme, additionalInfo: additional });
this._tokens.push(errToken);
}
_string() {
this.stringRe.lastIndex = this._start;
const match2 = this.stringRe.exec(this._input);
if (match2) {
this._current = this._start + match2[0].length;
const lexeme = this._input.substring(this._start, this._current);
const keyword = _Scanner._keywords.get(lexeme);
if (keyword) {
this._addToken(keyword);
} else {
this._tokens.push({ type: 17, lexeme, offset: this._start });
}
}
}
// captures the lexeme without the leading and trailing '
_quotedString() {
while (this._peek() !== 39 && !this._isAtEnd()) {
this._advance();
}
if (this._isAtEnd()) {
this._error(hintDidYouForgetToOpenOrCloseQuote);
return;
}
this._advance();
this._tokens.push({ type: 18, lexeme: this._input.substring(this._start + 1, this._current - 1), offset: this._start + 1 });
}
/*
* Lexing a regex expression: /.../[igsmyu]*
* Based on https://github.com/microsoft/TypeScript/blob/9247ef115e617805983740ba795d7a8164babf89/src/compiler/scanner.ts#L2129-L2181
*
* Note that we want slashes within a regex to be escaped, e.g., /file:\\/\\/\\// should match `file:///`
*/
_regex() {
let p = this._current;
let inEscape = false;
let inCharacterClass = false;
while (true) {
if (p >= this._input.length) {
this._current = p;
this._error(hintDidYouForgetToEscapeSlash);
return;
}
const ch = this._input.charCodeAt(p);
if (inEscape) {
inEscape = false;
} else if (ch === 47 && !inCharacterClass) {
p++;
break;
} else if (ch === 91) {
inCharacterClass = true;
} else if (ch === 92) {
inEscape = true;
} else if (ch === 93) {
inCharacterClass = false;
}
p++;
}
while (p < this._input.length && _Scanner._regexFlags.has(this._input.charCodeAt(p))) {
p++;
}
this._current = p;
const lexeme = this._input.substring(this._start, this._current);
this._tokens.push({ type: 10, lexeme, offset: this._start });
}
_isAtEnd() {
return this._current >= this._input.length;
}
};
Scanner._regexFlags = new Set(["i", "g", "s", "m", "y", "u"].map((ch) => ch.charCodeAt(0)));
Scanner._keywords = /* @__PURE__ */ new Map([
[
"not",
14
/* TokenType.Not */
],
[
"in",
13
/* TokenType.In */
],
[
"false",
12
/* TokenType.False */
],
[
"true",
11
/* TokenType.True */
]
]);
}
});
// node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
function expressionsAreEqualWithConstantSubstitution(a3, b) {
const aExpr = a3 ? a3.substituteConstants() : void 0;
const bExpr = b ? b.substituteConstants() : void 0;
if (!aExpr && !bExpr) {
return true;
}
if (!aExpr || !bExpr) {
return false;
}
return aExpr.equals(bExpr);
}
function cmp(a3, b) {
return a3.cmp(b);
}
function withFloatOrStr(value, callback) {
if (typeof value === "string") {
const n = parseFloat(value);
if (!isNaN(n)) {
value = n;
}
}
if (typeof value === "string" || typeof value === "number") {
return callback(value);
}
return ContextKeyFalseExpr.INSTANCE;
}
function eliminateConstantsInArray(arr) {
let newArr = null;
for (let i = 0, len = arr.length; i < len; i++) {
const newExpr = arr[i].substituteConstants();
if (arr[i] !== newExpr) {
if (newArr === null) {
newArr = [];
for (let j = 0; j < i; j++) {
newArr[j] = arr[j];
}
}
}
if (newArr !== null) {
newArr[i] = newExpr;
}
}
if (newArr === null) {
return arr;
}
return newArr;
}
function cmp1(key1, key2) {
if (key1 < key2) {
return -1;
}
if (key1 > key2) {
return 1;
}
return 0;
}
function cmp2(key1, value1, key2, value2) {
if (key1 < key2) {
return -1;
}
if (key1 > key2) {
return 1;
}
if (value1 < value2) {
return -1;
}
if (value1 > value2) {
return 1;
}
return 0;
}
function implies(p, q) {
if (p.type === 0 || q.type === 1) {
return true;
}
if (p.type === 9) {
if (q.type === 9) {
return allElementsIncluded(p.expr, q.expr);
}
return false;
}
if (q.type === 9) {
for (const element of q.expr) {
if (implies(p, element)) {
return true;
}
}
return false;
}
if (p.type === 6) {
if (q.type === 6) {
return allElementsIncluded(q.expr, p.expr);
}
for (const element of p.expr) {
if (implies(element, q)) {
return true;
}
}
return false;
}
return p.equals(q);
}
function allElementsIncluded(p, q) {
let pIndex = 0;
let qIndex = 0;
while (pIndex < p.length && qIndex < q.length) {
const cmp3 = p[pIndex].cmp(q[qIndex]);
if (cmp3 < 0) {
return false;
} else if (cmp3 === 0) {
pIndex++;
qIndex++;
} else {
qIndex++;
}
}
return pIndex === p.length;
}
function getTerminals(node) {
if (node.type === 9) {
return node.expr;
}
return [node];
}
var CONSTANT_VALUES, hasOwnProperty, defaultConfig, errorEmptyString, hintEmptyString, errorNoInAfterNot, errorClosingParenthesis, errorUnexpectedToken, hintUnexpectedToken, errorUnexpectedEOF, hintUnexpectedEOF, Parser, ContextKeyExpr, ContextKeyFalseExpr, ContextKeyTrueExpr, ContextKeyDefinedExpr, ContextKeyEqualsExpr, ContextKeyInExpr, ContextKeyNotInExpr, ContextKeyNotEqualsExpr, ContextKeyNotExpr, ContextKeyGreaterExpr, ContextKeyGreaterEqualsExpr, ContextKeySmallerExpr, ContextKeySmallerEqualsExpr, ContextKeyRegexExpr, ContextKeyNotRegexExpr, ContextKeyAndExpr, ContextKeyOrExpr, RawContextKey, IContextKeyService;
var init_contextkey = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js"() {
init_platform();
init_strings();
init_scanner();
init_instantiation();
init_nls();
CONSTANT_VALUES = /* @__PURE__ */ new Map();
CONSTANT_VALUES.set("false", false);
CONSTANT_VALUES.set("true", true);
CONSTANT_VALUES.set("isMac", isMacintosh);
CONSTANT_VALUES.set("isLinux", isLinux);
CONSTANT_VALUES.set("isWindows", isWindows);
CONSTANT_VALUES.set("isWeb", isWeb);
CONSTANT_VALUES.set("isMacNative", isMacintosh && !isWeb);
CONSTANT_VALUES.set("isEdge", isEdge);
CONSTANT_VALUES.set("isFirefox", isFirefox);
CONSTANT_VALUES.set("isChrome", isChrome);
CONSTANT_VALUES.set("isSafari", isSafari);
hasOwnProperty = Object.prototype.hasOwnProperty;
defaultConfig = {
regexParsingWithErrorRecovery: true
};
errorEmptyString = localize("contextkey.parser.error.emptyString", "Empty context key expression");
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.");
errorNoInAfterNot = localize("contextkey.parser.error.noInAfterNot", "'in' after 'not'.");
errorClosingParenthesis = localize("contextkey.parser.error.closingParenthesis", "closing parenthesis ')'");
errorUnexpectedToken = localize("contextkey.parser.error.unexpectedToken", "Unexpected token");
hintUnexpectedToken = localize("contextkey.parser.error.unexpectedToken.hint", "Did you forget to put && or || before the token?");
errorUnexpectedEOF = localize("contextkey.parser.error.unexpectedEOF", "Unexpected end of expression");
hintUnexpectedEOF = localize("contextkey.parser.error.unexpectedEOF.hint", "Did you forget to put a context key?");
Parser = class _Parser {
constructor(_config = defaultConfig) {
this._config = _config;
this._scanner = new Scanner();
this._tokens = [];
this._current = 0;
this._parsingErrors = [];
this._flagsGYRe = /g|y/g;
}
/**
* Parse a context key expression.
*
* @param input the expression to parse
* @returns the parsed expression or `undefined` if there's an error - call `lexingErrors` and `parsingErrors` to see the errors
*/
parse(input) {
if (input === "") {
this._parsingErrors.push({ message: errorEmptyString, offset: 0, lexeme: "", additionalInfo: hintEmptyString });
return void 0;
}
this._tokens = this._scanner.reset(input).scan();
this._current = 0;
this._parsingErrors = [];
try {
const expr = this._expr();
if (!this._isAtEnd()) {
const peek = this._peek();
const additionalInfo = peek.type === 17 ? hintUnexpectedToken : void 0;
this._parsingErrors.push({ message: errorUnexpectedToken, offset: peek.offset, lexeme: Scanner.getLexeme(peek), additionalInfo });
throw _Parser._parseError;
}
return expr;
} catch (e) {
if (!(e === _Parser._parseError)) {
throw e;
}
return void 0;
}
}
_expr() {
return this._or();
}
_or() {
const expr = [this._and()];
while (this._matchOne(
16
/* TokenType.Or */
)) {
const right = this._and();
expr.push(right);
}
return expr.length === 1 ? expr[0] : ContextKeyExpr.or(...expr);
}
_and() {
const expr = [this._term()];
while (this._matchOne(
15
/* TokenType.And */
)) {
const right = this._term();
expr.push(right);
}
return expr.length === 1 ? expr[0] : ContextKeyExpr.and(...expr);
}
_term() {
if (this._matchOne(
2
/* TokenType.Neg */
)) {
const peek = this._peek();
switch (peek.type) {
case 11:
this._advance();
return ContextKeyFalseExpr.INSTANCE;
case 12:
this._advance();
return ContextKeyTrueExpr.INSTANCE;
case 0: {
this._advance();
const expr = this._expr();
this._consume(1, errorClosingParenthesis);
return expr === null || expr === void 0 ? void 0 : expr.negate();
}
case 17:
this._advance();
return ContextKeyNotExpr.create(peek.lexeme);
default:
throw this._errExpectedButGot(`KEY | true | false | '(' expression ')'`, peek);
}
}
return this._primary();
}
_primary() {
const peek = this._peek();
switch (peek.type) {
case 11:
this._advance();
return ContextKeyExpr.true();
case 12:
this._advance();
return ContextKeyExpr.false();
case 0: {
this._advance();
const expr = this._expr();
this._consume(1, errorClosingParenthesis);
return expr;
}
case 17: {
const key = peek.lexeme;
this._advance();
if (this._matchOne(
9
/* TokenType.RegexOp */
)) {
const expr = this._peek();
if (!this._config.regexParsingWithErrorRecovery) {
this._advance();
if (expr.type !== 10) {
throw this._errExpectedButGot(`REGEX`, expr);
}
const regexLexeme = expr.lexeme;
const closingSlashIndex = regexLexeme.lastIndexOf("/");
const flags = closingSlashIndex === regexLexeme.length - 1 ? void 0 : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));
let regexp;
try {
regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);
} catch (e) {
throw this._errExpectedButGot(`REGEX`, expr);
}
return ContextKeyRegexExpr.create(key, regexp);
}
switch (expr.type) {
case 10:
case 19: {
const lexemeReconstruction = [expr.lexeme];
this._advance();
let followingToken = this._peek();
let parenBalance = 0;
for (let i = 0; i < expr.lexeme.length; i++) {
if (expr.lexeme.charCodeAt(i) === 40) {
parenBalance++;
} else if (expr.lexeme.charCodeAt(i) === 41) {
parenBalance--;
}
}
while (!this._isAtEnd() && followingToken.type !== 15 && followingToken.type !== 16) {
switch (followingToken.type) {
case 0:
parenBalance++;
break;
case 1:
parenBalance--;
break;
case 10:
case 18:
for (let i = 0; i < followingToken.lexeme.length; i++) {
if (followingToken.lexeme.charCodeAt(i) === 40) {
parenBalance++;
} else if (expr.lexeme.charCodeAt(i) === 41) {
parenBalance--;
}
}
}
if (parenBalance < 0) {
break;
}
lexemeReconstruction.push(Scanner.getLexeme(followingToken));
this._advance();
followingToken = this._peek();
}
const regexLexeme = lexemeReconstruction.join("");
const closingSlashIndex = regexLexeme.lastIndexOf("/");
const flags = closingSlashIndex === regexLexeme.length - 1 ? void 0 : this._removeFlagsGY(regexLexeme.substring(closingSlashIndex + 1));
let regexp;
try {
regexp = new RegExp(regexLexeme.substring(1, closingSlashIndex), flags);
} catch (e) {
throw this._errExpectedButGot(`REGEX`, expr);
}
return ContextKeyExpr.regex(key, regexp);
}
case 18: {
const serializedValue = expr.lexeme;
this._advance();
let regex = null;
if (!isFalsyOrWhitespace(serializedValue)) {
const start = serializedValue.indexOf("/");
const end = serializedValue.lastIndexOf("/");
if (start !== end && start >= 0) {
const value = serializedValue.slice(start + 1, end);
const caseIgnoreFlag = serializedValue[end + 1] === "i" ? "i" : "";
try {
regex = new RegExp(value, caseIgnoreFlag);
} catch (_e2) {
throw this._errExpectedButGot(`REGEX`, expr);
}
}
}
if (regex === null) {
throw this._errExpectedButGot("REGEX", expr);
}
return ContextKeyRegexExpr.create(key, regex);
}
default:
throw this._errExpectedButGot("REGEX", this._peek());
}
}
if (this._matchOne(
14
/* TokenType.Not */
)) {
this._consume(13, errorNoInAfterNot);
const right = this._value();
return ContextKeyExpr.notIn(key, right);
}
const maybeOp = this._peek().type;
switch (maybeOp) {
case 3: {
this._advance();
const right = this._value();
if (this._previous().type === 18) {
return ContextKeyExpr.equals(key, right);
}
switch (right) {
case "true":
return ContextKeyExpr.has(key);
case "false":
return ContextKeyExpr.not(key);
default:
return ContextKeyExpr.equals(key, right);
}
}
case 4: {
this._advance();
const right = this._value();
if (this._previous().type === 18) {
return ContextKeyExpr.notEquals(key, right);
}
switch (right) {
case "true":
return ContextKeyExpr.not(key);
case "false":
return ContextKeyExpr.has(key);
default:
return ContextKeyExpr.notEquals(key, right);
}
}
// 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
// consequently, package.json linter should _warn_ the user if they're passing undesired things to ops
case 5:
this._advance();
return ContextKeySmallerExpr.create(key, this._value());
case 6:
this._advance();
return ContextKeySmallerEqualsExpr.create(key, this._value());
case 7:
this._advance();
return ContextKeyGreaterExpr.create(key, this._value());
case 8:
this._advance();
return ContextKeyGreaterEqualsExpr.create(key, this._value());
case 13:
this._advance();
return ContextKeyExpr.in(key, this._value());
default:
return ContextKeyExpr.has(key);
}
}
case 20:
this._parsingErrors.push({ message: errorUnexpectedEOF, offset: peek.offset, lexeme: "", additionalInfo: hintUnexpectedEOF });
throw _Parser._parseError;
default:
throw this._errExpectedButGot(`true | false | KEY
| KEY '=~' REGEX
| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`, this._peek());
}
}
_value() {
const token = this._peek();
switch (token.type) {
case 17:
case 18:
this._advance();
return token.lexeme;
case 11:
this._advance();
return "true";
case 12:
this._advance();
return "false";
case 13:
this._advance();
return "in";
default:
return "";
}
}
_removeFlagsGY(flags) {
return flags.replaceAll(this._flagsGYRe, "");
}
// careful: this can throw if current token is the initial one (ie index = 0)
_previous() {
return this._tokens[this._current - 1];
}
_matchOne(token) {
if (this._check(token)) {
this._advance();
return true;
}
return false;
}
_advance() {
if (!this._isAtEnd()) {
this._current++;
}
return this._previous();
}
_consume(type, message) {
if (this._check(type)) {
return this._advance();
}
throw this._errExpectedButGot(message, this._peek());
}
_errExpectedButGot(expected, got, additionalInfo) {
const message = localize("contextkey.parser.error.expectedButGot", "Expected: {0}\nReceived: '{1}'.", expected, Scanner.getLexeme(got));
const offset = got.offset;
const lexeme = Scanner.getLexeme(got);
this._parsingErrors.push({ message, offset, lexeme, additionalInfo });
return _Parser._parseError;
}
_check(type) {
return this._peek().type === type;
}
_peek() {
return this._tokens[this._current];
}
_isAtEnd() {
return this._peek().type === 20;
}
};
Parser._parseError = new Error();
ContextKeyExpr = class {
static false() {
return ContextKeyFalseExpr.INSTANCE;
}
static true() {
return ContextKeyTrueExpr.INSTANCE;
}
static has(key) {
return ContextKeyDefinedExpr.create(key);
}
static equals(key, value) {
return ContextKeyEqualsExpr.create(key, value);
}
static notEquals(key, value) {
return ContextKeyNotEqualsExpr.create(key, value);
}
static regex(key, value) {
return ContextKeyRegexExpr.create(key, value);
}
static in(key, value) {
return ContextKeyInExpr.create(key, value);
}
static notIn(key, value) {
return ContextKeyNotInExpr.create(key, value);
}
static not(key) {
return ContextKeyNotExpr.create(key);
}
static and(...expr) {
return ContextKeyAndExpr.create(expr, null, true);
}
static or(...expr) {
return ContextKeyOrExpr.create(expr, null, true);
}
static deserialize(serialized) {
if (serialized === void 0 || serialized === null) {
return void 0;
}
const expr = this._parser.parse(serialized);
return expr;
}
};
ContextKeyExpr._parser = new Parser({ regexParsingWithErrorRecovery: false });
ContextKeyFalseExpr = class {
constructor() {
this.type = 0;
}
cmp(other) {
return this.type - other.type;
}
equals(other) {
return other.type === this.type;
}
substituteConstants() {
return this;
}
evaluate(context) {
return false;
}
serialize() {
return "false";
}
keys() {
return [];
}
negate() {
return ContextKeyTrueExpr.INSTANCE;
}
};
ContextKeyFalseExpr.INSTANCE = new ContextKeyFalseExpr();
ContextKeyTrueExpr = class {
constructor() {
this.type = 1;
}
cmp(other) {
return this.type - other.type;
}
equals(other) {
return other.type === this.type;
}
substituteConstants() {
return this;
}
evaluate(context) {
return true;
}
serialize() {
return "true";
}
keys() {
return [];
}
negate() {
return ContextKeyFalseExpr.INSTANCE;
}
};
ContextKeyTrueExpr.INSTANCE = new ContextKeyTrueExpr();
ContextKeyDefinedExpr = class _ContextKeyDefinedExpr {
static create(key, negated = null) {
const constantValue = CONSTANT_VALUES.get(key);
if (typeof constantValue === "boolean") {
return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
}
return new _ContextKeyDefinedExpr(key, negated);
}
constructor(key, negated) {
this.key = key;
this.negated = negated;
this.type = 2;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp1(this.key, other.key);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key;
}
return false;
}
substituteConstants() {
const constantValue = CONSTANT_VALUES.get(this.key);
if (typeof constantValue === "boolean") {
return constantValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
}
return this;
}
evaluate(context) {
return !!context.getValue(this.key);
}
serialize() {
return this.key;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyNotExpr.create(this.key, this);
}
return this.negated;
}
};
ContextKeyEqualsExpr = class _ContextKeyEqualsExpr {
static create(key, value, negated = null) {
if (typeof value === "boolean") {
return value ? ContextKeyDefinedExpr.create(key, negated) : ContextKeyNotExpr.create(key, negated);
}
const constantValue = CONSTANT_VALUES.get(key);
if (typeof constantValue === "boolean") {
const trueValue = constantValue ? "true" : "false";
return value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
}
return new _ContextKeyEqualsExpr(key, value, negated);
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 4;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
const constantValue = CONSTANT_VALUES.get(this.key);
if (typeof constantValue === "boolean") {
const trueValue = constantValue ? "true" : "false";
return this.value === trueValue ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE;
}
return this;
}
evaluate(context) {
return context.getValue(this.key) == this.value;
}
serialize() {
return `${this.key} == '${this.value}'`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyNotEqualsExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeyInExpr = class _ContextKeyInExpr {
static create(key, valueKey) {
return new _ContextKeyInExpr(key, valueKey);
}
constructor(key, valueKey) {
this.key = key;
this.valueKey = valueKey;
this.type = 10;
this.negated = null;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.valueKey, other.key, other.valueKey);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.valueKey === other.valueKey;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
const source = context.getValue(this.valueKey);
const item = context.getValue(this.key);
if (Array.isArray(source)) {
return source.includes(item);
}
if (typeof item === "string" && typeof source === "object" && source !== null) {
return hasOwnProperty.call(source, item);
}
return false;
}
serialize() {
return `${this.key} in '${this.valueKey}'`;
}
keys() {
return [this.key, this.valueKey];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyNotInExpr.create(this.key, this.valueKey);
}
return this.negated;
}
};
ContextKeyNotInExpr = class _ContextKeyNotInExpr {
static create(key, valueKey) {
return new _ContextKeyNotInExpr(key, valueKey);
}
constructor(key, valueKey) {
this.key = key;
this.valueKey = valueKey;
this.type = 11;
this._negated = ContextKeyInExpr.create(key, valueKey);
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return this._negated.cmp(other._negated);
}
equals(other) {
if (other.type === this.type) {
return this._negated.equals(other._negated);
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
return !this._negated.evaluate(context);
}
serialize() {
return `${this.key} not in '${this.valueKey}'`;
}
keys() {
return this._negated.keys();
}
negate() {
return this._negated;
}
};
ContextKeyNotEqualsExpr = class _ContextKeyNotEqualsExpr {
static create(key, value, negated = null) {
if (typeof value === "boolean") {
if (value) {
return ContextKeyNotExpr.create(key, negated);
}
return ContextKeyDefinedExpr.create(key, negated);
}
const constantValue = CONSTANT_VALUES.get(key);
if (typeof constantValue === "boolean") {
const falseValue = constantValue ? "true" : "false";
return value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
}
return new _ContextKeyNotEqualsExpr(key, value, negated);
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 5;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
const constantValue = CONSTANT_VALUES.get(this.key);
if (typeof constantValue === "boolean") {
const falseValue = constantValue ? "true" : "false";
return this.value === falseValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
}
return this;
}
evaluate(context) {
return context.getValue(this.key) != this.value;
}
serialize() {
return `${this.key} != '${this.value}'`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyEqualsExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeyNotExpr = class _ContextKeyNotExpr {
static create(key, negated = null) {
const constantValue = CONSTANT_VALUES.get(key);
if (typeof constantValue === "boolean") {
return constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
}
return new _ContextKeyNotExpr(key, negated);
}
constructor(key, negated) {
this.key = key;
this.negated = negated;
this.type = 3;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp1(this.key, other.key);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key;
}
return false;
}
substituteConstants() {
const constantValue = CONSTANT_VALUES.get(this.key);
if (typeof constantValue === "boolean") {
return constantValue ? ContextKeyFalseExpr.INSTANCE : ContextKeyTrueExpr.INSTANCE;
}
return this;
}
evaluate(context) {
return !context.getValue(this.key);
}
serialize() {
return `!${this.key}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyDefinedExpr.create(this.key, this);
}
return this.negated;
}
};
ContextKeyGreaterExpr = class _ContextKeyGreaterExpr {
static create(key, _value, negated = null) {
return withFloatOrStr(_value, (value) => new _ContextKeyGreaterExpr(key, value, negated));
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 12;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
if (typeof this.value === "string") {
return false;
}
return parseFloat(context.getValue(this.key)) > this.value;
}
serialize() {
return `${this.key} > ${this.value}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeySmallerEqualsExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeyGreaterEqualsExpr = class _ContextKeyGreaterEqualsExpr {
static create(key, _value, negated = null) {
return withFloatOrStr(_value, (value) => new _ContextKeyGreaterEqualsExpr(key, value, negated));
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 13;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
if (typeof this.value === "string") {
return false;
}
return parseFloat(context.getValue(this.key)) >= this.value;
}
serialize() {
return `${this.key} >= ${this.value}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeySmallerExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeySmallerExpr = class _ContextKeySmallerExpr {
static create(key, _value, negated = null) {
return withFloatOrStr(_value, (value) => new _ContextKeySmallerExpr(key, value, negated));
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 14;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
if (typeof this.value === "string") {
return false;
}
return parseFloat(context.getValue(this.key)) < this.value;
}
serialize() {
return `${this.key} < ${this.value}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyGreaterEqualsExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeySmallerEqualsExpr = class _ContextKeySmallerEqualsExpr {
static create(key, _value, negated = null) {
return withFloatOrStr(_value, (value) => new _ContextKeySmallerEqualsExpr(key, value, negated));
}
constructor(key, value, negated) {
this.key = key;
this.value = value;
this.negated = negated;
this.type = 15;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return cmp2(this.key, this.value, other.key, other.value);
}
equals(other) {
if (other.type === this.type) {
return this.key === other.key && this.value === other.value;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
if (typeof this.value === "string") {
return false;
}
return parseFloat(context.getValue(this.key)) <= this.value;
}
serialize() {
return `${this.key} <= ${this.value}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyGreaterExpr.create(this.key, this.value, this);
}
return this.negated;
}
};
ContextKeyRegexExpr = class _ContextKeyRegexExpr {
static create(key, regexp) {
return new _ContextKeyRegexExpr(key, regexp);
}
constructor(key, regexp) {
this.key = key;
this.regexp = regexp;
this.type = 7;
this.negated = null;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
const thisSource = this.regexp ? this.regexp.source : "";
const otherSource = other.regexp ? other.regexp.source : "";
if (thisSource < otherSource) {
return -1;
}
if (thisSource > otherSource) {
return 1;
}
return 0;
}
equals(other) {
if (other.type === this.type) {
const thisSource = this.regexp ? this.regexp.source : "";
const otherSource = other.regexp ? other.regexp.source : "";
return this.key === other.key && thisSource === otherSource;
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
const value = context.getValue(this.key);
return this.regexp ? this.regexp.test(value) : false;
}
serialize() {
const value = this.regexp ? `/${this.regexp.source}/${this.regexp.flags}` : "/invalid/";
return `${this.key} =~ ${value}`;
}
keys() {
return [this.key];
}
negate() {
if (!this.negated) {
this.negated = ContextKeyNotRegexExpr.create(this);
}
return this.negated;
}
};
ContextKeyNotRegexExpr = class _ContextKeyNotRegexExpr {
static create(actual) {
return new _ContextKeyNotRegexExpr(actual);
}
constructor(_actual) {
this._actual = _actual;
this.type = 8;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
return this._actual.cmp(other._actual);
}
equals(other) {
if (other.type === this.type) {
return this._actual.equals(other._actual);
}
return false;
}
substituteConstants() {
return this;
}
evaluate(context) {
return !this._actual.evaluate(context);
}
serialize() {
return `!(${this._actual.serialize()})`;
}
keys() {
return this._actual.keys();
}
negate() {
return this._actual;
}
};
ContextKeyAndExpr = class _ContextKeyAndExpr {
static create(_expr, negated, extraRedundantCheck) {
return _ContextKeyAndExpr._normalizeArr(_expr, negated, extraRedundantCheck);
}
constructor(expr, negated) {
this.expr = expr;
this.negated = negated;
this.type = 6;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
if (this.expr.length < other.expr.length) {
return -1;
}
if (this.expr.length > other.expr.length) {
return 1;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
const r = cmp(this.expr[i], other.expr[i]);
if (r !== 0) {
return r;
}
}
return 0;
}
equals(other) {
if (other.type === this.type) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
}
return false;
}
substituteConstants() {
const exprArr = eliminateConstantsInArray(this.expr);
if (exprArr === this.expr) {
return this;
}
return _ContextKeyAndExpr.create(exprArr, this.negated, false);
}
evaluate(context) {
for (let i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].evaluate(context)) {
return false;
}
}
return true;
}
static _normalizeArr(arr, negated, extraRedundantCheck) {
const expr = [];
let hasTrue = false;
for (const e of arr) {
if (!e) {
continue;
}
if (e.type === 1) {
hasTrue = true;
continue;
}
if (e.type === 0) {
return ContextKeyFalseExpr.INSTANCE;
}
if (e.type === 6) {
expr.push(...e.expr);
continue;
}
expr.push(e);
}
if (expr.length === 0 && hasTrue) {
return ContextKeyTrueExpr.INSTANCE;
}
if (expr.length === 0) {
return void 0;
}
if (expr.length === 1) {
return expr[0];
}
expr.sort(cmp);
for (let i = 1; i < expr.length; i++) {
if (expr[i - 1].equals(expr[i])) {
expr.splice(i, 1);
i--;
}
}
if (expr.length === 1) {
return expr[0];
}
while (expr.length > 1) {
const lastElement = expr[expr.length - 1];
if (lastElement.type !== 9) {
break;
}
expr.pop();
const secondToLastElement = expr.pop();
const isFinished = expr.length === 0;
const resultElement = ContextKeyOrExpr.create(lastElement.expr.map((el) => _ContextKeyAndExpr.create([el, secondToLastElement], null, extraRedundantCheck)), null, isFinished);
if (resultElement) {
expr.push(resultElement);
expr.sort(cmp);
}
}
if (expr.length === 1) {
return expr[0];
}
if (extraRedundantCheck) {
for (let i = 0; i < expr.length; i++) {
for (let j = i + 1; j < expr.length; j++) {
if (expr[i].negate().equals(expr[j])) {
return ContextKeyFalseExpr.INSTANCE;
}
}
}
if (expr.length === 1) {
return expr[0];
}
}
return new _ContextKeyAndExpr(expr, negated);
}
serialize() {
return this.expr.map((e) => e.serialize()).join(" && ");
}
keys() {
const result = [];
for (const expr of this.expr) {
result.push(...expr.keys());
}
return result;
}
negate() {
if (!this.negated) {
const result = [];
for (const expr of this.expr) {
result.push(expr.negate());
}
this.negated = ContextKeyOrExpr.create(result, this, true);
}
return this.negated;
}
};
ContextKeyOrExpr = class _ContextKeyOrExpr {
static create(_expr, negated, extraRedundantCheck) {
return _ContextKeyOrExpr._normalizeArr(_expr, negated, extraRedundantCheck);
}
constructor(expr, negated) {
this.expr = expr;
this.negated = negated;
this.type = 9;
}
cmp(other) {
if (other.type !== this.type) {
return this.type - other.type;
}
if (this.expr.length < other.expr.length) {
return -1;
}
if (this.expr.length > other.expr.length) {
return 1;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
const r = cmp(this.expr[i], other.expr[i]);
if (r !== 0) {
return r;
}
}
return 0;
}
equals(other) {
if (other.type === this.type) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (let i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
}
return false;
}
substituteConstants() {
const exprArr = eliminateConstantsInArray(this.expr);
if (exprArr === this.expr) {
return this;
}
return _ContextKeyOrExpr.create(exprArr, this.negated, false);
}
evaluate(context) {
for (let i = 0, len = this.expr.length; i < len; i++) {
if (this.expr[i].evaluate(context)) {
return true;
}
}
return false;
}
static _normalizeArr(arr, negated, extraRedundantCheck) {
let expr = [];
let hasFalse = false;
if (arr) {
for (let i = 0, len = arr.length; i < len; i++) {
const e = arr[i];
if (!e) {
continue;
}
if (e.type === 0) {
hasFalse = true;
continue;
}
if (e.type === 1) {
return ContextKeyTrueExpr.INSTANCE;
}
if (e.type === 9) {
expr = expr.concat(e.expr);
continue;
}
expr.push(e);
}
if (expr.length === 0 && hasFalse) {
return ContextKeyFalseExpr.INSTANCE;
}
expr.sort(cmp);
}
if (expr.length === 0) {
return void 0;
}
if (expr.length === 1) {
return expr[0];
}
for (let i = 1; i < expr.length; i++) {
if (expr[i - 1].equals(expr[i])) {
expr.splice(i, 1);
i--;
}
}
if (expr.length === 1) {
return expr[0];
}
if (extraRedundantCheck) {
for (let i = 0; i < expr.length; i++) {
for (let j = i + 1; j < expr.length; j++) {
if (expr[i].negate().equals(expr[j])) {
return ContextKeyTrueExpr.INSTANCE;
}
}
}
if (expr.length === 1) {
return expr[0];
}
}
return new _ContextKeyOrExpr(expr, negated);
}
serialize() {
return this.expr.map((e) => e.serialize()).join(" || ");
}
keys() {
const result = [];
for (const expr of this.expr) {
result.push(...expr.keys());
}
return result;
}
negate() {
if (!this.negated) {
const result = [];
for (const expr of this.expr) {
result.push(expr.negate());
}
while (result.length > 1) {
const LEFT = result.shift();
const RIGHT = result.shift();
const all = [];
for (const left of getTerminals(LEFT)) {
for (const right of getTerminals(RIGHT)) {
all.push(ContextKeyAndExpr.create([left, right], null, false));
}
}
result.unshift(_ContextKeyOrExpr.create(all, null, false));
}
this.negated = _ContextKeyOrExpr.create(result, this, true);
}
return this.negated;
}
};
RawContextKey = class _RawContextKey extends ContextKeyDefinedExpr {
static all() {
return _RawContextKey._info.values();
}
constructor(key, defaultValue, metaOrHide) {
super(key, null);
this._defaultValue = defaultValue;
if (typeof metaOrHide === "object") {
_RawContextKey._info.push(__spreadProps(__spreadValues({}, metaOrHide), { key }));
} else if (metaOrHide !== true) {
_RawContextKey._info.push({ key, description: metaOrHide, type: defaultValue !== null && defaultValue !== void 0 ? typeof defaultValue : void 0 });
}
}
bindTo(target) {
return target.createKey(this.key, this._defaultValue);
}
getValue(target) {
return target.getContextKeyValue(this.key);
}
toNegated() {
return this.negate();
}
isEqualTo(value) {
return ContextKeyEqualsExpr.create(this.key, value);
}
};
RawContextKey._info = [];
IContextKeyService = createDecorator("contextKeyService");
}
});
// node_modules/monaco-editor/esm/vs/base/common/assert.js
function ok(value, message) {
if (!value) {
throw new Error(message ? `Assertion failed (${message})` : "Assertion Failed");
}
}
function assertNever(value, message = "Unreachable") {
throw new Error(message);
}
function softAssert(condition) {
if (!condition) {
onUnexpectedError(new BugIndicatingError("Soft Assertion Failed"));
}
}
function assertFn(condition) {
if (!condition()) {
debugger;
condition();
onUnexpectedError(new BugIndicatingError("Assertion Failed"));
}
}
function checkAdjacentItems(items, predicate) {
let i = 0;
while (i < items.length - 1) {
const a3 = items[i];
const b = items[i + 1];
if (!predicate(a3, b)) {
return false;
}
i++;
}
return true;
}
var init_assert = __esm({
"node_modules/monaco-editor/esm/vs/base/common/assert.js"() {
init_errors();
}
});
// node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js
var RegistryImpl, Registry;
var init_platform2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js"() {
init_assert();
init_types();
RegistryImpl = class {
constructor() {
this.data = /* @__PURE__ */ new Map();
}
add(id, data) {
ok(isString(id));
ok(isObject(data));
ok(!this.data.has(id), "There is already an extension with this id");
this.data.set(id, data);
}
as(id) {
return this.data.get(id) || null;
}
};
Registry = new RegistryImpl();
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js
function sorter(a3, b) {
if (a3.weight1 !== b.weight1) {
return a3.weight1 - b.weight1;
}
if (a3.command && b.command) {
if (a3.command < b.command) {
return -1;
}
if (a3.command > b.command) {
return 1;
}
}
return a3.weight2 - b.weight2;
}
var KeybindingsRegistryImpl, KeybindingsRegistry, Extensions;
var init_keybindingsRegistry = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js"() {
init_keybindings();
init_platform();
init_commands();
init_platform2();
init_lifecycle();
init_linkedList();
KeybindingsRegistryImpl = class _KeybindingsRegistryImpl {
constructor() {
this._coreKeybindings = new LinkedList();
this._extensionKeybindings = [];
this._cachedMergedKeybindings = null;
}
/**
* Take current platform into account and reduce to primary & secondary.
*/
static bindToCurrentPlatform(kb) {
if (OS === 1) {
if (kb && kb.win) {
return kb.win;
}
} else if (OS === 2) {
if (kb && kb.mac) {
return kb.mac;
}
} else {
if (kb && kb.linux) {
return kb.linux;
}
}
return kb;
}
registerKeybindingRule(rule) {
const actualKb = _KeybindingsRegistryImpl.bindToCurrentPlatform(rule);
const result = new DisposableStore();
if (actualKb && actualKb.primary) {
const kk = decodeKeybinding(actualKb.primary, OS);
if (kk) {
result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when));
}
}
if (actualKb && Array.isArray(actualKb.secondary)) {
for (let i = 0, len = actualKb.secondary.length; i < len; i++) {
const k = actualKb.secondary[i];
const kk = decodeKeybinding(k, OS);
if (kk) {
result.add(this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when));
}
}
}
return result;
}
registerCommandAndKeybindingRule(desc) {
return combinedDisposable(this.registerKeybindingRule(desc), CommandsRegistry.registerCommand(desc));
}
_registerDefaultKeybinding(keybinding, commandId, commandArgs, weight1, weight22, when) {
const remove = this._coreKeybindings.push({
keybinding,
command: commandId,
commandArgs,
when,
weight1,
weight2: weight22,
extensionId: null,
isBuiltinExtension: false
});
this._cachedMergedKeybindings = null;
return toDisposable(() => {
remove();
this._cachedMergedKeybindings = null;
});
}
getDefaultKeybindings() {
if (!this._cachedMergedKeybindings) {
this._cachedMergedKeybindings = Array.from(this._coreKeybindings).concat(this._extensionKeybindings);
this._cachedMergedKeybindings.sort(sorter);
}
return this._cachedMergedKeybindings.slice(0);
}
};
KeybindingsRegistry = new KeybindingsRegistryImpl();
Extensions = {
EditorModes: "platform.keybindingsRegistry"
};
Registry.add(Extensions.EditorModes, KeybindingsRegistry);
}
});
// node_modules/monaco-editor/esm/vs/platform/actions/common/actions.js
function isIMenuItem(item) {
return item.command !== void 0;
}
function isISubmenuItem(item) {
return item.submenu !== void 0;
}
function registerAction2(ctor) {
const disposables = [];
const action = new ctor();
const _a10 = action.desc, { f1, menu, keybinding } = _a10, command = __objRest(_a10, ["f1", "menu", "keybinding"]);
if (CommandsRegistry.getCommand(command.id)) {
throw new Error(`Cannot register two commands with the same id: ${command.id}`);
}
disposables.push(CommandsRegistry.registerCommand({
id: command.id,
handler: (accessor, ...args) => action.run(accessor, ...args),
metadata: command.metadata
}));
if (Array.isArray(menu)) {
for (const item of menu) {
disposables.push(MenuRegistry.appendMenuItem(item.id, __spreadValues({ command: __spreadProps(__spreadValues({}, command), { precondition: item.precondition === null ? void 0 : command.precondition }) }, item)));
}
} else if (menu) {
disposables.push(MenuRegistry.appendMenuItem(menu.id, __spreadValues({ command: __spreadProps(__spreadValues({}, command), { precondition: menu.precondition === null ? void 0 : command.precondition }) }, menu)));
}
if (f1) {
disposables.push(MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command, when: command.precondition }));
disposables.push(MenuRegistry.addCommand(command));
}
if (Array.isArray(keybinding)) {
for (const item of keybinding) {
disposables.push(KeybindingsRegistry.registerKeybindingRule(__spreadProps(__spreadValues({}, item), {
id: command.id,
when: command.precondition ? ContextKeyExpr.and(command.precondition, item.when) : item.when
})));
}
} else if (keybinding) {
disposables.push(KeybindingsRegistry.registerKeybindingRule(__spreadProps(__spreadValues({}, keybinding), {
id: command.id,
when: command.precondition ? ContextKeyExpr.and(command.precondition, keybinding.when) : keybinding.when
})));
}
return {
dispose() {
dispose(disposables);
}
};
}
var __decorate, __param, MenuItemAction_1, MenuId, IMenuService, MenuRegistryChangeEvent, MenuRegistry, SubmenuItemAction, MenuItemAction, Action2;
var init_actions2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/actions/common/actions.js"() {
init_actions();
init_themables();
init_event();
init_lifecycle();
init_linkedList();
init_commands();
init_contextkey();
init_instantiation();
init_keybindingsRegistry();
__decorate = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MenuId = class _MenuId {
/**
* Create a new `MenuId` with the unique identifier. Will throw if a menu
* with the identifier already exists, use `MenuId.for(ident)` or a unique
* identifier
*/
constructor(identifier3) {
if (_MenuId._instances.has(identifier3)) {
throw new TypeError(`MenuId with identifier '${identifier3}' already exists. Use MenuId.for(ident) or a unique identifier`);
}
_MenuId._instances.set(identifier3, this);
this.id = identifier3;
}
};
MenuId._instances = /* @__PURE__ */ new Map();
MenuId.CommandPalette = new MenuId("CommandPalette");
MenuId.DebugBreakpointsContext = new MenuId("DebugBreakpointsContext");
MenuId.DebugCallStackContext = new MenuId("DebugCallStackContext");
MenuId.DebugConsoleContext = new MenuId("DebugConsoleContext");
MenuId.DebugVariablesContext = new MenuId("DebugVariablesContext");
MenuId.NotebookVariablesContext = new MenuId("NotebookVariablesContext");
MenuId.DebugHoverContext = new MenuId("DebugHoverContext");
MenuId.DebugWatchContext = new MenuId("DebugWatchContext");
MenuId.DebugToolBar = new MenuId("DebugToolBar");
MenuId.DebugToolBarStop = new MenuId("DebugToolBarStop");
MenuId.EditorContext = new MenuId("EditorContext");
MenuId.SimpleEditorContext = new MenuId("SimpleEditorContext");
MenuId.EditorContent = new MenuId("EditorContent");
MenuId.EditorLineNumberContext = new MenuId("EditorLineNumberContext");
MenuId.EditorContextCopy = new MenuId("EditorContextCopy");
MenuId.EditorContextPeek = new MenuId("EditorContextPeek");
MenuId.EditorContextShare = new MenuId("EditorContextShare");
MenuId.EditorTitle = new MenuId("EditorTitle");
MenuId.EditorTitleRun = new MenuId("EditorTitleRun");
MenuId.EditorTitleContext = new MenuId("EditorTitleContext");
MenuId.EditorTitleContextShare = new MenuId("EditorTitleContextShare");
MenuId.EmptyEditorGroup = new MenuId("EmptyEditorGroup");
MenuId.EmptyEditorGroupContext = new MenuId("EmptyEditorGroupContext");
MenuId.EditorTabsBarContext = new MenuId("EditorTabsBarContext");
MenuId.EditorTabsBarShowTabsSubmenu = new MenuId("EditorTabsBarShowTabsSubmenu");
MenuId.EditorTabsBarShowTabsZenModeSubmenu = new MenuId("EditorTabsBarShowTabsZenModeSubmenu");
MenuId.EditorActionsPositionSubmenu = new MenuId("EditorActionsPositionSubmenu");
MenuId.ExplorerContext = new MenuId("ExplorerContext");
MenuId.ExplorerContextShare = new MenuId("ExplorerContextShare");
MenuId.ExtensionContext = new MenuId("ExtensionContext");
MenuId.GlobalActivity = new MenuId("GlobalActivity");
MenuId.CommandCenter = new MenuId("CommandCenter");
MenuId.CommandCenterCenter = new MenuId("CommandCenterCenter");
MenuId.LayoutControlMenuSubmenu = new MenuId("LayoutControlMenuSubmenu");
MenuId.LayoutControlMenu = new MenuId("LayoutControlMenu");
MenuId.MenubarMainMenu = new MenuId("MenubarMainMenu");
MenuId.MenubarAppearanceMenu = new MenuId("MenubarAppearanceMenu");
MenuId.MenubarDebugMenu = new MenuId("MenubarDebugMenu");
MenuId.MenubarEditMenu = new MenuId("MenubarEditMenu");
MenuId.MenubarCopy = new MenuId("MenubarCopy");
MenuId.MenubarFileMenu = new MenuId("MenubarFileMenu");
MenuId.MenubarGoMenu = new MenuId("MenubarGoMenu");
MenuId.MenubarHelpMenu = new MenuId("MenubarHelpMenu");
MenuId.MenubarLayoutMenu = new MenuId("MenubarLayoutMenu");
MenuId.MenubarNewBreakpointMenu = new MenuId("MenubarNewBreakpointMenu");
MenuId.PanelAlignmentMenu = new MenuId("PanelAlignmentMenu");
MenuId.PanelPositionMenu = new MenuId("PanelPositionMenu");
MenuId.ActivityBarPositionMenu = new MenuId("ActivityBarPositionMenu");
MenuId.MenubarPreferencesMenu = new MenuId("MenubarPreferencesMenu");
MenuId.MenubarRecentMenu = new MenuId("MenubarRecentMenu");
MenuId.MenubarSelectionMenu = new MenuId("MenubarSelectionMenu");
MenuId.MenubarShare = new MenuId("MenubarShare");
MenuId.MenubarSwitchEditorMenu = new MenuId("MenubarSwitchEditorMenu");
MenuId.MenubarSwitchGroupMenu = new MenuId("MenubarSwitchGroupMenu");
MenuId.MenubarTerminalMenu = new MenuId("MenubarTerminalMenu");
MenuId.MenubarViewMenu = new MenuId("MenubarViewMenu");
MenuId.MenubarHomeMenu = new MenuId("MenubarHomeMenu");
MenuId.OpenEditorsContext = new MenuId("OpenEditorsContext");
MenuId.OpenEditorsContextShare = new MenuId("OpenEditorsContextShare");
MenuId.ProblemsPanelContext = new MenuId("ProblemsPanelContext");
MenuId.SCMInputBox = new MenuId("SCMInputBox");
MenuId.SCMChangesSeparator = new MenuId("SCMChangesSeparator");
MenuId.SCMIncomingChanges = new MenuId("SCMIncomingChanges");
MenuId.SCMIncomingChangesContext = new MenuId("SCMIncomingChangesContext");
MenuId.SCMIncomingChangesSetting = new MenuId("SCMIncomingChangesSetting");
MenuId.SCMOutgoingChanges = new MenuId("SCMOutgoingChanges");
MenuId.SCMOutgoingChangesContext = new MenuId("SCMOutgoingChangesContext");
MenuId.SCMOutgoingChangesSetting = new MenuId("SCMOutgoingChangesSetting");
MenuId.SCMIncomingChangesAllChangesContext = new MenuId("SCMIncomingChangesAllChangesContext");
MenuId.SCMIncomingChangesHistoryItemContext = new MenuId("SCMIncomingChangesHistoryItemContext");
MenuId.SCMOutgoingChangesAllChangesContext = new MenuId("SCMOutgoingChangesAllChangesContext");
MenuId.SCMOutgoingChangesHistoryItemContext = new MenuId("SCMOutgoingChangesHistoryItemContext");
MenuId.SCMChangeContext = new MenuId("SCMChangeContext");
MenuId.SCMResourceContext = new MenuId("SCMResourceContext");
MenuId.SCMResourceContextShare = new MenuId("SCMResourceContextShare");
MenuId.SCMResourceFolderContext = new MenuId("SCMResourceFolderContext");
MenuId.SCMResourceGroupContext = new MenuId("SCMResourceGroupContext");
MenuId.SCMSourceControl = new MenuId("SCMSourceControl");
MenuId.SCMSourceControlInline = new MenuId("SCMSourceControlInline");
MenuId.SCMSourceControlTitle = new MenuId("SCMSourceControlTitle");
MenuId.SCMTitle = new MenuId("SCMTitle");
MenuId.SearchContext = new MenuId("SearchContext");
MenuId.SearchActionMenu = new MenuId("SearchActionContext");
MenuId.StatusBarWindowIndicatorMenu = new MenuId("StatusBarWindowIndicatorMenu");
MenuId.StatusBarRemoteIndicatorMenu = new MenuId("StatusBarRemoteIndicatorMenu");
MenuId.StickyScrollContext = new MenuId("StickyScrollContext");
MenuId.TestItem = new MenuId("TestItem");
MenuId.TestItemGutter = new MenuId("TestItemGutter");
MenuId.TestMessageContext = new MenuId("TestMessageContext");
MenuId.TestMessageContent = new MenuId("TestMessageContent");
MenuId.TestPeekElement = new MenuId("TestPeekElement");
MenuId.TestPeekTitle = new MenuId("TestPeekTitle");
MenuId.TouchBarContext = new MenuId("TouchBarContext");
MenuId.TitleBarContext = new MenuId("TitleBarContext");
MenuId.TitleBarTitleContext = new MenuId("TitleBarTitleContext");
MenuId.TunnelContext = new MenuId("TunnelContext");
MenuId.TunnelPrivacy = new MenuId("TunnelPrivacy");
MenuId.TunnelProtocol = new MenuId("TunnelProtocol");
MenuId.TunnelPortInline = new MenuId("TunnelInline");
MenuId.TunnelTitle = new MenuId("TunnelTitle");
MenuId.TunnelLocalAddressInline = new MenuId("TunnelLocalAddressInline");
MenuId.TunnelOriginInline = new MenuId("TunnelOriginInline");
MenuId.ViewItemContext = new MenuId("ViewItemContext");
MenuId.ViewContainerTitle = new MenuId("ViewContainerTitle");
MenuId.ViewContainerTitleContext = new MenuId("ViewContainerTitleContext");
MenuId.ViewTitle = new MenuId("ViewTitle");
MenuId.ViewTitleContext = new MenuId("ViewTitleContext");
MenuId.CommentEditorActions = new MenuId("CommentEditorActions");
MenuId.CommentThreadTitle = new MenuId("CommentThreadTitle");
MenuId.CommentThreadActions = new MenuId("CommentThreadActions");
MenuId.CommentThreadAdditionalActions = new MenuId("CommentThreadAdditionalActions");
MenuId.CommentThreadTitleContext = new MenuId("CommentThreadTitleContext");
MenuId.CommentThreadCommentContext = new MenuId("CommentThreadCommentContext");
MenuId.CommentTitle = new MenuId("CommentTitle");
MenuId.CommentActions = new MenuId("CommentActions");
MenuId.CommentsViewThreadActions = new MenuId("CommentsViewThreadActions");
MenuId.InteractiveToolbar = new MenuId("InteractiveToolbar");
MenuId.InteractiveCellTitle = new MenuId("InteractiveCellTitle");
MenuId.InteractiveCellDelete = new MenuId("InteractiveCellDelete");
MenuId.InteractiveCellExecute = new MenuId("InteractiveCellExecute");
MenuId.InteractiveInputExecute = new MenuId("InteractiveInputExecute");
MenuId.IssueReporter = new MenuId("IssueReporter");
MenuId.NotebookToolbar = new MenuId("NotebookToolbar");
MenuId.NotebookStickyScrollContext = new MenuId("NotebookStickyScrollContext");
MenuId.NotebookCellTitle = new MenuId("NotebookCellTitle");
MenuId.NotebookCellDelete = new MenuId("NotebookCellDelete");
MenuId.NotebookCellInsert = new MenuId("NotebookCellInsert");
MenuId.NotebookCellBetween = new MenuId("NotebookCellBetween");
MenuId.NotebookCellListTop = new MenuId("NotebookCellTop");
MenuId.NotebookCellExecute = new MenuId("NotebookCellExecute");
MenuId.NotebookCellExecuteGoTo = new MenuId("NotebookCellExecuteGoTo");
MenuId.NotebookCellExecutePrimary = new MenuId("NotebookCellExecutePrimary");
MenuId.NotebookDiffCellInputTitle = new MenuId("NotebookDiffCellInputTitle");
MenuId.NotebookDiffCellMetadataTitle = new MenuId("NotebookDiffCellMetadataTitle");
MenuId.NotebookDiffCellOutputsTitle = new MenuId("NotebookDiffCellOutputsTitle");
MenuId.NotebookOutputToolbar = new MenuId("NotebookOutputToolbar");
MenuId.NotebookOutlineFilter = new MenuId("NotebookOutlineFilter");
MenuId.NotebookOutlineActionMenu = new MenuId("NotebookOutlineActionMenu");
MenuId.NotebookEditorLayoutConfigure = new MenuId("NotebookEditorLayoutConfigure");
MenuId.NotebookKernelSource = new MenuId("NotebookKernelSource");
MenuId.BulkEditTitle = new MenuId("BulkEditTitle");
MenuId.BulkEditContext = new MenuId("BulkEditContext");
MenuId.TimelineItemContext = new MenuId("TimelineItemContext");
MenuId.TimelineTitle = new MenuId("TimelineTitle");
MenuId.TimelineTitleContext = new MenuId("TimelineTitleContext");
MenuId.TimelineFilterSubMenu = new MenuId("TimelineFilterSubMenu");
MenuId.AccountsContext = new MenuId("AccountsContext");
MenuId.SidebarTitle = new MenuId("SidebarTitle");
MenuId.PanelTitle = new MenuId("PanelTitle");
MenuId.AuxiliaryBarTitle = new MenuId("AuxiliaryBarTitle");
MenuId.AuxiliaryBarHeader = new MenuId("AuxiliaryBarHeader");
MenuId.TerminalInstanceContext = new MenuId("TerminalInstanceContext");
MenuId.TerminalEditorInstanceContext = new MenuId("TerminalEditorInstanceContext");
MenuId.TerminalNewDropdownContext = new MenuId("TerminalNewDropdownContext");
MenuId.TerminalTabContext = new MenuId("TerminalTabContext");
MenuId.TerminalTabEmptyAreaContext = new MenuId("TerminalTabEmptyAreaContext");
MenuId.TerminalStickyScrollContext = new MenuId("TerminalStickyScrollContext");
MenuId.WebviewContext = new MenuId("WebviewContext");
MenuId.InlineCompletionsActions = new MenuId("InlineCompletionsActions");
MenuId.InlineEditActions = new MenuId("InlineEditActions");
MenuId.NewFile = new MenuId("NewFile");
MenuId.MergeInput1Toolbar = new MenuId("MergeToolbar1Toolbar");
MenuId.MergeInput2Toolbar = new MenuId("MergeToolbar2Toolbar");
MenuId.MergeBaseToolbar = new MenuId("MergeBaseToolbar");
MenuId.MergeInputResultToolbar = new MenuId("MergeToolbarResultToolbar");
MenuId.InlineSuggestionToolbar = new MenuId("InlineSuggestionToolbar");
MenuId.InlineEditToolbar = new MenuId("InlineEditToolbar");
MenuId.ChatContext = new MenuId("ChatContext");
MenuId.ChatCodeBlock = new MenuId("ChatCodeblock");
MenuId.ChatCompareBlock = new MenuId("ChatCompareBlock");
MenuId.ChatMessageTitle = new MenuId("ChatMessageTitle");
MenuId.ChatExecute = new MenuId("ChatExecute");
MenuId.ChatExecuteSecondary = new MenuId("ChatExecuteSecondary");
MenuId.ChatInputSide = new MenuId("ChatInputSide");
MenuId.AccessibleView = new MenuId("AccessibleView");
MenuId.MultiDiffEditorFileToolbar = new MenuId("MultiDiffEditorFileToolbar");
MenuId.DiffEditorHunkToolbar = new MenuId("DiffEditorHunkToolbar");
MenuId.DiffEditorSelectionToolbar = new MenuId("DiffEditorSelectionToolbar");
IMenuService = createDecorator("menuService");
MenuRegistryChangeEvent = class _MenuRegistryChangeEvent {
static for(id) {
let value = this._all.get(id);
if (!value) {
value = new _MenuRegistryChangeEvent(id);
this._all.set(id, value);
}
return value;
}
static merge(events) {
const ids = /* @__PURE__ */ new Set();
for (const item of events) {
if (item instanceof _MenuRegistryChangeEvent) {
ids.add(item.id);
}
}
return ids;
}
constructor(id) {
this.id = id;
this.has = (candidate) => candidate === id;
}
};
MenuRegistryChangeEvent._all = /* @__PURE__ */ new Map();
MenuRegistry = new class {
constructor() {
this._commands = /* @__PURE__ */ new Map();
this._menuItems = /* @__PURE__ */ new Map();
this._onDidChangeMenu = new MicrotaskEmitter({
merge: MenuRegistryChangeEvent.merge
});
this.onDidChangeMenu = this._onDidChangeMenu.event;
}
addCommand(command) {
this._commands.set(command.id, command);
this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));
return toDisposable(() => {
if (this._commands.delete(command.id)) {
this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(MenuId.CommandPalette));
}
});
}
getCommand(id) {
return this._commands.get(id);
}
getCommands() {
const map = /* @__PURE__ */ new Map();
this._commands.forEach((value, key) => map.set(key, value));
return map;
}
appendMenuItem(id, item) {
let list = this._menuItems.get(id);
if (!list) {
list = new LinkedList();
this._menuItems.set(id, list);
}
const rm = list.push(item);
this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));
return toDisposable(() => {
rm();
this._onDidChangeMenu.fire(MenuRegistryChangeEvent.for(id));
});
}
appendMenuItems(items) {
const result = new DisposableStore();
for (const { id, item } of items) {
result.add(this.appendMenuItem(id, item));
}
return result;
}
getMenuItems(id) {
let result;
if (this._menuItems.has(id)) {
result = [...this._menuItems.get(id)];
} else {
result = [];
}
if (id === MenuId.CommandPalette) {
this._appendImplicitItems(result);
}
return result;
}
_appendImplicitItems(result) {
const set = /* @__PURE__ */ new Set();
for (const item of result) {
if (isIMenuItem(item)) {
set.add(item.command.id);
if (item.alt) {
set.add(item.alt.id);
}
}
}
this._commands.forEach((command, id) => {
if (!set.has(id)) {
result.push({ command });
}
});
}
}();
SubmenuItemAction = class extends SubmenuAction {
constructor(item, hideActions, actions) {
super(`submenuitem.${item.submenu.id}`, typeof item.title === "string" ? item.title : item.title.value, actions, "submenu");
this.item = item;
this.hideActions = hideActions;
}
};
MenuItemAction = MenuItemAction_1 = class MenuItemAction2 {
static label(action, options2) {
return (options2 === null || options2 === void 0 ? void 0 : options2.renderShortTitle) && action.shortTitle ? typeof action.shortTitle === "string" ? action.shortTitle : action.shortTitle.value : typeof action.title === "string" ? action.title : action.title.value;
}
constructor(item, alt, options2, hideActions, menuKeybinding, contextKeyService, _commandService) {
var _a10, _b4;
this.hideActions = hideActions;
this.menuKeybinding = menuKeybinding;
this._commandService = _commandService;
this.id = item.id;
this.label = MenuItemAction_1.label(item, options2);
this.tooltip = (_b4 = typeof item.tooltip === "string" ? item.tooltip : (_a10 = item.tooltip) === null || _a10 === void 0 ? void 0 : _a10.value) !== null && _b4 !== void 0 ? _b4 : "";
this.enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);
this.checked = void 0;
let icon;
if (item.toggled) {
const toggled = item.toggled.condition ? item.toggled : { condition: item.toggled };
this.checked = contextKeyService.contextMatchesRules(toggled.condition);
if (this.checked && toggled.tooltip) {
this.tooltip = typeof toggled.tooltip === "string" ? toggled.tooltip : toggled.tooltip.value;
}
if (this.checked && ThemeIcon.isThemeIcon(toggled.icon)) {
icon = toggled.icon;
}
if (this.checked && toggled.title) {
this.label = typeof toggled.title === "string" ? toggled.title : toggled.title.value;
}
}
if (!icon) {
icon = ThemeIcon.isThemeIcon(item.icon) ? item.icon : void 0;
}
this.item = item;
this.alt = alt ? new MenuItemAction_1(alt, void 0, options2, hideActions, void 0, contextKeyService, _commandService) : void 0;
this._options = options2;
this.class = icon && ThemeIcon.asClassName(icon);
}
run(...args) {
var _a10, _b4;
let runArgs = [];
if ((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.arg) {
runArgs = [...runArgs, this._options.arg];
}
if ((_b4 = this._options) === null || _b4 === void 0 ? void 0 : _b4.shouldForwardArgs) {
runArgs = [...runArgs, ...args];
}
return this._commandService.executeCommand(this.id, ...runArgs);
}
};
MenuItemAction = MenuItemAction_1 = __decorate([
__param(5, IContextKeyService),
__param(6, ICommandService)
], MenuItemAction);
Action2 = class {
constructor(desc) {
this.desc = desc;
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/telemetry/common/telemetry.js
var ITelemetryService;
var init_telemetry = __esm({
"node_modules/monaco-editor/esm/vs/platform/telemetry/common/telemetry.js"() {
init_instantiation();
ITelemetryService = createDecorator("telemetryService");
}
});
// node_modules/monaco-editor/esm/vs/platform/log/common/log.js
function LogLevelToString(logLevel) {
switch (logLevel) {
case LogLevel.Trace:
return "trace";
case LogLevel.Debug:
return "debug";
case LogLevel.Info:
return "info";
case LogLevel.Warning:
return "warn";
case LogLevel.Error:
return "error";
case LogLevel.Off:
return "off";
}
}
var ILogService, LogLevel, DEFAULT_LOG_LEVEL, AbstractLogger, ConsoleLogger, MultiplexLogger, CONTEXT_LOG_LEVEL;
var init_log = __esm({
"node_modules/monaco-editor/esm/vs/platform/log/common/log.js"() {
init_event();
init_lifecycle();
init_contextkey();
init_instantiation();
ILogService = createDecorator("logService");
(function(LogLevel2) {
LogLevel2[LogLevel2["Off"] = 0] = "Off";
LogLevel2[LogLevel2["Trace"] = 1] = "Trace";
LogLevel2[LogLevel2["Debug"] = 2] = "Debug";
LogLevel2[LogLevel2["Info"] = 3] = "Info";
LogLevel2[LogLevel2["Warning"] = 4] = "Warning";
LogLevel2[LogLevel2["Error"] = 5] = "Error";
})(LogLevel || (LogLevel = {}));
DEFAULT_LOG_LEVEL = LogLevel.Info;
AbstractLogger = class extends Disposable {
constructor() {
super(...arguments);
this.level = DEFAULT_LOG_LEVEL;
this._onDidChangeLogLevel = this._register(new Emitter());
this.onDidChangeLogLevel = this._onDidChangeLogLevel.event;
}
setLevel(level) {
if (this.level !== level) {
this.level = level;
this._onDidChangeLogLevel.fire(this.level);
}
}
getLevel() {
return this.level;
}
checkLogLevel(level) {
return this.level !== LogLevel.Off && this.level <= level;
}
};
ConsoleLogger = class extends AbstractLogger {
constructor(logLevel = DEFAULT_LOG_LEVEL, useColors = true) {
super();
this.useColors = useColors;
this.setLevel(logLevel);
}
trace(message, ...args) {
if (this.checkLogLevel(LogLevel.Trace)) {
if (this.useColors) {
console.log("%cTRACE", "color: #888", message, ...args);
} else {
console.log(message, ...args);
}
}
}
debug(message, ...args) {
if (this.checkLogLevel(LogLevel.Debug)) {
if (this.useColors) {
console.log("%cDEBUG", "background: #eee; color: #888", message, ...args);
} else {
console.log(message, ...args);
}
}
}
info(message, ...args) {
if (this.checkLogLevel(LogLevel.Info)) {
if (this.useColors) {
console.log("%c INFO", "color: #33f", message, ...args);
} else {
console.log(message, ...args);
}
}
}
warn(message, ...args) {
if (this.checkLogLevel(LogLevel.Warning)) {
if (this.useColors) {
console.log("%c WARN", "color: #993", message, ...args);
} else {
console.log(message, ...args);
}
}
}
error(message, ...args) {
if (this.checkLogLevel(LogLevel.Error)) {
if (this.useColors) {
console.log("%c ERR", "color: #f33", message, ...args);
} else {
console.error(message, ...args);
}
}
}
};
MultiplexLogger = class extends AbstractLogger {
constructor(loggers) {
super();
this.loggers = loggers;
if (loggers.length) {
this.setLevel(loggers[0].getLevel());
}
}
setLevel(level) {
for (const logger of this.loggers) {
logger.setLevel(level);
}
super.setLevel(level);
}
trace(message, ...args) {
for (const logger of this.loggers) {
logger.trace(message, ...args);
}
}
debug(message, ...args) {
for (const logger of this.loggers) {
logger.debug(message, ...args);
}
}
info(message, ...args) {
for (const logger of this.loggers) {
logger.info(message, ...args);
}
}
warn(message, ...args) {
for (const logger of this.loggers) {
logger.warn(message, ...args);
}
}
error(message, ...args) {
for (const logger of this.loggers) {
logger.error(message, ...args);
}
}
dispose() {
for (const logger of this.loggers) {
logger.dispose();
}
super.dispose();
}
};
CONTEXT_LOG_LEVEL = new RawContextKey("logLevel", LogLevelToString(LogLevel.Info));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js
function registerModelAndPositionCommand(id, handler) {
CommandsRegistry.registerCommand(id, function(accessor, ...args) {
const instaService = accessor.get(IInstantiationService);
const [resource, position] = args;
assertType(URI.isUri(resource));
assertType(Position.isIPosition(position));
const model = accessor.get(IModelService).getModel(resource);
if (model) {
const editorPosition = Position.lift(position);
return instaService.invokeFunction(handler, model, editorPosition, ...args.slice(2));
}
return accessor.get(ITextModelService).createModelReference(resource).then((reference) => {
return new Promise((resolve2, reject) => {
try {
const result = instaService.invokeFunction(handler, reference.object.textEditorModel, Position.lift(position), args.slice(2));
resolve2(result);
} catch (err) {
reject(err);
}
}).finally(() => {
reference.dispose();
});
});
});
}
function registerEditorCommand(editorCommand) {
EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand);
return editorCommand;
}
function registerEditorAction(ctor) {
const action = new ctor();
EditorContributionRegistry.INSTANCE.registerEditorAction(action);
return action;
}
function registerMultiEditorAction(action) {
EditorContributionRegistry.INSTANCE.registerEditorAction(action);
return action;
}
function registerInstantiatedEditorAction(editorAction) {
EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);
}
function registerEditorContribution(id, ctor, instantiation) {
EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor, instantiation);
}
function registerCommand(command) {
command.register();
return command;
}
var Command2, MultiCommand, ProxyCommand, EditorCommand, EditorAction, MultiEditorAction, EditorAction2, EditorExtensionsRegistry, Extensions2, EditorContributionRegistry, UndoCommand, RedoCommand, SelectAllCommand;
var init_editorExtensions = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js"() {
init_nls();
init_uri();
init_codeEditorService();
init_position();
init_model();
init_resolverService();
init_actions2();
init_commands();
init_contextkey();
init_instantiation();
init_keybindingsRegistry();
init_platform2();
init_telemetry();
init_types();
init_log();
init_dom();
Command2 = class {
constructor(opts) {
this.id = opts.id;
this.precondition = opts.precondition;
this._kbOpts = opts.kbOpts;
this._menuOpts = opts.menuOpts;
this.metadata = opts.metadata;
}
register() {
if (Array.isArray(this._menuOpts)) {
this._menuOpts.forEach(this._registerMenuItem, this);
} else if (this._menuOpts) {
this._registerMenuItem(this._menuOpts);
}
if (this._kbOpts) {
const kbOptsArr = Array.isArray(this._kbOpts) ? this._kbOpts : [this._kbOpts];
for (const kbOpts of kbOptsArr) {
let kbWhen = kbOpts.kbExpr;
if (this.precondition) {
if (kbWhen) {
kbWhen = ContextKeyExpr.and(kbWhen, this.precondition);
} else {
kbWhen = this.precondition;
}
}
const desc = {
id: this.id,
weight: kbOpts.weight,
args: kbOpts.args,
when: kbWhen,
primary: kbOpts.primary,
secondary: kbOpts.secondary,
win: kbOpts.win,
linux: kbOpts.linux,
mac: kbOpts.mac
};
KeybindingsRegistry.registerKeybindingRule(desc);
}
}
CommandsRegistry.registerCommand({
id: this.id,
handler: (accessor, args) => this.runCommand(accessor, args),
metadata: this.metadata
});
}
_registerMenuItem(item) {
MenuRegistry.appendMenuItem(item.menuId, {
group: item.group,
command: {
id: this.id,
title: item.title,
icon: item.icon,
precondition: this.precondition
},
when: item.when,
order: item.order
});
}
};
MultiCommand = class extends Command2 {
constructor() {
super(...arguments);
this._implementations = [];
}
/**
* A higher priority gets to be looked at first
*/
addImplementation(priority, name, implementation, when) {
this._implementations.push({ priority, name, implementation, when });
this._implementations.sort((a3, b) => b.priority - a3.priority);
return {
dispose: () => {
for (let i = 0; i < this._implementations.length; i++) {
if (this._implementations[i].implementation === implementation) {
this._implementations.splice(i, 1);
return;
}
}
}
};
}
runCommand(accessor, args) {
const logService = accessor.get(ILogService);
const contextKeyService = accessor.get(IContextKeyService);
logService.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);
for (const impl of this._implementations) {
if (impl.when) {
const context = contextKeyService.getContext(getActiveElement());
const value = impl.when.evaluate(context);
if (!value) {
continue;
}
}
const result = impl.implementation(accessor, args);
if (result) {
logService.trace(`Command '${this.id}' was handled by '${impl.name}'.`);
if (typeof result === "boolean") {
return;
}
return result;
}
}
logService.trace(`The Command '${this.id}' was not handled by any implementation.`);
}
};
ProxyCommand = class extends Command2 {
constructor(command, opts) {
super(opts);
this.command = command;
}
runCommand(accessor, args) {
return this.command.runCommand(accessor, args);
}
};
EditorCommand = class _EditorCommand extends Command2 {
/**
* Create a command class that is bound to a certain editor contribution.
*/
static bindToContribution(controllerGetter) {
return class EditorControllerCommandImpl extends _EditorCommand {
constructor(opts) {
super(opts);
this._callback = opts.handler;
}
runEditorCommand(accessor, editor2, args) {
const controller = controllerGetter(editor2);
if (controller) {
this._callback(controller, args);
}
}
};
}
static runEditorCommand(accessor, args, precondition, runner) {
const codeEditorService = accessor.get(ICodeEditorService);
const editor2 = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();
if (!editor2) {
return;
}
return editor2.invokeWithinContext((editorAccessor) => {
const kbService = editorAccessor.get(IContextKeyService);
if (!kbService.contextMatchesRules(precondition !== null && precondition !== void 0 ? precondition : void 0)) {
return;
}
return runner(editorAccessor, editor2, args);
});
}
runCommand(accessor, args) {
return _EditorCommand.runEditorCommand(accessor, args, this.precondition, (accessor2, editor2, args2) => this.runEditorCommand(accessor2, editor2, args2));
}
};
EditorAction = class _EditorAction extends EditorCommand {
static convertOptions(opts) {
let menuOpts;
if (Array.isArray(opts.menuOpts)) {
menuOpts = opts.menuOpts;
} else if (opts.menuOpts) {
menuOpts = [opts.menuOpts];
} else {
menuOpts = [];
}
function withDefaults(item) {
if (!item.menuId) {
item.menuId = MenuId.EditorContext;
}
if (!item.title) {
item.title = opts.label;
}
item.when = ContextKeyExpr.and(opts.precondition, item.when);
return item;
}
if (Array.isArray(opts.contextMenuOpts)) {
menuOpts.push(...opts.contextMenuOpts.map(withDefaults));
} else if (opts.contextMenuOpts) {
menuOpts.push(withDefaults(opts.contextMenuOpts));
}
opts.menuOpts = menuOpts;
return opts;
}
constructor(opts) {
super(_EditorAction.convertOptions(opts));
this.label = opts.label;
this.alias = opts.alias;
}
runEditorCommand(accessor, editor2, args) {
this.reportTelemetry(accessor, editor2);
return this.run(accessor, editor2, args || {});
}
reportTelemetry(accessor, editor2) {
accessor.get(ITelemetryService).publicLog2("editorActionInvoked", { name: this.label, id: this.id });
}
};
MultiEditorAction = class extends EditorAction {
constructor() {
super(...arguments);
this._implementations = [];
}
/**
* A higher priority gets to be looked at first
*/
addImplementation(priority, implementation) {
this._implementations.push([priority, implementation]);
this._implementations.sort((a3, b) => b[0] - a3[0]);
return {
dispose: () => {
for (let i = 0; i < this._implementations.length; i++) {
if (this._implementations[i][1] === implementation) {
this._implementations.splice(i, 1);
return;
}
}
}
};
}
run(accessor, editor2, args) {
for (const impl of this._implementations) {
const result = impl[1](accessor, editor2, args);
if (result) {
if (typeof result === "boolean") {
return;
}
return result;
}
}
}
};
EditorAction2 = class extends Action2 {
run(accessor, ...args) {
const codeEditorService = accessor.get(ICodeEditorService);
const editor2 = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();
if (!editor2) {
return;
}
return editor2.invokeWithinContext((editorAccessor) => {
var _a10, _b4;
const kbService = editorAccessor.get(IContextKeyService);
const logService = editorAccessor.get(ILogService);
const enabled = kbService.contextMatchesRules((_a10 = this.desc.precondition) !== null && _a10 !== void 0 ? _a10 : void 0);
if (!enabled) {
logService.debug(`[EditorAction2] NOT running command because its precondition is FALSE`, this.desc.id, (_b4 = this.desc.precondition) === null || _b4 === void 0 ? void 0 : _b4.serialize());
return;
}
return this.runEditorCommand(editorAccessor, editor2, ...args);
});
}
};
(function(EditorExtensionsRegistry2) {
function getEditorCommand(commandId) {
return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);
}
EditorExtensionsRegistry2.getEditorCommand = getEditorCommand;
function getEditorActions() {
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
EditorExtensionsRegistry2.getEditorActions = getEditorActions;
function getEditorContributions() {
return EditorContributionRegistry.INSTANCE.getEditorContributions();
}
EditorExtensionsRegistry2.getEditorContributions = getEditorContributions;
function getSomeEditorContributions(ids) {
return EditorContributionRegistry.INSTANCE.getEditorContributions().filter((c) => ids.indexOf(c.id) >= 0);
}
EditorExtensionsRegistry2.getSomeEditorContributions = getSomeEditorContributions;
function getDiffEditorContributions() {
return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();
}
EditorExtensionsRegistry2.getDiffEditorContributions = getDiffEditorContributions;
})(EditorExtensionsRegistry || (EditorExtensionsRegistry = {}));
Extensions2 = {
EditorCommonContributions: "editor.contributions"
};
EditorContributionRegistry = class {
constructor() {
this.editorContributions = [];
this.diffEditorContributions = [];
this.editorActions = [];
this.editorCommands = /* @__PURE__ */ Object.create(null);
}
registerEditorContribution(id, ctor, instantiation) {
this.editorContributions.push({ id, ctor, instantiation });
}
getEditorContributions() {
return this.editorContributions.slice(0);
}
getDiffEditorContributions() {
return this.diffEditorContributions.slice(0);
}
registerEditorAction(action) {
action.register();
this.editorActions.push(action);
}
getEditorActions() {
return this.editorActions;
}
registerEditorCommand(editorCommand) {
editorCommand.register();
this.editorCommands[editorCommand.id] = editorCommand;
}
getEditorCommand(commandId) {
return this.editorCommands[commandId] || null;
}
};
EditorContributionRegistry.INSTANCE = new EditorContributionRegistry();
Registry.add(Extensions2.EditorCommonContributions, EditorContributionRegistry.INSTANCE);
UndoCommand = registerCommand(new MultiCommand({
id: "undo",
precondition: void 0,
kbOpts: {
weight: 0,
primary: 2048 | 56
/* KeyCode.KeyZ */
},
menuOpts: [{
menuId: MenuId.MenubarEditMenu,
group: "1_do",
title: localize({ key: "miUndo", comment: ["&& denotes a mnemonic"] }, "&&Undo"),
order: 1
}, {
menuId: MenuId.CommandPalette,
group: "",
title: localize("undo", "Undo"),
order: 1
}]
}));
registerCommand(new ProxyCommand(UndoCommand, { id: "default:undo", precondition: void 0 }));
RedoCommand = registerCommand(new MultiCommand({
id: "redo",
precondition: void 0,
kbOpts: {
weight: 0,
primary: 2048 | 55,
secondary: [
2048 | 1024 | 56
/* KeyCode.KeyZ */
],
mac: {
primary: 2048 | 1024 | 56
/* KeyCode.KeyZ */
}
},
menuOpts: [{
menuId: MenuId.MenubarEditMenu,
group: "1_do",
title: localize({ key: "miRedo", comment: ["&& denotes a mnemonic"] }, "&&Redo"),
order: 2
}, {
menuId: MenuId.CommandPalette,
group: "",
title: localize("redo", "Redo"),
order: 1
}]
}));
registerCommand(new ProxyCommand(RedoCommand, { id: "default:redo", precondition: void 0 }));
SelectAllCommand = registerCommand(new MultiCommand({
id: "editor.action.selectAll",
precondition: void 0,
kbOpts: {
weight: 0,
kbExpr: null,
primary: 2048 | 31
/* KeyCode.KeyA */
},
menuOpts: [{
menuId: MenuId.MenubarSelectionMenu,
group: "1_basic",
title: localize({ key: "miSelectAll", comment: ["&& denotes a mnemonic"] }, "&&Select All"),
order: 1
}, {
menuId: MenuId.CommandPalette,
group: "",
title: localize("selectAll", "Select All"),
order: 1
}]
}));
}
});
// node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js
function logOnceWebWorkerWarning(err) {
if (!isWeb) {
return;
}
if (!webWorkerWarningLogged) {
webWorkerWarningLogged = true;
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(err.message);
}
function propertyIsEvent(name) {
return name[0] === "o" && name[1] === "n" && isUpperAsciiLetter(name.charCodeAt(2));
}
function propertyIsDynamicEvent(name) {
return /^onDynamic/.test(name) && isUpperAsciiLetter(name.charCodeAt(9));
}
function createProxyObject2(methodNames, invoke, proxyListen) {
const createProxyMethod = (method) => {
return function() {
const args = Array.prototype.slice.call(arguments, 0);
return invoke(method, args);
};
};
const createProxyDynamicEvent = (eventName) => {
return function(arg) {
return proxyListen(eventName, arg);
};
};
const result = {};
for (const methodName of methodNames) {
if (propertyIsDynamicEvent(methodName)) {
result[methodName] = createProxyDynamicEvent(methodName);
continue;
}
if (propertyIsEvent(methodName)) {
result[methodName] = proxyListen(methodName, void 0);
continue;
}
result[methodName] = createProxyMethod(methodName);
}
return result;
}
var INITIALIZE, webWorkerWarningLogged, RequestMessage, ReplyMessage, SubscribeEventMessage, EventMessage, UnsubscribeEventMessage, SimpleWorkerProtocol, SimpleWorkerClient, SimpleWorkerServer;
var init_simpleWorker = __esm({
"node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js"() {
init_errors();
init_event();
init_lifecycle();
init_objects();
init_platform();
init_strings();
INITIALIZE = "$initialize";
webWorkerWarningLogged = false;
RequestMessage = class {
constructor(vsWorker, req, method, args) {
this.vsWorker = vsWorker;
this.req = req;
this.method = method;
this.args = args;
this.type = 0;
}
};
ReplyMessage = class {
constructor(vsWorker, seq, res, err) {
this.vsWorker = vsWorker;
this.seq = seq;
this.res = res;
this.err = err;
this.type = 1;
}
};
SubscribeEventMessage = class {
constructor(vsWorker, req, eventName, arg) {
this.vsWorker = vsWorker;
this.req = req;
this.eventName = eventName;
this.arg = arg;
this.type = 2;
}
};
EventMessage = class {
constructor(vsWorker, req, event) {
this.vsWorker = vsWorker;
this.req = req;
this.event = event;
this.type = 3;
}
};
UnsubscribeEventMessage = class {
constructor(vsWorker, req) {
this.vsWorker = vsWorker;
this.req = req;
this.type = 4;
}
};
SimpleWorkerProtocol = class {
constructor(handler) {
this._workerId = -1;
this._handler = handler;
this._lastSentReq = 0;
this._pendingReplies = /* @__PURE__ */ Object.create(null);
this._pendingEmitters = /* @__PURE__ */ new Map();
this._pendingEvents = /* @__PURE__ */ new Map();
}
setWorkerId(workerId) {
this._workerId = workerId;
}
sendMessage(method, args) {
const req = String(++this._lastSentReq);
return new Promise((resolve2, reject) => {
this._pendingReplies[req] = {
resolve: resolve2,
reject
};
this._send(new RequestMessage(this._workerId, req, method, args));
});
}
listen(eventName, arg) {
let req = null;
const emitter = new Emitter({
onWillAddFirstListener: () => {
req = String(++this._lastSentReq);
this._pendingEmitters.set(req, emitter);
this._send(new SubscribeEventMessage(this._workerId, req, eventName, arg));
},
onDidRemoveLastListener: () => {
this._pendingEmitters.delete(req);
this._send(new UnsubscribeEventMessage(this._workerId, req));
req = null;
}
});
return emitter.event;
}
handleMessage(message) {
if (!message || !message.vsWorker) {
return;
}
if (this._workerId !== -1 && message.vsWorker !== this._workerId) {
return;
}
this._handleMessage(message);
}
_handleMessage(msg) {
switch (msg.type) {
case 1:
return this._handleReplyMessage(msg);
case 0:
return this._handleRequestMessage(msg);
case 2:
return this._handleSubscribeEventMessage(msg);
case 3:
return this._handleEventMessage(msg);
case 4:
return this._handleUnsubscribeEventMessage(msg);
}
}
_handleReplyMessage(replyMessage) {
if (!this._pendingReplies[replyMessage.seq]) {
console.warn("Got reply to unknown seq");
return;
}
const reply = this._pendingReplies[replyMessage.seq];
delete this._pendingReplies[replyMessage.seq];
if (replyMessage.err) {
let err = replyMessage.err;
if (replyMessage.err.$isError) {
err = new Error();
err.name = replyMessage.err.name;
err.message = replyMessage.err.message;
err.stack = replyMessage.err.stack;
}
reply.reject(err);
return;
}
reply.resolve(replyMessage.res);
}
_handleRequestMessage(requestMessage) {
const req = requestMessage.req;
const result = this._handler.handleMessage(requestMessage.method, requestMessage.args);
result.then((r) => {
this._send(new ReplyMessage(this._workerId, req, r, void 0));
}, (e) => {
if (e.detail instanceof Error) {
e.detail = transformErrorForSerialization(e.detail);
}
this._send(new ReplyMessage(this._workerId, req, void 0, transformErrorForSerialization(e)));
});
}
_handleSubscribeEventMessage(msg) {
const req = msg.req;
const disposable = this._handler.handleEvent(msg.eventName, msg.arg)((event) => {
this._send(new EventMessage(this._workerId, req, event));
});
this._pendingEvents.set(req, disposable);
}
_handleEventMessage(msg) {
if (!this._pendingEmitters.has(msg.req)) {
console.warn("Got event for unknown req");
return;
}
this._pendingEmitters.get(msg.req).fire(msg.event);
}
_handleUnsubscribeEventMessage(msg) {
if (!this._pendingEvents.has(msg.req)) {
console.warn("Got unsubscribe for unknown req");
return;
}
this._pendingEvents.get(msg.req).dispose();
this._pendingEvents.delete(msg.req);
}
_send(msg) {
const transfer = [];
if (msg.type === 0) {
for (let i = 0; i < msg.args.length; i++) {
if (msg.args[i] instanceof ArrayBuffer) {
transfer.push(msg.args[i]);
}
}
} else if (msg.type === 1) {
if (msg.res instanceof ArrayBuffer) {
transfer.push(msg.res);
}
}
this._handler.sendMessage(msg, transfer);
}
};
SimpleWorkerClient = class extends Disposable {
constructor(workerFactory, moduleId, host) {
super();
let lazyProxyReject = null;
this._worker = this._register(workerFactory.create("vs/base/common/worker/simpleWorker", (msg) => {
this._protocol.handleMessage(msg);
}, (err) => {
lazyProxyReject === null || lazyProxyReject === void 0 ? void 0 : lazyProxyReject(err);
}));
this._protocol = new SimpleWorkerProtocol({
sendMessage: (msg, transfer) => {
this._worker.postMessage(msg, transfer);
},
handleMessage: (method, args) => {
if (typeof host[method] !== "function") {
return Promise.reject(new Error("Missing method " + method + " on main thread host."));
}
try {
return Promise.resolve(host[method].apply(host, args));
} catch (e) {
return Promise.reject(e);
}
},
handleEvent: (eventName, arg) => {
if (propertyIsDynamicEvent(eventName)) {
const event = host[eventName].call(host, arg);
if (typeof event !== "function") {
throw new Error(`Missing dynamic event ${eventName} on main thread host.`);
}
return event;
}
if (propertyIsEvent(eventName)) {
const event = host[eventName];
if (typeof event !== "function") {
throw new Error(`Missing event ${eventName} on main thread host.`);
}
return event;
}
throw new Error(`Malformed event name ${eventName}`);
}
});
this._protocol.setWorkerId(this._worker.getId());
let loaderConfiguration = null;
const globalRequire = globalThis.require;
if (typeof globalRequire !== "undefined" && typeof globalRequire.getConfig === "function") {
loaderConfiguration = globalRequire.getConfig();
} else if (typeof globalThis.requirejs !== "undefined") {
loaderConfiguration = globalThis.requirejs.s.contexts._.config;
}
const hostMethods = getAllMethodNames(host);
this._onModuleLoaded = this._protocol.sendMessage(INITIALIZE, [
this._worker.getId(),
JSON.parse(JSON.stringify(loaderConfiguration)),
moduleId,
hostMethods
]);
const proxyMethodRequest = (method, args) => {
return this._request(method, args);
};
const proxyListen = (eventName, arg) => {
return this._protocol.listen(eventName, arg);
};
this._lazyProxy = new Promise((resolve2, reject) => {
lazyProxyReject = reject;
this._onModuleLoaded.then((availableMethods) => {
resolve2(createProxyObject2(availableMethods, proxyMethodRequest, proxyListen));
}, (e) => {
reject(e);
this._onError("Worker failed to load " + moduleId, e);
});
});
}
getProxyObject() {
return this._lazyProxy;
}
_request(method, args) {
return new Promise((resolve2, reject) => {
this._onModuleLoaded.then(() => {
this._protocol.sendMessage(method, args).then(resolve2, reject);
}, reject);
});
}
_onError(message, error) {
console.error(message);
console.info(error);
}
};
SimpleWorkerServer = class {
constructor(postMessage, requestHandlerFactory) {
this._requestHandlerFactory = requestHandlerFactory;
this._requestHandler = null;
this._protocol = new SimpleWorkerProtocol({
sendMessage: (msg, transfer) => {
postMessage(msg, transfer);
},
handleMessage: (method, args) => this._handleMessage(method, args),
handleEvent: (eventName, arg) => this._handleEvent(eventName, arg)
});
}
onmessage(msg) {
this._protocol.handleMessage(msg);
}
_handleMessage(method, args) {
if (method === INITIALIZE) {
return this.initialize(args[0], args[1], args[2], args[3]);
}
if (!this._requestHandler || typeof this._requestHandler[method] !== "function") {
return Promise.reject(new Error("Missing requestHandler or method: " + method));
}
try {
return Promise.resolve(this._requestHandler[method].apply(this._requestHandler, args));
} catch (e) {
return Promise.reject(e);
}
}
_handleEvent(eventName, arg) {
if (!this._requestHandler) {
throw new Error(`Missing requestHandler`);
}
if (propertyIsDynamicEvent(eventName)) {
const event = this._requestHandler[eventName].call(this._requestHandler, arg);
if (typeof event !== "function") {
throw new Error(`Missing dynamic event ${eventName} on request handler.`);
}
return event;
}
if (propertyIsEvent(eventName)) {
const event = this._requestHandler[eventName];
if (typeof event !== "function") {
throw new Error(`Missing event ${eventName} on request handler.`);
}
return event;
}
throw new Error(`Malformed event name ${eventName}`);
}
initialize(workerId, loaderConfig, moduleId, hostMethods) {
this._protocol.setWorkerId(workerId);
const proxyMethodRequest = (method, args) => {
return this._protocol.sendMessage(method, args);
};
const proxyListen = (eventName, arg) => {
return this._protocol.listen(eventName, arg);
};
const hostProxy = createProxyObject2(hostMethods, proxyMethodRequest, proxyListen);
if (this._requestHandlerFactory) {
this._requestHandler = this._requestHandlerFactory(hostProxy);
return Promise.resolve(getAllMethodNames(this._requestHandler));
}
if (loaderConfig) {
if (typeof loaderConfig.baseUrl !== "undefined") {
delete loaderConfig["baseUrl"];
}
if (typeof loaderConfig.paths !== "undefined") {
if (typeof loaderConfig.paths.vs !== "undefined") {
delete loaderConfig.paths["vs"];
}
}
if (typeof loaderConfig.trustedTypesPolicy !== "undefined") {
delete loaderConfig["trustedTypesPolicy"];
}
loaderConfig.catchError = true;
globalThis.require.config(loaderConfig);
}
return new Promise((resolve2, reject) => {
const req = globalThis.require;
req([moduleId], (module3) => {
this._requestHandler = module3.create(hostProxy);
if (!this._requestHandler) {
reject(new Error(`No RequestHandler!`));
return;
}
resolve2(getAllMethodNames(this._requestHandler));
}, reject);
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js
function createTrustedTypesPolicy(policyName, policyOptions) {
var _a10;
const monacoEnvironment2 = globalThis.MonacoEnvironment;
if (monacoEnvironment2 === null || monacoEnvironment2 === void 0 ? void 0 : monacoEnvironment2.createTrustedTypesPolicy) {
try {
return monacoEnvironment2.createTrustedTypesPolicy(policyName, policyOptions);
} catch (err) {
onUnexpectedError(err);
return void 0;
}
}
try {
return (_a10 = mainWindow.trustedTypes) === null || _a10 === void 0 ? void 0 : _a10.createPolicy(policyName, policyOptions);
} catch (err) {
onUnexpectedError(err);
return void 0;
}
}
var init_trustedTypes = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/trustedTypes.js"() {
init_window();
init_errors();
}
});
// node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js
function getWorker(label) {
const monacoEnvironment2 = globalThis.MonacoEnvironment;
if (monacoEnvironment2) {
if (typeof monacoEnvironment2.getWorker === "function") {
return monacoEnvironment2.getWorker("workerMain.js", label);
}
if (typeof monacoEnvironment2.getWorkerUrl === "function") {
const workerUrl = monacoEnvironment2.getWorkerUrl("workerMain.js", label);
return new Worker(ttPolicy ? ttPolicy.createScriptURL(workerUrl) : workerUrl, { name: label });
}
}
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
}
function isPromiseLike(obj) {
if (typeof obj.then === "function") {
return true;
}
return false;
}
var ttPolicy, WebWorker, DefaultWorkerFactory;
var init_defaultWorkerFactory = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js"() {
init_trustedTypes();
init_errors();
init_simpleWorker();
init_lifecycle();
ttPolicy = createTrustedTypesPolicy("defaultWorkerFactory", { createScriptURL: (value) => value });
WebWorker = class extends Disposable {
constructor(moduleId, id, label, onMessageCallback, onErrorCallback) {
super();
this.id = id;
this.label = label;
const workerOrPromise = getWorker(label);
if (isPromiseLike(workerOrPromise)) {
this.worker = workerOrPromise;
} else {
this.worker = Promise.resolve(workerOrPromise);
}
this.postMessage(moduleId, []);
this.worker.then((w) => {
w.onmessage = function(ev) {
onMessageCallback(ev.data);
};
w.onmessageerror = onErrorCallback;
if (typeof w.addEventListener === "function") {
w.addEventListener("error", onErrorCallback);
}
});
this._register(toDisposable(() => {
var _a10;
(_a10 = this.worker) === null || _a10 === void 0 ? void 0 : _a10.then((w) => {
w.onmessage = null;
w.onmessageerror = null;
w.removeEventListener("error", onErrorCallback);
w.terminate();
});
this.worker = null;
}));
}
getId() {
return this.id;
}
postMessage(message, transfer) {
var _a10;
(_a10 = this.worker) === null || _a10 === void 0 ? void 0 : _a10.then((w) => {
try {
w.postMessage(message, transfer);
} catch (err) {
onUnexpectedError(err);
onUnexpectedError(new Error(`FAILED to post message to '${this.label}'-worker`, { cause: err }));
}
});
}
};
DefaultWorkerFactory = class _DefaultWorkerFactory {
constructor(label) {
this._label = label;
this._webWorkerFailedBeforeError = false;
}
create(moduleId, onMessageCallback, onErrorCallback) {
const workerId = ++_DefaultWorkerFactory.LAST_WORKER_ID;
if (this._webWorkerFailedBeforeError) {
throw this._webWorkerFailedBeforeError;
}
return new WebWorker(moduleId, workerId, this._label || "anonymous" + workerId, onMessageCallback, (err) => {
logOnceWebWorkerWarning(err);
this._webWorkerFailedBeforeError = err;
onErrorCallback(err);
});
}
};
DefaultWorkerFactory.LAST_WORKER_ID = 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfiguration.js
function appendEntry(target, key, value) {
if (target.has(key)) {
target.get(key).push(value);
} else {
target.set(key, [value]);
}
}
var IndentAction2, StandardAutoClosingPairConditional, AutoClosingPairs;
var init_languageConfiguration = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfiguration.js"() {
(function(IndentAction3) {
IndentAction3[IndentAction3["None"] = 0] = "None";
IndentAction3[IndentAction3["Indent"] = 1] = "Indent";
IndentAction3[IndentAction3["IndentOutdent"] = 2] = "IndentOutdent";
IndentAction3[IndentAction3["Outdent"] = 3] = "Outdent";
})(IndentAction2 || (IndentAction2 = {}));
StandardAutoClosingPairConditional = class {
constructor(source) {
this._neutralCharacter = null;
this._neutralCharacterSearched = false;
this.open = source.open;
this.close = source.close;
this._inString = true;
this._inComment = true;
this._inRegEx = true;
if (Array.isArray(source.notIn)) {
for (let i = 0, len = source.notIn.length; i < len; i++) {
const notIn = source.notIn[i];
switch (notIn) {
case "string":
this._inString = false;
break;
case "comment":
this._inComment = false;
break;
case "regex":
this._inRegEx = false;
break;
}
}
}
}
isOK(standardToken) {
switch (standardToken) {
case 0:
return true;
case 1:
return this._inComment;
case 2:
return this._inString;
case 3:
return this._inRegEx;
}
}
shouldAutoClose(context, column) {
if (context.getTokenCount() === 0) {
return true;
}
const tokenIndex = context.findTokenIndexAtOffset(column - 2);
const standardTokenType = context.getStandardTokenType(tokenIndex);
return this.isOK(standardTokenType);
}
_findNeutralCharacterInRange(fromCharCode, toCharCode) {
for (let charCode = fromCharCode; charCode <= toCharCode; charCode++) {
const character = String.fromCharCode(charCode);
if (!this.open.includes(character) && !this.close.includes(character)) {
return character;
}
}
return null;
}
/**
* Find a character in the range [0-9a-zA-Z] that does not appear in the open or close
*/
findNeutralCharacter() {
if (!this._neutralCharacterSearched) {
this._neutralCharacterSearched = true;
if (!this._neutralCharacter) {
this._neutralCharacter = this._findNeutralCharacterInRange(
48,
57
/* CharCode.Digit9 */
);
}
if (!this._neutralCharacter) {
this._neutralCharacter = this._findNeutralCharacterInRange(
97,
122
/* CharCode.z */
);
}
if (!this._neutralCharacter) {
this._neutralCharacter = this._findNeutralCharacterInRange(
65,
90
/* CharCode.Z */
);
}
}
return this._neutralCharacter;
}
};
AutoClosingPairs = class {
constructor(autoClosingPairs) {
this.autoClosingPairsOpenByStart = /* @__PURE__ */ new Map();
this.autoClosingPairsOpenByEnd = /* @__PURE__ */ new Map();
this.autoClosingPairsCloseByStart = /* @__PURE__ */ new Map();
this.autoClosingPairsCloseByEnd = /* @__PURE__ */ new Map();
this.autoClosingPairsCloseSingleChar = /* @__PURE__ */ new Map();
for (const pair of autoClosingPairs) {
appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);
appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);
appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);
appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);
if (pair.close.length === 1 && pair.open.length === 1) {
appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/characterPair.js
var CharacterPairSupport;
var init_characterPair = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/characterPair.js"() {
init_languageConfiguration();
CharacterPairSupport = class _CharacterPairSupport {
constructor(config) {
if (config.autoClosingPairs) {
this._autoClosingPairs = config.autoClosingPairs.map((el) => new StandardAutoClosingPairConditional(el));
} else if (config.brackets) {
this._autoClosingPairs = config.brackets.map((b) => new StandardAutoClosingPairConditional({ open: b[0], close: b[1] }));
} else {
this._autoClosingPairs = [];
}
if (config.__electricCharacterSupport && config.__electricCharacterSupport.docComment) {
const docComment = config.__electricCharacterSupport.docComment;
this._autoClosingPairs.push(new StandardAutoClosingPairConditional({ open: docComment.open, close: docComment.close || "" }));
}
this._autoCloseBeforeForQuotes = typeof config.autoCloseBefore === "string" ? config.autoCloseBefore : _CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES;
this._autoCloseBeforeForBrackets = typeof config.autoCloseBefore === "string" ? config.autoCloseBefore : _CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS;
this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs;
}
getAutoClosingPairs() {
return this._autoClosingPairs;
}
getAutoCloseBeforeSet(forQuotes) {
return forQuotes ? this._autoCloseBeforeForQuotes : this._autoCloseBeforeForBrackets;
}
getSurroundingPairs() {
return this._surroundingPairs;
}
};
CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES = ";:.,=}])> \n ";
CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS = "'\"`;:.,=}])> \n ";
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports.js
function createScopedLineTokens(context, offset) {
const tokenCount = context.getCount();
const tokenIndex = context.findTokenIndexAtOffset(offset);
const desiredLanguageId = context.getLanguageId(tokenIndex);
let lastTokenIndex = tokenIndex;
while (lastTokenIndex + 1 < tokenCount && context.getLanguageId(lastTokenIndex + 1) === desiredLanguageId) {
lastTokenIndex++;
}
let firstTokenIndex = tokenIndex;
while (firstTokenIndex > 0 && context.getLanguageId(firstTokenIndex - 1) === desiredLanguageId) {
firstTokenIndex--;
}
return new ScopedLineTokens(context, desiredLanguageId, firstTokenIndex, lastTokenIndex + 1, context.getStartOffset(firstTokenIndex), context.getEndOffset(lastTokenIndex));
}
function ignoreBracketsInToken(standardTokenType) {
return (standardTokenType & 3) !== 0;
}
var ScopedLineTokens;
var init_supports = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports.js"() {
ScopedLineTokens = class {
constructor(actual, languageId, firstTokenIndex, lastTokenIndex, firstCharOffset, lastCharOffset) {
this._scopedLineTokensBrand = void 0;
this._actual = actual;
this.languageId = languageId;
this._firstTokenIndex = firstTokenIndex;
this._lastTokenIndex = lastTokenIndex;
this.firstCharOffset = firstCharOffset;
this._lastCharOffset = lastCharOffset;
this.languageIdCodec = actual.languageIdCodec;
}
getLineContent() {
const actualLineContent = this._actual.getLineContent();
return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset);
}
getLineLength() {
return this._lastCharOffset - this.firstCharOffset;
}
getActualLineContentBefore(offset) {
const actualLineContent = this._actual.getLineContent();
return actualLineContent.substring(0, this.firstCharOffset + offset);
}
getTokenCount() {
return this._lastTokenIndex - this._firstTokenIndex;
}
findTokenIndexAtOffset(offset) {
return this._actual.findTokenIndexAtOffset(offset + this.firstCharOffset) - this._firstTokenIndex;
}
getStandardTokenType(tokenIndex) {
return this._actual.getStandardTokenType(tokenIndex + this._firstTokenIndex);
}
toIViewLineTokens() {
return this._actual.sliceAndInflate(this.firstCharOffset, this._lastCharOffset, 0);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/buffer.js
function readUInt16LE(source, offset) {
return source[offset + 0] << 0 >>> 0 | source[offset + 1] << 8 >>> 0;
}
function writeUInt16LE(destination, value, offset) {
destination[offset + 0] = value & 255;
value = value >>> 8;
destination[offset + 1] = value & 255;
}
function readUInt32BE(source, offset) {
return source[offset] * __pow(2, 24) + source[offset + 1] * __pow(2, 16) + source[offset + 2] * __pow(2, 8) + source[offset + 3];
}
function writeUInt32BE(destination, value, offset) {
destination[offset + 3] = value;
value = value >>> 8;
destination[offset + 2] = value;
value = value >>> 8;
destination[offset + 1] = value;
value = value >>> 8;
destination[offset] = value;
}
function readUInt8(source, offset) {
return source[offset];
}
function writeUInt8(destination, value, offset) {
destination[offset] = value;
}
var hasBuffer, indexOfTable, textDecoder, VSBuffer;
var init_buffer = __esm({
"node_modules/monaco-editor/esm/vs/base/common/buffer.js"() {
init_lazy();
hasBuffer = typeof Buffer !== "undefined";
indexOfTable = new Lazy(() => new Uint8Array(256));
VSBuffer = class _VSBuffer {
/**
* When running in a nodejs context, if `actual` is not a nodejs Buffer, the backing store for
* the returned `VSBuffer` instance might use a nodejs Buffer allocated from node's Buffer pool,
* which is not transferrable.
*/
static wrap(actual) {
if (hasBuffer && !Buffer.isBuffer(actual)) {
actual = Buffer.from(actual.buffer, actual.byteOffset, actual.byteLength);
}
return new _VSBuffer(actual);
}
constructor(buffer) {
this.buffer = buffer;
this.byteLength = this.buffer.byteLength;
}
toString() {
if (hasBuffer) {
return this.buffer.toString();
} else {
if (!textDecoder) {
textDecoder = new TextDecoder();
}
return textDecoder.decode(this.buffer);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/stringBuilder.js
function getUTF16LE_TextDecoder() {
if (!_utf16LE_TextDecoder) {
_utf16LE_TextDecoder = new TextDecoder("UTF-16LE");
}
return _utf16LE_TextDecoder;
}
function getUTF16BE_TextDecoder() {
if (!_utf16BE_TextDecoder) {
_utf16BE_TextDecoder = new TextDecoder("UTF-16BE");
}
return _utf16BE_TextDecoder;
}
function getPlatformTextDecoder() {
if (!_platformTextDecoder) {
_platformTextDecoder = isLittleEndian() ? getUTF16LE_TextDecoder() : getUTF16BE_TextDecoder();
}
return _platformTextDecoder;
}
function decodeUTF16LE(source, offset, len) {
const view = new Uint16Array(source.buffer, offset, len);
if (len > 0 && (view[0] === 65279 || view[0] === 65534)) {
return compatDecodeUTF16LE(source, offset, len);
}
return getUTF16LE_TextDecoder().decode(view);
}
function compatDecodeUTF16LE(source, offset, len) {
const result = [];
let resultLen = 0;
for (let i = 0; i < len; i++) {
const charCode = readUInt16LE(source, offset);
offset += 2;
result[resultLen++] = String.fromCharCode(charCode);
}
return result.join("");
}
var _utf16LE_TextDecoder, _utf16BE_TextDecoder, _platformTextDecoder, StringBuilder;
var init_stringBuilder = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/stringBuilder.js"() {
init_strings();
init_platform();
init_buffer();
StringBuilder = class {
constructor(capacity) {
this._capacity = capacity | 0;
this._buffer = new Uint16Array(this._capacity);
this._completedStrings = null;
this._bufferLength = 0;
}
reset() {
this._completedStrings = null;
this._bufferLength = 0;
}
build() {
if (this._completedStrings !== null) {
this._flushBuffer();
return this._completedStrings.join("");
}
return this._buildBuffer();
}
_buildBuffer() {
if (this._bufferLength === 0) {
return "";
}
const view = new Uint16Array(this._buffer.buffer, 0, this._bufferLength);
return getPlatformTextDecoder().decode(view);
}
_flushBuffer() {
const bufferString = this._buildBuffer();
this._bufferLength = 0;
if (this._completedStrings === null) {
this._completedStrings = [bufferString];
} else {
this._completedStrings[this._completedStrings.length] = bufferString;
}
}
/**
* Append a char code (<2^16)
*/
appendCharCode(charCode) {
const remainingSpace = this._capacity - this._bufferLength;
if (remainingSpace <= 1) {
if (remainingSpace === 0 || isHighSurrogate(charCode)) {
this._flushBuffer();
}
}
this._buffer[this._bufferLength++] = charCode;
}
/**
* Append an ASCII char code (<2^8)
*/
appendASCIICharCode(charCode) {
if (this._bufferLength === this._capacity) {
this._flushBuffer();
}
this._buffer[this._bufferLength++] = charCode;
}
appendString(str) {
const strLen = str.length;
if (this._bufferLength + strLen >= this._capacity) {
this._flushBuffer();
this._completedStrings[this._completedStrings.length] = str;
return;
}
for (let i = 0; i < strLen; i++) {
this._buffer[this._bufferLength++] = str.charCodeAt(i);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/richEditBrackets.js
function groupFuzzyBrackets(brackets) {
const N = brackets.length;
brackets = brackets.map((b) => [b[0].toLowerCase(), b[1].toLowerCase()]);
const group = [];
for (let i = 0; i < N; i++) {
group[i] = i;
}
const areOverlapping = (a3, b) => {
const [aOpen, aClose] = a3;
const [bOpen, bClose] = b;
return aOpen === bOpen || aOpen === bClose || aClose === bOpen || aClose === bClose;
};
const mergeGroups = (g1, g2) => {
const newG = Math.min(g1, g2);
const oldG = Math.max(g1, g2);
for (let i = 0; i < N; i++) {
if (group[i] === oldG) {
group[i] = newG;
}
}
};
for (let i = 0; i < N; i++) {
const a3 = brackets[i];
for (let j = i + 1; j < N; j++) {
const b = brackets[j];
if (areOverlapping(a3, b)) {
mergeGroups(group[i], group[j]);
}
}
}
const result = [];
for (let g = 0; g < N; g++) {
const currentOpen = [];
const currentClose = [];
for (let i = 0; i < N; i++) {
if (group[i] === g) {
const [open, close] = brackets[i];
currentOpen.push(open);
currentClose.push(close);
}
}
if (currentOpen.length > 0) {
result.push({
open: currentOpen,
close: currentClose
});
}
}
return result;
}
function collectSuperstrings(str, brackets, currentIndex, dest) {
for (let i = 0, len = brackets.length; i < len; i++) {
if (i === currentIndex) {
continue;
}
const bracket = brackets[i];
for (const open of bracket.open) {
if (open.indexOf(str) >= 0) {
dest.push(open);
}
}
for (const close of bracket.close) {
if (close.indexOf(str) >= 0) {
dest.push(close);
}
}
}
}
function lengthcmp(a3, b) {
return a3.length - b.length;
}
function unique(arr) {
if (arr.length <= 1) {
return arr;
}
const result = [];
const seen = /* @__PURE__ */ new Set();
for (const element of arr) {
if (seen.has(element)) {
continue;
}
result.push(element);
seen.add(element);
}
return result;
}
function getRegexForBracketPair(open, close, brackets, currentIndex) {
let pieces = [];
pieces = pieces.concat(open);
pieces = pieces.concat(close);
for (let i = 0, len = pieces.length; i < len; i++) {
collectSuperstrings(pieces[i], brackets, currentIndex, pieces);
}
pieces = unique(pieces);
pieces.sort(lengthcmp);
pieces.reverse();
return createBracketOrRegExp(pieces);
}
function getReversedRegexForBracketPair(open, close, brackets, currentIndex) {
let pieces = [];
pieces = pieces.concat(open);
pieces = pieces.concat(close);
for (let i = 0, len = pieces.length; i < len; i++) {
collectSuperstrings(pieces[i], brackets, currentIndex, pieces);
}
pieces = unique(pieces);
pieces.sort(lengthcmp);
pieces.reverse();
return createBracketOrRegExp(pieces.map(toReversedString));
}
function getRegexForBrackets(brackets) {
let pieces = [];
for (const bracket of brackets) {
for (const open of bracket.open) {
pieces.push(open);
}
for (const close of bracket.close) {
pieces.push(close);
}
}
pieces = unique(pieces);
return createBracketOrRegExp(pieces);
}
function getReversedRegexForBrackets(brackets) {
let pieces = [];
for (const bracket of brackets) {
for (const open of bracket.open) {
pieces.push(open);
}
for (const close of bracket.close) {
pieces.push(close);
}
}
pieces = unique(pieces);
return createBracketOrRegExp(pieces.map(toReversedString));
}
function prepareBracketForRegExp(str) {
const insertWordBoundaries = /^[\w ]+$/.test(str);
str = escapeRegExpCharacters(str);
return insertWordBoundaries ? `\\b${str}\\b` : str;
}
function createBracketOrRegExp(pieces, options2) {
const regexStr = `(${pieces.map(prepareBracketForRegExp).join(")|(")})`;
return createRegExp(regexStr, true, options2);
}
var RichEditBracket, RichEditBrackets, toReversedString, BracketsUtils;
var init_richEditBrackets = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/richEditBrackets.js"() {
init_strings();
init_stringBuilder();
init_range();
RichEditBracket = class _RichEditBracket {
constructor(languageId, index, open, close, forwardRegex, reversedRegex) {
this._richEditBracketBrand = void 0;
this.languageId = languageId;
this.index = index;
this.open = open;
this.close = close;
this.forwardRegex = forwardRegex;
this.reversedRegex = reversedRegex;
this._openSet = _RichEditBracket._toSet(this.open);
this._closeSet = _RichEditBracket._toSet(this.close);
}
/**
* Check if the provided `text` is an open bracket in this group.
*/
isOpen(text2) {
return this._openSet.has(text2);
}
/**
* Check if the provided `text` is a close bracket in this group.
*/
isClose(text2) {
return this._closeSet.has(text2);
}
static _toSet(arr) {
const result = /* @__PURE__ */ new Set();
for (const element of arr) {
result.add(element);
}
return result;
}
};
RichEditBrackets = class {
constructor(languageId, _brackets) {
this._richEditBracketsBrand = void 0;
const brackets = groupFuzzyBrackets(_brackets);
this.brackets = brackets.map((b, index) => {
return new RichEditBracket(languageId, index, b.open, b.close, getRegexForBracketPair(b.open, b.close, brackets, index), getReversedRegexForBracketPair(b.open, b.close, brackets, index));
});
this.forwardRegex = getRegexForBrackets(this.brackets);
this.reversedRegex = getReversedRegexForBrackets(this.brackets);
this.textIsBracket = {};
this.textIsOpenBracket = {};
this.maxBracketLength = 0;
for (const bracket of this.brackets) {
for (const open of bracket.open) {
this.textIsBracket[open] = bracket;
this.textIsOpenBracket[open] = true;
this.maxBracketLength = Math.max(this.maxBracketLength, open.length);
}
for (const close of bracket.close) {
this.textIsBracket[close] = bracket;
this.textIsOpenBracket[close] = false;
this.maxBracketLength = Math.max(this.maxBracketLength, close.length);
}
}
}
};
toReversedString = /* @__PURE__ */ function() {
function reverse(str) {
const arr = new Uint16Array(str.length);
let offset = 0;
for (let i = str.length - 1; i >= 0; i--) {
arr[offset++] = str.charCodeAt(i);
}
return getPlatformTextDecoder().decode(arr);
}
let lastInput = null;
let lastOutput = null;
return function toReversedString2(str) {
if (lastInput !== str) {
lastInput = str;
lastOutput = reverse(lastInput);
}
return lastOutput;
};
}();
BracketsUtils = class {
static _findPrevBracketInText(reversedBracketRegex, lineNumber, reversedText, offset) {
const m = reversedText.match(reversedBracketRegex);
if (!m) {
return null;
}
const matchOffset = reversedText.length - (m.index || 0);
const matchLength = m[0].length;
const absoluteMatchOffset = offset + matchOffset;
return new Range(lineNumber, absoluteMatchOffset - matchLength + 1, lineNumber, absoluteMatchOffset + 1);
}
static findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, startOffset, endOffset) {
const reversedLineText = toReversedString(lineText);
const reversedSubstr = reversedLineText.substring(lineText.length - endOffset, lineText.length - startOffset);
return this._findPrevBracketInText(reversedBracketRegex, lineNumber, reversedSubstr, startOffset);
}
static findNextBracketInText(bracketRegex, lineNumber, text2, offset) {
const m = text2.match(bracketRegex);
if (!m) {
return null;
}
const matchOffset = m.index || 0;
const matchLength = m[0].length;
if (matchLength === 0) {
return null;
}
const absoluteMatchOffset = offset + matchOffset;
return new Range(lineNumber, absoluteMatchOffset + 1, lineNumber, absoluteMatchOffset + 1 + matchLength);
}
static findNextBracketInRange(bracketRegex, lineNumber, lineText, startOffset, endOffset) {
const substr = lineText.substring(startOffset, endOffset);
return this.findNextBracketInText(bracketRegex, lineNumber, substr, startOffset);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/electricCharacter.js
var BracketElectricCharacterSupport;
var init_electricCharacter = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/electricCharacter.js"() {
init_arrays();
init_supports();
init_richEditBrackets();
BracketElectricCharacterSupport = class {
constructor(richEditBrackets) {
this._richEditBrackets = richEditBrackets;
}
getElectricCharacters() {
const result = [];
if (this._richEditBrackets) {
for (const bracket of this._richEditBrackets.brackets) {
for (const close of bracket.close) {
const lastChar = close.charAt(close.length - 1);
result.push(lastChar);
}
}
}
return distinct(result);
}
onElectricCharacter(character, context, column) {
if (!this._richEditBrackets || this._richEditBrackets.brackets.length === 0) {
return null;
}
const tokenIndex = context.findTokenIndexAtOffset(column - 1);
if (ignoreBracketsInToken(context.getStandardTokenType(tokenIndex))) {
return null;
}
const reversedBracketRegex = this._richEditBrackets.reversedRegex;
const text2 = context.getLineContent().substring(0, column - 1) + character;
const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, 1, text2, 0, text2.length);
if (!r) {
return null;
}
const bracketText = text2.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
const isOpen = this._richEditBrackets.textIsOpenBracket[bracketText];
if (isOpen) {
return null;
}
const textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1);
if (!/^\s*$/.test(textBeforeBracket)) {
return null;
}
return {
matchOpenBracket: bracketText
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/indentRules.js
function resetGlobalRegex(reg) {
if (reg.global) {
reg.lastIndex = 0;
}
return true;
}
var IndentRulesSupport;
var init_indentRules = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/indentRules.js"() {
IndentRulesSupport = class {
constructor(indentationRules) {
this._indentationRules = indentationRules;
}
shouldIncrease(text2) {
if (this._indentationRules) {
if (this._indentationRules.increaseIndentPattern && resetGlobalRegex(this._indentationRules.increaseIndentPattern) && this._indentationRules.increaseIndentPattern.test(text2)) {
return true;
}
}
return false;
}
shouldDecrease(text2) {
if (this._indentationRules && this._indentationRules.decreaseIndentPattern && resetGlobalRegex(this._indentationRules.decreaseIndentPattern) && this._indentationRules.decreaseIndentPattern.test(text2)) {
return true;
}
return false;
}
shouldIndentNextLine(text2) {
if (this._indentationRules && this._indentationRules.indentNextLinePattern && resetGlobalRegex(this._indentationRules.indentNextLinePattern) && this._indentationRules.indentNextLinePattern.test(text2)) {
return true;
}
return false;
}
shouldIgnore(text2) {
if (this._indentationRules && this._indentationRules.unIndentedLinePattern && resetGlobalRegex(this._indentationRules.unIndentedLinePattern) && this._indentationRules.unIndentedLinePattern.test(text2)) {
return true;
}
return false;
}
getIndentMetadata(text2) {
let ret = 0;
if (this.shouldIncrease(text2)) {
ret += 1;
}
if (this.shouldDecrease(text2)) {
ret += 2;
}
if (this.shouldIndentNextLine(text2)) {
ret += 4;
}
if (this.shouldIgnore(text2)) {
ret += 8;
}
return ret;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/onEnter.js
var OnEnterSupport;
var init_onEnter = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/onEnter.js"() {
init_errors();
init_strings();
init_languageConfiguration();
OnEnterSupport = class _OnEnterSupport {
constructor(opts) {
opts = opts || {};
opts.brackets = opts.brackets || [
["(", ")"],
["{", "}"],
["[", "]"]
];
this._brackets = [];
opts.brackets.forEach((bracket) => {
const openRegExp = _OnEnterSupport._createOpenBracketRegExp(bracket[0]);
const closeRegExp = _OnEnterSupport._createCloseBracketRegExp(bracket[1]);
if (openRegExp && closeRegExp) {
this._brackets.push({
open: bracket[0],
openRegExp,
close: bracket[1],
closeRegExp
});
}
});
this._regExpRules = opts.onEnterRules || [];
}
onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {
if (autoIndent >= 3) {
for (let i = 0, len = this._regExpRules.length; i < len; i++) {
const rule = this._regExpRules[i];
const regResult = [{
reg: rule.beforeText,
text: beforeEnterText
}, {
reg: rule.afterText,
text: afterEnterText
}, {
reg: rule.previousLineText,
text: previousLineText
}].every((obj) => {
if (!obj.reg) {
return true;
}
obj.reg.lastIndex = 0;
return obj.reg.test(obj.text);
});
if (regResult) {
return rule.action;
}
}
}
if (autoIndent >= 2) {
if (beforeEnterText.length > 0 && afterEnterText.length > 0) {
for (let i = 0, len = this._brackets.length; i < len; i++) {
const bracket = this._brackets[i];
if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {
return { indentAction: IndentAction2.IndentOutdent };
}
}
}
}
if (autoIndent >= 2) {
if (beforeEnterText.length > 0) {
for (let i = 0, len = this._brackets.length; i < len; i++) {
const bracket = this._brackets[i];
if (bracket.openRegExp.test(beforeEnterText)) {
return { indentAction: IndentAction2.Indent };
}
}
}
}
return null;
}
static _createOpenBracketRegExp(bracket) {
let str = escapeRegExpCharacters(bracket);
if (!/\B/.test(str.charAt(0))) {
str = "\\b" + str;
}
str += "\\s*$";
return _OnEnterSupport._safeRegExp(str);
}
static _createCloseBracketRegExp(bracket) {
let str = escapeRegExpCharacters(bracket);
if (!/\B/.test(str.charAt(str.length - 1))) {
str = str + "\\b";
}
str = "^\\s*" + str;
return _OnEnterSupport._safeRegExp(str);
}
static _safeRegExp(def) {
try {
return new RegExp(def);
} catch (err) {
onUnexpectedError(err);
return null;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js
function toValuesTree(properties, conflictReporter) {
const root = /* @__PURE__ */ Object.create(null);
for (const key in properties) {
addToValueTree(root, key, properties[key], conflictReporter);
}
return root;
}
function addToValueTree(settingsTreeRoot, key, value, conflictReporter) {
const segments = key.split(".");
const last = segments.pop();
let curr = settingsTreeRoot;
for (let i = 0; i < segments.length; i++) {
const s = segments[i];
let obj = curr[s];
switch (typeof obj) {
case "undefined":
obj = curr[s] = /* @__PURE__ */ Object.create(null);
break;
case "object":
if (obj === null) {
conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join(".")} is null`);
return;
}
break;
default:
conflictReporter(`Ignoring ${key} as ${segments.slice(0, i + 1).join(".")} is ${JSON.stringify(obj)}`);
return;
}
curr = obj;
}
if (typeof curr === "object" && curr !== null) {
try {
curr[last] = value;
} catch (e) {
conflictReporter(`Ignoring ${key} as ${segments.join(".")} is ${JSON.stringify(curr)}`);
}
} else {
conflictReporter(`Ignoring ${key} as ${segments.join(".")} is ${JSON.stringify(curr)}`);
}
}
function removeFromValueTree(valueTree, key) {
const segments = key.split(".");
doRemoveFromValueTree(valueTree, segments);
}
function doRemoveFromValueTree(valueTree, segments) {
const first2 = segments.shift();
if (segments.length === 0) {
delete valueTree[first2];
return;
}
if (Object.keys(valueTree).indexOf(first2) !== -1) {
const value = valueTree[first2];
if (typeof value === "object" && !Array.isArray(value)) {
doRemoveFromValueTree(value, segments);
if (Object.keys(value).length === 0) {
delete valueTree[first2];
}
}
}
}
function getConfigurationValue(config, settingPath, defaultValue) {
function accessSetting(config2, path2) {
let current = config2;
for (const component of path2) {
if (typeof current !== "object" || current === null) {
return void 0;
}
current = current[component];
}
return current;
}
const path = settingPath.split(".");
const result = accessSetting(config, path);
return typeof result === "undefined" ? defaultValue : result;
}
function getLanguageTagSettingPlainKey(settingKey) {
return settingKey.replace(/[\[\]]/g, "");
}
var IConfigurationService;
var init_configuration = __esm({
"node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js"() {
init_instantiation();
IConfigurationService = createDecorator("configurationService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/language.js
var ILanguageService;
var init_language = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/language.js"() {
init_instantiation();
ILanguageService = createDecorator("languageService");
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/descriptors.js
var SyncDescriptor;
var init_descriptors = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/descriptors.js"() {
SyncDescriptor = class {
constructor(ctor, staticArguments = [], supportsDelayedInstantiation = false) {
this.ctor = ctor;
this.staticArguments = staticArguments;
this.supportsDelayedInstantiation = supportsDelayedInstantiation;
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js
function registerSingleton(id, ctorOrDescriptor, supportsDelayedInstantiation) {
if (!(ctorOrDescriptor instanceof SyncDescriptor)) {
ctorOrDescriptor = new SyncDescriptor(ctorOrDescriptor, [], Boolean(supportsDelayedInstantiation));
}
_registry.push([id, ctorOrDescriptor]);
}
function getSingletonServiceDescriptors() {
return _registry;
}
var _registry;
var init_extensions = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js"() {
init_descriptors();
_registry = [];
}
});
// node_modules/monaco-editor/esm/vs/base/common/mime.js
var Mimes;
var init_mime = __esm({
"node_modules/monaco-editor/esm/vs/base/common/mime.js"() {
Mimes = Object.freeze({
text: "text/plain",
binary: "application/octet-stream",
unknown: "application/unknown",
markdown: "text/markdown",
latex: "text/latex",
uriList: "text/uri-list"
});
}
});
// node_modules/monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js
function normalizeId(id) {
if (id.length > 0 && id.charAt(id.length - 1) === "#") {
return id.substring(0, id.length - 1);
}
return id;
}
var Extensions3, JSONContributionRegistry, jsonContributionRegistry;
var init_jsonContributionRegistry = __esm({
"node_modules/monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js"() {
init_event();
init_platform2();
Extensions3 = {
JSONContribution: "base.contributions.json"
};
JSONContributionRegistry = class {
constructor() {
this._onDidChangeSchema = new Emitter();
this.schemasById = {};
}
registerSchema(uri, unresolvedSchemaContent) {
this.schemasById[normalizeId(uri)] = unresolvedSchemaContent;
this._onDidChangeSchema.fire(uri);
}
notifySchemaChanged(uri) {
this._onDidChangeSchema.fire(uri);
}
};
jsonContributionRegistry = new JSONContributionRegistry();
Registry.add(Extensions3.JSONContribution, jsonContributionRegistry);
}
});
// node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js
function overrideIdentifiersFromKey(key) {
const identifiers = [];
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
let matches2 = OVERRIDE_IDENTIFIER_REGEX.exec(key);
while (matches2 === null || matches2 === void 0 ? void 0 : matches2.length) {
const identifier3 = matches2[1].trim();
if (identifier3) {
identifiers.push(identifier3);
}
matches2 = OVERRIDE_IDENTIFIER_REGEX.exec(key);
}
}
return distinct(identifiers);
}
function getDefaultValue(type) {
const t4 = Array.isArray(type) ? type[0] : type;
switch (t4) {
case "boolean":
return false;
case "integer":
case "number":
return 0;
case "string":
return "";
case "array":
return [];
case "object":
return {};
default:
return null;
}
}
function validateProperty(property, schema) {
var _a10, _b4, _c2, _d2;
if (!property.trim()) {
return localize("config.property.empty", "Cannot register an empty property");
}
if (OVERRIDE_PROPERTY_REGEX.test(property)) {
return localize("config.property.languageDefault", "Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.", property);
}
if (configurationRegistry.getConfigurationProperties()[property] !== void 0) {
return localize("config.property.duplicate", "Cannot register '{0}'. This property is already registered.", property);
}
if (((_a10 = schema.policy) === null || _a10 === void 0 ? void 0 : _a10.name) && configurationRegistry.getPolicyConfigurations().get((_b4 = schema.policy) === null || _b4 === void 0 ? void 0 : _b4.name) !== void 0) {
return localize("config.policy.duplicate", "Cannot register '{0}'. The associated policy {1} is already registered with {2}.", property, (_c2 = schema.policy) === null || _c2 === void 0 ? void 0 : _c2.name, configurationRegistry.getPolicyConfigurations().get((_d2 = schema.policy) === null || _d2 === void 0 ? void 0 : _d2.name));
}
return null;
}
var Extensions4, allSettings, applicationSettings, machineSettings, machineOverridableSettings, windowSettings, resourceSettings, resourceLanguageSettingsSchemaId, contributionRegistry, ConfigurationRegistry, OVERRIDE_IDENTIFIER_PATTERN, OVERRIDE_IDENTIFIER_REGEX, OVERRIDE_PROPERTY_PATTERN, OVERRIDE_PROPERTY_REGEX, configurationRegistry;
var init_configurationRegistry = __esm({
"node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js"() {
init_arrays();
init_event();
init_types();
init_nls();
init_configuration();
init_jsonContributionRegistry();
init_platform2();
Extensions4 = {
Configuration: "base.contributions.configuration"
};
allSettings = { properties: {}, patternProperties: {} };
applicationSettings = { properties: {}, patternProperties: {} };
machineSettings = { properties: {}, patternProperties: {} };
machineOverridableSettings = { properties: {}, patternProperties: {} };
windowSettings = { properties: {}, patternProperties: {} };
resourceSettings = { properties: {}, patternProperties: {} };
resourceLanguageSettingsSchemaId = "vscode://schemas/settings/resourceLanguage";
contributionRegistry = Registry.as(Extensions3.JSONContribution);
ConfigurationRegistry = class {
constructor() {
this.overrideIdentifiers = /* @__PURE__ */ new Set();
this._onDidSchemaChange = new Emitter();
this._onDidUpdateConfiguration = new Emitter();
this.configurationDefaultsOverrides = /* @__PURE__ */ new Map();
this.defaultLanguageConfigurationOverridesNode = {
id: "defaultOverrides",
title: localize("defaultLanguageConfigurationOverrides.title", "Default Language Configuration Overrides"),
properties: {}
};
this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];
this.resourceLanguageSettingsSchema = {
properties: {},
patternProperties: {},
additionalProperties: true,
allowTrailingCommas: true,
allowComments: true
};
this.configurationProperties = {};
this.policyConfigurations = /* @__PURE__ */ new Map();
this.excludedConfigurationProperties = {};
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
this.registerOverridePropertyPatternKey();
}
registerConfiguration(configuration, validate2 = true) {
this.registerConfigurations([configuration], validate2);
}
registerConfigurations(configurations, validate2 = true) {
const properties = /* @__PURE__ */ new Set();
this.doRegisterConfigurations(configurations, validate2, properties);
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
this._onDidSchemaChange.fire();
this._onDidUpdateConfiguration.fire({ properties });
}
registerDefaultConfigurations(configurationDefaults) {
const properties = /* @__PURE__ */ new Set();
this.doRegisterDefaultConfigurations(configurationDefaults, properties);
this._onDidSchemaChange.fire();
this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
}
doRegisterDefaultConfigurations(configurationDefaults, bucket) {
var _a10;
const overrideIdentifiers = [];
for (const { overrides, source } of configurationDefaults) {
for (const key in overrides) {
bucket.add(key);
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
const configurationDefaultOverride = this.configurationDefaultsOverrides.get(key);
const valuesSources = (_a10 = configurationDefaultOverride === null || configurationDefaultOverride === void 0 ? void 0 : configurationDefaultOverride.valuesSources) !== null && _a10 !== void 0 ? _a10 : /* @__PURE__ */ new Map();
if (source) {
for (const configuration of Object.keys(overrides[key])) {
valuesSources.set(configuration, source);
}
}
const defaultValue = __spreadValues(__spreadValues({}, (configurationDefaultOverride === null || configurationDefaultOverride === void 0 ? void 0 : configurationDefaultOverride.value) || {}), overrides[key]);
this.configurationDefaultsOverrides.set(key, { source, value: defaultValue, valuesSources });
const plainKey = getLanguageTagSettingPlainKey(key);
const property = {
type: "object",
default: defaultValue,
description: localize("defaultLanguageConfiguration.description", "Configure settings to be overridden for the {0} language.", plainKey),
$ref: resourceLanguageSettingsSchemaId,
defaultDefaultValue: defaultValue,
source: isString(source) ? void 0 : source,
defaultValueSource: source
};
overrideIdentifiers.push(...overrideIdentifiersFromKey(key));
this.configurationProperties[key] = property;
this.defaultLanguageConfigurationOverridesNode.properties[key] = property;
} else {
this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });
const property = this.configurationProperties[key];
if (property) {
this.updatePropertyDefaultValue(key, property);
this.updateSchema(key, property);
}
}
}
}
this.doRegisterOverrideIdentifiers(overrideIdentifiers);
}
registerOverrideIdentifiers(overrideIdentifiers) {
this.doRegisterOverrideIdentifiers(overrideIdentifiers);
this._onDidSchemaChange.fire();
}
doRegisterOverrideIdentifiers(overrideIdentifiers) {
for (const overrideIdentifier of overrideIdentifiers) {
this.overrideIdentifiers.add(overrideIdentifier);
}
this.updateOverridePropertyPatternKey();
}
doRegisterConfigurations(configurations, validate2, bucket) {
configurations.forEach((configuration) => {
this.validateAndRegisterProperties(configuration, validate2, configuration.extensionInfo, configuration.restrictedProperties, void 0, bucket);
this.configurationContributors.push(configuration);
this.registerJSONConfiguration(configuration);
});
}
validateAndRegisterProperties(configuration, validate2 = true, extensionInfo, restrictedProperties, scope = 3, bucket) {
var _a10;
scope = isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;
const properties = configuration.properties;
if (properties) {
for (const key in properties) {
const property = properties[key];
if (validate2 && validateProperty(key, property)) {
delete properties[key];
continue;
}
property.source = extensionInfo;
property.defaultDefaultValue = properties[key].default;
this.updatePropertyDefaultValue(key, property);
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
property.scope = void 0;
} else {
property.scope = isUndefinedOrNull(property.scope) ? scope : property.scope;
property.restricted = isUndefinedOrNull(property.restricted) ? !!(restrictedProperties === null || restrictedProperties === void 0 ? void 0 : restrictedProperties.includes(key)) : property.restricted;
}
if (properties[key].hasOwnProperty("included") && !properties[key].included) {
this.excludedConfigurationProperties[key] = properties[key];
delete properties[key];
continue;
} else {
this.configurationProperties[key] = properties[key];
if ((_a10 = properties[key].policy) === null || _a10 === void 0 ? void 0 : _a10.name) {
this.policyConfigurations.set(properties[key].policy.name, key);
}
}
if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {
properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;
}
bucket.add(key);
}
}
const subNodes = configuration.allOf;
if (subNodes) {
for (const node of subNodes) {
this.validateAndRegisterProperties(node, validate2, extensionInfo, restrictedProperties, scope, bucket);
}
}
}
getConfigurationProperties() {
return this.configurationProperties;
}
getPolicyConfigurations() {
return this.policyConfigurations;
}
registerJSONConfiguration(configuration) {
const register4 = (configuration2) => {
const properties = configuration2.properties;
if (properties) {
for (const key in properties) {
this.updateSchema(key, properties[key]);
}
}
const subNodes = configuration2.allOf;
subNodes === null || subNodes === void 0 ? void 0 : subNodes.forEach(register4);
};
register4(configuration);
}
updateSchema(key, property) {
allSettings.properties[key] = property;
switch (property.scope) {
case 1:
applicationSettings.properties[key] = property;
break;
case 2:
machineSettings.properties[key] = property;
break;
case 6:
machineOverridableSettings.properties[key] = property;
break;
case 3:
windowSettings.properties[key] = property;
break;
case 4:
resourceSettings.properties[key] = property;
break;
case 5:
resourceSettings.properties[key] = property;
this.resourceLanguageSettingsSchema.properties[key] = property;
break;
}
}
updateOverridePropertyPatternKey() {
for (const overrideIdentifier of this.overrideIdentifiers.values()) {
const overrideIdentifierProperty = `[${overrideIdentifier}]`;
const resourceLanguagePropertiesSchema = {
type: "object",
description: localize("overrideSettings.defaultDescription", "Configure editor settings to be overridden for a language."),
errorMessage: localize("overrideSettings.errorMessage", "This setting does not support per-language configuration."),
$ref: resourceLanguageSettingsSchemaId
};
this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);
allSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
applicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
machineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
machineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
windowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
resourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
}
}
registerOverridePropertyPatternKey() {
const resourceLanguagePropertiesSchema = {
type: "object",
description: localize("overrideSettings.defaultDescription", "Configure editor settings to be overridden for a language."),
errorMessage: localize("overrideSettings.errorMessage", "This setting does not support per-language configuration."),
$ref: resourceLanguageSettingsSchemaId
};
allSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
applicationSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
machineSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
machineOverridableSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
windowSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
resourceSettings.patternProperties[OVERRIDE_PROPERTY_PATTERN] = resourceLanguagePropertiesSchema;
this._onDidSchemaChange.fire();
}
updatePropertyDefaultValue(key, property) {
const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);
let defaultValue = configurationdefaultOverride === null || configurationdefaultOverride === void 0 ? void 0 : configurationdefaultOverride.value;
let defaultSource = configurationdefaultOverride === null || configurationdefaultOverride === void 0 ? void 0 : configurationdefaultOverride.source;
if (isUndefined(defaultValue)) {
defaultValue = property.defaultDefaultValue;
defaultSource = void 0;
}
if (isUndefined(defaultValue)) {
defaultValue = getDefaultValue(property.type);
}
property.default = defaultValue;
property.defaultValueSource = defaultSource;
}
};
OVERRIDE_IDENTIFIER_PATTERN = `\\[([^\\]]+)\\]`;
OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, "g");
OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;
OVERRIDE_PROPERTY_REGEX = new RegExp(OVERRIDE_PROPERTY_PATTERN);
configurationRegistry = new ConfigurationRegistry();
Registry.add(Extensions4.Configuration, configurationRegistry);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/modesRegistry.js
var Extensions5, EditorModesRegistry, ModesRegistry, PLAINTEXT_LANGUAGE_ID, PLAINTEXT_EXTENSION;
var init_modesRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/modesRegistry.js"() {
init_nls();
init_event();
init_platform2();
init_mime();
init_configurationRegistry();
Extensions5 = {
ModesRegistry: "editor.modesRegistry"
};
EditorModesRegistry = class {
constructor() {
this._onDidChangeLanguages = new Emitter();
this.onDidChangeLanguages = this._onDidChangeLanguages.event;
this._languages = [];
}
registerLanguage(def) {
this._languages.push(def);
this._onDidChangeLanguages.fire(void 0);
return {
dispose: () => {
for (let i = 0, len = this._languages.length; i < len; i++) {
if (this._languages[i] === def) {
this._languages.splice(i, 1);
return;
}
}
}
};
}
getLanguages() {
return this._languages;
}
};
ModesRegistry = new EditorModesRegistry();
Registry.add(Extensions5.ModesRegistry, ModesRegistry);
PLAINTEXT_LANGUAGE_ID = "plaintext";
PLAINTEXT_EXTENSION = ".txt";
ModesRegistry.registerLanguage({
id: PLAINTEXT_LANGUAGE_ID,
extensions: [PLAINTEXT_EXTENSION],
aliases: [localize("plainText.alias", "Plain Text"), "text"],
mimetypes: [Mimes.text]
});
Registry.as(Extensions4.Configuration).registerDefaultConfigurations([{
overrides: {
"[plaintext]": {
"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.unicodeHighlight.invisibleCharacters": false
}
}
}]);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/languageBracketsConfiguration.js
function filterValidBrackets(bracketPairs) {
return bracketPairs.filter(([open, close]) => open !== "" && close !== "");
}
var LanguageBracketsConfiguration, BracketKindBase, OpeningBracketKind, ClosingBracketKind;
var init_languageBracketsConfiguration = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/languageBracketsConfiguration.js"() {
init_cache();
init_richEditBrackets();
LanguageBracketsConfiguration = class {
constructor(languageId, config) {
this.languageId = languageId;
const bracketPairs = config.brackets ? filterValidBrackets(config.brackets) : [];
const openingBracketInfos = new CachedFunction((bracket) => {
const closing = /* @__PURE__ */ new Set();
return {
info: new OpeningBracketKind(this, bracket, closing),
closing
};
});
const closingBracketInfos = new CachedFunction((bracket) => {
const opening = /* @__PURE__ */ new Set();
const openingColorized = /* @__PURE__ */ new Set();
return {
info: new ClosingBracketKind(this, bracket, opening, openingColorized),
opening,
openingColorized
};
});
for (const [open, close] of bracketPairs) {
const opening = openingBracketInfos.get(open);
const closing = closingBracketInfos.get(close);
opening.closing.add(closing.info);
closing.opening.add(opening.info);
}
const colorizedBracketPairs = config.colorizedBracketPairs ? filterValidBrackets(config.colorizedBracketPairs) : bracketPairs.filter((p) => !(p[0] === "<" && p[1] === ">"));
for (const [open, close] of colorizedBracketPairs) {
const opening = openingBracketInfos.get(open);
const closing = closingBracketInfos.get(close);
opening.closing.add(closing.info);
closing.openingColorized.add(opening.info);
closing.opening.add(opening.info);
}
this._openingBrackets = new Map([...openingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));
this._closingBrackets = new Map([...closingBracketInfos.cachedValues].map(([k, v]) => [k, v.info]));
}
/**
* No two brackets have the same bracket text.
*/
get openingBrackets() {
return [...this._openingBrackets.values()];
}
/**
* No two brackets have the same bracket text.
*/
get closingBrackets() {
return [...this._closingBrackets.values()];
}
getOpeningBracketInfo(bracketText) {
return this._openingBrackets.get(bracketText);
}
getClosingBracketInfo(bracketText) {
return this._closingBrackets.get(bracketText);
}
getBracketInfo(bracketText) {
return this.getOpeningBracketInfo(bracketText) || this.getClosingBracketInfo(bracketText);
}
getBracketRegExp(options2) {
const brackets = Array.from([...this._openingBrackets.keys(), ...this._closingBrackets.keys()]);
return createBracketOrRegExp(brackets, options2);
}
};
BracketKindBase = class {
constructor(config, bracketText) {
this.config = config;
this.bracketText = bracketText;
}
get languageId() {
return this.config.languageId;
}
};
OpeningBracketKind = class extends BracketKindBase {
constructor(config, bracketText, openedBrackets) {
super(config, bracketText);
this.openedBrackets = openedBrackets;
this.isOpeningBracket = true;
}
};
ClosingBracketKind = class extends BracketKindBase {
constructor(config, bracketText, openingBrackets, openingColorizedBrackets) {
super(config, bracketText);
this.openingBrackets = openingBrackets;
this.openingColorizedBrackets = openingColorizedBrackets;
this.isOpeningBracket = false;
}
/**
* Checks if this bracket closes the given other bracket.
* If the bracket infos come from different configurations, this method will return false.
*/
closes(other) {
if (other["config"] !== this.config) {
return false;
}
return this.openingBrackets.has(other);
}
closesColorized(other) {
if (other["config"] !== this.config) {
return false;
}
return this.openingColorizedBrackets.has(other);
}
getOpeningBrackets() {
return [...this.openingBrackets];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js
function computeConfig(languageId, registry, configurationService, languageService) {
let languageConfig = registry.getLanguageConfiguration(languageId);
if (!languageConfig) {
if (!languageService.isRegisteredLanguageId(languageId)) {
return new ResolvedLanguageConfiguration(languageId, {});
}
languageConfig = new ResolvedLanguageConfiguration(languageId, {});
}
const customizedConfig = getCustomizedLanguageConfig(languageConfig.languageId, configurationService);
const data = combineLanguageConfigurations([languageConfig.underlyingConfig, customizedConfig]);
const config = new ResolvedLanguageConfiguration(languageConfig.languageId, data);
return config;
}
function getCustomizedLanguageConfig(languageId, configurationService) {
const brackets = configurationService.getValue(customizedLanguageConfigKeys.brackets, {
overrideIdentifier: languageId
});
const colorizedBracketPairs = configurationService.getValue(customizedLanguageConfigKeys.colorizedBracketPairs, {
overrideIdentifier: languageId
});
return {
brackets: validateBracketPairs(brackets),
colorizedBracketPairs: validateBracketPairs(colorizedBracketPairs)
};
}
function validateBracketPairs(data) {
if (!Array.isArray(data)) {
return void 0;
}
return data.map((pair) => {
if (!Array.isArray(pair) || pair.length !== 2) {
return void 0;
}
return [pair[0], pair[1]];
}).filter((p) => !!p);
}
function getIndentationAtPosition(model, lineNumber, column) {
const lineText = model.getLineContent(lineNumber);
let indentation = getLeadingWhitespace(lineText);
if (indentation.length > column - 1) {
indentation = indentation.substring(0, column - 1);
}
return indentation;
}
function combineLanguageConfigurations(configs) {
let result = {
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 (const entry of configs) {
result = {
comments: entry.comments || result.comments,
brackets: entry.brackets || result.brackets,
wordPattern: entry.wordPattern || result.wordPattern,
indentationRules: entry.indentationRules || result.indentationRules,
onEnterRules: entry.onEnterRules || result.onEnterRules,
autoClosingPairs: entry.autoClosingPairs || result.autoClosingPairs,
surroundingPairs: entry.surroundingPairs || result.surroundingPairs,
autoCloseBefore: entry.autoCloseBefore || result.autoCloseBefore,
folding: entry.folding || result.folding,
colorizedBracketPairs: entry.colorizedBracketPairs || result.colorizedBracketPairs,
__electricCharacterSupport: entry.__electricCharacterSupport || result.__electricCharacterSupport
};
}
return result;
}
var __decorate2, __param2, LanguageConfigurationServiceChangeEvent, ILanguageConfigurationService, LanguageConfigurationService, customizedLanguageConfigKeys, ComposedLanguageConfiguration, LanguageConfigurationContribution, LanguageConfigurationChangeEvent, LanguageConfigurationRegistry, ResolvedLanguageConfiguration;
var init_languageConfigurationRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js"() {
init_event();
init_lifecycle();
init_strings();
init_wordHelper();
init_languageConfiguration();
init_characterPair();
init_electricCharacter();
init_indentRules();
init_onEnter();
init_richEditBrackets();
init_instantiation();
init_configuration();
init_language();
init_extensions();
init_modesRegistry();
init_languageBracketsConfiguration();
__decorate2 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param2 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
LanguageConfigurationServiceChangeEvent = class {
constructor(languageId) {
this.languageId = languageId;
}
affects(languageId) {
return !this.languageId ? true : this.languageId === languageId;
}
};
ILanguageConfigurationService = createDecorator("languageConfigurationService");
LanguageConfigurationService = class LanguageConfigurationService2 extends Disposable {
constructor(configurationService, languageService) {
super();
this.configurationService = configurationService;
this.languageService = languageService;
this._registry = this._register(new LanguageConfigurationRegistry());
this.onDidChangeEmitter = this._register(new Emitter());
this.onDidChange = this.onDidChangeEmitter.event;
this.configurations = /* @__PURE__ */ new Map();
const languageConfigKeys = new Set(Object.values(customizedLanguageConfigKeys));
this._register(this.configurationService.onDidChangeConfiguration((e) => {
const globalConfigChanged = e.change.keys.some((k) => languageConfigKeys.has(k));
const localConfigChanged = e.change.overrides.filter(([overrideLangName, keys]) => keys.some((k) => languageConfigKeys.has(k))).map(([overrideLangName]) => overrideLangName);
if (globalConfigChanged) {
this.configurations.clear();
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(void 0));
} else {
for (const languageId of localConfigChanged) {
if (this.languageService.isRegisteredLanguageId(languageId)) {
this.configurations.delete(languageId);
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(languageId));
}
}
}
}));
this._register(this._registry.onDidChange((e) => {
this.configurations.delete(e.languageId);
this.onDidChangeEmitter.fire(new LanguageConfigurationServiceChangeEvent(e.languageId));
}));
}
register(languageId, configuration, priority) {
return this._registry.register(languageId, configuration, priority);
}
getLanguageConfiguration(languageId) {
let result = this.configurations.get(languageId);
if (!result) {
result = computeConfig(languageId, this._registry, this.configurationService, this.languageService);
this.configurations.set(languageId, result);
}
return result;
}
};
LanguageConfigurationService = __decorate2([
__param2(0, IConfigurationService),
__param2(1, ILanguageService)
], LanguageConfigurationService);
customizedLanguageConfigKeys = {
brackets: "editor.language.brackets",
colorizedBracketPairs: "editor.language.colorizedBracketPairs"
};
ComposedLanguageConfiguration = class {
constructor(languageId) {
this.languageId = languageId;
this._resolved = null;
this._entries = [];
this._order = 0;
this._resolved = null;
}
register(configuration, priority) {
const entry = new LanguageConfigurationContribution(configuration, priority, ++this._order);
this._entries.push(entry);
this._resolved = null;
return toDisposable(() => {
for (let i = 0; i < this._entries.length; i++) {
if (this._entries[i] === entry) {
this._entries.splice(i, 1);
this._resolved = null;
break;
}
}
});
}
getResolvedConfiguration() {
if (!this._resolved) {
const config = this._resolve();
if (config) {
this._resolved = new ResolvedLanguageConfiguration(this.languageId, config);
}
}
return this._resolved;
}
_resolve() {
if (this._entries.length === 0) {
return null;
}
this._entries.sort(LanguageConfigurationContribution.cmp);
return combineLanguageConfigurations(this._entries.map((e) => e.configuration));
}
};
LanguageConfigurationContribution = class {
constructor(configuration, priority, order) {
this.configuration = configuration;
this.priority = priority;
this.order = order;
}
static cmp(a3, b) {
if (a3.priority === b.priority) {
return a3.order - b.order;
}
return a3.priority - b.priority;
}
};
LanguageConfigurationChangeEvent = class {
constructor(languageId) {
this.languageId = languageId;
}
};
LanguageConfigurationRegistry = class extends Disposable {
constructor() {
super();
this._entries = /* @__PURE__ */ new Map();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._register(this.register(PLAINTEXT_LANGUAGE_ID, {
brackets: [
["(", ")"],
["[", "]"],
["{", "}"]
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "`", close: "`" }
],
colorizedBracketPairs: [],
folding: {
offSide: true
}
}, 0));
}
/**
* @param priority Use a higher number for higher priority
*/
register(languageId, configuration, priority = 0) {
let entries2 = this._entries.get(languageId);
if (!entries2) {
entries2 = new ComposedLanguageConfiguration(languageId);
this._entries.set(languageId, entries2);
}
const disposable = entries2.register(configuration, priority);
this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));
return toDisposable(() => {
disposable.dispose();
this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageId));
});
}
getLanguageConfiguration(languageId) {
const entries2 = this._entries.get(languageId);
return (entries2 === null || entries2 === void 0 ? void 0 : entries2.getResolvedConfiguration()) || null;
}
};
ResolvedLanguageConfiguration = class _ResolvedLanguageConfiguration {
constructor(languageId, underlyingConfig) {
this.languageId = languageId;
this.underlyingConfig = underlyingConfig;
this._brackets = null;
this._electricCharacter = null;
this._onEnterSupport = this.underlyingConfig.brackets || this.underlyingConfig.indentationRules || this.underlyingConfig.onEnterRules ? new OnEnterSupport(this.underlyingConfig) : null;
this.comments = _ResolvedLanguageConfiguration._handleComments(this.underlyingConfig);
this.characterPair = new CharacterPairSupport(this.underlyingConfig);
this.wordDefinition = this.underlyingConfig.wordPattern || DEFAULT_WORD_REGEXP;
this.indentationRules = this.underlyingConfig.indentationRules;
if (this.underlyingConfig.indentationRules) {
this.indentRulesSupport = new IndentRulesSupport(this.underlyingConfig.indentationRules);
} else {
this.indentRulesSupport = null;
}
this.foldingRules = this.underlyingConfig.folding || {};
this.bracketsNew = new LanguageBracketsConfiguration(languageId, this.underlyingConfig);
}
getWordDefinition() {
return ensureValidWordDefinition(this.wordDefinition);
}
get brackets() {
if (!this._brackets && this.underlyingConfig.brackets) {
this._brackets = new RichEditBrackets(this.languageId, this.underlyingConfig.brackets);
}
return this._brackets;
}
get electricCharacter() {
if (!this._electricCharacter) {
this._electricCharacter = new BracketElectricCharacterSupport(this.brackets);
}
return this._electricCharacter;
}
onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText) {
if (!this._onEnterSupport) {
return null;
}
return this._onEnterSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);
}
getAutoClosingPairs() {
return new AutoClosingPairs(this.characterPair.getAutoClosingPairs());
}
getAutoCloseBeforeSet(forQuotes) {
return this.characterPair.getAutoCloseBeforeSet(forQuotes);
}
getSurroundingPairs() {
return this.characterPair.getSurroundingPairs();
}
static _handleComments(conf81) {
const commentRule = conf81.comments;
if (!commentRule) {
return null;
}
const comments = {};
if (commentRule.lineComment) {
comments.lineCommentToken = commentRule.lineComment;
}
if (commentRule.blockComment) {
const [blockStart, blockEnd] = commentRule.blockComment;
comments.blockCommentStartToken = blockStart;
comments.blockCommentEndToken = blockEnd;
}
return comments;
}
};
registerSingleton(
ILanguageConfigurationService,
LanguageConfigurationService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js
var DiffChange;
var init_diffChange = __esm({
"node_modules/monaco-editor/esm/vs/base/common/diff/diffChange.js"() {
DiffChange = class {
/**
* Constructs a new DiffChange with the given sequence information
* and content.
*/
constructor(originalStart, originalLength, modifiedStart, modifiedLength) {
this.originalStart = originalStart;
this.originalLength = originalLength;
this.modifiedStart = modifiedStart;
this.modifiedLength = modifiedLength;
}
/**
* The end point (exclusive) of the change in the original sequence.
*/
getOriginalEnd() {
return this.originalStart + this.originalLength;
}
/**
* The end point (exclusive) of the change in the modified sequence.
*/
getModifiedEnd() {
return this.modifiedStart + this.modifiedLength;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/diff/diff.js
function stringDiff(original, modified, pretty) {
return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes;
}
var StringDiffSequence, Debug, MyArray, DiffChangeHelper, LcsDiff;
var init_diff = __esm({
"node_modules/monaco-editor/esm/vs/base/common/diff/diff.js"() {
init_diffChange();
init_hash();
StringDiffSequence = class {
constructor(source) {
this.source = source;
}
getElements() {
const source = this.source;
const characters = new Int32Array(source.length);
for (let i = 0, len = source.length; i < len; i++) {
characters[i] = source.charCodeAt(i);
}
return characters;
}
};
Debug = class {
static Assert(condition, message) {
if (!condition) {
throw new Error(message);
}
}
};
MyArray = class {
/**
* Copies a range of elements from an Array starting at the specified source index and pastes
* them to another Array starting at the specified destination index. The length and the indexes
* are specified as 64-bit integers.
* sourceArray:
* The Array that contains the data to copy.
* sourceIndex:
* A 64-bit integer that represents the index in the sourceArray at which copying begins.
* destinationArray:
* The Array that receives the data.
* destinationIndex:
* A 64-bit integer that represents the index in the destinationArray at which storing begins.
* length:
* A 64-bit integer that represents the number of elements to copy.
*/
static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {
for (let i = 0; i < length; i++) {
destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
}
}
static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {
for (let i = 0; i < length; i++) {
destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
}
}
};
DiffChangeHelper = class {
/**
* Constructs a new DiffChangeHelper for the given DiffSequences.
*/
constructor() {
this.m_changes = [];
this.m_originalStart = 1073741824;
this.m_modifiedStart = 1073741824;
this.m_originalCount = 0;
this.m_modifiedCount = 0;
}
/**
* Marks the beginning of the next change in the set of differences.
*/
MarkNextChange() {
if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
this.m_changes.push(new DiffChange(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;
}
/**
* Adds the original element at the given position to the elements
* affected by the current change. The modified index gives context
* to the change position with respect to the original sequence.
* @param originalIndex The index of the original element to add.
* @param modifiedIndex The index of the modified element that provides corresponding position in the modified sequence.
*/
AddOriginalElement(originalIndex, modifiedIndex) {
this.m_originalStart = Math.min(this.m_originalStart, originalIndex);
this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);
this.m_originalCount++;
}
/**
* Adds the modified element at the given position to the elements
* affected by the current change. The original index gives context
* to the change position with respect to the modified sequence.
* @param originalIndex The index of the original element that provides corresponding position in the original sequence.
* @param modifiedIndex The index of the modified element to add.
*/
AddModifiedElement(originalIndex, modifiedIndex) {
this.m_originalStart = Math.min(this.m_originalStart, originalIndex);
this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);
this.m_modifiedCount++;
}
/**
* Retrieves all of the changes marked by the class.
*/
getChanges() {
if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
this.MarkNextChange();
}
return this.m_changes;
}
/**
* Retrieves all of the changes marked by the class in the reverse order
*/
getReverseChanges() {
if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
this.MarkNextChange();
}
this.m_changes.reverse();
return this.m_changes;
}
};
LcsDiff = class _LcsDiff {
/**
* Constructs the DiffFinder
*/
constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) {
this.ContinueProcessingPredicate = continueProcessingPredicate;
this._originalSequence = originalSequence;
this._modifiedSequence = modifiedSequence;
const [originalStringElements, originalElementsOrHash, originalHasStrings] = _LcsDiff._getElements(originalSequence);
const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = _LcsDiff._getElements(modifiedSequence);
this._hasStrings = originalHasStrings && modifiedHasStrings;
this._originalStringElements = originalStringElements;
this._originalElementsOrHash = originalElementsOrHash;
this._modifiedStringElements = modifiedStringElements;
this._modifiedElementsOrHash = modifiedElementsOrHash;
this.m_forwardHistory = [];
this.m_reverseHistory = [];
}
static _isStringArray(arr) {
return arr.length > 0 && typeof arr[0] === "string";
}
static _getElements(sequence) {
const elements = sequence.getElements();
if (_LcsDiff._isStringArray(elements)) {
const hashes = new Int32Array(elements.length);
for (let i = 0, len = elements.length; i < len; i++) {
hashes[i] = stringHash(elements[i], 0);
}
return [elements, hashes, true];
}
if (elements instanceof Int32Array) {
return [[], elements, false];
}
return [[], new Int32Array(elements), false];
}
ElementsAreEqual(originalIndex, newIndex) {
if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {
return false;
}
return this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true;
}
ElementsAreStrictEqual(originalIndex, newIndex) {
if (!this.ElementsAreEqual(originalIndex, newIndex)) {
return false;
}
const originalElement = _LcsDiff._getStrictElement(this._originalSequence, originalIndex);
const modifiedElement = _LcsDiff._getStrictElement(this._modifiedSequence, newIndex);
return originalElement === modifiedElement;
}
static _getStrictElement(sequence, index) {
if (typeof sequence.getStrictElement === "function") {
return sequence.getStrictElement(index);
}
return null;
}
OriginalElementsAreEqual(index1, index2) {
if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {
return false;
}
return this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true;
}
ModifiedElementsAreEqual(index1, index2) {
if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {
return false;
}
return this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true;
}
ComputeDiff(pretty) {
return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);
}
/**
* Computes the differences between the original and modified input
* sequences on the bounded range.
* @returns An array of the differences between the two input sequences.
*/
_ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) {
const quitEarlyArr = [false];
let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);
if (pretty) {
changes = this.PrettifyChanges(changes);
}
return {
quitEarly: quitEarlyArr[0],
changes
};
}
/**
* Private helper method which computes the differences on the bounded range
* recursively.
* @returns An array of the differences between the two input sequences.
*/
ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) {
quitEarlyArr[0] = false;
while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) {
originalStart++;
modifiedStart++;
}
while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) {
originalEnd--;
modifiedEnd--;
}
if (originalStart > originalEnd || modifiedStart > modifiedEnd) {
let changes;
if (modifiedStart <= modifiedEnd) {
Debug.Assert(originalStart === originalEnd + 1, "originalStart should only be one more than originalEnd");
changes = [
new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1)
];
} else if (originalStart <= originalEnd) {
Debug.Assert(modifiedStart === modifiedEnd + 1, "modifiedStart should only be one more than modifiedEnd");
changes = [
new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0)
];
} else {
Debug.Assert(originalStart === originalEnd + 1, "originalStart should only be one more than originalEnd");
Debug.Assert(modifiedStart === modifiedEnd + 1, "modifiedStart should only be one more than modifiedEnd");
changes = [];
}
return changes;
}
const midOriginalArr = [0];
const midModifiedArr = [0];
const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr);
const midOriginal = midOriginalArr[0];
const midModified = midModifiedArr[0];
if (result !== null) {
return result;
} else if (!quitEarlyArr[0]) {
const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr);
let rightChanges = [];
if (!quitEarlyArr[0]) {
rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr);
} else {
rightChanges = [
new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1)
];
}
return this.ConcatenateChanges(leftChanges, rightChanges);
}
return [
new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)
];
}
WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) {
let forwardChanges = null;
let reverseChanges = null;
let changeHelper = new DiffChangeHelper();
let diagonalMin = diagonalForwardStart;
let diagonalMax = diagonalForwardEnd;
let diagonalRelative = midOriginalArr[0] - midModifiedArr[0] - diagonalForwardOffset;
let lastOriginalIndex = -1073741824;
let historyIndex = this.m_forwardHistory.length - 1;
do {
const diagonal = diagonalRelative + diagonalForwardBase;
if (diagonal === diagonalMin || diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1]) {
originalIndex = forwardPoints[diagonal + 1];
modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;
if (originalIndex < lastOriginalIndex) {
changeHelper.MarkNextChange();
}
lastOriginalIndex = originalIndex;
changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);
diagonalRelative = diagonal + 1 - diagonalForwardBase;
} else {
originalIndex = forwardPoints[diagonal - 1] + 1;
modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;
if (originalIndex < lastOriginalIndex) {
changeHelper.MarkNextChange();
}
lastOriginalIndex = originalIndex - 1;
changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1);
diagonalRelative = diagonal - 1 - diagonalForwardBase;
}
if (historyIndex >= 0) {
forwardPoints = this.m_forwardHistory[historyIndex];
diagonalForwardBase = forwardPoints[0];
diagonalMin = 1;
diagonalMax = forwardPoints.length - 1;
}
} while (--historyIndex >= -1);
forwardChanges = changeHelper.getReverseChanges();
if (quitEarlyArr[0]) {
let originalStartPoint = midOriginalArr[0] + 1;
let modifiedStartPoint = midModifiedArr[0] + 1;
if (forwardChanges !== null && forwardChanges.length > 0) {
const lastForwardChange = forwardChanges[forwardChanges.length - 1];
originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd());
modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd());
}
reverseChanges = [
new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)
];
} else {
changeHelper = new DiffChangeHelper();
diagonalMin = diagonalReverseStart;
diagonalMax = diagonalReverseEnd;
diagonalRelative = midOriginalArr[0] - midModifiedArr[0] - diagonalReverseOffset;
lastOriginalIndex = 1073741824;
historyIndex = deltaIsEven ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2;
do {
const diagonal = diagonalRelative + diagonalReverseBase;
if (diagonal === diagonalMin || diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1]) {
originalIndex = reversePoints[diagonal + 1] - 1;
modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;
if (originalIndex > lastOriginalIndex) {
changeHelper.MarkNextChange();
}
lastOriginalIndex = originalIndex + 1;
changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1);
diagonalRelative = diagonal + 1 - diagonalReverseBase;
} else {
originalIndex = reversePoints[diagonal - 1];
modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;
if (originalIndex > lastOriginalIndex) {
changeHelper.MarkNextChange();
}
lastOriginalIndex = originalIndex;
changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1);
diagonalRelative = diagonal - 1 - diagonalReverseBase;
}
if (historyIndex >= 0) {
reversePoints = this.m_reverseHistory[historyIndex];
diagonalReverseBase = reversePoints[0];
diagonalMin = 1;
diagonalMax = reversePoints.length - 1;
}
} while (--historyIndex >= -1);
reverseChanges = changeHelper.getChanges();
}
return this.ConcatenateChanges(forwardChanges, reverseChanges);
}
/**
* Given the range to compute the diff on, this method finds the point:
* (midOriginal, midModified)
* that exists in the middle of the LCS of the two sequences and
* is the point at which the LCS problem may be broken down recursively.
* This method will try to keep the LCS trace in memory. If the LCS recursion
* point is calculated and the full trace is available in memory, then this method
* will return the change list.
* @param originalStart The start bound of the original sequence range
* @param originalEnd The end bound of the original sequence range
* @param modifiedStart The start bound of the modified sequence range
* @param modifiedEnd The end bound of the modified sequence range
* @param midOriginal The middle point of the original sequence range
* @param midModified The middle point of the modified sequence range
* @returns The diff changes, if available, otherwise null
*/
ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) {
let originalIndex = 0, modifiedIndex = 0;
let diagonalForwardStart = 0, diagonalForwardEnd = 0;
let diagonalReverseStart = 0, diagonalReverseEnd = 0;
originalStart--;
modifiedStart--;
midOriginalArr[0] = 0;
midModifiedArr[0] = 0;
this.m_forwardHistory = [];
this.m_reverseHistory = [];
const maxDifferences = originalEnd - originalStart + (modifiedEnd - modifiedStart);
const numDiagonals = maxDifferences + 1;
const forwardPoints = new Int32Array(numDiagonals);
const reversePoints = new Int32Array(numDiagonals);
const diagonalForwardBase = modifiedEnd - modifiedStart;
const diagonalReverseBase = originalEnd - originalStart;
const diagonalForwardOffset = originalStart - modifiedStart;
const diagonalReverseOffset = originalEnd - modifiedEnd;
const delta = diagonalReverseBase - diagonalForwardBase;
const deltaIsEven = delta % 2 === 0;
forwardPoints[diagonalForwardBase] = originalStart;
reversePoints[diagonalReverseBase] = originalEnd;
quitEarlyArr[0] = false;
for (let numDifferences = 1; numDifferences <= maxDifferences / 2 + 1; numDifferences++) {
let furthestOriginalIndex = 0;
let furthestModifiedIndex = 0;
diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals);
diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals);
for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) {
if (diagonal === diagonalForwardStart || diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1]) {
originalIndex = forwardPoints[diagonal + 1];
} else {
originalIndex = forwardPoints[diagonal - 1] + 1;
}
modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset;
const tempOriginalIndex = originalIndex;
while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) {
originalIndex++;
modifiedIndex++;
}
forwardPoints[diagonal] = originalIndex;
if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) {
furthestOriginalIndex = originalIndex;
furthestModifiedIndex = modifiedIndex;
}
if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= numDifferences - 1) {
if (originalIndex >= reversePoints[diagonal]) {
midOriginalArr[0] = originalIndex;
midModifiedArr[0] = modifiedIndex;
if (tempOriginalIndex <= reversePoints[diagonal] && 1447 > 0 && numDifferences <= 1447 + 1) {
return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
} else {
return null;
}
}
}
}
const matchLengthOfLongest = (furthestOriginalIndex - originalStart + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;
if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {
quitEarlyArr[0] = true;
midOriginalArr[0] = furthestOriginalIndex;
midModifiedArr[0] = furthestModifiedIndex;
if (matchLengthOfLongest > 0 && 1447 > 0 && numDifferences <= 1447 + 1) {
return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
} else {
originalStart++;
modifiedStart++;
return [
new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)
];
}
}
diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals);
diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals);
for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) {
if (diagonal === diagonalReverseStart || diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1]) {
originalIndex = reversePoints[diagonal + 1] - 1;
} else {
originalIndex = reversePoints[diagonal - 1];
}
modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset;
const tempOriginalIndex = originalIndex;
while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) {
originalIndex--;
modifiedIndex--;
}
reversePoints[diagonal] = originalIndex;
if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) {
if (originalIndex <= forwardPoints[diagonal]) {
midOriginalArr[0] = originalIndex;
midModifiedArr[0] = modifiedIndex;
if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 > 0 && numDifferences <= 1447 + 1) {
return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
} else {
return null;
}
}
}
}
if (numDifferences <= 1447) {
let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);
temp[0] = diagonalForwardBase - diagonalForwardStart + 1;
MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);
this.m_forwardHistory.push(temp);
temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);
temp[0] = diagonalReverseBase - diagonalReverseStart + 1;
MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);
this.m_reverseHistory.push(temp);
}
}
return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
}
/**
* Shifts the given changes to provide a more intuitive diff.
* While the first element in a diff matches the first element after the diff,
* we shift the diff down.
*
* @param changes The list of changes to shift
* @returns The shifted changes
*/
PrettifyChanges(changes) {
for (let i = 0; i < changes.length; i++) {
const change = changes[i];
const originalStop = i < changes.length - 1 ? changes[i + 1].originalStart : this._originalElementsOrHash.length;
const modifiedStop = i < changes.length - 1 ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;
const checkOriginal = change.originalLength > 0;
const checkModified = change.modifiedLength > 0;
while (change.originalStart + change.originalLength < originalStop && change.modifiedStart + change.modifiedLength < modifiedStop && (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength)) && (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {
const startStrictEqual = this.ElementsAreStrictEqual(change.originalStart, change.modifiedStart);
const endStrictEqual = this.ElementsAreStrictEqual(change.originalStart + change.originalLength, change.modifiedStart + change.modifiedLength);
if (endStrictEqual && !startStrictEqual) {
break;
}
change.originalStart++;
change.modifiedStart++;
}
const mergedChangeArr = [null];
if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {
changes[i] = mergedChangeArr[0];
changes.splice(i + 1, 1);
i--;
continue;
}
}
for (let i = changes.length - 1; i >= 0; i--) {
const change = changes[i];
let originalStop = 0;
let modifiedStop = 0;
if (i > 0) {
const prevChange = changes[i - 1];
originalStop = prevChange.originalStart + prevChange.originalLength;
modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;
}
const checkOriginal = change.originalLength > 0;
const checkModified = change.modifiedLength > 0;
let bestDelta = 0;
let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);
for (let delta = 1; ; delta++) {
const originalStart = change.originalStart - delta;
const modifiedStart = change.modifiedStart - delta;
if (originalStart < originalStop || modifiedStart < modifiedStop) {
break;
}
if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {
break;
}
if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {
break;
}
const touchingPreviousChange = originalStart === originalStop && modifiedStart === modifiedStop;
const score3 = (touchingPreviousChange ? 5 : 0) + this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength);
if (score3 > bestScore) {
bestScore = score3;
bestDelta = delta;
}
}
change.originalStart -= bestDelta;
change.modifiedStart -= bestDelta;
const mergedChangeArr = [null];
if (i > 0 && this.ChangesOverlap(changes[i - 1], changes[i], mergedChangeArr)) {
changes[i - 1] = mergedChangeArr[0];
changes.splice(i, 1);
i++;
continue;
}
}
if (this._hasStrings) {
for (let i = 1, len = changes.length; i < len; i++) {
const aChange = changes[i - 1];
const bChange = changes[i];
const matchedLength = bChange.originalStart - aChange.originalStart - aChange.originalLength;
const aOriginalStart = aChange.originalStart;
const bOriginalEnd = bChange.originalStart + bChange.originalLength;
const abOriginalLength = bOriginalEnd - aOriginalStart;
const aModifiedStart = aChange.modifiedStart;
const bModifiedEnd = bChange.modifiedStart + bChange.modifiedLength;
const abModifiedLength = bModifiedEnd - aModifiedStart;
if (matchedLength < 5 && abOriginalLength < 20 && abModifiedLength < 20) {
const t4 = this._findBetterContiguousSequence(aOriginalStart, abOriginalLength, aModifiedStart, abModifiedLength, matchedLength);
if (t4) {
const [originalMatchStart, modifiedMatchStart] = t4;
if (originalMatchStart !== aChange.originalStart + aChange.originalLength || modifiedMatchStart !== aChange.modifiedStart + aChange.modifiedLength) {
aChange.originalLength = originalMatchStart - aChange.originalStart;
aChange.modifiedLength = modifiedMatchStart - aChange.modifiedStart;
bChange.originalStart = originalMatchStart + matchedLength;
bChange.modifiedStart = modifiedMatchStart + matchedLength;
bChange.originalLength = bOriginalEnd - bChange.originalStart;
bChange.modifiedLength = bModifiedEnd - bChange.modifiedStart;
}
}
}
}
}
return changes;
}
_findBetterContiguousSequence(originalStart, originalLength, modifiedStart, modifiedLength, desiredLength) {
if (originalLength < desiredLength || modifiedLength < desiredLength) {
return null;
}
const originalMax = originalStart + originalLength - desiredLength + 1;
const modifiedMax = modifiedStart + modifiedLength - desiredLength + 1;
let bestScore = 0;
let bestOriginalStart = 0;
let bestModifiedStart = 0;
for (let i = originalStart; i < originalMax; i++) {
for (let j = modifiedStart; j < modifiedMax; j++) {
const score3 = this._contiguousSequenceScore(i, j, desiredLength);
if (score3 > 0 && score3 > bestScore) {
bestScore = score3;
bestOriginalStart = i;
bestModifiedStart = j;
}
}
}
if (bestScore > 0) {
return [bestOriginalStart, bestModifiedStart];
}
return null;
}
_contiguousSequenceScore(originalStart, modifiedStart, length) {
let score3 = 0;
for (let l = 0; l < length; l++) {
if (!this.ElementsAreEqual(originalStart + l, modifiedStart + l)) {
return 0;
}
score3 += this._originalStringElements[originalStart + l].length;
}
return score3;
}
_OriginalIsBoundary(index) {
if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {
return true;
}
return this._hasStrings && /^\s*$/.test(this._originalStringElements[index]);
}
_OriginalRegionIsBoundary(originalStart, originalLength) {
if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {
return true;
}
if (originalLength > 0) {
const originalEnd = originalStart + originalLength;
if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {
return true;
}
}
return false;
}
_ModifiedIsBoundary(index) {
if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {
return true;
}
return this._hasStrings && /^\s*$/.test(this._modifiedStringElements[index]);
}
_ModifiedRegionIsBoundary(modifiedStart, modifiedLength) {
if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {
return true;
}
if (modifiedLength > 0) {
const modifiedEnd = modifiedStart + modifiedLength;
if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {
return true;
}
}
return false;
}
_boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) {
const originalScore = this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0;
const modifiedScore = this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0;
return originalScore + modifiedScore;
}
/**
* Concatenates the two input DiffChange lists and returns the resulting
* list.
* @param The left changes
* @param The right changes
* @returns The concatenated list
*/
ConcatenateChanges(left, right) {
const mergedChangeArr = [];
if (left.length === 0 || right.length === 0) {
return right.length > 0 ? right : left;
} else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) {
const result = new Array(left.length + right.length - 1);
MyArray.Copy(left, 0, result, 0, left.length - 1);
result[left.length - 1] = mergedChangeArr[0];
MyArray.Copy(right, 1, result, left.length, right.length - 1);
return result;
} else {
const result = new Array(left.length + right.length);
MyArray.Copy(left, 0, result, 0, left.length);
MyArray.Copy(right, 0, result, left.length, right.length);
return result;
}
}
/**
* Returns true if the two changes overlap and can be merged into a single
* change
* @param left The left change
* @param right The right change
* @param mergedChange The merged change if the two overlap, null otherwise
* @returns True if the two changes overlap
*/
ChangesOverlap(left, right, mergedChangeArr) {
Debug.Assert(left.originalStart <= right.originalStart, "Left change is not less than or equal to right change");
Debug.Assert(left.modifiedStart <= right.modifiedStart, "Left change is not less than or equal to right change");
if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) {
const originalStart = left.originalStart;
let originalLength = left.originalLength;
const modifiedStart = left.modifiedStart;
let modifiedLength = left.modifiedLength;
if (left.originalStart + left.originalLength >= right.originalStart) {
originalLength = right.originalStart + right.originalLength - left.originalStart;
}
if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) {
modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart;
}
mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength);
return true;
} else {
mergedChangeArr[0] = null;
return false;
}
}
/**
* Helper method used to clip a diagonal index to the range of valid
* diagonals. This also decides whether or not the diagonal index,
* if it exceeds the boundary, should be clipped to the boundary or clipped
* one inside the boundary depending on the Even/Odd status of the boundary
* and numDifferences.
* @param diagonal The index of the diagonal to clip.
* @param numDifferences The current number of differences being iterated upon.
* @param diagonalBaseIndex The base reference diagonal.
* @param numDiagonals The total number of diagonals.
* @returns The clipped diagonal index.
*/
ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) {
if (diagonal >= 0 && diagonal < numDiagonals) {
return diagonal;
}
const diagonalsBelow = diagonalBaseIndex;
const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1;
const diffEven = numDifferences % 2 === 0;
if (diagonal < 0) {
const lowerBoundEven = diagonalsBelow % 2 === 0;
return diffEven === lowerBoundEven ? 0 : 1;
} else {
const upperBoundEven = diagonalsAbove % 2 === 0;
return diffEven === upperBoundEven ? numDiagonals - 1 : numDiagonals - 2;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/uint.js
function toUint8(v) {
if (v < 0) {
return 0;
}
if (v > 255) {
return 255;
}
return v | 0;
}
function toUint32(v) {
if (v < 0) {
return 0;
}
if (v > 4294967295) {
return 4294967295;
}
return v | 0;
}
var init_uint = __esm({
"node_modules/monaco-editor/esm/vs/base/common/uint.js"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/prefixSumComputer.js
var PrefixSumComputer, ConstantTimePrefixSumComputer, PrefixSumIndexOfResult;
var init_prefixSumComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/prefixSumComputer.js"() {
init_arrays();
init_uint();
PrefixSumComputer = class {
constructor(values2) {
this.values = values2;
this.prefixSum = new Uint32Array(values2.length);
this.prefixSumValidIndex = new Int32Array(1);
this.prefixSumValidIndex[0] = -1;
}
insertValues(insertIndex, insertValues) {
insertIndex = toUint32(insertIndex);
const oldValues = this.values;
const oldPrefixSum = this.prefixSum;
const insertValuesLen = insertValues.length;
if (insertValuesLen === 0) {
return false;
}
this.values = new Uint32Array(oldValues.length + insertValuesLen);
this.values.set(oldValues.subarray(0, insertIndex), 0);
this.values.set(oldValues.subarray(insertIndex), insertIndex + insertValuesLen);
this.values.set(insertValues, insertIndex);
if (insertIndex - 1 < this.prefixSumValidIndex[0]) {
this.prefixSumValidIndex[0] = insertIndex - 1;
}
this.prefixSum = new Uint32Array(this.values.length);
if (this.prefixSumValidIndex[0] >= 0) {
this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));
}
return true;
}
setValue(index, value) {
index = toUint32(index);
value = toUint32(value);
if (this.values[index] === value) {
return false;
}
this.values[index] = value;
if (index - 1 < this.prefixSumValidIndex[0]) {
this.prefixSumValidIndex[0] = index - 1;
}
return true;
}
removeValues(startIndex, count) {
startIndex = toUint32(startIndex);
count = toUint32(count);
const oldValues = this.values;
const oldPrefixSum = this.prefixSum;
if (startIndex >= oldValues.length) {
return false;
}
const maxCount = oldValues.length - startIndex;
if (count >= maxCount) {
count = maxCount;
}
if (count === 0) {
return false;
}
this.values = new Uint32Array(oldValues.length - count);
this.values.set(oldValues.subarray(0, startIndex), 0);
this.values.set(oldValues.subarray(startIndex + count), startIndex);
this.prefixSum = new Uint32Array(this.values.length);
if (startIndex - 1 < this.prefixSumValidIndex[0]) {
this.prefixSumValidIndex[0] = startIndex - 1;
}
if (this.prefixSumValidIndex[0] >= 0) {
this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));
}
return true;
}
getTotalSum() {
if (this.values.length === 0) {
return 0;
}
return this._getPrefixSum(this.values.length - 1);
}
/**
* Returns the sum of the first `index + 1` many items.
* @returns `SUM(0 <= j <= index, values[j])`.
*/
getPrefixSum(index) {
if (index < 0) {
return 0;
}
index = toUint32(index);
return this._getPrefixSum(index);
}
_getPrefixSum(index) {
if (index <= this.prefixSumValidIndex[0]) {
return this.prefixSum[index];
}
let startIndex = this.prefixSumValidIndex[0] + 1;
if (startIndex === 0) {
this.prefixSum[0] = this.values[0];
startIndex++;
}
if (index >= this.values.length) {
index = this.values.length - 1;
}
for (let i = startIndex; i <= index; i++) {
this.prefixSum[i] = this.prefixSum[i - 1] + this.values[i];
}
this.prefixSumValidIndex[0] = Math.max(this.prefixSumValidIndex[0], index);
return this.prefixSum[index];
}
getIndexOf(sum) {
sum = Math.floor(sum);
this.getTotalSum();
let low = 0;
let high = this.values.length - 1;
let mid = 0;
let midStop = 0;
let midStart = 0;
while (low <= high) {
mid = low + (high - low) / 2 | 0;
midStop = this.prefixSum[mid];
midStart = midStop - this.values[mid];
if (sum < midStart) {
high = mid - 1;
} else if (sum >= midStop) {
low = mid + 1;
} else {
break;
}
}
return new PrefixSumIndexOfResult(mid, sum - midStart);
}
};
ConstantTimePrefixSumComputer = class {
constructor(values2) {
this._values = values2;
this._isValid = false;
this._validEndIndex = -1;
this._prefixSum = [];
this._indexBySum = [];
}
/**
* @returns SUM(0 <= j < values.length, values[j])
*/
getTotalSum() {
this._ensureValid();
return this._indexBySum.length;
}
/**
* Returns the sum of the first `count` many items.
* @returns `SUM(0 <= j < count, values[j])`.
*/
getPrefixSum(count) {
this._ensureValid();
if (count === 0) {
return 0;
}
return this._prefixSum[count - 1];
}
/**
* @returns `result`, such that `getPrefixSum(result.index) + result.remainder = sum`
*/
getIndexOf(sum) {
this._ensureValid();
const idx = this._indexBySum[sum];
const viewLinesAbove = idx > 0 ? this._prefixSum[idx - 1] : 0;
return new PrefixSumIndexOfResult(idx, sum - viewLinesAbove);
}
removeValues(start, deleteCount) {
this._values.splice(start, deleteCount);
this._invalidate(start);
}
insertValues(insertIndex, insertArr) {
this._values = arrayInsert(this._values, insertIndex, insertArr);
this._invalidate(insertIndex);
}
_invalidate(index) {
this._isValid = false;
this._validEndIndex = Math.min(this._validEndIndex, index - 1);
}
_ensureValid() {
if (this._isValid) {
return;
}
for (let i = this._validEndIndex + 1, len = this._values.length; i < len; i++) {
const value = this._values[i];
const sumAbove = i > 0 ? this._prefixSum[i - 1] : 0;
this._prefixSum[i] = sumAbove + value;
for (let j = 0; j < value; j++) {
this._indexBySum[sumAbove + j] = i;
}
}
this._prefixSum.length = this._values.length;
this._indexBySum.length = this._prefixSum[this._prefixSum.length - 1];
this._isValid = true;
this._validEndIndex = this._values.length - 1;
}
setValue(index, value) {
if (this._values[index] === value) {
return;
}
this._values[index] = value;
this._invalidate(index);
}
};
PrefixSumIndexOfResult = class {
constructor(index, remainder) {
this.index = index;
this.remainder = remainder;
this._prefixSumIndexOfResultBrand = void 0;
this.index = index;
this.remainder = remainder;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js
var MirrorTextModel;
var init_mirrorTextModel = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js"() {
init_strings();
init_position();
init_prefixSumComputer();
MirrorTextModel = class {
constructor(uri, lines, eol, versionId) {
this._uri = uri;
this._lines = lines;
this._eol = eol;
this._versionId = versionId;
this._lineStarts = null;
this._cachedTextValue = null;
}
dispose() {
this._lines.length = 0;
}
get version() {
return this._versionId;
}
getText() {
if (this._cachedTextValue === null) {
this._cachedTextValue = this._lines.join(this._eol);
}
return this._cachedTextValue;
}
onEvents(e) {
if (e.eol && e.eol !== this._eol) {
this._eol = e.eol;
this._lineStarts = null;
}
const changes = e.changes;
for (const change of changes) {
this._acceptDeleteRange(change.range);
this._acceptInsertText(new Position(change.range.startLineNumber, change.range.startColumn), change.text);
}
this._versionId = e.versionId;
this._cachedTextValue = null;
}
_ensureLineStarts() {
if (!this._lineStarts) {
const eolLength = this._eol.length;
const linesLength = this._lines.length;
const lineStartValues = new Uint32Array(linesLength);
for (let i = 0; i < linesLength; i++) {
lineStartValues[i] = this._lines[i].length + eolLength;
}
this._lineStarts = new PrefixSumComputer(lineStartValues);
}
}
/**
* All changes to a line's text go through this method
*/
_setLineText(lineIndex, newValue) {
this._lines[lineIndex] = newValue;
if (this._lineStarts) {
this._lineStarts.setValue(lineIndex, this._lines[lineIndex].length + this._eol.length);
}
}
_acceptDeleteRange(range2) {
if (range2.startLineNumber === range2.endLineNumber) {
if (range2.startColumn === range2.endColumn) {
return;
}
this._setLineText(range2.startLineNumber - 1, this._lines[range2.startLineNumber - 1].substring(0, range2.startColumn - 1) + this._lines[range2.startLineNumber - 1].substring(range2.endColumn - 1));
return;
}
this._setLineText(range2.startLineNumber - 1, this._lines[range2.startLineNumber - 1].substring(0, range2.startColumn - 1) + this._lines[range2.endLineNumber - 1].substring(range2.endColumn - 1));
this._lines.splice(range2.startLineNumber, range2.endLineNumber - range2.startLineNumber);
if (this._lineStarts) {
this._lineStarts.removeValues(range2.startLineNumber, range2.endLineNumber - range2.startLineNumber);
}
}
_acceptInsertText(position, insertText) {
if (insertText.length === 0) {
return;
}
const insertLines = splitLines(insertText);
if (insertLines.length === 1) {
this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1) + insertLines[0] + this._lines[position.lineNumber - 1].substring(position.column - 1));
return;
}
insertLines[insertLines.length - 1] += this._lines[position.lineNumber - 1].substring(position.column - 1);
this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1) + insertLines[0]);
const newLengths = new Uint32Array(insertLines.length - 1);
for (let i = 1; i < insertLines.length; i++) {
this._lines.splice(position.lineNumber + i - 1, 0, insertLines[i]);
newLengths[i - 1] = insertLines[i].length + this._eol.length;
}
if (this._lineStarts) {
this._lineStarts.insertValues(position.lineNumber, newLengths);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js
var CharacterClassifier, CharacterSet;
var init_characterClassifier = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js"() {
init_uint();
CharacterClassifier = class _CharacterClassifier {
constructor(_defaultValue) {
const defaultValue = toUint8(_defaultValue);
this._defaultValue = defaultValue;
this._asciiMap = _CharacterClassifier._createAsciiMap(defaultValue);
this._map = /* @__PURE__ */ new Map();
}
static _createAsciiMap(defaultValue) {
const asciiMap = new Uint8Array(256);
asciiMap.fill(defaultValue);
return asciiMap;
}
set(charCode, _value) {
const value = toUint8(_value);
if (charCode >= 0 && charCode < 256) {
this._asciiMap[charCode] = value;
} else {
this._map.set(charCode, value);
}
}
get(charCode) {
if (charCode >= 0 && charCode < 256) {
return this._asciiMap[charCode];
} else {
return this._map.get(charCode) || this._defaultValue;
}
}
clear() {
this._asciiMap.fill(this._defaultValue);
this._map.clear();
}
};
CharacterSet = class {
constructor() {
this._actual = new CharacterClassifier(
0
/* Boolean.False */
);
}
add(charCode) {
this._actual.set(
charCode,
1
/* Boolean.True */
);
}
has(charCode) {
return this._actual.get(charCode) === 1;
}
clear() {
return this._actual.clear();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/linkComputer.js
function getStateMachine() {
if (_stateMachine === null) {
_stateMachine = new StateMachine([
[
1,
104,
2
/* State.H */
],
[
1,
72,
2
/* State.H */
],
[
1,
102,
6
/* State.F */
],
[
1,
70,
6
/* State.F */
],
[
2,
116,
3
/* State.HT */
],
[
2,
84,
3
/* State.HT */
],
[
3,
116,
4
/* State.HTT */
],
[
3,
84,
4
/* State.HTT */
],
[
4,
112,
5
/* State.HTTP */
],
[
4,
80,
5
/* State.HTTP */
],
[
5,
115,
9
/* State.BeforeColon */
],
[
5,
83,
9
/* State.BeforeColon */
],
[
5,
58,
10
/* State.AfterColon */
],
[
6,
105,
7
/* State.FI */
],
[
6,
73,
7
/* State.FI */
],
[
7,
108,
8
/* State.FIL */
],
[
7,
76,
8
/* State.FIL */
],
[
8,
101,
9
/* State.BeforeColon */
],
[
8,
69,
9
/* State.BeforeColon */
],
[
9,
58,
10
/* State.AfterColon */
],
[
10,
47,
11
/* State.AlmostThere */
],
[
11,
47,
12
/* State.End */
]
]);
}
return _stateMachine;
}
function getClassifier() {
if (_classifier === null) {
_classifier = new CharacterClassifier(
0
/* CharacterClass.None */
);
const FORCE_TERMINATION_CHARACTERS = ` <>'"\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 i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {
_classifier.set(
FORCE_TERMINATION_CHARACTERS.charCodeAt(i),
1
/* CharacterClass.ForceTermination */
);
}
const CANNOT_END_WITH_CHARACTERS = ".,;:";
for (let i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) {
_classifier.set(
CANNOT_END_WITH_CHARACTERS.charCodeAt(i),
2
/* CharacterClass.CannotEndIn */
);
}
}
return _classifier;
}
function computeLinks(model) {
if (!model || typeof model.getLineCount !== "function" || typeof model.getLineContent !== "function") {
return [];
}
return LinkComputer.computeLinks(model);
}
var Uint8Matrix, StateMachine, _stateMachine, _classifier, LinkComputer;
var init_linkComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/linkComputer.js"() {
init_characterClassifier();
Uint8Matrix = class {
constructor(rows, cols, defaultValue) {
const data = new Uint8Array(rows * cols);
for (let i = 0, len = rows * cols; i < len; i++) {
data[i] = defaultValue;
}
this._data = data;
this.rows = rows;
this.cols = cols;
}
get(row, col) {
return this._data[row * this.cols + col];
}
set(row, col, value) {
this._data[row * this.cols + col] = value;
}
};
StateMachine = class {
constructor(edges) {
let maxCharCode = 0;
let maxState = 0;
for (let i = 0, len = edges.length; i < len; i++) {
const [from, chCode, to] = edges[i];
if (chCode > maxCharCode) {
maxCharCode = chCode;
}
if (from > maxState) {
maxState = from;
}
if (to > maxState) {
maxState = to;
}
}
maxCharCode++;
maxState++;
const states = new Uint8Matrix(
maxState,
maxCharCode,
0
/* State.Invalid */
);
for (let i = 0, len = edges.length; i < len; i++) {
const [from, chCode, to] = edges[i];
states.set(from, chCode, to);
}
this._states = states;
this._maxCharCode = maxCharCode;
}
nextState(currentState, chCode) {
if (chCode < 0 || chCode >= this._maxCharCode) {
return 0;
}
return this._states.get(currentState, chCode);
}
};
_stateMachine = null;
_classifier = null;
LinkComputer = class _LinkComputer {
static _createLink(classifier, line, lineNumber, linkBeginIndex, linkEndIndex) {
let lastIncludedCharIndex = linkEndIndex - 1;
do {
const chCode = line.charCodeAt(lastIncludedCharIndex);
const chClass = classifier.get(chCode);
if (chClass !== 2) {
break;
}
lastIncludedCharIndex--;
} while (lastIncludedCharIndex > linkBeginIndex);
if (linkBeginIndex > 0) {
const charCodeBeforeLink = line.charCodeAt(linkBeginIndex - 1);
const lastCharCodeInLink = line.charCodeAt(lastIncludedCharIndex);
if (charCodeBeforeLink === 40 && lastCharCodeInLink === 41 || charCodeBeforeLink === 91 && lastCharCodeInLink === 93 || charCodeBeforeLink === 123 && lastCharCodeInLink === 125) {
lastIncludedCharIndex--;
}
}
return {
range: {
startLineNumber: lineNumber,
startColumn: linkBeginIndex + 1,
endLineNumber: lineNumber,
endColumn: lastIncludedCharIndex + 2
},
url: line.substring(linkBeginIndex, lastIncludedCharIndex + 1)
};
}
static computeLinks(model, stateMachine = getStateMachine()) {
const classifier = getClassifier();
const result = [];
for (let i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) {
const line = model.getLineContent(i);
const len = line.length;
let j = 0;
let linkBeginIndex = 0;
let linkBeginChCode = 0;
let state = 1;
let hasOpenParens = false;
let hasOpenSquareBracket = false;
let inSquareBrackets = false;
let hasOpenCurlyBracket = false;
while (j < len) {
let resetStateMachine = false;
const chCode = line.charCodeAt(j);
if (state === 13) {
let chClass;
switch (chCode) {
case 40:
hasOpenParens = true;
chClass = 0;
break;
case 41:
chClass = hasOpenParens ? 0 : 1;
break;
case 91:
inSquareBrackets = true;
hasOpenSquareBracket = true;
chClass = 0;
break;
case 93:
inSquareBrackets = false;
chClass = hasOpenSquareBracket ? 0 : 1;
break;
case 123:
hasOpenCurlyBracket = true;
chClass = 0;
break;
case 125:
chClass = hasOpenCurlyBracket ? 0 : 1;
break;
// The following three rules make it that ' or " or ` are allowed inside links
// only if the link is wrapped by some other quote character
case 39:
case 34:
case 96:
if (linkBeginChCode === chCode) {
chClass = 1;
} else if (linkBeginChCode === 39 || linkBeginChCode === 34 || linkBeginChCode === 96) {
chClass = 0;
} else {
chClass = 1;
}
break;
case 42:
chClass = linkBeginChCode === 42 ? 1 : 0;
break;
case 124:
chClass = linkBeginChCode === 124 ? 1 : 0;
break;
case 32:
chClass = inSquareBrackets ? 0 : 1;
break;
default:
chClass = classifier.get(chCode);
}
if (chClass === 1) {
result.push(_LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));
resetStateMachine = true;
}
} else if (state === 12) {
let chClass;
if (chCode === 91) {
hasOpenSquareBracket = true;
chClass = 0;
} else {
chClass = classifier.get(chCode);
}
if (chClass === 1) {
resetStateMachine = true;
} else {
state = 13;
}
} else {
state = stateMachine.nextState(state, chCode);
if (state === 0) {
resetStateMachine = true;
}
}
if (resetStateMachine) {
state = 1;
hasOpenParens = false;
hasOpenSquareBracket = false;
hasOpenCurlyBracket = false;
linkBeginIndex = j + 1;
linkBeginChCode = chCode;
}
j++;
}
if (state === 13) {
result.push(_LinkComputer._createLink(classifier, line, i, linkBeginIndex, len));
}
}
return result;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/inplaceReplaceSupport.js
var BasicInplaceReplace;
var init_inplaceReplaceSupport = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/inplaceReplaceSupport.js"() {
BasicInplaceReplace = class {
constructor() {
this._defaultValueSet = [
["true", "false"],
["True", "False"],
["Private", "Public", "Friend", "ReadOnly", "Partial", "Protected", "WriteOnly"],
["public", "protected", "private"]
];
}
navigateValueSet(range1, text1, range2, text2, up) {
if (range1 && text1) {
const result = this.doNavigateValueSet(text1, up);
if (result) {
return {
range: range1,
value: result
};
}
}
if (range2 && text2) {
const result = this.doNavigateValueSet(text2, up);
if (result) {
return {
range: range2,
value: result
};
}
}
return null;
}
doNavigateValueSet(text2, up) {
const numberResult = this.numberReplace(text2, up);
if (numberResult !== null) {
return numberResult;
}
return this.textReplace(text2, up);
}
numberReplace(value, up) {
const precision = Math.pow(10, value.length - (value.lastIndexOf(".") + 1));
let n1 = Number(value);
const n2 = parseFloat(value);
if (!isNaN(n1) && !isNaN(n2) && n1 === n2) {
if (n1 === 0 && !up) {
return null;
} else {
n1 = Math.floor(n1 * precision);
n1 += up ? precision : -precision;
return String(n1 / precision);
}
}
return null;
}
textReplace(value, up) {
return this.valueSetsReplace(this._defaultValueSet, value, up);
}
valueSetsReplace(valueSets, value, up) {
let result = null;
for (let i = 0, len = valueSets.length; result === null && i < len; i++) {
result = this.valueSetReplace(valueSets[i], value, up);
}
return result;
}
valueSetReplace(valueSet, value, up) {
let idx = valueSet.indexOf(value);
if (idx >= 0) {
idx += up ? 1 : -1;
if (idx < 0) {
idx = valueSet.length - 1;
} else {
idx %= valueSet.length;
}
return valueSet[idx];
}
return null;
}
};
BasicInplaceReplace.INSTANCE = new BasicInplaceReplace();
}
});
// node_modules/monaco-editor/esm/vs/base/common/map.js
function isEntries(arg) {
return Array.isArray(arg);
}
var _a3, _b2, ResourceMapEntry, ResourceMap, LinkedMap, Cache, LRUCache, BidirectionalMap, SetMap;
var init_map = __esm({
"node_modules/monaco-editor/esm/vs/base/common/map.js"() {
ResourceMapEntry = class {
constructor(uri, value) {
this.uri = uri;
this.value = value;
}
};
ResourceMap = class _ResourceMap {
constructor(arg, toKey) {
this[_a3] = "ResourceMap";
if (arg instanceof _ResourceMap) {
this.map = new Map(arg.map);
this.toKey = toKey !== null && toKey !== void 0 ? toKey : _ResourceMap.defaultToKey;
} else if (isEntries(arg)) {
this.map = /* @__PURE__ */ new Map();
this.toKey = toKey !== null && toKey !== void 0 ? toKey : _ResourceMap.defaultToKey;
for (const [resource, value] of arg) {
this.set(resource, value);
}
} else {
this.map = /* @__PURE__ */ new Map();
this.toKey = arg !== null && arg !== void 0 ? arg : _ResourceMap.defaultToKey;
}
}
set(resource, value) {
this.map.set(this.toKey(resource), new ResourceMapEntry(resource, value));
return this;
}
get(resource) {
var _c2;
return (_c2 = this.map.get(this.toKey(resource))) === null || _c2 === void 0 ? void 0 : _c2.value;
}
has(resource) {
return this.map.has(this.toKey(resource));
}
get size() {
return this.map.size;
}
clear() {
this.map.clear();
}
delete(resource) {
return this.map.delete(this.toKey(resource));
}
forEach(clb, thisArg) {
if (typeof thisArg !== "undefined") {
clb = clb.bind(thisArg);
}
for (const [_, entry] of this.map) {
clb(entry.value, entry.uri, this);
}
}
*values() {
for (const entry of this.map.values()) {
yield entry.value;
}
}
*keys() {
for (const entry of this.map.values()) {
yield entry.uri;
}
}
*entries() {
for (const entry of this.map.values()) {
yield [entry.uri, entry.value];
}
}
*[(_a3 = Symbol.toStringTag, Symbol.iterator)]() {
for (const [, entry] of this.map) {
yield [entry.uri, entry.value];
}
}
};
ResourceMap.defaultToKey = (resource) => resource.toString();
LinkedMap = class {
constructor() {
this[_b2] = "LinkedMap";
this._map = /* @__PURE__ */ 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 _c2;
return (_c2 = this._head) === null || _c2 === void 0 ? void 0 : _c2.value;
}
get last() {
var _c2;
return (_c2 = this._tail) === null || _c2 === void 0 ? void 0 : _c2.value;
}
has(key) {
return this._map.has(key);
}
get(key, touch = 0) {
const item = this._map.get(key);
if (!item) {
return void 0;
}
if (touch !== 0) {
this.touch(item, touch);
}
return item.value;
}
set(key, value, touch = 0) {
let item = this._map.get(key);
if (item) {
item.value = value;
if (touch !== 0) {
this.touch(item, touch);
}
} else {
item = { key, value, next: void 0, previous: void 0 };
switch (touch) {
case 0:
this.addItemLast(item);
break;
case 1:
this.addItemFirst(item);
break;
case 2:
this.addItemLast(item);
break;
default:
this.addItemLast(item);
break;
}
this._map.set(key, item);
this._size++;
}
return this;
}
delete(key) {
return !!this.remove(key);
}
remove(key) {
const item = this._map.get(key);
if (!item) {
return void 0;
}
this._map.delete(key);
this.removeItem(item);
this._size--;
return item.value;
}
shift() {
if (!this._head && !this._tail) {
return void 0;
}
if (!this._head || !this._tail) {
throw new Error("Invalid list");
}
const item = this._head;
this._map.delete(item.key);
this.removeItem(item);
this._size--;
return item.value;
}
forEach(callbackfn, thisArg) {
const state = this._state;
let current = this._head;
while (current) {
if (thisArg) {
callbackfn.bind(thisArg)(current.value, current.key, this);
} else {
callbackfn(current.value, current.key, this);
}
if (this._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
current = current.next;
}
}
keys() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: current.key, done: false };
current = current.next;
return result;
} else {
return { value: void 0, done: true };
}
}
};
return iterator;
}
values() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: current.value, done: false };
current = current.next;
return result;
} else {
return { value: void 0, done: true };
}
}
};
return iterator;
}
entries() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: [current.key, current.value], done: false };
current = current.next;
return result;
} else {
return { value: void 0, done: true };
}
}
};
return iterator;
}
[(_b2 = Symbol.toStringTag, Symbol.iterator)]() {
return this.entries();
}
trimOld(newSize) {
if (newSize >= this.size) {
return;
}
if (newSize === 0) {
this.clear();
return;
}
let current = this._head;
let currentSize = this.size;
while (current && currentSize > newSize) {
this._map.delete(current.key);
current = current.next;
currentSize--;
}
this._head = current;
this._size = currentSize;
if (current) {
current.previous = void 0;
}
this._state++;
}
trimNew(newSize) {
if (newSize >= this.size) {
return;
}
if (newSize === 0) {
this.clear();
return;
}
let current = this._tail;
let currentSize = this.size;
while (current && currentSize > newSize) {
this._map.delete(current.key);
current = current.previous;
currentSize--;
}
this._tail = current;
this._size = currentSize;
if (current) {
current.next = void 0;
}
this._state++;
}
addItemFirst(item) {
if (!this._head && !this._tail) {
this._tail = item;
} else if (!this._head) {
throw new Error("Invalid list");
} else {
item.next = this._head;
this._head.previous = item;
}
this._head = item;
this._state++;
}
addItemLast(item) {
if (!this._head && !this._tail) {
this._head = item;
} else if (!this._tail) {
throw new Error("Invalid list");
} else {
item.previous = this._tail;
this._tail.next = item;
}
this._tail = item;
this._state++;
}
removeItem(item) {
if (item === this._head && item === this._tail) {
this._head = void 0;
this._tail = void 0;
} else if (item === this._head) {
if (!item.next) {
throw new Error("Invalid list");
}
item.next.previous = void 0;
this._head = item.next;
} else if (item === this._tail) {
if (!item.previous) {
throw new Error("Invalid list");
}
item.previous.next = void 0;
this._tail = item.previous;
} else {
const next = item.next;
const previous = item.previous;
if (!next || !previous) {
throw new Error("Invalid list");
}
next.previous = previous;
previous.next = next;
}
item.next = void 0;
item.previous = void 0;
this._state++;
}
touch(item, touch) {
if (!this._head || !this._tail) {
throw new Error("Invalid list");
}
if (touch !== 1 && touch !== 2) {
return;
}
if (touch === 1) {
if (item === this._head) {
return;
}
const next = item.next;
const previous = item.previous;
if (item === this._tail) {
previous.next = void 0;
this._tail = previous;
} else {
next.previous = previous;
previous.next = next;
}
item.previous = void 0;
item.next = this._head;
this._head.previous = item;
this._head = item;
this._state++;
} else if (touch === 2) {
if (item === this._tail) {
return;
}
const next = item.next;
const previous = item.previous;
if (item === this._head) {
next.previous = void 0;
this._head = next;
} else {
next.previous = previous;
previous.next = next;
}
item.next = void 0;
item.previous = this._tail;
this._tail.next = item;
this._tail = item;
this._state++;
}
}
toJSON() {
const data = [];
this.forEach((value, key) => {
data.push([key, value]);
});
return data;
}
fromJSON(data) {
this.clear();
for (const [key, value] of data) {
this.set(key, value);
}
}
};
Cache = class extends LinkedMap {
constructor(limit, ratio = 1) {
super();
this._limit = limit;
this._ratio = Math.min(Math.max(0, ratio), 1);
}
get limit() {
return this._limit;
}
set limit(limit) {
this._limit = limit;
this.checkTrim();
}
get(key, touch = 2) {
return super.get(key, touch);
}
peek(key) {
return super.get(
key,
0
/* Touch.None */
);
}
set(key, value) {
super.set(
key,
value,
2
/* Touch.AsNew */
);
return this;
}
checkTrim() {
if (this.size > this._limit) {
this.trim(Math.round(this._limit * this._ratio));
}
}
};
LRUCache = class extends Cache {
constructor(limit, ratio = 1) {
super(limit, ratio);
}
trim(newSize) {
this.trimOld(newSize);
}
set(key, value) {
super.set(key, value);
this.checkTrim();
return this;
}
};
BidirectionalMap = class {
constructor(entries2) {
this._m1 = /* @__PURE__ */ new Map();
this._m2 = /* @__PURE__ */ new Map();
if (entries2) {
for (const [key, value] of entries2) {
this.set(key, value);
}
}
}
clear() {
this._m1.clear();
this._m2.clear();
}
set(key, value) {
this._m1.set(key, value);
this._m2.set(value, key);
}
get(key) {
return this._m1.get(key);
}
getKey(value) {
return this._m2.get(value);
}
delete(key) {
const value = this._m1.get(key);
if (value === void 0) {
return false;
}
this._m1.delete(key);
this._m2.delete(value);
return true;
}
keys() {
return this._m1.keys();
}
values() {
return this._m1.values();
}
};
SetMap = class {
constructor() {
this.map = /* @__PURE__ */ new Map();
}
add(key, value) {
let values2 = this.map.get(key);
if (!values2) {
values2 = /* @__PURE__ */ new Set();
this.map.set(key, values2);
}
values2.add(value);
}
delete(key, value) {
const values2 = this.map.get(key);
if (!values2) {
return;
}
values2.delete(value);
if (values2.size === 0) {
this.map.delete(key);
}
}
forEach(key, fn) {
const values2 = this.map.get(key);
if (!values2) {
return;
}
values2.forEach(fn);
}
get(key) {
const values2 = this.map.get(key);
if (!values2) {
return /* @__PURE__ */ new Set();
}
return values2;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/wordCharacterClassifier.js
function getMapForWordSeparators(wordSeparators2, intlSegmenterLocales) {
const key = `${wordSeparators2}/${intlSegmenterLocales.join(",")}`;
let result = wordClassifierCache.get(key);
if (!result) {
result = new WordCharacterClassifier(wordSeparators2, intlSegmenterLocales);
wordClassifierCache.set(key, result);
}
return result;
}
var WordCharacterClassifier, wordClassifierCache;
var init_wordCharacterClassifier = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/wordCharacterClassifier.js"() {
init_map();
init_characterClassifier();
WordCharacterClassifier = class extends CharacterClassifier {
constructor(wordSeparators2, intlSegmenterLocales) {
super(
0
/* WordCharacterClass.Regular */
);
this._segmenter = null;
this._cachedLine = null;
this._cachedSegments = [];
this.intlSegmenterLocales = intlSegmenterLocales;
if (this.intlSegmenterLocales.length > 0) {
this._segmenter = new Intl.Segmenter(this.intlSegmenterLocales, { granularity: "word" });
} else {
this._segmenter = null;
}
for (let i = 0, len = wordSeparators2.length; i < len; i++) {
this.set(
wordSeparators2.charCodeAt(i),
2
/* WordCharacterClass.WordSeparator */
);
}
this.set(
32,
1
/* WordCharacterClass.Whitespace */
);
this.set(
9,
1
/* WordCharacterClass.Whitespace */
);
}
findPrevIntlWordBeforeOrAtOffset(line, offset) {
let candidate = null;
for (const segment of this._getIntlSegmenterWordsOnLine(line)) {
if (segment.index > offset) {
break;
}
candidate = segment;
}
return candidate;
}
findNextIntlWordAtOrAfterOffset(lineContent, offset) {
for (const segment of this._getIntlSegmenterWordsOnLine(lineContent)) {
if (segment.index < offset) {
continue;
}
return segment;
}
return null;
}
_getIntlSegmenterWordsOnLine(line) {
if (!this._segmenter) {
return [];
}
if (this._cachedLine === line) {
return this._cachedSegments;
}
this._cachedLine = line;
this._cachedSegments = this._filterWordSegments(this._segmenter.segment(line));
return this._cachedSegments;
}
_filterWordSegments(segments) {
const result = [];
for (const segment of segments) {
if (this._isWordLike(segment)) {
result.push(segment);
}
}
return result;
}
_isWordLike(segment) {
if (segment.isWordLike) {
return true;
}
return false;
}
};
wordClassifierCache = new LRUCache(10);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model.js
function isITextSnapshot(obj) {
return obj && typeof obj.read === "function";
}
function shouldSynchronizeModel(model) {
return !model.isTooLargeForSyncing() && !model.isForSimpleWidget;
}
var OverviewRulerLane2, GlyphMarginLane2, InjectedTextCursorStops2, TextModelResolvedOptions, FindMatch, ValidAnnotatedEditOperation, SearchData, ApplyEditsResult;
var init_model2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model.js"() {
init_objects();
(function(OverviewRulerLane3) {
OverviewRulerLane3[OverviewRulerLane3["Left"] = 1] = "Left";
OverviewRulerLane3[OverviewRulerLane3["Center"] = 2] = "Center";
OverviewRulerLane3[OverviewRulerLane3["Right"] = 4] = "Right";
OverviewRulerLane3[OverviewRulerLane3["Full"] = 7] = "Full";
})(OverviewRulerLane2 || (OverviewRulerLane2 = {}));
(function(GlyphMarginLane3) {
GlyphMarginLane3[GlyphMarginLane3["Left"] = 1] = "Left";
GlyphMarginLane3[GlyphMarginLane3["Center"] = 2] = "Center";
GlyphMarginLane3[GlyphMarginLane3["Right"] = 3] = "Right";
})(GlyphMarginLane2 || (GlyphMarginLane2 = {}));
(function(InjectedTextCursorStops3) {
InjectedTextCursorStops3[InjectedTextCursorStops3["Both"] = 0] = "Both";
InjectedTextCursorStops3[InjectedTextCursorStops3["Right"] = 1] = "Right";
InjectedTextCursorStops3[InjectedTextCursorStops3["Left"] = 2] = "Left";
InjectedTextCursorStops3[InjectedTextCursorStops3["None"] = 3] = "None";
})(InjectedTextCursorStops2 || (InjectedTextCursorStops2 = {}));
TextModelResolvedOptions = class {
get originalIndentSize() {
return this._indentSizeIsTabSize ? "tabSize" : this.indentSize;
}
/**
* @internal
*/
constructor(src) {
this._textModelResolvedOptionsBrand = void 0;
this.tabSize = Math.max(1, src.tabSize | 0);
if (src.indentSize === "tabSize") {
this.indentSize = this.tabSize;
this._indentSizeIsTabSize = true;
} else {
this.indentSize = Math.max(1, src.indentSize | 0);
this._indentSizeIsTabSize = false;
}
this.insertSpaces = Boolean(src.insertSpaces);
this.defaultEOL = src.defaultEOL | 0;
this.trimAutoWhitespace = Boolean(src.trimAutoWhitespace);
this.bracketPairColorizationOptions = src.bracketPairColorizationOptions;
}
/**
* @internal
*/
equals(other) {
return this.tabSize === other.tabSize && this._indentSizeIsTabSize === other._indentSizeIsTabSize && this.indentSize === other.indentSize && this.insertSpaces === other.insertSpaces && this.defaultEOL === other.defaultEOL && this.trimAutoWhitespace === other.trimAutoWhitespace && equals2(this.bracketPairColorizationOptions, other.bracketPairColorizationOptions);
}
/**
* @internal
*/
createChangeEvent(newOpts) {
return {
tabSize: this.tabSize !== newOpts.tabSize,
indentSize: this.indentSize !== newOpts.indentSize,
insertSpaces: this.insertSpaces !== newOpts.insertSpaces,
trimAutoWhitespace: this.trimAutoWhitespace !== newOpts.trimAutoWhitespace
};
}
};
FindMatch = class {
/**
* @internal
*/
constructor(range2, matches2) {
this._findMatchBrand = void 0;
this.range = range2;
this.matches = matches2;
}
};
ValidAnnotatedEditOperation = class {
constructor(identifier3, range2, text2, forceMoveMarkers, isAutoWhitespaceEdit, _isTracked) {
this.identifier = identifier3;
this.range = range2;
this.text = text2;
this.forceMoveMarkers = forceMoveMarkers;
this.isAutoWhitespaceEdit = isAutoWhitespaceEdit;
this._isTracked = _isTracked;
}
};
SearchData = class {
constructor(regex, wordSeparators2, simpleSearch) {
this.regex = regex;
this.wordSeparators = wordSeparators2;
this.simpleSearch = simpleSearch;
}
};
ApplyEditsResult = class {
constructor(reverseEdits, changes, trimAutoWhitespaceLineNumbers) {
this.reverseEdits = reverseEdits;
this.changes = changes;
this.trimAutoWhitespaceLineNumbers = trimAutoWhitespaceLineNumbers;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/textModelSearch.js
function isMultilineRegexSource(searchString) {
if (!searchString || searchString.length === 0) {
return false;
}
for (let i = 0, len = searchString.length; i < len; i++) {
const chCode = searchString.charCodeAt(i);
if (chCode === 10) {
return true;
}
if (chCode === 92) {
i++;
if (i >= len) {
break;
}
const nextChCode = searchString.charCodeAt(i);
if (nextChCode === 110 || nextChCode === 114 || nextChCode === 87) {
return true;
}
}
}
return false;
}
function createFindMatch(range2, rawMatches, captureMatches) {
if (!captureMatches) {
return new FindMatch(range2, null);
}
const matches2 = [];
for (let i = 0, len = rawMatches.length; i < len; i++) {
matches2[i] = rawMatches[i];
}
return new FindMatch(range2, matches2);
}
function leftIsWordBounday(wordSeparators2, text2, textLength, matchStartIndex, matchLength) {
if (matchStartIndex === 0) {
return true;
}
const charBefore = text2.charCodeAt(matchStartIndex - 1);
if (wordSeparators2.get(charBefore) !== 0) {
return true;
}
if (charBefore === 13 || charBefore === 10) {
return true;
}
if (matchLength > 0) {
const firstCharInMatch = text2.charCodeAt(matchStartIndex);
if (wordSeparators2.get(firstCharInMatch) !== 0) {
return true;
}
}
return false;
}
function rightIsWordBounday(wordSeparators2, text2, textLength, matchStartIndex, matchLength) {
if (matchStartIndex + matchLength === textLength) {
return true;
}
const charAfter = text2.charCodeAt(matchStartIndex + matchLength);
if (wordSeparators2.get(charAfter) !== 0) {
return true;
}
if (charAfter === 13 || charAfter === 10) {
return true;
}
if (matchLength > 0) {
const lastCharInMatch = text2.charCodeAt(matchStartIndex + matchLength - 1);
if (wordSeparators2.get(lastCharInMatch) !== 0) {
return true;
}
}
return false;
}
function isValidMatch(wordSeparators2, text2, textLength, matchStartIndex, matchLength) {
return leftIsWordBounday(wordSeparators2, text2, textLength, matchStartIndex, matchLength) && rightIsWordBounday(wordSeparators2, text2, textLength, matchStartIndex, matchLength);
}
var LIMIT_FIND_COUNT, SearchParams, LineFeedCounter, TextModelSearch, Searcher;
var init_textModelSearch = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/textModelSearch.js"() {
init_strings();
init_wordCharacterClassifier();
init_position();
init_range();
init_model2();
LIMIT_FIND_COUNT = 999;
SearchParams = class {
constructor(searchString, isRegex, matchCase, wordSeparators2) {
this.searchString = searchString;
this.isRegex = isRegex;
this.matchCase = matchCase;
this.wordSeparators = wordSeparators2;
}
parseSearchRequest() {
if (this.searchString === "") {
return null;
}
let multiline;
if (this.isRegex) {
multiline = isMultilineRegexSource(this.searchString);
} else {
multiline = this.searchString.indexOf("\n") >= 0;
}
let regex = null;
try {
regex = createRegExp(this.searchString, this.isRegex, {
matchCase: this.matchCase,
wholeWord: false,
multiline,
global: true,
unicode: true
});
} catch (err) {
return null;
}
if (!regex) {
return null;
}
let canUseSimpleSearch = !this.isRegex && !multiline;
if (canUseSimpleSearch && this.searchString.toLowerCase() !== this.searchString.toUpperCase()) {
canUseSimpleSearch = this.matchCase;
}
return new SearchData(regex, this.wordSeparators ? getMapForWordSeparators(this.wordSeparators, []) : null, canUseSimpleSearch ? this.searchString : null);
}
};
LineFeedCounter = class {
constructor(text2) {
const lineFeedsOffsets = [];
let lineFeedsOffsetsLen = 0;
for (let i = 0, textLen = text2.length; i < textLen; i++) {
if (text2.charCodeAt(i) === 10) {
lineFeedsOffsets[lineFeedsOffsetsLen++] = i;
}
}
this._lineFeedsOffsets = lineFeedsOffsets;
}
findLineFeedCountBeforeOffset(offset) {
const lineFeedsOffsets = this._lineFeedsOffsets;
let min = 0;
let max = lineFeedsOffsets.length - 1;
if (max === -1) {
return 0;
}
if (offset <= lineFeedsOffsets[0]) {
return 0;
}
while (min < max) {
const mid = min + ((max - min) / 2 >> 0);
if (lineFeedsOffsets[mid] >= offset) {
max = mid - 1;
} else {
if (lineFeedsOffsets[mid + 1] >= offset) {
min = mid;
max = mid;
} else {
min = mid + 1;
}
}
}
return min + 1;
}
};
TextModelSearch = class {
static findMatches(model, searchParams, searchRange, captureMatches, limitResultCount) {
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return [];
}
if (searchData.regex.multiline) {
return this._doFindMatchesMultiline(model, searchRange, new Searcher(searchData.wordSeparators, searchData.regex), captureMatches, limitResultCount);
}
return this._doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount);
}
/**
* Multiline search always executes on the lines concatenated with \n.
* We must therefore compensate for the count of \n in case the model is CRLF
*/
static _getMultilineMatchRange(model, deltaOffset, text2, lfCounter, matchIndex, match0) {
let startOffset;
let lineFeedCountBeforeMatch = 0;
if (lfCounter) {
lineFeedCountBeforeMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex);
startOffset = deltaOffset + matchIndex + lineFeedCountBeforeMatch;
} else {
startOffset = deltaOffset + matchIndex;
}
let endOffset;
if (lfCounter) {
const lineFeedCountBeforeEndOfMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex + match0.length);
const lineFeedCountInMatch = lineFeedCountBeforeEndOfMatch - lineFeedCountBeforeMatch;
endOffset = startOffset + match0.length + lineFeedCountInMatch;
} else {
endOffset = startOffset + match0.length;
}
const startPosition = model.getPositionAt(startOffset);
const endPosition = model.getPositionAt(endOffset);
return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
}
static _doFindMatchesMultiline(model, searchRange, searcher, captureMatches, limitResultCount) {
const deltaOffset = model.getOffsetAt(searchRange.getStartPosition());
const text2 = model.getValueInRange(
searchRange,
1
/* EndOfLinePreference.LF */
);
const lfCounter = model.getEOL() === "\r\n" ? new LineFeedCounter(text2) : null;
const result = [];
let counter = 0;
let m;
searcher.reset(0);
while (m = searcher.next(text2)) {
result[counter++] = createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text2, lfCounter, m.index, m[0]), m, captureMatches);
if (counter >= limitResultCount) {
return result;
}
}
return result;
}
static _doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount) {
const result = [];
let resultLen = 0;
if (searchRange.startLineNumber === searchRange.endLineNumber) {
const text3 = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, text3, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);
return result;
}
const text2 = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1);
resultLen = this._findMatchesInLine(searchData, text2, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);
for (let lineNumber = searchRange.startLineNumber + 1; lineNumber < searchRange.endLineNumber && resultLen < limitResultCount; lineNumber++) {
resultLen = this._findMatchesInLine(searchData, model.getLineContent(lineNumber), lineNumber, 0, resultLen, result, captureMatches, limitResultCount);
}
if (resultLen < limitResultCount) {
const text3 = model.getLineContent(searchRange.endLineNumber).substring(0, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, text3, searchRange.endLineNumber, 0, resultLen, result, captureMatches, limitResultCount);
}
return result;
}
static _findMatchesInLine(searchData, text2, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {
const wordSeparators2 = searchData.wordSeparators;
if (!captureMatches && searchData.simpleSearch) {
const searchString = searchData.simpleSearch;
const searchStringLen = searchString.length;
const textLength = text2.length;
let lastMatchIndex = -searchStringLen;
while ((lastMatchIndex = text2.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {
if (!wordSeparators2 || isValidMatch(wordSeparators2, text2, textLength, lastMatchIndex, searchStringLen)) {
result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
}
return resultLen;
}
const searcher = new Searcher(searchData.wordSeparators, searchData.regex);
let m;
searcher.reset(0);
do {
m = searcher.next(text2);
if (m) {
result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
}
static findNextMatch(model, searchParams, searchStart, captureMatches) {
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
const searcher = new Searcher(searchData.wordSeparators, searchData.regex);
if (searchData.regex.multiline) {
return this._doFindNextMatchMultiline(model, searchStart, searcher, captureMatches);
}
return this._doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches);
}
static _doFindNextMatchMultiline(model, searchStart, searcher, captureMatches) {
const searchTextStart = new Position(searchStart.lineNumber, 1);
const deltaOffset = model.getOffsetAt(searchTextStart);
const lineCount = model.getLineCount();
const text2 = model.getValueInRange(
new Range(searchTextStart.lineNumber, searchTextStart.column, lineCount, model.getLineMaxColumn(lineCount)),
1
/* EndOfLinePreference.LF */
);
const lfCounter = model.getEOL() === "\r\n" ? new LineFeedCounter(text2) : null;
searcher.reset(searchStart.column - 1);
const m = searcher.next(text2);
if (m) {
return createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text2, lfCounter, m.index, m[0]), m, captureMatches);
}
if (searchStart.lineNumber !== 1 || searchStart.column !== 1) {
return this._doFindNextMatchMultiline(model, new Position(1, 1), searcher, captureMatches);
}
return null;
}
static _doFindNextMatchLineByLine(model, searchStart, searcher, captureMatches) {
const lineCount = model.getLineCount();
const startLineNumber = searchStart.lineNumber;
const text2 = model.getLineContent(startLineNumber);
const r = this._findFirstMatchInLine(searcher, text2, startLineNumber, searchStart.column, captureMatches);
if (r) {
return r;
}
for (let i = 1; i <= lineCount; i++) {
const lineIndex = (startLineNumber + i - 1) % lineCount;
const text3 = model.getLineContent(lineIndex + 1);
const r2 = this._findFirstMatchInLine(searcher, text3, lineIndex + 1, 1, captureMatches);
if (r2) {
return r2;
}
}
return null;
}
static _findFirstMatchInLine(searcher, text2, lineNumber, fromColumn, captureMatches) {
searcher.reset(fromColumn - 1);
const m = searcher.next(text2);
if (m) {
return createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);
}
return null;
}
static findPreviousMatch(model, searchParams, searchStart, captureMatches) {
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
const searcher = new Searcher(searchData.wordSeparators, searchData.regex);
if (searchData.regex.multiline) {
return this._doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches);
}
return this._doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches);
}
static _doFindPreviousMatchMultiline(model, searchStart, searcher, captureMatches) {
const matches2 = this._doFindMatchesMultiline(model, new Range(1, 1, searchStart.lineNumber, searchStart.column), searcher, captureMatches, 10 * LIMIT_FIND_COUNT);
if (matches2.length > 0) {
return matches2[matches2.length - 1];
}
const lineCount = model.getLineCount();
if (searchStart.lineNumber !== lineCount || searchStart.column !== model.getLineMaxColumn(lineCount)) {
return this._doFindPreviousMatchMultiline(model, new Position(lineCount, model.getLineMaxColumn(lineCount)), searcher, captureMatches);
}
return null;
}
static _doFindPreviousMatchLineByLine(model, searchStart, searcher, captureMatches) {
const lineCount = model.getLineCount();
const startLineNumber = searchStart.lineNumber;
const text2 = model.getLineContent(startLineNumber).substring(0, searchStart.column - 1);
const r = this._findLastMatchInLine(searcher, text2, startLineNumber, captureMatches);
if (r) {
return r;
}
for (let i = 1; i <= lineCount; i++) {
const lineIndex = (lineCount + startLineNumber - i - 1) % lineCount;
const text3 = model.getLineContent(lineIndex + 1);
const r2 = this._findLastMatchInLine(searcher, text3, lineIndex + 1, captureMatches);
if (r2) {
return r2;
}
}
return null;
}
static _findLastMatchInLine(searcher, text2, lineNumber, captureMatches) {
let bestResult = null;
let m;
searcher.reset(0);
while (m = searcher.next(text2)) {
bestResult = createFindMatch(new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);
}
return bestResult;
}
};
Searcher = class {
constructor(wordSeparators2, searchRegex) {
this._wordSeparators = wordSeparators2;
this._searchRegex = searchRegex;
this._prevMatchStartIndex = -1;
this._prevMatchLength = 0;
}
reset(lastIndex) {
this._searchRegex.lastIndex = lastIndex;
this._prevMatchStartIndex = -1;
this._prevMatchLength = 0;
}
next(text2) {
const textLength = text2.length;
let m;
do {
if (this._prevMatchStartIndex + this._prevMatchLength === textLength) {
return null;
}
m = this._searchRegex.exec(text2);
if (!m) {
return null;
}
const matchStartIndex = m.index;
const matchLength = m[0].length;
if (matchStartIndex === this._prevMatchStartIndex && matchLength === this._prevMatchLength) {
if (matchLength === 0) {
if (getNextCodePoint(text2, textLength, this._searchRegex.lastIndex) > 65535) {
this._searchRegex.lastIndex += 2;
} else {
this._searchRegex.lastIndex += 1;
}
continue;
}
return null;
}
this._prevMatchStartIndex = matchStartIndex;
this._prevMatchLength = matchLength;
if (!this._wordSeparators || isValidMatch(this._wordSeparators, text2, textLength, matchStartIndex, matchLength)) {
return m;
}
} while (m);
return null;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/unicodeTextModelHighlighter.js
function buildRegExpCharClassExpr(codePoints, flags) {
const src = `[${escapeRegExpCharacters(codePoints.map((i) => String.fromCodePoint(i)).join(""))}]`;
return src;
}
function isAllowedInvisibleCharacter(character) {
return character === " " || character === "\n" || character === " ";
}
var UnicodeTextModelHighlighter, CodePointHighlighter;
var init_unicodeTextModelHighlighter = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/unicodeTextModelHighlighter.js"() {
init_range();
init_textModelSearch();
init_strings();
init_assert();
init_wordHelper();
UnicodeTextModelHighlighter = class {
static computeUnicodeHighlights(model, options2, range2) {
const startLine = range2 ? range2.startLineNumber : 1;
const endLine = range2 ? range2.endLineNumber : model.getLineCount();
const codePointHighlighter = new CodePointHighlighter(options2);
const candidates = codePointHighlighter.getCandidateCodePoints();
let regex;
if (candidates === "allNonBasicAscii") {
regex = new RegExp("[^\\t\\n\\r\\x20-\\x7E]", "g");
} else {
regex = new RegExp(`${buildRegExpCharClassExpr(Array.from(candidates))}`, "g");
}
const searcher = new Searcher(null, regex);
const ranges = [];
let hasMore = false;
let m;
let ambiguousCharacterCount = 0;
let invisibleCharacterCount = 0;
let nonBasicAsciiCharacterCount = 0;
forLoop: for (let lineNumber = startLine, lineCount = endLine; lineNumber <= lineCount; lineNumber++) {
const lineContent = model.getLineContent(lineNumber);
const lineLength = lineContent.length;
searcher.reset(0);
do {
m = searcher.next(lineContent);
if (m) {
let startIndex = m.index;
let endIndex = m.index + m[0].length;
if (startIndex > 0) {
const charCodeBefore = lineContent.charCodeAt(startIndex - 1);
if (isHighSurrogate(charCodeBefore)) {
startIndex--;
}
}
if (endIndex + 1 < lineLength) {
const charCodeBefore = lineContent.charCodeAt(endIndex - 1);
if (isHighSurrogate(charCodeBefore)) {
endIndex++;
}
}
const str = lineContent.substring(startIndex, endIndex);
let word = getWordAtText(startIndex + 1, DEFAULT_WORD_REGEXP, lineContent, 0);
if (word && word.endColumn <= startIndex + 1) {
word = null;
}
const highlightReason = codePointHighlighter.shouldHighlightNonBasicASCII(str, word ? word.word : null);
if (highlightReason !== 0) {
if (highlightReason === 3) {
ambiguousCharacterCount++;
} else if (highlightReason === 2) {
invisibleCharacterCount++;
} else if (highlightReason === 1) {
nonBasicAsciiCharacterCount++;
} else {
assertNever(highlightReason);
}
const MAX_RESULT_LENGTH = 1e3;
if (ranges.length >= MAX_RESULT_LENGTH) {
hasMore = true;
break forLoop;
}
ranges.push(new Range(lineNumber, startIndex + 1, lineNumber, endIndex + 1));
}
}
} while (m);
}
return {
ranges,
hasMore,
ambiguousCharacterCount,
invisibleCharacterCount,
nonBasicAsciiCharacterCount
};
}
static computeUnicodeHighlightReason(char, options2) {
const codePointHighlighter = new CodePointHighlighter(options2);
const reason = codePointHighlighter.shouldHighlightNonBasicASCII(char, null);
switch (reason) {
case 0:
return null;
case 2:
return {
kind: 1
/* UnicodeHighlighterReasonKind.Invisible */
};
case 3: {
const codePoint = char.codePointAt(0);
const primaryConfusable = codePointHighlighter.ambiguousCharacters.getPrimaryConfusable(codePoint);
const notAmbiguousInLocales = AmbiguousCharacters.getLocales().filter((l) => !AmbiguousCharacters.getInstance(/* @__PURE__ */ new Set([...options2.allowedLocales, l])).isAmbiguous(codePoint));
return { kind: 0, confusableWith: String.fromCodePoint(primaryConfusable), notAmbiguousInLocales };
}
case 1:
return {
kind: 2
/* UnicodeHighlighterReasonKind.NonBasicAscii */
};
}
}
};
CodePointHighlighter = class {
constructor(options2) {
this.options = options2;
this.allowedCodePoints = new Set(options2.allowedCodePoints);
this.ambiguousCharacters = AmbiguousCharacters.getInstance(new Set(options2.allowedLocales));
}
getCandidateCodePoints() {
if (this.options.nonBasicASCII) {
return "allNonBasicAscii";
}
const set = /* @__PURE__ */ new Set();
if (this.options.invisibleCharacters) {
for (const cp of InvisibleCharacters.codePoints) {
if (!isAllowedInvisibleCharacter(String.fromCodePoint(cp))) {
set.add(cp);
}
}
}
if (this.options.ambiguousCharacters) {
for (const cp of this.ambiguousCharacters.getConfusableCodePoints()) {
set.add(cp);
}
}
for (const cp of this.allowedCodePoints) {
set.delete(cp);
}
return set;
}
shouldHighlightNonBasicASCII(character, wordContext) {
const codePoint = character.codePointAt(0);
if (this.allowedCodePoints.has(codePoint)) {
return 0;
}
if (this.options.nonBasicASCII) {
return 1;
}
let hasBasicASCIICharacters = false;
let hasNonConfusableNonBasicAsciiCharacter = false;
if (wordContext) {
for (const char of wordContext) {
const codePoint2 = char.codePointAt(0);
const isBasicASCII2 = isBasicASCII(char);
hasBasicASCIICharacters = hasBasicASCIICharacters || isBasicASCII2;
if (!isBasicASCII2 && !this.ambiguousCharacters.isAmbiguous(codePoint2) && !InvisibleCharacters.isInvisibleCharacter(codePoint2)) {
hasNonConfusableNonBasicAsciiCharacter = true;
}
}
}
if (
/* Don't allow mixing weird looking characters with ASCII */
!hasBasicASCIICharacters && /* Is there an obviously weird looking character? */
hasNonConfusableNonBasicAsciiCharacter
) {
return 0;
}
if (this.options.invisibleCharacters) {
if (!isAllowedInvisibleCharacter(character) && InvisibleCharacters.isInvisibleCharacter(codePoint)) {
return 2;
}
}
if (this.options.ambiguousCharacters) {
if (this.ambiguousCharacters.isAmbiguous(codePoint)) {
return 3;
}
}
return 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputer.js
var LinesDiff, MovedText;
var init_linesDiffComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputer.js"() {
LinesDiff = class {
constructor(changes, moves, hitTimeout) {
this.changes = changes;
this.moves = moves;
this.hitTimeout = hitTimeout;
}
};
MovedText = class {
constructor(lineRangeMapping, changes) {
this.lineRangeMapping = lineRangeMapping;
this.changes = changes;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/offsetRange.js
var OffsetRange, OffsetRangeSet;
var init_offsetRange = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/offsetRange.js"() {
init_errors();
OffsetRange = class _OffsetRange {
static addRange(range2, sortedRanges) {
let i = 0;
while (i < sortedRanges.length && sortedRanges[i].endExclusive < range2.start) {
i++;
}
let j = i;
while (j < sortedRanges.length && sortedRanges[j].start <= range2.endExclusive) {
j++;
}
if (i === j) {
sortedRanges.splice(i, 0, range2);
} else {
const start = Math.min(range2.start, sortedRanges[i].start);
const end = Math.max(range2.endExclusive, sortedRanges[j - 1].endExclusive);
sortedRanges.splice(i, j - i, new _OffsetRange(start, end));
}
}
static tryCreate(start, endExclusive) {
if (start > endExclusive) {
return void 0;
}
return new _OffsetRange(start, endExclusive);
}
static ofLength(length) {
return new _OffsetRange(0, length);
}
static ofStartAndLength(start, length) {
return new _OffsetRange(start, start + length);
}
constructor(start, endExclusive) {
this.start = start;
this.endExclusive = endExclusive;
if (start > endExclusive) {
throw new BugIndicatingError(`Invalid range: ${this.toString()}`);
}
}
get isEmpty() {
return this.start === this.endExclusive;
}
delta(offset) {
return new _OffsetRange(this.start + offset, this.endExclusive + offset);
}
deltaStart(offset) {
return new _OffsetRange(this.start + offset, this.endExclusive);
}
deltaEnd(offset) {
return new _OffsetRange(this.start, this.endExclusive + offset);
}
get length() {
return this.endExclusive - this.start;
}
toString() {
return `[${this.start}, ${this.endExclusive})`;
}
contains(offset) {
return this.start <= offset && offset < this.endExclusive;
}
/**
* for all numbers n: range1.contains(n) or range2.contains(n) => range1.join(range2).contains(n)
* The joined range is the smallest range that contains both ranges.
*/
join(other) {
return new _OffsetRange(Math.min(this.start, other.start), Math.max(this.endExclusive, other.endExclusive));
}
/**
* for all numbers n: range1.contains(n) and range2.contains(n) <=> range1.intersect(range2).contains(n)
*
* The resulting range is empty if the ranges do not intersect, but touch.
* If the ranges don't even touch, the result is undefined.
*/
intersect(other) {
const start = Math.max(this.start, other.start);
const end = Math.min(this.endExclusive, other.endExclusive);
if (start <= end) {
return new _OffsetRange(start, end);
}
return void 0;
}
intersects(other) {
const start = Math.max(this.start, other.start);
const end = Math.min(this.endExclusive, other.endExclusive);
return start < end;
}
isBefore(other) {
return this.endExclusive <= other.start;
}
isAfter(other) {
return this.start >= other.endExclusive;
}
slice(arr) {
return arr.slice(this.start, this.endExclusive);
}
substring(str) {
return str.substring(this.start, this.endExclusive);
}
/**
* Returns the given value if it is contained in this instance, otherwise the closest value that is contained.
* The range must not be empty.
*/
clip(value) {
if (this.isEmpty) {
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
}
return Math.max(this.start, Math.min(this.endExclusive - 1, value));
}
/**
* Returns `r := value + k * length` such that `r` is contained in this range.
* The range must not be empty.
*
* E.g. `[5, 10).clipCyclic(10) === 5`, `[5, 10).clipCyclic(11) === 6` and `[5, 10).clipCyclic(4) === 9`.
*/
clipCyclic(value) {
if (this.isEmpty) {
throw new BugIndicatingError(`Invalid clipping range: ${this.toString()}`);
}
if (value < this.start) {
return this.endExclusive - (this.start - value) % this.length;
}
if (value >= this.endExclusive) {
return this.start + (value - this.start) % this.length;
}
return value;
}
forEach(f3) {
for (let i = this.start; i < this.endExclusive; i++) {
f3(i);
}
}
};
OffsetRangeSet = class _OffsetRangeSet {
constructor() {
this._sortedRanges = [];
}
addRange(range2) {
let i = 0;
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive < range2.start) {
i++;
}
let j = i;
while (j < this._sortedRanges.length && this._sortedRanges[j].start <= range2.endExclusive) {
j++;
}
if (i === j) {
this._sortedRanges.splice(i, 0, range2);
} else {
const start = Math.min(range2.start, this._sortedRanges[i].start);
const end = Math.max(range2.endExclusive, this._sortedRanges[j - 1].endExclusive);
this._sortedRanges.splice(i, j - i, new OffsetRange(start, end));
}
}
toString() {
return this._sortedRanges.map((r) => r.toString()).join(", ");
}
/**
* Returns of there is a value that is contained in this instance and the given range.
*/
intersectsStrict(other) {
let i = 0;
while (i < this._sortedRanges.length && this._sortedRanges[i].endExclusive <= other.start) {
i++;
}
return i < this._sortedRanges.length && this._sortedRanges[i].start < other.endExclusive;
}
intersectWithRange(other) {
const result = new _OffsetRangeSet();
for (const range2 of this._sortedRanges) {
const intersection2 = range2.intersect(other);
if (intersection2) {
result.addRange(intersection2);
}
}
return result;
}
intersectWithRangeLength(other) {
return this.intersectWithRange(other).length;
}
get length() {
return this._sortedRanges.reduce((prev, cur) => prev + cur.length, 0);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/arraysFind.js
function findLast(array2, predicate) {
const idx = findLastIdx(array2, predicate);
if (idx === -1) {
return void 0;
}
return array2[idx];
}
function findLastIdx(array2, predicate, fromIndex = array2.length - 1) {
for (let i = fromIndex; i >= 0; i--) {
const element = array2[i];
if (predicate(element)) {
return i;
}
}
return -1;
}
function findLastMonotonous(array2, predicate) {
const idx = findLastIdxMonotonous(array2, predicate);
return idx === -1 ? void 0 : array2[idx];
}
function findLastIdxMonotonous(array2, predicate, startIdx = 0, endIdxEx = array2.length) {
let i = startIdx;
let j = endIdxEx;
while (i < j) {
const k = Math.floor((i + j) / 2);
if (predicate(array2[k])) {
i = k + 1;
} else {
j = k;
}
}
return i - 1;
}
function findFirstMonotonous(array2, predicate) {
const idx = findFirstIdxMonotonousOrArrLen(array2, predicate);
return idx === array2.length ? void 0 : array2[idx];
}
function findFirstIdxMonotonousOrArrLen(array2, predicate, startIdx = 0, endIdxEx = array2.length) {
let i = startIdx;
let j = endIdxEx;
while (i < j) {
const k = Math.floor((i + j) / 2);
if (predicate(array2[k])) {
j = k;
} else {
i = k + 1;
}
}
return i;
}
function findFirstMax(array2, comparator) {
if (array2.length === 0) {
return void 0;
}
let max = array2[0];
for (let i = 1; i < array2.length; i++) {
const item = array2[i];
if (comparator(item, max) > 0) {
max = item;
}
}
return max;
}
function findLastMax(array2, comparator) {
if (array2.length === 0) {
return void 0;
}
let max = array2[0];
for (let i = 1; i < array2.length; i++) {
const item = array2[i];
if (comparator(item, max) >= 0) {
max = item;
}
}
return max;
}
function findFirstMin(array2, comparator) {
return findFirstMax(array2, (a3, b) => -comparator(a3, b));
}
function findMaxIdx(array2, comparator) {
if (array2.length === 0) {
return -1;
}
let maxIdx = 0;
for (let i = 1; i < array2.length; i++) {
const item = array2[i];
if (comparator(item, array2[maxIdx]) > 0) {
maxIdx = i;
}
}
return maxIdx;
}
function mapFindFirst(items, mapFn) {
for (const value of items) {
const mapped = mapFn(value);
if (mapped !== void 0) {
return mapped;
}
}
return void 0;
}
var MonotonousArray;
var init_arraysFind = __esm({
"node_modules/monaco-editor/esm/vs/base/common/arraysFind.js"() {
MonotonousArray = class _MonotonousArray {
constructor(_array) {
this._array = _array;
this._findLastMonotonousLastIdx = 0;
}
/**
* The predicate must be monotonous, i.e. `arr.map(predicate)` must be like `[true, ..., true, false, ..., false]`!
* For subsequent calls, current predicate must be weaker than (or equal to) the previous predicate, i.e. more entries must be `true`.
*/
findLastMonotonous(predicate) {
if (_MonotonousArray.assertInvariants) {
if (this._prevFindLastPredicate) {
for (const item of this._array) {
if (this._prevFindLastPredicate(item) && !predicate(item)) {
throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");
}
}
}
this._prevFindLastPredicate = predicate;
}
const idx = findLastIdxMonotonous(this._array, predicate, this._findLastMonotonousLastIdx);
this._findLastMonotonousLastIdx = idx + 1;
return idx === -1 ? void 0 : this._array[idx];
}
};
MonotonousArray.assertInvariants = false;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/lineRange.js
var LineRange, LineRangeSet;
var init_lineRange = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/lineRange.js"() {
init_errors();
init_offsetRange();
init_range();
init_arraysFind();
LineRange = class _LineRange {
static fromRangeInclusive(range2) {
return new _LineRange(range2.startLineNumber, range2.endLineNumber + 1);
}
/**
* @param lineRanges An array of sorted line ranges.
*/
static joinMany(lineRanges) {
if (lineRanges.length === 0) {
return [];
}
let result = new LineRangeSet(lineRanges[0].slice());
for (let i = 1; i < lineRanges.length; i++) {
result = result.getUnion(new LineRangeSet(lineRanges[i].slice()));
}
return result.ranges;
}
static join(lineRanges) {
if (lineRanges.length === 0) {
throw new BugIndicatingError("lineRanges cannot be empty");
}
let startLineNumber = lineRanges[0].startLineNumber;
let endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;
for (let i = 1; i < lineRanges.length; i++) {
startLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);
endLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);
}
return new _LineRange(startLineNumber, endLineNumberExclusive);
}
static ofLength(startLineNumber, length) {
return new _LineRange(startLineNumber, startLineNumber + length);
}
/**
* @internal
*/
static deserialize(lineRange) {
return new _LineRange(lineRange[0], lineRange[1]);
}
constructor(startLineNumber, endLineNumberExclusive) {
if (startLineNumber > endLineNumberExclusive) {
throw new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);
}
this.startLineNumber = startLineNumber;
this.endLineNumberExclusive = endLineNumberExclusive;
}
/**
* Indicates if this line range contains the given line number.
*/
contains(lineNumber) {
return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;
}
/**
* Indicates if this line range is empty.
*/
get isEmpty() {
return this.startLineNumber === this.endLineNumberExclusive;
}
/**
* Moves this line range by the given offset of line numbers.
*/
delta(offset) {
return new _LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);
}
deltaLength(offset) {
return new _LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);
}
/**
* The number of lines this line range spans.
*/
get length() {
return this.endLineNumberExclusive - this.startLineNumber;
}
/**
* Creates a line range that combines this and the given line range.
*/
join(other) {
return new _LineRange(Math.min(this.startLineNumber, other.startLineNumber), Math.max(this.endLineNumberExclusive, other.endLineNumberExclusive));
}
toString() {
return `[${this.startLineNumber},${this.endLineNumberExclusive})`;
}
/**
* The resulting range is empty if the ranges do not intersect, but touch.
* If the ranges don't even touch, the result is undefined.
*/
intersect(other) {
const startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);
const endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);
if (startLineNumber <= endLineNumberExclusive) {
return new _LineRange(startLineNumber, endLineNumberExclusive);
}
return void 0;
}
intersectsStrict(other) {
return this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;
}
overlapOrTouch(other) {
return this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;
}
equals(b) {
return this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;
}
toInclusiveRange() {
if (this.isEmpty) {
return null;
}
return new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);
}
/**
* @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!
*/
toExclusiveRange() {
return new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);
}
mapToLineArray(f3) {
const result = [];
for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {
result.push(f3(lineNumber));
}
return result;
}
forEach(f3) {
for (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {
f3(lineNumber);
}
}
/**
* @internal
*/
serialize() {
return [this.startLineNumber, this.endLineNumberExclusive];
}
includes(lineNumber) {
return this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;
}
/**
* Converts this 1-based line range to a 0-based offset range (subtracts 1!).
* @internal
*/
toOffsetRange() {
return new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);
}
};
LineRangeSet = class _LineRangeSet {
constructor(_normalizedRanges = []) {
this._normalizedRanges = _normalizedRanges;
}
get ranges() {
return this._normalizedRanges;
}
addRange(range2) {
if (range2.length === 0) {
return;
}
const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, (r) => r.endLineNumberExclusive >= range2.startLineNumber);
const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= range2.endLineNumberExclusive) + 1;
if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
this._normalizedRanges.splice(joinRangeStartIdx, 0, range2);
} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {
const joinRange = this._normalizedRanges[joinRangeStartIdx];
this._normalizedRanges[joinRangeStartIdx] = joinRange.join(range2);
} else {
const joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range2);
this._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);
}
}
contains(lineNumber) {
const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= lineNumber);
return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;
}
intersects(range2) {
const rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, (r) => r.startLineNumber < range2.endLineNumberExclusive);
return !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range2.startLineNumber;
}
getUnion(other) {
if (this._normalizedRanges.length === 0) {
return other;
}
if (other._normalizedRanges.length === 0) {
return this;
}
const result = [];
let i1 = 0;
let i2 = 0;
let current = null;
while (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {
let next = null;
if (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {
const lineRange1 = this._normalizedRanges[i1];
const lineRange2 = other._normalizedRanges[i2];
if (lineRange1.startLineNumber < lineRange2.startLineNumber) {
next = lineRange1;
i1++;
} else {
next = lineRange2;
i2++;
}
} else if (i1 < this._normalizedRanges.length) {
next = this._normalizedRanges[i1];
i1++;
} else {
next = other._normalizedRanges[i2];
i2++;
}
if (current === null) {
current = next;
} else {
if (current.endLineNumberExclusive >= next.startLineNumber) {
current = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));
} else {
result.push(current);
current = next;
}
}
}
if (current !== null) {
result.push(current);
}
return new _LineRangeSet(result);
}
/**
* Subtracts all ranges in this set from `range` and returns the result.
*/
subtractFrom(range2) {
const joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, (r) => r.endLineNumberExclusive >= range2.startLineNumber);
const joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, (r) => r.startLineNumber <= range2.endLineNumberExclusive) + 1;
if (joinRangeStartIdx === joinRangeEndIdxExclusive) {
return new _LineRangeSet([range2]);
}
const result = [];
let startLineNumber = range2.startLineNumber;
for (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {
const r = this._normalizedRanges[i];
if (r.startLineNumber > startLineNumber) {
result.push(new LineRange(startLineNumber, r.startLineNumber));
}
startLineNumber = r.endLineNumberExclusive;
}
if (startLineNumber < range2.endLineNumberExclusive) {
result.push(new LineRange(startLineNumber, range2.endLineNumberExclusive));
}
return new _LineRangeSet(result);
}
toString() {
return this._normalizedRanges.map((r) => r.toString()).join(", ");
}
getIntersection(other) {
const result = [];
let i1 = 0;
let i2 = 0;
while (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {
const r1 = this._normalizedRanges[i1];
const r2 = other._normalizedRanges[i2];
const i = r1.intersect(r2);
if (i && !i.isEmpty) {
result.push(i);
}
if (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {
i1++;
} else {
i2++;
}
}
return new _LineRangeSet(result);
}
getWithDelta(value) {
return new _LineRangeSet(this._normalizedRanges.map((r) => r.delta(value)));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/textLength.js
var TextLength;
var init_textLength = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/textLength.js"() {
init_position();
init_range();
TextLength = class _TextLength {
static betweenPositions(position1, position2) {
if (position1.lineNumber === position2.lineNumber) {
return new _TextLength(0, position2.column - position1.column);
} else {
return new _TextLength(position2.lineNumber - position1.lineNumber, position2.column - 1);
}
}
static ofRange(range2) {
return _TextLength.betweenPositions(range2.getStartPosition(), range2.getEndPosition());
}
static ofText(text2) {
let line = 0;
let column = 0;
for (const c of text2) {
if (c === "\n") {
line++;
column = 0;
} else {
column++;
}
}
return new _TextLength(line, column);
}
constructor(lineCount, columnCount) {
this.lineCount = lineCount;
this.columnCount = columnCount;
}
isGreaterThanOrEqualTo(other) {
if (this.lineCount !== other.lineCount) {
return this.lineCount > other.lineCount;
}
return this.columnCount >= other.columnCount;
}
createRange(startPosition) {
if (this.lineCount === 0) {
return new Range(startPosition.lineNumber, startPosition.column, startPosition.lineNumber, startPosition.column + this.columnCount);
} else {
return new Range(startPosition.lineNumber, startPosition.column, startPosition.lineNumber + this.lineCount, this.columnCount + 1);
}
}
addToPosition(position) {
if (this.lineCount === 0) {
return new Position(position.lineNumber, position.column + this.columnCount);
} else {
return new Position(position.lineNumber + this.lineCount, this.columnCount + 1);
}
}
toString() {
return `${this.lineCount},${this.columnCount}`;
}
};
TextLength.zero = new TextLength(0, 0);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/positionToOffset.js
var PositionOffsetTransformer;
var init_positionToOffset = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/positionToOffset.js"() {
init_offsetRange();
init_textLength();
PositionOffsetTransformer = class {
constructor(text2) {
this.text = text2;
this.lineStartOffsetByLineIdx = [];
this.lineStartOffsetByLineIdx.push(0);
for (let i = 0; i < text2.length; i++) {
if (text2.charAt(i) === "\n") {
this.lineStartOffsetByLineIdx.push(i + 1);
}
}
}
getOffset(position) {
return this.lineStartOffsetByLineIdx[position.lineNumber - 1] + position.column - 1;
}
getOffsetRange(range2) {
return new OffsetRange(this.getOffset(range2.getStartPosition()), this.getOffset(range2.getEndPosition()));
}
get textLength() {
const lineIdx = this.lineStartOffsetByLineIdx.length - 1;
return new TextLength(lineIdx, this.text.length - this.lineStartOffsetByLineIdx[lineIdx]);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/textEdit.js
function rangeFromPositions(start, end) {
if (start.lineNumber === end.lineNumber && start.column === Number.MAX_SAFE_INTEGER) {
return Range.fromPositions(end, end);
} else if (!start.isBeforeOrEqual(end)) {
throw new BugIndicatingError("start must be before end");
}
return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
}
var TextEdit, SingleTextEdit, AbstractText, StringText;
var init_textEdit = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/textEdit.js"() {
init_assert();
init_errors();
init_position();
init_positionToOffset();
init_range();
init_textLength();
TextEdit = class {
constructor(edits) {
this.edits = edits;
assertFn(() => checkAdjacentItems(edits, (a3, b) => a3.range.getEndPosition().isBeforeOrEqual(b.range.getStartPosition())));
}
apply(text2) {
let result = "";
let lastEditEnd = new Position(1, 1);
for (const edit of this.edits) {
const editRange = edit.range;
const editStart = editRange.getStartPosition();
const editEnd = editRange.getEndPosition();
const r2 = rangeFromPositions(lastEditEnd, editStart);
if (!r2.isEmpty()) {
result += text2.getValueOfRange(r2);
}
result += edit.text;
lastEditEnd = editEnd;
}
const r = rangeFromPositions(lastEditEnd, text2.endPositionExclusive);
if (!r.isEmpty()) {
result += text2.getValueOfRange(r);
}
return result;
}
applyToString(str) {
const strText = new StringText(str);
return this.apply(strText);
}
getNewRanges() {
const newRanges = [];
let previousEditEndLineNumber = 0;
let lineOffset = 0;
let columnOffset = 0;
for (const edit of this.edits) {
const textLength = TextLength.ofText(edit.text);
const newRangeStart = Position.lift({
lineNumber: edit.range.startLineNumber + lineOffset,
column: edit.range.startColumn + (edit.range.startLineNumber === previousEditEndLineNumber ? columnOffset : 0)
});
const newRange = textLength.createRange(newRangeStart);
newRanges.push(newRange);
lineOffset = newRange.endLineNumber - edit.range.endLineNumber;
columnOffset = newRange.endColumn - edit.range.endColumn;
previousEditEndLineNumber = edit.range.endLineNumber;
}
return newRanges;
}
};
SingleTextEdit = class {
constructor(range2, text2) {
this.range = range2;
this.text = text2;
}
};
AbstractText = class {
get endPositionExclusive() {
return this.length.addToPosition(new Position(1, 1));
}
};
StringText = class extends AbstractText {
constructor(value) {
super();
this.value = value;
this._t = new PositionOffsetTransformer(this.value);
}
getValueOfRange(range2) {
return this._t.getOffsetRange(range2).substring(this.value);
}
get length() {
return this._t.textLength;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/rangeMapping.js
var LineRangeMapping, DetailedLineRangeMapping, RangeMapping;
var init_rangeMapping = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/rangeMapping.js"() {
init_errors();
init_lineRange();
init_range();
init_textEdit();
LineRangeMapping = class _LineRangeMapping {
static inverse(mapping, originalLineCount, modifiedLineCount) {
const result = [];
let lastOriginalEndLineNumber = 1;
let lastModifiedEndLineNumber = 1;
for (const m of mapping) {
const r2 = new _LineRangeMapping(new LineRange(lastOriginalEndLineNumber, m.original.startLineNumber), new LineRange(lastModifiedEndLineNumber, m.modified.startLineNumber));
if (!r2.modified.isEmpty) {
result.push(r2);
}
lastOriginalEndLineNumber = m.original.endLineNumberExclusive;
lastModifiedEndLineNumber = m.modified.endLineNumberExclusive;
}
const r = new _LineRangeMapping(new LineRange(lastOriginalEndLineNumber, originalLineCount + 1), new LineRange(lastModifiedEndLineNumber, modifiedLineCount + 1));
if (!r.modified.isEmpty) {
result.push(r);
}
return result;
}
static clip(mapping, originalRange, modifiedRange) {
const result = [];
for (const m of mapping) {
const original = m.original.intersect(originalRange);
const modified = m.modified.intersect(modifiedRange);
if (original && !original.isEmpty && modified && !modified.isEmpty) {
result.push(new _LineRangeMapping(original, modified));
}
}
return result;
}
constructor(originalRange, modifiedRange) {
this.original = originalRange;
this.modified = modifiedRange;
}
toString() {
return `{${this.original.toString()}->${this.modified.toString()}}`;
}
flip() {
return new _LineRangeMapping(this.modified, this.original);
}
join(other) {
return new _LineRangeMapping(this.original.join(other.original), this.modified.join(other.modified));
}
/**
* This method assumes that the LineRangeMapping describes a valid diff!
* I.e. if one range is empty, the other range cannot be the entire document.
* It avoids various problems when the line range points to non-existing line-numbers.
*/
toRangeMapping() {
const origInclusiveRange = this.original.toInclusiveRange();
const modInclusiveRange = this.modified.toInclusiveRange();
if (origInclusiveRange && modInclusiveRange) {
return new RangeMapping(origInclusiveRange, modInclusiveRange);
} else if (this.original.startLineNumber === 1 || this.modified.startLineNumber === 1) {
if (!(this.modified.startLineNumber === 1 && this.original.startLineNumber === 1)) {
throw new BugIndicatingError("not a valid diff");
}
return new RangeMapping(new Range(this.original.startLineNumber, 1, this.original.endLineNumberExclusive, 1), new Range(this.modified.startLineNumber, 1, this.modified.endLineNumberExclusive, 1));
} else {
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));
}
}
};
DetailedLineRangeMapping = class _DetailedLineRangeMapping extends LineRangeMapping {
static fromRangeMappings(rangeMappings) {
const originalRange = LineRange.join(rangeMappings.map((r) => LineRange.fromRangeInclusive(r.originalRange)));
const modifiedRange = LineRange.join(rangeMappings.map((r) => LineRange.fromRangeInclusive(r.modifiedRange)));
return new _DetailedLineRangeMapping(originalRange, modifiedRange, rangeMappings);
}
constructor(originalRange, modifiedRange, innerChanges) {
super(originalRange, modifiedRange);
this.innerChanges = innerChanges;
}
flip() {
var _a10;
return new _DetailedLineRangeMapping(this.modified, this.original, (_a10 = this.innerChanges) === null || _a10 === void 0 ? void 0 : _a10.map((c) => c.flip()));
}
withInnerChangesFromLineRanges() {
return new _DetailedLineRangeMapping(this.original, this.modified, [this.toRangeMapping()]);
}
};
RangeMapping = class _RangeMapping {
constructor(originalRange, modifiedRange) {
this.originalRange = originalRange;
this.modifiedRange = modifiedRange;
}
toString() {
return `{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`;
}
flip() {
return new _RangeMapping(this.modifiedRange, this.originalRange);
}
/**
* Creates a single text edit that describes the change from the original to the modified text.
*/
toTextEdit(modified) {
const newText = modified.getValueOfRange(this.modifiedRange);
return new SingleTextEdit(this.originalRange, newText);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/legacyLinesDiffComputer.js
function computeDiff(originalSequence, modifiedSequence, continueProcessingPredicate, pretty) {
const diffAlgo = new LcsDiff(originalSequence, modifiedSequence, continueProcessingPredicate);
return diffAlgo.ComputeDiff(pretty);
}
function postProcessCharChanges(rawChanges) {
if (rawChanges.length <= 1) {
return rawChanges;
}
const result = [rawChanges[0]];
let prevChange = result[0];
for (let i = 1, len = rawChanges.length; i < len; i++) {
const currChange = rawChanges[i];
const originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);
const modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);
const matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);
if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {
prevChange.originalLength = currChange.originalStart + currChange.originalLength - prevChange.originalStart;
prevChange.modifiedLength = currChange.modifiedStart + currChange.modifiedLength - prevChange.modifiedStart;
} else {
result.push(currChange);
prevChange = currChange;
}
}
return result;
}
function getFirstNonBlankColumn(txt, defaultValue) {
const r = firstNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 1;
}
function getLastNonBlankColumn(txt, defaultValue) {
const r = lastNonWhitespaceIndex(txt);
if (r === -1) {
return defaultValue;
}
return r + 2;
}
function createContinueProcessingPredicate(maximumRuntime) {
if (maximumRuntime === 0) {
return () => true;
}
const startTime = Date.now();
return () => {
return Date.now() - startTime < maximumRuntime;
};
}
var MINIMUM_MATCHING_CHARACTER_LENGTH, LegacyLinesDiffComputer, LineSequence, CharSequence, CharChange, LineChange, DiffComputer;
var init_legacyLinesDiffComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/legacyLinesDiffComputer.js"() {
init_diff();
init_linesDiffComputer();
init_rangeMapping();
init_strings();
init_range();
init_assert();
init_lineRange();
MINIMUM_MATCHING_CHARACTER_LENGTH = 3;
LegacyLinesDiffComputer = class {
computeDiff(originalLines, modifiedLines, options2) {
var _a10;
const diffComputer = new DiffComputer(originalLines, modifiedLines, {
maxComputationTime: options2.maxComputationTimeMs,
shouldIgnoreTrimWhitespace: options2.ignoreTrimWhitespace,
shouldComputeCharChanges: true,
shouldMakePrettyDiff: true,
shouldPostProcessCharChanges: true
});
const result = diffComputer.computeDiff();
const changes = [];
let lastChange = null;
for (const c of result.changes) {
let originalRange;
if (c.originalEndLineNumber === 0) {
originalRange = new LineRange(c.originalStartLineNumber + 1, c.originalStartLineNumber + 1);
} else {
originalRange = new LineRange(c.originalStartLineNumber, c.originalEndLineNumber + 1);
}
let modifiedRange;
if (c.modifiedEndLineNumber === 0) {
modifiedRange = new LineRange(c.modifiedStartLineNumber + 1, c.modifiedStartLineNumber + 1);
} else {
modifiedRange = new LineRange(c.modifiedStartLineNumber, c.modifiedEndLineNumber + 1);
}
let change = new DetailedLineRangeMapping(originalRange, modifiedRange, (_a10 = c.charChanges) === null || _a10 === void 0 ? void 0 : _a10.map((c2) => new RangeMapping(new Range(c2.originalStartLineNumber, c2.originalStartColumn, c2.originalEndLineNumber, c2.originalEndColumn), new Range(c2.modifiedStartLineNumber, c2.modifiedStartColumn, c2.modifiedEndLineNumber, c2.modifiedEndColumn))));
if (lastChange) {
if (lastChange.modified.endLineNumberExclusive === change.modified.startLineNumber || lastChange.original.endLineNumberExclusive === change.original.startLineNumber) {
change = new DetailedLineRangeMapping(lastChange.original.join(change.original), lastChange.modified.join(change.modified), lastChange.innerChanges && change.innerChanges ? lastChange.innerChanges.concat(change.innerChanges) : void 0);
changes.pop();
}
}
changes.push(change);
lastChange = change;
}
assertFn(() => {
return checkAdjacentItems(changes, (m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive && // There has to be an unchanged line in between (otherwise both diffs should have been joined)
m1.original.endLineNumberExclusive < m2.original.startLineNumber && m1.modified.endLineNumberExclusive < m2.modified.startLineNumber);
});
return new LinesDiff(changes, [], result.quitEarly);
}
};
LineSequence = class {
constructor(lines) {
const startColumns = [];
const endColumns = [];
for (let i = 0, length = lines.length; i < length; i++) {
startColumns[i] = getFirstNonBlankColumn(lines[i], 1);
endColumns[i] = getLastNonBlankColumn(lines[i], 1);
}
this.lines = lines;
this._startColumns = startColumns;
this._endColumns = endColumns;
}
getElements() {
const elements = [];
for (let i = 0, len = this.lines.length; i < len; i++) {
elements[i] = this.lines[i].substring(this._startColumns[i] - 1, this._endColumns[i] - 1);
}
return elements;
}
getStrictElement(index) {
return this.lines[index];
}
getStartLineNumber(i) {
return i + 1;
}
getEndLineNumber(i) {
return i + 1;
}
createCharSequence(shouldIgnoreTrimWhitespace, startIndex, endIndex) {
const charCodes = [];
const lineNumbers = [];
const columns = [];
let len = 0;
for (let index = startIndex; index <= endIndex; index++) {
const lineContent = this.lines[index];
const startColumn = shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1;
const endColumn = shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1;
for (let col = startColumn; col < endColumn; col++) {
charCodes[len] = lineContent.charCodeAt(col - 1);
lineNumbers[len] = index + 1;
columns[len] = col;
len++;
}
if (!shouldIgnoreTrimWhitespace && index < endIndex) {
charCodes[len] = 10;
lineNumbers[len] = index + 1;
columns[len] = lineContent.length + 1;
len++;
}
}
return new CharSequence(charCodes, lineNumbers, columns);
}
};
CharSequence = class {
constructor(charCodes, lineNumbers, columns) {
this._charCodes = charCodes;
this._lineNumbers = lineNumbers;
this._columns = columns;
}
toString() {
return "[" + this._charCodes.map((s, idx) => (s === 10 ? "\\n" : String.fromCharCode(s)) + `-(${this._lineNumbers[idx]},${this._columns[idx]})`).join(", ") + "]";
}
_assertIndex(index, arr) {
if (index < 0 || index >= arr.length) {
throw new Error(`Illegal index`);
}
}
getElements() {
return this._charCodes;
}
getStartLineNumber(i) {
if (i > 0 && i === this._lineNumbers.length) {
return this.getEndLineNumber(i - 1);
}
this._assertIndex(i, this._lineNumbers);
return this._lineNumbers[i];
}
getEndLineNumber(i) {
if (i === -1) {
return this.getStartLineNumber(i + 1);
}
this._assertIndex(i, this._lineNumbers);
if (this._charCodes[i] === 10) {
return this._lineNumbers[i] + 1;
}
return this._lineNumbers[i];
}
getStartColumn(i) {
if (i > 0 && i === this._columns.length) {
return this.getEndColumn(i - 1);
}
this._assertIndex(i, this._columns);
return this._columns[i];
}
getEndColumn(i) {
if (i === -1) {
return this.getStartColumn(i + 1);
}
this._assertIndex(i, this._columns);
if (this._charCodes[i] === 10) {
return 1;
}
return this._columns[i] + 1;
}
};
CharChange = class _CharChange {
constructor(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn) {
this.originalStartLineNumber = originalStartLineNumber;
this.originalStartColumn = originalStartColumn;
this.originalEndLineNumber = originalEndLineNumber;
this.originalEndColumn = originalEndColumn;
this.modifiedStartLineNumber = modifiedStartLineNumber;
this.modifiedStartColumn = modifiedStartColumn;
this.modifiedEndLineNumber = modifiedEndLineNumber;
this.modifiedEndColumn = modifiedEndColumn;
}
static createFromDiffChange(diffChange, originalCharSequence, modifiedCharSequence) {
const originalStartLineNumber = originalCharSequence.getStartLineNumber(diffChange.originalStart);
const originalStartColumn = originalCharSequence.getStartColumn(diffChange.originalStart);
const originalEndLineNumber = originalCharSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);
const originalEndColumn = originalCharSequence.getEndColumn(diffChange.originalStart + diffChange.originalLength - 1);
const modifiedStartLineNumber = modifiedCharSequence.getStartLineNumber(diffChange.modifiedStart);
const modifiedStartColumn = modifiedCharSequence.getStartColumn(diffChange.modifiedStart);
const modifiedEndLineNumber = modifiedCharSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);
const modifiedEndColumn = modifiedCharSequence.getEndColumn(diffChange.modifiedStart + diffChange.modifiedLength - 1);
return new _CharChange(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn);
}
};
LineChange = class _LineChange {
constructor(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges) {
this.originalStartLineNumber = originalStartLineNumber;
this.originalEndLineNumber = originalEndLineNumber;
this.modifiedStartLineNumber = modifiedStartLineNumber;
this.modifiedEndLineNumber = modifiedEndLineNumber;
this.charChanges = charChanges;
}
static createFromDiffResult(shouldIgnoreTrimWhitespace, diffChange, originalLineSequence, modifiedLineSequence, continueCharDiff, shouldComputeCharChanges, shouldPostProcessCharChanges) {
let originalStartLineNumber;
let originalEndLineNumber;
let modifiedStartLineNumber;
let modifiedEndLineNumber;
let charChanges = void 0;
if (diffChange.originalLength === 0) {
originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart) - 1;
originalEndLineNumber = 0;
} else {
originalStartLineNumber = originalLineSequence.getStartLineNumber(diffChange.originalStart);
originalEndLineNumber = originalLineSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);
}
if (diffChange.modifiedLength === 0) {
modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart) - 1;
modifiedEndLineNumber = 0;
} else {
modifiedStartLineNumber = modifiedLineSequence.getStartLineNumber(diffChange.modifiedStart);
modifiedEndLineNumber = modifiedLineSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);
}
if (shouldComputeCharChanges && diffChange.originalLength > 0 && diffChange.originalLength < 20 && diffChange.modifiedLength > 0 && diffChange.modifiedLength < 20 && continueCharDiff()) {
const originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);
const modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);
if (originalCharSequence.getElements().length > 0 && modifiedCharSequence.getElements().length > 0) {
let rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueCharDiff, true).changes;
if (shouldPostProcessCharChanges) {
rawChanges = postProcessCharChanges(rawChanges);
}
charChanges = [];
for (let i = 0, length = rawChanges.length; i < length; i++) {
charChanges.push(CharChange.createFromDiffChange(rawChanges[i], originalCharSequence, modifiedCharSequence));
}
}
}
return new _LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges);
}
};
DiffComputer = class {
constructor(originalLines, modifiedLines, opts) {
this.shouldComputeCharChanges = opts.shouldComputeCharChanges;
this.shouldPostProcessCharChanges = opts.shouldPostProcessCharChanges;
this.shouldIgnoreTrimWhitespace = opts.shouldIgnoreTrimWhitespace;
this.shouldMakePrettyDiff = opts.shouldMakePrettyDiff;
this.originalLines = originalLines;
this.modifiedLines = modifiedLines;
this.original = new LineSequence(originalLines);
this.modified = new LineSequence(modifiedLines);
this.continueLineDiff = createContinueProcessingPredicate(opts.maxComputationTime);
this.continueCharDiff = createContinueProcessingPredicate(opts.maxComputationTime === 0 ? 0 : Math.min(opts.maxComputationTime, 5e3));
}
computeDiff() {
if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
return {
quitEarly: false,
changes: []
};
}
return {
quitEarly: false,
changes: [{
originalStartLineNumber: 1,
originalEndLineNumber: 1,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: this.modified.lines.length,
charChanges: void 0
}]
};
}
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
return {
quitEarly: false,
changes: [{
originalStartLineNumber: 1,
originalEndLineNumber: this.original.lines.length,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: 1,
charChanges: void 0
}]
};
}
const diffResult = computeDiff(this.original, this.modified, this.continueLineDiff, this.shouldMakePrettyDiff);
const rawChanges = diffResult.changes;
const quitEarly = diffResult.quitEarly;
if (this.shouldIgnoreTrimWhitespace) {
const lineChanges = [];
for (let i = 0, length = rawChanges.length; i < length; i++) {
lineChanges.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, rawChanges[i], this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));
}
return {
quitEarly,
changes: lineChanges
};
}
const result = [];
let originalLineIndex = 0;
let modifiedLineIndex = 0;
for (let i = -1, len = rawChanges.length; i < len; i++) {
const nextChange = i + 1 < len ? rawChanges[i + 1] : null;
const originalStop = nextChange ? nextChange.originalStart : this.originalLines.length;
const modifiedStop = nextChange ? nextChange.modifiedStart : this.modifiedLines.length;
while (originalLineIndex < originalStop && modifiedLineIndex < modifiedStop) {
const originalLine = this.originalLines[originalLineIndex];
const modifiedLine = this.modifiedLines[modifiedLineIndex];
if (originalLine !== modifiedLine) {
{
let originalStartColumn = getFirstNonBlankColumn(originalLine, 1);
let modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);
while (originalStartColumn > 1 && modifiedStartColumn > 1) {
const originalChar = originalLine.charCodeAt(originalStartColumn - 2);
const modifiedChar = modifiedLine.charCodeAt(modifiedStartColumn - 2);
if (originalChar !== modifiedChar) {
break;
}
originalStartColumn--;
modifiedStartColumn--;
}
if (originalStartColumn > 1 || modifiedStartColumn > 1) {
this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, 1, originalStartColumn, modifiedLineIndex + 1, 1, modifiedStartColumn);
}
}
{
let originalEndColumn = getLastNonBlankColumn(originalLine, 1);
let modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);
const originalMaxColumn = originalLine.length + 1;
const modifiedMaxColumn = modifiedLine.length + 1;
while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {
const originalChar = originalLine.charCodeAt(originalEndColumn - 1);
const modifiedChar = originalLine.charCodeAt(modifiedEndColumn - 1);
if (originalChar !== modifiedChar) {
break;
}
originalEndColumn++;
modifiedEndColumn++;
}
if (originalEndColumn < originalMaxColumn || modifiedEndColumn < modifiedMaxColumn) {
this._pushTrimWhitespaceCharChange(result, originalLineIndex + 1, originalEndColumn, originalMaxColumn, modifiedLineIndex + 1, modifiedEndColumn, modifiedMaxColumn);
}
}
}
originalLineIndex++;
modifiedLineIndex++;
}
if (nextChange) {
result.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, nextChange, this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));
originalLineIndex += nextChange.originalLength;
modifiedLineIndex += nextChange.modifiedLength;
}
}
return {
quitEarly,
changes: result
};
}
_pushTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {
if (this._mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn)) {
return;
}
let charChanges = void 0;
if (this.shouldComputeCharChanges) {
charChanges = [new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn)];
}
result.push(new LineChange(originalLineNumber, originalLineNumber, modifiedLineNumber, modifiedLineNumber, charChanges));
}
_mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {
const len = result.length;
if (len === 0) {
return false;
}
const prevChange = result[len - 1];
if (prevChange.originalEndLineNumber === 0 || prevChange.modifiedEndLineNumber === 0) {
return false;
}
if (prevChange.originalEndLineNumber === originalLineNumber && prevChange.modifiedEndLineNumber === modifiedLineNumber) {
if (this.shouldComputeCharChanges && prevChange.charChanges) {
prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));
}
return true;
}
if (prevChange.originalEndLineNumber + 1 === originalLineNumber && prevChange.modifiedEndLineNumber + 1 === modifiedLineNumber) {
prevChange.originalEndLineNumber = originalLineNumber;
prevChange.modifiedEndLineNumber = modifiedLineNumber;
if (this.shouldComputeCharChanges && prevChange.charChanges) {
prevChange.charChanges.push(new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn));
}
return true;
}
return false;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js
var DiffAlgorithmResult, SequenceDiff, OffsetPair, InfiniteTimeout, DateTimeout;
var init_diffAlgorithm = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js"() {
init_arrays();
init_errors();
init_offsetRange();
DiffAlgorithmResult = class _DiffAlgorithmResult {
static trivial(seq1, seq2) {
return new _DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], false);
}
static trivialTimedOut(seq1, seq2) {
return new _DiffAlgorithmResult([new SequenceDiff(OffsetRange.ofLength(seq1.length), OffsetRange.ofLength(seq2.length))], true);
}
constructor(diffs, hitTimeout) {
this.diffs = diffs;
this.hitTimeout = hitTimeout;
}
};
SequenceDiff = class _SequenceDiff {
static invert(sequenceDiffs, doc1Length) {
const result = [];
forEachAdjacent(sequenceDiffs, (a3, b) => {
result.push(_SequenceDiff.fromOffsetPairs(a3 ? a3.getEndExclusives() : OffsetPair.zero, b ? b.getStarts() : new OffsetPair(doc1Length, (a3 ? a3.seq2Range.endExclusive - a3.seq1Range.endExclusive : 0) + doc1Length)));
});
return result;
}
static fromOffsetPairs(start, endExclusive) {
return new _SequenceDiff(new OffsetRange(start.offset1, endExclusive.offset1), new OffsetRange(start.offset2, endExclusive.offset2));
}
constructor(seq1Range, seq2Range) {
this.seq1Range = seq1Range;
this.seq2Range = seq2Range;
}
swap() {
return new _SequenceDiff(this.seq2Range, this.seq1Range);
}
toString() {
return `${this.seq1Range} <-> ${this.seq2Range}`;
}
join(other) {
return new _SequenceDiff(this.seq1Range.join(other.seq1Range), this.seq2Range.join(other.seq2Range));
}
delta(offset) {
if (offset === 0) {
return this;
}
return new _SequenceDiff(this.seq1Range.delta(offset), this.seq2Range.delta(offset));
}
deltaStart(offset) {
if (offset === 0) {
return this;
}
return new _SequenceDiff(this.seq1Range.deltaStart(offset), this.seq2Range.deltaStart(offset));
}
deltaEnd(offset) {
if (offset === 0) {
return this;
}
return new _SequenceDiff(this.seq1Range.deltaEnd(offset), this.seq2Range.deltaEnd(offset));
}
intersect(other) {
const i1 = this.seq1Range.intersect(other.seq1Range);
const i2 = this.seq2Range.intersect(other.seq2Range);
if (!i1 || !i2) {
return void 0;
}
return new _SequenceDiff(i1, i2);
}
getStarts() {
return new OffsetPair(this.seq1Range.start, this.seq2Range.start);
}
getEndExclusives() {
return new OffsetPair(this.seq1Range.endExclusive, this.seq2Range.endExclusive);
}
};
OffsetPair = class _OffsetPair {
constructor(offset1, offset2) {
this.offset1 = offset1;
this.offset2 = offset2;
}
toString() {
return `${this.offset1} <-> ${this.offset2}`;
}
delta(offset) {
if (offset === 0) {
return this;
}
return new _OffsetPair(this.offset1 + offset, this.offset2 + offset);
}
equals(other) {
return this.offset1 === other.offset1 && this.offset2 === other.offset2;
}
};
OffsetPair.zero = new OffsetPair(0, 0);
OffsetPair.max = new OffsetPair(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
InfiniteTimeout = class {
isValid() {
return true;
}
};
InfiniteTimeout.instance = new InfiniteTimeout();
DateTimeout = class {
constructor(timeout2) {
this.timeout = timeout2;
this.startTime = Date.now();
this.valid = true;
if (timeout2 <= 0) {
throw new BugIndicatingError("timeout must be positive");
}
}
// Recommendation: Set a log-point `{this.disable()}` in the body
isValid() {
const valid = Date.now() - this.startTime < this.timeout;
if (!valid && this.valid) {
this.valid = false;
debugger;
}
return this.valid;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/utils.js
function isSpace(charCode) {
return charCode === 32 || charCode === 9;
}
var Array2D, LineRangeFragment;
var init_utils = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/utils.js"() {
Array2D = class {
constructor(width2, height) {
this.width = width2;
this.height = height;
this.array = [];
this.array = new Array(width2 * height);
}
get(x, y) {
return this.array[x + y * this.width];
}
set(x, y, value) {
this.array[x + y * this.width] = value;
}
};
LineRangeFragment = class _LineRangeFragment {
static getKey(chr) {
let key = this.chrKeys.get(chr);
if (key === void 0) {
key = this.chrKeys.size;
this.chrKeys.set(chr, key);
}
return key;
}
constructor(range2, lines, source) {
this.range = range2;
this.lines = lines;
this.source = source;
this.histogram = [];
let counter = 0;
for (let i = range2.startLineNumber - 1; i < range2.endLineNumberExclusive - 1; i++) {
const line = lines[i];
for (let j = 0; j < line.length; j++) {
counter++;
const chr = line[j];
const key2 = _LineRangeFragment.getKey(chr);
this.histogram[key2] = (this.histogram[key2] || 0) + 1;
}
counter++;
const key = _LineRangeFragment.getKey("\n");
this.histogram[key] = (this.histogram[key] || 0) + 1;
}
this.totalCount = counter;
}
computeSimilarity(other) {
var _a10, _b4;
let sumDifferences = 0;
const maxLength = Math.max(this.histogram.length, other.histogram.length);
for (let i = 0; i < maxLength; i++) {
sumDifferences += Math.abs(((_a10 = this.histogram[i]) !== null && _a10 !== void 0 ? _a10 : 0) - ((_b4 = other.histogram[i]) !== null && _b4 !== void 0 ? _b4 : 0));
}
return 1 - sumDifferences / (this.totalCount + other.totalCount);
}
};
LineRangeFragment.chrKeys = /* @__PURE__ */ new Map();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js
var DynamicProgrammingDiffing;
var init_dynamicProgrammingDiffing = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js"() {
init_offsetRange();
init_diffAlgorithm();
init_utils();
DynamicProgrammingDiffing = class {
compute(sequence1, sequence2, timeout2 = InfiniteTimeout.instance, equalityScore) {
if (sequence1.length === 0 || sequence2.length === 0) {
return DiffAlgorithmResult.trivial(sequence1, sequence2);
}
const lcsLengths = new Array2D(sequence1.length, sequence2.length);
const directions = new Array2D(sequence1.length, sequence2.length);
const lengths = new Array2D(sequence1.length, sequence2.length);
for (let s12 = 0; s12 < sequence1.length; s12++) {
for (let s22 = 0; s22 < sequence2.length; s22++) {
if (!timeout2.isValid()) {
return DiffAlgorithmResult.trivialTimedOut(sequence1, sequence2);
}
const horizontalLen = s12 === 0 ? 0 : lcsLengths.get(s12 - 1, s22);
const verticalLen = s22 === 0 ? 0 : lcsLengths.get(s12, s22 - 1);
let extendedSeqScore;
if (sequence1.getElement(s12) === sequence2.getElement(s22)) {
if (s12 === 0 || s22 === 0) {
extendedSeqScore = 0;
} else {
extendedSeqScore = lcsLengths.get(s12 - 1, s22 - 1);
}
if (s12 > 0 && s22 > 0 && directions.get(s12 - 1, s22 - 1) === 3) {
extendedSeqScore += lengths.get(s12 - 1, s22 - 1);
}
extendedSeqScore += equalityScore ? equalityScore(s12, s22) : 1;
} else {
extendedSeqScore = -1;
}
const newValue = Math.max(horizontalLen, verticalLen, extendedSeqScore);
if (newValue === extendedSeqScore) {
const prevLen = s12 > 0 && s22 > 0 ? lengths.get(s12 - 1, s22 - 1) : 0;
lengths.set(s12, s22, prevLen + 1);
directions.set(s12, s22, 3);
} else if (newValue === horizontalLen) {
lengths.set(s12, s22, 0);
directions.set(s12, s22, 1);
} else if (newValue === verticalLen) {
lengths.set(s12, s22, 0);
directions.set(s12, s22, 2);
}
lcsLengths.set(s12, s22, newValue);
}
}
const result = [];
let lastAligningPosS1 = sequence1.length;
let lastAligningPosS2 = sequence2.length;
function reportDecreasingAligningPositions(s12, s22) {
if (s12 + 1 !== lastAligningPosS1 || s22 + 1 !== lastAligningPosS2) {
result.push(new SequenceDiff(new OffsetRange(s12 + 1, lastAligningPosS1), new OffsetRange(s22 + 1, lastAligningPosS2)));
}
lastAligningPosS1 = s12;
lastAligningPosS2 = s22;
}
let s1 = sequence1.length - 1;
let s2 = sequence2.length - 1;
while (s1 >= 0 && s2 >= 0) {
if (directions.get(s1, s2) === 3) {
reportDecreasingAligningPositions(s1, s2);
s1--;
s2--;
} else {
if (directions.get(s1, s2) === 1) {
s1--;
} else {
s2--;
}
}
}
reportDecreasingAligningPositions(-1, -1);
result.reverse();
return new DiffAlgorithmResult(result, false);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js
var MyersDiffAlgorithm, SnakePath, FastInt32Array, FastArrayNegativeIndices;
var init_myersDiffAlgorithm = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js"() {
init_offsetRange();
init_diffAlgorithm();
MyersDiffAlgorithm = class {
compute(seq1, seq2, timeout2 = InfiniteTimeout.instance) {
if (seq1.length === 0 || seq2.length === 0) {
return DiffAlgorithmResult.trivial(seq1, seq2);
}
const seqX = seq1;
const seqY = seq2;
function getXAfterSnake(x, y) {
while (x < seqX.length && y < seqY.length && seqX.getElement(x) === seqY.getElement(y)) {
x++;
y++;
}
return x;
}
let d = 0;
const V = new FastInt32Array();
V.set(0, getXAfterSnake(0, 0));
const paths = new FastArrayNegativeIndices();
paths.set(0, V.get(0) === 0 ? null : new SnakePath(null, 0, 0, V.get(0)));
let k = 0;
loop: while (true) {
d++;
if (!timeout2.isValid()) {
return DiffAlgorithmResult.trivialTimedOut(seqX, seqY);
}
const lowerBound = -Math.min(d, seqY.length + d % 2);
const upperBound = Math.min(d, seqX.length + d % 2);
for (k = lowerBound; k <= upperBound; k += 2) {
let step = 0;
const maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1);
const maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1;
step++;
const x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seqX.length);
const y = x - k;
step++;
if (x > seqX.length || y > seqY.length) {
continue;
}
const newMaxX = getXAfterSnake(x, y);
V.set(k, newMaxX);
const lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1);
paths.set(k, newMaxX !== x ? new SnakePath(lastPath, x, y, newMaxX - x) : lastPath);
if (V.get(k) === seqX.length && V.get(k) - k === seqY.length) {
break loop;
}
}
}
let path = paths.get(k);
const result = [];
let lastAligningPosS1 = seqX.length;
let lastAligningPosS2 = seqY.length;
while (true) {
const endX = path ? path.x + path.length : 0;
const endY = path ? path.y + path.length : 0;
if (endX !== lastAligningPosS1 || endY !== lastAligningPosS2) {
result.push(new SequenceDiff(new OffsetRange(endX, lastAligningPosS1), new OffsetRange(endY, lastAligningPosS2)));
}
if (!path) {
break;
}
lastAligningPosS1 = path.x;
lastAligningPosS2 = path.y;
path = path.prev;
}
result.reverse();
return new DiffAlgorithmResult(result, false);
}
};
SnakePath = class {
constructor(prev, x, y, length) {
this.prev = prev;
this.x = x;
this.y = y;
this.length = length;
}
};
FastInt32Array = class {
constructor() {
this.positiveArr = new Int32Array(10);
this.negativeArr = new Int32Array(10);
}
get(idx) {
if (idx < 0) {
idx = -idx - 1;
return this.negativeArr[idx];
} else {
return this.positiveArr[idx];
}
}
set(idx, value) {
if (idx < 0) {
idx = -idx - 1;
if (idx >= this.negativeArr.length) {
const arr = this.negativeArr;
this.negativeArr = new Int32Array(arr.length * 2);
this.negativeArr.set(arr);
}
this.negativeArr[idx] = value;
} else {
if (idx >= this.positiveArr.length) {
const arr = this.positiveArr;
this.positiveArr = new Int32Array(arr.length * 2);
this.positiveArr.set(arr);
}
this.positiveArr[idx] = value;
}
}
};
FastArrayNegativeIndices = class {
constructor() {
this.positiveArr = [];
this.negativeArr = [];
}
get(idx) {
if (idx < 0) {
idx = -idx - 1;
return this.negativeArr[idx];
} else {
return this.positiveArr[idx];
}
}
set(idx, value) {
if (idx < 0) {
idx = -idx - 1;
this.negativeArr[idx] = value;
} else {
this.positiveArr[idx] = value;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js
function isWordChar(charCode) {
return charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90 || charCode >= 48 && charCode <= 57;
}
function getCategoryBoundaryScore(category) {
return score[category];
}
function getCategory(charCode) {
if (charCode === 10) {
return 8;
} else if (charCode === 13) {
return 7;
} else if (isSpace(charCode)) {
return 6;
} else if (charCode >= 97 && charCode <= 122) {
return 0;
} else if (charCode >= 65 && charCode <= 90) {
return 1;
} else if (charCode >= 48 && charCode <= 57) {
return 2;
} else if (charCode === -1) {
return 3;
} else if (charCode === 44 || charCode === 59) {
return 5;
} else {
return 4;
}
}
var LinesSliceCharSequence, score;
var init_linesSliceCharSequence = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js"() {
init_arraysFind();
init_offsetRange();
init_position();
init_range();
init_utils();
LinesSliceCharSequence = class {
constructor(lines, lineRange, considerWhitespaceChanges) {
this.lines = lines;
this.considerWhitespaceChanges = considerWhitespaceChanges;
this.elements = [];
this.firstCharOffsetByLine = [];
this.additionalOffsetByLine = [];
let trimFirstLineFully = false;
if (lineRange.start > 0 && lineRange.endExclusive >= lines.length) {
lineRange = new OffsetRange(lineRange.start - 1, lineRange.endExclusive);
trimFirstLineFully = true;
}
this.lineRange = lineRange;
this.firstCharOffsetByLine[0] = 0;
for (let i = this.lineRange.start; i < this.lineRange.endExclusive; i++) {
let line = lines[i];
let offset = 0;
if (trimFirstLineFully) {
offset = line.length;
line = "";
trimFirstLineFully = false;
} else if (!considerWhitespaceChanges) {
const trimmedStartLine = line.trimStart();
offset = line.length - trimmedStartLine.length;
line = trimmedStartLine.trimEnd();
}
this.additionalOffsetByLine.push(offset);
for (let i2 = 0; i2 < line.length; i2++) {
this.elements.push(line.charCodeAt(i2));
}
if (i < lines.length - 1) {
this.elements.push("\n".charCodeAt(0));
this.firstCharOffsetByLine[i - this.lineRange.start + 1] = this.elements.length;
}
}
this.additionalOffsetByLine.push(0);
}
toString() {
return `Slice: "${this.text}"`;
}
get text() {
return this.getText(new OffsetRange(0, this.length));
}
getText(range2) {
return this.elements.slice(range2.start, range2.endExclusive).map((e) => String.fromCharCode(e)).join("");
}
getElement(offset) {
return this.elements[offset];
}
get length() {
return this.elements.length;
}
getBoundaryScore(length) {
const prevCategory = getCategory(length > 0 ? this.elements[length - 1] : -1);
const nextCategory = getCategory(length < this.elements.length ? this.elements[length] : -1);
if (prevCategory === 7 && nextCategory === 8) {
return 0;
}
if (prevCategory === 8) {
return 150;
}
let score3 = 0;
if (prevCategory !== nextCategory) {
score3 += 10;
if (prevCategory === 0 && nextCategory === 1) {
score3 += 1;
}
}
score3 += getCategoryBoundaryScore(prevCategory);
score3 += getCategoryBoundaryScore(nextCategory);
return score3;
}
translateOffset(offset) {
if (this.lineRange.isEmpty) {
return new Position(this.lineRange.start + 1, 1);
}
const i = findLastIdxMonotonous(this.firstCharOffsetByLine, (value) => value <= offset);
return new Position(this.lineRange.start + i + 1, offset - this.firstCharOffsetByLine[i] + this.additionalOffsetByLine[i] + 1);
}
translateRange(range2) {
return Range.fromPositions(this.translateOffset(range2.start), this.translateOffset(range2.endExclusive));
}
/**
* Finds the word that contains the character at the given offset
*/
findWordContaining(offset) {
if (offset < 0 || offset >= this.elements.length) {
return void 0;
}
if (!isWordChar(this.elements[offset])) {
return void 0;
}
let start = offset;
while (start > 0 && isWordChar(this.elements[start - 1])) {
start--;
}
let end = offset;
while (end < this.elements.length && isWordChar(this.elements[end])) {
end++;
}
return new OffsetRange(start, end);
}
countLinesIn(range2) {
return this.translateOffset(range2.endExclusive).lineNumber - this.translateOffset(range2.start).lineNumber;
}
isStronglyEqual(offset1, offset2) {
return this.elements[offset1] === this.elements[offset2];
}
extendToFullLines(range2) {
var _a10, _b4;
const start = (_a10 = findLastMonotonous(this.firstCharOffsetByLine, (x) => x <= range2.start)) !== null && _a10 !== void 0 ? _a10 : 0;
const end = (_b4 = findFirstMonotonous(this.firstCharOffsetByLine, (x) => range2.endExclusive <= x)) !== null && _b4 !== void 0 ? _b4 : this.elements.length;
return new OffsetRange(start, end);
}
};
score = {
[
0
/* CharBoundaryCategory.WordLower */
]: 0,
[
1
/* CharBoundaryCategory.WordUpper */
]: 0,
[
2
/* CharBoundaryCategory.WordNumber */
]: 0,
[
3
/* CharBoundaryCategory.End */
]: 10,
[
4
/* CharBoundaryCategory.Other */
]: 2,
[
5
/* CharBoundaryCategory.Separator */
]: 30,
[
6
/* CharBoundaryCategory.Space */
]: 3,
[
7
/* CharBoundaryCategory.LineBreakCR */
]: 10,
[
8
/* CharBoundaryCategory.LineBreakLF */
]: 10
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js
function computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout2) {
let { moves, excludedChanges } = computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout2);
if (!timeout2.isValid()) {
return [];
}
const filteredChanges = changes.filter((c) => !excludedChanges.has(c));
const unchangedMoves = computeUnchangedMoves(filteredChanges, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout2);
pushMany(moves, unchangedMoves);
moves = joinCloseConsecutiveMoves(moves);
moves = moves.filter((current) => {
const lines = current.original.toOffsetRange().slice(originalLines).map((l) => l.trim());
const originalText = lines.join("\n");
return originalText.length >= 15 && countWhere(lines, (l) => l.length >= 2) >= 2;
});
moves = removeMovesInSameDiff(changes, moves);
return moves;
}
function countWhere(arr, predicate) {
let count = 0;
for (const t4 of arr) {
if (predicate(t4)) {
count++;
}
}
return count;
}
function computeMovesFromSimpleDeletionsToSimpleInsertions(changes, originalLines, modifiedLines, timeout2) {
const moves = [];
const deletions = changes.filter((c) => c.modified.isEmpty && c.original.length >= 3).map((d) => new LineRangeFragment(d.original, originalLines, d));
const insertions = new Set(changes.filter((c) => c.original.isEmpty && c.modified.length >= 3).map((d) => new LineRangeFragment(d.modified, modifiedLines, d)));
const excludedChanges = /* @__PURE__ */ new Set();
for (const deletion of deletions) {
let highestSimilarity = -1;
let best;
for (const insertion of insertions) {
const similarity = deletion.computeSimilarity(insertion);
if (similarity > highestSimilarity) {
highestSimilarity = similarity;
best = insertion;
}
}
if (highestSimilarity > 0.9 && best) {
insertions.delete(best);
moves.push(new LineRangeMapping(deletion.range, best.range));
excludedChanges.add(deletion.source);
excludedChanges.add(best.source);
}
if (!timeout2.isValid()) {
return { moves, excludedChanges };
}
}
return { moves, excludedChanges };
}
function computeUnchangedMoves(changes, hashedOriginalLines, hashedModifiedLines, originalLines, modifiedLines, timeout2) {
const moves = [];
const original3LineHashes = new SetMap();
for (const change of changes) {
for (let i = change.original.startLineNumber; i < change.original.endLineNumberExclusive - 2; i++) {
const key = `${hashedOriginalLines[i - 1]}:${hashedOriginalLines[i + 1 - 1]}:${hashedOriginalLines[i + 2 - 1]}`;
original3LineHashes.add(key, { range: new LineRange(i, i + 3) });
}
}
const possibleMappings = [];
changes.sort(compareBy((c) => c.modified.startLineNumber, numberComparator));
for (const change of changes) {
let lastMappings = [];
for (let i = change.modified.startLineNumber; i < change.modified.endLineNumberExclusive - 2; i++) {
const key = `${hashedModifiedLines[i - 1]}:${hashedModifiedLines[i + 1 - 1]}:${hashedModifiedLines[i + 2 - 1]}`;
const currentModifiedRange = new LineRange(i, i + 3);
const nextMappings = [];
original3LineHashes.forEach(key, ({ range: range2 }) => {
for (const lastMapping of lastMappings) {
if (lastMapping.originalLineRange.endLineNumberExclusive + 1 === range2.endLineNumberExclusive && lastMapping.modifiedLineRange.endLineNumberExclusive + 1 === currentModifiedRange.endLineNumberExclusive) {
lastMapping.originalLineRange = new LineRange(lastMapping.originalLineRange.startLineNumber, range2.endLineNumberExclusive);
lastMapping.modifiedLineRange = new LineRange(lastMapping.modifiedLineRange.startLineNumber, currentModifiedRange.endLineNumberExclusive);
nextMappings.push(lastMapping);
return;
}
}
const mapping = {
modifiedLineRange: currentModifiedRange,
originalLineRange: range2
};
possibleMappings.push(mapping);
nextMappings.push(mapping);
});
lastMappings = nextMappings;
}
if (!timeout2.isValid()) {
return [];
}
}
possibleMappings.sort(reverseOrder(compareBy((m) => m.modifiedLineRange.length, numberComparator)));
const modifiedSet = new LineRangeSet();
const originalSet = new LineRangeSet();
for (const mapping of possibleMappings) {
const diffOrigToMod = mapping.modifiedLineRange.startLineNumber - mapping.originalLineRange.startLineNumber;
const modifiedSections = modifiedSet.subtractFrom(mapping.modifiedLineRange);
const originalTranslatedSections = originalSet.subtractFrom(mapping.originalLineRange).getWithDelta(diffOrigToMod);
const modifiedIntersectedSections = modifiedSections.getIntersection(originalTranslatedSections);
for (const s of modifiedIntersectedSections.ranges) {
if (s.length < 3) {
continue;
}
const modifiedLineRange = s;
const originalLineRange = s.delta(-diffOrigToMod);
moves.push(new LineRangeMapping(originalLineRange, modifiedLineRange));
modifiedSet.addRange(modifiedLineRange);
originalSet.addRange(originalLineRange);
}
}
moves.sort(compareBy((m) => m.original.startLineNumber, numberComparator));
const monotonousChanges = new MonotonousArray(changes);
for (let i = 0; i < moves.length; i++) {
const move = moves[i];
const firstTouchingChangeOrig = monotonousChanges.findLastMonotonous((c) => c.original.startLineNumber <= move.original.startLineNumber);
const firstTouchingChangeMod = findLastMonotonous(changes, (c) => c.modified.startLineNumber <= move.modified.startLineNumber);
const linesAbove = Math.max(move.original.startLineNumber - firstTouchingChangeOrig.original.startLineNumber, move.modified.startLineNumber - firstTouchingChangeMod.modified.startLineNumber);
const lastTouchingChangeOrig = monotonousChanges.findLastMonotonous((c) => c.original.startLineNumber < move.original.endLineNumberExclusive);
const lastTouchingChangeMod = findLastMonotonous(changes, (c) => c.modified.startLineNumber < move.modified.endLineNumberExclusive);
const linesBelow = Math.max(lastTouchingChangeOrig.original.endLineNumberExclusive - move.original.endLineNumberExclusive, lastTouchingChangeMod.modified.endLineNumberExclusive - move.modified.endLineNumberExclusive);
let extendToTop;
for (extendToTop = 0; extendToTop < linesAbove; extendToTop++) {
const origLine = move.original.startLineNumber - extendToTop - 1;
const modLine = move.modified.startLineNumber - extendToTop - 1;
if (origLine > originalLines.length || modLine > modifiedLines.length) {
break;
}
if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {
break;
}
if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout2)) {
break;
}
}
if (extendToTop > 0) {
originalSet.addRange(new LineRange(move.original.startLineNumber - extendToTop, move.original.startLineNumber));
modifiedSet.addRange(new LineRange(move.modified.startLineNumber - extendToTop, move.modified.startLineNumber));
}
let extendToBottom;
for (extendToBottom = 0; extendToBottom < linesBelow; extendToBottom++) {
const origLine = move.original.endLineNumberExclusive + extendToBottom;
const modLine = move.modified.endLineNumberExclusive + extendToBottom;
if (origLine > originalLines.length || modLine > modifiedLines.length) {
break;
}
if (modifiedSet.contains(modLine) || originalSet.contains(origLine)) {
break;
}
if (!areLinesSimilar(originalLines[origLine - 1], modifiedLines[modLine - 1], timeout2)) {
break;
}
}
if (extendToBottom > 0) {
originalSet.addRange(new LineRange(move.original.endLineNumberExclusive, move.original.endLineNumberExclusive + extendToBottom));
modifiedSet.addRange(new LineRange(move.modified.endLineNumberExclusive, move.modified.endLineNumberExclusive + extendToBottom));
}
if (extendToTop > 0 || extendToBottom > 0) {
moves[i] = new LineRangeMapping(new LineRange(move.original.startLineNumber - extendToTop, move.original.endLineNumberExclusive + extendToBottom), new LineRange(move.modified.startLineNumber - extendToTop, move.modified.endLineNumberExclusive + extendToBottom));
}
}
return moves;
}
function areLinesSimilar(line1, line2, timeout2) {
if (line1.trim() === line2.trim()) {
return true;
}
if (line1.length > 300 && line2.length > 300) {
return false;
}
const myersDiffingAlgorithm = new MyersDiffAlgorithm();
const result = myersDiffingAlgorithm.compute(new LinesSliceCharSequence([line1], new OffsetRange(0, 1), false), new LinesSliceCharSequence([line2], new OffsetRange(0, 1), false), timeout2);
let commonNonSpaceCharCount = 0;
const inverted = SequenceDiff.invert(result.diffs, line1.length);
for (const seq of inverted) {
seq.seq1Range.forEach((idx) => {
if (!isSpace(line1.charCodeAt(idx))) {
commonNonSpaceCharCount++;
}
});
}
function countNonWsChars(str) {
let count = 0;
for (let i = 0; i < line1.length; i++) {
if (!isSpace(str.charCodeAt(i))) {
count++;
}
}
return count;
}
const longerLineLength = countNonWsChars(line1.length > line2.length ? line1 : line2);
const r = commonNonSpaceCharCount / longerLineLength > 0.6 && longerLineLength > 10;
return r;
}
function joinCloseConsecutiveMoves(moves) {
if (moves.length === 0) {
return moves;
}
moves.sort(compareBy((m) => m.original.startLineNumber, numberComparator));
const result = [moves[0]];
for (let i = 1; i < moves.length; i++) {
const last = result[result.length - 1];
const current = moves[i];
const originalDist = current.original.startLineNumber - last.original.endLineNumberExclusive;
const modifiedDist = current.modified.startLineNumber - last.modified.endLineNumberExclusive;
const currentMoveAfterLast = originalDist >= 0 && modifiedDist >= 0;
if (currentMoveAfterLast && originalDist + modifiedDist <= 2) {
result[result.length - 1] = last.join(current);
continue;
}
result.push(current);
}
return result;
}
function removeMovesInSameDiff(changes, moves) {
const changesMonotonous = new MonotonousArray(changes);
moves = moves.filter((m) => {
const diffBeforeEndOfMoveOriginal = changesMonotonous.findLastMonotonous((c) => c.original.startLineNumber < m.original.endLineNumberExclusive) || new LineRangeMapping(new LineRange(1, 1), new LineRange(1, 1));
const diffBeforeEndOfMoveModified = findLastMonotonous(changes, (c) => c.modified.startLineNumber < m.modified.endLineNumberExclusive);
const differentDiffs = diffBeforeEndOfMoveOriginal !== diffBeforeEndOfMoveModified;
return differentDiffs;
});
return moves;
}
var init_computeMovedLines = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js"() {
init_diffAlgorithm();
init_rangeMapping();
init_arrays();
init_arraysFind();
init_map();
init_lineRange();
init_offsetRange();
init_linesSliceCharSequence();
init_utils();
init_myersDiffAlgorithm();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js
function optimizeSequenceDiffs(sequence1, sequence2, sequenceDiffs) {
let result = sequenceDiffs;
result = joinSequenceDiffsByShifting(sequence1, sequence2, result);
result = joinSequenceDiffsByShifting(sequence1, sequence2, result);
result = shiftSequenceDiffs(sequence1, sequence2, result);
return result;
}
function joinSequenceDiffsByShifting(sequence1, sequence2, sequenceDiffs) {
if (sequenceDiffs.length === 0) {
return sequenceDiffs;
}
const result = [];
result.push(sequenceDiffs[0]);
for (let i = 1; i < sequenceDiffs.length; i++) {
const prevResult = result[result.length - 1];
let cur = sequenceDiffs[i];
if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {
const length = cur.seq1Range.start - prevResult.seq1Range.endExclusive;
let d;
for (d = 1; d <= length; d++) {
if (sequence1.getElement(cur.seq1Range.start - d) !== sequence1.getElement(cur.seq1Range.endExclusive - d) || sequence2.getElement(cur.seq2Range.start - d) !== sequence2.getElement(cur.seq2Range.endExclusive - d)) {
break;
}
}
d--;
if (d === length) {
result[result.length - 1] = new SequenceDiff(new OffsetRange(prevResult.seq1Range.start, cur.seq1Range.endExclusive - length), new OffsetRange(prevResult.seq2Range.start, cur.seq2Range.endExclusive - length));
continue;
}
cur = cur.delta(-d);
}
result.push(cur);
}
const result2 = [];
for (let i = 0; i < result.length - 1; i++) {
const nextResult = result[i + 1];
let cur = result[i];
if (cur.seq1Range.isEmpty || cur.seq2Range.isEmpty) {
const length = nextResult.seq1Range.start - cur.seq1Range.endExclusive;
let d;
for (d = 0; d < length; d++) {
if (!sequence1.isStronglyEqual(cur.seq1Range.start + d, cur.seq1Range.endExclusive + d) || !sequence2.isStronglyEqual(cur.seq2Range.start + d, cur.seq2Range.endExclusive + d)) {
break;
}
}
if (d === length) {
result[i + 1] = new SequenceDiff(new OffsetRange(cur.seq1Range.start + length, nextResult.seq1Range.endExclusive), new OffsetRange(cur.seq2Range.start + length, nextResult.seq2Range.endExclusive));
continue;
}
if (d > 0) {
cur = cur.delta(d);
}
}
result2.push(cur);
}
if (result.length > 0) {
result2.push(result[result.length - 1]);
}
return result2;
}
function shiftSequenceDiffs(sequence1, sequence2, sequenceDiffs) {
if (!sequence1.getBoundaryScore || !sequence2.getBoundaryScore) {
return sequenceDiffs;
}
for (let i = 0; i < sequenceDiffs.length; i++) {
const prevDiff = i > 0 ? sequenceDiffs[i - 1] : void 0;
const diff = sequenceDiffs[i];
const nextDiff = i + 1 < sequenceDiffs.length ? sequenceDiffs[i + 1] : void 0;
const seq1ValidRange = new OffsetRange(prevDiff ? prevDiff.seq1Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq1Range.start - 1 : sequence1.length);
const seq2ValidRange = new OffsetRange(prevDiff ? prevDiff.seq2Range.endExclusive + 1 : 0, nextDiff ? nextDiff.seq2Range.start - 1 : sequence2.length);
if (diff.seq1Range.isEmpty) {
sequenceDiffs[i] = shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange);
} else if (diff.seq2Range.isEmpty) {
sequenceDiffs[i] = shiftDiffToBetterPosition(diff.swap(), sequence2, sequence1, seq2ValidRange, seq1ValidRange).swap();
}
}
return sequenceDiffs;
}
function shiftDiffToBetterPosition(diff, sequence1, sequence2, seq1ValidRange, seq2ValidRange) {
const maxShiftLimit = 100;
let deltaBefore = 1;
while (diff.seq1Range.start - deltaBefore >= seq1ValidRange.start && diff.seq2Range.start - deltaBefore >= seq2ValidRange.start && sequence2.isStronglyEqual(diff.seq2Range.start - deltaBefore, diff.seq2Range.endExclusive - deltaBefore) && deltaBefore < maxShiftLimit) {
deltaBefore++;
}
deltaBefore--;
let deltaAfter = 0;
while (diff.seq1Range.start + deltaAfter < seq1ValidRange.endExclusive && diff.seq2Range.endExclusive + deltaAfter < seq2ValidRange.endExclusive && sequence2.isStronglyEqual(diff.seq2Range.start + deltaAfter, diff.seq2Range.endExclusive + deltaAfter) && deltaAfter < maxShiftLimit) {
deltaAfter++;
}
if (deltaBefore === 0 && deltaAfter === 0) {
return diff;
}
let bestDelta = 0;
let bestScore = -1;
for (let delta = -deltaBefore; delta <= deltaAfter; delta++) {
const seq2OffsetStart = diff.seq2Range.start + delta;
const seq2OffsetEndExclusive = diff.seq2Range.endExclusive + delta;
const seq1Offset = diff.seq1Range.start + delta;
const score3 = sequence1.getBoundaryScore(seq1Offset) + sequence2.getBoundaryScore(seq2OffsetStart) + sequence2.getBoundaryScore(seq2OffsetEndExclusive);
if (score3 > bestScore) {
bestScore = score3;
bestDelta = delta;
}
}
return diff.delta(bestDelta);
}
function removeShortMatches(sequence1, sequence2, sequenceDiffs) {
const result = [];
for (const s of sequenceDiffs) {
const last = result[result.length - 1];
if (!last) {
result.push(s);
continue;
}
if (s.seq1Range.start - last.seq1Range.endExclusive <= 2 || s.seq2Range.start - last.seq2Range.endExclusive <= 2) {
result[result.length - 1] = new SequenceDiff(last.seq1Range.join(s.seq1Range), last.seq2Range.join(s.seq2Range));
} else {
result.push(s);
}
}
return result;
}
function extendDiffsToEntireWordIfAppropriate(sequence1, sequence2, sequenceDiffs) {
const equalMappings = SequenceDiff.invert(sequenceDiffs, sequence1.length);
const additional = [];
let lastPoint = new OffsetPair(0, 0);
function scanWord(pair, equalMapping) {
if (pair.offset1 < lastPoint.offset1 || pair.offset2 < lastPoint.offset2) {
return;
}
const w1 = sequence1.findWordContaining(pair.offset1);
const w2 = sequence2.findWordContaining(pair.offset2);
if (!w1 || !w2) {
return;
}
let w = new SequenceDiff(w1, w2);
const equalPart = w.intersect(equalMapping);
let equalChars1 = equalPart.seq1Range.length;
let equalChars2 = equalPart.seq2Range.length;
while (equalMappings.length > 0) {
const next = equalMappings[0];
const intersects2 = next.seq1Range.intersects(w.seq1Range) || next.seq2Range.intersects(w.seq2Range);
if (!intersects2) {
break;
}
const v1 = sequence1.findWordContaining(next.seq1Range.start);
const v2 = sequence2.findWordContaining(next.seq2Range.start);
const v = new SequenceDiff(v1, v2);
const equalPart2 = v.intersect(next);
equalChars1 += equalPart2.seq1Range.length;
equalChars2 += equalPart2.seq2Range.length;
w = w.join(v);
if (w.seq1Range.endExclusive >= next.seq1Range.endExclusive) {
equalMappings.shift();
} else {
break;
}
}
if (equalChars1 + equalChars2 < (w.seq1Range.length + w.seq2Range.length) * 2 / 3) {
additional.push(w);
}
lastPoint = w.getEndExclusives();
}
while (equalMappings.length > 0) {
const next = equalMappings.shift();
if (next.seq1Range.isEmpty) {
continue;
}
scanWord(next.getStarts(), next);
scanWord(next.getEndExclusives().delta(-1), next);
}
const merged = mergeSequenceDiffs(sequenceDiffs, additional);
return merged;
}
function mergeSequenceDiffs(sequenceDiffs1, sequenceDiffs2) {
const result = [];
while (sequenceDiffs1.length > 0 || sequenceDiffs2.length > 0) {
const sd1 = sequenceDiffs1[0];
const sd2 = sequenceDiffs2[0];
let next;
if (sd1 && (!sd2 || sd1.seq1Range.start < sd2.seq1Range.start)) {
next = sequenceDiffs1.shift();
} else {
next = sequenceDiffs2.shift();
}
if (result.length > 0 && result[result.length - 1].seq1Range.endExclusive >= next.seq1Range.start) {
result[result.length - 1] = result[result.length - 1].join(next);
} else {
result.push(next);
}
}
return result;
}
function removeVeryShortMatchingLinesBetweenDiffs(sequence1, _sequence2, sequenceDiffs) {
let diffs = sequenceDiffs;
if (diffs.length === 0) {
return diffs;
}
let counter = 0;
let shouldRepeat;
do {
shouldRepeat = false;
const result = [
diffs[0]
];
for (let i = 1; i < diffs.length; i++) {
let shouldJoinDiffs = function(before, after2) {
const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);
const unchangedText = sequence1.getText(unchangedRange);
const unchangedTextWithoutWs = unchangedText.replace(/\s/g, "");
if (unchangedTextWithoutWs.length <= 4 && (before.seq1Range.length + before.seq2Range.length > 5 || after2.seq1Range.length + after2.seq2Range.length > 5)) {
return true;
}
return false;
};
const cur = diffs[i];
const lastResult = result[result.length - 1];
const shouldJoin = shouldJoinDiffs(lastResult, cur);
if (shouldJoin) {
shouldRepeat = true;
result[result.length - 1] = result[result.length - 1].join(cur);
} else {
result.push(cur);
}
}
diffs = result;
} while (counter++ < 10 && shouldRepeat);
return diffs;
}
function removeVeryShortMatchingTextBetweenLongDiffs(sequence1, sequence2, sequenceDiffs) {
let diffs = sequenceDiffs;
if (diffs.length === 0) {
return diffs;
}
let counter = 0;
let shouldRepeat;
do {
shouldRepeat = false;
const result = [
diffs[0]
];
for (let i = 1; i < diffs.length; i++) {
let shouldJoinDiffs = function(before, after2) {
const unchangedRange = new OffsetRange(lastResult.seq1Range.endExclusive, cur.seq1Range.start);
const unchangedLineCount = sequence1.countLinesIn(unchangedRange);
if (unchangedLineCount > 5 || unchangedRange.length > 500) {
return false;
}
const unchangedText = sequence1.getText(unchangedRange).trim();
if (unchangedText.length > 20 || unchangedText.split(/\r\n|\r|\n/).length > 1) {
return false;
}
const beforeLineCount1 = sequence1.countLinesIn(before.seq1Range);
const beforeSeq1Length = before.seq1Range.length;
const beforeLineCount2 = sequence2.countLinesIn(before.seq2Range);
const beforeSeq2Length = before.seq2Range.length;
const afterLineCount1 = sequence1.countLinesIn(after2.seq1Range);
const afterSeq1Length = after2.seq1Range.length;
const afterLineCount2 = sequence2.countLinesIn(after2.seq2Range);
const afterSeq2Length = after2.seq2Range.length;
const max = 2 * 40 + 50;
function cap(v) {
return Math.min(v, max);
}
if (Math.pow(Math.pow(cap(beforeLineCount1 * 40 + beforeSeq1Length), 1.5) + Math.pow(cap(beforeLineCount2 * 40 + beforeSeq2Length), 1.5), 1.5) + Math.pow(Math.pow(cap(afterLineCount1 * 40 + afterSeq1Length), 1.5) + Math.pow(cap(afterLineCount2 * 40 + afterSeq2Length), 1.5), 1.5) > __pow(__pow(max, 1.5), 1.5) * 1.3) {
return true;
}
return false;
};
const cur = diffs[i];
const lastResult = result[result.length - 1];
const shouldJoin = shouldJoinDiffs(lastResult, cur);
if (shouldJoin) {
shouldRepeat = true;
result[result.length - 1] = result[result.length - 1].join(cur);
} else {
result.push(cur);
}
}
diffs = result;
} while (counter++ < 10 && shouldRepeat);
const newDiffs = [];
forEachWithNeighbors(diffs, (prev, cur, next) => {
let newDiff = cur;
function shouldMarkAsChanged(text2) {
return text2.length > 0 && text2.trim().length <= 3 && cur.seq1Range.length + cur.seq2Range.length > 100;
}
const fullRange1 = sequence1.extendToFullLines(cur.seq1Range);
const prefix = sequence1.getText(new OffsetRange(fullRange1.start, cur.seq1Range.start));
if (shouldMarkAsChanged(prefix)) {
newDiff = newDiff.deltaStart(-prefix.length);
}
const suffix = sequence1.getText(new OffsetRange(cur.seq1Range.endExclusive, fullRange1.endExclusive));
if (shouldMarkAsChanged(suffix)) {
newDiff = newDiff.deltaEnd(suffix.length);
}
const availableSpace = SequenceDiff.fromOffsetPairs(prev ? prev.getEndExclusives() : OffsetPair.zero, next ? next.getStarts() : OffsetPair.max);
const result = newDiff.intersect(availableSpace);
if (newDiffs.length > 0 && result.getStarts().equals(newDiffs[newDiffs.length - 1].getEndExclusives())) {
newDiffs[newDiffs.length - 1] = newDiffs[newDiffs.length - 1].join(result);
} else {
newDiffs.push(result);
}
});
return newDiffs;
}
var init_heuristicSequenceOptimizations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js"() {
init_arrays();
init_offsetRange();
init_diffAlgorithm();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js
function getIndentation(str) {
let i = 0;
while (i < str.length && (str.charCodeAt(i) === 32 || str.charCodeAt(i) === 9)) {
i++;
}
return i;
}
var LineSequence2;
var init_lineSequence = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js"() {
LineSequence2 = class {
constructor(trimmedHash, lines) {
this.trimmedHash = trimmedHash;
this.lines = lines;
}
getElement(offset) {
return this.trimmedHash[offset];
}
get length() {
return this.trimmedHash.length;
}
getBoundaryScore(length) {
const indentationBefore = length === 0 ? 0 : getIndentation(this.lines[length - 1]);
const indentationAfter = length === this.lines.length ? 0 : getIndentation(this.lines[length]);
return 1e3 - (indentationBefore + indentationAfter);
}
getText(range2) {
return this.lines.slice(range2.start, range2.endExclusive).join("\n");
}
isStronglyEqual(offset1, offset2) {
return this.lines[offset1] === this.lines[offset2];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js
function lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines, dontAssertStartLine = false) {
const changes = [];
for (const g of groupAdjacentBy(alignments.map((a3) => getLineRangeMapping(a3, originalLines, modifiedLines)), (a1, a22) => a1.original.overlapOrTouch(a22.original) || a1.modified.overlapOrTouch(a22.modified))) {
const first2 = g[0];
const last = g[g.length - 1];
changes.push(new DetailedLineRangeMapping(first2.original.join(last.original), first2.modified.join(last.modified), g.map((a3) => a3.innerChanges[0])));
}
assertFn(() => {
if (!dontAssertStartLine && changes.length > 0) {
if (changes[0].modified.startLineNumber !== changes[0].original.startLineNumber) {
return false;
}
if (modifiedLines.length - changes[changes.length - 1].modified.endLineNumberExclusive !== originalLines.length - changes[changes.length - 1].original.endLineNumberExclusive) {
return false;
}
}
return checkAdjacentItems(changes, (m1, m2) => m2.original.startLineNumber - m1.original.endLineNumberExclusive === m2.modified.startLineNumber - m1.modified.endLineNumberExclusive && // There has to be an unchanged line in between (otherwise both diffs should have been joined)
m1.original.endLineNumberExclusive < m2.original.startLineNumber && m1.modified.endLineNumberExclusive < m2.modified.startLineNumber);
});
return changes;
}
function getLineRangeMapping(rangeMapping, originalLines, modifiedLines) {
let lineStartDelta = 0;
let lineEndDelta = 0;
if (rangeMapping.modifiedRange.endColumn === 1 && rangeMapping.originalRange.endColumn === 1 && rangeMapping.originalRange.startLineNumber + lineStartDelta <= rangeMapping.originalRange.endLineNumber && rangeMapping.modifiedRange.startLineNumber + lineStartDelta <= rangeMapping.modifiedRange.endLineNumber) {
lineEndDelta = -1;
}
if (rangeMapping.modifiedRange.startColumn - 1 >= modifiedLines[rangeMapping.modifiedRange.startLineNumber - 1].length && rangeMapping.originalRange.startColumn - 1 >= originalLines[rangeMapping.originalRange.startLineNumber - 1].length && rangeMapping.originalRange.startLineNumber <= rangeMapping.originalRange.endLineNumber + lineEndDelta && rangeMapping.modifiedRange.startLineNumber <= rangeMapping.modifiedRange.endLineNumber + lineEndDelta) {
lineStartDelta = 1;
}
const originalLineRange = new LineRange(rangeMapping.originalRange.startLineNumber + lineStartDelta, rangeMapping.originalRange.endLineNumber + 1 + lineEndDelta);
const modifiedLineRange = new LineRange(rangeMapping.modifiedRange.startLineNumber + lineStartDelta, rangeMapping.modifiedRange.endLineNumber + 1 + lineEndDelta);
return new DetailedLineRangeMapping(originalLineRange, modifiedLineRange, [rangeMapping]);
}
var DefaultLinesDiffComputer;
var init_defaultLinesDiffComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js"() {
init_arrays();
init_assert();
init_lineRange();
init_offsetRange();
init_range();
init_diffAlgorithm();
init_dynamicProgrammingDiffing();
init_myersDiffAlgorithm();
init_computeMovedLines();
init_heuristicSequenceOptimizations();
init_lineSequence();
init_linesSliceCharSequence();
init_linesDiffComputer();
init_rangeMapping();
DefaultLinesDiffComputer = class {
constructor() {
this.dynamicProgrammingDiffing = new DynamicProgrammingDiffing();
this.myersDiffingAlgorithm = new MyersDiffAlgorithm();
}
computeDiff(originalLines, modifiedLines, options2) {
if (originalLines.length <= 1 && equals(originalLines, modifiedLines, (a3, b) => a3 === b)) {
return new LinesDiff([], [], false);
}
if (originalLines.length === 1 && originalLines[0].length === 0 || modifiedLines.length === 1 && modifiedLines[0].length === 0) {
return new LinesDiff([
new DetailedLineRangeMapping(new LineRange(1, originalLines.length + 1), new LineRange(1, modifiedLines.length + 1), [
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))
])
], [], false);
}
const timeout2 = options2.maxComputationTimeMs === 0 ? InfiniteTimeout.instance : new DateTimeout(options2.maxComputationTimeMs);
const considerWhitespaceChanges = !options2.ignoreTrimWhitespace;
const perfectHashes = /* @__PURE__ */ new Map();
function getOrCreateHash(text2) {
let hash2 = perfectHashes.get(text2);
if (hash2 === void 0) {
hash2 = perfectHashes.size;
perfectHashes.set(text2, hash2);
}
return hash2;
}
const originalLinesHashes = originalLines.map((l) => getOrCreateHash(l.trim()));
const modifiedLinesHashes = modifiedLines.map((l) => getOrCreateHash(l.trim()));
const sequence1 = new LineSequence2(originalLinesHashes, originalLines);
const sequence2 = new LineSequence2(modifiedLinesHashes, modifiedLines);
const lineAlignmentResult = (() => {
if (sequence1.length + sequence2.length < 1700) {
return this.dynamicProgrammingDiffing.compute(sequence1, sequence2, timeout2, (offset1, offset2) => originalLines[offset1] === modifiedLines[offset2] ? modifiedLines[offset2].length === 0 ? 0.1 : 1 + Math.log(1 + modifiedLines[offset2].length) : 0.99);
}
return this.myersDiffingAlgorithm.compute(sequence1, sequence2, timeout2);
})();
let lineAlignments = lineAlignmentResult.diffs;
let hitTimeout = lineAlignmentResult.hitTimeout;
lineAlignments = optimizeSequenceDiffs(sequence1, sequence2, lineAlignments);
lineAlignments = removeVeryShortMatchingLinesBetweenDiffs(sequence1, sequence2, lineAlignments);
const alignments = [];
const scanForWhitespaceChanges = (equalLinesCount) => {
if (!considerWhitespaceChanges) {
return;
}
for (let i = 0; i < equalLinesCount; i++) {
const seq1Offset = seq1LastStart + i;
const seq2Offset = seq2LastStart + i;
if (originalLines[seq1Offset] !== modifiedLines[seq2Offset]) {
const characterDiffs = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(new OffsetRange(seq1Offset, seq1Offset + 1), new OffsetRange(seq2Offset, seq2Offset + 1)), timeout2, considerWhitespaceChanges);
for (const a3 of characterDiffs.mappings) {
alignments.push(a3);
}
if (characterDiffs.hitTimeout) {
hitTimeout = true;
}
}
}
};
let seq1LastStart = 0;
let seq2LastStart = 0;
for (const diff of lineAlignments) {
assertFn(() => diff.seq1Range.start - seq1LastStart === diff.seq2Range.start - seq2LastStart);
const equalLinesCount = diff.seq1Range.start - seq1LastStart;
scanForWhitespaceChanges(equalLinesCount);
seq1LastStart = diff.seq1Range.endExclusive;
seq2LastStart = diff.seq2Range.endExclusive;
const characterDiffs = this.refineDiff(originalLines, modifiedLines, diff, timeout2, considerWhitespaceChanges);
if (characterDiffs.hitTimeout) {
hitTimeout = true;
}
for (const a3 of characterDiffs.mappings) {
alignments.push(a3);
}
}
scanForWhitespaceChanges(originalLines.length - seq1LastStart);
const changes = lineRangeMappingFromRangeMappings(alignments, originalLines, modifiedLines);
let moves = [];
if (options2.computeMoves) {
moves = this.computeMoves(changes, originalLines, modifiedLines, originalLinesHashes, modifiedLinesHashes, timeout2, considerWhitespaceChanges);
}
assertFn(() => {
function validatePosition(pos, lines) {
if (pos.lineNumber < 1 || pos.lineNumber > lines.length) {
return false;
}
const line = lines[pos.lineNumber - 1];
if (pos.column < 1 || pos.column > line.length + 1) {
return false;
}
return true;
}
function validateRange(range2, lines) {
if (range2.startLineNumber < 1 || range2.startLineNumber > lines.length + 1) {
return false;
}
if (range2.endLineNumberExclusive < 1 || range2.endLineNumberExclusive > lines.length + 1) {
return false;
}
return true;
}
for (const c of changes) {
if (!c.innerChanges) {
return false;
}
for (const ic of c.innerChanges) {
const valid = validatePosition(ic.modifiedRange.getStartPosition(), modifiedLines) && validatePosition(ic.modifiedRange.getEndPosition(), modifiedLines) && validatePosition(ic.originalRange.getStartPosition(), originalLines) && validatePosition(ic.originalRange.getEndPosition(), originalLines);
if (!valid) {
return false;
}
}
if (!validateRange(c.modified, modifiedLines) || !validateRange(c.original, originalLines)) {
return false;
}
}
return true;
});
return new LinesDiff(changes, moves, hitTimeout);
}
computeMoves(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout2, considerWhitespaceChanges) {
const moves = computeMovedLines(changes, originalLines, modifiedLines, hashedOriginalLines, hashedModifiedLines, timeout2);
const movesWithDiffs = moves.map((m) => {
const moveChanges = this.refineDiff(originalLines, modifiedLines, new SequenceDiff(m.original.toOffsetRange(), m.modified.toOffsetRange()), timeout2, considerWhitespaceChanges);
const mappings = lineRangeMappingFromRangeMappings(moveChanges.mappings, originalLines, modifiedLines, true);
return new MovedText(m, mappings);
});
return movesWithDiffs;
}
refineDiff(originalLines, modifiedLines, diff, timeout2, considerWhitespaceChanges) {
const slice1 = new LinesSliceCharSequence(originalLines, diff.seq1Range, considerWhitespaceChanges);
const slice2 = new LinesSliceCharSequence(modifiedLines, diff.seq2Range, considerWhitespaceChanges);
const diffResult = slice1.length + slice2.length < 500 ? this.dynamicProgrammingDiffing.compute(slice1, slice2, timeout2) : this.myersDiffingAlgorithm.compute(slice1, slice2, timeout2);
let diffs = diffResult.diffs;
diffs = optimizeSequenceDiffs(slice1, slice2, diffs);
diffs = extendDiffsToEntireWordIfAppropriate(slice1, slice2, diffs);
diffs = removeShortMatches(slice1, slice2, diffs);
diffs = removeVeryShortMatchingTextBetweenLongDiffs(slice1, slice2, diffs);
const result = diffs.map((d) => new RangeMapping(slice1.translateRange(d.seq1Range), slice2.translateRange(d.seq2Range)));
return {
mappings: result,
hitTimeout: diffResult.hitTimeout
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputers.js
var linesDiffComputers;
var init_linesDiffComputers = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/diff/linesDiffComputers.js"() {
init_legacyLinesDiffComputer();
init_defaultLinesDiffComputer();
linesDiffComputers = {
getLegacy: () => new LegacyLinesDiffComputer(),
getDefault: () => new DefaultLinesDiffComputer()
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/color.js
function roundFloat(number, decimalPoints) {
const decimal = Math.pow(10, decimalPoints);
return Math.round(number * decimal) / decimal;
}
var RGBA, HSLA, HSVA, Color;
var init_color = __esm({
"node_modules/monaco-editor/esm/vs/base/common/color.js"() {
RGBA = class {
constructor(r, g, b, a3 = 1) {
this._rgbaBrand = void 0;
this.r = Math.min(255, Math.max(0, r)) | 0;
this.g = Math.min(255, Math.max(0, g)) | 0;
this.b = Math.min(255, Math.max(0, b)) | 0;
this.a = roundFloat(Math.max(Math.min(1, a3), 0), 3);
}
static equals(a3, b) {
return a3.r === b.r && a3.g === b.g && a3.b === b.b && a3.a === b.a;
}
};
HSLA = class _HSLA {
constructor(h2, s, l, a3) {
this._hslaBrand = void 0;
this.h = Math.max(Math.min(360, h2), 0) | 0;
this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);
this.l = roundFloat(Math.max(Math.min(1, l), 0), 3);
this.a = roundFloat(Math.max(Math.min(1, a3), 0), 3);
}
static equals(a3, b) {
return a3.h === b.h && a3.s === b.s && a3.l === b.l && a3.a === b.a;
}
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h in the set [0, 360], s, and l in the set [0, 1].
*/
static fromRGBA(rgba) {
const r = rgba.r / 255;
const g = rgba.g / 255;
const b = rgba.b / 255;
const a3 = rgba.a;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
let h2 = 0;
let s = 0;
const l = (min + max) / 2;
const chroma = max - min;
if (chroma > 0) {
s = Math.min(l <= 0.5 ? chroma / (2 * l) : chroma / (2 - 2 * l), 1);
switch (max) {
case r:
h2 = (g - b) / chroma + (g < b ? 6 : 0);
break;
case g:
h2 = (b - r) / chroma + 2;
break;
case b:
h2 = (r - g) / chroma + 4;
break;
}
h2 *= 60;
h2 = Math.round(h2);
}
return new _HSLA(h2, s, l, a3);
}
static _hue2rgb(p, q, t4) {
if (t4 < 0) {
t4 += 1;
}
if (t4 > 1) {
t4 -= 1;
}
if (t4 < 1 / 6) {
return p + (q - p) * 6 * t4;
}
if (t4 < 1 / 2) {
return q;
}
if (t4 < 2 / 3) {
return p + (q - p) * (2 / 3 - t4) * 6;
}
return p;
}
/**
* Converts an HSL color value to RGB. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes h in the set [0, 360] s, and l are contained in the set [0, 1] and
* returns r, g, and b in the set [0, 255].
*/
static toRGBA(hsla) {
const h2 = hsla.h / 360;
const { s, l, a: a3 } = hsla;
let r, g, b;
if (s === 0) {
r = g = b = l;
} else {
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = _HSLA._hue2rgb(p, q, h2 + 1 / 3);
g = _HSLA._hue2rgb(p, q, h2);
b = _HSLA._hue2rgb(p, q, h2 - 1 / 3);
}
return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a3);
}
};
HSVA = class _HSVA {
constructor(h2, s, v, a3) {
this._hsvaBrand = void 0;
this.h = Math.max(Math.min(360, h2), 0) | 0;
this.s = roundFloat(Math.max(Math.min(1, s), 0), 3);
this.v = roundFloat(Math.max(Math.min(1, v), 0), 3);
this.a = roundFloat(Math.max(Math.min(1, a3), 0), 3);
}
static equals(a3, b) {
return a3.h === b.h && a3.s === b.s && a3.v === b.v && a3.a === b.a;
}
// from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm
static fromRGBA(rgba) {
const r = rgba.r / 255;
const g = rgba.g / 255;
const b = rgba.b / 255;
const cmax = Math.max(r, g, b);
const cmin = Math.min(r, g, b);
const delta = cmax - cmin;
const s = cmax === 0 ? 0 : delta / cmax;
let m;
if (delta === 0) {
m = 0;
} else if (cmax === r) {
m = ((g - b) / delta % 6 + 6) % 6;
} else if (cmax === g) {
m = (b - r) / delta + 2;
} else {
m = (r - g) / delta + 4;
}
return new _HSVA(Math.round(m * 60), s, cmax, rgba.a);
}
// from http://www.rapidtables.com/convert/color/hsv-to-rgb.htm
static toRGBA(hsva) {
const { h: h2, s, v, a: a3 } = hsva;
const c = v * s;
const x = c * (1 - Math.abs(h2 / 60 % 2 - 1));
const m = v - c;
let [r, g, b] = [0, 0, 0];
if (h2 < 60) {
r = c;
g = x;
} else if (h2 < 120) {
r = x;
g = c;
} else if (h2 < 180) {
g = c;
b = x;
} else if (h2 < 240) {
g = x;
b = c;
} else if (h2 < 300) {
r = x;
b = c;
} else if (h2 <= 360) {
r = c;
b = x;
}
r = Math.round((r + m) * 255);
g = Math.round((g + m) * 255);
b = Math.round((b + m) * 255);
return new RGBA(r, g, b, a3);
}
};
Color = class _Color {
static fromHex(hex) {
return _Color.Format.CSS.parseHex(hex) || _Color.red;
}
static equals(a3, b) {
if (!a3 && !b) {
return true;
}
if (!a3 || !b) {
return false;
}
return a3.equals(b);
}
get hsla() {
if (this._hsla) {
return this._hsla;
} else {
return HSLA.fromRGBA(this.rgba);
}
}
get hsva() {
if (this._hsva) {
return this._hsva;
}
return HSVA.fromRGBA(this.rgba);
}
constructor(arg) {
if (!arg) {
throw new Error("Color needs a value");
} else if (arg instanceof RGBA) {
this.rgba = arg;
} else if (arg instanceof HSLA) {
this._hsla = arg;
this.rgba = HSLA.toRGBA(arg);
} else if (arg instanceof HSVA) {
this._hsva = arg;
this.rgba = HSVA.toRGBA(arg);
} else {
throw new Error("Invalid color ctor argument");
}
}
equals(other) {
return !!other && RGBA.equals(this.rgba, other.rgba) && HSLA.equals(this.hsla, other.hsla) && HSVA.equals(this.hsva, other.hsva);
}
/**
* http://www.w3.org/TR/WCAG20/#relativeluminancedef
* Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.
*/
getRelativeLuminance() {
const R = _Color._relativeLuminanceForComponent(this.rgba.r);
const G = _Color._relativeLuminanceForComponent(this.rgba.g);
const B = _Color._relativeLuminanceForComponent(this.rgba.b);
const luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;
return roundFloat(luminance, 4);
}
static _relativeLuminanceForComponent(color) {
const c = color / 255;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
}
/**
* http://24ways.org/2010/calculating-color-contrast
* Return 'true' if lighter color otherwise 'false'
*/
isLighter() {
const yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1e3;
return yiq >= 128;
}
isLighterThan(another) {
const lum1 = this.getRelativeLuminance();
const lum2 = another.getRelativeLuminance();
return lum1 > lum2;
}
isDarkerThan(another) {
const lum1 = this.getRelativeLuminance();
const lum2 = another.getRelativeLuminance();
return lum1 < lum2;
}
lighten(factor2) {
return new _Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor2, this.hsla.a));
}
darken(factor2) {
return new _Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor2, this.hsla.a));
}
transparent(factor2) {
const { r, g, b, a: a3 } = this.rgba;
return new _Color(new RGBA(r, g, b, a3 * factor2));
}
isTransparent() {
return this.rgba.a === 0;
}
isOpaque() {
return this.rgba.a === 1;
}
opposite() {
return new _Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a));
}
makeOpaque(opaqueBackground) {
if (this.isOpaque() || opaqueBackground.rgba.a !== 1) {
return this;
}
const { r, g, b, a: a3 } = this.rgba;
return new _Color(new RGBA(opaqueBackground.rgba.r - a3 * (opaqueBackground.rgba.r - r), opaqueBackground.rgba.g - a3 * (opaqueBackground.rgba.g - g), opaqueBackground.rgba.b - a3 * (opaqueBackground.rgba.b - b), 1));
}
toString() {
if (!this._toString) {
this._toString = _Color.Format.CSS.format(this);
}
return this._toString;
}
static getLighterColor(of, relative2, factor2) {
if (of.isLighterThan(relative2)) {
return of;
}
factor2 = factor2 ? factor2 : 0.5;
const lum1 = of.getRelativeLuminance();
const lum2 = relative2.getRelativeLuminance();
factor2 = factor2 * (lum2 - lum1) / lum2;
return of.lighten(factor2);
}
static getDarkerColor(of, relative2, factor2) {
if (of.isDarkerThan(relative2)) {
return of;
}
factor2 = factor2 ? factor2 : 0.5;
const lum1 = of.getRelativeLuminance();
const lum2 = relative2.getRelativeLuminance();
factor2 = factor2 * (lum1 - lum2) / lum1;
return of.darken(factor2);
}
};
Color.white = new Color(new RGBA(255, 255, 255, 1));
Color.black = new Color(new RGBA(0, 0, 0, 1));
Color.red = new Color(new RGBA(255, 0, 0, 1));
Color.blue = new Color(new RGBA(0, 0, 255, 1));
Color.green = new Color(new RGBA(0, 255, 0, 1));
Color.cyan = new Color(new RGBA(0, 255, 255, 1));
Color.lightgrey = new Color(new RGBA(211, 211, 211, 1));
Color.transparent = new Color(new RGBA(0, 0, 0, 0));
(function(Color8) {
let Format;
(function(Format2) {
let CSS;
(function(CSS2) {
function formatRGB(color) {
if (color.rgba.a === 1) {
return `rgb(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b})`;
}
return Color8.Format.CSS.formatRGBA(color);
}
CSS2.formatRGB = formatRGB;
function formatRGBA(color) {
return `rgba(${color.rgba.r}, ${color.rgba.g}, ${color.rgba.b}, ${+color.rgba.a.toFixed(2)})`;
}
CSS2.formatRGBA = formatRGBA;
function formatHSL(color) {
if (color.hsla.a === 1) {
return `hsl(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%)`;
}
return Color8.Format.CSS.formatHSLA(color);
}
CSS2.formatHSL = formatHSL;
function formatHSLA(color) {
return `hsla(${color.hsla.h}, ${(color.hsla.s * 100).toFixed(2)}%, ${(color.hsla.l * 100).toFixed(2)}%, ${color.hsla.a.toFixed(2)})`;
}
CSS2.formatHSLA = formatHSLA;
function _toTwoDigitHex(n) {
const r = n.toString(16);
return r.length !== 2 ? "0" + r : r;
}
function formatHex(color) {
return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}`;
}
CSS2.formatHex = formatHex;
function formatHexA(color, compact = false) {
if (compact && color.rgba.a === 1) {
return Color8.Format.CSS.formatHex(color);
}
return `#${_toTwoDigitHex(color.rgba.r)}${_toTwoDigitHex(color.rgba.g)}${_toTwoDigitHex(color.rgba.b)}${_toTwoDigitHex(Math.round(color.rgba.a * 255))}`;
}
CSS2.formatHexA = formatHexA;
function format7(color) {
if (color.isOpaque()) {
return Color8.Format.CSS.formatHex(color);
}
return Color8.Format.CSS.formatRGBA(color);
}
CSS2.format = format7;
function parseHex(hex) {
const length = hex.length;
if (length === 0) {
return null;
}
if (hex.charCodeAt(0) !== 35) {
return null;
}
if (length === 7) {
const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));
const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
return new Color8(new RGBA(r, g, b, 1));
}
if (length === 9) {
const r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));
const g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
const b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
const a3 = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));
return new Color8(new RGBA(r, g, b, a3 / 255));
}
if (length === 4) {
const r = _parseHexDigit(hex.charCodeAt(1));
const g = _parseHexDigit(hex.charCodeAt(2));
const b = _parseHexDigit(hex.charCodeAt(3));
return new Color8(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));
}
if (length === 5) {
const r = _parseHexDigit(hex.charCodeAt(1));
const g = _parseHexDigit(hex.charCodeAt(2));
const b = _parseHexDigit(hex.charCodeAt(3));
const a3 = _parseHexDigit(hex.charCodeAt(4));
return new Color8(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a3 + a3) / 255));
}
return null;
}
CSS2.parseHex = parseHex;
function _parseHexDigit(charCode) {
switch (charCode) {
case 48:
return 0;
case 49:
return 1;
case 50:
return 2;
case 51:
return 3;
case 52:
return 4;
case 53:
return 5;
case 54:
return 6;
case 55:
return 7;
case 56:
return 8;
case 57:
return 9;
case 97:
return 10;
case 65:
return 10;
case 98:
return 11;
case 66:
return 11;
case 99:
return 12;
case 67:
return 12;
case 100:
return 13;
case 68:
return 13;
case 101:
return 14;
case 69:
return 14;
case 102:
return 15;
case 70:
return 15;
}
return 0;
}
})(CSS = Format2.CSS || (Format2.CSS = {}));
})(Format = Color8.Format || (Color8.Format = {}));
})(Color || (Color = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js
function _parseCaptureGroups(captureGroups) {
const values2 = [];
for (const captureGroup of captureGroups) {
const parsedNumber = Number(captureGroup);
if (parsedNumber || parsedNumber === 0 && captureGroup.replace(/\s/g, "") !== "") {
values2.push(parsedNumber);
}
}
return values2;
}
function _toIColor(r, g, b, a3) {
return {
red: r / 255,
blue: b / 255,
green: g / 255,
alpha: a3
};
}
function _findRange(model, match2) {
const index = match2.index;
const length = match2[0].length;
if (!index) {
return;
}
const startPosition = model.positionAt(index);
const range2 = {
startLineNumber: startPosition.lineNumber,
startColumn: startPosition.column,
endLineNumber: startPosition.lineNumber,
endColumn: startPosition.column + length
};
return range2;
}
function _findHexColorInformation(range2, hexValue) {
if (!range2) {
return;
}
const parsedHexColor = Color.Format.CSS.parseHex(hexValue);
if (!parsedHexColor) {
return;
}
return {
range: range2,
color: _toIColor(parsedHexColor.rgba.r, parsedHexColor.rgba.g, parsedHexColor.rgba.b, parsedHexColor.rgba.a)
};
}
function _findRGBColorInformation(range2, matches2, isAlpha) {
if (!range2 || matches2.length !== 1) {
return;
}
const match2 = matches2[0];
const captureGroups = match2.values();
const parsedRegex = _parseCaptureGroups(captureGroups);
return {
range: range2,
color: _toIColor(parsedRegex[0], parsedRegex[1], parsedRegex[2], isAlpha ? parsedRegex[3] : 1)
};
}
function _findHSLColorInformation(range2, matches2, isAlpha) {
if (!range2 || matches2.length !== 1) {
return;
}
const match2 = matches2[0];
const captureGroups = match2.values();
const parsedRegex = _parseCaptureGroups(captureGroups);
const colorEquivalent = new Color(new HSLA(parsedRegex[0], parsedRegex[1] / 100, parsedRegex[2] / 100, isAlpha ? parsedRegex[3] : 1));
return {
range: range2,
color: _toIColor(colorEquivalent.rgba.r, colorEquivalent.rgba.g, colorEquivalent.rgba.b, colorEquivalent.rgba.a)
};
}
function _findMatches(model, regex) {
if (typeof model === "string") {
return [...model.matchAll(regex)];
} else {
return model.findMatches(regex);
}
}
function computeColors(model) {
const result = [];
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;
const initialValidationMatches = _findMatches(model, initialValidationRegex);
if (initialValidationMatches.length > 0) {
for (const initialMatch of initialValidationMatches) {
const initialCaptureGroups = initialMatch.filter((captureGroup) => captureGroup !== void 0);
const colorScheme = initialCaptureGroups[1];
const colorParameters = initialCaptureGroups[2];
if (!colorParameters) {
continue;
}
let colorInformation;
if (colorScheme === "rgb") {
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;
colorInformation = _findRGBColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), false);
} else if (colorScheme === "rgba") {
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;
colorInformation = _findRGBColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), true);
} else if (colorScheme === "hsl") {
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;
colorInformation = _findHSLColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), false);
} else if (colorScheme === "hsla") {
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;
colorInformation = _findHSLColorInformation(_findRange(model, initialMatch), _findMatches(colorParameters, regexParameters), true);
} else if (colorScheme === "#") {
colorInformation = _findHexColorInformation(_findRange(model, initialMatch), colorScheme + colorParameters);
}
if (colorInformation) {
result.push(colorInformation);
}
}
}
return result;
}
function computeDefaultDocumentColors(model) {
if (!model || typeof model.getValue !== "function" || typeof model.positionAt !== "function") {
return [];
}
return computeColors(model);
}
var init_defaultDocumentColorsComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js"() {
init_color();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/findSectionHeaders.js
function findSectionHeaders(model, options2) {
var _a10;
let headers = [];
if (options2.findRegionSectionHeaders && ((_a10 = options2.foldingRules) === null || _a10 === void 0 ? void 0 : _a10.markers)) {
const regionHeaders = collectRegionHeaders(model, options2);
headers = headers.concat(regionHeaders);
}
if (options2.findMarkSectionHeaders) {
const markHeaders = collectMarkHeaders(model);
headers = headers.concat(markHeaders);
}
return headers;
}
function collectRegionHeaders(model, options2) {
const regionHeaders = [];
const endLineNumber = model.getLineCount();
for (let lineNumber = 1; lineNumber <= endLineNumber; lineNumber++) {
const lineContent = model.getLineContent(lineNumber);
const match2 = lineContent.match(options2.foldingRules.markers.start);
if (match2) {
const range2 = { startLineNumber: lineNumber, startColumn: match2[0].length + 1, endLineNumber: lineNumber, endColumn: lineContent.length + 1 };
if (range2.endColumn > range2.startColumn) {
const sectionHeader = __spreadProps(__spreadValues({
range: range2
}, getHeaderText(lineContent.substring(match2[0].length))), {
shouldBeInComments: false
});
if (sectionHeader.text || sectionHeader.hasSeparatorLine) {
regionHeaders.push(sectionHeader);
}
}
}
}
return regionHeaders;
}
function collectMarkHeaders(model) {
const markHeaders = [];
const endLineNumber = model.getLineCount();
for (let lineNumber = 1; lineNumber <= endLineNumber; lineNumber++) {
const lineContent = model.getLineContent(lineNumber);
addMarkHeaderIfFound(lineContent, lineNumber, markHeaders);
}
return markHeaders;
}
function addMarkHeaderIfFound(lineContent, lineNumber, sectionHeaders) {
markRegex.lastIndex = 0;
const match2 = markRegex.exec(lineContent);
if (match2) {
const column = match2.indices[1][0] + 1;
const endColumn = match2.indices[1][1] + 1;
const range2 = { startLineNumber: lineNumber, startColumn: column, endLineNumber: lineNumber, endColumn };
if (range2.endColumn > range2.startColumn) {
const sectionHeader = __spreadProps(__spreadValues({
range: range2
}, getHeaderText(match2[1])), {
shouldBeInComments: true
});
if (sectionHeader.text || sectionHeader.hasSeparatorLine) {
sectionHeaders.push(sectionHeader);
}
}
}
}
function getHeaderText(text2) {
text2 = text2.trim();
const hasSeparatorLine = text2.startsWith("-");
text2 = text2.replace(trimDashesRegex, "");
return { text: text2, hasSeparatorLine };
}
var markRegex, trimDashesRegex;
var init_findSectionHeaders = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/findSectionHeaders.js"() {
markRegex = new RegExp("\\bMARK:\\s*(.*)$", "d");
trimDashesRegex = /^-+|-+$/g;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js
var MirrorModel, EditorSimpleWorker;
var init_editorSimpleWorker = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js"() {
init_diff();
init_uri();
init_position();
init_range();
init_mirrorTextModel();
init_wordHelper();
init_linkComputer();
init_inplaceReplaceSupport();
init_editorBaseApi();
init_stopwatch();
init_unicodeTextModelHighlighter();
init_linesDiffComputers();
init_objects();
init_defaultDocumentColorsComputer();
init_findSectionHeaders();
MirrorModel = class extends MirrorTextModel {
get uri() {
return this._uri;
}
get eol() {
return this._eol;
}
getValue() {
return this.getText();
}
findMatches(regex) {
const matches2 = [];
for (let i = 0; i < this._lines.length; i++) {
const line = this._lines[i];
const offsetToAdd = this.offsetAt(new Position(i + 1, 1));
const iteratorOverMatches = line.matchAll(regex);
for (const match2 of iteratorOverMatches) {
if (match2.index || match2.index === 0) {
match2.index = match2.index + offsetToAdd;
}
matches2.push(match2);
}
}
return matches2;
}
getLinesContent() {
return this._lines.slice(0);
}
getLineCount() {
return this._lines.length;
}
getLineContent(lineNumber) {
return this._lines[lineNumber - 1];
}
getWordAtPosition(position, wordDefinition) {
const wordAtText = getWordAtText(position.column, ensureValidWordDefinition(wordDefinition), this._lines[position.lineNumber - 1], 0);
if (wordAtText) {
return new Range(position.lineNumber, wordAtText.startColumn, position.lineNumber, wordAtText.endColumn);
}
return null;
}
words(wordDefinition) {
const lines = this._lines;
const wordenize = this._wordenize.bind(this);
let lineNumber = 0;
let lineText = "";
let wordRangesIdx = 0;
let wordRanges = [];
return {
*[Symbol.iterator]() {
while (true) {
if (wordRangesIdx < wordRanges.length) {
const value = lineText.substring(wordRanges[wordRangesIdx].start, wordRanges[wordRangesIdx].end);
wordRangesIdx += 1;
yield value;
} else {
if (lineNumber < lines.length) {
lineText = lines[lineNumber];
wordRanges = wordenize(lineText, wordDefinition);
wordRangesIdx = 0;
lineNumber += 1;
} else {
break;
}
}
}
}
};
}
getLineWords(lineNumber, wordDefinition) {
const content = this._lines[lineNumber - 1];
const ranges = this._wordenize(content, wordDefinition);
const words = [];
for (const range2 of ranges) {
words.push({
word: content.substring(range2.start, range2.end),
startColumn: range2.start + 1,
endColumn: range2.end + 1
});
}
return words;
}
_wordenize(content, wordDefinition) {
const result = [];
let match2;
wordDefinition.lastIndex = 0;
while (match2 = wordDefinition.exec(content)) {
if (match2[0].length === 0) {
break;
}
result.push({ start: match2.index, end: match2.index + match2[0].length });
}
return result;
}
getValueInRange(range2) {
range2 = this._validateRange(range2);
if (range2.startLineNumber === range2.endLineNumber) {
return this._lines[range2.startLineNumber - 1].substring(range2.startColumn - 1, range2.endColumn - 1);
}
const lineEnding = this._eol;
const startLineIndex = range2.startLineNumber - 1;
const endLineIndex = range2.endLineNumber - 1;
const resultLines = [];
resultLines.push(this._lines[startLineIndex].substring(range2.startColumn - 1));
for (let i = startLineIndex + 1; i < endLineIndex; i++) {
resultLines.push(this._lines[i]);
}
resultLines.push(this._lines[endLineIndex].substring(0, range2.endColumn - 1));
return resultLines.join(lineEnding);
}
offsetAt(position) {
position = this._validatePosition(position);
this._ensureLineStarts();
return this._lineStarts.getPrefixSum(position.lineNumber - 2) + (position.column - 1);
}
positionAt(offset) {
offset = Math.floor(offset);
offset = Math.max(0, offset);
this._ensureLineStarts();
const out = this._lineStarts.getIndexOf(offset);
const lineLength = this._lines[out.index].length;
return {
lineNumber: 1 + out.index,
column: 1 + Math.min(out.remainder, lineLength)
};
}
_validateRange(range2) {
const start = this._validatePosition({ lineNumber: range2.startLineNumber, column: range2.startColumn });
const end = this._validatePosition({ lineNumber: range2.endLineNumber, column: range2.endColumn });
if (start.lineNumber !== range2.startLineNumber || start.column !== range2.startColumn || end.lineNumber !== range2.endLineNumber || end.column !== range2.endColumn) {
return {
startLineNumber: start.lineNumber,
startColumn: start.column,
endLineNumber: end.lineNumber,
endColumn: end.column
};
}
return range2;
}
_validatePosition(position) {
if (!Position.isIPosition(position)) {
throw new Error("bad position");
}
let { lineNumber, column } = position;
let hasChanged = false;
if (lineNumber < 1) {
lineNumber = 1;
column = 1;
hasChanged = true;
} else if (lineNumber > this._lines.length) {
lineNumber = this._lines.length;
column = this._lines[lineNumber - 1].length + 1;
hasChanged = true;
} else {
const maxCharacter = this._lines[lineNumber - 1].length + 1;
if (column < 1) {
column = 1;
hasChanged = true;
} else if (column > maxCharacter) {
column = maxCharacter;
hasChanged = true;
}
}
if (!hasChanged) {
return position;
} else {
return { lineNumber, column };
}
}
};
EditorSimpleWorker = class _EditorSimpleWorker {
constructor(host, foreignModuleFactory) {
this._host = host;
this._models = /* @__PURE__ */ Object.create(null);
this._foreignModuleFactory = foreignModuleFactory;
this._foreignModule = null;
}
dispose() {
this._models = /* @__PURE__ */ Object.create(null);
}
_getModel(uri) {
return this._models[uri];
}
_getModels() {
const all = [];
Object.keys(this._models).forEach((key) => all.push(this._models[key]));
return all;
}
acceptNewModel(data) {
this._models[data.url] = new MirrorModel(URI.parse(data.url), data.lines, data.EOL, data.versionId);
}
acceptModelChanged(strURL, e) {
if (!this._models[strURL]) {
return;
}
const model = this._models[strURL];
model.onEvents(e);
}
acceptRemovedModel(strURL) {
if (!this._models[strURL]) {
return;
}
delete this._models[strURL];
}
computeUnicodeHighlights(url, options2, range2) {
return __async(this, null, function* () {
const model = this._getModel(url);
if (!model) {
return { ranges: [], hasMore: false, ambiguousCharacterCount: 0, invisibleCharacterCount: 0, nonBasicAsciiCharacterCount: 0 };
}
return UnicodeTextModelHighlighter.computeUnicodeHighlights(model, options2, range2);
});
}
findSectionHeaders(url, options2) {
return __async(this, null, function* () {
const model = this._getModel(url);
if (!model) {
return [];
}
return findSectionHeaders(model, options2);
});
}
// ---- BEGIN diff --------------------------------------------------------------------------
computeDiff(originalUrl, modifiedUrl, options2, algorithm) {
return __async(this, null, function* () {
const original = this._getModel(originalUrl);
const modified = this._getModel(modifiedUrl);
if (!original || !modified) {
return null;
}
const result = _EditorSimpleWorker.computeDiff(original, modified, options2, algorithm);
return result;
});
}
static computeDiff(originalTextModel, modifiedTextModel, options2, algorithm) {
const diffAlgorithm = algorithm === "advanced" ? linesDiffComputers.getDefault() : linesDiffComputers.getLegacy();
const originalLines = originalTextModel.getLinesContent();
const modifiedLines = modifiedTextModel.getLinesContent();
const result = diffAlgorithm.computeDiff(originalLines, modifiedLines, options2);
const identical = result.changes.length > 0 ? false : this._modelsAreIdentical(originalTextModel, modifiedTextModel);
function getLineChanges(changes) {
return changes.map((m) => {
var _a10;
return [m.original.startLineNumber, m.original.endLineNumberExclusive, m.modified.startLineNumber, m.modified.endLineNumberExclusive, (_a10 = m.innerChanges) === null || _a10 === void 0 ? void 0 : _a10.map((m2) => [
m2.originalRange.startLineNumber,
m2.originalRange.startColumn,
m2.originalRange.endLineNumber,
m2.originalRange.endColumn,
m2.modifiedRange.startLineNumber,
m2.modifiedRange.startColumn,
m2.modifiedRange.endLineNumber,
m2.modifiedRange.endColumn
])];
});
}
return {
identical,
quitEarly: result.hitTimeout,
changes: getLineChanges(result.changes),
moves: result.moves.map((m) => [
m.lineRangeMapping.original.startLineNumber,
m.lineRangeMapping.original.endLineNumberExclusive,
m.lineRangeMapping.modified.startLineNumber,
m.lineRangeMapping.modified.endLineNumberExclusive,
getLineChanges(m.changes)
])
};
}
static _modelsAreIdentical(original, modified) {
const originalLineCount = original.getLineCount();
const modifiedLineCount = modified.getLineCount();
if (originalLineCount !== modifiedLineCount) {
return false;
}
for (let line = 1; line <= originalLineCount; line++) {
const originalLine = original.getLineContent(line);
const modifiedLine = modified.getLineContent(line);
if (originalLine !== modifiedLine) {
return false;
}
}
return true;
}
computeMoreMinimalEdits(modelUrl, edits, pretty) {
return __async(this, null, function* () {
const model = this._getModel(modelUrl);
if (!model) {
return edits;
}
const result = [];
let lastEol = void 0;
edits = edits.slice(0).sort((a3, b) => {
if (a3.range && b.range) {
return Range.compareRangesUsingStarts(a3.range, b.range);
}
const aRng = a3.range ? 0 : 1;
const bRng = b.range ? 0 : 1;
return aRng - bRng;
});
let writeIndex = 0;
for (let readIndex = 1; readIndex < edits.length; readIndex++) {
if (Range.getEndPosition(edits[writeIndex].range).equals(Range.getStartPosition(edits[readIndex].range))) {
edits[writeIndex].range = Range.fromPositions(Range.getStartPosition(edits[writeIndex].range), Range.getEndPosition(edits[readIndex].range));
edits[writeIndex].text += edits[readIndex].text;
} else {
writeIndex++;
edits[writeIndex] = edits[readIndex];
}
}
edits.length = writeIndex + 1;
for (let { range: range2, text: text2, eol } of edits) {
if (typeof eol === "number") {
lastEol = eol;
}
if (Range.isEmpty(range2) && !text2) {
continue;
}
const original = model.getValueInRange(range2);
text2 = text2.replace(/\r\n|\n|\r/g, model.eol);
if (original === text2) {
continue;
}
if (Math.max(text2.length, original.length) > _EditorSimpleWorker._diffLimit) {
result.push({ range: range2, text: text2 });
continue;
}
const changes = stringDiff(original, text2, pretty);
const editOffset = model.offsetAt(Range.lift(range2).getStartPosition());
for (const change of changes) {
const start = model.positionAt(editOffset + change.originalStart);
const end = model.positionAt(editOffset + change.originalStart + change.originalLength);
const newEdit = {
text: text2.substr(change.modifiedStart, change.modifiedLength),
range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column }
};
if (model.getValueInRange(newEdit.range) !== newEdit.text) {
result.push(newEdit);
}
}
}
if (typeof lastEol === "number") {
result.push({ eol: lastEol, text: "", range: { startLineNumber: 0, startColumn: 0, endLineNumber: 0, endColumn: 0 } });
}
return result;
});
}
// ---- END minimal edits ---------------------------------------------------------------
computeLinks(modelUrl) {
return __async(this, null, function* () {
const model = this._getModel(modelUrl);
if (!model) {
return null;
}
return computeLinks(model);
});
}
// --- BEGIN default document colors -----------------------------------------------------------
computeDefaultDocumentColors(modelUrl) {
return __async(this, null, function* () {
const model = this._getModel(modelUrl);
if (!model) {
return null;
}
return computeDefaultDocumentColors(model);
});
}
textualSuggest(modelUrls, leadingWord, wordDef, wordDefFlags) {
return __async(this, null, function* () {
const sw = new StopWatch();
const wordDefRegExp = new RegExp(wordDef, wordDefFlags);
const seen = /* @__PURE__ */ new Set();
outer: for (const url of modelUrls) {
const model = this._getModel(url);
if (!model) {
continue;
}
for (const word of model.words(wordDefRegExp)) {
if (word === leadingWord || !isNaN(Number(word))) {
continue;
}
seen.add(word);
if (seen.size > _EditorSimpleWorker._suggestionsLimit) {
break outer;
}
}
}
return { words: Array.from(seen), duration: sw.elapsed() };
});
}
// ---- END suggest --------------------------------------------------------------------------
//#region -- word ranges --
computeWordRanges(modelUrl, range2, wordDef, wordDefFlags) {
return __async(this, null, function* () {
const model = this._getModel(modelUrl);
if (!model) {
return /* @__PURE__ */ Object.create(null);
}
const wordDefRegExp = new RegExp(wordDef, wordDefFlags);
const result = /* @__PURE__ */ Object.create(null);
for (let line = range2.startLineNumber; line < range2.endLineNumber; line++) {
const words = model.getLineWords(line, wordDefRegExp);
for (const word of words) {
if (!isNaN(Number(word.word))) {
continue;
}
let array2 = result[word.word];
if (!array2) {
array2 = [];
result[word.word] = array2;
}
array2.push({
startLineNumber: line,
startColumn: word.startColumn,
endLineNumber: line,
endColumn: word.endColumn
});
}
}
return result;
});
}
//#endregion
navigateValueSet(modelUrl, range2, up, wordDef, wordDefFlags) {
return __async(this, null, function* () {
const model = this._getModel(modelUrl);
if (!model) {
return null;
}
const wordDefRegExp = new RegExp(wordDef, wordDefFlags);
if (range2.startColumn === range2.endColumn) {
range2 = {
startLineNumber: range2.startLineNumber,
startColumn: range2.startColumn,
endLineNumber: range2.endLineNumber,
endColumn: range2.endColumn + 1
};
}
const selectionText = model.getValueInRange(range2);
const wordRange = model.getWordAtPosition({ lineNumber: range2.startLineNumber, column: range2.startColumn }, wordDefRegExp);
if (!wordRange) {
return null;
}
const word = model.getValueInRange(wordRange);
const result = BasicInplaceReplace.INSTANCE.navigateValueSet(range2, selectionText, wordRange, word, up);
return result;
});
}
// ---- BEGIN foreign module support --------------------------------------------------------------------------
loadForeignModule(moduleId, createData, foreignHostMethods) {
const proxyMethodRequest = (method, args) => {
return this._host.fhr(method, args);
};
const foreignHost = createProxyObject(foreignHostMethods, proxyMethodRequest);
const ctx = {
host: foreignHost,
getMirrorModels: () => {
return this._getModels();
}
};
if (this._foreignModuleFactory) {
this._foreignModule = this._foreignModuleFactory(ctx, createData);
return Promise.resolve(getAllMethodNames(this._foreignModule));
}
return Promise.reject(new Error(`Unexpected usage`));
}
// foreign method request
fmr(method, args) {
if (!this._foreignModule || typeof this._foreignModule[method] !== "function") {
return Promise.reject(new Error("Missing requestHandler or method: " + method));
}
try {
return Promise.resolve(this._foreignModule[method].apply(this._foreignModule, args));
} catch (e) {
return Promise.reject(e);
}
}
};
EditorSimpleWorker._diffLimit = 1e5;
EditorSimpleWorker._suggestionsLimit = 1e4;
if (typeof importScripts === "function") {
globalThis.monaco = createMonacoBaseAPI();
}
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js
var ITextResourceConfigurationService, ITextResourcePropertiesService;
var init_textResourceConfiguration = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js"() {
init_instantiation();
ITextResourceConfigurationService = createDecorator("textResourceConfigurationService");
ITextResourcePropertiesService = createDecorator("textResourcePropertiesService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatures.js
var ILanguageFeaturesService;
var init_languageFeatures = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatures.js"() {
init_instantiation();
ILanguageFeaturesService = createDecorator("ILanguageFeaturesService");
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/editorWorkerService.js
function canSyncModel(modelService, resource) {
const model = modelService.getModel(resource);
if (!model) {
return false;
}
if (model.isTooLargeForSyncing()) {
return false;
}
return true;
}
var __decorate3, __param3, STOP_SYNC_MODEL_DELTA_TIME_MS, STOP_WORKER_DELTA_TIME_MS, EditorWorkerService, WordBasedCompletionItemProvider, WorkerManager, EditorModelManager, SynchronousWorkerClient, EditorWorkerHost, EditorWorkerClient;
var init_editorWorkerService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/editorWorkerService.js"() {
init_async();
init_lifecycle();
init_simpleWorker();
init_defaultWorkerFactory();
init_range();
init_languageConfigurationRegistry();
init_editorSimpleWorker();
init_model();
init_textResourceConfiguration();
init_arrays();
init_log();
init_stopwatch();
init_errors();
init_languageFeatures();
init_linesDiffComputer();
init_rangeMapping();
init_lineRange();
init_window();
init_dom();
__decorate3 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param3 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
STOP_SYNC_MODEL_DELTA_TIME_MS = 60 * 1e3;
STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1e3;
EditorWorkerService = class EditorWorkerService2 extends Disposable {
constructor(modelService, configurationService, logService, languageConfigurationService, languageFeaturesService) {
super();
this._modelService = modelService;
this._workerManager = this._register(new WorkerManager(this._modelService, languageConfigurationService));
this._logService = logService;
this._register(languageFeaturesService.linkProvider.register({ language: "*", hasAccessToAllModels: true }, {
provideLinks: (model, token) => {
if (!canSyncModel(this._modelService, model.uri)) {
return Promise.resolve({ links: [] });
}
return this._workerManager.withWorker().then((client) => client.computeLinks(model.uri)).then((links) => {
return links && { links };
});
}
}));
this._register(languageFeaturesService.completionProvider.register("*", new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, languageConfigurationService)));
}
dispose() {
super.dispose();
}
canComputeUnicodeHighlights(uri) {
return canSyncModel(this._modelService, uri);
}
computedUnicodeHighlights(uri, options2, range2) {
return this._workerManager.withWorker().then((client) => client.computedUnicodeHighlights(uri, options2, range2));
}
computeDiff(original, modified, options2, algorithm) {
return __async(this, null, function* () {
const result = yield this._workerManager.withWorker().then((client) => client.computeDiff(original, modified, options2, algorithm));
if (!result) {
return null;
}
const diff = {
identical: result.identical,
quitEarly: result.quitEarly,
changes: toLineRangeMappings(result.changes),
moves: result.moves.map((m) => new MovedText(new LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])), toLineRangeMappings(m[4])))
};
return diff;
function toLineRangeMappings(changes) {
return changes.map((c) => {
var _a10;
return new DetailedLineRangeMapping(new LineRange(c[0], c[1]), new LineRange(c[2], c[3]), (_a10 = c[4]) === null || _a10 === void 0 ? void 0 : _a10.map((c2) => new RangeMapping(new Range(c2[0], c2[1], c2[2], c2[3]), new Range(c2[4], c2[5], c2[6], c2[7]))));
});
}
});
}
computeMoreMinimalEdits(resource, edits, pretty = false) {
if (isNonEmptyArray(edits)) {
if (!canSyncModel(this._modelService, resource)) {
return Promise.resolve(edits);
}
const sw = StopWatch.create();
const result = this._workerManager.withWorker().then((client) => client.computeMoreMinimalEdits(resource, edits, pretty));
result.finally(() => this._logService.trace("FORMAT#computeMoreMinimalEdits", resource.toString(true), sw.elapsed()));
return Promise.race([result, timeout(1e3).then(() => edits)]);
} else {
return Promise.resolve(void 0);
}
}
canNavigateValueSet(resource) {
return canSyncModel(this._modelService, resource);
}
navigateValueSet(resource, range2, up) {
return this._workerManager.withWorker().then((client) => client.navigateValueSet(resource, range2, up));
}
canComputeWordRanges(resource) {
return canSyncModel(this._modelService, resource);
}
computeWordRanges(resource, range2) {
return this._workerManager.withWorker().then((client) => client.computeWordRanges(resource, range2));
}
findSectionHeaders(uri, options2) {
return this._workerManager.withWorker().then((client) => client.findSectionHeaders(uri, options2));
}
};
EditorWorkerService = __decorate3([
__param3(0, IModelService),
__param3(1, ITextResourceConfigurationService),
__param3(2, ILogService),
__param3(3, ILanguageConfigurationService),
__param3(4, ILanguageFeaturesService)
], EditorWorkerService);
WordBasedCompletionItemProvider = class {
constructor(workerManager, configurationService, modelService, languageConfigurationService) {
this.languageConfigurationService = languageConfigurationService;
this._debugDisplayName = "wordbasedCompletions";
this._workerManager = workerManager;
this._configurationService = configurationService;
this._modelService = modelService;
}
provideCompletionItems(model, position) {
return __async(this, null, function* () {
const config = this._configurationService.getValue(model.uri, position, "editor");
if (config.wordBasedSuggestions === "off") {
return void 0;
}
const models = [];
if (config.wordBasedSuggestions === "currentDocument") {
if (canSyncModel(this._modelService, model.uri)) {
models.push(model.uri);
}
} else {
for (const candidate of this._modelService.getModels()) {
if (!canSyncModel(this._modelService, candidate.uri)) {
continue;
}
if (candidate === model) {
models.unshift(candidate.uri);
} else if (config.wordBasedSuggestions === "allDocuments" || candidate.getLanguageId() === model.getLanguageId()) {
models.push(candidate.uri);
}
}
}
if (models.length === 0) {
return void 0;
}
const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();
const word = model.getWordAtPosition(position);
const replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
const insert = replace.setEndPosition(position.lineNumber, position.column);
const client = yield this._workerManager.withWorker();
const data = yield client.textualSuggest(models, word === null || word === void 0 ? void 0 : word.word, wordDefRegExp);
if (!data) {
return void 0;
}
return {
duration: data.duration,
suggestions: data.words.map((word2) => {
return {
kind: 18,
label: word2,
insertText: word2,
range: { insert, replace }
};
})
};
});
}
};
WorkerManager = class extends Disposable {
constructor(modelService, languageConfigurationService) {
super();
this.languageConfigurationService = languageConfigurationService;
this._modelService = modelService;
this._editorWorkerClient = null;
this._lastWorkerUsedTime = (/* @__PURE__ */ new Date()).getTime();
const stopWorkerInterval = this._register(new WindowIntervalTimer());
stopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);
this._register(this._modelService.onModelRemoved((_) => this._checkStopEmptyWorker()));
}
dispose() {
if (this._editorWorkerClient) {
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
super.dispose();
}
/**
* Check if the model service has no more models and stop the worker if that is the case.
*/
_checkStopEmptyWorker() {
if (!this._editorWorkerClient) {
return;
}
const models = this._modelService.getModels();
if (models.length === 0) {
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
}
/**
* Check if the worker has been idle for a while and then stop it.
*/
_checkStopIdleWorker() {
if (!this._editorWorkerClient) {
return;
}
const timeSinceLastWorkerUsedTime = (/* @__PURE__ */ new Date()).getTime() - this._lastWorkerUsedTime;
if (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
}
withWorker() {
this._lastWorkerUsedTime = (/* @__PURE__ */ new Date()).getTime();
if (!this._editorWorkerClient) {
this._editorWorkerClient = new EditorWorkerClient(this._modelService, false, "editorWorkerService", this.languageConfigurationService);
}
return Promise.resolve(this._editorWorkerClient);
}
};
EditorModelManager = class extends Disposable {
constructor(proxy, modelService, keepIdleModels) {
super();
this._syncedModels = /* @__PURE__ */ Object.create(null);
this._syncedModelsLastUsedTime = /* @__PURE__ */ Object.create(null);
this._proxy = proxy;
this._modelService = modelService;
if (!keepIdleModels) {
const timer = new IntervalTimer();
timer.cancelAndSet(() => this._checkStopModelSync(), Math.round(STOP_SYNC_MODEL_DELTA_TIME_MS / 2));
this._register(timer);
}
}
dispose() {
for (const modelUrl in this._syncedModels) {
dispose(this._syncedModels[modelUrl]);
}
this._syncedModels = /* @__PURE__ */ Object.create(null);
this._syncedModelsLastUsedTime = /* @__PURE__ */ Object.create(null);
super.dispose();
}
ensureSyncedResources(resources, forceLargeModels) {
for (const resource of resources) {
const resourceStr = resource.toString();
if (!this._syncedModels[resourceStr]) {
this._beginModelSync(resource, forceLargeModels);
}
if (this._syncedModels[resourceStr]) {
this._syncedModelsLastUsedTime[resourceStr] = (/* @__PURE__ */ new Date()).getTime();
}
}
}
_checkStopModelSync() {
const currentTime = (/* @__PURE__ */ new Date()).getTime();
const toRemove = [];
for (const modelUrl in this._syncedModelsLastUsedTime) {
const elapsedTime = currentTime - this._syncedModelsLastUsedTime[modelUrl];
if (elapsedTime > STOP_SYNC_MODEL_DELTA_TIME_MS) {
toRemove.push(modelUrl);
}
}
for (const e of toRemove) {
this._stopModelSync(e);
}
}
_beginModelSync(resource, forceLargeModels) {
const model = this._modelService.getModel(resource);
if (!model) {
return;
}
if (!forceLargeModels && model.isTooLargeForSyncing()) {
return;
}
const modelUrl = resource.toString();
this._proxy.acceptNewModel({
url: model.uri.toString(),
lines: model.getLinesContent(),
EOL: model.getEOL(),
versionId: model.getVersionId()
});
const toDispose = new DisposableStore();
toDispose.add(model.onDidChangeContent((e) => {
this._proxy.acceptModelChanged(modelUrl.toString(), e);
}));
toDispose.add(model.onWillDispose(() => {
this._stopModelSync(modelUrl);
}));
toDispose.add(toDisposable(() => {
this._proxy.acceptRemovedModel(modelUrl);
}));
this._syncedModels[modelUrl] = toDispose;
}
_stopModelSync(modelUrl) {
const toDispose = this._syncedModels[modelUrl];
delete this._syncedModels[modelUrl];
delete this._syncedModelsLastUsedTime[modelUrl];
dispose(toDispose);
}
};
SynchronousWorkerClient = class {
constructor(instance) {
this._instance = instance;
this._proxyObj = Promise.resolve(this._instance);
}
dispose() {
this._instance.dispose();
}
getProxyObject() {
return this._proxyObj;
}
};
EditorWorkerHost = class {
constructor(workerClient) {
this._workerClient = workerClient;
}
// foreign host request
fhr(method, args) {
return this._workerClient.fhr(method, args);
}
};
EditorWorkerClient = class extends Disposable {
constructor(modelService, keepIdleModels, label, languageConfigurationService) {
super();
this.languageConfigurationService = languageConfigurationService;
this._disposed = false;
this._modelService = modelService;
this._keepIdleModels = keepIdleModels;
this._workerFactory = new DefaultWorkerFactory(label);
this._worker = null;
this._modelManager = null;
}
// foreign host request
fhr(method, args) {
throw new Error(`Not implemented!`);
}
_getOrCreateWorker() {
if (!this._worker) {
try {
this._worker = this._register(new SimpleWorkerClient(this._workerFactory, "vs/editor/common/services/editorSimpleWorker", new EditorWorkerHost(this)));
} catch (err) {
logOnceWebWorkerWarning(err);
this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));
}
}
return this._worker;
}
_getProxy() {
return this._getOrCreateWorker().getProxyObject().then(void 0, (err) => {
logOnceWebWorkerWarning(err);
this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));
return this._getOrCreateWorker().getProxyObject();
});
}
_getOrCreateModelManager(proxy) {
if (!this._modelManager) {
this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, this._keepIdleModels));
}
return this._modelManager;
}
_withSyncedResources(resources, forceLargeModels = false) {
return __async(this, null, function* () {
if (this._disposed) {
return Promise.reject(canceled());
}
return this._getProxy().then((proxy) => {
this._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);
return proxy;
});
});
}
computedUnicodeHighlights(uri, options2, range2) {
return this._withSyncedResources([uri]).then((proxy) => {
return proxy.computeUnicodeHighlights(uri.toString(), options2, range2);
});
}
computeDiff(original, modified, options2, algorithm) {
return this._withSyncedResources(
[original, modified],
/* forceLargeModels */
true
).then((proxy) => {
return proxy.computeDiff(original.toString(), modified.toString(), options2, algorithm);
});
}
computeMoreMinimalEdits(resource, edits, pretty) {
return this._withSyncedResources([resource]).then((proxy) => {
return proxy.computeMoreMinimalEdits(resource.toString(), edits, pretty);
});
}
computeLinks(resource) {
return this._withSyncedResources([resource]).then((proxy) => {
return proxy.computeLinks(resource.toString());
});
}
computeDefaultDocumentColors(resource) {
return this._withSyncedResources([resource]).then((proxy) => {
return proxy.computeDefaultDocumentColors(resource.toString());
});
}
textualSuggest(resources, leadingWord, wordDefRegExp) {
return __async(this, null, function* () {
const proxy = yield this._withSyncedResources(resources);
const wordDef = wordDefRegExp.source;
const wordDefFlags = wordDefRegExp.flags;
return proxy.textualSuggest(resources.map((r) => r.toString()), leadingWord, wordDef, wordDefFlags);
});
}
computeWordRanges(resource, range2) {
return this._withSyncedResources([resource]).then((proxy) => {
const model = this._modelService.getModel(resource);
if (!model) {
return Promise.resolve(null);
}
const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();
const wordDef = wordDefRegExp.source;
const wordDefFlags = wordDefRegExp.flags;
return proxy.computeWordRanges(resource.toString(), range2, wordDef, wordDefFlags);
});
}
navigateValueSet(resource, range2, up) {
return this._withSyncedResources([resource]).then((proxy) => {
const model = this._modelService.getModel(resource);
if (!model) {
return null;
}
const wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();
const wordDef = wordDefRegExp.source;
const wordDefFlags = wordDefRegExp.flags;
return proxy.navigateValueSet(resource.toString(), range2, up, wordDef, wordDefFlags);
});
}
findSectionHeaders(uri, options2) {
return this._withSyncedResources([uri]).then((proxy) => {
return proxy.findSectionHeaders(uri.toString(), options2);
});
}
dispose() {
super.dispose();
this._disposed = true;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/webWorker.js
function createWebWorker(modelService, languageConfigurationService, opts) {
return new MonacoWebWorkerImpl(modelService, languageConfigurationService, opts);
}
var MonacoWebWorkerImpl;
var init_webWorker = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/webWorker.js"() {
init_objects();
init_editorWorkerService();
MonacoWebWorkerImpl = class extends EditorWorkerClient {
constructor(modelService, languageConfigurationService, opts) {
super(modelService, opts.keepIdleModels || false, opts.label, languageConfigurationService);
this._foreignModuleId = opts.moduleId;
this._foreignModuleCreateData = opts.createData || null;
this._foreignModuleHost = opts.host || null;
this._foreignProxy = null;
}
// foreign host request
fhr(method, args) {
if (!this._foreignModuleHost || typeof this._foreignModuleHost[method] !== "function") {
return Promise.reject(new Error("Missing method " + method + " or missing main thread foreign host."));
}
try {
return Promise.resolve(this._foreignModuleHost[method].apply(this._foreignModuleHost, args));
} catch (e) {
return Promise.reject(e);
}
}
_getForeignProxy() {
if (!this._foreignProxy) {
this._foreignProxy = this._getProxy().then((proxy) => {
const foreignHostMethods = this._foreignModuleHost ? getAllMethodNames(this._foreignModuleHost) : [];
return proxy.loadForeignModule(this._foreignModuleId, this._foreignModuleCreateData, foreignHostMethods).then((foreignMethods) => {
this._foreignModuleCreateData = null;
const proxyMethodRequest = (method, args) => {
return proxy.fmr(method, args);
};
const createProxyMethod = (method, proxyMethodRequest2) => {
return function() {
const args = Array.prototype.slice.call(arguments, 0);
return proxyMethodRequest2(method, args);
};
};
const foreignProxy = {};
for (const foreignMethod of foreignMethods) {
foreignProxy[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);
}
return foreignProxy;
});
});
}
return this._foreignProxy;
}
getProxy() {
return this._getForeignProxy();
}
withSyncedResources(resources) {
return this._withSyncedResources(resources).then((_) => this.getProxy());
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js
var EditorType;
var init_editorCommon = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js"() {
EditorType = {
ICodeEditor: "vs.editor.ICodeEditor",
IDiffEditor: "vs.editor.IDiffEditor"
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/nullTokenize.js
function nullTokenize(languageId, state) {
return new TokenizationResult([new Token(0, "", languageId)], state);
}
function nullTokenizeEncoded(languageId, state) {
const tokens = new Uint32Array(2);
tokens[0] = 0;
tokens[1] = (languageId << 0 | 0 << 8 | 0 << 11 | 1 << 15 | 2 << 24) >>> 0;
return new EncodedTokenizationResult(tokens, state === null ? NullState : state);
}
var NullState;
var init_nullTokenize = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/nullTokenize.js"() {
init_languages();
NullState = new class {
clone() {
return this;
}
equals(other) {
return this === other;
}
}();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/encodedTokenAttributes.js
var TokenMetadata;
var init_encodedTokenAttributes = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/encodedTokenAttributes.js"() {
TokenMetadata = class {
static getLanguageId(metadata) {
return (metadata & 255) >>> 0;
}
static getTokenType(metadata) {
return (metadata & 768) >>> 8;
}
static containsBalancedBrackets(metadata) {
return (metadata & 1024) !== 0;
}
static getFontStyle(metadata) {
return (metadata & 30720) >>> 11;
}
static getForeground(metadata) {
return (metadata & 16744448) >>> 15;
}
static getBackground(metadata) {
return (metadata & 4278190080) >>> 24;
}
static getClassNameFromMetadata(metadata) {
const foreground2 = this.getForeground(metadata);
let className = "mtk" + foreground2;
const fontStyle = this.getFontStyle(metadata);
if (fontStyle & 1) {
className += " mtki";
}
if (fontStyle & 2) {
className += " mtkb";
}
if (fontStyle & 4) {
className += " mtku";
}
if (fontStyle & 8) {
className += " mtks";
}
return className;
}
static getInlineStyleFromMetadata(metadata, colorMap) {
const foreground2 = this.getForeground(metadata);
const fontStyle = this.getFontStyle(metadata);
let result = `color: ${colorMap[foreground2]};`;
if (fontStyle & 1) {
result += "font-style: italic;";
}
if (fontStyle & 2) {
result += "font-weight: bold;";
}
let textDecoration = "";
if (fontStyle & 4) {
textDecoration += " underline";
}
if (fontStyle & 8) {
textDecoration += " line-through";
}
if (textDecoration) {
result += `text-decoration:${textDecoration};`;
}
return result;
}
static getPresentationFromMetadata(metadata) {
const foreground2 = this.getForeground(metadata);
const fontStyle = this.getFontStyle(metadata);
return {
foreground: foreground2,
italic: Boolean(
fontStyle & 1
/* FontStyle.Italic */
),
bold: Boolean(
fontStyle & 2
/* FontStyle.Bold */
),
underline: Boolean(
fontStyle & 4
/* FontStyle.Underline */
),
strikethrough: Boolean(
fontStyle & 8
/* FontStyle.Strikethrough */
)
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/lineTokens.js
function getStandardTokenTypeAtPosition(model, position) {
const lineNumber = position.lineNumber;
if (!model.tokenization.isCheapToTokenize(lineNumber)) {
return void 0;
}
model.tokenization.forceTokenization(lineNumber);
const lineTokens = model.tokenization.getLineTokens(lineNumber);
const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
const tokenType = lineTokens.getStandardTokenType(tokenIndex);
return tokenType;
}
var LineTokens, SliceLineTokens;
var init_lineTokens = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/lineTokens.js"() {
init_encodedTokenAttributes();
LineTokens = class _LineTokens {
static createEmpty(lineContent, decoder) {
const defaultMetadata = _LineTokens.defaultTokenMetadata;
const tokens = new Uint32Array(2);
tokens[0] = lineContent.length;
tokens[1] = defaultMetadata;
return new _LineTokens(tokens, lineContent, decoder);
}
static createFromTextAndMetadata(data, decoder) {
let offset = 0;
let fullText = "";
const tokens = new Array();
for (const { text: text2, metadata } of data) {
tokens.push(offset + text2.length, metadata);
offset += text2.length;
fullText += text2;
}
return new _LineTokens(new Uint32Array(tokens), fullText, decoder);
}
constructor(tokens, text2, decoder) {
this._lineTokensBrand = void 0;
this._tokens = tokens;
this._tokensCount = this._tokens.length >>> 1;
this._text = text2;
this.languageIdCodec = decoder;
}
equals(other) {
if (other instanceof _LineTokens) {
return this.slicedEquals(other, 0, this._tokensCount);
}
return false;
}
slicedEquals(other, sliceFromTokenIndex, sliceTokenCount) {
if (this._text !== other._text) {
return false;
}
if (this._tokensCount !== other._tokensCount) {
return false;
}
const from = sliceFromTokenIndex << 1;
const to = from + (sliceTokenCount << 1);
for (let i = from; i < to; i++) {
if (this._tokens[i] !== other._tokens[i]) {
return false;
}
}
return true;
}
getLineContent() {
return this._text;
}
getCount() {
return this._tokensCount;
}
getStartOffset(tokenIndex) {
if (tokenIndex > 0) {
return this._tokens[tokenIndex - 1 << 1];
}
return 0;
}
getMetadata(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return metadata;
}
getLanguageId(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
const languageId = TokenMetadata.getLanguageId(metadata);
return this.languageIdCodec.decodeLanguageId(languageId);
}
getStandardTokenType(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return TokenMetadata.getTokenType(metadata);
}
getForeground(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return TokenMetadata.getForeground(metadata);
}
getClassName(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return TokenMetadata.getClassNameFromMetadata(metadata);
}
getInlineStyle(tokenIndex, colorMap) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return TokenMetadata.getInlineStyleFromMetadata(metadata, colorMap);
}
getPresentation(tokenIndex) {
const metadata = this._tokens[(tokenIndex << 1) + 1];
return TokenMetadata.getPresentationFromMetadata(metadata);
}
getEndOffset(tokenIndex) {
return this._tokens[tokenIndex << 1];
}
/**
* Find the token containing offset `offset`.
* @param offset The search offset
* @return The index of the token containing the offset.
*/
findTokenIndexAtOffset(offset) {
return _LineTokens.findIndexInTokensArray(this._tokens, offset);
}
inflate() {
return this;
}
sliceAndInflate(startOffset, endOffset, deltaOffset) {
return new SliceLineTokens(this, startOffset, endOffset, deltaOffset);
}
static convertToEndOffset(tokens, lineTextLength) {
const tokenCount = tokens.length >>> 1;
const lastTokenIndex = tokenCount - 1;
for (let tokenIndex = 0; tokenIndex < lastTokenIndex; tokenIndex++) {
tokens[tokenIndex << 1] = tokens[tokenIndex + 1 << 1];
}
tokens[lastTokenIndex << 1] = lineTextLength;
}
static findIndexInTokensArray(tokens, desiredIndex) {
if (tokens.length <= 2) {
return 0;
}
let low = 0;
let high = (tokens.length >>> 1) - 1;
while (low < high) {
const mid = low + Math.floor((high - low) / 2);
const endOffset = tokens[mid << 1];
if (endOffset === desiredIndex) {
return mid + 1;
} else if (endOffset < desiredIndex) {
low = mid + 1;
} else if (endOffset > desiredIndex) {
high = mid;
}
}
return low;
}
/**
* @pure
* @param insertTokens Must be sorted by offset.
*/
withInserted(insertTokens) {
if (insertTokens.length === 0) {
return this;
}
let nextOriginalTokenIdx = 0;
let nextInsertTokenIdx = 0;
let text2 = "";
const newTokens = new Array();
let originalEndOffset = 0;
while (true) {
const nextOriginalTokenEndOffset = nextOriginalTokenIdx < this._tokensCount ? this._tokens[nextOriginalTokenIdx << 1] : -1;
const nextInsertToken = nextInsertTokenIdx < insertTokens.length ? insertTokens[nextInsertTokenIdx] : null;
if (nextOriginalTokenEndOffset !== -1 && (nextInsertToken === null || nextOriginalTokenEndOffset <= nextInsertToken.offset)) {
text2 += this._text.substring(originalEndOffset, nextOriginalTokenEndOffset);
const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];
newTokens.push(text2.length, metadata);
nextOriginalTokenIdx++;
originalEndOffset = nextOriginalTokenEndOffset;
} else if (nextInsertToken) {
if (nextInsertToken.offset > originalEndOffset) {
text2 += this._text.substring(originalEndOffset, nextInsertToken.offset);
const metadata = this._tokens[(nextOriginalTokenIdx << 1) + 1];
newTokens.push(text2.length, metadata);
originalEndOffset = nextInsertToken.offset;
}
text2 += nextInsertToken.text;
newTokens.push(text2.length, nextInsertToken.tokenMetadata);
nextInsertTokenIdx++;
} else {
break;
}
}
return new _LineTokens(new Uint32Array(newTokens), text2, this.languageIdCodec);
}
getTokenText(tokenIndex) {
const startOffset = this.getStartOffset(tokenIndex);
const endOffset = this.getEndOffset(tokenIndex);
const text2 = this._text.substring(startOffset, endOffset);
return text2;
}
forEach(callback) {
const tokenCount = this.getCount();
for (let tokenIndex = 0; tokenIndex < tokenCount; tokenIndex++) {
callback(tokenIndex);
}
}
};
LineTokens.defaultTokenMetadata = (0 << 11 | 1 << 15 | 2 << 24) >>> 0;
SliceLineTokens = class _SliceLineTokens {
constructor(source, startOffset, endOffset, deltaOffset) {
this._source = source;
this._startOffset = startOffset;
this._endOffset = endOffset;
this._deltaOffset = deltaOffset;
this._firstTokenIndex = source.findTokenIndexAtOffset(startOffset);
this.languageIdCodec = source.languageIdCodec;
this._tokensCount = 0;
for (let i = this._firstTokenIndex, len = source.getCount(); i < len; i++) {
const tokenStartOffset = source.getStartOffset(i);
if (tokenStartOffset >= endOffset) {
break;
}
this._tokensCount++;
}
}
getMetadata(tokenIndex) {
return this._source.getMetadata(this._firstTokenIndex + tokenIndex);
}
getLanguageId(tokenIndex) {
return this._source.getLanguageId(this._firstTokenIndex + tokenIndex);
}
getLineContent() {
return this._source.getLineContent().substring(this._startOffset, this._endOffset);
}
equals(other) {
if (other instanceof _SliceLineTokens) {
return this._startOffset === other._startOffset && this._endOffset === other._endOffset && this._deltaOffset === other._deltaOffset && this._source.slicedEquals(other._source, this._firstTokenIndex, this._tokensCount);
}
return false;
}
getCount() {
return this._tokensCount;
}
getStandardTokenType(tokenIndex) {
return this._source.getStandardTokenType(this._firstTokenIndex + tokenIndex);
}
getForeground(tokenIndex) {
return this._source.getForeground(this._firstTokenIndex + tokenIndex);
}
getEndOffset(tokenIndex) {
const tokenEndOffset = this._source.getEndOffset(this._firstTokenIndex + tokenIndex);
return Math.min(this._endOffset, tokenEndOffset) - this._startOffset + this._deltaOffset;
}
getClassName(tokenIndex) {
return this._source.getClassName(this._firstTokenIndex + tokenIndex);
}
getInlineStyle(tokenIndex, colorMap) {
return this._source.getInlineStyle(this._firstTokenIndex + tokenIndex, colorMap);
}
getPresentation(tokenIndex) {
return this._source.getPresentation(this._firstTokenIndex + tokenIndex);
}
findTokenIndexAtOffset(offset) {
return this._source.findTokenIndexAtOffset(offset + this._startOffset - this._deltaOffset) - this._firstTokenIndex;
}
getTokenText(tokenIndex) {
const adjustedTokenIndex = this._firstTokenIndex + tokenIndex;
const tokenStartOffset = this._source.getStartOffset(adjustedTokenIndex);
const tokenEndOffset = this._source.getEndOffset(adjustedTokenIndex);
let text2 = this._source.getTokenText(adjustedTokenIndex);
if (tokenStartOffset < this._startOffset) {
text2 = text2.substring(this._startOffset - tokenStartOffset);
}
if (tokenEndOffset > this._endOffset) {
text2 = text2.substring(0, text2.length - (tokenEndOffset - this._endOffset));
}
return text2;
}
forEach(callback) {
for (let tokenIndex = 0; tokenIndex < this.getCount(); tokenIndex++) {
callback(tokenIndex);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/lineDecorations.js
var LineDecoration, DecorationSegment, Stack, LineDecorationsNormalizer;
var init_lineDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/lineDecorations.js"() {
init_strings();
LineDecoration = class _LineDecoration {
constructor(startColumn, endColumn, className, type) {
this.startColumn = startColumn;
this.endColumn = endColumn;
this.className = className;
this.type = type;
this._lineDecorationBrand = void 0;
}
static _equals(a3, b) {
return a3.startColumn === b.startColumn && a3.endColumn === b.endColumn && a3.className === b.className && a3.type === b.type;
}
static equalsArr(a3, b) {
const aLen = a3.length;
const bLen = b.length;
if (aLen !== bLen) {
return false;
}
for (let i = 0; i < aLen; i++) {
if (!_LineDecoration._equals(a3[i], b[i])) {
return false;
}
}
return true;
}
static extractWrapped(arr, startOffset, endOffset) {
if (arr.length === 0) {
return arr;
}
const startColumn = startOffset + 1;
const endColumn = endOffset + 1;
const lineLength = endOffset - startOffset;
const r = [];
let rLength = 0;
for (const dec of arr) {
if (dec.endColumn <= startColumn || dec.startColumn >= endColumn) {
continue;
}
r[rLength++] = new _LineDecoration(Math.max(1, dec.startColumn - startColumn + 1), Math.min(lineLength + 1, dec.endColumn - startColumn + 1), dec.className, dec.type);
}
return r;
}
static filter(lineDecorations, lineNumber, minLineColumn, maxLineColumn) {
if (lineDecorations.length === 0) {
return [];
}
const result = [];
let resultLen = 0;
for (let i = 0, len = lineDecorations.length; i < len; i++) {
const d = lineDecorations[i];
const range2 = d.range;
if (range2.endLineNumber < lineNumber || range2.startLineNumber > lineNumber) {
continue;
}
if (range2.isEmpty() && (d.type === 0 || d.type === 3)) {
continue;
}
const startColumn = range2.startLineNumber === lineNumber ? range2.startColumn : minLineColumn;
const endColumn = range2.endLineNumber === lineNumber ? range2.endColumn : maxLineColumn;
result[resultLen++] = new _LineDecoration(startColumn, endColumn, d.inlineClassName, d.type);
}
return result;
}
static _typeCompare(a3, b) {
const ORDER = [2, 0, 1, 3];
return ORDER[a3] - ORDER[b];
}
static compare(a3, b) {
if (a3.startColumn !== b.startColumn) {
return a3.startColumn - b.startColumn;
}
if (a3.endColumn !== b.endColumn) {
return a3.endColumn - b.endColumn;
}
const typeCmp = _LineDecoration._typeCompare(a3.type, b.type);
if (typeCmp !== 0) {
return typeCmp;
}
if (a3.className !== b.className) {
return a3.className < b.className ? -1 : 1;
}
return 0;
}
};
DecorationSegment = class {
constructor(startOffset, endOffset, className, metadata) {
this.startOffset = startOffset;
this.endOffset = endOffset;
this.className = className;
this.metadata = metadata;
}
};
Stack = class _Stack {
constructor() {
this.stopOffsets = [];
this.classNames = [];
this.metadata = [];
this.count = 0;
}
static _metadata(metadata) {
let result = 0;
for (let i = 0, len = metadata.length; i < len; i++) {
result |= metadata[i];
}
return result;
}
consumeLowerThan(maxStopOffset, nextStartOffset, result) {
while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {
let i = 0;
while (i + 1 < this.count && this.stopOffsets[i] === this.stopOffsets[i + 1]) {
i++;
}
result.push(new DecorationSegment(nextStartOffset, this.stopOffsets[i], this.classNames.join(" "), _Stack._metadata(this.metadata)));
nextStartOffset = this.stopOffsets[i] + 1;
this.stopOffsets.splice(0, i + 1);
this.classNames.splice(0, i + 1);
this.metadata.splice(0, i + 1);
this.count -= i + 1;
}
if (this.count > 0 && nextStartOffset < maxStopOffset) {
result.push(new DecorationSegment(nextStartOffset, maxStopOffset - 1, this.classNames.join(" "), _Stack._metadata(this.metadata)));
nextStartOffset = maxStopOffset;
}
return nextStartOffset;
}
insert(stopOffset, className, metadata) {
if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {
this.stopOffsets.push(stopOffset);
this.classNames.push(className);
this.metadata.push(metadata);
} else {
for (let i = 0; i < this.count; i++) {
if (this.stopOffsets[i] >= stopOffset) {
this.stopOffsets.splice(i, 0, stopOffset);
this.classNames.splice(i, 0, className);
this.metadata.splice(i, 0, metadata);
break;
}
}
}
this.count++;
return;
}
};
LineDecorationsNormalizer = class {
/**
* Normalize line decorations. Overlapping decorations will generate multiple segments
*/
static normalize(lineContent, lineDecorations) {
if (lineDecorations.length === 0) {
return [];
}
const result = [];
const stack = new Stack();
let nextStartOffset = 0;
for (let i = 0, len = lineDecorations.length; i < len; i++) {
const d = lineDecorations[i];
let startColumn = d.startColumn;
let endColumn = d.endColumn;
const className = d.className;
const metadata = d.type === 1 ? 2 : d.type === 2 ? 4 : 0;
if (startColumn > 1) {
const charCodeBefore = lineContent.charCodeAt(startColumn - 2);
if (isHighSurrogate(charCodeBefore)) {
startColumn--;
}
}
if (endColumn > 1) {
const charCodeBefore = lineContent.charCodeAt(endColumn - 2);
if (isHighSurrogate(charCodeBefore)) {
endColumn--;
}
}
const currentStartOffset = startColumn - 1;
const currentEndOffset = endColumn - 2;
nextStartOffset = stack.consumeLowerThan(currentStartOffset, nextStartOffset, result);
if (stack.count === 0) {
nextStartOffset = currentStartOffset;
}
stack.insert(currentEndOffset, className, metadata);
}
stack.consumeLowerThan(1073741824, nextStartOffset, result);
return result;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linePart.js
var LinePart;
var init_linePart = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linePart.js"() {
LinePart = class {
constructor(endIndex, type, metadata, containsRTL2) {
this.endIndex = endIndex;
this.type = type;
this.metadata = metadata;
this.containsRTL = containsRTL2;
this._linePartBrand = void 0;
}
isWhitespace() {
return this.metadata & 1 ? true : false;
}
isPseudoAfter() {
return this.metadata & 4 ? true : false;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js
function renderViewLine(input, sb) {
if (input.lineContent.length === 0) {
if (input.lineDecorations.length > 0) {
sb.appendString(``);
let beforeCount = 0;
let afterCount = 0;
let containsForeignElements = 0;
for (const lineDecoration of input.lineDecorations) {
if (lineDecoration.type === 1 || lineDecoration.type === 2) {
sb.appendString(``);
if (lineDecoration.type === 1) {
containsForeignElements |= 1;
beforeCount++;
}
if (lineDecoration.type === 2) {
containsForeignElements |= 2;
afterCount++;
}
}
}
sb.appendString(``);
const characterMapping = new CharacterMapping(1, beforeCount + afterCount);
characterMapping.setColumnInfo(1, beforeCount, 0, 0);
return new RenderLineOutput(characterMapping, false, containsForeignElements);
}
sb.appendString("");
return new RenderLineOutput(
new CharacterMapping(0, 0),
false,
0
/* ForeignElementType.None */
);
}
return _renderLine(resolveRenderLineInput(input), sb);
}
function renderViewLine2(input) {
const sb = new StringBuilder(1e4);
const out = renderViewLine(input, sb);
return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);
}
function resolveRenderLineInput(input) {
const lineContent = input.lineContent;
let isOverflowing;
let overflowingCharCount;
let len;
if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {
isOverflowing = true;
overflowingCharCount = lineContent.length - input.stopRenderingLineAfter;
len = input.stopRenderingLineAfter;
} else {
isOverflowing = false;
overflowingCharCount = 0;
len = lineContent.length;
}
let tokens = transformAndRemoveOverflowing(lineContent, input.containsRTL, input.lineTokens, input.fauxIndentLength, len);
if (input.renderControlCharacters && !input.isBasicASCII) {
tokens = extractControlCharacters(lineContent, tokens);
}
if (input.renderWhitespace === 4 || input.renderWhitespace === 1 || input.renderWhitespace === 2 && !!input.selectionsOnLine || input.renderWhitespace === 3 && !input.continuesWithWrappedLine) {
tokens = _applyRenderWhitespace(input, lineContent, len, tokens);
}
let containsForeignElements = 0;
if (input.lineDecorations.length > 0) {
for (let i = 0, len2 = input.lineDecorations.length; i < len2; i++) {
const lineDecoration = input.lineDecorations[i];
if (lineDecoration.type === 3) {
containsForeignElements |= 1;
} else if (lineDecoration.type === 1) {
containsForeignElements |= 1;
} else if (lineDecoration.type === 2) {
containsForeignElements |= 2;
}
}
tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);
}
if (!input.containsRTL) {
tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);
}
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);
}
function transformAndRemoveOverflowing(lineContent, lineContainsRTL, tokens, fauxIndentLength, len) {
const result = [];
let resultLen = 0;
if (fauxIndentLength > 0) {
result[resultLen++] = new LinePart(fauxIndentLength, "", 0, false);
}
let startOffset = fauxIndentLength;
for (let tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {
const endIndex = tokens.getEndOffset(tokenIndex);
if (endIndex <= fauxIndentLength) {
continue;
}
const type = tokens.getClassName(tokenIndex);
if (endIndex >= len) {
const tokenContainsRTL2 = lineContainsRTL ? containsRTL(lineContent.substring(startOffset, len)) : false;
result[resultLen++] = new LinePart(len, type, 0, tokenContainsRTL2);
break;
}
const tokenContainsRTL = lineContainsRTL ? containsRTL(lineContent.substring(startOffset, endIndex)) : false;
result[resultLen++] = new LinePart(endIndex, type, 0, tokenContainsRTL);
startOffset = endIndex;
}
return result;
}
function splitLargeTokens(lineContent, tokens, onlyAtSpaces) {
let lastTokenEndIndex = 0;
const result = [];
let resultLen = 0;
if (onlyAtSpaces) {
for (let i = 0, len = tokens.length; i < len; i++) {
const token = tokens[i];
const tokenEndIndex = token.endIndex;
if (lastTokenEndIndex + 50 < tokenEndIndex) {
const tokenType = token.type;
const tokenMetadata = token.metadata;
const tokenContainsRTL = token.containsRTL;
let lastSpaceOffset = -1;
let currTokenStart = lastTokenEndIndex;
for (let j = lastTokenEndIndex; j < tokenEndIndex; j++) {
if (lineContent.charCodeAt(j) === 32) {
lastSpaceOffset = j;
}
if (lastSpaceOffset !== -1 && j - currTokenStart >= 50) {
result[resultLen++] = new LinePart(lastSpaceOffset + 1, tokenType, tokenMetadata, tokenContainsRTL);
currTokenStart = lastSpaceOffset + 1;
lastSpaceOffset = -1;
}
}
if (currTokenStart !== tokenEndIndex) {
result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);
}
} else {
result[resultLen++] = token;
}
lastTokenEndIndex = tokenEndIndex;
}
} else {
for (let i = 0, len = tokens.length; i < len; i++) {
const token = tokens[i];
const tokenEndIndex = token.endIndex;
const diff = tokenEndIndex - lastTokenEndIndex;
if (diff > 50) {
const tokenType = token.type;
const tokenMetadata = token.metadata;
const tokenContainsRTL = token.containsRTL;
const piecesCount = Math.ceil(
diff / 50
/* Constants.LongToken */
);
for (let j = 1; j < piecesCount; j++) {
const pieceEndIndex = lastTokenEndIndex + j * 50;
result[resultLen++] = new LinePart(pieceEndIndex, tokenType, tokenMetadata, tokenContainsRTL);
}
result[resultLen++] = new LinePart(tokenEndIndex, tokenType, tokenMetadata, tokenContainsRTL);
} else {
result[resultLen++] = token;
}
lastTokenEndIndex = tokenEndIndex;
}
}
return result;
}
function isControlCharacter(charCode) {
if (charCode < 32) {
return charCode !== 9;
}
if (charCode === 127) {
return true;
}
if (charCode >= 8234 && charCode <= 8238 || charCode >= 8294 && charCode <= 8297 || charCode >= 8206 && charCode <= 8207 || charCode === 1564) {
return true;
}
return false;
}
function extractControlCharacters(lineContent, tokens) {
const result = [];
let lastLinePart = new LinePart(0, "", 0, false);
let charOffset = 0;
for (const token of tokens) {
const tokenEndIndex = token.endIndex;
for (; charOffset < tokenEndIndex; charOffset++) {
const charCode = lineContent.charCodeAt(charOffset);
if (isControlCharacter(charCode)) {
if (charOffset > lastLinePart.endIndex) {
lastLinePart = new LinePart(charOffset, token.type, token.metadata, token.containsRTL);
result.push(lastLinePart);
}
lastLinePart = new LinePart(charOffset + 1, "mtkcontrol", token.metadata, false);
result.push(lastLinePart);
}
}
if (charOffset > lastLinePart.endIndex) {
lastLinePart = new LinePart(tokenEndIndex, token.type, token.metadata, token.containsRTL);
result.push(lastLinePart);
}
}
return result;
}
function _applyRenderWhitespace(input, lineContent, len, tokens) {
const continuesWithWrappedLine = input.continuesWithWrappedLine;
const fauxIndentLength = input.fauxIndentLength;
const tabSize = input.tabSize;
const startVisibleColumn = input.startVisibleColumn;
const useMonospaceOptimizations = input.useMonospaceOptimizations;
const selections = input.selectionsOnLine;
const onlyBoundary = input.renderWhitespace === 1;
const onlyTrailing = input.renderWhitespace === 3;
const generateLinePartForEachWhitespace = input.renderSpaceWidth !== input.spaceWidth;
const result = [];
let resultLen = 0;
let tokenIndex = 0;
let tokenType = tokens[tokenIndex].type;
let tokenContainsRTL = tokens[tokenIndex].containsRTL;
let tokenEndIndex = tokens[tokenIndex].endIndex;
const tokensLength = tokens.length;
let lineIsEmptyOrWhitespace = false;
let firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(lineContent);
let lastNonWhitespaceIndex2;
if (firstNonWhitespaceIndex2 === -1) {
lineIsEmptyOrWhitespace = true;
firstNonWhitespaceIndex2 = len;
lastNonWhitespaceIndex2 = len;
} else {
lastNonWhitespaceIndex2 = lastNonWhitespaceIndex(lineContent);
}
let wasInWhitespace = false;
let currentSelectionIndex = 0;
let currentSelection = selections && selections[currentSelectionIndex];
let tmpIndent = startVisibleColumn % tabSize;
for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {
const chCode = lineContent.charCodeAt(charIndex);
if (currentSelection && charIndex >= currentSelection.endOffset) {
currentSelectionIndex++;
currentSelection = selections && selections[currentSelectionIndex];
}
let isInWhitespace;
if (charIndex < firstNonWhitespaceIndex2 || charIndex > lastNonWhitespaceIndex2) {
isInWhitespace = true;
} else if (chCode === 9) {
isInWhitespace = true;
} else if (chCode === 32) {
if (onlyBoundary) {
if (wasInWhitespace) {
isInWhitespace = true;
} else {
const nextChCode = charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0;
isInWhitespace = nextChCode === 32 || nextChCode === 9;
}
} else {
isInWhitespace = true;
}
} else {
isInWhitespace = false;
}
if (isInWhitespace && selections) {
isInWhitespace = !!currentSelection && currentSelection.startOffset <= charIndex && currentSelection.endOffset > charIndex;
}
if (isInWhitespace && onlyTrailing) {
isInWhitespace = lineIsEmptyOrWhitespace || charIndex > lastNonWhitespaceIndex2;
}
if (isInWhitespace && tokenContainsRTL) {
if (charIndex >= firstNonWhitespaceIndex2 && charIndex <= lastNonWhitespaceIndex2) {
isInWhitespace = false;
}
}
if (wasInWhitespace) {
if (!isInWhitespace || !useMonospaceOptimizations && tmpIndent >= tabSize) {
if (generateLinePartForEachWhitespace) {
const lastEndIndex = resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength;
for (let i = lastEndIndex + 1; i <= charIndex; i++) {
result[resultLen++] = new LinePart(i, "mtkw", 1, false);
}
} else {
result[resultLen++] = new LinePart(charIndex, "mtkw", 1, false);
}
tmpIndent = tmpIndent % tabSize;
}
} else {
if (charIndex === tokenEndIndex || isInWhitespace && charIndex > fauxIndentLength) {
result[resultLen++] = new LinePart(charIndex, tokenType, 0, tokenContainsRTL);
tmpIndent = tmpIndent % tabSize;
}
}
if (chCode === 9) {
tmpIndent = tabSize;
} else if (isFullWidthCharacter(chCode)) {
tmpIndent += 2;
} else {
tmpIndent++;
}
wasInWhitespace = isInWhitespace;
while (charIndex === tokenEndIndex) {
tokenIndex++;
if (tokenIndex < tokensLength) {
tokenType = tokens[tokenIndex].type;
tokenContainsRTL = tokens[tokenIndex].containsRTL;
tokenEndIndex = tokens[tokenIndex].endIndex;
} else {
break;
}
}
}
let generateWhitespace = false;
if (wasInWhitespace) {
if (continuesWithWrappedLine && onlyBoundary) {
const lastCharCode = len > 0 ? lineContent.charCodeAt(len - 1) : 0;
const prevCharCode = len > 1 ? lineContent.charCodeAt(len - 2) : 0;
const isSingleTrailingSpace = lastCharCode === 32 && (prevCharCode !== 32 && prevCharCode !== 9);
if (!isSingleTrailingSpace) {
generateWhitespace = true;
}
} else {
generateWhitespace = true;
}
}
if (generateWhitespace) {
if (generateLinePartForEachWhitespace) {
const lastEndIndex = resultLen > 0 ? result[resultLen - 1].endIndex : fauxIndentLength;
for (let i = lastEndIndex + 1; i <= len; i++) {
result[resultLen++] = new LinePart(i, "mtkw", 1, false);
}
} else {
result[resultLen++] = new LinePart(len, "mtkw", 1, false);
}
} else {
result[resultLen++] = new LinePart(len, tokenType, 0, tokenContainsRTL);
}
return result;
}
function _applyInlineDecorations(lineContent, len, tokens, _lineDecorations) {
_lineDecorations.sort(LineDecoration.compare);
const lineDecorations = LineDecorationsNormalizer.normalize(lineContent, _lineDecorations);
const lineDecorationsLen = lineDecorations.length;
let lineDecorationIndex = 0;
const result = [];
let resultLen = 0;
let lastResultEndIndex = 0;
for (let tokenIndex = 0, len2 = tokens.length; tokenIndex < len2; tokenIndex++) {
const token = tokens[tokenIndex];
const tokenEndIndex = token.endIndex;
const tokenType = token.type;
const tokenMetadata = token.metadata;
const tokenContainsRTL = token.containsRTL;
while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {
const lineDecoration = lineDecorations[lineDecorationIndex];
if (lineDecoration.startOffset > lastResultEndIndex) {
lastResultEndIndex = lineDecoration.startOffset;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);
}
if (lineDecoration.endOffset + 1 <= tokenEndIndex) {
lastResultEndIndex = lineDecoration.endOffset + 1;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + " " + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);
lineDecorationIndex++;
} else {
lastResultEndIndex = tokenEndIndex;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + " " + lineDecoration.className, tokenMetadata | lineDecoration.metadata, tokenContainsRTL);
break;
}
}
if (tokenEndIndex > lastResultEndIndex) {
lastResultEndIndex = tokenEndIndex;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType, tokenMetadata, tokenContainsRTL);
}
}
const lastTokenEndIndex = tokens[tokens.length - 1].endIndex;
if (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {
while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {
const lineDecoration = lineDecorations[lineDecorationIndex];
result[resultLen++] = new LinePart(lastResultEndIndex, lineDecoration.className, lineDecoration.metadata, false);
lineDecorationIndex++;
}
}
return result;
}
function _renderLine(input, sb) {
const fontIsMonospace = input.fontIsMonospace;
const canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;
const containsForeignElements = input.containsForeignElements;
const lineContent = input.lineContent;
const len = input.len;
const isOverflowing = input.isOverflowing;
const overflowingCharCount = input.overflowingCharCount;
const parts = input.parts;
const fauxIndentLength = input.fauxIndentLength;
const tabSize = input.tabSize;
const startVisibleColumn = input.startVisibleColumn;
const containsRTL2 = input.containsRTL;
const spaceWidth = input.spaceWidth;
const renderSpaceCharCode = input.renderSpaceCharCode;
const renderWhitespace = input.renderWhitespace;
const renderControlCharacters = input.renderControlCharacters;
const characterMapping = new CharacterMapping(len + 1, parts.length);
let lastCharacterMappingDefined = false;
let charIndex = 0;
let visibleColumn = startVisibleColumn;
let charOffsetInPart = 0;
let charHorizontalOffset = 0;
let partDisplacement = 0;
if (containsRTL2) {
sb.appendString('');
} else {
sb.appendString("");
}
for (let partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {
const part = parts[partIndex];
const partEndIndex = part.endIndex;
const partType = part.type;
const partContainsRTL = part.containsRTL;
const partRendersWhitespace = renderWhitespace !== 0 && part.isWhitespace();
const partRendersWhitespaceWithWidth = partRendersWhitespace && !fontIsMonospace && (partType === "mtkw" || !containsForeignElements);
const partIsEmptyAndHasPseudoAfter = charIndex === partEndIndex && part.isPseudoAfter();
charOffsetInPart = 0;
sb.appendString("= fauxIndentLength) {
_visibleColumn += charWidth;
}
}
}
if (partRendersWhitespaceWithWidth) {
sb.appendString(' style="width:');
sb.appendString(String(spaceWidth * partWidth));
sb.appendString('px"');
}
sb.appendASCIICharCode(
62
/* CharCode.GreaterThan */
);
for (; charIndex < partEndIndex; charIndex++) {
characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);
partDisplacement = 0;
const charCode = lineContent.charCodeAt(charIndex);
let producedCharacters;
let charWidth;
if (charCode === 9) {
producedCharacters = tabSize - visibleColumn % tabSize | 0;
charWidth = producedCharacters;
if (!canUseHalfwidthRightwardsArrow || charWidth > 1) {
sb.appendCharCode(8594);
} else {
sb.appendCharCode(65515);
}
for (let space = 2; space <= charWidth; space++) {
sb.appendCharCode(160);
}
} else {
producedCharacters = 2;
charWidth = 1;
sb.appendCharCode(renderSpaceCharCode);
sb.appendCharCode(8204);
}
charOffsetInPart += producedCharacters;
charHorizontalOffset += charWidth;
if (charIndex >= fauxIndentLength) {
visibleColumn += charWidth;
}
}
} else {
sb.appendASCIICharCode(
62
/* CharCode.GreaterThan */
);
for (; charIndex < partEndIndex; charIndex++) {
characterMapping.setColumnInfo(charIndex + 1, partIndex - partDisplacement, charOffsetInPart, charHorizontalOffset);
partDisplacement = 0;
const charCode = lineContent.charCodeAt(charIndex);
let producedCharacters = 1;
let charWidth = 1;
switch (charCode) {
case 9:
producedCharacters = tabSize - visibleColumn % tabSize;
charWidth = producedCharacters;
for (let space = 1; space <= producedCharacters; space++) {
sb.appendCharCode(160);
}
break;
case 32:
sb.appendCharCode(160);
break;
case 60:
sb.appendString("<");
break;
case 62:
sb.appendString(">");
break;
case 38:
sb.appendString("&");
break;
case 0:
if (renderControlCharacters) {
sb.appendCharCode(9216);
} else {
sb.appendString("");
}
break;
case 65279:
case 8232:
case 8233:
case 133:
sb.appendCharCode(65533);
break;
default:
if (isFullWidthCharacter(charCode)) {
charWidth++;
}
if (renderControlCharacters && charCode < 32) {
sb.appendCharCode(9216 + charCode);
} else if (renderControlCharacters && charCode === 127) {
sb.appendCharCode(9249);
} else if (renderControlCharacters && isControlCharacter(charCode)) {
sb.appendString("[U+");
sb.appendString(to4CharHex(charCode));
sb.appendString("]");
producedCharacters = 8;
charWidth = producedCharacters;
} else {
sb.appendCharCode(charCode);
}
}
charOffsetInPart += producedCharacters;
charHorizontalOffset += charWidth;
if (charIndex >= fauxIndentLength) {
visibleColumn += charWidth;
}
}
}
if (partIsEmptyAndHasPseudoAfter) {
partDisplacement++;
} else {
partDisplacement = 0;
}
if (charIndex >= len && !lastCharacterMappingDefined && part.isPseudoAfter()) {
lastCharacterMappingDefined = true;
characterMapping.setColumnInfo(charIndex + 1, partIndex, charOffsetInPart, charHorizontalOffset);
}
sb.appendString("");
}
if (!lastCharacterMappingDefined) {
characterMapping.setColumnInfo(len + 1, parts.length - 1, charOffsetInPart, charHorizontalOffset);
}
if (isOverflowing) {
sb.appendString('');
sb.appendString(localize("showMore", "Show more ({0})", renderOverflowingCharCount(overflowingCharCount)));
sb.appendString("");
}
sb.appendString("");
return new RenderLineOutput(characterMapping, containsRTL2, containsForeignElements);
}
function to4CharHex(n) {
return n.toString(16).toUpperCase().padStart(4, "0");
}
function renderOverflowingCharCount(n) {
if (n < 1024) {
return localize("overflow.chars", "{0} chars", n);
}
if (n < 1024 * 1024) {
return `${(n / 1024).toFixed(1)} KB`;
}
return `${(n / 1024 / 1024).toFixed(1)} MB`;
}
var LineRange2, RenderLineInput, DomPosition, CharacterMapping, RenderLineOutput, RenderLineOutput2, ResolvedRenderLineInput;
var init_viewLineRenderer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js"() {
init_nls();
init_strings();
init_stringBuilder();
init_lineDecorations();
init_linePart();
LineRange2 = class {
constructor(startIndex, endIndex) {
this.startOffset = startIndex;
this.endOffset = endIndex;
}
equals(otherLineRange) {
return this.startOffset === otherLineRange.startOffset && this.endOffset === otherLineRange.endOffset;
}
};
RenderLineInput = class {
constructor(useMonospaceOptimizations, canUseHalfwidthRightwardsArrow, lineContent, continuesWithWrappedLine, isBasicASCII2, containsRTL2, fauxIndentLength, lineTokens, lineDecorations, tabSize, startVisibleColumn, spaceWidth, middotWidth, wsmiddotWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures, selectionsOnLine) {
this.useMonospaceOptimizations = useMonospaceOptimizations;
this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;
this.lineContent = lineContent;
this.continuesWithWrappedLine = continuesWithWrappedLine;
this.isBasicASCII = isBasicASCII2;
this.containsRTL = containsRTL2;
this.fauxIndentLength = fauxIndentLength;
this.lineTokens = lineTokens;
this.lineDecorations = lineDecorations.sort(LineDecoration.compare);
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
this.spaceWidth = spaceWidth;
this.stopRenderingLineAfter = stopRenderingLineAfter;
this.renderWhitespace = renderWhitespace === "all" ? 4 : renderWhitespace === "boundary" ? 1 : renderWhitespace === "selection" ? 2 : renderWhitespace === "trailing" ? 3 : 0;
this.renderControlCharacters = renderControlCharacters;
this.fontLigatures = fontLigatures;
this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a3, b) => a3.startOffset < b.startOffset ? -1 : 1);
const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);
const middotDiff = Math.abs(middotWidth - spaceWidth);
if (wsmiddotDiff < middotDiff) {
this.renderSpaceWidth = wsmiddotWidth;
this.renderSpaceCharCode = 11825;
} else {
this.renderSpaceWidth = middotWidth;
this.renderSpaceCharCode = 183;
}
}
sameSelection(otherSelections) {
if (this.selectionsOnLine === null) {
return otherSelections === null;
}
if (otherSelections === null) {
return false;
}
if (otherSelections.length !== this.selectionsOnLine.length) {
return false;
}
for (let i = 0; i < this.selectionsOnLine.length; i++) {
if (!this.selectionsOnLine[i].equals(otherSelections[i])) {
return false;
}
}
return true;
}
equals(other) {
return this.useMonospaceOptimizations === other.useMonospaceOptimizations && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.lineContent === other.lineContent && this.continuesWithWrappedLine === other.continuesWithWrappedLine && this.isBasicASCII === other.isBasicASCII && this.containsRTL === other.containsRTL && this.fauxIndentLength === other.fauxIndentLength && this.tabSize === other.tabSize && this.startVisibleColumn === other.startVisibleColumn && this.spaceWidth === other.spaceWidth && this.renderSpaceWidth === other.renderSpaceWidth && this.renderSpaceCharCode === other.renderSpaceCharCode && this.stopRenderingLineAfter === other.stopRenderingLineAfter && this.renderWhitespace === other.renderWhitespace && this.renderControlCharacters === other.renderControlCharacters && this.fontLigatures === other.fontLigatures && LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations) && this.lineTokens.equals(other.lineTokens) && this.sameSelection(other.selectionsOnLine);
}
};
DomPosition = class {
constructor(partIndex, charIndex) {
this.partIndex = partIndex;
this.charIndex = charIndex;
}
};
CharacterMapping = class _CharacterMapping {
static getPartIndex(partData) {
return (partData & 4294901760) >>> 16;
}
static getCharIndex(partData) {
return (partData & 65535) >>> 0;
}
constructor(length, partCount) {
this.length = length;
this._data = new Uint32Array(this.length);
this._horizontalOffset = new Uint32Array(this.length);
}
setColumnInfo(column, partIndex, charIndex, horizontalOffset) {
const partData = (partIndex << 16 | charIndex << 0) >>> 0;
this._data[column - 1] = partData;
this._horizontalOffset[column - 1] = horizontalOffset;
}
getHorizontalOffset(column) {
if (this._horizontalOffset.length === 0) {
return 0;
}
return this._horizontalOffset[column - 1];
}
charOffsetToPartData(charOffset) {
if (this.length === 0) {
return 0;
}
if (charOffset < 0) {
return this._data[0];
}
if (charOffset >= this.length) {
return this._data[this.length - 1];
}
return this._data[charOffset];
}
getDomPosition(column) {
const partData = this.charOffsetToPartData(column - 1);
const partIndex = _CharacterMapping.getPartIndex(partData);
const charIndex = _CharacterMapping.getCharIndex(partData);
return new DomPosition(partIndex, charIndex);
}
getColumn(domPosition, partLength) {
const charOffset = this.partDataToCharOffset(domPosition.partIndex, partLength, domPosition.charIndex);
return charOffset + 1;
}
partDataToCharOffset(partIndex, partLength, charIndex) {
if (this.length === 0) {
return 0;
}
const searchEntry = (partIndex << 16 | charIndex << 0) >>> 0;
let min = 0;
let max = this.length - 1;
while (min + 1 < max) {
const mid = min + max >>> 1;
const midEntry = this._data[mid];
if (midEntry === searchEntry) {
return mid;
} else if (midEntry > searchEntry) {
max = mid;
} else {
min = mid;
}
}
if (min === max) {
return min;
}
const minEntry = this._data[min];
const maxEntry = this._data[max];
if (minEntry === searchEntry) {
return min;
}
if (maxEntry === searchEntry) {
return max;
}
const minPartIndex = _CharacterMapping.getPartIndex(minEntry);
const minCharIndex = _CharacterMapping.getCharIndex(minEntry);
const maxPartIndex = _CharacterMapping.getPartIndex(maxEntry);
let maxCharIndex;
if (minPartIndex !== maxPartIndex) {
maxCharIndex = partLength;
} else {
maxCharIndex = _CharacterMapping.getCharIndex(maxEntry);
}
const minEntryDistance = charIndex - minCharIndex;
const maxEntryDistance = maxCharIndex - charIndex;
if (minEntryDistance <= maxEntryDistance) {
return min;
}
return max;
}
};
RenderLineOutput = class {
constructor(characterMapping, containsRTL2, containsForeignElements) {
this._renderLineOutputBrand = void 0;
this.characterMapping = characterMapping;
this.containsRTL = containsRTL2;
this.containsForeignElements = containsForeignElements;
}
};
RenderLineOutput2 = class {
constructor(characterMapping, html2, containsRTL2, containsForeignElements) {
this.characterMapping = characterMapping;
this.html = html2;
this.containsRTL = containsRTL2;
this.containsForeignElements = containsForeignElements;
}
};
ResolvedRenderLineInput = class {
constructor(fontIsMonospace, canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, overflowingCharCount, parts, containsForeignElements, fauxIndentLength, tabSize, startVisibleColumn, containsRTL2, spaceWidth, renderSpaceCharCode, renderWhitespace, renderControlCharacters) {
this.fontIsMonospace = fontIsMonospace;
this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;
this.lineContent = lineContent;
this.len = len;
this.isOverflowing = isOverflowing;
this.overflowingCharCount = overflowingCharCount;
this.parts = parts;
this.containsForeignElements = containsForeignElements;
this.fauxIndentLength = fauxIndentLength;
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
this.containsRTL = containsRTL2;
this.spaceWidth = spaceWidth;
this.renderSpaceCharCode = renderSpaceCharCode;
this.renderWhitespace = renderWhitespace;
this.renderControlCharacters = renderControlCharacters;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel.js
var Viewport, MinimapLinesRenderingData, ViewLineData, ViewLineRenderingData, InlineDecoration, SingleLineInlineDecoration, ViewModelDecoration, OverviewRulerDecorationsGroup;
var init_viewModel = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel.js"() {
init_arrays();
init_strings();
init_range();
Viewport = class {
constructor(top, left, width2, height) {
this._viewportBrand = void 0;
this.top = top | 0;
this.left = left | 0;
this.width = width2 | 0;
this.height = height | 0;
}
};
MinimapLinesRenderingData = class {
constructor(tabSize, data) {
this.tabSize = tabSize;
this.data = data;
}
};
ViewLineData = class {
constructor(content, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens, inlineDecorations) {
this._viewLineDataBrand = void 0;
this.content = content;
this.continuesWithWrappedLine = continuesWithWrappedLine;
this.minColumn = minColumn;
this.maxColumn = maxColumn;
this.startVisibleColumn = startVisibleColumn;
this.tokens = tokens;
this.inlineDecorations = inlineDecorations;
}
};
ViewLineRenderingData = class _ViewLineRenderingData {
constructor(minColumn, maxColumn, content, continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, tokens, inlineDecorations, tabSize, startVisibleColumn) {
this.minColumn = minColumn;
this.maxColumn = maxColumn;
this.content = content;
this.continuesWithWrappedLine = continuesWithWrappedLine;
this.isBasicASCII = _ViewLineRenderingData.isBasicASCII(content, mightContainNonBasicASCII);
this.containsRTL = _ViewLineRenderingData.containsRTL(content, this.isBasicASCII, mightContainRTL);
this.tokens = tokens;
this.inlineDecorations = inlineDecorations;
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
}
static isBasicASCII(lineContent, mightContainNonBasicASCII) {
if (mightContainNonBasicASCII) {
return isBasicASCII(lineContent);
}
return true;
}
static containsRTL(lineContent, isBasicASCII2, mightContainRTL) {
if (!isBasicASCII2 && mightContainRTL) {
return containsRTL(lineContent);
}
return false;
}
};
InlineDecoration = class {
constructor(range2, inlineClassName, type) {
this.range = range2;
this.inlineClassName = inlineClassName;
this.type = type;
}
};
SingleLineInlineDecoration = class {
constructor(startOffset, endOffset, inlineClassName, inlineClassNameAffectsLetterSpacing) {
this.startOffset = startOffset;
this.endOffset = endOffset;
this.inlineClassName = inlineClassName;
this.inlineClassNameAffectsLetterSpacing = inlineClassNameAffectsLetterSpacing;
}
toInlineDecoration(lineNumber) {
return new InlineDecoration(
new Range(lineNumber, this.startOffset + 1, lineNumber, this.endOffset + 1),
this.inlineClassName,
this.inlineClassNameAffectsLetterSpacing ? 3 : 0
/* InlineDecorationType.Regular */
);
}
};
ViewModelDecoration = class {
constructor(range2, options2) {
this._viewModelDecorationBrand = void 0;
this.range = range2;
this.options = options2;
}
};
OverviewRulerDecorationsGroup = class _OverviewRulerDecorationsGroup {
constructor(color, zIndex, data) {
this.color = color;
this.zIndex = zIndex;
this.data = data;
}
static compareByRenderingProps(a3, b) {
if (a3.zIndex === b.zIndex) {
if (a3.color < b.color) {
return -1;
}
if (a3.color > b.color) {
return 1;
}
return 0;
}
return a3.zIndex - b.zIndex;
}
static equals(a3, b) {
return a3.color === b.color && a3.zIndex === b.zIndex && equals(a3.data, b.data);
}
static equalsArr(a3, b) {
return equals(a3, b, _OverviewRulerDecorationsGroup.equals);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCommon.js
function isFuzzyActionArr(what) {
return Array.isArray(what);
}
function isFuzzyAction(what) {
return !isFuzzyActionArr(what);
}
function isString2(what) {
return typeof what === "string";
}
function isIAction(what) {
return !isString2(what);
}
function empty(s) {
return s ? false : true;
}
function fixCase(lexer2, str) {
return lexer2.ignoreCase && str ? str.toLowerCase() : str;
}
function sanitize2(s) {
return s.replace(/[&<>'"_]/g, "-");
}
function log(lexer2, msg) {
console.log(`${lexer2.languageId}: ${msg}`);
}
function createError(lexer2, msg) {
return new Error(`${lexer2.languageId}: ${msg}`);
}
function substituteMatches(lexer2, str, id, matches2, state) {
const re = /\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;
let stateMatches = null;
return str.replace(re, function(full, sub, dollar, hash2, n, s, attr, ofs, total) {
if (!empty(dollar)) {
return "$";
}
if (!empty(hash2)) {
return fixCase(lexer2, id);
}
if (!empty(n) && n < matches2.length) {
return fixCase(lexer2, matches2[n]);
}
if (!empty(attr) && lexer2 && typeof lexer2[attr] === "string") {
return lexer2[attr];
}
if (stateMatches === null) {
stateMatches = state.split(".");
stateMatches.unshift(state);
}
if (!empty(s) && s < stateMatches.length) {
return fixCase(lexer2, stateMatches[s]);
}
return "";
});
}
function substituteMatchesRe(lexer2, str, state) {
const re = /\$[sS](\d\d?)/g;
let stateMatches = null;
return str.replace(re, function(full, s) {
if (stateMatches === null) {
stateMatches = state.split(".");
stateMatches.unshift(state);
}
if (!empty(s) && s < stateMatches.length) {
return fixCase(lexer2, stateMatches[s]);
}
return "";
});
}
function findRules(lexer2, inState) {
let state = inState;
while (state && state.length > 0) {
const rules = lexer2.tokenizer[state];
if (rules) {
return rules;
}
const idx = state.lastIndexOf(".");
if (idx < 0) {
state = null;
} else {
state = state.substr(0, idx);
}
}
return null;
}
function stateExists(lexer2, inState) {
let state = inState;
while (state && state.length > 0) {
const exist = lexer2.stateNames[state];
if (exist) {
return true;
}
const idx = state.lastIndexOf(".");
if (idx < 0) {
state = null;
} else {
state = state.substr(0, idx);
}
}
return false;
}
var init_monarchCommon = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCommon.js"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js
function findBracket(lexer2, matched) {
if (!matched) {
return null;
}
matched = fixCase(lexer2, matched);
const brackets = lexer2.brackets;
for (const bracket of brackets) {
if (bracket.open === matched) {
return {
token: bracket.token,
bracketType: 1
/* monarchCommon.MonarchBracket.Open */
};
} else if (bracket.close === matched) {
return {
token: bracket.token,
bracketType: -1
/* monarchCommon.MonarchBracket.Close */
};
}
}
return null;
}
var __decorate4, __param4, MonarchTokenizer_1, CACHE_STACK_DEPTH, MonarchStackElementFactory, MonarchStackElement, EmbeddedLanguageData, MonarchLineStateFactory, MonarchLineState, MonarchClassicTokensCollector, MonarchModernTokensCollector, MonarchTokenizer;
var init_monarchLexer = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js"() {
init_lifecycle();
init_languages();
init_nullTokenize();
init_monarchCommon();
init_configuration();
__decorate4 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param4 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
CACHE_STACK_DEPTH = 5;
MonarchStackElementFactory = class {
static create(parent, state) {
return this._INSTANCE.create(parent, state);
}
constructor(maxCacheDepth) {
this._maxCacheDepth = maxCacheDepth;
this._entries = /* @__PURE__ */ Object.create(null);
}
create(parent, state) {
if (parent !== null && parent.depth >= this._maxCacheDepth) {
return new MonarchStackElement(parent, state);
}
let stackElementId = MonarchStackElement.getStackElementId(parent);
if (stackElementId.length > 0) {
stackElementId += "|";
}
stackElementId += state;
let result = this._entries[stackElementId];
if (result) {
return result;
}
result = new MonarchStackElement(parent, state);
this._entries[stackElementId] = result;
return result;
}
};
MonarchStackElementFactory._INSTANCE = new MonarchStackElementFactory(CACHE_STACK_DEPTH);
MonarchStackElement = class _MonarchStackElement {
constructor(parent, state) {
this.parent = parent;
this.state = state;
this.depth = (this.parent ? this.parent.depth : 0) + 1;
}
static getStackElementId(element) {
let result = "";
while (element !== null) {
if (result.length > 0) {
result += "|";
}
result += element.state;
element = element.parent;
}
return result;
}
static _equals(a3, b) {
while (a3 !== null && b !== null) {
if (a3 === b) {
return true;
}
if (a3.state !== b.state) {
return false;
}
a3 = a3.parent;
b = b.parent;
}
if (a3 === null && b === null) {
return true;
}
return false;
}
equals(other) {
return _MonarchStackElement._equals(this, other);
}
push(state) {
return MonarchStackElementFactory.create(this, state);
}
pop() {
return this.parent;
}
popall() {
let result = this;
while (result.parent) {
result = result.parent;
}
return result;
}
switchTo(state) {
return MonarchStackElementFactory.create(this.parent, state);
}
};
EmbeddedLanguageData = class _EmbeddedLanguageData {
constructor(languageId, state) {
this.languageId = languageId;
this.state = state;
}
equals(other) {
return this.languageId === other.languageId && this.state.equals(other.state);
}
clone() {
const stateClone = this.state.clone();
if (stateClone === this.state) {
return this;
}
return new _EmbeddedLanguageData(this.languageId, this.state);
}
};
MonarchLineStateFactory = class {
static create(stack, embeddedLanguageData) {
return this._INSTANCE.create(stack, embeddedLanguageData);
}
constructor(maxCacheDepth) {
this._maxCacheDepth = maxCacheDepth;
this._entries = /* @__PURE__ */ Object.create(null);
}
create(stack, embeddedLanguageData) {
if (embeddedLanguageData !== null) {
return new MonarchLineState(stack, embeddedLanguageData);
}
if (stack !== null && stack.depth >= this._maxCacheDepth) {
return new MonarchLineState(stack, embeddedLanguageData);
}
const stackElementId = MonarchStackElement.getStackElementId(stack);
let result = this._entries[stackElementId];
if (result) {
return result;
}
result = new MonarchLineState(stack, null);
this._entries[stackElementId] = result;
return result;
}
};
MonarchLineStateFactory._INSTANCE = new MonarchLineStateFactory(CACHE_STACK_DEPTH);
MonarchLineState = class _MonarchLineState {
constructor(stack, embeddedLanguageData) {
this.stack = stack;
this.embeddedLanguageData = embeddedLanguageData;
}
clone() {
const embeddedlanguageDataClone = this.embeddedLanguageData ? this.embeddedLanguageData.clone() : null;
if (embeddedlanguageDataClone === this.embeddedLanguageData) {
return this;
}
return MonarchLineStateFactory.create(this.stack, this.embeddedLanguageData);
}
equals(other) {
if (!(other instanceof _MonarchLineState)) {
return false;
}
if (!this.stack.equals(other.stack)) {
return false;
}
if (this.embeddedLanguageData === null && other.embeddedLanguageData === null) {
return true;
}
if (this.embeddedLanguageData === null || other.embeddedLanguageData === null) {
return false;
}
return this.embeddedLanguageData.equals(other.embeddedLanguageData);
}
};
MonarchClassicTokensCollector = class {
constructor() {
this._tokens = [];
this._languageId = null;
this._lastTokenType = null;
this._lastTokenLanguage = null;
}
enterLanguage(languageId) {
this._languageId = languageId;
}
emit(startOffset, type) {
if (this._lastTokenType === type && this._lastTokenLanguage === this._languageId) {
return;
}
this._lastTokenType = type;
this._lastTokenLanguage = this._languageId;
this._tokens.push(new Token(startOffset, type, this._languageId));
}
nestedLanguageTokenize(embeddedLanguageLine, hasEOL, embeddedLanguageData, offsetDelta) {
const nestedLanguageId = embeddedLanguageData.languageId;
const embeddedModeState = embeddedLanguageData.state;
const nestedLanguageTokenizationSupport = TokenizationRegistry2.get(nestedLanguageId);
if (!nestedLanguageTokenizationSupport) {
this.enterLanguage(nestedLanguageId);
this.emit(offsetDelta, "");
return embeddedModeState;
}
const nestedResult = nestedLanguageTokenizationSupport.tokenize(embeddedLanguageLine, hasEOL, embeddedModeState);
if (offsetDelta !== 0) {
for (const token of nestedResult.tokens) {
this._tokens.push(new Token(token.offset + offsetDelta, token.type, token.language));
}
} else {
this._tokens = this._tokens.concat(nestedResult.tokens);
}
this._lastTokenType = null;
this._lastTokenLanguage = null;
this._languageId = null;
return nestedResult.endState;
}
finalize(endState) {
return new TokenizationResult(this._tokens, endState);
}
};
MonarchModernTokensCollector = class _MonarchModernTokensCollector {
constructor(languageService, theme) {
this._languageService = languageService;
this._theme = theme;
this._prependTokens = null;
this._tokens = [];
this._currentLanguageId = 0;
this._lastTokenMetadata = 0;
}
enterLanguage(languageId) {
this._currentLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
}
emit(startOffset, type) {
const metadata = this._theme.match(this._currentLanguageId, type) | 1024;
if (this._lastTokenMetadata === metadata) {
return;
}
this._lastTokenMetadata = metadata;
this._tokens.push(startOffset);
this._tokens.push(metadata);
}
static _merge(a3, b, c) {
const aLen = a3 !== null ? a3.length : 0;
const bLen = b.length;
const cLen = c !== null ? c.length : 0;
if (aLen === 0 && bLen === 0 && cLen === 0) {
return new Uint32Array(0);
}
if (aLen === 0 && bLen === 0) {
return c;
}
if (bLen === 0 && cLen === 0) {
return a3;
}
const result = new Uint32Array(aLen + bLen + cLen);
if (a3 !== null) {
result.set(a3);
}
for (let i = 0; i < bLen; i++) {
result[aLen + i] = b[i];
}
if (c !== null) {
result.set(c, aLen + bLen);
}
return result;
}
nestedLanguageTokenize(embeddedLanguageLine, hasEOL, embeddedLanguageData, offsetDelta) {
const nestedLanguageId = embeddedLanguageData.languageId;
const embeddedModeState = embeddedLanguageData.state;
const nestedLanguageTokenizationSupport = TokenizationRegistry2.get(nestedLanguageId);
if (!nestedLanguageTokenizationSupport) {
this.enterLanguage(nestedLanguageId);
this.emit(offsetDelta, "");
return embeddedModeState;
}
const nestedResult = nestedLanguageTokenizationSupport.tokenizeEncoded(embeddedLanguageLine, hasEOL, embeddedModeState);
if (offsetDelta !== 0) {
for (let i = 0, len = nestedResult.tokens.length; i < len; i += 2) {
nestedResult.tokens[i] += offsetDelta;
}
}
this._prependTokens = _MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, nestedResult.tokens);
this._tokens = [];
this._currentLanguageId = 0;
this._lastTokenMetadata = 0;
return nestedResult.endState;
}
finalize(endState) {
return new EncodedTokenizationResult(_MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, null), endState);
}
};
MonarchTokenizer = MonarchTokenizer_1 = class MonarchTokenizer2 extends Disposable {
constructor(languageService, standaloneThemeService, languageId, lexer2, _configurationService) {
super();
this._configurationService = _configurationService;
this._languageService = languageService;
this._standaloneThemeService = standaloneThemeService;
this._languageId = languageId;
this._lexer = lexer2;
this._embeddedLanguages = /* @__PURE__ */ Object.create(null);
this.embeddedLoaded = Promise.resolve(void 0);
let emitting = false;
this._register(TokenizationRegistry2.onDidChange((e) => {
if (emitting) {
return;
}
let isOneOfMyEmbeddedModes = false;
for (let i = 0, len = e.changedLanguages.length; i < len; i++) {
const language82 = e.changedLanguages[i];
if (this._embeddedLanguages[language82]) {
isOneOfMyEmbeddedModes = true;
break;
}
}
if (isOneOfMyEmbeddedModes) {
emitting = true;
TokenizationRegistry2.handleChange([this._languageId]);
emitting = false;
}
}));
this._maxTokenizationLineLength = this._configurationService.getValue("editor.maxTokenizationLineLength", {
overrideIdentifier: this._languageId
});
this._register(this._configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration("editor.maxTokenizationLineLength")) {
this._maxTokenizationLineLength = this._configurationService.getValue("editor.maxTokenizationLineLength", {
overrideIdentifier: this._languageId
});
}
}));
}
getLoadStatus() {
const promises = [];
for (const nestedLanguageId in this._embeddedLanguages) {
const tokenizationSupport = TokenizationRegistry2.get(nestedLanguageId);
if (tokenizationSupport) {
if (tokenizationSupport instanceof MonarchTokenizer_1) {
const nestedModeStatus = tokenizationSupport.getLoadStatus();
if (nestedModeStatus.loaded === false) {
promises.push(nestedModeStatus.promise);
}
}
continue;
}
if (!TokenizationRegistry2.isResolved(nestedLanguageId)) {
promises.push(TokenizationRegistry2.getOrCreate(nestedLanguageId));
}
}
if (promises.length === 0) {
return {
loaded: true
};
}
return {
loaded: false,
promise: Promise.all(promises).then((_) => void 0)
};
}
getInitialState() {
const rootState = MonarchStackElementFactory.create(null, this._lexer.start);
return MonarchLineStateFactory.create(rootState, null);
}
tokenize(line, hasEOL, lineState) {
if (line.length >= this._maxTokenizationLineLength) {
return nullTokenize(this._languageId, lineState);
}
const tokensCollector = new MonarchClassicTokensCollector();
const endLineState = this._tokenize(line, hasEOL, lineState, tokensCollector);
return tokensCollector.finalize(endLineState);
}
tokenizeEncoded(line, hasEOL, lineState) {
if (line.length >= this._maxTokenizationLineLength) {
return nullTokenizeEncoded(this._languageService.languageIdCodec.encodeLanguageId(this._languageId), lineState);
}
const tokensCollector = new MonarchModernTokensCollector(this._languageService, this._standaloneThemeService.getColorTheme().tokenTheme);
const endLineState = this._tokenize(line, hasEOL, lineState, tokensCollector);
return tokensCollector.finalize(endLineState);
}
_tokenize(line, hasEOL, lineState, collector) {
if (lineState.embeddedLanguageData) {
return this._nestedTokenize(line, hasEOL, lineState, 0, collector);
} else {
return this._myTokenize(line, hasEOL, lineState, 0, collector);
}
}
_findLeavingNestedLanguageOffset(line, state) {
let rules = this._lexer.tokenizer[state.stack.state];
if (!rules) {
rules = findRules(this._lexer, state.stack.state);
if (!rules) {
throw createError(this._lexer, "tokenizer state is not defined: " + state.stack.state);
}
}
let popOffset = -1;
let hasEmbeddedPopRule = false;
for (const rule of rules) {
if (!isIAction(rule.action) || rule.action.nextEmbedded !== "@pop") {
continue;
}
hasEmbeddedPopRule = true;
let regex = rule.resolveRegex(state.stack.state);
const regexSource = regex.source;
if (regexSource.substr(0, 4) === "^(?:" && regexSource.substr(regexSource.length - 1, 1) === ")") {
const flags = (regex.ignoreCase ? "i" : "") + (regex.unicode ? "u" : "");
regex = new RegExp(regexSource.substr(4, regexSource.length - 5), flags);
}
const result = line.search(regex);
if (result === -1 || result !== 0 && rule.matchOnlyAtLineStart) {
continue;
}
if (popOffset === -1 || result < popOffset) {
popOffset = result;
}
}
if (!hasEmbeddedPopRule) {
throw createError(this._lexer, 'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: ' + state.stack.state);
}
return popOffset;
}
_nestedTokenize(line, hasEOL, lineState, offsetDelta, tokensCollector) {
const popOffset = this._findLeavingNestedLanguageOffset(line, lineState);
if (popOffset === -1) {
const nestedEndState = tokensCollector.nestedLanguageTokenize(line, hasEOL, lineState.embeddedLanguageData, offsetDelta);
return MonarchLineStateFactory.create(lineState.stack, new EmbeddedLanguageData(lineState.embeddedLanguageData.languageId, nestedEndState));
}
const nestedLanguageLine = line.substring(0, popOffset);
if (nestedLanguageLine.length > 0) {
tokensCollector.nestedLanguageTokenize(nestedLanguageLine, false, lineState.embeddedLanguageData, offsetDelta);
}
const restOfTheLine = line.substring(popOffset);
return this._myTokenize(restOfTheLine, hasEOL, lineState, offsetDelta + popOffset, tokensCollector);
}
_safeRuleName(rule) {
if (rule) {
return rule.name;
}
return "(unknown)";
}
_myTokenize(lineWithoutLF, hasEOL, lineState, offsetDelta, tokensCollector) {
tokensCollector.enterLanguage(this._languageId);
const lineWithoutLFLength = lineWithoutLF.length;
const line = hasEOL && this._lexer.includeLF ? lineWithoutLF + "\n" : lineWithoutLF;
const lineLength = line.length;
let embeddedLanguageData = lineState.embeddedLanguageData;
let stack = lineState.stack;
let pos = 0;
let groupMatching = null;
let forceEvaluation = true;
while (forceEvaluation || pos < lineLength) {
const pos0 = pos;
const stackLen0 = stack.depth;
const groupLen0 = groupMatching ? groupMatching.groups.length : 0;
const state = stack.state;
let matches2 = null;
let matched = null;
let action = null;
let rule = null;
let enteringEmbeddedLanguage = null;
if (groupMatching) {
matches2 = groupMatching.matches;
const groupEntry = groupMatching.groups.shift();
matched = groupEntry.matched;
action = groupEntry.action;
rule = groupMatching.rule;
if (groupMatching.groups.length === 0) {
groupMatching = null;
}
} else {
if (!forceEvaluation && pos >= lineLength) {
break;
}
forceEvaluation = false;
let rules = this._lexer.tokenizer[state];
if (!rules) {
rules = findRules(this._lexer, state);
if (!rules) {
throw createError(this._lexer, "tokenizer state is not defined: " + state);
}
}
const restOfLine = line.substr(pos);
for (const rule2 of rules) {
if (pos === 0 || !rule2.matchOnlyAtLineStart) {
matches2 = restOfLine.match(rule2.resolveRegex(state));
if (matches2) {
matched = matches2[0];
action = rule2.action;
break;
}
}
}
}
if (!matches2) {
matches2 = [""];
matched = "";
}
if (!action) {
if (pos < lineLength) {
matches2 = [line.charAt(pos)];
matched = matches2[0];
}
action = this._lexer.defaultToken;
}
if (matched === null) {
break;
}
pos += matched.length;
while (isFuzzyAction(action) && isIAction(action) && action.test) {
action = action.test(matched, matches2, state, pos === lineLength);
}
let result = null;
if (typeof action === "string" || Array.isArray(action)) {
result = action;
} else if (action.group) {
result = action.group;
} else if (action.token !== null && action.token !== void 0) {
if (action.tokenSubst) {
result = substituteMatches(this._lexer, action.token, matched, matches2, state);
} else {
result = action.token;
}
if (action.nextEmbedded) {
if (action.nextEmbedded === "@pop") {
if (!embeddedLanguageData) {
throw createError(this._lexer, "cannot pop embedded language if not inside one");
}
embeddedLanguageData = null;
} else if (embeddedLanguageData) {
throw createError(this._lexer, "cannot enter embedded language from within an embedded language");
} else {
enteringEmbeddedLanguage = substituteMatches(this._lexer, action.nextEmbedded, matched, matches2, state);
}
}
if (action.goBack) {
pos = Math.max(0, pos - action.goBack);
}
if (action.switchTo && typeof action.switchTo === "string") {
let nextState = substituteMatches(this._lexer, action.switchTo, matched, matches2, state);
if (nextState[0] === "@") {
nextState = nextState.substr(1);
}
if (!findRules(this._lexer, nextState)) {
throw createError(this._lexer, "trying to switch to a state '" + nextState + "' that is undefined in rule: " + this._safeRuleName(rule));
} else {
stack = stack.switchTo(nextState);
}
} else if (action.transform && typeof action.transform === "function") {
throw createError(this._lexer, "action.transform not supported");
} else if (action.next) {
if (action.next === "@push") {
if (stack.depth >= this._lexer.maxStack) {
throw createError(this._lexer, "maximum tokenizer stack size reached: [" + stack.state + "," + stack.parent.state + ",...]");
} else {
stack = stack.push(state);
}
} else if (action.next === "@pop") {
if (stack.depth <= 1) {
throw createError(this._lexer, "trying to pop an empty stack in rule: " + this._safeRuleName(rule));
} else {
stack = stack.pop();
}
} else if (action.next === "@popall") {
stack = stack.popall();
} else {
let nextState = substituteMatches(this._lexer, action.next, matched, matches2, state);
if (nextState[0] === "@") {
nextState = nextState.substr(1);
}
if (!findRules(this._lexer, nextState)) {
throw createError(this._lexer, "trying to set a next state '" + nextState + "' that is undefined in rule: " + this._safeRuleName(rule));
} else {
stack = stack.push(nextState);
}
}
}
if (action.log && typeof action.log === "string") {
log(this._lexer, this._lexer.languageId + ": " + substituteMatches(this._lexer, action.log, matched, matches2, state));
}
}
if (result === null) {
throw createError(this._lexer, "lexer rule has no well-defined action in rule: " + this._safeRuleName(rule));
}
const computeNewStateForEmbeddedLanguage = (enteringEmbeddedLanguage2) => {
const languageId = this._languageService.getLanguageIdByLanguageName(enteringEmbeddedLanguage2) || this._languageService.getLanguageIdByMimeType(enteringEmbeddedLanguage2) || enteringEmbeddedLanguage2;
const embeddedLanguageData2 = this._getNestedEmbeddedLanguageData(languageId);
if (pos < lineLength) {
const restOfLine = lineWithoutLF.substr(pos);
return this._nestedTokenize(restOfLine, hasEOL, MonarchLineStateFactory.create(stack, embeddedLanguageData2), offsetDelta + pos, tokensCollector);
} else {
return MonarchLineStateFactory.create(stack, embeddedLanguageData2);
}
};
if (Array.isArray(result)) {
if (groupMatching && groupMatching.groups.length > 0) {
throw createError(this._lexer, "groups cannot be nested: " + this._safeRuleName(rule));
}
if (matches2.length !== result.length + 1) {
throw createError(this._lexer, "matched number of groups does not match the number of actions in rule: " + this._safeRuleName(rule));
}
let totalLen = 0;
for (let i = 1; i < matches2.length; i++) {
totalLen += matches2[i].length;
}
if (totalLen !== matched.length) {
throw createError(this._lexer, "with groups, all characters should be matched in consecutive groups in rule: " + this._safeRuleName(rule));
}
groupMatching = {
rule,
matches: matches2,
groups: []
};
for (let i = 0; i < result.length; i++) {
groupMatching.groups[i] = {
action: result[i],
matched: matches2[i + 1]
};
}
pos -= matched.length;
continue;
} else {
if (result === "@rematch") {
pos -= matched.length;
matched = "";
matches2 = null;
result = "";
if (enteringEmbeddedLanguage !== null) {
return computeNewStateForEmbeddedLanguage(enteringEmbeddedLanguage);
}
}
if (matched.length === 0) {
if (lineLength === 0 || stackLen0 !== stack.depth || state !== stack.state || (!groupMatching ? 0 : groupMatching.groups.length) !== groupLen0) {
continue;
} else {
throw createError(this._lexer, "no progress in tokenizer in rule: " + this._safeRuleName(rule));
}
}
let tokenType = null;
if (isString2(result) && result.indexOf("@brackets") === 0) {
const rest = result.substr("@brackets".length);
const bracket = findBracket(this._lexer, matched);
if (!bracket) {
throw createError(this._lexer, "@brackets token returned but no bracket defined as: " + matched);
}
tokenType = sanitize2(bracket.token + rest);
} else {
const token = result === "" ? "" : result + this._lexer.tokenPostfix;
tokenType = sanitize2(token);
}
if (pos0 < lineWithoutLFLength) {
tokensCollector.emit(pos0 + offsetDelta, tokenType);
}
}
if (enteringEmbeddedLanguage !== null) {
return computeNewStateForEmbeddedLanguage(enteringEmbeddedLanguage);
}
}
return MonarchLineStateFactory.create(stack, embeddedLanguageData);
}
_getNestedEmbeddedLanguageData(languageId) {
if (!this._languageService.isRegisteredLanguageId(languageId)) {
return new EmbeddedLanguageData(languageId, NullState);
}
if (languageId !== this._languageId) {
this._languageService.requestBasicLanguageFeatures(languageId);
TokenizationRegistry2.getOrCreate(languageId);
this._embeddedLanguages[languageId] = true;
}
const tokenizationSupport = TokenizationRegistry2.get(languageId);
if (tokenizationSupport) {
return new EmbeddedLanguageData(languageId, tokenizationSupport.getInitialState());
}
return new EmbeddedLanguageData(languageId, NullState);
}
};
MonarchTokenizer = MonarchTokenizer_1 = __decorate4([
__param4(4, IConfigurationService)
], MonarchTokenizer);
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/colorizer.js
function _colorize(lines, tabSize, tokenizationSupport, languageIdCodec) {
return new Promise((c, e) => {
const execute = () => {
const result = _actualColorize(lines, tabSize, tokenizationSupport, languageIdCodec);
if (tokenizationSupport instanceof MonarchTokenizer) {
const status2 = tokenizationSupport.getLoadStatus();
if (status2.loaded === false) {
status2.promise.then(execute, e);
return;
}
}
c(result);
};
execute();
});
}
function _fakeColorize(lines, tabSize, languageIdCodec) {
let html2 = [];
const defaultMetadata = (0 << 11 | 1 << 15 | 2 << 24) >>> 0;
const tokens = new Uint32Array(2);
tokens[0] = 0;
tokens[1] = defaultMetadata;
for (let i = 0, length = lines.length; i < length; i++) {
const line = lines[i];
tokens[0] = line.length;
const lineTokens = new LineTokens(tokens, line, languageIdCodec);
const isBasicASCII2 = ViewLineRenderingData.isBasicASCII(
line,
/* check for basic ASCII */
true
);
const containsRTL2 = ViewLineRenderingData.containsRTL(
line,
isBasicASCII2,
/* check for RTL */
true
);
const renderResult = renderViewLine2(new RenderLineInput(false, true, line, false, isBasicASCII2, containsRTL2, 0, lineTokens, [], tabSize, 0, 0, 0, 0, -1, "none", false, false, null));
html2 = html2.concat(renderResult.html);
html2.push("
");
}
return html2.join("");
}
function _actualColorize(lines, tabSize, tokenizationSupport, languageIdCodec) {
let html2 = [];
let state = tokenizationSupport.getInitialState();
for (let i = 0, length = lines.length; i < length; i++) {
const line = lines[i];
const tokenizeResult = tokenizationSupport.tokenizeEncoded(line, true, state);
LineTokens.convertToEndOffset(tokenizeResult.tokens, line.length);
const lineTokens = new LineTokens(tokenizeResult.tokens, line, languageIdCodec);
const isBasicASCII2 = ViewLineRenderingData.isBasicASCII(
line,
/* check for basic ASCII */
true
);
const containsRTL2 = ViewLineRenderingData.containsRTL(
line,
isBasicASCII2,
/* check for RTL */
true
);
const renderResult = renderViewLine2(new RenderLineInput(false, true, line, false, isBasicASCII2, containsRTL2, 0, lineTokens.inflate(), [], tabSize, 0, 0, 0, 0, -1, "none", false, false, null));
html2 = html2.concat(renderResult.html);
html2.push("
");
state = tokenizeResult.endState;
}
return html2.join("");
}
var ttPolicy2, Colorizer;
var init_colorizer = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/colorizer.js"() {
init_trustedTypes();
init_strings();
init_languages();
init_lineTokens();
init_viewLineRenderer();
init_viewModel();
init_monarchLexer();
ttPolicy2 = createTrustedTypesPolicy("standaloneColorizer", { createHTML: (value) => value });
Colorizer = class {
static colorizeElement(themeService, languageService, domNode, options2) {
options2 = options2 || {};
const theme = options2.theme || "vs";
const mimeType = options2.mimeType || domNode.getAttribute("lang") || domNode.getAttribute("data-lang");
if (!mimeType) {
console.error("Mode not detected");
return Promise.resolve();
}
const languageId = languageService.getLanguageIdByMimeType(mimeType) || mimeType;
themeService.setTheme(theme);
const text2 = domNode.firstChild ? domNode.firstChild.nodeValue : "";
domNode.className += " " + theme;
const render = (str) => {
var _a10;
const trustedhtml = (_a10 = ttPolicy2 === null || ttPolicy2 === void 0 ? void 0 : ttPolicy2.createHTML(str)) !== null && _a10 !== void 0 ? _a10 : str;
domNode.innerHTML = trustedhtml;
};
return this.colorize(languageService, text2 || "", languageId, options2).then(render, (err) => console.error(err));
}
static colorize(languageService, text2, languageId, options2) {
return __async(this, null, function* () {
const languageIdCodec = languageService.languageIdCodec;
let tabSize = 4;
if (options2 && typeof options2.tabSize === "number") {
tabSize = options2.tabSize;
}
if (startsWithUTF8BOM(text2)) {
text2 = text2.substr(1);
}
const lines = splitLines(text2);
if (!languageService.isRegisteredLanguageId(languageId)) {
return _fakeColorize(lines, tabSize, languageIdCodec);
}
const tokenizationSupport = yield TokenizationRegistry2.getOrCreate(languageId);
if (tokenizationSupport) {
return _colorize(lines, tabSize, tokenizationSupport, languageIdCodec);
}
return _fakeColorize(lines, tabSize, languageIdCodec);
});
}
static colorizeLine(line, mightContainNonBasicASCII, mightContainRTL, tokens, tabSize = 4) {
const isBasicASCII2 = ViewLineRenderingData.isBasicASCII(line, mightContainNonBasicASCII);
const containsRTL2 = ViewLineRenderingData.containsRTL(line, isBasicASCII2, mightContainRTL);
const renderResult = renderViewLine2(new RenderLineInput(false, true, line, false, isBasicASCII2, containsRTL2, 0, tokens, [], tabSize, 0, 0, 0, 0, -1, "none", false, false, null));
return renderResult.html;
}
static colorizeModelLine(model, lineNumber, tabSize = 4) {
const content = model.getLineContent(lineNumber);
model.tokenization.forceTokenization(lineNumber);
const tokens = model.tokenization.getLineTokens(lineNumber);
const inflatedTokens = tokens.inflate();
return this.colorizeLine(content, model.mightContainNonBasicASCII(), model.mightContainRTL(), inflatedTokens, tabSize);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css
var init_aria = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js
function setARIAContainer(parent) {
ariaContainer = document.createElement("div");
ariaContainer.className = "monaco-aria-container";
const createAlertContainer = () => {
const element = document.createElement("div");
element.className = "monaco-alert";
element.setAttribute("role", "alert");
element.setAttribute("aria-atomic", "true");
ariaContainer.appendChild(element);
return element;
};
alertContainer = createAlertContainer();
alertContainer2 = createAlertContainer();
const createStatusContainer = () => {
const element = document.createElement("div");
element.className = "monaco-status";
element.setAttribute("aria-live", "polite");
element.setAttribute("aria-atomic", "true");
ariaContainer.appendChild(element);
return element;
};
statusContainer = createStatusContainer();
statusContainer2 = createStatusContainer();
parent.appendChild(ariaContainer);
}
function alert(msg) {
if (!ariaContainer) {
return;
}
if (alertContainer.textContent !== msg) {
clearNode(alertContainer2);
insertMessage(alertContainer, msg);
} else {
clearNode(alertContainer);
insertMessage(alertContainer2, msg);
}
}
function status(msg) {
if (!ariaContainer) {
return;
}
if (statusContainer.textContent !== msg) {
clearNode(statusContainer2);
insertMessage(statusContainer, msg);
} else {
clearNode(statusContainer);
insertMessage(statusContainer2, msg);
}
}
function insertMessage(target, msg) {
clearNode(target);
if (msg.length > MAX_MESSAGE_LENGTH) {
msg = msg.substr(0, MAX_MESSAGE_LENGTH);
}
target.textContent = msg;
target.style.visibility = "hidden";
target.style.visibility = "visible";
}
var MAX_MESSAGE_LENGTH, ariaContainer, alertContainer, alertContainer2, statusContainer, statusContainer2;
var init_aria2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js"() {
init_dom();
init_aria();
MAX_MESSAGE_LENGTH = 2e4;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorations.js
var IMarkerDecorationsService;
var init_markerDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorations.js"() {
init_instantiation();
IMarkerDecorationsService = createDecorator("markerDecorationsService");
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/markerDecorations.js
var __decorate5, __param5, MarkerDecorationsContribution;
var init_markerDecorations2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/markerDecorations.js"() {
init_markerDecorations();
init_editorExtensions();
__decorate5 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param5 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MarkerDecorationsContribution = class MarkerDecorationsContribution2 {
constructor(_editor, _markerDecorationsService) {
}
dispose() {
}
};
MarkerDecorationsContribution.ID = "editor.contrib.markerDecorations";
MarkerDecorationsContribution = __decorate5([
__param5(1, IMarkerDecorationsService)
], MarkerDecorationsContribution);
registerEditorContribution(
MarkerDecorationsContribution.ID,
MarkerDecorationsContribution,
0
/* EditorContributionInstantiation.Eager */
);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/editor.css
var init_editor = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/editor.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/elementSizeObserver.js
var ElementSizeObserver;
var init_elementSizeObserver = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/elementSizeObserver.js"() {
init_lifecycle();
init_event();
init_dom();
ElementSizeObserver = class extends Disposable {
constructor(referenceDomElement, dimension) {
super();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._referenceDomElement = referenceDomElement;
this._width = -1;
this._height = -1;
this._resizeObserver = null;
this.measureReferenceDomElement(false, dimension);
}
dispose() {
this.stopObserving();
super.dispose();
}
getWidth() {
return this._width;
}
getHeight() {
return this._height;
}
startObserving() {
if (!this._resizeObserver && this._referenceDomElement) {
let observedDimenstion = null;
const observeNow = () => {
if (observedDimenstion) {
this.observe({ width: observedDimenstion.width, height: observedDimenstion.height });
} else {
this.observe();
}
};
let shouldObserve = false;
let alreadyObservedThisAnimationFrame = false;
const update = () => {
if (shouldObserve && !alreadyObservedThisAnimationFrame) {
try {
shouldObserve = false;
alreadyObservedThisAnimationFrame = true;
observeNow();
} finally {
scheduleAtNextAnimationFrame(getWindow(this._referenceDomElement), () => {
alreadyObservedThisAnimationFrame = false;
update();
});
}
}
};
this._resizeObserver = new ResizeObserver((entries2) => {
if (entries2 && entries2[0] && entries2[0].contentRect) {
observedDimenstion = { width: entries2[0].contentRect.width, height: entries2[0].contentRect.height };
} else {
observedDimenstion = null;
}
shouldObserve = true;
update();
});
this._resizeObserver.observe(this._referenceDomElement);
}
}
stopObserving() {
if (this._resizeObserver) {
this._resizeObserver.disconnect();
this._resizeObserver = null;
}
}
observe(dimension) {
this.measureReferenceDomElement(true, dimension);
}
measureReferenceDomElement(emitEvent, dimension) {
let observedWidth = 0;
let observedHeight = 0;
if (dimension) {
observedWidth = dimension.width;
observedHeight = dimension.height;
} else if (this._referenceDomElement) {
observedWidth = this._referenceDomElement.clientWidth;
observedHeight = this._referenceDomElement.clientHeight;
}
observedWidth = Math.max(5, observedWidth);
observedHeight = Math.max(5, observedHeight);
if (this._width !== observedWidth || this._height !== observedHeight) {
this._width = observedWidth;
this._height = observedHeight;
if (emitEvent) {
this._onDidChange.fire();
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/migrateOptions.js
function registerEditorSettingMigration(key, migrate) {
EditorSettingMigration.items.push(new EditorSettingMigration(key, migrate));
}
function registerSimpleEditorSettingMigration(key, values2) {
registerEditorSettingMigration(key, (value, read, write) => {
if (typeof value !== "undefined") {
for (const [oldValue, newValue] of values2) {
if (value === oldValue) {
write(key, newValue);
return;
}
}
}
});
}
function migrateOptions(options2) {
EditorSettingMigration.items.forEach((migration) => migration.apply(options2));
}
var EditorSettingMigration, suggestFilteredTypesMapping;
var init_migrateOptions = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/migrateOptions.js"() {
EditorSettingMigration = class _EditorSettingMigration {
constructor(key, migrate) {
this.key = key;
this.migrate = migrate;
}
apply(options2) {
const value = _EditorSettingMigration._read(options2, this.key);
const read = (key) => _EditorSettingMigration._read(options2, key);
const write = (key, value2) => _EditorSettingMigration._write(options2, key, value2);
this.migrate(value, read, write);
}
static _read(source, key) {
if (typeof source === "undefined") {
return void 0;
}
const firstDotIndex = key.indexOf(".");
if (firstDotIndex >= 0) {
const firstSegment = key.substring(0, firstDotIndex);
return this._read(source[firstSegment], key.substring(firstDotIndex + 1));
}
return source[key];
}
static _write(target, key, value) {
const firstDotIndex = key.indexOf(".");
if (firstDotIndex >= 0) {
const firstSegment = key.substring(0, firstDotIndex);
target[firstSegment] = target[firstSegment] || {};
this._write(target[firstSegment], key.substring(firstDotIndex + 1), value);
return;
}
target[key] = value;
}
};
EditorSettingMigration.items = [];
registerSimpleEditorSettingMigration("wordWrap", [[true, "on"], [false, "off"]]);
registerSimpleEditorSettingMigration("lineNumbers", [[true, "on"], [false, "off"]]);
registerSimpleEditorSettingMigration("cursorBlinking", [["visible", "solid"]]);
registerSimpleEditorSettingMigration("renderWhitespace", [[true, "boundary"], [false, "none"]]);
registerSimpleEditorSettingMigration("renderLineHighlight", [[true, "line"], [false, "none"]]);
registerSimpleEditorSettingMigration("acceptSuggestionOnEnter", [[true, "on"], [false, "off"]]);
registerSimpleEditorSettingMigration("tabCompletion", [[false, "off"], [true, "onlySnippets"]]);
registerSimpleEditorSettingMigration("hover", [[true, { enabled: true }], [false, { enabled: false }]]);
registerSimpleEditorSettingMigration("parameterHints", [[true, { enabled: true }], [false, { enabled: false }]]);
registerSimpleEditorSettingMigration("autoIndent", [[false, "advanced"], [true, "full"]]);
registerSimpleEditorSettingMigration("matchBrackets", [[true, "always"], [false, "never"]]);
registerSimpleEditorSettingMigration("renderFinalNewline", [[true, "on"], [false, "off"]]);
registerSimpleEditorSettingMigration("cursorSmoothCaretAnimation", [[true, "on"], [false, "off"]]);
registerSimpleEditorSettingMigration("occurrencesHighlight", [[true, "singleFile"], [false, "off"]]);
registerSimpleEditorSettingMigration("wordBasedSuggestions", [[true, "matchingDocuments"], [false, "off"]]);
registerEditorSettingMigration("autoClosingBrackets", (value, read, write) => {
if (value === false) {
write("autoClosingBrackets", "never");
if (typeof read("autoClosingQuotes") === "undefined") {
write("autoClosingQuotes", "never");
}
if (typeof read("autoSurround") === "undefined") {
write("autoSurround", "never");
}
}
});
registerEditorSettingMigration("renderIndentGuides", (value, read, write) => {
if (typeof value !== "undefined") {
write("renderIndentGuides", void 0);
if (typeof read("guides.indentation") === "undefined") {
write("guides.indentation", !!value);
}
}
});
registerEditorSettingMigration("highlightActiveIndentGuide", (value, read, write) => {
if (typeof value !== "undefined") {
write("highlightActiveIndentGuide", void 0);
if (typeof read("guides.highlightActiveIndentation") === "undefined") {
write("guides.highlightActiveIndentation", !!value);
}
}
});
suggestFilteredTypesMapping = {
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"
};
registerEditorSettingMigration("suggest.filteredTypes", (value, read, write) => {
if (value && typeof value === "object") {
for (const entry of Object.entries(suggestFilteredTypesMapping)) {
const v = value[entry[0]];
if (v === false) {
if (typeof read(`suggest.${entry[1]}`) === "undefined") {
write(`suggest.${entry[1]}`, false);
}
}
}
write("suggest.filteredTypes", void 0);
}
});
registerEditorSettingMigration("quickSuggestions", (input, read, write) => {
if (typeof input === "boolean") {
const value = input ? "on" : "off";
const newValue = { comments: value, strings: value, other: value };
write("quickSuggestions", newValue);
}
});
registerEditorSettingMigration("experimental.stickyScroll.enabled", (value, read, write) => {
if (typeof value === "boolean") {
write("experimental.stickyScroll.enabled", void 0);
if (typeof read("stickyScroll.enabled") === "undefined") {
write("stickyScroll.enabled", value);
}
}
});
registerEditorSettingMigration("experimental.stickyScroll.maxLineCount", (value, read, write) => {
if (typeof value === "number") {
write("experimental.stickyScroll.maxLineCount", void 0);
if (typeof read("stickyScroll.maxLineCount") === "undefined") {
write("stickyScroll.maxLineCount", value);
}
}
});
registerEditorSettingMigration("codeActionsOnSave", (value, read, write) => {
if (value && typeof value === "object") {
let toBeModified = false;
const newValue = {};
for (const entry of Object.entries(value)) {
if (typeof entry[1] === "boolean") {
toBeModified = true;
newValue[entry[0]] = entry[1] ? "explicit" : "never";
} else {
newValue[entry[0]] = entry[1];
}
}
if (toBeModified) {
write(`codeActionsOnSave`, newValue);
}
}
});
registerEditorSettingMigration("codeActionWidget.includeNearbyQuickfixes", (value, read, write) => {
if (typeof value === "boolean") {
write("codeActionWidget.includeNearbyQuickfixes", void 0);
if (typeof read("codeActionWidget.includeNearbyQuickFixes") === "undefined") {
write("codeActionWidget.includeNearbyQuickFixes", value);
}
}
});
registerEditorSettingMigration("lightbulb.enabled", (value, read, write) => {
if (typeof value === "boolean") {
write("lightbulb.enabled", value ? void 0 : "off");
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/tabFocus.js
var TabFocusImpl, TabFocus;
var init_tabFocus = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/tabFocus.js"() {
init_event();
TabFocusImpl = class {
constructor() {
this._tabFocus = false;
this._onDidChangeTabFocus = new Emitter();
this.onDidChangeTabFocus = this._onDidChangeTabFocus.event;
}
getTabFocusMode() {
return this._tabFocus;
}
setTabFocusMode(tabFocusMode) {
this._tabFocus = tabFocusMode;
this._onDidChangeTabFocus.fire(this._tabFocus);
}
};
TabFocus = new TabFocusImpl();
}
});
// node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js
var IAccessibilityService, CONTEXT_ACCESSIBILITY_MODE_ENABLED;
var init_accessibility = __esm({
"node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js"() {
init_contextkey();
init_instantiation();
IAccessibilityService = createDecorator("accessibilityService");
CONTEXT_ACCESSIBILITY_MODE_ENABLED = new RawContextKey("accessibilityModeEnabled", false);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/config/editorConfiguration.js
function digitCount(n) {
let r = 0;
while (n) {
n = Math.floor(n / 10);
r++;
}
return r ? r : 1;
}
function getExtraEditorClassName() {
let extra = "";
if (!isSafari2 && !isWebkitWebView) {
extra += "no-user-select ";
}
if (isSafari2) {
extra += "no-minimap-shadow ";
extra += "enable-user-select ";
}
if (isMacintosh) {
extra += "mac ";
}
return extra;
}
function deepCloneAndMigrateOptions(_options) {
const options2 = deepClone(_options);
migrateOptions(options2);
return options2;
}
var __decorate6, __param6, EditorConfiguration, ValidatedEditorOptions, ComputedEditorOptions, EditorOptionsUtil;
var init_editorConfiguration = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/config/editorConfiguration.js"() {
init_browser();
init_arrays();
init_event();
init_lifecycle();
init_objects();
init_platform();
init_elementSizeObserver();
init_fontMeasurements();
init_migrateOptions();
init_tabFocus();
init_editorOptions();
init_editorZoom();
init_fontInfo();
init_accessibility();
init_dom();
init_pixelRatio();
__decorate6 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param6 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
EditorConfiguration = class EditorConfiguration2 extends Disposable {
constructor(isSimpleWidget, contextMenuId, options2, container, _accessibilityService) {
super();
this._accessibilityService = _accessibilityService;
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._onDidChangeFast = this._register(new Emitter());
this.onDidChangeFast = this._onDidChangeFast.event;
this._isDominatedByLongLines = false;
this._viewLineCount = 1;
this._lineNumbersDigitCount = 1;
this._reservedHeight = 0;
this._glyphMarginDecorationLaneCount = 1;
this._computeOptionsMemory = new ComputeOptionsMemory();
this.isSimpleWidget = isSimpleWidget;
this.contextMenuId = contextMenuId;
this._containerObserver = this._register(new ElementSizeObserver(container, options2.dimension));
this._targetWindowId = getWindow(container).vscodeWindowId;
this._rawOptions = deepCloneAndMigrateOptions(options2);
this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);
this.options = this._computeOptions();
if (this.options.get(
13
/* EditorOption.automaticLayout */
)) {
this._containerObserver.startObserving();
}
this._register(EditorZoom.onDidChangeZoomLevel(() => this._recomputeOptions()));
this._register(TabFocus.onDidChangeTabFocus(() => this._recomputeOptions()));
this._register(this._containerObserver.onDidChange(() => this._recomputeOptions()));
this._register(FontMeasurements.onDidChange(() => this._recomputeOptions()));
this._register(PixelRatio.getInstance(getWindow(container)).onDidChange(() => this._recomputeOptions()));
this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => this._recomputeOptions()));
}
_recomputeOptions() {
const newOptions = this._computeOptions();
const changeEvent = EditorOptionsUtil.checkEquals(this.options, newOptions);
if (changeEvent === null) {
return;
}
this.options = newOptions;
this._onDidChangeFast.fire(changeEvent);
this._onDidChange.fire(changeEvent);
}
_computeOptions() {
const partialEnv = this._readEnvConfiguration();
const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.pixelRatio, this.isSimpleWidget);
const fontInfo = this._readFontInfo(bareFontInfo);
const env2 = {
memory: this._computeOptionsMemory,
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight - this._reservedHeight,
fontInfo,
extraEditorClassName: partialEnv.extraEditorClassName,
isDominatedByLongLines: this._isDominatedByLongLines,
viewLineCount: this._viewLineCount,
lineNumbersDigitCount: this._lineNumbersDigitCount,
emptySelectionClipboard: partialEnv.emptySelectionClipboard,
pixelRatio: partialEnv.pixelRatio,
tabFocusMode: TabFocus.getTabFocusMode(),
accessibilitySupport: partialEnv.accessibilitySupport,
glyphMarginDecorationLaneCount: this._glyphMarginDecorationLaneCount
};
return EditorOptionsUtil.computeOptions(this._validatedOptions, env2);
}
_readEnvConfiguration() {
return {
extraEditorClassName: getExtraEditorClassName(),
outerWidth: this._containerObserver.getWidth(),
outerHeight: this._containerObserver.getHeight(),
emptySelectionClipboard: isWebKit || isFirefox2,
pixelRatio: PixelRatio.getInstance(getWindowById(this._targetWindowId, true).window).value,
accessibilitySupport: this._accessibilityService.isScreenReaderOptimized() ? 2 : this._accessibilityService.getAccessibilitySupport()
};
}
_readFontInfo(bareFontInfo) {
return FontMeasurements.readFontInfo(getWindowById(this._targetWindowId, true).window, bareFontInfo);
}
getRawOptions() {
return this._rawOptions;
}
updateOptions(_newOptions) {
const newOptions = deepCloneAndMigrateOptions(_newOptions);
const didChange = EditorOptionsUtil.applyUpdate(this._rawOptions, newOptions);
if (!didChange) {
return;
}
this._validatedOptions = EditorOptionsUtil.validateOptions(this._rawOptions);
this._recomputeOptions();
}
observeContainer(dimension) {
this._containerObserver.observe(dimension);
}
setIsDominatedByLongLines(isDominatedByLongLines) {
if (this._isDominatedByLongLines === isDominatedByLongLines) {
return;
}
this._isDominatedByLongLines = isDominatedByLongLines;
this._recomputeOptions();
}
setModelLineCount(modelLineCount) {
const lineNumbersDigitCount = digitCount(modelLineCount);
if (this._lineNumbersDigitCount === lineNumbersDigitCount) {
return;
}
this._lineNumbersDigitCount = lineNumbersDigitCount;
this._recomputeOptions();
}
setViewLineCount(viewLineCount) {
if (this._viewLineCount === viewLineCount) {
return;
}
this._viewLineCount = viewLineCount;
this._recomputeOptions();
}
setReservedHeight(reservedHeight) {
if (this._reservedHeight === reservedHeight) {
return;
}
this._reservedHeight = reservedHeight;
this._recomputeOptions();
}
setGlyphMarginDecorationLaneCount(decorationLaneCount) {
if (this._glyphMarginDecorationLaneCount === decorationLaneCount) {
return;
}
this._glyphMarginDecorationLaneCount = decorationLaneCount;
this._recomputeOptions();
}
};
EditorConfiguration = __decorate6([
__param6(4, IAccessibilityService)
], EditorConfiguration);
ValidatedEditorOptions = class {
constructor() {
this._values = [];
}
_read(option) {
return this._values[option];
}
get(id) {
return this._values[id];
}
_write(option, value) {
this._values[option] = value;
}
};
ComputedEditorOptions = class {
constructor() {
this._values = [];
}
_read(id) {
if (id >= this._values.length) {
throw new Error("Cannot read uninitialized value");
}
return this._values[id];
}
get(id) {
return this._read(id);
}
_write(id, value) {
this._values[id] = value;
}
};
EditorOptionsUtil = class _EditorOptionsUtil {
static validateOptions(options2) {
const result = new ValidatedEditorOptions();
for (const editorOption of editorOptionsRegistry) {
const value = editorOption.name === "_never_" ? void 0 : options2[editorOption.name];
result._write(editorOption.id, editorOption.validate(value));
}
return result;
}
static computeOptions(options2, env2) {
const result = new ComputedEditorOptions();
for (const editorOption of editorOptionsRegistry) {
result._write(editorOption.id, editorOption.compute(env2, result, options2._read(editorOption.id)));
}
return result;
}
static _deepEquals(a3, b) {
if (typeof a3 !== "object" || typeof b !== "object" || !a3 || !b) {
return a3 === b;
}
if (Array.isArray(a3) || Array.isArray(b)) {
return Array.isArray(a3) && Array.isArray(b) ? equals(a3, b) : false;
}
if (Object.keys(a3).length !== Object.keys(b).length) {
return false;
}
for (const key in a3) {
if (!_EditorOptionsUtil._deepEquals(a3[key], b[key])) {
return false;
}
}
return true;
}
static checkEquals(a3, b) {
const result = [];
let somethingChanged = false;
for (const editorOption of editorOptionsRegistry) {
const changed = !_EditorOptionsUtil._deepEquals(a3._read(editorOption.id), b._read(editorOption.id));
result[editorOption.id] = changed;
if (changed) {
somethingChanged = true;
}
}
return somethingChanged ? new ConfigurationChangedEvent(result) : null;
}
/**
* Returns true if something changed.
* Modifies `options`.
*/
static applyUpdate(options2, update) {
let changed = false;
for (const editorOption of editorOptionsRegistry) {
if (update.hasOwnProperty(editorOption.name)) {
const result = editorOption.applyUpdate(options2[editorOption.name], update[editorOption.name]);
options2[editorOption.name] = result.newValue;
changed = changed || result.didChange;
}
}
return changed;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/performance.js
var inputLatency;
var init_performance = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/performance.js"() {
(function(inputLatency2) {
const totalKeydownTime = { total: 0, min: Number.MAX_VALUE, max: 0 };
const totalInputTime = __spreadValues({}, totalKeydownTime);
const totalRenderTime = __spreadValues({}, totalKeydownTime);
const totalInputLatencyTime = __spreadValues({}, totalKeydownTime);
let measurementsCount = 0;
const state = {
keydown: 0,
input: 0,
render: 0
};
function onKeyDown() {
recordIfFinished();
performance.mark("inputlatency/start");
performance.mark("keydown/start");
state.keydown = 1;
queueMicrotask(markKeyDownEnd);
}
inputLatency2.onKeyDown = onKeyDown;
function markKeyDownEnd() {
if (state.keydown === 1) {
performance.mark("keydown/end");
state.keydown = 2;
}
}
function onBeforeInput() {
performance.mark("input/start");
state.input = 1;
scheduleRecordIfFinishedTask();
}
inputLatency2.onBeforeInput = onBeforeInput;
function onInput() {
if (state.input === 0) {
onBeforeInput();
}
queueMicrotask(markInputEnd);
}
inputLatency2.onInput = onInput;
function markInputEnd() {
if (state.input === 1) {
performance.mark("input/end");
state.input = 2;
}
}
function onKeyUp() {
recordIfFinished();
}
inputLatency2.onKeyUp = onKeyUp;
function onSelectionChange() {
recordIfFinished();
}
inputLatency2.onSelectionChange = onSelectionChange;
function onRenderStart() {
if (state.keydown === 2 && state.input === 2 && state.render === 0) {
performance.mark("render/start");
state.render = 1;
queueMicrotask(markRenderEnd);
scheduleRecordIfFinishedTask();
}
}
inputLatency2.onRenderStart = onRenderStart;
function markRenderEnd() {
if (state.render === 1) {
performance.mark("render/end");
state.render = 2;
}
}
function scheduleRecordIfFinishedTask() {
setTimeout(recordIfFinished);
}
function recordIfFinished() {
if (state.keydown === 2 && state.input === 2 && state.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");
addMeasure("keydown", totalKeydownTime);
addMeasure("input", totalInputTime);
addMeasure("render", totalRenderTime);
addMeasure("inputlatency", totalInputLatencyTime);
measurementsCount++;
reset2();
}
}
function addMeasure(entryName, cumulativeMeasurement) {
const duration = performance.getEntriesByName(entryName)[0].duration;
cumulativeMeasurement.total += duration;
cumulativeMeasurement.min = Math.min(cumulativeMeasurement.min, duration);
cumulativeMeasurement.max = Math.max(cumulativeMeasurement.max, duration);
}
function reset2() {
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");
state.keydown = 0;
state.input = 0;
state.render = 0;
}
function getAndClearMeasurements() {
if (measurementsCount === 0) {
return void 0;
}
const result = {
keydown: cumulativeToFinalMeasurement(totalKeydownTime),
input: cumulativeToFinalMeasurement(totalInputTime),
render: cumulativeToFinalMeasurement(totalRenderTime),
total: cumulativeToFinalMeasurement(totalInputLatencyTime),
sampleCount: measurementsCount
};
clearCumulativeMeasurement(totalKeydownTime);
clearCumulativeMeasurement(totalInputTime);
clearCumulativeMeasurement(totalRenderTime);
clearCumulativeMeasurement(totalInputLatencyTime);
measurementsCount = 0;
return result;
}
inputLatency2.getAndClearMeasurements = getAndClearMeasurements;
function cumulativeToFinalMeasurement(cumulative) {
return {
average: cumulative.total / measurementsCount,
max: cumulative.max,
min: cumulative.min
};
}
function clearCumulativeMeasurement(cumulative) {
cumulative.total = 0;
cumulative.min = Number.MAX_VALUE;
cumulative.max = 0;
}
})(inputLatency || (inputLatency = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js
var GlobalPointerMoveMonitor;
var init_globalPointerMoveMonitor = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/globalPointerMoveMonitor.js"() {
init_dom();
init_lifecycle();
GlobalPointerMoveMonitor = class {
constructor() {
this._hooks = new DisposableStore();
this._pointerMoveCallback = null;
this._onStopCallback = null;
}
dispose() {
this.stopMonitoring(false);
this._hooks.dispose();
}
stopMonitoring(invokeStopCallback, browserEvent) {
if (!this.isMonitoring()) {
return;
}
this._hooks.clear();
this._pointerMoveCallback = null;
const onStopCallback = this._onStopCallback;
this._onStopCallback = null;
if (invokeStopCallback && onStopCallback) {
onStopCallback(browserEvent);
}
}
isMonitoring() {
return !!this._pointerMoveCallback;
}
startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {
if (this.isMonitoring()) {
this.stopMonitoring(false);
}
this._pointerMoveCallback = pointerMoveCallback;
this._onStopCallback = onStopCallback;
let eventSource = initialElement;
try {
initialElement.setPointerCapture(pointerId);
this._hooks.add(toDisposable(() => {
try {
initialElement.releasePointerCapture(pointerId);
} catch (err) {
}
}));
} catch (err) {
eventSource = getWindow(initialElement);
}
this._hooks.add(addDisposableListener(eventSource, EventType.POINTER_MOVE, (e) => {
if (e.buttons !== initialButtons) {
this.stopMonitoring(true);
return;
}
e.preventDefault();
this._pointerMoveCallback(e);
}));
this._hooks.add(addDisposableListener(eventSource, EventType.POINTER_UP, (e) => this.stopMonitoring(true)));
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colorUtils.js
function asCssVariableName(colorIdent) {
return `--vscode-${colorIdent.replace(/\./g, "-")}`;
}
function asCssVariable(color) {
return `var(${asCssVariableName(color)})`;
}
function asCssVariableWithDefault(color, defaultCssValue) {
return `var(${asCssVariableName(color)}, ${defaultCssValue})`;
}
function registerColor(id, defaults, description, needsTransparency, deprecationMessage) {
return colorRegistry.registerColor(id, defaults, description, needsTransparency, deprecationMessage);
}
function executeTransform(transform, theme) {
var _a10, _b4, _c2, _d2;
switch (transform.op) {
case 0:
return (_a10 = resolveColorValue(transform.value, theme)) === null || _a10 === void 0 ? void 0 : _a10.darken(transform.factor);
case 1:
return (_b4 = resolveColorValue(transform.value, theme)) === null || _b4 === void 0 ? void 0 : _b4.lighten(transform.factor);
case 2:
return (_c2 = resolveColorValue(transform.value, theme)) === null || _c2 === void 0 ? void 0 : _c2.transparent(transform.factor);
case 3: {
const backgroundColor = resolveColorValue(transform.background, theme);
if (!backgroundColor) {
return resolveColorValue(transform.value, theme);
}
return (_d2 = resolveColorValue(transform.value, theme)) === null || _d2 === void 0 ? void 0 : _d2.makeOpaque(backgroundColor);
}
case 4:
for (const candidate of transform.values) {
const color = resolveColorValue(candidate, theme);
if (color) {
return color;
}
}
return void 0;
case 6:
return resolveColorValue(theme.defines(transform.if) ? transform.then : transform.else, theme);
case 5: {
const from = resolveColorValue(transform.value, theme);
if (!from) {
return void 0;
}
const backgroundColor = resolveColorValue(transform.background, theme);
if (!backgroundColor) {
return from.transparent(transform.factor * transform.transparency);
}
return from.isDarkerThan(backgroundColor) ? Color.getLighterColor(from, backgroundColor, transform.factor).transparent(transform.transparency) : Color.getDarkerColor(from, backgroundColor, transform.factor).transparent(transform.transparency);
}
default:
throw assertNever(transform);
}
}
function darken(colorValue, factor2) {
return { op: 0, value: colorValue, factor: factor2 };
}
function lighten(colorValue, factor2) {
return { op: 1, value: colorValue, factor: factor2 };
}
function transparent(colorValue, factor2) {
return { op: 2, value: colorValue, factor: factor2 };
}
function oneOf(...colorValues) {
return { op: 4, values: colorValues };
}
function ifDefinedThenElse(ifArg, thenArg, elseArg) {
return { op: 6, if: ifArg, then: thenArg, else: elseArg };
}
function lessProminent(colorValue, backgroundColorValue, factor2, transparency) {
return { op: 5, value: colorValue, background: backgroundColorValue, factor: factor2, transparency };
}
function resolveColorValue(colorValue, theme) {
if (colorValue === null) {
return void 0;
} else if (typeof colorValue === "string") {
if (colorValue[0] === "#") {
return Color.fromHex(colorValue);
}
return theme.getColor(colorValue);
} else if (colorValue instanceof Color) {
return colorValue;
} else if (typeof colorValue === "object") {
return executeTransform(colorValue, theme);
}
return void 0;
}
var Extensions6, ColorRegistry, colorRegistry, workbenchColorsSchemaId, schemaRegistry, delayer;
var init_colorUtils = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colorUtils.js"() {
init_assert();
init_async();
init_color();
init_event();
init_jsonContributionRegistry();
init_platform2();
Extensions6 = {
ColorContribution: "base.contributions.colors"
};
ColorRegistry = class {
constructor() {
this._onDidChangeSchema = new Emitter();
this.onDidChangeSchema = this._onDidChangeSchema.event;
this.colorSchema = { type: "object", properties: {} };
this.colorReferenceSchema = { type: "string", enum: [], enumDescriptions: [] };
this.colorsById = {};
}
registerColor(id, defaults, description, needsTransparency = false, deprecationMessage) {
const colorContribution = { id, description, defaults, needsTransparency, deprecationMessage };
this.colorsById[id] = colorContribution;
const propertySchema = { type: "string", description, format: "color-hex", defaultSnippets: [{ body: "${1:#ff0000}" }] };
if (deprecationMessage) {
propertySchema.deprecationMessage = deprecationMessage;
}
if (needsTransparency) {
propertySchema.pattern = "^#(?:(?[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$";
propertySchema.patternErrorMessage = "This color must be transparent or it will obscure content";
}
this.colorSchema.properties[id] = propertySchema;
this.colorReferenceSchema.enum.push(id);
this.colorReferenceSchema.enumDescriptions.push(description);
this._onDidChangeSchema.fire();
return id;
}
getColors() {
return Object.keys(this.colorsById).map((id) => this.colorsById[id]);
}
resolveDefaultColor(id, theme) {
const colorDesc = this.colorsById[id];
if (colorDesc && colorDesc.defaults) {
const colorValue = colorDesc.defaults[theme.type];
return resolveColorValue(colorValue, theme);
}
return void 0;
}
getColorSchema() {
return this.colorSchema;
}
toString() {
const sorter2 = (a3, b) => {
const cat1 = a3.indexOf(".") === -1 ? 0 : 1;
const cat2 = b.indexOf(".") === -1 ? 0 : 1;
if (cat1 !== cat2) {
return cat1 - cat2;
}
return a3.localeCompare(b);
};
return Object.keys(this.colorsById).sort(sorter2).map((k) => `- \`${k}\`: ${this.colorsById[k].description}`).join("\n");
}
};
colorRegistry = new ColorRegistry();
Registry.add(Extensions6.ColorContribution, colorRegistry);
workbenchColorsSchemaId = "vscode://schemas/workbench-colors";
schemaRegistry = Registry.as(Extensions3.JSONContribution);
schemaRegistry.registerSchema(workbenchColorsSchemaId, colorRegistry.getColorSchema());
delayer = new RunOnceScheduler(() => schemaRegistry.notifySchemaChanged(workbenchColorsSchemaId), 200);
colorRegistry.onDidChangeSchema(() => {
if (!delayer.isScheduled()) {
delayer.schedule();
}
});
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/baseColors.js
var foreground, disabledForeground, errorForeground, descriptionForeground, iconForeground, focusBorder, contrastBorder, activeContrastBorder, selectionBackground, textLinkForeground, textLinkActiveForeground, textSeparatorForeground, textPreformatForeground, textPreformatBackground, textBlockQuoteBackground, textBlockQuoteBorder, textCodeBlockBackground;
var init_baseColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/baseColors.js"() {
init_nls();
init_color();
init_colorUtils();
foreground = registerColor("foreground", { dark: "#CCCCCC", light: "#616161", hcDark: "#FFFFFF", hcLight: "#292929" }, localize("foreground", "Overall foreground color. This color is only used if not overridden by a component."));
disabledForeground = registerColor("disabledForeground", { dark: "#CCCCCC80", light: "#61616180", hcDark: "#A5A5A5", hcLight: "#7F7F7F" }, localize("disabledForeground", "Overall foreground for disabled elements. This color is only used if not overridden by a component."));
errorForeground = registerColor("errorForeground", { dark: "#F48771", light: "#A1260D", hcDark: "#F48771", hcLight: "#B5200D" }, localize("errorForeground", "Overall foreground color for error messages. This color is only used if not overridden by a component."));
descriptionForeground = registerColor("descriptionForeground", { light: "#717171", dark: transparent(foreground, 0.7), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, localize("descriptionForeground", "Foreground color for description text providing additional information, for example for a label."));
iconForeground = registerColor("icon.foreground", { dark: "#C5C5C5", light: "#424242", hcDark: "#FFFFFF", hcLight: "#292929" }, localize("iconForeground", "The default color for icons in the workbench."));
focusBorder = registerColor("focusBorder", { dark: "#007FD4", light: "#0090F1", hcDark: "#F38518", hcLight: "#006BBD" }, localize("focusBorder", "Overall border color for focused elements. This color is only used if not overridden by a component."));
contrastBorder = registerColor("contrastBorder", { light: null, dark: null, hcDark: "#6FC3DF", hcLight: "#0F4A85" }, localize("contrastBorder", "An extra border around elements to separate them from others for greater contrast."));
activeContrastBorder = registerColor("contrastActiveBorder", { light: null, dark: null, hcDark: focusBorder, hcLight: focusBorder }, localize("activeContrastBorder", "An extra border around active elements to separate them from others for greater contrast."));
selectionBackground = registerColor("selection.background", { light: null, dark: null, hcDark: null, hcLight: null }, 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."));
textLinkForeground = registerColor("textLink.foreground", { light: "#006AB1", dark: "#3794FF", hcDark: "#21A6FF", hcLight: "#0F4A85" }, localize("textLinkForeground", "Foreground color for links in text."));
textLinkActiveForeground = registerColor("textLink.activeForeground", { light: "#006AB1", dark: "#3794FF", hcDark: "#21A6FF", hcLight: "#0F4A85" }, localize("textLinkActiveForeground", "Foreground color for links in text when clicked on and on mouse hover."));
textSeparatorForeground = registerColor("textSeparator.foreground", { light: "#0000002e", dark: "#ffffff2e", hcDark: Color.black, hcLight: "#292929" }, localize("textSeparatorForeground", "Color for text separators."));
textPreformatForeground = registerColor("textPreformat.foreground", { light: "#A31515", dark: "#D7BA7D", hcDark: "#000000", hcLight: "#FFFFFF" }, localize("textPreformatForeground", "Foreground color for preformatted text segments."));
textPreformatBackground = registerColor("textPreformat.background", { light: "#0000001A", dark: "#FFFFFF1A", hcDark: "#FFFFFF", hcLight: "#09345f" }, localize("textPreformatBackground", "Background color for preformatted text segments."));
textBlockQuoteBackground = registerColor("textBlockQuote.background", { light: "#f2f2f2", dark: "#222222", hcDark: null, hcLight: "#F2F2F2" }, localize("textBlockQuoteBackground", "Background color for block quotes in text."));
textBlockQuoteBorder = registerColor("textBlockQuote.border", { light: "#007acc80", dark: "#007acc80", hcDark: Color.white, hcLight: "#292929" }, localize("textBlockQuoteBorder", "Border color for block quotes in text."));
textCodeBlockBackground = registerColor("textCodeBlock.background", { light: "#dcdcdc66", dark: "#0a0a0a66", hcDark: Color.black, hcLight: "#F2F2F2" }, localize("textCodeBlockBackground", "Background color for code blocks in text."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/miscColors.js
var sashHoverBorder, badgeBackground, badgeForeground, scrollbarShadow, scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground, progressBarBackground;
var init_miscColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/miscColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_baseColors();
sashHoverBorder = registerColor("sash.hoverBorder", { dark: focusBorder, light: focusBorder, hcDark: focusBorder, hcLight: focusBorder }, localize("sashActiveBorder", "Border color of active sashes."));
badgeBackground = registerColor("badge.background", { dark: "#4D4D4D", light: "#C4C4C4", hcDark: Color.black, hcLight: "#0F4A85" }, localize("badgeBackground", "Badge background color. Badges are small information labels, e.g. for search results count."));
badgeForeground = registerColor("badge.foreground", { dark: Color.white, light: "#333", hcDark: Color.white, hcLight: Color.white }, localize("badgeForeground", "Badge foreground color. Badges are small information labels, e.g. for search results count."));
scrollbarShadow = registerColor("scrollbar.shadow", { dark: "#000000", light: "#DDDDDD", hcDark: null, hcLight: null }, localize("scrollbarShadow", "Scrollbar shadow to indicate that the view is scrolled."));
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) }, localize("scrollbarSliderBackground", "Scrollbar slider background color."));
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) }, localize("scrollbarSliderHoverBackground", "Scrollbar slider background color when hovering."));
scrollbarSliderActiveBackground = registerColor("scrollbarSlider.activeBackground", { dark: Color.fromHex("#BFBFBF").transparent(0.4), light: Color.fromHex("#000000").transparent(0.6), hcDark: contrastBorder, hcLight: contrastBorder }, localize("scrollbarSliderActiveBackground", "Scrollbar slider background color when clicked on."));
progressBarBackground = registerColor("progressBar.background", { dark: Color.fromHex("#0E70C0"), light: Color.fromHex("#0E70C0"), hcDark: contrastBorder, hcLight: contrastBorder }, localize("progressBarBackground", "Background color of the progress bar that can show for long running operations."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/editorColors.js
var editorBackground, editorForeground, editorStickyScrollBackground, editorStickyScrollHoverBackground, editorStickyScrollBorder, editorStickyScrollShadow, editorWidgetBackground, editorWidgetForeground, editorWidgetBorder, editorWidgetResizeBorder, editorErrorBackground, editorErrorForeground, editorErrorBorder, editorWarningBackground, editorWarningForeground, editorWarningBorder, editorInfoBackground, editorInfoForeground, editorInfoBorder, editorHintForeground, editorHintBorder, editorActiveLinkForeground, editorSelectionBackground, editorSelectionForeground, editorInactiveSelection, editorSelectionHighlight, editorSelectionHighlightBorder, editorFindMatch, editorFindMatchForeground, editorFindMatchHighlight, editorFindMatchHighlightForeground, editorFindRangeHighlight, editorFindMatchBorder, editorFindMatchHighlightBorder, editorFindRangeHighlightBorder, editorHoverHighlight, editorHoverBackground, editorHoverForeground, editorHoverBorder, editorHoverStatusBarBackground, editorInlayHintForeground, editorInlayHintBackground, editorInlayHintTypeForeground, editorInlayHintTypeBackground, editorInlayHintParameterForeground, editorInlayHintParameterBackground, editorLightBulbForeground, editorLightBulbAutoFixForeground, editorLightBulbAiForeground, snippetTabstopHighlightBackground, snippetTabstopHighlightBorder, snippetFinalTabstopHighlightBackground, snippetFinalTabstopHighlightBorder, defaultInsertColor, defaultRemoveColor, diffInserted, diffRemoved, diffInsertedLine, diffRemovedLine, diffInsertedLineGutter, diffRemovedLineGutter, diffOverviewRulerInserted, diffOverviewRulerRemoved, diffInsertedOutline, diffRemovedOutline, diffBorder, diffDiagonalFill, diffUnchangedRegionBackground, diffUnchangedRegionForeground, diffUnchangedTextBackground, widgetShadow, widgetBorder, toolbarHoverBackground, toolbarHoverOutline, toolbarActiveBackground, breadcrumbsForeground, breadcrumbsBackground, breadcrumbsFocusForeground, breadcrumbsActiveSelectionForeground, breadcrumbsPickerBackground, headerTransparency, currentBaseColor, incomingBaseColor, commonBaseColor, contentTransparency, rulerTransparency, mergeCurrentHeaderBackground, mergeCurrentContentBackground, mergeIncomingHeaderBackground, mergeIncomingContentBackground, mergeCommonHeaderBackground, mergeCommonContentBackground, mergeBorder, overviewRulerCurrentContentForeground, overviewRulerIncomingContentForeground, overviewRulerCommonContentForeground, overviewRulerFindMatchForeground, overviewRulerSelectionHighlightForeground, problemsErrorIconForeground, problemsWarningIconForeground, problemsInfoIconForeground;
var init_editorColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/editorColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_baseColors();
init_miscColors();
editorBackground = registerColor("editor.background", { light: "#ffffff", dark: "#1E1E1E", hcDark: Color.black, hcLight: Color.white }, localize("editorBackground", "Editor background color."));
editorForeground = registerColor("editor.foreground", { light: "#333333", dark: "#BBBBBB", hcDark: Color.white, hcLight: foreground }, localize("editorForeground", "Editor default foreground color."));
editorStickyScrollBackground = registerColor("editorStickyScroll.background", { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, localize("editorStickyScrollBackground", "Background color of sticky scroll in the editor"));
editorStickyScrollHoverBackground = registerColor("editorStickyScrollHover.background", { dark: "#2A2D2E", light: "#F0F0F0", hcDark: null, hcLight: Color.fromHex("#0F4A85").transparent(0.1) }, localize("editorStickyScrollHoverBackground", "Background color of sticky scroll on hover in the editor"));
editorStickyScrollBorder = registerColor("editorStickyScroll.border", { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, localize("editorStickyScrollBorder", "Border color of sticky scroll in the editor"));
editorStickyScrollShadow = registerColor("editorStickyScroll.shadow", { dark: scrollbarShadow, light: scrollbarShadow, hcDark: scrollbarShadow, hcLight: scrollbarShadow }, localize("editorStickyScrollShadow", " Shadow color of sticky scroll in the editor"));
editorWidgetBackground = registerColor("editorWidget.background", { dark: "#252526", light: "#F3F3F3", hcDark: "#0C141F", hcLight: Color.white }, localize("editorWidgetBackground", "Background color of editor widgets, such as find/replace."));
editorWidgetForeground = registerColor("editorWidget.foreground", { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, localize("editorWidgetForeground", "Foreground color of editor widgets, such as find/replace."));
editorWidgetBorder = registerColor("editorWidget.border", { dark: "#454545", light: "#C8C8C8", hcDark: contrastBorder, hcLight: contrastBorder }, 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."));
editorWidgetResizeBorder = registerColor("editorWidget.resizeBorder", { light: null, dark: null, hcDark: null, hcLight: null }, 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."));
editorErrorBackground = registerColor("editorError.background", { dark: null, light: null, hcDark: null, hcLight: null }, 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);
editorErrorForeground = registerColor("editorError.foreground", { dark: "#F14C4C", light: "#E51400", hcDark: "#F48771", hcLight: "#B5200D" }, localize("editorError.foreground", "Foreground color of error squigglies in the editor."));
editorErrorBorder = registerColor("editorError.border", { dark: null, light: null, hcDark: Color.fromHex("#E47777").transparent(0.8), hcLight: "#B5200D" }, localize("errorBorder", "If set, color of double underlines for errors in the editor."));
editorWarningBackground = registerColor("editorWarning.background", { dark: null, light: null, hcDark: null, hcLight: null }, 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);
editorWarningForeground = registerColor("editorWarning.foreground", { dark: "#CCA700", light: "#BF8803", hcDark: "#FFD370", hcLight: "#895503" }, localize("editorWarning.foreground", "Foreground color of warning squigglies in the editor."));
editorWarningBorder = registerColor("editorWarning.border", { dark: null, light: null, hcDark: Color.fromHex("#FFCC00").transparent(0.8), hcLight: Color.fromHex("#FFCC00").transparent(0.8) }, localize("warningBorder", "If set, color of double underlines for warnings in the editor."));
editorInfoBackground = registerColor("editorInfo.background", { dark: null, light: null, hcDark: null, hcLight: null }, 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);
editorInfoForeground = registerColor("editorInfo.foreground", { dark: "#3794FF", light: "#1a85ff", hcDark: "#3794FF", hcLight: "#1a85ff" }, localize("editorInfo.foreground", "Foreground color of info squigglies in the editor."));
editorInfoBorder = registerColor("editorInfo.border", { dark: null, light: null, hcDark: Color.fromHex("#3794FF").transparent(0.8), hcLight: "#292929" }, localize("infoBorder", "If set, color of double underlines for infos in the editor."));
editorHintForeground = registerColor("editorHint.foreground", { dark: Color.fromHex("#eeeeee").transparent(0.7), light: "#6c6c6c", hcDark: null, hcLight: null }, localize("editorHint.foreground", "Foreground color of hint squigglies in the editor."));
editorHintBorder = registerColor("editorHint.border", { dark: null, light: null, hcDark: Color.fromHex("#eeeeee").transparent(0.8), hcLight: "#292929" }, localize("hintBorder", "If set, color of double underlines for hints in the editor."));
editorActiveLinkForeground = registerColor("editorLink.activeForeground", { dark: "#4E94CE", light: Color.blue, hcDark: Color.cyan, hcLight: "#292929" }, localize("activeLinkForeground", "Color of active links."));
editorSelectionBackground = registerColor("editor.selectionBackground", { light: "#ADD6FF", dark: "#264F78", hcDark: "#f3f518", hcLight: "#0F4A85" }, localize("editorSelectionBackground", "Color of the editor selection."));
editorSelectionForeground = registerColor("editor.selectionForeground", { light: null, dark: null, hcDark: "#000000", hcLight: Color.white }, localize("editorSelectionForeground", "Color of the selected text for high contrast."));
editorInactiveSelection = registerColor("editor.inactiveSelectionBackground", { light: transparent(editorSelectionBackground, 0.5), dark: transparent(editorSelectionBackground, 0.5), hcDark: transparent(editorSelectionBackground, 0.7), hcLight: transparent(editorSelectionBackground, 0.5) }, localize("editorInactiveSelection", "Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."), true);
editorSelectionHighlight = registerColor("editor.selectionHighlightBackground", { light: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), hcDark: null, hcLight: null }, 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);
editorSelectionHighlightBorder = registerColor("editor.selectionHighlightBorder", { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("editorSelectionHighlightBorder", "Border color for regions with the same content as the selection."));
editorFindMatch = registerColor("editor.findMatchBackground", { light: "#A8AC94", dark: "#515C6A", hcDark: null, hcLight: null }, localize("editorFindMatch", "Color of the current search match."));
editorFindMatchForeground = registerColor("editor.findMatchForeground", { light: null, dark: null, hcDark: null, hcLight: null }, localize("editorFindMatchForeground", "Text color of the current search match."));
editorFindMatchHighlight = registerColor("editor.findMatchHighlightBackground", { light: "#EA5C0055", dark: "#EA5C0055", hcDark: null, hcLight: null }, localize("findMatchHighlight", "Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."), true);
editorFindMatchHighlightForeground = registerColor("editor.findMatchHighlightForeground", { light: null, dark: null, hcDark: null, hcLight: null }, localize("findMatchHighlightForeground", "Foreground color of the other search matches."), true);
editorFindRangeHighlight = registerColor("editor.findRangeHighlightBackground", { dark: "#3a3d4166", light: "#b4b4b44d", hcDark: null, hcLight: null }, localize("findRangeHighlight", "Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."), true);
editorFindMatchBorder = registerColor("editor.findMatchBorder", { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("editorFindMatchBorder", "Border color of the current search match."));
editorFindMatchHighlightBorder = registerColor("editor.findMatchHighlightBorder", { light: null, dark: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("findMatchHighlightBorder", "Border color of the other search matches."));
editorFindRangeHighlightBorder = registerColor("editor.findRangeHighlightBorder", { dark: null, light: null, hcDark: transparent(activeContrastBorder, 0.4), hcLight: transparent(activeContrastBorder, 0.4) }, localize("findRangeHighlightBorder", "Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."), true);
editorHoverHighlight = registerColor("editor.hoverHighlightBackground", { light: "#ADD6FF26", dark: "#264f7840", hcDark: "#ADD6FF26", hcLight: null }, 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);
editorHoverBackground = registerColor("editorHoverWidget.background", { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("hoverBackground", "Background color of the editor hover."));
editorHoverForeground = registerColor("editorHoverWidget.foreground", { light: editorWidgetForeground, dark: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, localize("hoverForeground", "Foreground color of the editor hover."));
editorHoverBorder = registerColor("editorHoverWidget.border", { light: editorWidgetBorder, dark: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, localize("hoverBorder", "Border color of the editor hover."));
editorHoverStatusBarBackground = registerColor("editorHoverWidget.statusBarBackground", { dark: lighten(editorHoverBackground, 0.2), light: darken(editorHoverBackground, 0.05), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("statusBarBackground", "Background color of the editor hover status bar."));
editorInlayHintForeground = registerColor("editorInlayHint.foreground", { dark: "#969696", light: "#969696", hcDark: Color.white, hcLight: Color.black }, localize("editorInlayHintForeground", "Foreground color of inline hints"));
editorInlayHintBackground = registerColor("editorInlayHint.background", { dark: transparent(badgeBackground, 0.1), light: transparent(badgeBackground, 0.1), hcDark: transparent(Color.white, 0.1), hcLight: transparent(badgeBackground, 0.1) }, localize("editorInlayHintBackground", "Background color of inline hints"));
editorInlayHintTypeForeground = registerColor("editorInlayHint.typeForeground", { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, localize("editorInlayHintForegroundTypes", "Foreground color of inline hints for types"));
editorInlayHintTypeBackground = registerColor("editorInlayHint.typeBackground", { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, localize("editorInlayHintBackgroundTypes", "Background color of inline hints for types"));
editorInlayHintParameterForeground = registerColor("editorInlayHint.parameterForeground", { dark: editorInlayHintForeground, light: editorInlayHintForeground, hcDark: editorInlayHintForeground, hcLight: editorInlayHintForeground }, localize("editorInlayHintForegroundParameter", "Foreground color of inline hints for parameters"));
editorInlayHintParameterBackground = registerColor("editorInlayHint.parameterBackground", { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, localize("editorInlayHintBackgroundParameter", "Background color of inline hints for parameters"));
editorLightBulbForeground = registerColor("editorLightBulb.foreground", { dark: "#FFCC00", light: "#DDB100", hcDark: "#FFCC00", hcLight: "#007ACC" }, localize("editorLightBulbForeground", "The color used for the lightbulb actions icon."));
editorLightBulbAutoFixForeground = registerColor("editorLightBulbAutoFix.foreground", { dark: "#75BEFF", light: "#007ACC", hcDark: "#75BEFF", hcLight: "#007ACC" }, localize("editorLightBulbAutoFixForeground", "The color used for the lightbulb auto fix actions icon."));
editorLightBulbAiForeground = registerColor("editorLightBulbAi.foreground", { dark: editorLightBulbForeground, light: editorLightBulbForeground, hcDark: editorLightBulbForeground, hcLight: editorLightBulbForeground }, localize("editorLightBulbAiForeground", "The color used for the lightbulb AI icon."));
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)) }, localize("snippetTabstopHighlightBackground", "Highlight background color of a snippet tabstop."));
snippetTabstopHighlightBorder = registerColor("editor.snippetTabstopHighlightBorder", { dark: null, light: null, hcDark: null, hcLight: null }, localize("snippetTabstopHighlightBorder", "Highlight border color of a snippet tabstop."));
snippetFinalTabstopHighlightBackground = registerColor("editor.snippetFinalTabstopHighlightBackground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("snippetFinalTabstopHighlightBackground", "Highlight background color of the final tabstop of a snippet."));
snippetFinalTabstopHighlightBorder = registerColor("editor.snippetFinalTabstopHighlightBorder", { dark: "#525252", light: new Color(new RGBA(10, 50, 100, 0.5)), hcDark: "#525252", hcLight: "#292929" }, localize("snippetFinalTabstopHighlightBorder", "Highlight border color of the final tabstop of a snippet."));
defaultInsertColor = new Color(new RGBA(155, 185, 85, 0.2));
defaultRemoveColor = new Color(new RGBA(255, 0, 0, 0.2));
diffInserted = registerColor("diffEditor.insertedTextBackground", { dark: "#9ccc2c33", light: "#9ccc2c40", hcDark: null, hcLight: null }, localize("diffEditorInserted", "Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."), true);
diffRemoved = registerColor("diffEditor.removedTextBackground", { dark: "#ff000033", light: "#ff000033", hcDark: null, hcLight: null }, localize("diffEditorRemoved", "Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."), true);
diffInsertedLine = registerColor("diffEditor.insertedLineBackground", { dark: defaultInsertColor, light: defaultInsertColor, hcDark: null, hcLight: null }, localize("diffEditorInsertedLines", "Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."), true);
diffRemovedLine = registerColor("diffEditor.removedLineBackground", { dark: defaultRemoveColor, light: defaultRemoveColor, hcDark: null, hcLight: null }, localize("diffEditorRemovedLines", "Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."), true);
diffInsertedLineGutter = registerColor("diffEditorGutter.insertedLineBackground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("diffEditorInsertedLineGutter", "Background color for the margin where lines got inserted."));
diffRemovedLineGutter = registerColor("diffEditorGutter.removedLineBackground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("diffEditorRemovedLineGutter", "Background color for the margin where lines got removed."));
diffOverviewRulerInserted = registerColor("diffEditorOverview.insertedForeground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("diffEditorOverviewInserted", "Diff overview ruler foreground for inserted content."));
diffOverviewRulerRemoved = registerColor("diffEditorOverview.removedForeground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("diffEditorOverviewRemoved", "Diff overview ruler foreground for removed content."));
diffInsertedOutline = registerColor("diffEditor.insertedTextBorder", { dark: null, light: null, hcDark: "#33ff2eff", hcLight: "#374E06" }, localize("diffEditorInsertedOutline", "Outline color for the text that got inserted."));
diffRemovedOutline = registerColor("diffEditor.removedTextBorder", { dark: null, light: null, hcDark: "#FF008F", hcLight: "#AD0707" }, localize("diffEditorRemovedOutline", "Outline color for text that got removed."));
diffBorder = registerColor("diffEditor.border", { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, localize("diffEditorBorder", "Border color between the two text editors."));
diffDiagonalFill = registerColor("diffEditor.diagonalFill", { dark: "#cccccc33", light: "#22222233", hcDark: null, hcLight: null }, localize("diffDiagonalFill", "Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views."));
diffUnchangedRegionBackground = registerColor("diffEditor.unchangedRegionBackground", { dark: "sideBar.background", light: "sideBar.background", hcDark: "sideBar.background", hcLight: "sideBar.background" }, localize("diffEditor.unchangedRegionBackground", "The background color of unchanged blocks in the diff editor."));
diffUnchangedRegionForeground = registerColor("diffEditor.unchangedRegionForeground", { dark: "foreground", light: "foreground", hcDark: "foreground", hcLight: "foreground" }, localize("diffEditor.unchangedRegionForeground", "The foreground color of unchanged blocks in the diff editor."));
diffUnchangedTextBackground = registerColor("diffEditor.unchangedCodeBackground", { dark: "#74747429", light: "#b8b8b829", hcDark: null, hcLight: null }, localize("diffEditor.unchangedCodeBackground", "The background color of unchanged code in the diff editor."));
widgetShadow = registerColor("widget.shadow", { dark: transparent(Color.black, 0.36), light: transparent(Color.black, 0.16), hcDark: null, hcLight: null }, localize("widgetShadow", "Shadow color of widgets such as find/replace inside the editor."));
widgetBorder = registerColor("widget.border", { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, localize("widgetBorder", "Border color of widgets such as find/replace inside the editor."));
toolbarHoverBackground = registerColor("toolbar.hoverBackground", { dark: "#5a5d5e50", light: "#b8b8b850", hcDark: null, hcLight: null }, localize("toolbarHoverBackground", "Toolbar background when hovering over actions using the mouse"));
toolbarHoverOutline = registerColor("toolbar.hoverOutline", { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("toolbarHoverOutline", "Toolbar outline when hovering over actions using the mouse"));
toolbarActiveBackground = registerColor("toolbar.activeBackground", { dark: lighten(toolbarHoverBackground, 0.1), light: darken(toolbarHoverBackground, 0.1), hcDark: null, hcLight: null }, localize("toolbarActiveBackground", "Toolbar background when holding the mouse over actions"));
breadcrumbsForeground = registerColor("breadcrumb.foreground", { light: transparent(foreground, 0.8), dark: transparent(foreground, 0.8), hcDark: transparent(foreground, 0.8), hcLight: transparent(foreground, 0.8) }, localize("breadcrumbsFocusForeground", "Color of focused breadcrumb items."));
breadcrumbsBackground = registerColor("breadcrumb.background", { light: editorBackground, dark: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, localize("breadcrumbsBackground", "Background color of breadcrumb items."));
breadcrumbsFocusForeground = registerColor("breadcrumb.focusForeground", { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, localize("breadcrumbsFocusForeground", "Color of focused breadcrumb items."));
breadcrumbsActiveSelectionForeground = registerColor("breadcrumb.activeSelectionForeground", { light: darken(foreground, 0.2), dark: lighten(foreground, 0.1), hcDark: lighten(foreground, 0.1), hcLight: lighten(foreground, 0.1) }, localize("breadcrumbsSelectedForeground", "Color of selected breadcrumb items."));
breadcrumbsPickerBackground = registerColor("breadcrumbPicker.background", { light: editorWidgetBackground, dark: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("breadcrumbsSelectedBackground", "Background color of breadcrumb item picker."));
headerTransparency = 0.5;
currentBaseColor = Color.fromHex("#40C8AE").transparent(headerTransparency);
incomingBaseColor = Color.fromHex("#40A6FF").transparent(headerTransparency);
commonBaseColor = Color.fromHex("#606060").transparent(0.4);
contentTransparency = 0.4;
rulerTransparency = 1;
mergeCurrentHeaderBackground = registerColor("merge.currentHeaderBackground", { dark: currentBaseColor, light: currentBaseColor, hcDark: null, hcLight: null }, localize("mergeCurrentHeaderBackground", "Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeCurrentContentBackground = registerColor("merge.currentContentBackground", { dark: transparent(mergeCurrentHeaderBackground, contentTransparency), light: transparent(mergeCurrentHeaderBackground, contentTransparency), hcDark: transparent(mergeCurrentHeaderBackground, contentTransparency), hcLight: transparent(mergeCurrentHeaderBackground, contentTransparency) }, localize("mergeCurrentContentBackground", "Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeIncomingHeaderBackground = registerColor("merge.incomingHeaderBackground", { dark: incomingBaseColor, light: incomingBaseColor, hcDark: null, hcLight: null }, localize("mergeIncomingHeaderBackground", "Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeIncomingContentBackground = registerColor("merge.incomingContentBackground", { dark: transparent(mergeIncomingHeaderBackground, contentTransparency), light: transparent(mergeIncomingHeaderBackground, contentTransparency), hcDark: transparent(mergeIncomingHeaderBackground, contentTransparency), hcLight: transparent(mergeIncomingHeaderBackground, contentTransparency) }, localize("mergeIncomingContentBackground", "Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeCommonHeaderBackground = registerColor("merge.commonHeaderBackground", { dark: commonBaseColor, light: commonBaseColor, hcDark: null, hcLight: null }, localize("mergeCommonHeaderBackground", "Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeCommonContentBackground = registerColor("merge.commonContentBackground", { dark: transparent(mergeCommonHeaderBackground, contentTransparency), light: transparent(mergeCommonHeaderBackground, contentTransparency), hcDark: transparent(mergeCommonHeaderBackground, contentTransparency), hcLight: transparent(mergeCommonHeaderBackground, contentTransparency) }, localize("mergeCommonContentBackground", "Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."), true);
mergeBorder = registerColor("merge.border", { dark: null, light: null, hcDark: "#C3DF6F", hcLight: "#007ACC" }, localize("mergeBorder", "Border color on headers and the splitter in inline merge-conflicts."));
overviewRulerCurrentContentForeground = registerColor("editorOverviewRuler.currentContentForeground", { dark: transparent(mergeCurrentHeaderBackground, rulerTransparency), light: transparent(mergeCurrentHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, localize("overviewRulerCurrentContentForeground", "Current overview ruler foreground for inline merge-conflicts."));
overviewRulerIncomingContentForeground = registerColor("editorOverviewRuler.incomingContentForeground", { dark: transparent(mergeIncomingHeaderBackground, rulerTransparency), light: transparent(mergeIncomingHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, localize("overviewRulerIncomingContentForeground", "Incoming overview ruler foreground for inline merge-conflicts."));
overviewRulerCommonContentForeground = registerColor("editorOverviewRuler.commonContentForeground", { dark: transparent(mergeCommonHeaderBackground, rulerTransparency), light: transparent(mergeCommonHeaderBackground, rulerTransparency), hcDark: mergeBorder, hcLight: mergeBorder }, localize("overviewRulerCommonContentForeground", "Common ancestor overview ruler foreground for inline merge-conflicts."));
overviewRulerFindMatchForeground = registerColor("editorOverviewRuler.findMatchForeground", { dark: "#d186167e", light: "#d186167e", hcDark: "#AB5A00", hcLight: "" }, localize("overviewRulerFindMatchForeground", "Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."), true);
overviewRulerSelectionHighlightForeground = registerColor("editorOverviewRuler.selectionHighlightForeground", { dark: "#A0A0A0CC", light: "#A0A0A0CC", hcDark: "#A0A0A0CC", hcLight: "#A0A0A0CC" }, localize("overviewRulerSelectionHighlightForeground", "Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."), true);
problemsErrorIconForeground = registerColor("problemsErrorIcon.foreground", { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, localize("problemsErrorIconForeground", "The color used for the problems error icon."));
problemsWarningIconForeground = registerColor("problemsWarningIcon.foreground", { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, localize("problemsWarningIconForeground", "The color used for the problems warning icon."));
problemsInfoIconForeground = registerColor("problemsInfoIcon.foreground", { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, localize("problemsInfoIconForeground", "The color used for the problems info icon."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/minimapColors.js
var minimapFindMatch, minimapSelectionOccurrenceHighlight, minimapSelection, minimapInfo, minimapWarning, minimapError, minimapBackground, minimapForegroundOpacity, minimapSliderBackground, minimapSliderHoverBackground, minimapSliderActiveBackground;
var init_minimapColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/minimapColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_editorColors();
init_miscColors();
minimapFindMatch = registerColor("minimap.findMatchHighlight", { light: "#d18616", dark: "#d18616", hcDark: "#AB5A00", hcLight: "#0F4A85" }, localize("minimapFindMatchHighlight", "Minimap marker color for find matches."), true);
minimapSelectionOccurrenceHighlight = registerColor("minimap.selectionOccurrenceHighlight", { light: "#c9c9c9", dark: "#676767", hcDark: "#ffffff", hcLight: "#0F4A85" }, localize("minimapSelectionOccurrenceHighlight", "Minimap marker color for repeating editor selections."), true);
minimapSelection = registerColor("minimap.selectionHighlight", { light: "#ADD6FF", dark: "#264F78", hcDark: "#ffffff", hcLight: "#0F4A85" }, localize("minimapSelectionHighlight", "Minimap marker color for the editor selection."), true);
minimapInfo = registerColor("minimap.infoHighlight", { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, localize("minimapInfo", "Minimap marker color for infos."));
minimapWarning = registerColor("minimap.warningHighlight", { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, localize("overviewRuleWarning", "Minimap marker color for warnings."));
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" }, localize("minimapError", "Minimap marker color for errors."));
minimapBackground = registerColor("minimap.background", { dark: null, light: null, hcDark: null, hcLight: null }, localize("minimapBackground", "Minimap background color."));
minimapForegroundOpacity = registerColor("minimap.foregroundOpacity", { dark: Color.fromHex("#000f"), light: Color.fromHex("#000f"), hcDark: Color.fromHex("#000f"), hcLight: Color.fromHex("#000f") }, localize("minimapForegroundOpacity", 'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));
minimapSliderBackground = registerColor("minimapSlider.background", { light: transparent(scrollbarSliderBackground, 0.5), dark: transparent(scrollbarSliderBackground, 0.5), hcDark: transparent(scrollbarSliderBackground, 0.5), hcLight: transparent(scrollbarSliderBackground, 0.5) }, localize("minimapSliderBackground", "Minimap slider background color."));
minimapSliderHoverBackground = registerColor("minimapSlider.hoverBackground", { light: transparent(scrollbarSliderHoverBackground, 0.5), dark: transparent(scrollbarSliderHoverBackground, 0.5), hcDark: transparent(scrollbarSliderHoverBackground, 0.5), hcLight: transparent(scrollbarSliderHoverBackground, 0.5) }, localize("minimapSliderHoverBackground", "Minimap slider background color when hovering."));
minimapSliderActiveBackground = registerColor("minimapSlider.activeBackground", { light: transparent(scrollbarSliderActiveBackground, 0.5), dark: transparent(scrollbarSliderActiveBackground, 0.5), hcDark: transparent(scrollbarSliderActiveBackground, 0.5), hcLight: transparent(scrollbarSliderActiveBackground, 0.5) }, localize("minimapSliderActiveBackground", "Minimap slider background color when clicked on."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/chartsColors.js
var chartsForeground, chartsLines, chartsRed, chartsBlue, chartsYellow, chartsOrange, chartsGreen, chartsPurple;
var init_chartsColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/chartsColors.js"() {
init_nls();
init_colorUtils();
init_baseColors();
init_editorColors();
init_minimapColors();
chartsForeground = registerColor("charts.foreground", { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, localize("chartsForeground", "The foreground color used in charts."));
chartsLines = registerColor("charts.lines", { dark: transparent(foreground, 0.5), light: transparent(foreground, 0.5), hcDark: transparent(foreground, 0.5), hcLight: transparent(foreground, 0.5) }, localize("chartsLines", "The color used for horizontal lines in charts."));
chartsRed = registerColor("charts.red", { dark: editorErrorForeground, light: editorErrorForeground, hcDark: editorErrorForeground, hcLight: editorErrorForeground }, localize("chartsRed", "The red color used in chart visualizations."));
chartsBlue = registerColor("charts.blue", { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoForeground, hcLight: editorInfoForeground }, localize("chartsBlue", "The blue color used in chart visualizations."));
chartsYellow = registerColor("charts.yellow", { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, localize("chartsYellow", "The yellow color used in chart visualizations."));
chartsOrange = registerColor("charts.orange", { dark: minimapFindMatch, light: minimapFindMatch, hcDark: minimapFindMatch, hcLight: minimapFindMatch }, localize("chartsOrange", "The orange color used in chart visualizations."));
chartsGreen = registerColor("charts.green", { dark: "#89D185", light: "#388A34", hcDark: "#89D185", hcLight: "#374e06" }, localize("chartsGreen", "The green color used in chart visualizations."));
chartsPurple = registerColor("charts.purple", { dark: "#B180D7", light: "#652D90", hcDark: "#B180D7", hcLight: "#652D90" }, localize("chartsPurple", "The purple color used in chart visualizations."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/inputColors.js
var inputBackground, inputForeground, inputBorder, inputActiveOptionBorder, inputActiveOptionHoverBackground, inputActiveOptionBackground, inputActiveOptionForeground, inputPlaceholderForeground, inputValidationInfoBackground, inputValidationInfoForeground, inputValidationInfoBorder, inputValidationWarningBackground, inputValidationWarningForeground, inputValidationWarningBorder, inputValidationErrorBackground, inputValidationErrorForeground, inputValidationErrorBorder, selectBackground, selectListBackground, selectForeground, selectBorder, buttonForeground, buttonSeparator, buttonBackground, buttonHoverBackground, buttonBorder, buttonSecondaryForeground, buttonSecondaryBackground, buttonSecondaryHoverBackground, checkboxBackground, checkboxSelectBackground, checkboxForeground, checkboxBorder, checkboxSelectBorder, keybindingLabelBackground, keybindingLabelForeground, keybindingLabelBorder, keybindingLabelBottomBorder;
var init_inputColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/inputColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_baseColors();
init_editorColors();
inputBackground = registerColor("input.background", { dark: "#3C3C3C", light: Color.white, hcDark: Color.black, hcLight: Color.white }, localize("inputBoxBackground", "Input box background."));
inputForeground = registerColor("input.foreground", { dark: foreground, light: foreground, hcDark: foreground, hcLight: foreground }, localize("inputBoxForeground", "Input box foreground."));
inputBorder = registerColor("input.border", { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, localize("inputBoxBorder", "Input box border."));
inputActiveOptionBorder = registerColor("inputOption.activeBorder", { dark: "#007ACC", light: "#007ACC", hcDark: contrastBorder, hcLight: contrastBorder }, localize("inputBoxActiveOptionBorder", "Border color of activated options in input fields."));
inputActiveOptionHoverBackground = registerColor("inputOption.hoverBackground", { dark: "#5a5d5e80", light: "#b8b8b850", hcDark: null, hcLight: null }, localize("inputOption.hoverBackground", "Background color of activated options in input fields."));
inputActiveOptionBackground = registerColor("inputOption.activeBackground", { dark: transparent(focusBorder, 0.4), light: transparent(focusBorder, 0.2), hcDark: Color.transparent, hcLight: Color.transparent }, localize("inputOption.activeBackground", "Background hover color of options in input fields."));
inputActiveOptionForeground = registerColor("inputOption.activeForeground", { dark: Color.white, light: Color.black, hcDark: foreground, hcLight: foreground }, localize("inputOption.activeForeground", "Foreground color of activated options in input fields."));
inputPlaceholderForeground = registerColor("input.placeholderForeground", { light: transparent(foreground, 0.5), dark: transparent(foreground, 0.5), hcDark: transparent(foreground, 0.7), hcLight: transparent(foreground, 0.7) }, localize("inputPlaceholderForeground", "Input box foreground color for placeholder text."));
inputValidationInfoBackground = registerColor("inputValidation.infoBackground", { dark: "#063B49", light: "#D6ECF2", hcDark: Color.black, hcLight: Color.white }, localize("inputValidationInfoBackground", "Input validation background color for information severity."));
inputValidationInfoForeground = registerColor("inputValidation.infoForeground", { dark: null, light: null, hcDark: null, hcLight: foreground }, localize("inputValidationInfoForeground", "Input validation foreground color for information severity."));
inputValidationInfoBorder = registerColor("inputValidation.infoBorder", { dark: "#007acc", light: "#007acc", hcDark: contrastBorder, hcLight: contrastBorder }, localize("inputValidationInfoBorder", "Input validation border color for information severity."));
inputValidationWarningBackground = registerColor("inputValidation.warningBackground", { dark: "#352A05", light: "#F6F5D2", hcDark: Color.black, hcLight: Color.white }, localize("inputValidationWarningBackground", "Input validation background color for warning severity."));
inputValidationWarningForeground = registerColor("inputValidation.warningForeground", { dark: null, light: null, hcDark: null, hcLight: foreground }, localize("inputValidationWarningForeground", "Input validation foreground color for warning severity."));
inputValidationWarningBorder = registerColor("inputValidation.warningBorder", { dark: "#B89500", light: "#B89500", hcDark: contrastBorder, hcLight: contrastBorder }, localize("inputValidationWarningBorder", "Input validation border color for warning severity."));
inputValidationErrorBackground = registerColor("inputValidation.errorBackground", { dark: "#5A1D1D", light: "#F2DEDE", hcDark: Color.black, hcLight: Color.white }, localize("inputValidationErrorBackground", "Input validation background color for error severity."));
inputValidationErrorForeground = registerColor("inputValidation.errorForeground", { dark: null, light: null, hcDark: null, hcLight: foreground }, localize("inputValidationErrorForeground", "Input validation foreground color for error severity."));
inputValidationErrorBorder = registerColor("inputValidation.errorBorder", { dark: "#BE1100", light: "#BE1100", hcDark: contrastBorder, hcLight: contrastBorder }, localize("inputValidationErrorBorder", "Input validation border color for error severity."));
selectBackground = registerColor("dropdown.background", { dark: "#3C3C3C", light: Color.white, hcDark: Color.black, hcLight: Color.white }, localize("dropdownBackground", "Dropdown background."));
selectListBackground = registerColor("dropdown.listBackground", { dark: null, light: null, hcDark: Color.black, hcLight: Color.white }, localize("dropdownListBackground", "Dropdown list background."));
selectForeground = registerColor("dropdown.foreground", { dark: "#F0F0F0", light: foreground, hcDark: Color.white, hcLight: foreground }, localize("dropdownForeground", "Dropdown foreground."));
selectBorder = registerColor("dropdown.border", { dark: selectBackground, light: "#CECECE", hcDark: contrastBorder, hcLight: contrastBorder }, localize("dropdownBorder", "Dropdown border."));
buttonForeground = registerColor("button.foreground", { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: Color.white }, localize("buttonForeground", "Button foreground color."));
buttonSeparator = registerColor("button.separator", { dark: transparent(buttonForeground, 0.4), light: transparent(buttonForeground, 0.4), hcDark: transparent(buttonForeground, 0.4), hcLight: transparent(buttonForeground, 0.4) }, localize("buttonSeparator", "Button separator color."));
buttonBackground = registerColor("button.background", { dark: "#0E639C", light: "#007ACC", hcDark: null, hcLight: "#0F4A85" }, localize("buttonBackground", "Button background color."));
buttonHoverBackground = registerColor("button.hoverBackground", { dark: lighten(buttonBackground, 0.2), light: darken(buttonBackground, 0.2), hcDark: buttonBackground, hcLight: buttonBackground }, localize("buttonHoverBackground", "Button background color when hovering."));
buttonBorder = registerColor("button.border", { dark: contrastBorder, light: contrastBorder, hcDark: contrastBorder, hcLight: contrastBorder }, localize("buttonBorder", "Button border color."));
buttonSecondaryForeground = registerColor("button.secondaryForeground", { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: foreground }, localize("buttonSecondaryForeground", "Secondary button foreground color."));
buttonSecondaryBackground = registerColor("button.secondaryBackground", { dark: "#3A3D41", light: "#5F6A79", hcDark: null, hcLight: Color.white }, localize("buttonSecondaryBackground", "Secondary button background color."));
buttonSecondaryHoverBackground = registerColor("button.secondaryHoverBackground", { dark: lighten(buttonSecondaryBackground, 0.2), light: darken(buttonSecondaryBackground, 0.2), hcDark: null, hcLight: null }, localize("buttonSecondaryHoverBackground", "Secondary button background color when hovering."));
checkboxBackground = registerColor("checkbox.background", { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, localize("checkbox.background", "Background color of checkbox widget."));
checkboxSelectBackground = registerColor("checkbox.selectBackground", { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("checkbox.select.background", "Background color of checkbox widget when the element it's in is selected."));
checkboxForeground = registerColor("checkbox.foreground", { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, localize("checkbox.foreground", "Foreground color of checkbox widget."));
checkboxBorder = registerColor("checkbox.border", { dark: selectBorder, light: selectBorder, hcDark: selectBorder, hcLight: selectBorder }, localize("checkbox.border", "Border color of checkbox widget."));
checkboxSelectBorder = registerColor("checkbox.selectBorder", { dark: iconForeground, light: iconForeground, hcDark: iconForeground, hcLight: iconForeground }, localize("checkbox.select.border", "Border color of checkbox widget when the element it's in is selected."));
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 }, localize("keybindingLabelBackground", "Keybinding label background color. The keybinding label is used to represent a keyboard shortcut."));
keybindingLabelForeground = registerColor("keybindingLabel.foreground", { dark: Color.fromHex("#CCCCCC"), light: Color.fromHex("#555555"), hcDark: Color.white, hcLight: foreground }, localize("keybindingLabelForeground", "Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut."));
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 }, localize("keybindingLabelBorder", "Keybinding label border color. The keybinding label is used to represent a keyboard shortcut."));
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 }, localize("keybindingLabelBottomBorder", "Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/listColors.js
var listFocusBackground, listFocusForeground, listFocusOutline, listFocusAndSelectionOutline, listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground, listInactiveSelectionBackground, listInactiveSelectionForeground, listInactiveSelectionIconForeground, listInactiveFocusBackground, listInactiveFocusOutline, listHoverBackground, listHoverForeground, listDropOverBackground, listDropBetweenBackground, listHighlightForeground, listFocusHighlightForeground, listInvalidItemForeground, listErrorForeground, listWarningForeground, listFilterWidgetBackground, listFilterWidgetOutline, listFilterWidgetNoMatchesOutline, listFilterWidgetShadow, listFilterMatchHighlight, listFilterMatchHighlightBorder, listDeemphasizedForeground, treeIndentGuidesStroke, treeInactiveIndentGuidesStroke, tableColumnsBorder, tableOddRowsBackgroundColor;
var init_listColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/listColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_baseColors();
init_editorColors();
listFocusBackground = registerColor("list.focusBackground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listFocusForeground = registerColor("list.focusForeground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listFocusOutline = registerColor("list.focusOutline", { dark: focusBorder, light: focusBorder, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, 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."));
listFocusAndSelectionOutline = registerColor("list.focusAndSelectionOutline", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listActiveSelectionBackground = registerColor("list.activeSelectionBackground", { dark: "#04395E", light: "#0060C0", hcDark: null, hcLight: Color.fromHex("#0F4A85").transparent(0.1) }, 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."));
listActiveSelectionForeground = registerColor("list.activeSelectionForeground", { dark: Color.white, light: Color.white, hcDark: null, hcLight: null }, 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."));
listActiveSelectionIconForeground = registerColor("list.activeSelectionIconForeground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listInactiveSelectionBackground = registerColor("list.inactiveSelectionBackground", { dark: "#37373D", light: "#E4E6F1", hcDark: null, hcLight: Color.fromHex("#0F4A85").transparent(0.1) }, 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."));
listInactiveSelectionForeground = registerColor("list.inactiveSelectionForeground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listInactiveSelectionIconForeground = registerColor("list.inactiveSelectionIconForeground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listInactiveFocusBackground = registerColor("list.inactiveFocusBackground", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listInactiveFocusOutline = registerColor("list.inactiveFocusOutline", { dark: null, light: null, hcDark: null, hcLight: null }, 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."));
listHoverBackground = registerColor("list.hoverBackground", { dark: "#2A2D2E", light: "#F0F0F0", hcDark: Color.white.transparent(0.1), hcLight: Color.fromHex("#0F4A85").transparent(0.1) }, localize("listHoverBackground", "List/Tree background when hovering over items using the mouse."));
listHoverForeground = registerColor("list.hoverForeground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("listHoverForeground", "List/Tree foreground when hovering over items using the mouse."));
listDropOverBackground = registerColor("list.dropBackground", { dark: "#062F4A", light: "#D6EBFF", hcDark: null, hcLight: null }, localize("listDropBackground", "List/Tree drag and drop background when moving items over other items when using the mouse."));
listDropBetweenBackground = registerColor("list.dropBetweenBackground", { dark: iconForeground, light: iconForeground, hcDark: null, hcLight: null }, localize("listDropBetweenBackground", "List/Tree drag and drop border color when moving items between items when using the mouse."));
listHighlightForeground = registerColor("list.highlightForeground", { dark: "#2AAAFF", light: "#0066BF", hcDark: focusBorder, hcLight: focusBorder }, localize("highlight", "List/Tree foreground color of the match highlights when searching inside the list/tree."));
listFocusHighlightForeground = registerColor("list.focusHighlightForeground", { dark: listHighlightForeground, light: ifDefinedThenElse(listActiveSelectionBackground, listHighlightForeground, "#BBE7FF"), hcDark: listHighlightForeground, hcLight: listHighlightForeground }, localize("listFocusHighlightForeground", "List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));
listInvalidItemForeground = registerColor("list.invalidItemForeground", { dark: "#B89500", light: "#B89500", hcDark: "#B89500", hcLight: "#B5200D" }, localize("invalidItemForeground", "List/Tree foreground color for invalid items, for example an unresolved root in explorer."));
listErrorForeground = registerColor("list.errorForeground", { dark: "#F88070", light: "#B01011", hcDark: null, hcLight: null }, localize("listErrorForeground", "Foreground color of list items containing errors."));
listWarningForeground = registerColor("list.warningForeground", { dark: "#CCA700", light: "#855F00", hcDark: null, hcLight: null }, localize("listWarningForeground", "Foreground color of list items containing warnings."));
listFilterWidgetBackground = registerColor("listFilterWidget.background", { light: darken(editorWidgetBackground, 0), dark: lighten(editorWidgetBackground, 0), hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("listFilterWidgetBackground", "Background color of the type filter widget in lists and trees."));
listFilterWidgetOutline = registerColor("listFilterWidget.outline", { dark: Color.transparent, light: Color.transparent, hcDark: "#f38518", hcLight: "#007ACC" }, localize("listFilterWidgetOutline", "Outline color of the type filter widget in lists and trees."));
listFilterWidgetNoMatchesOutline = registerColor("listFilterWidget.noMatchesOutline", { dark: "#BE1100", light: "#BE1100", hcDark: contrastBorder, hcLight: contrastBorder }, localize("listFilterWidgetNoMatchesOutline", "Outline color of the type filter widget in lists and trees, when there are no matches."));
listFilterWidgetShadow = registerColor("listFilterWidget.shadow", { dark: widgetShadow, light: widgetShadow, hcDark: widgetShadow, hcLight: widgetShadow }, localize("listFilterWidgetShadow", "Shadow color of the type filter widget in lists and trees."));
listFilterMatchHighlight = registerColor("list.filterMatchBackground", { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hcDark: null, hcLight: null }, localize("listFilterMatchHighlight", "Background color of the filtered match."));
listFilterMatchHighlightBorder = registerColor("list.filterMatchBorder", { dark: editorFindMatchHighlightBorder, light: editorFindMatchHighlightBorder, hcDark: contrastBorder, hcLight: activeContrastBorder }, localize("listFilterMatchHighlightBorder", "Border color of the filtered match."));
listDeemphasizedForeground = registerColor("list.deemphasizedForeground", { dark: "#8C8C8C", light: "#8E8E90", hcDark: "#A7A8A9", hcLight: "#666666" }, localize("listDeemphasizedForeground", "List/Tree foreground color for items that are deemphasized."));
treeIndentGuidesStroke = registerColor("tree.indentGuidesStroke", { dark: "#585858", light: "#a9a9a9", hcDark: "#a9a9a9", hcLight: "#a5a5a5" }, localize("treeIndentGuidesStroke", "Tree stroke color for the indentation guides."));
treeInactiveIndentGuidesStroke = registerColor("tree.inactiveIndentGuidesStroke", { dark: transparent(treeIndentGuidesStroke, 0.4), light: transparent(treeIndentGuidesStroke, 0.4), hcDark: transparent(treeIndentGuidesStroke, 0.4), hcLight: transparent(treeIndentGuidesStroke, 0.4) }, localize("treeInactiveIndentGuidesStroke", "Tree stroke color for the indentation guides that are not active."));
tableColumnsBorder = registerColor("tree.tableColumnsBorder", { dark: "#CCCCCC20", light: "#61616120", hcDark: null, hcLight: null }, localize("tableColumnsBorder", "Table border color between columns."));
tableOddRowsBackgroundColor = registerColor("tree.tableOddRowsBackground", { dark: transparent(foreground, 0.04), light: transparent(foreground, 0.04), hcDark: null, hcLight: null }, localize("tableOddRowsBackgroundColor", "Background color for odd table rows."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/menuColors.js
var menuBorder, menuForeground, menuBackground, menuSelectionForeground, menuSelectionBackground, menuSelectionBorder, menuSeparatorBackground;
var init_menuColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/menuColors.js"() {
init_nls();
init_colorUtils();
init_baseColors();
init_inputColors();
init_listColors();
menuBorder = registerColor("menu.border", { dark: null, light: null, hcDark: contrastBorder, hcLight: contrastBorder }, localize("menuBorder", "Border color of menus."));
menuForeground = registerColor("menu.foreground", { dark: selectForeground, light: selectForeground, hcDark: selectForeground, hcLight: selectForeground }, localize("menuForeground", "Foreground color of menu items."));
menuBackground = registerColor("menu.background", { dark: selectBackground, light: selectBackground, hcDark: selectBackground, hcLight: selectBackground }, localize("menuBackground", "Background color of menu items."));
menuSelectionForeground = registerColor("menu.selectionForeground", { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, localize("menuSelectionForeground", "Foreground color of the selected menu item in menus."));
menuSelectionBackground = registerColor("menu.selectionBackground", { dark: listActiveSelectionBackground, light: listActiveSelectionBackground, hcDark: listActiveSelectionBackground, hcLight: listActiveSelectionBackground }, localize("menuSelectionBackground", "Background color of the selected menu item in menus."));
menuSelectionBorder = registerColor("menu.selectionBorder", { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("menuSelectionBorder", "Border color of the selected menu item in menus."));
menuSeparatorBackground = registerColor("menu.separatorBackground", { dark: "#606060", light: "#D4D4D4", hcDark: contrastBorder, hcLight: contrastBorder }, localize("menuSeparatorBackground", "Color of a separator menu item in menus."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/quickpickColors.js
var quickInputBackground, quickInputForeground, quickInputTitleBackground, pickerGroupForeground, pickerGroupBorder, _deprecatedQuickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, quickInputListFocusBackground;
var init_quickpickColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/quickpickColors.js"() {
init_nls();
init_color();
init_colorUtils();
init_editorColors();
init_listColors();
quickInputBackground = registerColor("quickInput.background", { dark: editorWidgetBackground, light: editorWidgetBackground, hcDark: editorWidgetBackground, hcLight: editorWidgetBackground }, localize("pickerBackground", "Quick picker background color. The quick picker widget is the container for pickers like the command palette."));
quickInputForeground = registerColor("quickInput.foreground", { dark: editorWidgetForeground, light: editorWidgetForeground, hcDark: editorWidgetForeground, hcLight: editorWidgetForeground }, localize("pickerForeground", "Quick picker foreground color. The quick picker widget is the container for pickers like the command palette."));
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 }, localize("pickerTitleBackground", "Quick picker title background color. The quick picker widget is the container for pickers like the command palette."));
pickerGroupForeground = registerColor("pickerGroup.foreground", { dark: "#3794FF", light: "#0066BF", hcDark: Color.white, hcLight: "#0F4A85" }, localize("pickerGroupForeground", "Quick picker color for grouping labels."));
pickerGroupBorder = registerColor("pickerGroup.border", { dark: "#3F3F46", light: "#CCCEDB", hcDark: Color.white, hcLight: "#0F4A85" }, localize("pickerGroupBorder", "Quick picker color for grouping borders."));
_deprecatedQuickInputListFocusBackground = registerColor("quickInput.list.focusBackground", { dark: null, light: null, hcDark: null, hcLight: null }, "", void 0, localize("quickInput.list.focusBackground deprecation", "Please use quickInputList.focusBackground instead"));
quickInputListFocusForeground = registerColor("quickInputList.focusForeground", { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hcDark: listActiveSelectionForeground, hcLight: listActiveSelectionForeground }, localize("quickInput.listFocusForeground", "Quick picker foreground color for the focused item."));
quickInputListFocusIconForeground = registerColor("quickInputList.focusIconForeground", { dark: listActiveSelectionIconForeground, light: listActiveSelectionIconForeground, hcDark: listActiveSelectionIconForeground, hcLight: listActiveSelectionIconForeground }, localize("quickInput.listFocusIconForeground", "Quick picker icon foreground color for the focused item."));
quickInputListFocusBackground = registerColor("quickInputList.focusBackground", { dark: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), light: oneOf(_deprecatedQuickInputListFocusBackground, listActiveSelectionBackground), hcDark: null, hcLight: null }, localize("quickInput.listFocusBackground", "Quick picker background color for the focused item."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colors/searchColors.js
var searchResultsInfoForeground, searchEditorFindMatch, searchEditorFindMatchBorder;
var init_searchColors = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colors/searchColors.js"() {
init_nls();
init_colorUtils();
init_baseColors();
init_editorColors();
searchResultsInfoForeground = registerColor("search.resultsInfoForeground", { light: foreground, dark: transparent(foreground, 0.65), hcDark: foreground, hcLight: foreground }, localize("search.resultsInfoForeground", "Color of the text in the search viewlet's completion message."));
searchEditorFindMatch = registerColor("searchEditor.findMatchBackground", { light: transparent(editorFindMatchHighlight, 0.66), dark: transparent(editorFindMatchHighlight, 0.66), hcDark: editorFindMatchHighlight, hcLight: editorFindMatchHighlight }, localize("searchEditor.queryMatch", "Color of the Search Editor query matches."));
searchEditorFindMatchBorder = registerColor("searchEditor.findMatchBorder", { light: transparent(editorFindMatchHighlightBorder, 0.66), dark: transparent(editorFindMatchHighlightBorder, 0.66), hcDark: editorFindMatchHighlightBorder, hcLight: editorFindMatchHighlightBorder }, localize("searchEditor.editorFindMatchBorder", "Border color of the Search Editor query matches."));
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js
var init_colorRegistry = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js"() {
init_colorUtils();
init_baseColors();
init_chartsColors();
init_editorColors();
init_inputColors();
init_listColors();
init_menuColors();
init_minimapColors();
init_miscColors();
init_quickpickColors();
init_searchColors();
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/editorDom.js
function createEditorPagePosition(editorViewDomNode) {
const editorPos = getDomNodePagePosition(editorViewDomNode);
return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);
}
function createCoordinatesRelativeToEditor(editorViewDomNode, editorPagePosition, pos) {
const scaleX = editorPagePosition.width / editorViewDomNode.offsetWidth;
const scaleY = editorPagePosition.height / editorViewDomNode.offsetHeight;
const relativeX = (pos.x - editorPagePosition.x) / scaleX;
const relativeY = (pos.y - editorPagePosition.y) / scaleY;
return new CoordinatesRelativeToEditor(relativeX, relativeY);
}
function camelToDashes(str) {
return str.replace(/(^[A-Z])/, ([first2]) => first2.toLowerCase()).replace(/([A-Z])/g, ([letter]) => `-${letter.toLowerCase()}`);
}
var PageCoordinates, ClientCoordinates, EditorPagePosition, CoordinatesRelativeToEditor, EditorMouseEvent, EditorMouseEventFactory, EditorPointerEventFactory, GlobalEditorPointerMoveMonitor, DynamicCssRules, RefCountedCssRule;
var init_editorDom = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/editorDom.js"() {
init_dom();
init_globalPointerMoveMonitor();
init_mouseEvent();
init_async();
init_lifecycle();
init_colorRegistry();
PageCoordinates = class {
constructor(x, y) {
this.x = x;
this.y = y;
this._pageCoordinatesBrand = void 0;
}
toClientCoordinates(targetWindow) {
return new ClientCoordinates(this.x - targetWindow.scrollX, this.y - targetWindow.scrollY);
}
};
ClientCoordinates = class {
constructor(clientX, clientY) {
this.clientX = clientX;
this.clientY = clientY;
this._clientCoordinatesBrand = void 0;
}
toPageCoordinates(targetWindow) {
return new PageCoordinates(this.clientX + targetWindow.scrollX, this.clientY + targetWindow.scrollY);
}
};
EditorPagePosition = class {
constructor(x, y, width2, height) {
this.x = x;
this.y = y;
this.width = width2;
this.height = height;
this._editorPagePositionBrand = void 0;
}
};
CoordinatesRelativeToEditor = class {
constructor(x, y) {
this.x = x;
this.y = y;
this._positionRelativeToEditorBrand = void 0;
}
};
EditorMouseEvent = class extends StandardMouseEvent {
constructor(e, isFromPointerCapture, editorViewDomNode) {
super(getWindow(editorViewDomNode), e);
this._editorMouseEventBrand = void 0;
this.isFromPointerCapture = isFromPointerCapture;
this.pos = new PageCoordinates(this.posx, this.posy);
this.editorPos = createEditorPagePosition(editorViewDomNode);
this.relativePos = createCoordinatesRelativeToEditor(editorViewDomNode, this.editorPos, this.pos);
}
};
EditorMouseEventFactory = class {
constructor(editorViewDomNode) {
this._editorViewDomNode = editorViewDomNode;
}
_create(e) {
return new EditorMouseEvent(e, false, this._editorViewDomNode);
}
onContextMenu(target, callback) {
return addDisposableListener(target, "contextmenu", (e) => {
callback(this._create(e));
});
}
onMouseUp(target, callback) {
return addDisposableListener(target, "mouseup", (e) => {
callback(this._create(e));
});
}
onMouseDown(target, callback) {
return addDisposableListener(target, EventType.MOUSE_DOWN, (e) => {
callback(this._create(e));
});
}
onPointerDown(target, callback) {
return addDisposableListener(target, EventType.POINTER_DOWN, (e) => {
callback(this._create(e), e.pointerId);
});
}
onMouseLeave(target, callback) {
return addDisposableListener(target, EventType.MOUSE_LEAVE, (e) => {
callback(this._create(e));
});
}
onMouseMove(target, callback) {
return addDisposableListener(target, "mousemove", (e) => callback(this._create(e)));
}
};
EditorPointerEventFactory = class {
constructor(editorViewDomNode) {
this._editorViewDomNode = editorViewDomNode;
}
_create(e) {
return new EditorMouseEvent(e, false, this._editorViewDomNode);
}
onPointerUp(target, callback) {
return addDisposableListener(target, "pointerup", (e) => {
callback(this._create(e));
});
}
onPointerDown(target, callback) {
return addDisposableListener(target, EventType.POINTER_DOWN, (e) => {
callback(this._create(e), e.pointerId);
});
}
onPointerLeave(target, callback) {
return addDisposableListener(target, EventType.POINTER_LEAVE, (e) => {
callback(this._create(e));
});
}
onPointerMove(target, callback) {
return addDisposableListener(target, "pointermove", (e) => callback(this._create(e)));
}
};
GlobalEditorPointerMoveMonitor = class extends Disposable {
constructor(editorViewDomNode) {
super();
this._editorViewDomNode = editorViewDomNode;
this._globalPointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());
this._keydownListener = null;
}
startMonitoring(initialElement, pointerId, initialButtons, pointerMoveCallback, onStopCallback) {
this._keydownListener = addStandardDisposableListener(initialElement.ownerDocument, "keydown", (e) => {
const chord = e.toKeyCodeChord();
if (chord.isModifierKey()) {
return;
}
this._globalPointerMoveMonitor.stopMonitoring(true, e.browserEvent);
}, true);
this._globalPointerMoveMonitor.startMonitoring(initialElement, pointerId, initialButtons, (e) => {
pointerMoveCallback(new EditorMouseEvent(e, true, this._editorViewDomNode));
}, (e) => {
this._keydownListener.dispose();
onStopCallback(e);
});
}
stopMonitoring() {
this._globalPointerMoveMonitor.stopMonitoring(true);
}
};
DynamicCssRules = class _DynamicCssRules {
constructor(_editor) {
this._editor = _editor;
this._instanceId = ++_DynamicCssRules._idPool;
this._counter = 0;
this._rules = /* @__PURE__ */ new Map();
this._garbageCollectionScheduler = new RunOnceScheduler(() => this.garbageCollect(), 1e3);
}
createClassNameRef(options2) {
const rule = this.getOrCreateRule(options2);
rule.increaseRefCount();
return {
className: rule.className,
dispose: () => {
rule.decreaseRefCount();
this._garbageCollectionScheduler.schedule();
}
};
}
getOrCreateRule(properties) {
const key = this.computeUniqueKey(properties);
let existingRule = this._rules.get(key);
if (!existingRule) {
const counter = this._counter++;
existingRule = new RefCountedCssRule(key, `dyn-rule-${this._instanceId}-${counter}`, isInShadowDOM(this._editor.getContainerDomNode()) ? this._editor.getContainerDomNode() : void 0, properties);
this._rules.set(key, existingRule);
}
return existingRule;
}
computeUniqueKey(properties) {
return JSON.stringify(properties);
}
garbageCollect() {
for (const rule of this._rules.values()) {
if (!rule.hasReferences()) {
this._rules.delete(rule.key);
rule.dispose();
}
}
}
};
DynamicCssRules._idPool = 0;
RefCountedCssRule = class {
constructor(key, className, _containerElement, properties) {
this.key = key;
this.className = className;
this.properties = properties;
this._referenceCount = 0;
this._styleElementDisposables = new DisposableStore();
this._styleElement = createStyleSheet(_containerElement, void 0, this._styleElementDisposables);
this._styleElement.textContent = this.getCssText(this.className, this.properties);
}
getCssText(className, properties) {
let str = `.${className} {`;
for (const prop in properties) {
const value = properties[prop];
let cssValue;
if (typeof value === "object") {
cssValue = asCssVariable(value.id);
} else {
cssValue = value;
}
const cssPropName = camelToDashes(prop);
str += `
${cssPropName}: ${cssValue};`;
}
str += `
}`;
return str;
}
dispose() {
this._styleElementDisposables.dispose();
this._styleElement = void 0;
}
increaseRefCount() {
this._referenceCount++;
}
decreaseRefCount() {
this._referenceCount--;
}
hasReferences() {
return this._referenceCount > 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewEventHandler.js
var ViewEventHandler;
var init_viewEventHandler = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewEventHandler.js"() {
init_lifecycle();
ViewEventHandler = class extends Disposable {
constructor() {
super();
this._shouldRender = true;
}
shouldRender() {
return this._shouldRender;
}
forceShouldRender() {
this._shouldRender = true;
}
setShouldRender() {
this._shouldRender = true;
}
onDidRender() {
this._shouldRender = false;
}
// --- begin event handlers
onCompositionStart(e) {
return false;
}
onCompositionEnd(e) {
return false;
}
onConfigurationChanged(e) {
return false;
}
onCursorStateChanged(e) {
return false;
}
onDecorationsChanged(e) {
return false;
}
onFlushed(e) {
return false;
}
onFocusChanged(e) {
return false;
}
onLanguageConfigurationChanged(e) {
return false;
}
onLineMappingChanged(e) {
return false;
}
onLinesChanged(e) {
return false;
}
onLinesDeleted(e) {
return false;
}
onLinesInserted(e) {
return false;
}
onRevealRangeRequest(e) {
return false;
}
onScrollChanged(e) {
return false;
}
onThemeChanged(e) {
return false;
}
onTokensChanged(e) {
return false;
}
onTokensColorsChanged(e) {
return false;
}
onZonesChanged(e) {
return false;
}
// --- end event handlers
handleEvents(events) {
let shouldRender = false;
for (let i = 0, len = events.length; i < len; i++) {
const e = events[i];
switch (e.type) {
case 0:
if (this.onCompositionStart(e)) {
shouldRender = true;
}
break;
case 1:
if (this.onCompositionEnd(e)) {
shouldRender = true;
}
break;
case 2:
if (this.onConfigurationChanged(e)) {
shouldRender = true;
}
break;
case 3:
if (this.onCursorStateChanged(e)) {
shouldRender = true;
}
break;
case 4:
if (this.onDecorationsChanged(e)) {
shouldRender = true;
}
break;
case 5:
if (this.onFlushed(e)) {
shouldRender = true;
}
break;
case 6:
if (this.onFocusChanged(e)) {
shouldRender = true;
}
break;
case 7:
if (this.onLanguageConfigurationChanged(e)) {
shouldRender = true;
}
break;
case 8:
if (this.onLineMappingChanged(e)) {
shouldRender = true;
}
break;
case 9:
if (this.onLinesChanged(e)) {
shouldRender = true;
}
break;
case 10:
if (this.onLinesDeleted(e)) {
shouldRender = true;
}
break;
case 11:
if (this.onLinesInserted(e)) {
shouldRender = true;
}
break;
case 12:
if (this.onRevealRangeRequest(e)) {
shouldRender = true;
}
break;
case 13:
if (this.onScrollChanged(e)) {
shouldRender = true;
}
break;
case 15:
if (this.onTokensChanged(e)) {
shouldRender = true;
}
break;
case 14:
if (this.onThemeChanged(e)) {
shouldRender = true;
}
break;
case 16:
if (this.onTokensColorsChanged(e)) {
shouldRender = true;
}
break;
case 17:
if (this.onZonesChanged(e)) {
shouldRender = true;
}
break;
default:
console.info("View received unknown event: ");
console.info(e);
}
}
if (shouldRender) {
this._shouldRender = true;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/viewPart.js
var ViewPart, PartFingerprints;
var init_viewPart = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/viewPart.js"() {
init_viewEventHandler();
ViewPart = class extends ViewEventHandler {
constructor(context) {
super();
this._context = context;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
super.dispose();
}
};
PartFingerprints = class {
static write(target, partId) {
target.setAttribute("data-mprt", String(partId));
}
static read(target) {
const r = target.getAttribute("data-mprt");
if (r === null) {
return 0;
}
return parseInt(r, 10);
}
static collect(child, stopAt) {
const result = [];
let resultLen = 0;
while (child && child !== child.ownerDocument.body) {
if (child === stopAt) {
break;
}
if (child.nodeType === child.ELEMENT_NODE) {
result[resultLen++] = this.read(child);
}
child = child.parentElement;
}
const r = new Uint8Array(resultLen);
for (let i = 0; i < resultLen; i++) {
r[i] = result[resultLen - i - 1];
}
return r;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/renderingContext.js
var RestrictedRenderingContext, RenderingContext, LineVisibleRanges, HorizontalRange, FloatHorizontalRange, HorizontalPosition, VisibleRanges;
var init_renderingContext = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/renderingContext.js"() {
RestrictedRenderingContext = class {
constructor(viewLayout, viewportData) {
this._restrictedRenderingContextBrand = void 0;
this._viewLayout = viewLayout;
this.viewportData = viewportData;
this.scrollWidth = this._viewLayout.getScrollWidth();
this.scrollHeight = this._viewLayout.getScrollHeight();
this.visibleRange = this.viewportData.visibleRange;
this.bigNumbersDelta = this.viewportData.bigNumbersDelta;
const vInfo = this._viewLayout.getCurrentViewport();
this.scrollTop = vInfo.top;
this.scrollLeft = vInfo.left;
this.viewportWidth = vInfo.width;
this.viewportHeight = vInfo.height;
}
getScrolledTopFromAbsoluteTop(absoluteTop) {
return absoluteTop - this.scrollTop;
}
getVerticalOffsetForLineNumber(lineNumber, includeViewZones) {
return this._viewLayout.getVerticalOffsetForLineNumber(lineNumber, includeViewZones);
}
getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones) {
return this._viewLayout.getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones);
}
getDecorationsInViewport() {
return this.viewportData.getDecorationsInViewport();
}
};
RenderingContext = class extends RestrictedRenderingContext {
constructor(viewLayout, viewportData, viewLines) {
super(viewLayout, viewportData);
this._renderingContextBrand = void 0;
this._viewLines = viewLines;
}
linesVisibleRangesForRange(range2, includeNewLines) {
return this._viewLines.linesVisibleRangesForRange(range2, includeNewLines);
}
visibleRangeForPosition(position) {
return this._viewLines.visibleRangeForPosition(position);
}
};
LineVisibleRanges = class {
constructor(outsideRenderedLine, lineNumber, ranges, continuesOnNextLine) {
this.outsideRenderedLine = outsideRenderedLine;
this.lineNumber = lineNumber;
this.ranges = ranges;
this.continuesOnNextLine = continuesOnNextLine;
}
};
HorizontalRange = class _HorizontalRange {
static from(ranges) {
const result = new Array(ranges.length);
for (let i = 0, len = ranges.length; i < len; i++) {
const range2 = ranges[i];
result[i] = new _HorizontalRange(range2.left, range2.width);
}
return result;
}
constructor(left, width2) {
this._horizontalRangeBrand = void 0;
this.left = Math.round(left);
this.width = Math.round(width2);
}
toString() {
return `[${this.left},${this.width}]`;
}
};
FloatHorizontalRange = class {
constructor(left, width2) {
this._floatHorizontalRangeBrand = void 0;
this.left = left;
this.width = width2;
}
toString() {
return `[${this.left},${this.width}]`;
}
static compare(a3, b) {
return a3.left - b.left;
}
};
HorizontalPosition = class {
constructor(outsideRenderedLine, left) {
this.outsideRenderedLine = outsideRenderedLine;
this.originalLeft = left;
this.left = Math.round(this.originalLeft);
}
};
VisibleRanges = class {
constructor(outsideRenderedLine, ranges) {
this.outsideRenderedLine = outsideRenderedLine;
this.ranges = ranges;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/rangeUtil.js
var RangeUtil;
var init_rangeUtil = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/rangeUtil.js"() {
init_renderingContext();
RangeUtil = class {
static _createRange() {
if (!this._handyReadyRange) {
this._handyReadyRange = document.createRange();
}
return this._handyReadyRange;
}
static _detachRange(range2, endNode) {
range2.selectNodeContents(endNode);
}
static _readClientRects(startElement, startOffset, endElement, endOffset, endNode) {
const range2 = this._createRange();
try {
range2.setStart(startElement, startOffset);
range2.setEnd(endElement, endOffset);
return range2.getClientRects();
} catch (e) {
return null;
} finally {
this._detachRange(range2, endNode);
}
}
static _mergeAdjacentRanges(ranges) {
if (ranges.length === 1) {
return ranges;
}
ranges.sort(FloatHorizontalRange.compare);
const result = [];
let resultLen = 0;
let prev = ranges[0];
for (let i = 1, len = ranges.length; i < len; i++) {
const range2 = ranges[i];
if (prev.left + prev.width + 0.9 >= range2.left) {
prev.width = Math.max(prev.width, range2.left + range2.width - prev.left);
} else {
result[resultLen++] = prev;
prev = range2;
}
}
result[resultLen++] = prev;
return result;
}
static _createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft, clientRectScale) {
if (!clientRects || clientRects.length === 0) {
return null;
}
const result = [];
for (let i = 0, len = clientRects.length; i < len; i++) {
const clientRect = clientRects[i];
result[i] = new FloatHorizontalRange(Math.max(0, (clientRect.left - clientRectDeltaLeft) / clientRectScale), clientRect.width / clientRectScale);
}
return this._mergeAdjacentRanges(result);
}
static readHorizontalRanges(domNode, startChildIndex, startOffset, endChildIndex, endOffset, context) {
const min = 0;
const max = domNode.children.length - 1;
if (min > max) {
return null;
}
startChildIndex = Math.min(max, Math.max(min, startChildIndex));
endChildIndex = Math.min(max, Math.max(min, endChildIndex));
if (startChildIndex === endChildIndex && startOffset === endOffset && startOffset === 0 && !domNode.children[startChildIndex].firstChild) {
const clientRects2 = domNode.children[startChildIndex].getClientRects();
context.markDidDomLayout();
return this._createHorizontalRangesFromClientRects(clientRects2, context.clientRectDeltaLeft, context.clientRectScale);
}
if (startChildIndex !== endChildIndex) {
if (endChildIndex > 0 && endOffset === 0) {
endChildIndex--;
endOffset = 1073741824;
}
}
let startElement = domNode.children[startChildIndex].firstChild;
let endElement = domNode.children[endChildIndex].firstChild;
if (!startElement || !endElement) {
if (!startElement && startOffset === 0 && startChildIndex > 0) {
startElement = domNode.children[startChildIndex - 1].firstChild;
startOffset = 1073741824;
}
if (!endElement && endOffset === 0 && endChildIndex > 0) {
endElement = domNode.children[endChildIndex - 1].firstChild;
endOffset = 1073741824;
}
}
if (!startElement || !endElement) {
return null;
}
startOffset = Math.min(startElement.textContent.length, Math.max(0, startOffset));
endOffset = Math.min(endElement.textContent.length, Math.max(0, endOffset));
const clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, context.endNode);
context.markDidDomLayout();
return this._createHorizontalRangesFromClientRects(clientRects, context.clientRectDeltaLeft, context.clientRectScale);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/theme.js
function isHighContrast(scheme) {
return scheme === ColorScheme.HIGH_CONTRAST_DARK || scheme === ColorScheme.HIGH_CONTRAST_LIGHT;
}
function isDark(scheme) {
return scheme === ColorScheme.DARK || scheme === ColorScheme.HIGH_CONTRAST_DARK;
}
var ColorScheme;
var init_theme = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/theme.js"() {
(function(ColorScheme2) {
ColorScheme2["DARK"] = "dark";
ColorScheme2["LIGHT"] = "light";
ColorScheme2["HIGH_CONTRAST_DARK"] = "hcDark";
ColorScheme2["HIGH_CONTRAST_LIGHT"] = "hcLight";
})(ColorScheme || (ColorScheme = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLine.js
function createWebKitRenderedLine(domNode, renderLineInput, characterMapping, containsRTL2, containsForeignElements) {
return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL2, containsForeignElements);
}
function createNormalRenderedLine(domNode, renderLineInput, characterMapping, containsRTL2, containsForeignElements) {
return new RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL2, containsForeignElements);
}
function getColumnOfNodeOffset(characterMapping, spanNode, offset) {
const spanNodeTextContentLength = spanNode.textContent.length;
let spanIndex = -1;
while (spanNode) {
spanNode = spanNode.previousSibling;
spanIndex++;
}
return characterMapping.getColumn(new DomPosition(spanIndex, offset), spanNodeTextContentLength);
}
var canUseFastRenderedViewLine, monospaceAssumptionsAreValid, ViewLineOptions, ViewLine, FastRenderedViewLine, RenderedViewLine, WebKitRenderedViewLine, createRenderedLine;
var init_viewLine = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLine.js"() {
init_browser();
init_fastDomNode();
init_platform();
init_rangeUtil();
init_renderingContext();
init_lineDecorations();
init_viewLineRenderer();
init_theme();
init_editorOptions();
canUseFastRenderedViewLine = function() {
if (isNative) {
return true;
}
if (isLinux || isFirefox2 || isSafari2) {
return false;
}
return true;
}();
monospaceAssumptionsAreValid = true;
ViewLineOptions = class {
constructor(config, themeType) {
this.themeType = themeType;
const options2 = config.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const experimentalWhitespaceRendering = options2.get(
38
/* EditorOption.experimentalWhitespaceRendering */
);
if (experimentalWhitespaceRendering === "off") {
this.renderWhitespace = options2.get(
99
/* EditorOption.renderWhitespace */
);
} else {
this.renderWhitespace = "none";
}
this.renderControlCharacters = options2.get(
94
/* EditorOption.renderControlCharacters */
);
this.spaceWidth = fontInfo.spaceWidth;
this.middotWidth = fontInfo.middotWidth;
this.wsmiddotWidth = fontInfo.wsmiddotWidth;
this.useMonospaceOptimizations = fontInfo.isMonospace && !options2.get(
33
/* EditorOption.disableMonospaceOptimizations */
);
this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;
this.lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this.stopRenderingLineAfter = options2.get(
117
/* EditorOption.stopRenderingLineAfter */
);
this.fontLigatures = options2.get(
51
/* EditorOption.fontLigatures */
);
}
equals(other) {
return this.themeType === other.themeType && this.renderWhitespace === other.renderWhitespace && this.renderControlCharacters === other.renderControlCharacters && this.spaceWidth === other.spaceWidth && this.middotWidth === other.middotWidth && this.wsmiddotWidth === other.wsmiddotWidth && this.useMonospaceOptimizations === other.useMonospaceOptimizations && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.lineHeight === other.lineHeight && this.stopRenderingLineAfter === other.stopRenderingLineAfter && this.fontLigatures === other.fontLigatures;
}
};
ViewLine = class _ViewLine {
constructor(options2) {
this._options = options2;
this._isMaybeInvalid = true;
this._renderedViewLine = null;
}
// --- begin IVisibleLineData
getDomNode() {
if (this._renderedViewLine && this._renderedViewLine.domNode) {
return this._renderedViewLine.domNode.domNode;
}
return null;
}
setDomNode(domNode) {
if (this._renderedViewLine) {
this._renderedViewLine.domNode = createFastDomNode(domNode);
} else {
throw new Error("I have no rendered view line to set the dom node to...");
}
}
onContentChanged() {
this._isMaybeInvalid = true;
}
onTokensChanged() {
this._isMaybeInvalid = true;
}
onDecorationsChanged() {
this._isMaybeInvalid = true;
}
onOptionsChanged(newOptions) {
this._isMaybeInvalid = true;
this._options = newOptions;
}
onSelectionChanged() {
if (isHighContrast(this._options.themeType) || this._options.renderWhitespace === "selection") {
this._isMaybeInvalid = true;
return true;
}
return false;
}
renderLine(lineNumber, deltaTop, lineHeight, viewportData, sb) {
if (this._isMaybeInvalid === false) {
return false;
}
this._isMaybeInvalid = false;
const lineData = viewportData.getViewLineRenderingData(lineNumber);
const options2 = this._options;
const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);
let selectionsOnLine = null;
if (isHighContrast(options2.themeType) || this._options.renderWhitespace === "selection") {
const selections = viewportData.selections;
for (const selection of selections) {
if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {
continue;
}
const startColumn = selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn;
const endColumn = selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn;
if (startColumn < endColumn) {
if (isHighContrast(options2.themeType)) {
actualInlineDecorations.push(new LineDecoration(
startColumn,
endColumn,
"inline-selected-text",
0
/* InlineDecorationType.Regular */
));
}
if (this._options.renderWhitespace === "selection") {
if (!selectionsOnLine) {
selectionsOnLine = [];
}
selectionsOnLine.push(new LineRange2(startColumn - 1, endColumn - 1));
}
}
}
}
const renderLineInput = new RenderLineInput(options2.useMonospaceOptimizations, options2.canUseHalfwidthRightwardsArrow, lineData.content, lineData.continuesWithWrappedLine, lineData.isBasicASCII, lineData.containsRTL, lineData.minColumn - 1, lineData.tokens, actualInlineDecorations, lineData.tabSize, lineData.startVisibleColumn, options2.spaceWidth, options2.middotWidth, options2.wsmiddotWidth, options2.stopRenderingLineAfter, options2.renderWhitespace, options2.renderControlCharacters, options2.fontLigatures !== EditorFontLigatures.OFF, selectionsOnLine);
if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {
return false;
}
sb.appendString('');
const output = renderViewLine(renderLineInput, sb);
sb.appendString("
");
let renderedViewLine = null;
if (monospaceAssumptionsAreValid && canUseFastRenderedViewLine && lineData.isBasicASCII && options2.useMonospaceOptimizations && output.containsForeignElements === 0) {
renderedViewLine = new FastRenderedViewLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping);
}
if (!renderedViewLine) {
renderedViewLine = createRenderedLine(this._renderedViewLine ? this._renderedViewLine.domNode : null, renderLineInput, output.characterMapping, output.containsRTL, output.containsForeignElements);
}
this._renderedViewLine = renderedViewLine;
return true;
}
layoutLine(lineNumber, deltaTop, lineHeight) {
if (this._renderedViewLine && this._renderedViewLine.domNode) {
this._renderedViewLine.domNode.setTop(deltaTop);
this._renderedViewLine.domNode.setHeight(lineHeight);
}
}
// --- end IVisibleLineData
getWidth(context) {
if (!this._renderedViewLine) {
return 0;
}
return this._renderedViewLine.getWidth(context);
}
getWidthIsFast() {
if (!this._renderedViewLine) {
return true;
}
return this._renderedViewLine.getWidthIsFast();
}
needsMonospaceFontCheck() {
if (!this._renderedViewLine) {
return false;
}
return this._renderedViewLine instanceof FastRenderedViewLine;
}
monospaceAssumptionsAreValid() {
if (!this._renderedViewLine) {
return monospaceAssumptionsAreValid;
}
if (this._renderedViewLine instanceof FastRenderedViewLine) {
return this._renderedViewLine.monospaceAssumptionsAreValid();
}
return monospaceAssumptionsAreValid;
}
onMonospaceAssumptionsInvalidated() {
if (this._renderedViewLine && this._renderedViewLine instanceof FastRenderedViewLine) {
this._renderedViewLine = this._renderedViewLine.toSlowRenderedLine();
}
}
getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {
if (!this._renderedViewLine) {
return null;
}
startColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, startColumn));
endColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, endColumn));
const stopRenderingLineAfter = this._renderedViewLine.input.stopRenderingLineAfter;
if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1 && endColumn > stopRenderingLineAfter + 1) {
return new VisibleRanges(true, [new FloatHorizontalRange(this.getWidth(context), 0)]);
}
if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1) {
startColumn = stopRenderingLineAfter + 1;
}
if (stopRenderingLineAfter !== -1 && endColumn > stopRenderingLineAfter + 1) {
endColumn = stopRenderingLineAfter + 1;
}
const horizontalRanges = this._renderedViewLine.getVisibleRangesForRange(lineNumber, startColumn, endColumn, context);
if (horizontalRanges && horizontalRanges.length > 0) {
return new VisibleRanges(false, horizontalRanges);
}
return null;
}
getColumnOfNodeOffset(spanNode, offset) {
if (!this._renderedViewLine) {
return 1;
}
return this._renderedViewLine.getColumnOfNodeOffset(spanNode, offset);
}
};
ViewLine.CLASS_NAME = "view-line";
FastRenderedViewLine = class {
constructor(domNode, renderLineInput, characterMapping) {
this._cachedWidth = -1;
this.domNode = domNode;
this.input = renderLineInput;
const keyColumnCount = Math.floor(
renderLineInput.lineContent.length / 300
/* Constants.MaxMonospaceDistance */
);
if (keyColumnCount > 0) {
this._keyColumnPixelOffsetCache = new Float32Array(keyColumnCount);
for (let i = 0; i < keyColumnCount; i++) {
this._keyColumnPixelOffsetCache[i] = -1;
}
} else {
this._keyColumnPixelOffsetCache = null;
}
this._characterMapping = characterMapping;
this._charWidth = renderLineInput.spaceWidth;
}
getWidth(context) {
if (!this.domNode || this.input.lineContent.length < 300) {
const horizontalOffset = this._characterMapping.getHorizontalOffset(this._characterMapping.length);
return Math.round(this._charWidth * horizontalOffset);
}
if (this._cachedWidth === -1) {
this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;
context === null || context === void 0 ? void 0 : context.markDidDomLayout();
}
return this._cachedWidth;
}
getWidthIsFast() {
return this.input.lineContent.length < 300 || this._cachedWidth !== -1;
}
monospaceAssumptionsAreValid() {
if (!this.domNode) {
return monospaceAssumptionsAreValid;
}
if (this.input.lineContent.length < 300) {
const expectedWidth = this.getWidth(null);
const actualWidth = this.domNode.domNode.firstChild.offsetWidth;
if (Math.abs(expectedWidth - actualWidth) >= 2) {
console.warn(`monospace assumptions have been violated, therefore disabling monospace optimizations!`);
monospaceAssumptionsAreValid = false;
}
}
return monospaceAssumptionsAreValid;
}
toSlowRenderedLine() {
return createRenderedLine(
this.domNode,
this.input,
this._characterMapping,
false,
0
/* ForeignElementType.None */
);
}
getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {
const startPosition = this._getColumnPixelOffset(lineNumber, startColumn, context);
const endPosition = this._getColumnPixelOffset(lineNumber, endColumn, context);
return [new FloatHorizontalRange(startPosition, endPosition - startPosition)];
}
_getColumnPixelOffset(lineNumber, column, context) {
if (column <= 300) {
const horizontalOffset2 = this._characterMapping.getHorizontalOffset(column);
return this._charWidth * horizontalOffset2;
}
const keyColumnOrdinal = Math.floor(
(column - 1) / 300
/* Constants.MaxMonospaceDistance */
) - 1;
const keyColumn = (keyColumnOrdinal + 1) * 300 + 1;
let keyColumnPixelOffset = -1;
if (this._keyColumnPixelOffsetCache) {
keyColumnPixelOffset = this._keyColumnPixelOffsetCache[keyColumnOrdinal];
if (keyColumnPixelOffset === -1) {
keyColumnPixelOffset = this._actualReadPixelOffset(lineNumber, keyColumn, context);
this._keyColumnPixelOffsetCache[keyColumnOrdinal] = keyColumnPixelOffset;
}
}
if (keyColumnPixelOffset === -1) {
const horizontalOffset2 = this._characterMapping.getHorizontalOffset(column);
return this._charWidth * horizontalOffset2;
}
const keyColumnHorizontalOffset = this._characterMapping.getHorizontalOffset(keyColumn);
const horizontalOffset = this._characterMapping.getHorizontalOffset(column);
return keyColumnPixelOffset + this._charWidth * (horizontalOffset - keyColumnHorizontalOffset);
}
_getReadingTarget(myDomNode) {
return myDomNode.domNode.firstChild;
}
_actualReadPixelOffset(lineNumber, column, context) {
if (!this.domNode) {
return -1;
}
const domPosition = this._characterMapping.getDomPosition(column);
const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(this.domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);
if (!r || r.length === 0) {
return -1;
}
return r[0].left;
}
getColumnOfNodeOffset(spanNode, offset) {
return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);
}
};
RenderedViewLine = class {
constructor(domNode, renderLineInput, characterMapping, containsRTL2, containsForeignElements) {
this.domNode = domNode;
this.input = renderLineInput;
this._characterMapping = characterMapping;
this._isWhitespaceOnly = /^\s*$/.test(renderLineInput.lineContent);
this._containsForeignElements = containsForeignElements;
this._cachedWidth = -1;
this._pixelOffsetCache = null;
if (!containsRTL2 || this._characterMapping.length === 0) {
this._pixelOffsetCache = new Float32Array(Math.max(2, this._characterMapping.length + 1));
for (let column = 0, len = this._characterMapping.length; column <= len; column++) {
this._pixelOffsetCache[column] = -1;
}
}
}
// --- Reading from the DOM methods
_getReadingTarget(myDomNode) {
return myDomNode.domNode.firstChild;
}
/**
* Width of the line in pixels
*/
getWidth(context) {
if (!this.domNode) {
return 0;
}
if (this._cachedWidth === -1) {
this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;
context === null || context === void 0 ? void 0 : context.markDidDomLayout();
}
return this._cachedWidth;
}
getWidthIsFast() {
if (this._cachedWidth === -1) {
return false;
}
return true;
}
/**
* Visible ranges for a model range
*/
getVisibleRangesForRange(lineNumber, startColumn, endColumn, context) {
if (!this.domNode) {
return null;
}
if (this._pixelOffsetCache !== null) {
const startOffset = this._readPixelOffset(this.domNode, lineNumber, startColumn, context);
if (startOffset === -1) {
return null;
}
const endOffset = this._readPixelOffset(this.domNode, lineNumber, endColumn, context);
if (endOffset === -1) {
return null;
}
return [new FloatHorizontalRange(startOffset, endOffset - startOffset)];
}
return this._readVisibleRangesForRange(this.domNode, lineNumber, startColumn, endColumn, context);
}
_readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {
if (startColumn === endColumn) {
const pixelOffset = this._readPixelOffset(domNode, lineNumber, startColumn, context);
if (pixelOffset === -1) {
return null;
} else {
return [new FloatHorizontalRange(pixelOffset, 0)];
}
} else {
return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context);
}
}
_readPixelOffset(domNode, lineNumber, column, context) {
if (this._characterMapping.length === 0) {
if (this._containsForeignElements === 0) {
return 0;
}
if (this._containsForeignElements === 2) {
return 0;
}
if (this._containsForeignElements === 1) {
return this.getWidth(context);
}
const readingTarget = this._getReadingTarget(domNode);
if (readingTarget.firstChild) {
context.markDidDomLayout();
return readingTarget.firstChild.offsetWidth;
} else {
return 0;
}
}
if (this._pixelOffsetCache !== null) {
const cachedPixelOffset = this._pixelOffsetCache[column];
if (cachedPixelOffset !== -1) {
return cachedPixelOffset;
}
const result = this._actualReadPixelOffset(domNode, lineNumber, column, context);
this._pixelOffsetCache[column] = result;
return result;
}
return this._actualReadPixelOffset(domNode, lineNumber, column, context);
}
_actualReadPixelOffset(domNode, lineNumber, column, context) {
if (this._characterMapping.length === 0) {
const r2 = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context);
if (!r2 || r2.length === 0) {
return -1;
}
return r2[0].left;
}
if (column === this._characterMapping.length && this._isWhitespaceOnly && this._containsForeignElements === 0) {
return this.getWidth(context);
}
const domPosition = this._characterMapping.getDomPosition(column);
const r = RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), domPosition.partIndex, domPosition.charIndex, domPosition.partIndex, domPosition.charIndex, context);
if (!r || r.length === 0) {
return -1;
}
const result = r[0].left;
if (this.input.isBasicASCII) {
const horizontalOffset = this._characterMapping.getHorizontalOffset(column);
const expectedResult = Math.round(this.input.spaceWidth * horizontalOffset);
if (Math.abs(expectedResult - result) <= 1) {
return expectedResult;
}
}
return result;
}
_readRawVisibleRangesForRange(domNode, startColumn, endColumn, context) {
if (startColumn === 1 && endColumn === this._characterMapping.length) {
return [new FloatHorizontalRange(0, this.getWidth(context))];
}
const startDomPosition = this._characterMapping.getDomPosition(startColumn);
const endDomPosition = this._characterMapping.getDomPosition(endColumn);
return RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startDomPosition.partIndex, startDomPosition.charIndex, endDomPosition.partIndex, endDomPosition.charIndex, context);
}
/**
* Returns the column for the text found at a specific offset inside a rendered dom node
*/
getColumnOfNodeOffset(spanNode, offset) {
return getColumnOfNodeOffset(this._characterMapping, spanNode, offset);
}
};
WebKitRenderedViewLine = class extends RenderedViewLine {
_readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context) {
const output = super._readVisibleRangesForRange(domNode, lineNumber, startColumn, endColumn, context);
if (!output || output.length === 0 || startColumn === endColumn || startColumn === 1 && endColumn === this._characterMapping.length) {
return output;
}
if (!this.input.containsRTL) {
const endPixelOffset = this._readPixelOffset(domNode, lineNumber, endColumn, context);
if (endPixelOffset !== -1) {
const lastRange = output[output.length - 1];
if (lastRange.left < endPixelOffset) {
lastRange.width = endPixelOffset - lastRange.left;
}
}
}
return output;
}
};
createRenderedLine = function() {
if (isWebKit) {
return createWebKitRenderedLine;
}
return createNormalRenderedLine;
}();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/cursorColumns.js
var CursorColumns;
var init_cursorColumns = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/cursorColumns.js"() {
init_strings();
CursorColumns = class _CursorColumns {
static _nextVisibleColumn(codePoint, visibleColumn, tabSize) {
if (codePoint === 9) {
return _CursorColumns.nextRenderTabStop(visibleColumn, tabSize);
}
if (isFullWidthCharacter(codePoint) || isEmojiImprecise(codePoint)) {
return visibleColumn + 2;
}
return visibleColumn + 1;
}
/**
* Returns a visible column from a column.
* @see {@link CursorColumns}
*/
static visibleColumnFromColumn(lineContent, column, tabSize) {
const textLen = Math.min(column - 1, lineContent.length);
const text2 = lineContent.substring(0, textLen);
const iterator = new GraphemeIterator(text2);
let result = 0;
while (!iterator.eol()) {
const codePoint = getNextCodePoint(text2, textLen, iterator.offset);
iterator.nextGraphemeLength();
result = this._nextVisibleColumn(codePoint, result, tabSize);
}
return result;
}
/**
* Returns a column from a visible column.
* @see {@link CursorColumns}
*/
static columnFromVisibleColumn(lineContent, visibleColumn, tabSize) {
if (visibleColumn <= 0) {
return 1;
}
const lineContentLength = lineContent.length;
const iterator = new GraphemeIterator(lineContent);
let beforeVisibleColumn = 0;
let beforeColumn = 1;
while (!iterator.eol()) {
const codePoint = getNextCodePoint(lineContent, lineContentLength, iterator.offset);
iterator.nextGraphemeLength();
const afterVisibleColumn = this._nextVisibleColumn(codePoint, beforeVisibleColumn, tabSize);
const afterColumn = iterator.offset + 1;
if (afterVisibleColumn >= visibleColumn) {
const beforeDelta = visibleColumn - beforeVisibleColumn;
const afterDelta = afterVisibleColumn - visibleColumn;
if (afterDelta < beforeDelta) {
return afterColumn;
} else {
return beforeColumn;
}
}
beforeVisibleColumn = afterVisibleColumn;
beforeColumn = afterColumn;
}
return lineContentLength + 1;
}
/**
* ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)
* @see {@link CursorColumns}
*/
static nextRenderTabStop(visibleColumn, tabSize) {
return visibleColumn + tabSize - visibleColumn % tabSize;
}
/**
* ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)
* @see {@link CursorColumns}
*/
static nextIndentTabStop(visibleColumn, indentSize) {
return visibleColumn + indentSize - visibleColumn % indentSize;
}
/**
* ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)
* @see {@link CursorColumns}
*/
static prevRenderTabStop(column, tabSize) {
return Math.max(0, column - 1 - (column - 1) % tabSize);
}
/**
* ATTENTION: This works with 0-based columns (as opposed to the regular 1-based columns)
* @see {@link CursorColumns}
*/
static prevIndentTabStop(column, indentSize) {
return Math.max(0, column - 1 - (column - 1) % indentSize);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorAtomicMoveOperations.js
var AtomicTabMoveOperations;
var init_cursorAtomicMoveOperations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorAtomicMoveOperations.js"() {
init_cursorColumns();
AtomicTabMoveOperations = class _AtomicTabMoveOperations {
/**
* Get the visible column at the position. If we get to a non-whitespace character first
* or past the end of string then return -1.
*
* **Note** `position` and the return value are 0-based.
*/
static whitespaceVisibleColumn(lineContent, position, tabSize) {
const lineLength = lineContent.length;
let visibleColumn = 0;
let prevTabStopPosition = -1;
let prevTabStopVisibleColumn = -1;
for (let i = 0; i < lineLength; i++) {
if (i === position) {
return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];
}
if (visibleColumn % tabSize === 0) {
prevTabStopPosition = i;
prevTabStopVisibleColumn = visibleColumn;
}
const chCode = lineContent.charCodeAt(i);
switch (chCode) {
case 32:
visibleColumn += 1;
break;
case 9:
visibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);
break;
default:
return [-1, -1, -1];
}
}
if (position === lineLength) {
return [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn];
}
return [-1, -1, -1];
}
/**
* Return the position that should result from a move left, right or to the
* nearest tab, if atomic tabs are enabled. Left and right are used for the
* arrow key movements, nearest is used for mouse selection. It returns
* -1 if atomic tabs are not relevant and you should fall back to normal
* behaviour.
*
* **Note**: `position` and the return value are 0-based.
*/
static atomicPosition(lineContent, position, tabSize, direction) {
const lineLength = lineContent.length;
const [prevTabStopPosition, prevTabStopVisibleColumn, visibleColumn] = _AtomicTabMoveOperations.whitespaceVisibleColumn(lineContent, position, tabSize);
if (visibleColumn === -1) {
return -1;
}
let left;
switch (direction) {
case 0:
left = true;
break;
case 1:
left = false;
break;
case 2:
if (visibleColumn % tabSize === 0) {
return position;
}
left = visibleColumn % tabSize <= tabSize / 2;
break;
}
if (left) {
if (prevTabStopPosition === -1) {
return -1;
}
let currentVisibleColumn2 = prevTabStopVisibleColumn;
for (let i = prevTabStopPosition; i < lineLength; ++i) {
if (currentVisibleColumn2 === prevTabStopVisibleColumn + tabSize) {
return prevTabStopPosition;
}
const chCode = lineContent.charCodeAt(i);
switch (chCode) {
case 32:
currentVisibleColumn2 += 1;
break;
case 9:
currentVisibleColumn2 = CursorColumns.nextRenderTabStop(currentVisibleColumn2, tabSize);
break;
default:
return -1;
}
}
if (currentVisibleColumn2 === prevTabStopVisibleColumn + tabSize) {
return prevTabStopPosition;
}
return -1;
}
const targetVisibleColumn = CursorColumns.nextRenderTabStop(visibleColumn, tabSize);
let currentVisibleColumn = visibleColumn;
for (let i = position; i < lineLength; i++) {
if (currentVisibleColumn === targetVisibleColumn) {
return i;
}
const chCode = lineContent.charCodeAt(i);
switch (chCode) {
case 32:
currentVisibleColumn += 1;
break;
case 9:
currentVisibleColumn = CursorColumns.nextRenderTabStop(currentVisibleColumn, tabSize);
break;
default:
return -1;
}
}
if (currentVisibleColumn === targetVisibleColumn) {
return lineLength;
}
return -1;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js
function createEmptyContentDataInLines(horizontalDistanceToText) {
return {
isAfterLines: false,
horizontalDistanceToText
};
}
function shadowCaretRangeFromPoint(shadowRoot, x, y) {
const range2 = document.createRange();
let el = shadowRoot.elementFromPoint(x, y);
if (el !== null) {
while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE && el.lastChild && el.lastChild.firstChild) {
el = el.lastChild;
}
const rect = el.getBoundingClientRect();
const elWindow = getWindow(el);
const fontStyle = elWindow.getComputedStyle(el, null).getPropertyValue("font-style");
const fontVariant = elWindow.getComputedStyle(el, null).getPropertyValue("font-variant");
const fontWeight = elWindow.getComputedStyle(el, null).getPropertyValue("font-weight");
const fontSize = elWindow.getComputedStyle(el, null).getPropertyValue("font-size");
const lineHeight = elWindow.getComputedStyle(el, null).getPropertyValue("line-height");
const fontFamily = elWindow.getComputedStyle(el, null).getPropertyValue("font-family");
const font = `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}/${lineHeight} ${fontFamily}`;
const text2 = el.innerText;
let pixelCursor = rect.left;
let offset = 0;
let step;
if (x > rect.left + rect.width) {
offset = text2.length;
} else {
const charWidthReader = CharWidthReader.getInstance();
for (let i = 0; i < text2.length + 1; i++) {
step = charWidthReader.getCharWidth(text2.charAt(i), font) / 2;
pixelCursor += step;
if (x < pixelCursor) {
offset = i;
break;
}
pixelCursor += step;
}
}
range2.setStart(el.firstChild, offset);
range2.setEnd(el.firstChild, offset);
}
return range2;
}
var UnknownHitTestResult, ContentHitTestResult, HitTestResult, PointerHandlerLastRenderData, MouseTarget, ElementPath, HitTestContext, BareHitTestRequest, HitTestRequest, EMPTY_CONTENT_AFTER_LINES, MouseTargetFactory, CharWidthReader;
var init_mouseTarget = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js"() {
init_editorDom();
init_viewPart();
init_viewLine();
init_position();
init_range();
init_cursorColumns();
init_dom();
init_cursorAtomicMoveOperations();
init_lazy();
UnknownHitTestResult = class {
constructor(hitTarget = null) {
this.hitTarget = hitTarget;
this.type = 0;
}
};
ContentHitTestResult = class {
get hitTarget() {
return this.spanNode;
}
constructor(position, spanNode, injectedText) {
this.position = position;
this.spanNode = spanNode;
this.injectedText = injectedText;
this.type = 1;
}
};
(function(HitTestResult2) {
function createFromDOMInfo(ctx, spanNode, offset) {
const position = ctx.getPositionFromDOMInfo(spanNode, offset);
if (position) {
return new ContentHitTestResult(position, spanNode, null);
}
return new UnknownHitTestResult(spanNode);
}
HitTestResult2.createFromDOMInfo = createFromDOMInfo;
})(HitTestResult || (HitTestResult = {}));
PointerHandlerLastRenderData = class {
constructor(lastViewCursorsRenderData, lastTextareaPosition) {
this.lastViewCursorsRenderData = lastViewCursorsRenderData;
this.lastTextareaPosition = lastTextareaPosition;
}
};
MouseTarget = class {
static _deduceRage(position, range2 = null) {
if (!range2 && position) {
return new Range(position.lineNumber, position.column, position.lineNumber, position.column);
}
return range2 !== null && range2 !== void 0 ? range2 : null;
}
static createUnknown(element, mouseColumn, position) {
return { type: 0, element, mouseColumn, position, range: this._deduceRage(position) };
}
static createTextarea(element, mouseColumn) {
return { type: 1, element, mouseColumn, position: null, range: null };
}
static createMargin(type, element, mouseColumn, position, range2, detail) {
return { type, element, mouseColumn, position, range: range2, detail };
}
static createViewZone(type, element, mouseColumn, position, detail) {
return { type, element, mouseColumn, position, range: this._deduceRage(position), detail };
}
static createContentText(element, mouseColumn, position, range2, detail) {
return { type: 6, element, mouseColumn, position, range: this._deduceRage(position, range2), detail };
}
static createContentEmpty(element, mouseColumn, position, detail) {
return { type: 7, element, mouseColumn, position, range: this._deduceRage(position), detail };
}
static createContentWidget(element, mouseColumn, detail) {
return { type: 9, element, mouseColumn, position: null, range: null, detail };
}
static createScrollbar(element, mouseColumn, position) {
return { type: 11, element, mouseColumn, position, range: this._deduceRage(position) };
}
static createOverlayWidget(element, mouseColumn, detail) {
return { type: 12, element, mouseColumn, position: null, range: null, detail };
}
static createOutsideEditor(mouseColumn, position, outsidePosition, outsideDistance) {
return { type: 13, element: null, mouseColumn, position, range: this._deduceRage(position), outsidePosition, outsideDistance };
}
static _typeToString(type) {
if (type === 1) {
return "TEXTAREA";
}
if (type === 2) {
return "GUTTER_GLYPH_MARGIN";
}
if (type === 3) {
return "GUTTER_LINE_NUMBERS";
}
if (type === 4) {
return "GUTTER_LINE_DECORATIONS";
}
if (type === 5) {
return "GUTTER_VIEW_ZONE";
}
if (type === 6) {
return "CONTENT_TEXT";
}
if (type === 7) {
return "CONTENT_EMPTY";
}
if (type === 8) {
return "CONTENT_VIEW_ZONE";
}
if (type === 9) {
return "CONTENT_WIDGET";
}
if (type === 10) {
return "OVERVIEW_RULER";
}
if (type === 11) {
return "SCROLLBAR";
}
if (type === 12) {
return "OVERLAY_WIDGET";
}
return "UNKNOWN";
}
static toString(target) {
return this._typeToString(target.type) + ": " + target.position + " - " + target.range + " - " + JSON.stringify(target.detail);
}
};
ElementPath = class {
static isTextArea(path) {
return path.length === 2 && path[0] === 3 && path[1] === 7;
}
static isChildOfViewLines(path) {
return path.length >= 4 && path[0] === 3 && path[3] === 8;
}
static isStrictChildOfViewLines(path) {
return path.length > 4 && path[0] === 3 && path[3] === 8;
}
static isChildOfScrollableElement(path) {
return path.length >= 2 && path[0] === 3 && path[1] === 6;
}
static isChildOfMinimap(path) {
return path.length >= 2 && path[0] === 3 && path[1] === 9;
}
static isChildOfContentWidgets(path) {
return path.length >= 4 && path[0] === 3 && path[3] === 1;
}
static isChildOfOverflowGuard(path) {
return path.length >= 1 && path[0] === 3;
}
static isChildOfOverflowingContentWidgets(path) {
return path.length >= 1 && path[0] === 2;
}
static isChildOfOverlayWidgets(path) {
return path.length >= 2 && path[0] === 3 && path[1] === 4;
}
static isChildOfOverflowingOverlayWidgets(path) {
return path.length >= 1 && path[0] === 5;
}
};
HitTestContext = class _HitTestContext {
constructor(context, viewHelper, lastRenderData) {
this.viewModel = context.viewModel;
const options2 = context.configuration.options;
this.layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this.viewDomNode = viewHelper.viewDomNode;
this.lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this.stickyTabStops = options2.get(
116
/* EditorOption.stickyTabStops */
);
this.typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
this.lastRenderData = lastRenderData;
this._context = context;
this._viewHelper = viewHelper;
}
getZoneAtCoord(mouseVerticalOffset) {
return _HitTestContext.getZoneAtCoord(this._context, mouseVerticalOffset);
}
static getZoneAtCoord(context, mouseVerticalOffset) {
const viewZoneWhitespace = context.viewLayout.getWhitespaceAtVerticalOffset(mouseVerticalOffset);
if (viewZoneWhitespace) {
const viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2;
const lineCount = context.viewModel.getLineCount();
let positionBefore = null;
let position;
let positionAfter = null;
if (viewZoneWhitespace.afterLineNumber !== lineCount) {
positionAfter = new Position(viewZoneWhitespace.afterLineNumber + 1, 1);
}
if (viewZoneWhitespace.afterLineNumber > 0) {
positionBefore = new Position(viewZoneWhitespace.afterLineNumber, context.viewModel.getLineMaxColumn(viewZoneWhitespace.afterLineNumber));
}
if (positionAfter === null) {
position = positionBefore;
} else if (positionBefore === null) {
position = positionAfter;
} else if (mouseVerticalOffset < viewZoneMiddle) {
position = positionBefore;
} else {
position = positionAfter;
}
return {
viewZoneId: viewZoneWhitespace.id,
afterLineNumber: viewZoneWhitespace.afterLineNumber,
positionBefore,
positionAfter,
position
};
}
return null;
}
getFullLineRangeAtCoord(mouseVerticalOffset) {
if (this._context.viewLayout.isAfterLines(mouseVerticalOffset)) {
const lineNumber2 = this._context.viewModel.getLineCount();
const maxLineColumn2 = this._context.viewModel.getLineMaxColumn(lineNumber2);
return {
range: new Range(lineNumber2, maxLineColumn2, lineNumber2, maxLineColumn2),
isAfterLines: true
};
}
const lineNumber = this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);
const maxLineColumn = this._context.viewModel.getLineMaxColumn(lineNumber);
return {
range: new Range(lineNumber, 1, lineNumber, maxLineColumn),
isAfterLines: false
};
}
getLineNumberAtVerticalOffset(mouseVerticalOffset) {
return this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);
}
isAfterLines(mouseVerticalOffset) {
return this._context.viewLayout.isAfterLines(mouseVerticalOffset);
}
isInTopPadding(mouseVerticalOffset) {
return this._context.viewLayout.isInTopPadding(mouseVerticalOffset);
}
isInBottomPadding(mouseVerticalOffset) {
return this._context.viewLayout.isInBottomPadding(mouseVerticalOffset);
}
getVerticalOffsetForLineNumber(lineNumber) {
return this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber);
}
findAttribute(element, attr) {
return _HitTestContext._findAttribute(element, attr, this._viewHelper.viewDomNode);
}
static _findAttribute(element, attr, stopAt) {
while (element && element !== element.ownerDocument.body) {
if (element.hasAttribute && element.hasAttribute(attr)) {
return element.getAttribute(attr);
}
if (element === stopAt) {
return null;
}
element = element.parentNode;
}
return null;
}
getLineWidth(lineNumber) {
return this._viewHelper.getLineWidth(lineNumber);
}
visibleRangeForPosition(lineNumber, column) {
return this._viewHelper.visibleRangeForPosition(lineNumber, column);
}
getPositionFromDOMInfo(spanNode, offset) {
return this._viewHelper.getPositionFromDOMInfo(spanNode, offset);
}
getCurrentScrollTop() {
return this._context.viewLayout.getCurrentScrollTop();
}
getCurrentScrollLeft() {
return this._context.viewLayout.getCurrentScrollLeft();
}
};
BareHitTestRequest = class {
constructor(ctx, editorPos, pos, relativePos) {
this.editorPos = editorPos;
this.pos = pos;
this.relativePos = relativePos;
this.mouseVerticalOffset = Math.max(0, ctx.getCurrentScrollTop() + this.relativePos.y);
this.mouseContentHorizontalOffset = ctx.getCurrentScrollLeft() + this.relativePos.x - ctx.layoutInfo.contentLeft;
this.isInMarginArea = this.relativePos.x < ctx.layoutInfo.contentLeft && this.relativePos.x >= ctx.layoutInfo.glyphMarginLeft;
this.isInContentArea = !this.isInMarginArea;
this.mouseColumn = Math.max(0, MouseTargetFactory._getMouseColumn(this.mouseContentHorizontalOffset, ctx.typicalHalfwidthCharacterWidth));
}
};
HitTestRequest = class extends BareHitTestRequest {
get target() {
if (this._useHitTestTarget) {
return this.hitTestResult.value.hitTarget;
}
return this._eventTarget;
}
get targetPath() {
if (this._targetPathCacheElement !== this.target) {
this._targetPathCacheElement = this.target;
this._targetPathCacheValue = PartFingerprints.collect(this.target, this._ctx.viewDomNode);
}
return this._targetPathCacheValue;
}
constructor(ctx, editorPos, pos, relativePos, eventTarget) {
super(ctx, editorPos, pos, relativePos);
this.hitTestResult = new Lazy(() => MouseTargetFactory.doHitTest(this._ctx, this));
this._targetPathCacheElement = null;
this._targetPathCacheValue = new Uint8Array(0);
this._ctx = ctx;
this._eventTarget = eventTarget;
const hasEventTarget = Boolean(this._eventTarget);
this._useHitTestTarget = !hasEventTarget;
}
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 = true;
}
_getMouseColumn(position = null) {
if (position && position.column < this._ctx.viewModel.getLineMaxColumn(position.lineNumber)) {
return CursorColumns.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(position.lineNumber), position.column, this._ctx.viewModel.model.getOptions().tabSize) + 1;
}
return this.mouseColumn;
}
fulfillUnknown(position = null) {
return MouseTarget.createUnknown(this.target, this._getMouseColumn(position), position);
}
fulfillTextarea() {
return MouseTarget.createTextarea(this.target, this._getMouseColumn());
}
fulfillMargin(type, position, range2, detail) {
return MouseTarget.createMargin(type, this.target, this._getMouseColumn(position), position, range2, detail);
}
fulfillViewZone(type, position, detail) {
return MouseTarget.createViewZone(type, this.target, this._getMouseColumn(position), position, detail);
}
fulfillContentText(position, range2, detail) {
return MouseTarget.createContentText(this.target, this._getMouseColumn(position), position, range2, detail);
}
fulfillContentEmpty(position, detail) {
return MouseTarget.createContentEmpty(this.target, this._getMouseColumn(position), position, detail);
}
fulfillContentWidget(detail) {
return MouseTarget.createContentWidget(this.target, this._getMouseColumn(), detail);
}
fulfillScrollbar(position) {
return MouseTarget.createScrollbar(this.target, this._getMouseColumn(position), position);
}
fulfillOverlayWidget(detail) {
return MouseTarget.createOverlayWidget(this.target, this._getMouseColumn(), detail);
}
};
EMPTY_CONTENT_AFTER_LINES = { isAfterLines: true };
MouseTargetFactory = class _MouseTargetFactory {
constructor(context, viewHelper) {
this._context = context;
this._viewHelper = viewHelper;
}
mouseTargetIsWidget(e) {
const t4 = e.target;
const path = PartFingerprints.collect(t4, this._viewHelper.viewDomNode);
if (ElementPath.isChildOfContentWidgets(path) || ElementPath.isChildOfOverflowingContentWidgets(path)) {
return true;
}
if (ElementPath.isChildOfOverlayWidgets(path) || ElementPath.isChildOfOverflowingOverlayWidgets(path)) {
return true;
}
return false;
}
createMouseTarget(lastRenderData, editorPos, pos, relativePos, target) {
const ctx = new HitTestContext(this._context, this._viewHelper, lastRenderData);
const request = new HitTestRequest(ctx, editorPos, pos, relativePos, target);
try {
const r = _MouseTargetFactory._createMouseTarget(ctx, request);
if (r.type === 6) {
if (ctx.stickyTabStops && r.position !== null) {
const position = _MouseTargetFactory._snapToSoftTabBoundary(r.position, ctx.viewModel);
const range2 = Range.fromPositions(position, position).plusRange(r.range);
return request.fulfillContentText(position, range2, r.detail);
}
}
return r;
} catch (err) {
return request.fulfillUnknown();
}
}
static _createMouseTarget(ctx, request) {
if (request.target === null) {
return request.fulfillUnknown();
}
const resolvedRequest = request;
let result = null;
if (!ElementPath.isChildOfOverflowGuard(request.targetPath) && !ElementPath.isChildOfOverflowingContentWidgets(request.targetPath) && !ElementPath.isChildOfOverflowingOverlayWidgets(request.targetPath)) {
result = result || request.fulfillUnknown();
}
result = result || _MouseTargetFactory._hitTestContentWidget(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestOverlayWidget(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestMinimap(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestScrollbarSlider(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestViewZone(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestMargin(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestViewCursor(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestTextArea(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestViewLines(ctx, resolvedRequest);
result = result || _MouseTargetFactory._hitTestScrollbar(ctx, resolvedRequest);
return result || request.fulfillUnknown();
}
static _hitTestContentWidget(ctx, request) {
if (ElementPath.isChildOfContentWidgets(request.targetPath) || ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {
const widgetId = ctx.findAttribute(request.target, "widgetId");
if (widgetId) {
return request.fulfillContentWidget(widgetId);
} else {
return request.fulfillUnknown();
}
}
return null;
}
static _hitTestOverlayWidget(ctx, request) {
if (ElementPath.isChildOfOverlayWidgets(request.targetPath) || ElementPath.isChildOfOverflowingOverlayWidgets(request.targetPath)) {
const widgetId = ctx.findAttribute(request.target, "widgetId");
if (widgetId) {
return request.fulfillOverlayWidget(widgetId);
} else {
return request.fulfillUnknown();
}
}
return null;
}
static _hitTestViewCursor(ctx, request) {
if (request.target) {
const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;
for (const d of lastViewCursorsRenderData) {
if (request.target === d.domNode) {
return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });
}
}
}
if (request.isInContentArea) {
const lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;
const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;
const mouseVerticalOffset = request.mouseVerticalOffset;
for (const d of lastViewCursorsRenderData) {
if (mouseContentHorizontalOffset < d.contentLeft) {
continue;
}
if (mouseContentHorizontalOffset > d.contentLeft + d.width) {
continue;
}
const cursorVerticalOffset = ctx.getVerticalOffsetForLineNumber(d.position.lineNumber);
if (cursorVerticalOffset <= mouseVerticalOffset && mouseVerticalOffset <= cursorVerticalOffset + d.height) {
return request.fulfillContentText(d.position, null, { mightBeForeignElement: false, injectedText: null });
}
}
}
return null;
}
static _hitTestViewZone(ctx, request) {
const viewZoneData = ctx.getZoneAtCoord(request.mouseVerticalOffset);
if (viewZoneData) {
const mouseTargetType = request.isInContentArea ? 8 : 5;
return request.fulfillViewZone(mouseTargetType, viewZoneData.position, viewZoneData);
}
return null;
}
static _hitTestTextArea(ctx, request) {
if (ElementPath.isTextArea(request.targetPath)) {
if (ctx.lastRenderData.lastTextareaPosition) {
return request.fulfillContentText(ctx.lastRenderData.lastTextareaPosition, null, { mightBeForeignElement: false, injectedText: null });
}
return request.fulfillTextarea();
}
return null;
}
static _hitTestMargin(ctx, request) {
if (request.isInMarginArea) {
const res = ctx.getFullLineRangeAtCoord(request.mouseVerticalOffset);
const pos = res.range.getStartPosition();
let offset = Math.abs(request.relativePos.x);
const detail = {
isAfterLines: res.isAfterLines,
glyphMarginLeft: ctx.layoutInfo.glyphMarginLeft,
glyphMarginWidth: ctx.layoutInfo.glyphMarginWidth,
lineNumbersWidth: ctx.layoutInfo.lineNumbersWidth,
offsetX: offset
};
offset -= ctx.layoutInfo.glyphMarginLeft;
if (offset <= ctx.layoutInfo.glyphMarginWidth) {
const modelCoordinate = ctx.viewModel.coordinatesConverter.convertViewPositionToModelPosition(res.range.getStartPosition());
const lanes = ctx.viewModel.glyphLanes.getLanesAtLine(modelCoordinate.lineNumber);
detail.glyphMarginLane = lanes[Math.floor(offset / ctx.lineHeight)];
return request.fulfillMargin(2, pos, res.range, detail);
}
offset -= ctx.layoutInfo.glyphMarginWidth;
if (offset <= ctx.layoutInfo.lineNumbersWidth) {
return request.fulfillMargin(3, pos, res.range, detail);
}
offset -= ctx.layoutInfo.lineNumbersWidth;
return request.fulfillMargin(4, pos, res.range, detail);
}
return null;
}
static _hitTestViewLines(ctx, request) {
if (!ElementPath.isChildOfViewLines(request.targetPath)) {
return null;
}
if (ctx.isInTopPadding(request.mouseVerticalOffset)) {
return request.fulfillContentEmpty(new Position(1, 1), EMPTY_CONTENT_AFTER_LINES);
}
if (ctx.isAfterLines(request.mouseVerticalOffset) || ctx.isInBottomPadding(request.mouseVerticalOffset)) {
const lineCount = ctx.viewModel.getLineCount();
const maxLineColumn = ctx.viewModel.getLineMaxColumn(lineCount);
return request.fulfillContentEmpty(new Position(lineCount, maxLineColumn), EMPTY_CONTENT_AFTER_LINES);
}
if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {
const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
if (ctx.viewModel.getLineLength(lineNumber) === 0) {
const lineWidth2 = ctx.getLineWidth(lineNumber);
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth2);
return request.fulfillContentEmpty(new Position(lineNumber, 1), detail);
}
const lineWidth = ctx.getLineWidth(lineNumber);
if (request.mouseContentHorizontalOffset >= lineWidth) {
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
const pos = new Position(lineNumber, ctx.viewModel.getLineMaxColumn(lineNumber));
return request.fulfillContentEmpty(pos, detail);
}
}
const hitTestResult = request.hitTestResult.value;
if (hitTestResult.type === 1) {
return _MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.spanNode, hitTestResult.position, hitTestResult.injectedText);
}
if (request.wouldBenefitFromHitTestTargetSwitch) {
request.switchToHitTestTarget();
return this._createMouseTarget(ctx, request);
}
return request.fulfillUnknown();
}
static _hitTestMinimap(ctx, request) {
if (ElementPath.isChildOfMinimap(request.targetPath)) {
const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);
return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));
}
return null;
}
static _hitTestScrollbarSlider(ctx, request) {
if (ElementPath.isChildOfScrollableElement(request.targetPath)) {
if (request.target && request.target.nodeType === 1) {
const className = request.target.className;
if (className && /\b(slider|scrollbar)\b/.test(className)) {
const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);
return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));
}
}
}
return null;
}
static _hitTestScrollbar(ctx, request) {
if (ElementPath.isChildOfScrollableElement(request.targetPath)) {
const possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
const maxColumn = ctx.viewModel.getLineMaxColumn(possibleLineNumber);
return request.fulfillScrollbar(new Position(possibleLineNumber, maxColumn));
}
return null;
}
getMouseColumn(relativePos) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + relativePos.x - layoutInfo.contentLeft;
return _MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth);
}
static _getMouseColumn(mouseContentHorizontalOffset, typicalHalfwidthCharacterWidth) {
if (mouseContentHorizontalOffset < 0) {
return 1;
}
const chars = Math.round(mouseContentHorizontalOffset / typicalHalfwidthCharacterWidth);
return chars + 1;
}
static createMouseTargetFromHitTestPosition(ctx, request, spanNode, pos, injectedText) {
const lineNumber = pos.lineNumber;
const column = pos.column;
const lineWidth = ctx.getLineWidth(lineNumber);
if (request.mouseContentHorizontalOffset > lineWidth) {
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
return request.fulfillContentEmpty(pos, detail);
}
const visibleRange = ctx.visibleRangeForPosition(lineNumber, column);
if (!visibleRange) {
return request.fulfillUnknown(pos);
}
const columnHorizontalOffset = visibleRange.left;
if (Math.abs(request.mouseContentHorizontalOffset - columnHorizontalOffset) < 1) {
return request.fulfillContentText(pos, null, { mightBeForeignElement: !!injectedText, injectedText });
}
const points = [];
points.push({ offset: visibleRange.left, column });
if (column > 1) {
const visibleRange2 = ctx.visibleRangeForPosition(lineNumber, column - 1);
if (visibleRange2) {
points.push({ offset: visibleRange2.left, column: column - 1 });
}
}
const lineMaxColumn = ctx.viewModel.getLineMaxColumn(lineNumber);
if (column < lineMaxColumn) {
const visibleRange2 = ctx.visibleRangeForPosition(lineNumber, column + 1);
if (visibleRange2) {
points.push({ offset: visibleRange2.left, column: column + 1 });
}
}
points.sort((a3, b) => a3.offset - b.offset);
const mouseCoordinates = request.pos.toClientCoordinates(getWindow(ctx.viewDomNode));
const spanNodeClientRect = spanNode.getBoundingClientRect();
const mouseIsOverSpanNode = spanNodeClientRect.left <= mouseCoordinates.clientX && mouseCoordinates.clientX <= spanNodeClientRect.right;
let rng = null;
for (let i = 1; i < points.length; i++) {
const prev = points[i - 1];
const curr = points[i];
if (prev.offset <= request.mouseContentHorizontalOffset && request.mouseContentHorizontalOffset <= curr.offset) {
rng = new Range(lineNumber, prev.column, lineNumber, curr.column);
const prevDelta = Math.abs(prev.offset - request.mouseContentHorizontalOffset);
const nextDelta = Math.abs(curr.offset - request.mouseContentHorizontalOffset);
pos = prevDelta < nextDelta ? new Position(lineNumber, prev.column) : new Position(lineNumber, curr.column);
break;
}
}
return request.fulfillContentText(pos, rng, { mightBeForeignElement: !mouseIsOverSpanNode || !!injectedText, injectedText });
}
/**
* Most probably WebKit browsers and Edge
*/
static _doHitTestWithCaretRangeFromPoint(ctx, request) {
const lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
const lineStartVerticalOffset = ctx.getVerticalOffsetForLineNumber(lineNumber);
const lineEndVerticalOffset = lineStartVerticalOffset + ctx.lineHeight;
const isBelowLastLine = lineNumber === ctx.viewModel.getLineCount() && request.mouseVerticalOffset > lineEndVerticalOffset;
if (!isBelowLastLine) {
const lineCenteredVerticalOffset = Math.floor((lineStartVerticalOffset + lineEndVerticalOffset) / 2);
let adjustedPageY = request.pos.y + (lineCenteredVerticalOffset - request.mouseVerticalOffset);
if (adjustedPageY <= request.editorPos.y) {
adjustedPageY = request.editorPos.y + 1;
}
if (adjustedPageY >= request.editorPos.y + request.editorPos.height) {
adjustedPageY = request.editorPos.y + request.editorPos.height - 1;
}
const adjustedPage = new PageCoordinates(request.pos.x, adjustedPageY);
const r = this._actualDoHitTestWithCaretRangeFromPoint(ctx, adjustedPage.toClientCoordinates(getWindow(ctx.viewDomNode)));
if (r.type === 1) {
return r;
}
}
return this._actualDoHitTestWithCaretRangeFromPoint(ctx, request.pos.toClientCoordinates(getWindow(ctx.viewDomNode)));
}
static _actualDoHitTestWithCaretRangeFromPoint(ctx, coords) {
const shadowRoot = getShadowRoot(ctx.viewDomNode);
let range2;
if (shadowRoot) {
if (typeof shadowRoot.caretRangeFromPoint === "undefined") {
range2 = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY);
} else {
range2 = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY);
}
} else {
range2 = ctx.viewDomNode.ownerDocument.caretRangeFromPoint(coords.clientX, coords.clientY);
}
if (!range2 || !range2.startContainer) {
return new UnknownHitTestResult();
}
const startContainer = range2.startContainer;
if (startContainer.nodeType === startContainer.TEXT_NODE) {
const parent1 = startContainer.parentNode;
const parent2 = parent1 ? parent1.parentNode : null;
const parent3 = parent2 ? parent2.parentNode : null;
const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;
if (parent3ClassName === ViewLine.CLASS_NAME) {
return HitTestResult.createFromDOMInfo(ctx, parent1, range2.startOffset);
} else {
return new UnknownHitTestResult(startContainer.parentNode);
}
} else if (startContainer.nodeType === startContainer.ELEMENT_NODE) {
const parent1 = startContainer.parentNode;
const parent2 = parent1 ? parent1.parentNode : null;
const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;
if (parent2ClassName === ViewLine.CLASS_NAME) {
return HitTestResult.createFromDOMInfo(ctx, startContainer, startContainer.textContent.length);
} else {
return new UnknownHitTestResult(startContainer);
}
}
return new UnknownHitTestResult();
}
/**
* Most probably Gecko
*/
static _doHitTestWithCaretPositionFromPoint(ctx, coords) {
const hitResult = ctx.viewDomNode.ownerDocument.caretPositionFromPoint(coords.clientX, coords.clientY);
if (hitResult.offsetNode.nodeType === hitResult.offsetNode.TEXT_NODE) {
const parent1 = hitResult.offsetNode.parentNode;
const parent2 = parent1 ? parent1.parentNode : null;
const parent3 = parent2 ? parent2.parentNode : null;
const parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;
if (parent3ClassName === ViewLine.CLASS_NAME) {
return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode.parentNode, hitResult.offset);
} else {
return new UnknownHitTestResult(hitResult.offsetNode.parentNode);
}
}
if (hitResult.offsetNode.nodeType === hitResult.offsetNode.ELEMENT_NODE) {
const parent1 = hitResult.offsetNode.parentNode;
const parent1ClassName = parent1 && parent1.nodeType === parent1.ELEMENT_NODE ? parent1.className : null;
const parent2 = parent1 ? parent1.parentNode : null;
const parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;
if (parent1ClassName === ViewLine.CLASS_NAME) {
const tokenSpan = hitResult.offsetNode.childNodes[Math.min(hitResult.offset, hitResult.offsetNode.childNodes.length - 1)];
if (tokenSpan) {
return HitTestResult.createFromDOMInfo(ctx, tokenSpan, 0);
}
} else if (parent2ClassName === ViewLine.CLASS_NAME) {
return HitTestResult.createFromDOMInfo(ctx, hitResult.offsetNode, 0);
}
}
return new UnknownHitTestResult(hitResult.offsetNode);
}
static _snapToSoftTabBoundary(position, viewModel) {
const lineContent = viewModel.getLineContent(position.lineNumber);
const { tabSize } = viewModel.model.getOptions();
const newPosition = AtomicTabMoveOperations.atomicPosition(
lineContent,
position.column - 1,
tabSize,
2
/* Direction.Nearest */
);
if (newPosition !== -1) {
return new Position(position.lineNumber, newPosition + 1);
}
return position;
}
static doHitTest(ctx, request) {
let result = new UnknownHitTestResult();
if (typeof ctx.viewDomNode.ownerDocument.caretRangeFromPoint === "function") {
result = this._doHitTestWithCaretRangeFromPoint(ctx, request);
} else if (ctx.viewDomNode.ownerDocument.caretPositionFromPoint) {
result = this._doHitTestWithCaretPositionFromPoint(ctx, request.pos.toClientCoordinates(getWindow(ctx.viewDomNode)));
}
if (result.type === 1) {
const injectedText = ctx.viewModel.getInjectedTextAt(result.position);
const normalizedPosition = ctx.viewModel.normalizePosition(
result.position,
2
/* PositionAffinity.None */
);
if (injectedText || !normalizedPosition.equals(result.position)) {
result = new ContentHitTestResult(normalizedPosition, result.spanNode, injectedText);
}
}
return result;
}
};
CharWidthReader = class _CharWidthReader {
static getInstance() {
if (!_CharWidthReader._INSTANCE) {
_CharWidthReader._INSTANCE = new _CharWidthReader();
}
return _CharWidthReader._INSTANCE;
}
constructor() {
this._cache = {};
this._canvas = document.createElement("canvas");
}
getCharWidth(char, font) {
const cacheKey = char + font;
if (this._cache[cacheKey]) {
return this._cache[cacheKey];
}
const context = this._canvas.getContext("2d");
context.font = font;
const metrics = context.measureText(char);
const width2 = metrics.width;
this._cache[cacheKey] = width2;
return width2;
}
};
CharWidthReader._INSTANCE = null;
}
});
// node_modules/monaco-editor/esm/vs/base/common/decorators.js
function memoize(_target, key, descriptor) {
let fnKey = null;
let fn = null;
if (typeof descriptor.value === "function") {
fnKey = "value";
fn = descriptor.value;
if (fn.length !== 0) {
console.warn("Memoize should only be used in functions with zero parameters");
}
} else if (typeof descriptor.get === "function") {
fnKey = "get";
fn = descriptor.get;
}
if (!fn) {
throw new Error("not supported");
}
const memoizeKey = `$memoize$${key}`;
descriptor[fnKey] = function(...args) {
if (!this.hasOwnProperty(memoizeKey)) {
Object.defineProperty(this, memoizeKey, {
configurable: false,
enumerable: false,
writable: false,
value: fn.apply(this, args)
});
}
return this[memoizeKey];
};
}
var init_decorators = __esm({
"node_modules/monaco-editor/esm/vs/base/common/decorators.js"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/touch.js
var __decorate7, EventType2, Gesture;
var init_touch = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/touch.js"() {
init_dom();
init_window();
init_arrays();
init_decorators();
init_event();
init_lifecycle();
init_linkedList();
__decorate7 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
(function(EventType3) {
EventType3.Tap = "-monaco-gesturetap";
EventType3.Change = "-monaco-gesturechange";
EventType3.Start = "-monaco-gesturestart";
EventType3.End = "-monaco-gesturesend";
EventType3.Contextmenu = "-monaco-gesturecontextmenu";
})(EventType2 || (EventType2 = {}));
Gesture = class _Gesture extends Disposable {
constructor() {
super();
this.dispatched = false;
this.targets = new LinkedList();
this.ignoreTargets = new LinkedList();
this.activeTouches = {};
this.handle = null;
this._lastSetTapCountTime = 0;
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window: window2, disposables }) => {
disposables.add(addDisposableListener(window2.document, "touchstart", (e) => this.onTouchStart(e), { passive: false }));
disposables.add(addDisposableListener(window2.document, "touchend", (e) => this.onTouchEnd(window2, e)));
disposables.add(addDisposableListener(window2.document, "touchmove", (e) => this.onTouchMove(e), { passive: false }));
}, { window: mainWindow, disposables: this._store }));
}
static addTarget(element) {
if (!_Gesture.isTouchDevice()) {
return Disposable.None;
}
if (!_Gesture.INSTANCE) {
_Gesture.INSTANCE = markAsSingleton(new _Gesture());
}
const remove = _Gesture.INSTANCE.targets.push(element);
return toDisposable(remove);
}
static ignoreTarget(element) {
if (!_Gesture.isTouchDevice()) {
return Disposable.None;
}
if (!_Gesture.INSTANCE) {
_Gesture.INSTANCE = markAsSingleton(new _Gesture());
}
const remove = _Gesture.INSTANCE.ignoreTargets.push(element);
return toDisposable(remove);
}
static isTouchDevice() {
return "ontouchstart" in mainWindow || navigator.maxTouchPoints > 0;
}
dispose() {
if (this.handle) {
this.handle.dispose();
this.handle = null;
}
super.dispose();
}
onTouchStart(e) {
const timestamp = Date.now();
if (this.handle) {
this.handle.dispose();
this.handle = null;
}
for (let i = 0, len = e.targetTouches.length; i < len; i++) {
const touch = e.targetTouches.item(i);
this.activeTouches[touch.identifier] = {
id: touch.identifier,
initialTarget: touch.target,
initialTimeStamp: timestamp,
initialPageX: touch.pageX,
initialPageY: touch.pageY,
rollingTimestamps: [timestamp],
rollingPageX: [touch.pageX],
rollingPageY: [touch.pageY]
};
const evt = this.newGestureEvent(EventType2.Start, touch.target);
evt.pageX = touch.pageX;
evt.pageY = touch.pageY;
this.dispatchEvent(evt);
}
if (this.dispatched) {
e.preventDefault();
e.stopPropagation();
this.dispatched = false;
}
}
onTouchEnd(targetWindow, e) {
const timestamp = Date.now();
const activeTouchCount = Object.keys(this.activeTouches).length;
for (let i = 0, len = e.changedTouches.length; i < len; i++) {
const touch = e.changedTouches.item(i);
if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {
console.warn("move of an UNKNOWN touch", touch);
continue;
}
const data = this.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;
if (holdTime < _Gesture.HOLD_DELAY && Math.abs(data.initialPageX - tail(data.rollingPageX)) < 30 && Math.abs(data.initialPageY - tail(data.rollingPageY)) < 30) {
const evt = this.newGestureEvent(EventType2.Tap, data.initialTarget);
evt.pageX = tail(data.rollingPageX);
evt.pageY = tail(data.rollingPageY);
this.dispatchEvent(evt);
} else if (holdTime >= _Gesture.HOLD_DELAY && Math.abs(data.initialPageX - tail(data.rollingPageX)) < 30 && Math.abs(data.initialPageY - tail(data.rollingPageY)) < 30) {
const evt = this.newGestureEvent(EventType2.Contextmenu, data.initialTarget);
evt.pageX = tail(data.rollingPageX);
evt.pageY = tail(data.rollingPageY);
this.dispatchEvent(evt);
} else if (activeTouchCount === 1) {
const finalX = tail(data.rollingPageX);
const finalY = tail(data.rollingPageY);
const deltaT = tail(data.rollingTimestamps) - data.rollingTimestamps[0];
const deltaX = finalX - data.rollingPageX[0];
const deltaY = finalY - data.rollingPageY[0];
const dispatchTo = [...this.targets].filter((t4) => data.initialTarget instanceof Node && t4.contains(data.initialTarget));
this.inertia(
targetWindow,
dispatchTo,
timestamp,
// time now
Math.abs(deltaX) / deltaT,
// speed
deltaX > 0 ? 1 : -1,
// x direction
finalX,
// x now
Math.abs(deltaY) / deltaT,
// y speed
deltaY > 0 ? 1 : -1,
// y direction
finalY
// y now
);
}
this.dispatchEvent(this.newGestureEvent(EventType2.End, data.initialTarget));
delete this.activeTouches[touch.identifier];
}
if (this.dispatched) {
e.preventDefault();
e.stopPropagation();
this.dispatched = false;
}
}
newGestureEvent(type, initialTarget) {
const event = document.createEvent("CustomEvent");
event.initEvent(type, false, true);
event.initialTarget = initialTarget;
event.tapCount = 0;
return event;
}
dispatchEvent(event) {
if (event.type === EventType2.Tap) {
const currentTime = (/* @__PURE__ */ new Date()).getTime();
let setTapCount = 0;
if (currentTime - this._lastSetTapCountTime > _Gesture.CLEAR_TAP_COUNT_TIME) {
setTapCount = 1;
} else {
setTapCount = 2;
}
this._lastSetTapCountTime = currentTime;
event.tapCount = setTapCount;
} else if (event.type === EventType2.Change || event.type === EventType2.Contextmenu) {
this._lastSetTapCountTime = 0;
}
if (event.initialTarget instanceof Node) {
for (const ignoreTarget of this.ignoreTargets) {
if (ignoreTarget.contains(event.initialTarget)) {
return;
}
}
const targets = [];
for (const target of this.targets) {
if (target.contains(event.initialTarget)) {
let depth = 0;
let now = event.initialTarget;
while (now && now !== target) {
depth++;
now = now.parentElement;
}
targets.push([depth, target]);
}
}
targets.sort((a3, b) => a3[0] - b[0]);
for (const [_, target] of targets) {
target.dispatchEvent(event);
this.dispatched = true;
}
}
}
inertia(targetWindow, dispatchTo, t1, vX, dirX, x, vY, dirY, y) {
this.handle = scheduleAtNextAnimationFrame(targetWindow, () => {
const now = Date.now();
const deltaT = now - t1;
let delta_pos_x = 0, delta_pos_y = 0;
let stopped = true;
vX += _Gesture.SCROLL_FRICTION * deltaT;
vY += _Gesture.SCROLL_FRICTION * deltaT;
if (vX > 0) {
stopped = false;
delta_pos_x = dirX * vX * deltaT;
}
if (vY > 0) {
stopped = false;
delta_pos_y = dirY * vY * deltaT;
}
const evt = this.newGestureEvent(EventType2.Change);
evt.translationX = delta_pos_x;
evt.translationY = delta_pos_y;
dispatchTo.forEach((d) => d.dispatchEvent(evt));
if (!stopped) {
this.inertia(targetWindow, dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);
}
});
}
onTouchMove(e) {
const timestamp = Date.now();
for (let i = 0, len = e.changedTouches.length; i < len; i++) {
const touch = e.changedTouches.item(i);
if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {
console.warn("end of an UNKNOWN touch", touch);
continue;
}
const data = this.activeTouches[touch.identifier];
const evt = this.newGestureEvent(EventType2.Change, data.initialTarget);
evt.translationX = touch.pageX - tail(data.rollingPageX);
evt.translationY = touch.pageY - tail(data.rollingPageY);
evt.pageX = touch.pageX;
evt.pageY = touch.pageY;
this.dispatchEvent(evt);
if (data.rollingPageX.length > 3) {
data.rollingPageX.shift();
data.rollingPageY.shift();
data.rollingTimestamps.shift();
}
data.rollingPageX.push(touch.pageX);
data.rollingPageY.push(touch.pageY);
data.rollingTimestamps.push(timestamp);
}
if (this.dispatched) {
e.preventDefault();
e.stopPropagation();
this.dispatched = false;
}
}
};
Gesture.SCROLL_FRICTION = -5e-3;
Gesture.HOLD_DELAY = 700;
Gesture.CLEAR_TAP_COUNT_TIME = 400;
__decorate7([
memoize
], Gesture, "isTouchDevice", null);
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js
var Widget;
var init_widget = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js"() {
init_dom();
init_keyboardEvent();
init_mouseEvent();
init_touch();
init_lifecycle();
Widget = class extends Disposable {
onclick(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.CLICK, (e) => listener(new StandardMouseEvent(getWindow(domNode), e))));
}
onmousedown(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.MOUSE_DOWN, (e) => listener(new StandardMouseEvent(getWindow(domNode), e))));
}
onmouseover(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.MOUSE_OVER, (e) => listener(new StandardMouseEvent(getWindow(domNode), e))));
}
onmouseleave(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.MOUSE_LEAVE, (e) => listener(new StandardMouseEvent(getWindow(domNode), e))));
}
onkeydown(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.KEY_DOWN, (e) => listener(new StandardKeyboardEvent(e))));
}
onkeyup(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.KEY_UP, (e) => listener(new StandardKeyboardEvent(e))));
}
oninput(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.INPUT, listener));
}
onblur(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.BLUR, listener));
}
onfocus(domNode, listener) {
this._register(addDisposableListener(domNode, EventType.FOCUS, listener));
}
ignoreGesture(domNode) {
return Gesture.ignoreTarget(domNode);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js
var ARROW_IMG_SIZE, ScrollbarArrow;
var init_scrollbarArrow = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js"() {
init_globalPointerMoveMonitor();
init_widget();
init_async();
init_themables();
init_dom();
ARROW_IMG_SIZE = 11;
ScrollbarArrow = class extends Widget {
constructor(opts) {
super();
this._onActivate = opts.onActivate;
this.bgDomNode = document.createElement("div");
this.bgDomNode.className = "arrow-background";
this.bgDomNode.style.position = "absolute";
this.bgDomNode.style.width = opts.bgWidth + "px";
this.bgDomNode.style.height = opts.bgHeight + "px";
if (typeof opts.top !== "undefined") {
this.bgDomNode.style.top = "0px";
}
if (typeof opts.left !== "undefined") {
this.bgDomNode.style.left = "0px";
}
if (typeof opts.bottom !== "undefined") {
this.bgDomNode.style.bottom = "0px";
}
if (typeof opts.right !== "undefined") {
this.bgDomNode.style.right = "0px";
}
this.domNode = document.createElement("div");
this.domNode.className = opts.className;
this.domNode.classList.add(...ThemeIcon.asClassNameArray(opts.icon));
this.domNode.style.position = "absolute";
this.domNode.style.width = ARROW_IMG_SIZE + "px";
this.domNode.style.height = ARROW_IMG_SIZE + "px";
if (typeof opts.top !== "undefined") {
this.domNode.style.top = opts.top + "px";
}
if (typeof opts.left !== "undefined") {
this.domNode.style.left = opts.left + "px";
}
if (typeof opts.bottom !== "undefined") {
this.domNode.style.bottom = opts.bottom + "px";
}
if (typeof opts.right !== "undefined") {
this.domNode.style.right = opts.right + "px";
}
this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());
this._register(addStandardDisposableListener(this.bgDomNode, EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));
this._register(addStandardDisposableListener(this.domNode, EventType.POINTER_DOWN, (e) => this._arrowPointerDown(e)));
this._pointerdownRepeatTimer = this._register(new WindowIntervalTimer());
this._pointerdownScheduleRepeatTimer = this._register(new TimeoutTimer());
}
_arrowPointerDown(e) {
if (!e.target || !(e.target instanceof Element)) {
return;
}
const scheduleRepeater = () => {
this._pointerdownRepeatTimer.cancelAndSet(() => this._onActivate(), 1e3 / 24, getWindow(e));
};
this._onActivate();
this._pointerdownRepeatTimer.cancel();
this._pointerdownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);
this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => {
}, () => {
this._pointerdownRepeatTimer.cancel();
this._pointerdownScheduleRepeatTimer.cancel();
});
e.preventDefault();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js
var ScrollbarVisibilityController;
var init_scrollbarVisibilityController = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js"() {
init_async();
init_lifecycle();
ScrollbarVisibilityController = class extends Disposable {
constructor(visibility, visibleClassName, invisibleClassName) {
super();
this._visibility = visibility;
this._visibleClassName = visibleClassName;
this._invisibleClassName = invisibleClassName;
this._domNode = null;
this._isVisible = false;
this._isNeeded = false;
this._rawShouldBeVisible = false;
this._shouldBeVisible = false;
this._revealTimer = this._register(new TimeoutTimer());
}
setVisibility(visibility) {
if (this._visibility !== visibility) {
this._visibility = visibility;
this._updateShouldBeVisible();
}
}
// ----------------- Hide / Reveal
setShouldBeVisible(rawShouldBeVisible) {
this._rawShouldBeVisible = rawShouldBeVisible;
this._updateShouldBeVisible();
}
_applyVisibilitySetting() {
if (this._visibility === 2) {
return false;
}
if (this._visibility === 3) {
return true;
}
return this._rawShouldBeVisible;
}
_updateShouldBeVisible() {
const shouldBeVisible = this._applyVisibilitySetting();
if (this._shouldBeVisible !== shouldBeVisible) {
this._shouldBeVisible = shouldBeVisible;
this.ensureVisibility();
}
}
setIsNeeded(isNeeded) {
if (this._isNeeded !== isNeeded) {
this._isNeeded = isNeeded;
this.ensureVisibility();
}
}
setDomNode(domNode) {
this._domNode = domNode;
this._domNode.setClassName(this._invisibleClassName);
this.setShouldBeVisible(false);
}
ensureVisibility() {
if (!this._isNeeded) {
this._hide(false);
return;
}
if (this._shouldBeVisible) {
this._reveal();
} else {
this._hide(true);
}
}
_reveal() {
if (this._isVisible) {
return;
}
this._isVisible = true;
this._revealTimer.setIfNotSet(() => {
var _a10;
(_a10 = this._domNode) === null || _a10 === void 0 ? void 0 : _a10.setClassName(this._visibleClassName);
}, 0);
}
_hide(withFadeAway) {
var _a10;
this._revealTimer.cancel();
if (!this._isVisible) {
return;
}
this._isVisible = false;
(_a10 = this._domNode) === null || _a10 === void 0 ? void 0 : _a10.setClassName(this._invisibleClassName + (withFadeAway ? " fade" : ""));
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js
var POINTER_DRAG_RESET_DISTANCE, AbstractScrollbar;
var init_abstractScrollbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js"() {
init_dom();
init_fastDomNode();
init_globalPointerMoveMonitor();
init_scrollbarArrow();
init_scrollbarVisibilityController();
init_widget();
init_platform();
POINTER_DRAG_RESET_DISTANCE = 140;
AbstractScrollbar = class extends Widget {
constructor(opts) {
super();
this._lazyRender = opts.lazyRender;
this._host = opts.host;
this._scrollable = opts.scrollable;
this._scrollByPage = opts.scrollByPage;
this._scrollbarState = opts.scrollbarState;
this._visibilityController = this._register(new ScrollbarVisibilityController(opts.visibility, "visible scrollbar " + opts.extraScrollbarClassName, "invisible scrollbar " + opts.extraScrollbarClassName));
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._pointerMoveMonitor = this._register(new GlobalPointerMoveMonitor());
this._shouldRender = true;
this.domNode = createFastDomNode(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(addDisposableListener(this.domNode.domNode, EventType.POINTER_DOWN, (e) => this._domNodePointerDown(e)));
}
// ----------------- creation
/**
* Creates the dom node for an arrow & adds it to the container
*/
_createArrow(opts) {
const arrow = this._register(new ScrollbarArrow(opts));
this.domNode.domNode.appendChild(arrow.bgDomNode);
this.domNode.domNode.appendChild(arrow.domNode);
}
/**
* Creates the slider dom node, adds it to the container & hooks up the events
*/
_createSlider(top, left, width2, height) {
this.slider = createFastDomNode(document.createElement("div"));
this.slider.setClassName("slider");
this.slider.setPosition("absolute");
this.slider.setTop(top);
this.slider.setLeft(left);
if (typeof width2 === "number") {
this.slider.setWidth(width2);
}
if (typeof height === "number") {
this.slider.setHeight(height);
}
this.slider.setLayerHinting(true);
this.slider.setContain("strict");
this.domNode.domNode.appendChild(this.slider.domNode);
this._register(addDisposableListener(this.slider.domNode, EventType.POINTER_DOWN, (e) => {
if (e.button === 0) {
e.preventDefault();
this._sliderPointerDown(e);
}
}));
this.onclick(this.slider.domNode, (e) => {
if (e.leftButton) {
e.stopPropagation();
}
});
}
// ----------------- Update state
_onElementSize(visibleSize) {
if (this._scrollbarState.setVisibleSize(visibleSize)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
}
_onElementScrollSize(elementScrollSize) {
if (this._scrollbarState.setScrollSize(elementScrollSize)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
}
_onElementScrollPosition(elementScrollPosition) {
if (this._scrollbarState.setScrollPosition(elementScrollPosition)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
}
// ----------------- rendering
beginReveal() {
this._visibilityController.setShouldBeVisible(true);
}
beginHide() {
this._visibilityController.setShouldBeVisible(false);
}
render() {
if (!this._shouldRender) {
return;
}
this._shouldRender = false;
this._renderDomNode(this._scrollbarState.getRectangleLargeSize(), this._scrollbarState.getRectangleSmallSize());
this._updateSlider(this._scrollbarState.getSliderSize(), this._scrollbarState.getArrowSize() + this._scrollbarState.getSliderPosition());
}
// ----------------- DOM events
_domNodePointerDown(e) {
if (e.target !== this.domNode.domNode) {
return;
}
this._onPointerDown(e);
}
delegatePointerDown(e) {
const domTop = this.domNode.domNode.getClientRects()[0].top;
const sliderStart = domTop + this._scrollbarState.getSliderPosition();
const sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();
const pointerPos = this._sliderPointerPosition(e);
if (sliderStart <= pointerPos && pointerPos <= sliderStop) {
if (e.button === 0) {
e.preventDefault();
this._sliderPointerDown(e);
}
} else {
this._onPointerDown(e);
}
}
_onPointerDown(e) {
let offsetX;
let offsetY;
if (e.target === this.domNode.domNode && typeof e.offsetX === "number" && typeof e.offsetY === "number") {
offsetX = e.offsetX;
offsetY = e.offsetY;
} else {
const domNodePosition = getDomNodePagePosition(this.domNode.domNode);
offsetX = e.pageX - domNodePosition.left;
offsetY = e.pageY - domNodePosition.top;
}
const offset = this._pointerDownRelativePosition(offsetX, offsetY);
this._setDesiredScrollPositionNow(this._scrollByPage ? this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(offset) : this._scrollbarState.getDesiredScrollPositionFromOffset(offset));
if (e.button === 0) {
e.preventDefault();
this._sliderPointerDown(e);
}
}
_sliderPointerDown(e) {
if (!e.target || !(e.target instanceof Element)) {
return;
}
const initialPointerPosition = this._sliderPointerPosition(e);
const initialPointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(e);
const initialScrollbarState = this._scrollbarState.clone();
this.slider.toggleClassName("active", true);
this._pointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => {
const pointerOrthogonalPosition = this._sliderOrthogonalPointerPosition(pointerMoveData);
const pointerOrthogonalDelta = Math.abs(pointerOrthogonalPosition - initialPointerOrthogonalPosition);
if (isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE) {
this._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());
return;
}
const pointerPosition = this._sliderPointerPosition(pointerMoveData);
const pointerDelta = pointerPosition - initialPointerPosition;
this._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(pointerDelta));
}, () => {
this.slider.toggleClassName("active", false);
this._host.onDragEnd();
});
this._host.onDragStart();
}
_setDesiredScrollPositionNow(_desiredScrollPosition) {
const desiredScrollPosition = {};
this.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);
this._scrollable.setScrollPositionNow(desiredScrollPosition);
}
updateScrollbarSize(scrollbarSize) {
this._updateScrollbarSize(scrollbarSize);
this._scrollbarState.setScrollbarSize(scrollbarSize);
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
isNeeded() {
return this._scrollbarState.isNeeded();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js
var MINIMUM_SLIDER_SIZE, ScrollbarState;
var init_scrollbarState = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js"() {
MINIMUM_SLIDER_SIZE = 20;
ScrollbarState = class _ScrollbarState {
constructor(arrowSize, scrollbarSize, oppositeScrollbarSize, visibleSize, scrollSize, scrollPosition) {
this._scrollbarSize = Math.round(scrollbarSize);
this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);
this._arrowSize = Math.round(arrowSize);
this._visibleSize = visibleSize;
this._scrollSize = scrollSize;
this._scrollPosition = scrollPosition;
this._computedAvailableSize = 0;
this._computedIsNeeded = false;
this._computedSliderSize = 0;
this._computedSliderRatio = 0;
this._computedSliderPosition = 0;
this._refreshComputedValues();
}
clone() {
return new _ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);
}
setVisibleSize(visibleSize) {
const iVisibleSize = Math.round(visibleSize);
if (this._visibleSize !== iVisibleSize) {
this._visibleSize = iVisibleSize;
this._refreshComputedValues();
return true;
}
return false;
}
setScrollSize(scrollSize) {
const iScrollSize = Math.round(scrollSize);
if (this._scrollSize !== iScrollSize) {
this._scrollSize = iScrollSize;
this._refreshComputedValues();
return true;
}
return false;
}
setScrollPosition(scrollPosition) {
const iScrollPosition = Math.round(scrollPosition);
if (this._scrollPosition !== iScrollPosition) {
this._scrollPosition = iScrollPosition;
this._refreshComputedValues();
return true;
}
return false;
}
setScrollbarSize(scrollbarSize) {
this._scrollbarSize = Math.round(scrollbarSize);
}
setOppositeScrollbarSize(oppositeScrollbarSize) {
this._oppositeScrollbarSize = Math.round(oppositeScrollbarSize);
}
static _computeValues(oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) {
const computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);
const computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);
const computedIsNeeded = scrollSize > 0 && scrollSize > visibleSize;
if (!computedIsNeeded) {
return {
computedAvailableSize: Math.round(computedAvailableSize),
computedIsNeeded,
computedSliderSize: Math.round(computedRepresentableSize),
computedSliderRatio: 0,
computedSliderPosition: 0
};
}
const computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));
const computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);
const computedSliderPosition = scrollPosition * computedSliderRatio;
return {
computedAvailableSize: Math.round(computedAvailableSize),
computedIsNeeded,
computedSliderSize: Math.round(computedSliderSize),
computedSliderRatio,
computedSliderPosition: Math.round(computedSliderPosition)
};
}
_refreshComputedValues() {
const r = _ScrollbarState._computeValues(this._oppositeScrollbarSize, this._arrowSize, this._visibleSize, this._scrollSize, this._scrollPosition);
this._computedAvailableSize = r.computedAvailableSize;
this._computedIsNeeded = r.computedIsNeeded;
this._computedSliderSize = r.computedSliderSize;
this._computedSliderRatio = r.computedSliderRatio;
this._computedSliderPosition = r.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;
}
/**
* Compute a desired `scrollPosition` such that `offset` ends up in the center of the slider.
* `offset` is based on the same coordinate system as the `sliderPosition`.
*/
getDesiredScrollPositionFromOffset(offset) {
if (!this._computedIsNeeded) {
return 0;
}
const desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;
return Math.round(desiredSliderPosition / this._computedSliderRatio);
}
/**
* Compute a desired `scrollPosition` from if offset is before or after the slider position.
* If offset is before slider, treat as a page up (or left). If after, page down (or right).
* `offset` and `_computedSliderPosition` are based on the same coordinate system.
* `_visibleSize` corresponds to a "page" of lines in the returned coordinate system.
*/
getDesiredScrollPositionFromOffsetPaged(offset) {
if (!this._computedIsNeeded) {
return 0;
}
const correctedOffset = offset - this._arrowSize;
let desiredScrollPosition = this._scrollPosition;
if (correctedOffset < this._computedSliderPosition) {
desiredScrollPosition -= this._visibleSize;
} else {
desiredScrollPosition += this._visibleSize;
}
return desiredScrollPosition;
}
/**
* Compute a desired `scrollPosition` such that the slider moves by `delta`.
*/
getDesiredScrollPositionFromDelta(delta) {
if (!this._computedIsNeeded) {
return 0;
}
const desiredSliderPosition = this._computedSliderPosition + delta;
return Math.round(desiredSliderPosition / this._computedSliderRatio);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js
var HorizontalScrollbar;
var init_horizontalScrollbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js"() {
init_mouseEvent();
init_abstractScrollbar();
init_scrollbarArrow();
init_scrollbarState();
init_codicons();
HorizontalScrollbar = class extends AbstractScrollbar {
constructor(scrollable, options2, host) {
const scrollDimensions = scrollable.getScrollDimensions();
const scrollPosition = scrollable.getCurrentScrollPosition();
super({
lazyRender: options2.lazyRender,
host,
scrollbarState: new ScrollbarState(options2.horizontalHasArrows ? options2.arrowSize : 0, options2.horizontal === 2 ? 0 : options2.horizontalScrollbarSize, options2.vertical === 2 ? 0 : options2.verticalScrollbarSize, scrollDimensions.width, scrollDimensions.scrollWidth, scrollPosition.scrollLeft),
visibility: options2.horizontal,
extraScrollbarClassName: "horizontal",
scrollable,
scrollByPage: options2.scrollByPage
});
if (options2.horizontalHasArrows) {
const arrowDelta = (options2.arrowSize - ARROW_IMG_SIZE) / 2;
const scrollbarDelta = (options2.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;
this._createArrow({
className: "scra",
icon: Codicon.scrollbarButtonLeft,
top: scrollbarDelta,
left: arrowDelta,
bottom: void 0,
right: void 0,
bgWidth: options2.arrowSize,
bgHeight: options2.horizontalScrollbarSize,
onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 1, 0))
});
this._createArrow({
className: "scra",
icon: Codicon.scrollbarButtonRight,
top: scrollbarDelta,
left: void 0,
bottom: void 0,
right: arrowDelta,
bgWidth: options2.arrowSize,
bgHeight: options2.horizontalScrollbarSize,
onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, -1, 0))
});
}
this._createSlider(Math.floor((options2.horizontalScrollbarSize - options2.horizontalSliderSize) / 2), 0, void 0, options2.horizontalSliderSize);
}
_updateSlider(sliderSize, sliderPosition) {
this.slider.setWidth(sliderSize);
this.slider.setLeft(sliderPosition);
}
_renderDomNode(largeSize, smallSize) {
this.domNode.setWidth(largeSize);
this.domNode.setHeight(smallSize);
this.domNode.setLeft(0);
this.domNode.setBottom(0);
}
onDidScroll(e) {
this._shouldRender = this._onElementScrollSize(e.scrollWidth) || this._shouldRender;
this._shouldRender = this._onElementScrollPosition(e.scrollLeft) || this._shouldRender;
this._shouldRender = this._onElementSize(e.width) || this._shouldRender;
return this._shouldRender;
}
_pointerDownRelativePosition(offsetX, offsetY) {
return offsetX;
}
_sliderPointerPosition(e) {
return e.pageX;
}
_sliderOrthogonalPointerPosition(e) {
return e.pageY;
}
_updateScrollbarSize(size2) {
this.slider.setHeight(size2);
}
writeScrollPosition(target, scrollPosition) {
target.scrollLeft = scrollPosition;
}
updateOptions(options2) {
this.updateScrollbarSize(options2.horizontal === 2 ? 0 : options2.horizontalScrollbarSize);
this._scrollbarState.setOppositeScrollbarSize(options2.vertical === 2 ? 0 : options2.verticalScrollbarSize);
this._visibilityController.setVisibility(options2.horizontal);
this._scrollByPage = options2.scrollByPage;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js
var VerticalScrollbar;
var init_verticalScrollbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js"() {
init_mouseEvent();
init_abstractScrollbar();
init_scrollbarArrow();
init_scrollbarState();
init_codicons();
VerticalScrollbar = class extends AbstractScrollbar {
constructor(scrollable, options2, host) {
const scrollDimensions = scrollable.getScrollDimensions();
const scrollPosition = scrollable.getCurrentScrollPosition();
super({
lazyRender: options2.lazyRender,
host,
scrollbarState: new ScrollbarState(
options2.verticalHasArrows ? options2.arrowSize : 0,
options2.vertical === 2 ? 0 : options2.verticalScrollbarSize,
// give priority to vertical scroll bar over horizontal and let it scroll all the way to the bottom
0,
scrollDimensions.height,
scrollDimensions.scrollHeight,
scrollPosition.scrollTop
),
visibility: options2.vertical,
extraScrollbarClassName: "vertical",
scrollable,
scrollByPage: options2.scrollByPage
});
if (options2.verticalHasArrows) {
const arrowDelta = (options2.arrowSize - ARROW_IMG_SIZE) / 2;
const scrollbarDelta = (options2.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;
this._createArrow({
className: "scra",
icon: Codicon.scrollbarButtonUp,
top: arrowDelta,
left: scrollbarDelta,
bottom: void 0,
right: void 0,
bgWidth: options2.verticalScrollbarSize,
bgHeight: options2.arrowSize,
onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, 1))
});
this._createArrow({
className: "scra",
icon: Codicon.scrollbarButtonDown,
top: void 0,
left: scrollbarDelta,
bottom: arrowDelta,
right: void 0,
bgWidth: options2.verticalScrollbarSize,
bgHeight: options2.arrowSize,
onActivate: () => this._host.onMouseWheel(new StandardWheelEvent(null, 0, -1))
});
}
this._createSlider(0, Math.floor((options2.verticalScrollbarSize - options2.verticalSliderSize) / 2), options2.verticalSliderSize, void 0);
}
_updateSlider(sliderSize, sliderPosition) {
this.slider.setHeight(sliderSize);
this.slider.setTop(sliderPosition);
}
_renderDomNode(largeSize, smallSize) {
this.domNode.setWidth(smallSize);
this.domNode.setHeight(largeSize);
this.domNode.setRight(0);
this.domNode.setTop(0);
}
onDidScroll(e) {
this._shouldRender = this._onElementScrollSize(e.scrollHeight) || this._shouldRender;
this._shouldRender = this._onElementScrollPosition(e.scrollTop) || this._shouldRender;
this._shouldRender = this._onElementSize(e.height) || this._shouldRender;
return this._shouldRender;
}
_pointerDownRelativePosition(offsetX, offsetY) {
return offsetY;
}
_sliderPointerPosition(e) {
return e.pageY;
}
_sliderOrthogonalPointerPosition(e) {
return e.pageX;
}
_updateScrollbarSize(size2) {
this.slider.setWidth(size2);
}
writeScrollPosition(target, scrollPosition) {
target.scrollTop = scrollPosition;
}
updateOptions(options2) {
this.updateScrollbarSize(options2.vertical === 2 ? 0 : options2.verticalScrollbarSize);
this._scrollbarState.setOppositeScrollbarSize(0);
this._visibilityController.setVisibility(options2.vertical);
this._scrollByPage = options2.scrollByPage;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/scrollable.js
function createEaseOutCubic(from, to) {
const delta = to - from;
return function(completion) {
return from + delta * easeOutCubic(completion);
};
}
function createComposed(a3, b, cut) {
return function(completion) {
if (completion < cut) {
return a3(completion / cut);
}
return b((completion - cut) / (1 - cut));
};
}
function easeInCubic(t4) {
return Math.pow(t4, 3);
}
function easeOutCubic(t4) {
return 1 - easeInCubic(1 - t4);
}
var ScrollState, Scrollable, SmoothScrollingUpdate, SmoothScrollingOperation;
var init_scrollable = __esm({
"node_modules/monaco-editor/esm/vs/base/common/scrollable.js"() {
init_event();
init_lifecycle();
ScrollState = class _ScrollState {
constructor(_forceIntegerValues, width2, scrollWidth, scrollLeft, height, scrollHeight, scrollTop) {
this._forceIntegerValues = _forceIntegerValues;
this._scrollStateBrand = void 0;
if (this._forceIntegerValues) {
width2 = width2 | 0;
scrollWidth = scrollWidth | 0;
scrollLeft = scrollLeft | 0;
height = height | 0;
scrollHeight = scrollHeight | 0;
scrollTop = scrollTop | 0;
}
this.rawScrollLeft = scrollLeft;
this.rawScrollTop = scrollTop;
if (width2 < 0) {
width2 = 0;
}
if (scrollLeft + width2 > scrollWidth) {
scrollLeft = scrollWidth - width2;
}
if (scrollLeft < 0) {
scrollLeft = 0;
}
if (height < 0) {
height = 0;
}
if (scrollTop + height > scrollHeight) {
scrollTop = scrollHeight - height;
}
if (scrollTop < 0) {
scrollTop = 0;
}
this.width = width2;
this.scrollWidth = scrollWidth;
this.scrollLeft = scrollLeft;
this.height = height;
this.scrollHeight = scrollHeight;
this.scrollTop = scrollTop;
}
equals(other) {
return this.rawScrollLeft === other.rawScrollLeft && this.rawScrollTop === other.rawScrollTop && this.width === other.width && this.scrollWidth === other.scrollWidth && this.scrollLeft === other.scrollLeft && this.height === other.height && this.scrollHeight === other.scrollHeight && this.scrollTop === other.scrollTop;
}
withScrollDimensions(update, useRawScrollPositions) {
return new _ScrollState(this._forceIntegerValues, typeof update.width !== "undefined" ? update.width : this.width, typeof update.scrollWidth !== "undefined" ? update.scrollWidth : this.scrollWidth, useRawScrollPositions ? this.rawScrollLeft : this.scrollLeft, typeof update.height !== "undefined" ? update.height : this.height, typeof update.scrollHeight !== "undefined" ? update.scrollHeight : this.scrollHeight, useRawScrollPositions ? this.rawScrollTop : this.scrollTop);
}
withScrollPosition(update) {
return new _ScrollState(this._forceIntegerValues, this.width, this.scrollWidth, typeof update.scrollLeft !== "undefined" ? update.scrollLeft : this.rawScrollLeft, this.height, this.scrollHeight, typeof update.scrollTop !== "undefined" ? update.scrollTop : this.rawScrollTop);
}
createScrollEvent(previous, inSmoothScrolling) {
const widthChanged = this.width !== previous.width;
const scrollWidthChanged = this.scrollWidth !== previous.scrollWidth;
const scrollLeftChanged = this.scrollLeft !== previous.scrollLeft;
const heightChanged = this.height !== previous.height;
const scrollHeightChanged = this.scrollHeight !== previous.scrollHeight;
const scrollTopChanged = this.scrollTop !== previous.scrollTop;
return {
inSmoothScrolling,
oldWidth: previous.width,
oldScrollWidth: previous.scrollWidth,
oldScrollLeft: previous.scrollLeft,
width: this.width,
scrollWidth: this.scrollWidth,
scrollLeft: this.scrollLeft,
oldHeight: previous.height,
oldScrollHeight: previous.scrollHeight,
oldScrollTop: previous.scrollTop,
height: this.height,
scrollHeight: this.scrollHeight,
scrollTop: this.scrollTop,
widthChanged,
scrollWidthChanged,
scrollLeftChanged,
heightChanged,
scrollHeightChanged,
scrollTopChanged
};
}
};
Scrollable = class extends Disposable {
constructor(options2) {
super();
this._scrollableBrand = void 0;
this._onScroll = this._register(new Emitter());
this.onScroll = this._onScroll.event;
this._smoothScrollDuration = options2.smoothScrollDuration;
this._scheduleAtNextAnimationFrame = options2.scheduleAtNextAnimationFrame;
this._state = new ScrollState(options2.forceIntegerValues, 0, 0, 0, 0, 0, 0);
this._smoothScrolling = null;
}
dispose() {
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
super.dispose();
}
setSmoothScrollDuration(smoothScrollDuration) {
this._smoothScrollDuration = smoothScrollDuration;
}
validateScrollPosition(scrollPosition) {
return this._state.withScrollPosition(scrollPosition);
}
getScrollDimensions() {
return this._state;
}
setScrollDimensions(dimensions, useRawScrollPositions) {
var _a10;
const newState = this._state.withScrollDimensions(dimensions, useRawScrollPositions);
this._setState(newState, Boolean(this._smoothScrolling));
(_a10 = this._smoothScrolling) === null || _a10 === void 0 ? void 0 : _a10.acceptScrollDimensions(this._state);
}
/**
* Returns the final scroll position that the instance will have once the smooth scroll animation concludes.
* If no scroll animation is occurring, it will return the current scroll position instead.
*/
getFutureScrollPosition() {
if (this._smoothScrolling) {
return this._smoothScrolling.to;
}
return this._state;
}
/**
* Returns the current scroll position.
* Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
*/
getCurrentScrollPosition() {
return this._state;
}
setScrollPositionNow(update) {
const newState = this._state.withScrollPosition(update);
if (this._smoothScrolling) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
}
this._setState(newState, false);
}
setScrollPositionSmooth(update, reuseAnimation) {
if (this._smoothScrollDuration === 0) {
return this.setScrollPositionNow(update);
}
if (this._smoothScrolling) {
update = {
scrollLeft: typeof update.scrollLeft === "undefined" ? this._smoothScrolling.to.scrollLeft : update.scrollLeft,
scrollTop: typeof update.scrollTop === "undefined" ? this._smoothScrolling.to.scrollTop : update.scrollTop
};
const validTarget = this._state.withScrollPosition(update);
if (this._smoothScrolling.to.scrollLeft === validTarget.scrollLeft && this._smoothScrolling.to.scrollTop === validTarget.scrollTop) {
return;
}
let newSmoothScrolling;
if (reuseAnimation) {
newSmoothScrolling = new SmoothScrollingOperation(this._smoothScrolling.from, validTarget, this._smoothScrolling.startTime, this._smoothScrolling.duration);
} else {
newSmoothScrolling = this._smoothScrolling.combine(this._state, validTarget, this._smoothScrollDuration);
}
this._smoothScrolling.dispose();
this._smoothScrolling = newSmoothScrolling;
} else {
const validTarget = this._state.withScrollPosition(update);
this._smoothScrolling = SmoothScrollingOperation.start(this._state, validTarget, this._smoothScrollDuration);
}
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
}
hasPendingScrollAnimation() {
return Boolean(this._smoothScrolling);
}
_performSmoothScrolling() {
if (!this._smoothScrolling) {
return;
}
const update = this._smoothScrolling.tick();
const newState = this._state.withScrollPosition(update);
this._setState(newState, true);
if (!this._smoothScrolling) {
return;
}
if (update.isDone) {
this._smoothScrolling.dispose();
this._smoothScrolling = null;
return;
}
this._smoothScrolling.animationFrameDisposable = this._scheduleAtNextAnimationFrame(() => {
if (!this._smoothScrolling) {
return;
}
this._smoothScrolling.animationFrameDisposable = null;
this._performSmoothScrolling();
});
}
_setState(newState, inSmoothScrolling) {
const oldState = this._state;
if (oldState.equals(newState)) {
return;
}
this._state = newState;
this._onScroll.fire(this._state.createScrollEvent(oldState, inSmoothScrolling));
}
};
SmoothScrollingUpdate = class {
constructor(scrollLeft, scrollTop, isDone) {
this.scrollLeft = scrollLeft;
this.scrollTop = scrollTop;
this.isDone = isDone;
}
};
SmoothScrollingOperation = class _SmoothScrollingOperation {
constructor(from, to, startTime, duration) {
this.from = from;
this.to = to;
this.duration = duration;
this.startTime = startTime;
this.animationFrameDisposable = null;
this._initAnimations();
}
_initAnimations() {
this.scrollLeft = this._initAnimation(this.from.scrollLeft, this.to.scrollLeft, this.to.width);
this.scrollTop = this._initAnimation(this.from.scrollTop, this.to.scrollTop, this.to.height);
}
_initAnimation(from, to, viewportSize) {
const delta = Math.abs(from - to);
if (delta > 2.5 * viewportSize) {
let stop1, stop2;
if (from < to) {
stop1 = from + 0.75 * viewportSize;
stop2 = to - 0.75 * viewportSize;
} else {
stop1 = from - 0.75 * viewportSize;
stop2 = to + 0.75 * viewportSize;
}
return createComposed(createEaseOutCubic(from, stop1), createEaseOutCubic(stop2, to), 0.33);
}
return createEaseOutCubic(from, to);
}
dispose() {
if (this.animationFrameDisposable !== null) {
this.animationFrameDisposable.dispose();
this.animationFrameDisposable = null;
}
}
acceptScrollDimensions(state) {
this.to = state.withScrollPosition(this.to);
this._initAnimations();
}
tick() {
return this._tick(Date.now());
}
_tick(now) {
const completion = (now - this.startTime) / this.duration;
if (completion < 1) {
const newScrollLeft = this.scrollLeft(completion);
const newScrollTop = this.scrollTop(completion);
return new SmoothScrollingUpdate(newScrollLeft, newScrollTop, false);
}
return new SmoothScrollingUpdate(this.to.scrollLeft, this.to.scrollTop, true);
}
combine(from, to, duration) {
return _SmoothScrollingOperation.start(from, to, duration);
}
static start(from, to, duration) {
duration = duration + 10;
const startTime = Date.now() - 10;
return new _SmoothScrollingOperation(from, to, startTime, duration);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css
var init_scrollbars = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js
function resolveOptions(opts) {
const result = {
lazyRender: typeof opts.lazyRender !== "undefined" ? opts.lazyRender : false,
className: typeof opts.className !== "undefined" ? opts.className : "",
useShadows: typeof opts.useShadows !== "undefined" ? opts.useShadows : true,
handleMouseWheel: typeof opts.handleMouseWheel !== "undefined" ? opts.handleMouseWheel : true,
flipAxes: typeof opts.flipAxes !== "undefined" ? opts.flipAxes : false,
consumeMouseWheelIfScrollbarIsNeeded: typeof opts.consumeMouseWheelIfScrollbarIsNeeded !== "undefined" ? opts.consumeMouseWheelIfScrollbarIsNeeded : false,
alwaysConsumeMouseWheel: typeof opts.alwaysConsumeMouseWheel !== "undefined" ? opts.alwaysConsumeMouseWheel : false,
scrollYToX: typeof opts.scrollYToX !== "undefined" ? opts.scrollYToX : false,
mouseWheelScrollSensitivity: typeof opts.mouseWheelScrollSensitivity !== "undefined" ? opts.mouseWheelScrollSensitivity : 1,
fastScrollSensitivity: typeof opts.fastScrollSensitivity !== "undefined" ? opts.fastScrollSensitivity : 5,
scrollPredominantAxis: typeof opts.scrollPredominantAxis !== "undefined" ? opts.scrollPredominantAxis : true,
mouseWheelSmoothScroll: typeof opts.mouseWheelSmoothScroll !== "undefined" ? opts.mouseWheelSmoothScroll : true,
arrowSize: typeof opts.arrowSize !== "undefined" ? opts.arrowSize : 11,
listenOnDomNode: typeof opts.listenOnDomNode !== "undefined" ? opts.listenOnDomNode : null,
horizontal: typeof opts.horizontal !== "undefined" ? opts.horizontal : 1,
horizontalScrollbarSize: typeof opts.horizontalScrollbarSize !== "undefined" ? opts.horizontalScrollbarSize : 10,
horizontalSliderSize: typeof opts.horizontalSliderSize !== "undefined" ? opts.horizontalSliderSize : 0,
horizontalHasArrows: typeof opts.horizontalHasArrows !== "undefined" ? opts.horizontalHasArrows : false,
vertical: typeof opts.vertical !== "undefined" ? opts.vertical : 1,
verticalScrollbarSize: typeof opts.verticalScrollbarSize !== "undefined" ? opts.verticalScrollbarSize : 10,
verticalHasArrows: typeof opts.verticalHasArrows !== "undefined" ? opts.verticalHasArrows : false,
verticalSliderSize: typeof opts.verticalSliderSize !== "undefined" ? opts.verticalSliderSize : 0,
scrollByPage: typeof opts.scrollByPage !== "undefined" ? opts.scrollByPage : false
};
result.horizontalSliderSize = typeof opts.horizontalSliderSize !== "undefined" ? opts.horizontalSliderSize : result.horizontalScrollbarSize;
result.verticalSliderSize = typeof opts.verticalSliderSize !== "undefined" ? opts.verticalSliderSize : result.verticalScrollbarSize;
if (isMacintosh) {
result.className += " mac";
}
return result;
}
var HIDE_TIMEOUT, SCROLL_WHEEL_SENSITIVITY, SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED, MouseWheelClassifierItem, MouseWheelClassifier, AbstractScrollableElement, ScrollableElement, SmoothScrollableElement, DomScrollableElement;
var init_scrollableElement = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js"() {
init_browser();
init_dom();
init_fastDomNode();
init_mouseEvent();
init_horizontalScrollbar();
init_verticalScrollbar();
init_widget();
init_async();
init_event();
init_lifecycle();
init_platform();
init_scrollable();
init_scrollbars();
HIDE_TIMEOUT = 500;
SCROLL_WHEEL_SENSITIVITY = 50;
SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;
MouseWheelClassifierItem = class {
constructor(timestamp, deltaX, deltaY) {
this.timestamp = timestamp;
this.deltaX = deltaX;
this.deltaY = deltaY;
this.score = 0;
}
};
MouseWheelClassifier = class {
constructor() {
this._capacity = 5;
this._memory = [];
this._front = -1;
this._rear = -1;
}
isPhysicalMouseWheel() {
if (this._front === -1 && this._rear === -1) {
return false;
}
let remainingInfluence = 1;
let score3 = 0;
let iteration = 1;
let index = this._rear;
do {
const influence = index === this._front ? remainingInfluence : Math.pow(2, -iteration);
remainingInfluence -= influence;
score3 += this._memory[index].score * influence;
if (index === this._front) {
break;
}
index = (this._capacity + index - 1) % this._capacity;
iteration++;
} while (true);
return score3 <= 0.5;
}
acceptStandardWheelEvent(e) {
if (isChrome2) {
const targetWindow = getWindow(e.browserEvent);
const pageZoomFactor = getZoomFactor(targetWindow);
this.accept(Date.now(), e.deltaX * pageZoomFactor, e.deltaY * pageZoomFactor);
} else {
this.accept(Date.now(), e.deltaX, e.deltaY);
}
}
accept(timestamp, deltaX, deltaY) {
let previousItem = null;
const item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);
if (this._front === -1 && this._rear === -1) {
this._memory[0] = item;
this._front = 0;
this._rear = 0;
} else {
previousItem = this._memory[this._rear];
this._rear = (this._rear + 1) % this._capacity;
if (this._rear === this._front) {
this._front = (this._front + 1) % this._capacity;
}
this._memory[this._rear] = item;
}
item.score = this._computeScore(item, previousItem);
}
/**
* A score between 0 and 1 for `item`.
* - a score towards 0 indicates that the source appears to be a physical mouse wheel
* - a score towards 1 indicates that the source appears to be a touchpad or magic mouse, etc.
*/
_computeScore(item, previousItem) {
if (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {
return 1;
}
let score3 = 0.5;
if (!this._isAlmostInt(item.deltaX) || !this._isAlmostInt(item.deltaY)) {
score3 += 0.25;
}
if (previousItem) {
const absDeltaX = Math.abs(item.deltaX);
const absDeltaY = Math.abs(item.deltaY);
const absPreviousDeltaX = Math.abs(previousItem.deltaX);
const absPreviousDeltaY = Math.abs(previousItem.deltaY);
const minDeltaX = Math.max(Math.min(absDeltaX, absPreviousDeltaX), 1);
const minDeltaY = Math.max(Math.min(absDeltaY, absPreviousDeltaY), 1);
const maxDeltaX = Math.max(absDeltaX, absPreviousDeltaX);
const maxDeltaY = Math.max(absDeltaY, absPreviousDeltaY);
const isSameModulo = maxDeltaX % minDeltaX === 0 && maxDeltaY % minDeltaY === 0;
if (isSameModulo) {
score3 -= 0.5;
}
}
return Math.min(Math.max(score3, 0), 1);
}
_isAlmostInt(value) {
const delta = Math.abs(Math.round(value) - value);
return delta < 0.01;
}
};
MouseWheelClassifier.INSTANCE = new MouseWheelClassifier();
AbstractScrollableElement = class extends Widget {
get options() {
return this._options;
}
constructor(element, options2, scrollable) {
super();
this._onScroll = this._register(new Emitter());
this.onScroll = this._onScroll.event;
this._onWillScroll = this._register(new Emitter());
element.style.overflow = "hidden";
this._options = resolveOptions(options2);
this._scrollable = scrollable;
this._register(this._scrollable.onScroll((e) => {
this._onWillScroll.fire(e);
this._onDidScroll(e);
this._onScroll.fire(e);
}));
const scrollbarHost = {
onMouseWheel: (mouseWheelEvent) => this._onMouseWheel(mouseWheelEvent),
onDragStart: () => this._onDragStart(),
onDragEnd: () => this._onDragEnd()
};
this._verticalScrollbar = this._register(new VerticalScrollbar(this._scrollable, this._options, scrollbarHost));
this._horizontalScrollbar = this._register(new HorizontalScrollbar(this._scrollable, this._options, scrollbarHost));
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(element);
this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode);
this._domNode.appendChild(this._verticalScrollbar.domNode.domNode);
if (this._options.useShadows) {
this._leftShadowDomNode = createFastDomNode(document.createElement("div"));
this._leftShadowDomNode.setClassName("shadow");
this._domNode.appendChild(this._leftShadowDomNode.domNode);
this._topShadowDomNode = createFastDomNode(document.createElement("div"));
this._topShadowDomNode.setClassName("shadow");
this._domNode.appendChild(this._topShadowDomNode.domNode);
this._topLeftShadowDomNode = createFastDomNode(document.createElement("div"));
this._topLeftShadowDomNode.setClassName("shadow");
this._domNode.appendChild(this._topLeftShadowDomNode.domNode);
} else {
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, (e) => this._onMouseOver(e));
this.onmouseleave(this._listenOnDomNode, (e) => this._onMouseLeave(e));
this._hideTimeout = this._register(new TimeoutTimer());
this._isDragging = false;
this._mouseIsOver = false;
this._shouldRender = true;
this._revealOnScroll = true;
}
dispose() {
this._mouseWheelToDispose = dispose(this._mouseWheelToDispose);
super.dispose();
}
/**
* Get the generated 'scrollable' dom node
*/
getDomNode() {
return this._domNode;
}
getOverviewRulerLayoutInfo() {
return {
parent: this._domNode,
insertBefore: this._verticalScrollbar.domNode.domNode
};
}
/**
* Delegate a pointer down event to the vertical scrollbar.
* This is to help with clicking somewhere else and having the scrollbar react.
*/
delegateVerticalScrollbarPointerDown(browserEvent) {
this._verticalScrollbar.delegatePointerDown(browserEvent);
}
getScrollDimensions() {
return this._scrollable.getScrollDimensions();
}
setScrollDimensions(dimensions) {
this._scrollable.setScrollDimensions(dimensions, false);
}
/**
* Update the class name of the scrollable element.
*/
updateClassName(newClassName) {
this._options.className = newClassName;
if (isMacintosh) {
this._options.className += " mac";
}
this._domNode.className = "monaco-scrollable-element " + this._options.className;
}
/**
* Update configuration options for the scrollbar.
*/
updateOptions(newOptions) {
if (typeof newOptions.handleMouseWheel !== "undefined") {
this._options.handleMouseWheel = newOptions.handleMouseWheel;
this._setListeningToMouseWheel(this._options.handleMouseWheel);
}
if (typeof newOptions.mouseWheelScrollSensitivity !== "undefined") {
this._options.mouseWheelScrollSensitivity = newOptions.mouseWheelScrollSensitivity;
}
if (typeof newOptions.fastScrollSensitivity !== "undefined") {
this._options.fastScrollSensitivity = newOptions.fastScrollSensitivity;
}
if (typeof newOptions.scrollPredominantAxis !== "undefined") {
this._options.scrollPredominantAxis = newOptions.scrollPredominantAxis;
}
if (typeof newOptions.horizontal !== "undefined") {
this._options.horizontal = newOptions.horizontal;
}
if (typeof newOptions.vertical !== "undefined") {
this._options.vertical = newOptions.vertical;
}
if (typeof newOptions.horizontalScrollbarSize !== "undefined") {
this._options.horizontalScrollbarSize = newOptions.horizontalScrollbarSize;
}
if (typeof newOptions.verticalScrollbarSize !== "undefined") {
this._options.verticalScrollbarSize = newOptions.verticalScrollbarSize;
}
if (typeof newOptions.scrollByPage !== "undefined") {
this._options.scrollByPage = newOptions.scrollByPage;
}
this._horizontalScrollbar.updateOptions(this._options);
this._verticalScrollbar.updateOptions(this._options);
if (!this._options.lazyRender) {
this._render();
}
}
delegateScrollFromMouseWheelEvent(browserEvent) {
this._onMouseWheel(new StandardWheelEvent(browserEvent));
}
// -------------------- mouse wheel scrolling --------------------
_setListeningToMouseWheel(shouldListen) {
const isListening = this._mouseWheelToDispose.length > 0;
if (isListening === shouldListen) {
return;
}
this._mouseWheelToDispose = dispose(this._mouseWheelToDispose);
if (shouldListen) {
const onMouseWheel = (browserEvent) => {
this._onMouseWheel(new StandardWheelEvent(browserEvent));
};
this._mouseWheelToDispose.push(addDisposableListener(this._listenOnDomNode, EventType.MOUSE_WHEEL, onMouseWheel, { passive: false }));
}
}
_onMouseWheel(e) {
var _a10;
if ((_a10 = e.browserEvent) === null || _a10 === void 0 ? void 0 : _a10.defaultPrevented) {
return;
}
const classifier = MouseWheelClassifier.INSTANCE;
if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {
classifier.acceptStandardWheelEvent(e);
}
let didScroll = false;
if (e.deltaY || e.deltaX) {
let deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;
let deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;
if (this._options.scrollPredominantAxis) {
if (this._options.scrollYToX && deltaX + deltaY === 0) {
deltaX = deltaY = 0;
} else if (Math.abs(deltaY) >= Math.abs(deltaX)) {
deltaX = 0;
} else {
deltaY = 0;
}
}
if (this._options.flipAxes) {
[deltaY, deltaX] = [deltaX, deltaY];
}
const shiftConvert = !isMacintosh && e.browserEvent && e.browserEvent.shiftKey;
if ((this._options.scrollYToX || shiftConvert) && !deltaX) {
deltaX = deltaY;
deltaY = 0;
}
if (e.browserEvent && e.browserEvent.altKey) {
deltaX = deltaX * this._options.fastScrollSensitivity;
deltaY = deltaY * this._options.fastScrollSensitivity;
}
const futureScrollPosition = this._scrollable.getFutureScrollPosition();
let desiredScrollPosition = {};
if (deltaY) {
const deltaScrollTop = SCROLL_WHEEL_SENSITIVITY * deltaY;
const desiredScrollTop = futureScrollPosition.scrollTop - (deltaScrollTop < 0 ? Math.floor(deltaScrollTop) : Math.ceil(deltaScrollTop));
this._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);
}
if (deltaX) {
const deltaScrollLeft = SCROLL_WHEEL_SENSITIVITY * deltaX;
const desiredScrollLeft = futureScrollPosition.scrollLeft - (deltaScrollLeft < 0 ? Math.floor(deltaScrollLeft) : Math.ceil(deltaScrollLeft));
this._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);
}
desiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);
if (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {
const canPerformSmoothScroll = SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED && this._options.mouseWheelSmoothScroll && classifier.isPhysicalMouseWheel();
if (canPerformSmoothScroll) {
this._scrollable.setScrollPositionSmooth(desiredScrollPosition);
} else {
this._scrollable.setScrollPositionNow(desiredScrollPosition);
}
didScroll = true;
}
}
let consumeMouseWheel = didScroll;
if (!consumeMouseWheel && this._options.alwaysConsumeMouseWheel) {
consumeMouseWheel = true;
}
if (!consumeMouseWheel && this._options.consumeMouseWheelIfScrollbarIsNeeded && (this._verticalScrollbar.isNeeded() || this._horizontalScrollbar.isNeeded())) {
consumeMouseWheel = true;
}
if (consumeMouseWheel) {
e.preventDefault();
e.stopPropagation();
}
}
_onDidScroll(e) {
this._shouldRender = this._horizontalScrollbar.onDidScroll(e) || this._shouldRender;
this._shouldRender = this._verticalScrollbar.onDidScroll(e) || this._shouldRender;
if (this._options.useShadows) {
this._shouldRender = true;
}
if (this._revealOnScroll) {
this._reveal();
}
if (!this._options.lazyRender) {
this._render();
}
}
/**
* Render / mutate the DOM now.
* Should be used together with the ctor option `lazyRender`.
*/
renderNow() {
if (!this._options.lazyRender) {
throw new Error("Please use `lazyRender` together with `renderNow`!");
}
this._render();
}
_render() {
if (!this._shouldRender) {
return;
}
this._shouldRender = false;
this._horizontalScrollbar.render();
this._verticalScrollbar.render();
if (this._options.useShadows) {
const scrollState = this._scrollable.getCurrentScrollPosition();
const enableTop = scrollState.scrollTop > 0;
const enableLeft = scrollState.scrollLeft > 0;
const leftClassName = enableLeft ? " left" : "";
const topClassName = enableTop ? " top" : "";
const topLeftClassName = enableLeft || enableTop ? " top-left-corner" : "";
this._leftShadowDomNode.setClassName(`shadow${leftClassName}`);
this._topShadowDomNode.setClassName(`shadow${topClassName}`);
this._topLeftShadowDomNode.setClassName(`shadow${topLeftClassName}${topClassName}${leftClassName}`);
}
}
// -------------------- fade in / fade out --------------------
_onDragStart() {
this._isDragging = true;
this._reveal();
}
_onDragEnd() {
this._isDragging = false;
this._hide();
}
_onMouseLeave(e) {
this._mouseIsOver = false;
this._hide();
}
_onMouseOver(e) {
this._mouseIsOver = true;
this._reveal();
}
_reveal() {
this._verticalScrollbar.beginReveal();
this._horizontalScrollbar.beginReveal();
this._scheduleHide();
}
_hide() {
if (!this._mouseIsOver && !this._isDragging) {
this._verticalScrollbar.beginHide();
this._horizontalScrollbar.beginHide();
}
}
_scheduleHide() {
if (!this._mouseIsOver && !this._isDragging) {
this._hideTimeout.cancelAndSet(() => this._hide(), HIDE_TIMEOUT);
}
}
};
ScrollableElement = class extends AbstractScrollableElement {
constructor(element, options2) {
options2 = options2 || {};
options2.mouseWheelSmoothScroll = false;
const scrollable = new Scrollable({
forceIntegerValues: true,
smoothScrollDuration: 0,
scheduleAtNextAnimationFrame: (callback) => scheduleAtNextAnimationFrame(getWindow(element), callback)
});
super(element, options2, scrollable);
this._register(scrollable);
}
setScrollPosition(update) {
this._scrollable.setScrollPositionNow(update);
}
};
SmoothScrollableElement = class extends AbstractScrollableElement {
constructor(element, options2, scrollable) {
super(element, options2, scrollable);
}
setScrollPosition(update) {
if (update.reuseAnimation) {
this._scrollable.setScrollPositionSmooth(update, update.reuseAnimation);
} else {
this._scrollable.setScrollPositionNow(update);
}
}
getScrollPosition() {
return this._scrollable.getCurrentScrollPosition();
}
};
DomScrollableElement = class extends AbstractScrollableElement {
constructor(element, options2) {
options2 = options2 || {};
options2.mouseWheelSmoothScroll = false;
const scrollable = new Scrollable({
forceIntegerValues: false,
// See https://github.com/microsoft/vscode/issues/139877
smoothScrollDuration: 0,
scheduleAtNextAnimationFrame: (callback) => scheduleAtNextAnimationFrame(getWindow(element), callback)
});
super(element, options2, scrollable);
this._register(scrollable);
this._element = element;
this._register(this.onScroll((e) => {
if (e.scrollTopChanged) {
this._element.scrollTop = e.scrollTop;
}
if (e.scrollLeftChanged) {
this._element.scrollLeft = e.scrollLeft;
}
}));
this.scanDomNode();
}
setScrollPosition(update) {
this._scrollable.setScrollPositionNow(update);
}
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
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseHandler.js
var MouseHandler, MouseDownOperation, TopBottomDragScrolling, TopBottomDragScrollingOperation, MouseDownState;
var init_mouseHandler = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseHandler.js"() {
init_dom();
init_mouseEvent();
init_lifecycle();
init_platform();
init_mouseTarget();
init_editorDom();
init_editorZoom();
init_position();
init_selection();
init_viewEventHandler();
init_scrollableElement();
MouseHandler = class extends ViewEventHandler {
constructor(context, viewController, viewHelper) {
super();
this._mouseLeaveMonitor = null;
this._context = context;
this.viewController = viewController;
this.viewHelper = viewHelper;
this.mouseTargetFactory = new MouseTargetFactory(this._context, viewHelper);
this._mouseDownOperation = this._register(new MouseDownOperation(this._context, this.viewController, this.viewHelper, this.mouseTargetFactory, (e, testEventTarget) => this._createMouseTarget(e, testEventTarget), (e) => this._getMouseColumn(e)));
this.lastMouseLeaveTime = -1;
this._height = this._context.configuration.options.get(
145
/* EditorOption.layoutInfo */
).height;
const mouseEvents = new EditorMouseEventFactory(this.viewHelper.viewDomNode);
this._register(mouseEvents.onContextMenu(this.viewHelper.viewDomNode, (e) => this._onContextMenu(e, true)));
this._register(mouseEvents.onMouseMove(this.viewHelper.viewDomNode, (e) => {
this._onMouseMove(e);
if (!this._mouseLeaveMonitor) {
this._mouseLeaveMonitor = addDisposableListener(this.viewHelper.viewDomNode.ownerDocument, "mousemove", (e2) => {
if (!this.viewHelper.viewDomNode.contains(e2.target)) {
this._onMouseLeave(new EditorMouseEvent(e2, false, this.viewHelper.viewDomNode));
}
});
}
}));
this._register(mouseEvents.onMouseUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));
this._register(mouseEvents.onMouseLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));
let capturePointerId = 0;
this._register(mouseEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => {
capturePointerId = pointerId;
}));
this._register(addDisposableListener(this.viewHelper.viewDomNode, EventType.POINTER_UP, (e) => {
this._mouseDownOperation.onPointerUp();
}));
this._register(mouseEvents.onMouseDown(this.viewHelper.viewDomNode, (e) => this._onMouseDown(e, capturePointerId)));
this._setupMouseWheelZoomListener();
this._context.addEventHandler(this);
}
_setupMouseWheelZoomListener() {
const classifier = MouseWheelClassifier.INSTANCE;
let prevMouseWheelTime = 0;
let gestureStartZoomLevel = EditorZoom.getZoomLevel();
let gestureHasZoomModifiers = false;
let gestureAccumulatedDelta = 0;
const onMouseWheel = (browserEvent) => {
this.viewController.emitMouseWheel(browserEvent);
if (!this._context.configuration.options.get(
76
/* EditorOption.mouseWheelZoom */
)) {
return;
}
const e = new StandardWheelEvent(browserEvent);
classifier.acceptStandardWheelEvent(e);
if (classifier.isPhysicalMouseWheel()) {
if (hasMouseWheelZoomModifiers(browserEvent)) {
const zoomLevel = EditorZoom.getZoomLevel();
const delta = e.deltaY > 0 ? 1 : -1;
EditorZoom.setZoomLevel(zoomLevel + delta);
e.preventDefault();
e.stopPropagation();
}
} else {
if (Date.now() - prevMouseWheelTime > 50) {
gestureStartZoomLevel = EditorZoom.getZoomLevel();
gestureHasZoomModifiers = hasMouseWheelZoomModifiers(browserEvent);
gestureAccumulatedDelta = 0;
}
prevMouseWheelTime = Date.now();
gestureAccumulatedDelta += e.deltaY;
if (gestureHasZoomModifiers) {
EditorZoom.setZoomLevel(gestureStartZoomLevel + gestureAccumulatedDelta / 5);
e.preventDefault();
e.stopPropagation();
}
}
};
this._register(addDisposableListener(this.viewHelper.viewDomNode, EventType.MOUSE_WHEEL, onMouseWheel, { capture: true, passive: false }));
function hasMouseWheelZoomModifiers(browserEvent) {
return isMacintosh ? (browserEvent.metaKey || browserEvent.ctrlKey) && !browserEvent.shiftKey && !browserEvent.altKey : browserEvent.ctrlKey && !browserEvent.metaKey && !browserEvent.shiftKey && !browserEvent.altKey;
}
}
dispose() {
this._context.removeEventHandler(this);
if (this._mouseLeaveMonitor) {
this._mouseLeaveMonitor.dispose();
this._mouseLeaveMonitor = null;
}
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
const height = this._context.configuration.options.get(
145
/* EditorOption.layoutInfo */
).height;
if (this._height !== height) {
this._height = height;
this._mouseDownOperation.onHeightChanged();
}
}
return false;
}
onCursorStateChanged(e) {
this._mouseDownOperation.onCursorStateChanged(e);
return false;
}
onFocusChanged(e) {
return false;
}
// --- end event handlers
getTargetAtClientPoint(clientX, clientY) {
const clientPos = new ClientCoordinates(clientX, clientY);
const pos = clientPos.toPageCoordinates(getWindow(this.viewHelper.viewDomNode));
const editorPos = createEditorPagePosition(this.viewHelper.viewDomNode);
if (pos.y < editorPos.y || pos.y > editorPos.y + editorPos.height || pos.x < editorPos.x || pos.x > editorPos.x + editorPos.width) {
return null;
}
const relativePos = createCoordinatesRelativeToEditor(this.viewHelper.viewDomNode, editorPos, pos);
return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);
}
_createMouseTarget(e, testEventTarget) {
let target = e.target;
if (!this.viewHelper.viewDomNode.contains(target)) {
const shadowRoot = getShadowRoot(this.viewHelper.viewDomNode);
if (shadowRoot) {
target = shadowRoot.elementsFromPoint(e.posx, e.posy).find((el) => this.viewHelper.viewDomNode.contains(el));
}
}
return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, e.relativePos, testEventTarget ? target : null);
}
_getMouseColumn(e) {
return this.mouseTargetFactory.getMouseColumn(e.relativePos);
}
_onContextMenu(e, testEventTarget) {
this.viewController.emitContextMenu({
event: e,
target: this._createMouseTarget(e, testEventTarget)
});
}
_onMouseMove(e) {
const targetIsWidget = this.mouseTargetFactory.mouseTargetIsWidget(e);
if (!targetIsWidget) {
e.preventDefault();
}
if (this._mouseDownOperation.isActive()) {
return;
}
const actualMouseMoveTime = e.timestamp;
if (actualMouseMoveTime < this.lastMouseLeaveTime) {
return;
}
this.viewController.emitMouseMove({
event: e,
target: this._createMouseTarget(e, true)
});
}
_onMouseLeave(e) {
if (this._mouseLeaveMonitor) {
this._mouseLeaveMonitor.dispose();
this._mouseLeaveMonitor = null;
}
this.lastMouseLeaveTime = (/* @__PURE__ */ new Date()).getTime();
this.viewController.emitMouseLeave({
event: e,
target: null
});
}
_onMouseUp(e) {
this.viewController.emitMouseUp({
event: e,
target: this._createMouseTarget(e, true)
});
}
_onMouseDown(e, pointerId) {
const t4 = this._createMouseTarget(e, true);
const targetIsContent = t4.type === 6 || t4.type === 7;
const targetIsGutter = t4.type === 2 || t4.type === 3 || t4.type === 4;
const targetIsLineNumbers = t4.type === 3;
const selectOnLineNumbers = this._context.configuration.options.get(
109
/* EditorOption.selectOnLineNumbers */
);
const targetIsViewZone = t4.type === 8 || t4.type === 5;
const targetIsWidget = t4.type === 9;
let shouldHandle = e.leftButton || e.middleButton;
if (isMacintosh && e.leftButton && e.ctrlKey) {
shouldHandle = false;
}
const focus = () => {
e.preventDefault();
this.viewHelper.focusTextArea();
};
if (shouldHandle && (targetIsContent || targetIsLineNumbers && selectOnLineNumbers)) {
focus();
this._mouseDownOperation.start(t4.type, e, pointerId);
} else if (targetIsGutter) {
e.preventDefault();
} else if (targetIsViewZone) {
const viewZoneData = t4.detail;
if (shouldHandle && this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {
focus();
this._mouseDownOperation.start(t4.type, e, pointerId);
e.preventDefault();
}
} else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t4.detail)) {
focus();
e.preventDefault();
}
this.viewController.emitMouseDown({
event: e,
target: t4
});
}
};
MouseDownOperation = class extends Disposable {
constructor(_context, _viewController, _viewHelper, _mouseTargetFactory, createMouseTarget, getMouseColumn) {
super();
this._context = _context;
this._viewController = _viewController;
this._viewHelper = _viewHelper;
this._mouseTargetFactory = _mouseTargetFactory;
this._createMouseTarget = createMouseTarget;
this._getMouseColumn = getMouseColumn;
this._mouseMoveMonitor = this._register(new GlobalEditorPointerMoveMonitor(this._viewHelper.viewDomNode));
this._topBottomDragScrolling = this._register(new TopBottomDragScrolling(this._context, this._viewHelper, this._mouseTargetFactory, (position, inSelectionMode, revealType) => this._dispatchMouse(position, inSelectionMode, revealType)));
this._mouseState = new MouseDownState();
this._currentSelection = new Selection(1, 1, 1, 1);
this._isActive = false;
this._lastMouseEvent = null;
}
dispose() {
super.dispose();
}
isActive() {
return this._isActive;
}
_onMouseDownThenMove(e) {
this._lastMouseEvent = e;
this._mouseState.setModifiers(e);
const position = this._findMousePosition(e, false);
if (!position) {
return;
}
if (this._mouseState.isDragAndDrop) {
this._viewController.emitMouseDrag({
event: e,
target: position
});
} else {
if (position.type === 13 && (position.outsidePosition === "above" || position.outsidePosition === "below")) {
this._topBottomDragScrolling.start(position, e);
} else {
this._topBottomDragScrolling.stop();
this._dispatchMouse(
position,
true,
1
/* NavigationCommandRevealType.Minimal */
);
}
}
}
start(targetType, e, pointerId) {
this._lastMouseEvent = e;
this._mouseState.setStartedOnLineNumbers(
targetType === 3
/* MouseTargetType.GUTTER_LINE_NUMBERS */
);
this._mouseState.setStartButtons(e);
this._mouseState.setModifiers(e);
const position = this._findMousePosition(e, true);
if (!position || !position.position) {
return;
}
this._mouseState.trySetCount(e.detail, position.position);
e.detail = this._mouseState.count;
const options2 = this._context.configuration.options;
if (!options2.get(
91
/* EditorOption.readOnly */
) && options2.get(
35
/* EditorOption.dragAndDrop */
) && !options2.get(
22
/* EditorOption.columnSelection */
) && !this._mouseState.altKey && e.detail < 2 && !this._isActive && !this._currentSelection.isEmpty() && position.type === 6 && position.position && this._currentSelection.containsPosition(position.position)) {
this._mouseState.isDragAndDrop = true;
this._isActive = true;
this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode, pointerId, e.buttons, (e2) => this._onMouseDownThenMove(e2), (browserEvent) => {
const position2 = this._findMousePosition(this._lastMouseEvent, false);
if (isKeyboardEvent(browserEvent)) {
this._viewController.emitMouseDropCanceled();
} else {
this._viewController.emitMouseDrop({
event: this._lastMouseEvent,
target: position2 ? this._createMouseTarget(this._lastMouseEvent, true) : null
// Ignoring because position is unknown, e.g., Content View Zone
});
}
this._stop();
});
return;
}
this._mouseState.isDragAndDrop = false;
this._dispatchMouse(
position,
e.shiftKey,
1
/* NavigationCommandRevealType.Minimal */
);
if (!this._isActive) {
this._isActive = true;
this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode, pointerId, e.buttons, (e2) => this._onMouseDownThenMove(e2), () => this._stop());
}
}
_stop() {
this._isActive = false;
this._topBottomDragScrolling.stop();
}
onHeightChanged() {
this._mouseMoveMonitor.stopMonitoring();
}
onPointerUp() {
this._mouseMoveMonitor.stopMonitoring();
}
onCursorStateChanged(e) {
this._currentSelection = e.selections[0];
}
_getPositionOutsideEditor(e) {
const editorContent = e.editorPos;
const model = this._context.viewModel;
const viewLayout = this._context.viewLayout;
const mouseColumn = this._getMouseColumn(e);
if (e.posy < editorContent.y) {
const outsideDistance = editorContent.y - e.posy;
const verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - outsideDistance, 0);
const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);
if (viewZoneData) {
const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);
if (newPosition) {
return MouseTarget.createOutsideEditor(mouseColumn, newPosition, "above", outsideDistance);
}
}
const aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);
return MouseTarget.createOutsideEditor(mouseColumn, new Position(aboveLineNumber, 1), "above", outsideDistance);
}
if (e.posy > editorContent.y + editorContent.height) {
const outsideDistance = e.posy - editorContent.y - editorContent.height;
const verticalOffset = viewLayout.getCurrentScrollTop() + e.relativePos.y;
const viewZoneData = HitTestContext.getZoneAtCoord(this._context, verticalOffset);
if (viewZoneData) {
const newPosition = this._helpPositionJumpOverViewZone(viewZoneData);
if (newPosition) {
return MouseTarget.createOutsideEditor(mouseColumn, newPosition, "below", outsideDistance);
}
}
const belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);
return MouseTarget.createOutsideEditor(mouseColumn, new Position(belowLineNumber, model.getLineMaxColumn(belowLineNumber)), "below", outsideDistance);
}
const possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + e.relativePos.y);
if (e.posx < editorContent.x) {
const outsideDistance = editorContent.x - e.posx;
return MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, 1), "left", outsideDistance);
}
if (e.posx > editorContent.x + editorContent.width) {
const outsideDistance = e.posx - editorContent.x - editorContent.width;
return MouseTarget.createOutsideEditor(mouseColumn, new Position(possibleLineNumber, model.getLineMaxColumn(possibleLineNumber)), "right", outsideDistance);
}
return null;
}
_findMousePosition(e, testEventTarget) {
const positionOutsideEditor = this._getPositionOutsideEditor(e);
if (positionOutsideEditor) {
return positionOutsideEditor;
}
const t4 = this._createMouseTarget(e, testEventTarget);
const hintedPosition = t4.position;
if (!hintedPosition) {
return null;
}
if (t4.type === 8 || t4.type === 5) {
const newPosition = this._helpPositionJumpOverViewZone(t4.detail);
if (newPosition) {
return MouseTarget.createViewZone(t4.type, t4.element, t4.mouseColumn, newPosition, t4.detail);
}
}
return t4;
}
_helpPositionJumpOverViewZone(viewZoneData) {
const selectionStart = new Position(this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);
const positionBefore = viewZoneData.positionBefore;
const positionAfter = viewZoneData.positionAfter;
if (positionBefore && positionAfter) {
if (positionBefore.isBefore(selectionStart)) {
return positionBefore;
} else {
return positionAfter;
}
}
return null;
}
_dispatchMouse(position, inSelectionMode, revealType) {
if (!position.position) {
return;
}
this._viewController.dispatchMouse({
position: position.position,
mouseColumn: position.mouseColumn,
startedOnLineNumbers: this._mouseState.startedOnLineNumbers,
revealType,
inSelectionMode,
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: position.type === 6 && position.detail.injectedText !== null
});
}
};
TopBottomDragScrolling = class extends Disposable {
constructor(_context, _viewHelper, _mouseTargetFactory, _dispatchMouse) {
super();
this._context = _context;
this._viewHelper = _viewHelper;
this._mouseTargetFactory = _mouseTargetFactory;
this._dispatchMouse = _dispatchMouse;
this._operation = null;
}
dispose() {
super.dispose();
this.stop();
}
start(position, mouseEvent) {
if (this._operation) {
this._operation.setPosition(position, mouseEvent);
} else {
this._operation = new TopBottomDragScrollingOperation(this._context, this._viewHelper, this._mouseTargetFactory, this._dispatchMouse, position, mouseEvent);
}
}
stop() {
if (this._operation) {
this._operation.dispose();
this._operation = null;
}
}
};
TopBottomDragScrollingOperation = class extends Disposable {
constructor(_context, _viewHelper, _mouseTargetFactory, _dispatchMouse, position, mouseEvent) {
super();
this._context = _context;
this._viewHelper = _viewHelper;
this._mouseTargetFactory = _mouseTargetFactory;
this._dispatchMouse = _dispatchMouse;
this._position = position;
this._mouseEvent = mouseEvent;
this._lastTime = Date.now();
this._animationFrameDisposable = scheduleAtNextAnimationFrame(getWindow(mouseEvent.browserEvent), () => this._execute());
}
dispose() {
this._animationFrameDisposable.dispose();
super.dispose();
}
setPosition(position, mouseEvent) {
this._position = position;
this._mouseEvent = mouseEvent;
}
/**
* update internal state and return elapsed ms since last time
*/
_tick() {
const now = Date.now();
const elapsed = now - this._lastTime;
this._lastTime = now;
return elapsed;
}
/**
* get the number of lines per second to auto-scroll
*/
_getScrollSpeed() {
const lineHeight = this._context.configuration.options.get(
67
/* EditorOption.lineHeight */
);
const viewportInLines = this._context.configuration.options.get(
145
/* EditorOption.layoutInfo */
).height / lineHeight;
const outsideDistanceInLines = this._position.outsideDistance / lineHeight;
if (outsideDistanceInLines <= 1.5) {
return Math.max(30, viewportInLines * (1 + outsideDistanceInLines));
}
if (outsideDistanceInLines <= 3) {
return Math.max(60, viewportInLines * (2 + outsideDistanceInLines));
}
return Math.max(200, viewportInLines * (7 + outsideDistanceInLines));
}
_execute() {
const lineHeight = this._context.configuration.options.get(
67
/* EditorOption.lineHeight */
);
const scrollSpeedInLines = this._getScrollSpeed();
const elapsed = this._tick();
const scrollInPixels = scrollSpeedInLines * (elapsed / 1e3) * lineHeight;
const scrollValue = this._position.outsidePosition === "above" ? -scrollInPixels : scrollInPixels;
this._context.viewModel.viewLayout.deltaScrollNow(0, scrollValue);
this._viewHelper.renderNow();
const viewportData = this._context.viewLayout.getLinesViewportData();
const edgeLineNumber = this._position.outsidePosition === "above" ? viewportData.startLineNumber : viewportData.endLineNumber;
let mouseTarget;
{
const editorPos = createEditorPagePosition(this._viewHelper.viewDomNode);
const horizontalScrollbarHeight = this._context.configuration.options.get(
145
/* EditorOption.layoutInfo */
).horizontalScrollbarHeight;
const pos = new PageCoordinates(this._mouseEvent.pos.x, editorPos.y + editorPos.height - horizontalScrollbarHeight - 0.1);
const relativePos = createCoordinatesRelativeToEditor(this._viewHelper.viewDomNode, editorPos, pos);
mouseTarget = this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(), editorPos, pos, relativePos, null);
}
if (!mouseTarget.position || mouseTarget.position.lineNumber !== edgeLineNumber) {
if (this._position.outsidePosition === "above") {
mouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, 1), "above", this._position.outsideDistance);
} else {
mouseTarget = MouseTarget.createOutsideEditor(this._position.mouseColumn, new Position(edgeLineNumber, this._context.viewModel.getLineMaxColumn(edgeLineNumber)), "below", this._position.outsideDistance);
}
}
this._dispatchMouse(
mouseTarget,
true,
2
/* NavigationCommandRevealType.None */
);
this._animationFrameDisposable = scheduleAtNextAnimationFrame(getWindow(mouseTarget.element), () => this._execute());
}
};
MouseDownState = class _MouseDownState {
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 = false;
this._ctrlKey = false;
this._metaKey = false;
this._shiftKey = false;
this._leftButton = false;
this._middleButton = false;
this._startedOnLineNumbers = false;
this._lastMouseDownPosition = null;
this._lastMouseDownPositionEqualCount = 0;
this._lastMouseDownCount = 0;
this._lastSetMouseDownCountTime = 0;
this.isDragAndDrop = false;
}
get count() {
return this._lastMouseDownCount;
}
setModifiers(source) {
this._altKey = source.altKey;
this._ctrlKey = source.ctrlKey;
this._metaKey = source.metaKey;
this._shiftKey = source.shiftKey;
}
setStartButtons(source) {
this._leftButton = source.leftButton;
this._middleButton = source.middleButton;
}
setStartedOnLineNumbers(startedOnLineNumbers) {
this._startedOnLineNumbers = startedOnLineNumbers;
}
trySetCount(setMouseDownCount, newMouseDownPosition) {
const currentTime = (/* @__PURE__ */ new Date()).getTime();
if (currentTime - this._lastSetMouseDownCountTime > _MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {
setMouseDownCount = 1;
}
this._lastSetMouseDownCountTime = currentTime;
if (setMouseDownCount > this._lastMouseDownCount + 1) {
setMouseDownCount = this._lastMouseDownCount + 1;
}
if (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {
this._lastMouseDownPositionEqualCount++;
} else {
this._lastMouseDownPositionEqualCount = 1;
}
this._lastMouseDownPosition = newMouseDownPosition;
this._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);
}
};
MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME = 400;
}
});
// node_modules/monaco-editor/esm/vs/base/browser/event.js
var DomEmitter;
var init_event2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/event.js"() {
init_event();
DomEmitter = class {
get event() {
return this.emitter.event;
}
constructor(element, type, useCapture) {
const fn = (e) => this.emitter.fire(e);
this.emitter = new Emitter({
onWillAddFirstListener: () => element.addEventListener(type, fn, useCapture),
onDidRemoveLastListener: () => element.removeEventListener(type, fn, useCapture)
});
}
dispose() {
this.emitter.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaState.js
var _debugComposition, TextAreaState, PagedScreenReaderStrategy;
var init_textAreaState = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaState.js"() {
init_strings();
init_range();
_debugComposition = false;
TextAreaState = class _TextAreaState {
constructor(value, selectionStart, selectionEnd, selection, newlineCountBeforeSelection) {
this.value = value;
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
this.selection = selection;
this.newlineCountBeforeSelection = newlineCountBeforeSelection;
}
toString() {
return `[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`;
}
static readFromTextArea(textArea, previousState) {
const value = textArea.getValue();
const selectionStart = textArea.getSelectionStart();
const selectionEnd = textArea.getSelectionEnd();
let newlineCountBeforeSelection = void 0;
if (previousState) {
const valueBeforeSelectionStart = value.substring(0, selectionStart);
const previousValueBeforeSelectionStart = previousState.value.substring(0, previousState.selectionStart);
if (valueBeforeSelectionStart === previousValueBeforeSelectionStart) {
newlineCountBeforeSelection = previousState.newlineCountBeforeSelection;
}
}
return new _TextAreaState(value, selectionStart, selectionEnd, null, newlineCountBeforeSelection);
}
collapseSelection() {
if (this.selectionStart === this.value.length) {
return this;
}
return new _TextAreaState(this.value, this.value.length, this.value.length, null, void 0);
}
writeToTextArea(reason, textArea, select) {
if (_debugComposition) {
console.log(`writeToTextArea ${reason}: ${this.toString()}`);
}
textArea.setValue(reason, this.value);
if (select) {
textArea.setSelectionRange(reason, this.selectionStart, this.selectionEnd);
}
}
deduceEditorPosition(offset) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2;
if (offset <= this.selectionStart) {
const str = this.value.substring(offset, this.selectionStart);
return this._finishDeduceEditorPosition((_b4 = (_a10 = this.selection) === null || _a10 === void 0 ? void 0 : _a10.getStartPosition()) !== null && _b4 !== void 0 ? _b4 : null, str, -1);
}
if (offset >= this.selectionEnd) {
const str = this.value.substring(this.selectionEnd, offset);
return this._finishDeduceEditorPosition((_d2 = (_c2 = this.selection) === null || _c2 === void 0 ? void 0 : _c2.getEndPosition()) !== null && _d2 !== void 0 ? _d2 : null, str, 1);
}
const str1 = this.value.substring(this.selectionStart, offset);
if (str1.indexOf(String.fromCharCode(8230)) === -1) {
return this._finishDeduceEditorPosition((_f3 = (_e2 = this.selection) === null || _e2 === void 0 ? void 0 : _e2.getStartPosition()) !== null && _f3 !== void 0 ? _f3 : null, str1, 1);
}
const str2 = this.value.substring(offset, this.selectionEnd);
return this._finishDeduceEditorPosition((_h2 = (_g2 = this.selection) === null || _g2 === void 0 ? void 0 : _g2.getEndPosition()) !== null && _h2 !== void 0 ? _h2 : null, str2, -1);
}
_finishDeduceEditorPosition(anchor, deltaText, signum) {
let lineFeedCnt = 0;
let lastLineFeedIndex = -1;
while ((lastLineFeedIndex = deltaText.indexOf("\n", lastLineFeedIndex + 1)) !== -1) {
lineFeedCnt++;
}
return [anchor, signum * deltaText.length, lineFeedCnt];
}
static deduceInput(previousState, currentState, couldBeEmojiInput) {
if (!previousState) {
return {
text: "",
replacePrevCharCnt: 0,
replaceNextCharCnt: 0,
positionDelta: 0
};
}
if (_debugComposition) {
console.log("------------------------deduceInput");
console.log(`PREVIOUS STATE: ${previousState.toString()}`);
console.log(`CURRENT STATE: ${currentState.toString()}`);
}
const prefixLength = Math.min(commonPrefixLength(previousState.value, currentState.value), previousState.selectionStart, currentState.selectionStart);
const suffixLength = Math.min(commonSuffixLength(previousState.value, currentState.value), previousState.value.length - previousState.selectionEnd, currentState.value.length - currentState.selectionEnd);
const previousValue = previousState.value.substring(prefixLength, previousState.value.length - suffixLength);
const currentValue = currentState.value.substring(prefixLength, currentState.value.length - suffixLength);
const previousSelectionStart = previousState.selectionStart - prefixLength;
const previousSelectionEnd = previousState.selectionEnd - prefixLength;
const currentSelectionStart = currentState.selectionStart - prefixLength;
const currentSelectionEnd = currentState.selectionEnd - prefixLength;
if (_debugComposition) {
console.log(`AFTER DIFFING PREVIOUS STATE: <${previousValue}>, selectionStart: ${previousSelectionStart}, selectionEnd: ${previousSelectionEnd}`);
console.log(`AFTER DIFFING CURRENT STATE: <${currentValue}>, selectionStart: ${currentSelectionStart}, selectionEnd: ${currentSelectionEnd}`);
}
if (currentSelectionStart === currentSelectionEnd) {
const replacePreviousCharacters2 = previousState.selectionStart - prefixLength;
if (_debugComposition) {
console.log(`REMOVE PREVIOUS: ${replacePreviousCharacters2} chars`);
}
return {
text: currentValue,
replacePrevCharCnt: replacePreviousCharacters2,
replaceNextCharCnt: 0,
positionDelta: 0
};
}
const replacePreviousCharacters = previousSelectionEnd - previousSelectionStart;
return {
text: currentValue,
replacePrevCharCnt: replacePreviousCharacters,
replaceNextCharCnt: 0,
positionDelta: 0
};
}
static deduceAndroidCompositionInput(previousState, currentState) {
if (!previousState) {
return {
text: "",
replacePrevCharCnt: 0,
replaceNextCharCnt: 0,
positionDelta: 0
};
}
if (_debugComposition) {
console.log("------------------------deduceAndroidCompositionInput");
console.log(`PREVIOUS STATE: ${previousState.toString()}`);
console.log(`CURRENT STATE: ${currentState.toString()}`);
}
if (previousState.value === currentState.value) {
return {
text: "",
replacePrevCharCnt: 0,
replaceNextCharCnt: 0,
positionDelta: currentState.selectionEnd - previousState.selectionEnd
};
}
const prefixLength = Math.min(commonPrefixLength(previousState.value, currentState.value), previousState.selectionEnd);
const suffixLength = Math.min(commonSuffixLength(previousState.value, currentState.value), previousState.value.length - previousState.selectionEnd);
const previousValue = previousState.value.substring(prefixLength, previousState.value.length - suffixLength);
const currentValue = currentState.value.substring(prefixLength, currentState.value.length - suffixLength);
const previousSelectionStart = previousState.selectionStart - prefixLength;
const previousSelectionEnd = previousState.selectionEnd - prefixLength;
const currentSelectionStart = currentState.selectionStart - prefixLength;
const currentSelectionEnd = currentState.selectionEnd - prefixLength;
if (_debugComposition) {
console.log(`AFTER DIFFING PREVIOUS STATE: <${previousValue}>, selectionStart: ${previousSelectionStart}, selectionEnd: ${previousSelectionEnd}`);
console.log(`AFTER DIFFING CURRENT STATE: <${currentValue}>, selectionStart: ${currentSelectionStart}, selectionEnd: ${currentSelectionEnd}`);
}
return {
text: currentValue,
replacePrevCharCnt: previousSelectionEnd,
replaceNextCharCnt: previousValue.length - previousSelectionEnd,
positionDelta: currentSelectionEnd - currentValue.length
};
}
};
TextAreaState.EMPTY = new TextAreaState("", 0, 0, null, void 0);
PagedScreenReaderStrategy = class _PagedScreenReaderStrategy {
static _getPageOfLine(lineNumber, linesPerPage) {
return Math.floor((lineNumber - 1) / linesPerPage);
}
static _getRangeForPage(page, linesPerPage) {
const offset = page * linesPerPage;
const startLineNumber = offset + 1;
const endLineNumber = offset + linesPerPage;
return new Range(startLineNumber, 1, endLineNumber + 1, 1);
}
static fromEditorSelection(model, selection, linesPerPage, trimLongText) {
const LIMIT_CHARS = 500;
const selectionStartPage = _PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber, linesPerPage);
const selectionStartPageRange = _PagedScreenReaderStrategy._getRangeForPage(selectionStartPage, linesPerPage);
const selectionEndPage = _PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber, linesPerPage);
const selectionEndPageRange = _PagedScreenReaderStrategy._getRangeForPage(selectionEndPage, linesPerPage);
let pretextRange = selectionStartPageRange.intersectRanges(new Range(1, 1, selection.startLineNumber, selection.startColumn));
if (trimLongText && model.getValueLengthInRange(
pretextRange,
1
/* EndOfLinePreference.LF */
) > LIMIT_CHARS) {
const pretextStart = model.modifyPosition(pretextRange.getEndPosition(), -LIMIT_CHARS);
pretextRange = Range.fromPositions(pretextStart, pretextRange.getEndPosition());
}
const pretext = model.getValueInRange(
pretextRange,
1
/* EndOfLinePreference.LF */
);
const lastLine = model.getLineCount();
const lastLineMaxColumn = model.getLineMaxColumn(lastLine);
let posttextRange = selectionEndPageRange.intersectRanges(new Range(selection.endLineNumber, selection.endColumn, lastLine, lastLineMaxColumn));
if (trimLongText && model.getValueLengthInRange(
posttextRange,
1
/* EndOfLinePreference.LF */
) > LIMIT_CHARS) {
const posttextEnd = model.modifyPosition(posttextRange.getStartPosition(), LIMIT_CHARS);
posttextRange = Range.fromPositions(posttextRange.getStartPosition(), posttextEnd);
}
const posttext = model.getValueInRange(
posttextRange,
1
/* EndOfLinePreference.LF */
);
let text2;
if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) {
text2 = model.getValueInRange(
selection,
1
/* EndOfLinePreference.LF */
);
} else {
const selectionRange1 = selectionStartPageRange.intersectRanges(selection);
const selectionRange2 = selectionEndPageRange.intersectRanges(selection);
text2 = model.getValueInRange(
selectionRange1,
1
/* EndOfLinePreference.LF */
) + String.fromCharCode(8230) + model.getValueInRange(
selectionRange2,
1
/* EndOfLinePreference.LF */
);
}
if (trimLongText && text2.length > 2 * LIMIT_CHARS) {
text2 = text2.substring(0, LIMIT_CHARS) + String.fromCharCode(8230) + text2.substring(text2.length - LIMIT_CHARS, text2.length);
}
return new TextAreaState(pretext + text2 + posttext, pretext.length, pretext.length + text2.length, selection, pretextRange.endLineNumber - pretextRange.startLineNumber);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaInput.js
var __decorate8, __param7, TextAreaSyntethicEvents, CopyOptions, InMemoryClipboardMetadataManager, CompositionContext, TextAreaInput, ClipboardEventUtils, TextAreaWrapper;
var init_textAreaInput = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaInput.js"() {
init_browser();
init_dom();
init_event2();
init_keyboardEvent();
init_performance();
init_async();
init_event();
init_lifecycle();
init_mime();
init_strings();
init_textAreaState();
init_selection();
init_accessibility();
init_log();
__decorate8 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param7 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
(function(TextAreaSyntethicEvents2) {
TextAreaSyntethicEvents2.Tap = "-monaco-textarea-synthetic-tap";
})(TextAreaSyntethicEvents || (TextAreaSyntethicEvents = {}));
CopyOptions = {
forceCopyWithSyntaxHighlighting: false
};
InMemoryClipboardMetadataManager = class {
constructor() {
this._lastState = null;
}
set(lastCopiedValue, data) {
this._lastState = { lastCopiedValue, data };
}
get(pastedText) {
if (this._lastState && this._lastState.lastCopiedValue === pastedText) {
return this._lastState.data;
}
this._lastState = null;
return null;
}
};
InMemoryClipboardMetadataManager.INSTANCE = new InMemoryClipboardMetadataManager();
CompositionContext = class {
constructor() {
this._lastTypeTextLength = 0;
}
handleCompositionUpdate(text2) {
text2 = text2 || "";
const typeInput = {
text: text2,
replacePrevCharCnt: this._lastTypeTextLength,
replaceNextCharCnt: 0,
positionDelta: 0
};
this._lastTypeTextLength = text2.length;
return typeInput;
}
};
TextAreaInput = class TextAreaInput2 extends Disposable {
get textAreaState() {
return this._textAreaState;
}
constructor(_host, _textArea, _OS, _browser, _accessibilityService, _logService) {
super();
this._host = _host;
this._textArea = _textArea;
this._OS = _OS;
this._browser = _browser;
this._accessibilityService = _accessibilityService;
this._logService = _logService;
this._onFocus = this._register(new Emitter());
this.onFocus = this._onFocus.event;
this._onBlur = this._register(new Emitter());
this.onBlur = this._onBlur.event;
this._onKeyDown = this._register(new Emitter());
this.onKeyDown = this._onKeyDown.event;
this._onKeyUp = this._register(new Emitter());
this.onKeyUp = this._onKeyUp.event;
this._onCut = this._register(new Emitter());
this.onCut = this._onCut.event;
this._onPaste = this._register(new Emitter());
this.onPaste = this._onPaste.event;
this._onType = this._register(new Emitter());
this.onType = this._onType.event;
this._onCompositionStart = this._register(new Emitter());
this.onCompositionStart = this._onCompositionStart.event;
this._onCompositionUpdate = this._register(new Emitter());
this.onCompositionUpdate = this._onCompositionUpdate.event;
this._onCompositionEnd = this._register(new Emitter());
this.onCompositionEnd = this._onCompositionEnd.event;
this._onSelectionChangeRequest = this._register(new Emitter());
this.onSelectionChangeRequest = this._onSelectionChangeRequest.event;
this._asyncFocusGainWriteScreenReaderContent = this._register(new MutableDisposable());
this._asyncTriggerCut = this._register(new RunOnceScheduler(() => this._onCut.fire(), 0));
this._textAreaState = TextAreaState.EMPTY;
this._selectionChangeListener = null;
if (this._accessibilityService.isScreenReaderOptimized()) {
this.writeNativeTextAreaContent("ctor");
}
this._register(Event.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized, () => {
if (this._accessibilityService.isScreenReaderOptimized() && !this._asyncFocusGainWriteScreenReaderContent.value) {
this._asyncFocusGainWriteScreenReaderContent.value = this._register(new RunOnceScheduler(() => this.writeNativeTextAreaContent("asyncFocusGain"), 0));
} else {
this._asyncFocusGainWriteScreenReaderContent.clear();
}
}));
this._hasFocus = false;
this._currentComposition = null;
let lastKeyDown = null;
this._register(this._textArea.onKeyDown((_e2) => {
const e = new StandardKeyboardEvent(_e2);
if (e.keyCode === 114 || this._currentComposition && e.keyCode === 1) {
e.stopPropagation();
}
if (e.equals(
9
/* KeyCode.Escape */
)) {
e.preventDefault();
}
lastKeyDown = e;
this._onKeyDown.fire(e);
}));
this._register(this._textArea.onKeyUp((_e2) => {
const e = new StandardKeyboardEvent(_e2);
this._onKeyUp.fire(e);
}));
this._register(this._textArea.onCompositionStart((e) => {
if (_debugComposition) {
console.log(`[compositionstart]`, e);
}
const currentComposition = new CompositionContext();
if (this._currentComposition) {
this._currentComposition = currentComposition;
return;
}
this._currentComposition = currentComposition;
if (this._OS === 2 && lastKeyDown && lastKeyDown.equals(
114
/* KeyCode.KEY_IN_COMPOSITION */
) && this._textAreaState.selectionStart === this._textAreaState.selectionEnd && this._textAreaState.selectionStart > 0 && this._textAreaState.value.substr(this._textAreaState.selectionStart - 1, 1) === e.data && (lastKeyDown.code === "ArrowRight" || lastKeyDown.code === "ArrowLeft")) {
if (_debugComposition) {
console.log(`[compositionstart] Handling long press case on macOS + arrow key`, e);
}
currentComposition.handleCompositionUpdate("x");
this._onCompositionStart.fire({ data: e.data });
return;
}
if (this._browser.isAndroid) {
this._onCompositionStart.fire({ data: e.data });
return;
}
this._onCompositionStart.fire({ data: e.data });
}));
this._register(this._textArea.onCompositionUpdate((e) => {
if (_debugComposition) {
console.log(`[compositionupdate]`, e);
}
const currentComposition = this._currentComposition;
if (!currentComposition) {
return;
}
if (this._browser.isAndroid) {
const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);
const typeInput2 = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);
this._textAreaState = newState;
this._onType.fire(typeInput2);
this._onCompositionUpdate.fire(e);
return;
}
const typeInput = currentComposition.handleCompositionUpdate(e.data);
this._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);
this._onType.fire(typeInput);
this._onCompositionUpdate.fire(e);
}));
this._register(this._textArea.onCompositionEnd((e) => {
if (_debugComposition) {
console.log(`[compositionend]`, e);
}
const currentComposition = this._currentComposition;
if (!currentComposition) {
return;
}
this._currentComposition = null;
if (this._browser.isAndroid) {
const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);
const typeInput2 = TextAreaState.deduceAndroidCompositionInput(this._textAreaState, newState);
this._textAreaState = newState;
this._onType.fire(typeInput2);
this._onCompositionEnd.fire();
return;
}
const typeInput = currentComposition.handleCompositionUpdate(e.data);
this._textAreaState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);
this._onType.fire(typeInput);
this._onCompositionEnd.fire();
}));
this._register(this._textArea.onInput((e) => {
if (_debugComposition) {
console.log(`[input]`, e);
}
this._textArea.setIgnoreSelectionChangeTime("received input event");
if (this._currentComposition) {
return;
}
const newState = TextAreaState.readFromTextArea(this._textArea, this._textAreaState);
const typeInput = TextAreaState.deduceInput(
this._textAreaState,
newState,
/*couldBeEmojiInput*/
this._OS === 2
/* OperatingSystem.Macintosh */
);
if (typeInput.replacePrevCharCnt === 0 && typeInput.text.length === 1) {
if (isHighSurrogate(typeInput.text.charCodeAt(0)) || typeInput.text.charCodeAt(0) === 127) {
return;
}
}
this._textAreaState = newState;
if (typeInput.text !== "" || typeInput.replacePrevCharCnt !== 0 || typeInput.replaceNextCharCnt !== 0 || typeInput.positionDelta !== 0) {
this._onType.fire(typeInput);
}
}));
this._register(this._textArea.onCut((e) => {
this._textArea.setIgnoreSelectionChangeTime("received cut event");
this._ensureClipboardGetsEditorSelection(e);
this._asyncTriggerCut.schedule();
}));
this._register(this._textArea.onCopy((e) => {
this._ensureClipboardGetsEditorSelection(e);
}));
this._register(this._textArea.onPaste((e) => {
this._textArea.setIgnoreSelectionChangeTime("received paste event");
e.preventDefault();
if (!e.clipboardData) {
return;
}
let [text2, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
if (!text2) {
return;
}
metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text2);
this._onPaste.fire({
text: text2,
metadata
});
}));
this._register(this._textArea.onFocus(() => {
const hadFocus = this._hasFocus;
this._setHasFocus(true);
if (this._accessibilityService.isScreenReaderOptimized() && this._browser.isSafari && !hadFocus && this._hasFocus) {
if (!this._asyncFocusGainWriteScreenReaderContent.value) {
this._asyncFocusGainWriteScreenReaderContent.value = new RunOnceScheduler(() => this.writeNativeTextAreaContent("asyncFocusGain"), 0);
}
this._asyncFocusGainWriteScreenReaderContent.value.schedule();
}
}));
this._register(this._textArea.onBlur(() => {
if (this._currentComposition) {
this._currentComposition = null;
this.writeNativeTextAreaContent("blurWithoutCompositionEnd");
this._onCompositionEnd.fire();
}
this._setHasFocus(false);
}));
this._register(this._textArea.onSyntheticTap(() => {
if (this._browser.isAndroid && this._currentComposition) {
this._currentComposition = null;
this.writeNativeTextAreaContent("tapWithoutCompositionEnd");
this._onCompositionEnd.fire();
}
}));
}
_installSelectionChangeListener() {
let previousSelectionChangeEventTime = 0;
return addDisposableListener(this._textArea.ownerDocument, "selectionchange", (e) => {
inputLatency.onSelectionChange();
if (!this._hasFocus) {
return;
}
if (this._currentComposition) {
return;
}
if (!this._browser.isChrome) {
return;
}
const now = Date.now();
const delta1 = now - previousSelectionChangeEventTime;
previousSelectionChangeEventTime = now;
if (delta1 < 5) {
return;
}
const delta2 = now - this._textArea.getIgnoreSelectionChangeTime();
this._textArea.resetSelectionChangeTime();
if (delta2 < 100) {
return;
}
if (!this._textAreaState.selection) {
return;
}
const newValue = this._textArea.getValue();
if (this._textAreaState.value !== newValue) {
return;
}
const newSelectionStart = this._textArea.getSelectionStart();
const newSelectionEnd = this._textArea.getSelectionEnd();
if (this._textAreaState.selectionStart === newSelectionStart && this._textAreaState.selectionEnd === newSelectionEnd) {
return;
}
const _newSelectionStartPosition = this._textAreaState.deduceEditorPosition(newSelectionStart);
const newSelectionStartPosition = this._host.deduceModelPosition(_newSelectionStartPosition[0], _newSelectionStartPosition[1], _newSelectionStartPosition[2]);
const _newSelectionEndPosition = this._textAreaState.deduceEditorPosition(newSelectionEnd);
const newSelectionEndPosition = this._host.deduceModelPosition(_newSelectionEndPosition[0], _newSelectionEndPosition[1], _newSelectionEndPosition[2]);
const newSelection = new Selection(newSelectionStartPosition.lineNumber, newSelectionStartPosition.column, newSelectionEndPosition.lineNumber, newSelectionEndPosition.column);
this._onSelectionChangeRequest.fire(newSelection);
});
}
dispose() {
super.dispose();
if (this._selectionChangeListener) {
this._selectionChangeListener.dispose();
this._selectionChangeListener = null;
}
}
focusTextArea() {
this._setHasFocus(true);
this.refreshFocusState();
}
isFocused() {
return this._hasFocus;
}
refreshFocusState() {
this._setHasFocus(this._textArea.hasFocus());
}
_setHasFocus(newHasFocus) {
if (this._hasFocus === newHasFocus) {
return;
}
this._hasFocus = newHasFocus;
if (this._selectionChangeListener) {
this._selectionChangeListener.dispose();
this._selectionChangeListener = null;
}
if (this._hasFocus) {
this._selectionChangeListener = this._installSelectionChangeListener();
}
if (this._hasFocus) {
this.writeNativeTextAreaContent("focusgain");
}
if (this._hasFocus) {
this._onFocus.fire();
} else {
this._onBlur.fire();
}
}
_setAndWriteTextAreaState(reason, textAreaState) {
if (!this._hasFocus) {
textAreaState = textAreaState.collapseSelection();
}
textAreaState.writeToTextArea(reason, this._textArea, this._hasFocus);
this._textAreaState = textAreaState;
}
writeNativeTextAreaContent(reason) {
if (!this._accessibilityService.isScreenReaderOptimized() && reason === "render" || this._currentComposition) {
return;
}
this._logService.trace(`writeTextAreaState(reason: ${reason})`);
this._setAndWriteTextAreaState(reason, this._host.getScreenReaderContent());
}
_ensureClipboardGetsEditorSelection(e) {
const dataToCopy = this._host.getDataToCopy();
const storedMetadata = {
version: 1,
isFromEmptySelection: dataToCopy.isFromEmptySelection,
multicursorText: dataToCopy.multicursorText,
mode: dataToCopy.mode
};
InMemoryClipboardMetadataManager.INSTANCE.set(
// When writing "LINE\r\n" to the clipboard and then pasting,
// Firefox pastes "LINE\n", so let's work around this quirk
this._browser.isFirefox ? dataToCopy.text.replace(/\r\n/g, "\n") : dataToCopy.text,
storedMetadata
);
e.preventDefault();
if (e.clipboardData) {
ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);
}
}
};
TextAreaInput = __decorate8([
__param7(4, IAccessibilityService),
__param7(5, ILogService)
], TextAreaInput);
ClipboardEventUtils = {
getTextData(clipboardData) {
const text2 = clipboardData.getData(Mimes.text);
let metadata = null;
const rawmetadata = clipboardData.getData("vscode-editor-data");
if (typeof rawmetadata === "string") {
try {
metadata = JSON.parse(rawmetadata);
if (metadata.version !== 1) {
metadata = null;
}
} catch (err) {
}
}
if (text2.length === 0 && metadata === null && clipboardData.files.length > 0) {
const files = Array.prototype.slice.call(clipboardData.files, 0);
return [files.map((file) => file.name).join("\n"), null];
}
return [text2, metadata];
},
setTextData(clipboardData, text2, html2, metadata) {
clipboardData.setData(Mimes.text, text2);
if (typeof html2 === "string") {
clipboardData.setData("text/html", html2);
}
clipboardData.setData("vscode-editor-data", JSON.stringify(metadata));
}
};
TextAreaWrapper = class extends Disposable {
get ownerDocument() {
return this._actual.ownerDocument;
}
constructor(_actual) {
super();
this._actual = _actual;
this.onKeyDown = this._register(new DomEmitter(this._actual, "keydown")).event;
this.onKeyUp = this._register(new DomEmitter(this._actual, "keyup")).event;
this.onCompositionStart = this._register(new DomEmitter(this._actual, "compositionstart")).event;
this.onCompositionUpdate = this._register(new DomEmitter(this._actual, "compositionupdate")).event;
this.onCompositionEnd = this._register(new DomEmitter(this._actual, "compositionend")).event;
this.onBeforeInput = this._register(new DomEmitter(this._actual, "beforeinput")).event;
this.onInput = this._register(new DomEmitter(this._actual, "input")).event;
this.onCut = this._register(new DomEmitter(this._actual, "cut")).event;
this.onCopy = this._register(new DomEmitter(this._actual, "copy")).event;
this.onPaste = this._register(new DomEmitter(this._actual, "paste")).event;
this.onFocus = this._register(new DomEmitter(this._actual, "focus")).event;
this.onBlur = this._register(new DomEmitter(this._actual, "blur")).event;
this._onSyntheticTap = this._register(new Emitter());
this.onSyntheticTap = this._onSyntheticTap.event;
this._ignoreSelectionChangeTime = 0;
this._register(this.onKeyDown(() => inputLatency.onKeyDown()));
this._register(this.onBeforeInput(() => inputLatency.onBeforeInput()));
this._register(this.onInput(() => inputLatency.onInput()));
this._register(this.onKeyUp(() => inputLatency.onKeyUp()));
this._register(addDisposableListener(this._actual, TextAreaSyntethicEvents.Tap, () => this._onSyntheticTap.fire()));
}
hasFocus() {
const shadowRoot = getShadowRoot(this._actual);
if (shadowRoot) {
return shadowRoot.activeElement === this._actual;
} else if (this._actual.isConnected) {
return getActiveElement() === this._actual;
} else {
return false;
}
}
setIgnoreSelectionChangeTime(reason) {
this._ignoreSelectionChangeTime = Date.now();
}
getIgnoreSelectionChangeTime() {
return this._ignoreSelectionChangeTime;
}
resetSelectionChangeTime() {
this._ignoreSelectionChangeTime = 0;
}
getValue() {
return this._actual.value;
}
setValue(reason, value) {
const textArea = this._actual;
if (textArea.value === value) {
return;
}
this.setIgnoreSelectionChangeTime("setValue");
textArea.value = value;
}
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(reason, selectionStart, selectionEnd) {
const textArea = this._actual;
let activeElement = null;
const shadowRoot = getShadowRoot(textArea);
if (shadowRoot) {
activeElement = shadowRoot.activeElement;
} else {
activeElement = getActiveElement();
}
const activeWindow = getWindow(activeElement);
const currentIsFocused = activeElement === textArea;
const currentSelectionStart = textArea.selectionStart;
const currentSelectionEnd = textArea.selectionEnd;
if (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) {
if (isFirefox2 && activeWindow.parent !== activeWindow) {
textArea.focus();
}
return;
}
if (currentIsFocused) {
this.setIgnoreSelectionChangeTime("setSelectionRange");
textArea.setSelectionRange(selectionStart, selectionEnd);
if (isFirefox2 && activeWindow.parent !== activeWindow) {
textArea.focus();
}
return;
}
try {
const scrollState = saveParentsScrollTop(textArea);
this.setIgnoreSelectionChangeTime("setSelectionRange");
textArea.focus();
textArea.setSelectionRange(selectionStart, selectionEnd);
restoreParentsScrollTop(textArea, scrollState);
} catch (e) {
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/pointerHandler.js
var PointerEventHandler, TouchHandler, PointerHandler;
var init_pointerHandler = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/pointerHandler.js"() {
init_canIUse();
init_dom();
init_touch();
init_window();
init_lifecycle();
init_platform();
init_mouseHandler();
init_textAreaInput();
init_editorDom();
PointerEventHandler = class extends MouseHandler {
constructor(context, viewController, viewHelper) {
super(context, viewController, viewHelper);
this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Tap, (e) => this.onTap(e)));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Change, (e) => this.onChange(e)));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));
this._lastPointerType = "mouse";
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, "pointerdown", (e) => {
const pointerType = e.pointerType;
if (pointerType === "mouse") {
this._lastPointerType = "mouse";
return;
} else if (pointerType === "touch") {
this._lastPointerType = "touch";
} else {
this._lastPointerType = "pen";
}
}));
const pointerEvents = new EditorPointerEventFactory(this.viewHelper.viewDomNode);
this._register(pointerEvents.onPointerMove(this.viewHelper.viewDomNode, (e) => this._onMouseMove(e)));
this._register(pointerEvents.onPointerUp(this.viewHelper.viewDomNode, (e) => this._onMouseUp(e)));
this._register(pointerEvents.onPointerLeave(this.viewHelper.viewDomNode, (e) => this._onMouseLeave(e)));
this._register(pointerEvents.onPointerDown(this.viewHelper.viewDomNode, (e, pointerId) => this._onMouseDown(e, pointerId)));
}
onTap(event) {
if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) {
return;
}
event.preventDefault();
this.viewHelper.focusTextArea();
this._dispatchGesture(
event,
/*inSelectionMode*/
false
);
}
onChange(event) {
if (this._lastPointerType === "touch") {
this._context.viewModel.viewLayout.deltaScrollNow(-event.translationX, -event.translationY);
}
if (this._lastPointerType === "pen") {
this._dispatchGesture(
event,
/*inSelectionMode*/
true
);
}
}
_dispatchGesture(event, inSelectionMode) {
const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);
if (target.position) {
this.viewController.dispatchMouse({
position: target.position,
mouseColumn: target.position.column,
startedOnLineNumbers: false,
revealType: 1,
mouseDownCount: event.tapCount,
inSelectionMode,
altKey: false,
ctrlKey: false,
metaKey: false,
shiftKey: false,
leftButton: false,
middleButton: false,
onInjectedText: target.type === 6 && target.detail.injectedText !== null
});
}
}
_onMouseDown(e, pointerId) {
if (e.browserEvent.pointerType === "touch") {
return;
}
super._onMouseDown(e, pointerId);
}
};
TouchHandler = class extends MouseHandler {
constructor(context, viewController, viewHelper) {
super(context, viewController, viewHelper);
this._register(Gesture.addTarget(this.viewHelper.linesContentDomNode));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Tap, (e) => this.onTap(e)));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Change, (e) => this.onChange(e)));
this._register(addDisposableListener(this.viewHelper.linesContentDomNode, EventType2.Contextmenu, (e) => this._onContextMenu(new EditorMouseEvent(e, false, this.viewHelper.viewDomNode), false)));
}
onTap(event) {
event.preventDefault();
this.viewHelper.focusTextArea();
const target = this._createMouseTarget(new EditorMouseEvent(event, false, this.viewHelper.viewDomNode), false);
if (target.position) {
const event2 = document.createEvent("CustomEvent");
event2.initEvent(TextAreaSyntethicEvents.Tap, false, true);
this.viewHelper.dispatchTextAreaEvent(event2);
this.viewController.moveTo(
target.position,
1
/* NavigationCommandRevealType.Minimal */
);
}
}
onChange(e) {
this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);
}
};
PointerHandler = class extends Disposable {
constructor(context, viewController, viewHelper) {
super();
const isPhone = isIOS || isAndroid && isMobile;
if (isPhone && BrowserFeatures.pointerEvents) {
this.handler = this._register(new PointerEventHandler(context, viewController, viewHelper));
} else if (mainWindow.TouchEvent) {
this.handler = this._register(new TouchHandler(context, viewController, viewHelper));
} else {
this.handler = this._register(new MouseHandler(context, viewController, viewHelper));
}
}
getTargetAtClientPoint(clientX, clientY) {
return this.handler.getTargetAtClientPoint(clientX, clientY);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.css
var init_textAreaHandler = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css
var init_lineNumbers = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/dynamicViewOverlay.js
var DynamicViewOverlay;
var init_dynamicViewOverlay = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/dynamicViewOverlay.js"() {
init_viewEventHandler();
DynamicViewOverlay = class extends ViewEventHandler {
};
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js
function themeColorFromId(id) {
return { id };
}
function getThemeTypeSelector(type) {
switch (type) {
case ColorScheme.DARK:
return "vs-dark";
case ColorScheme.HIGH_CONTRAST_DARK:
return "hc-black";
case ColorScheme.HIGH_CONTRAST_LIGHT:
return "hc-light";
default:
return "vs";
}
}
function registerThemingParticipant(participant) {
return themingRegistry.onColorThemeChange(participant);
}
var IThemeService, Extensions7, ThemingRegistry, themingRegistry, Themable;
var init_themeService = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js"() {
init_event();
init_lifecycle();
init_instantiation();
init_platform2();
init_theme();
IThemeService = createDecorator("themeService");
Extensions7 = {
ThemingContribution: "base.contributions.theming"
};
ThemingRegistry = class {
constructor() {
this.themingParticipants = [];
this.themingParticipants = [];
this.onThemingParticipantAddedEmitter = new Emitter();
}
onColorThemeChange(participant) {
this.themingParticipants.push(participant);
this.onThemingParticipantAddedEmitter.fire(participant);
return toDisposable(() => {
const idx = this.themingParticipants.indexOf(participant);
this.themingParticipants.splice(idx, 1);
});
}
getThemingParticipants() {
return this.themingParticipants;
}
};
themingRegistry = new ThemingRegistry();
Registry.add(Extensions7.ThemingContribution, themingRegistry);
Themable = class extends Disposable {
constructor(themeService) {
super();
this.themeService = themeService;
this.theme = themeService.getColorTheme();
this._register(this.themeService.onDidColorThemeChange((theme) => this.onThemeChange(theme)));
}
onThemeChange(theme) {
this.theme = theme;
this.updateStyles();
}
updateStyles() {
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/editorColorRegistry.js
var editorLineHighlight, editorLineHighlightBorder, editorRangeHighlight, editorRangeHighlightBorder, editorSymbolHighlight, editorSymbolHighlightBorder, editorCursorForeground, editorCursorBackground, editorMultiCursorPrimaryForeground, editorMultiCursorPrimaryBackground, editorMultiCursorSecondaryForeground, editorMultiCursorSecondaryBackground, editorWhitespaces, editorLineNumbers, deprecatedEditorIndentGuides, deprecatedEditorActiveIndentGuides, editorIndentGuide1, editorIndentGuide2, editorIndentGuide3, editorIndentGuide4, editorIndentGuide5, editorIndentGuide6, editorActiveIndentGuide1, editorActiveIndentGuide2, editorActiveIndentGuide3, editorActiveIndentGuide4, editorActiveIndentGuide5, editorActiveIndentGuide6, deprecatedEditorActiveLineNumber, editorActiveLineNumber, editorDimmedLineNumber, editorRuler, editorCodeLensForeground, editorBracketMatchBackground, editorBracketMatchBorder, editorOverviewRulerBorder, editorOverviewRulerBackground, editorGutter, editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity, ghostTextBorder, ghostTextForeground, ghostTextBackground, rulerRangeDefault, overviewRulerRangeHighlight, overviewRulerError, overviewRulerWarning, overviewRulerInfo, editorBracketHighlightingForeground1, editorBracketHighlightingForeground2, editorBracketHighlightingForeground3, editorBracketHighlightingForeground4, editorBracketHighlightingForeground5, editorBracketHighlightingForeground6, editorBracketHighlightingUnexpectedBracketForeground, editorBracketPairGuideBackground1, editorBracketPairGuideBackground2, editorBracketPairGuideBackground3, editorBracketPairGuideBackground4, editorBracketPairGuideBackground5, editorBracketPairGuideBackground6, editorBracketPairGuideActiveBackground1, editorBracketPairGuideActiveBackground2, editorBracketPairGuideActiveBackground3, editorBracketPairGuideActiveBackground4, editorBracketPairGuideActiveBackground5, editorBracketPairGuideActiveBackground6, editorUnicodeHighlightBorder, editorUnicodeHighlightBackground;
var init_editorColorRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/editorColorRegistry.js"() {
init_nls();
init_color();
init_colorRegistry();
init_themeService();
editorLineHighlight = registerColor("editor.lineHighlightBackground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("lineHighlight", "Background color for the highlight of line at the cursor position."));
editorLineHighlightBorder = registerColor("editor.lineHighlightBorder", { dark: "#282828", light: "#eeeeee", hcDark: "#f38518", hcLight: contrastBorder }, localize("lineHighlightBorderBox", "Background color for the border around the line at the cursor position."));
editorRangeHighlight = registerColor("editor.rangeHighlightBackground", { dark: "#ffffff0b", light: "#fdff0033", hcDark: null, hcLight: null }, 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);
editorRangeHighlightBorder = registerColor("editor.rangeHighlightBorder", { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("rangeHighlightBorder", "Background color of the border around highlighted ranges."));
editorSymbolHighlight = registerColor("editor.symbolHighlightBackground", { dark: editorFindMatchHighlight, light: editorFindMatchHighlight, hcDark: null, hcLight: null }, 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);
editorSymbolHighlightBorder = registerColor("editor.symbolHighlightBorder", { dark: null, light: null, hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("symbolHighlightBorder", "Background color of the border around highlighted symbols."));
editorCursorForeground = registerColor("editorCursor.foreground", { dark: "#AEAFAD", light: Color.black, hcDark: Color.white, hcLight: "#0F4A85" }, localize("caret", "Color of the editor cursor."));
editorCursorBackground = registerColor("editorCursor.background", null, localize("editorCursorBackground", "The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor."));
editorMultiCursorPrimaryForeground = registerColor("editorMultiCursor.primary.foreground", { dark: editorCursorForeground, light: editorCursorForeground, hcDark: editorCursorForeground, hcLight: editorCursorForeground }, localize("editorMultiCursorPrimaryForeground", "Color of the primary editor cursor when multiple cursors are present."));
editorMultiCursorPrimaryBackground = registerColor("editorMultiCursor.primary.background", { dark: editorCursorBackground, light: editorCursorBackground, hcDark: editorCursorBackground, hcLight: editorCursorBackground }, 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."));
editorMultiCursorSecondaryForeground = registerColor("editorMultiCursor.secondary.foreground", { dark: editorCursorForeground, light: editorCursorForeground, hcDark: editorCursorForeground, hcLight: editorCursorForeground }, localize("editorMultiCursorSecondaryForeground", "Color of secondary editor cursors when multiple cursors are present."));
editorMultiCursorSecondaryBackground = registerColor("editorMultiCursor.secondary.background", { dark: editorCursorBackground, light: editorCursorBackground, hcDark: editorCursorBackground, hcLight: editorCursorBackground }, 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."));
editorWhitespaces = registerColor("editorWhitespace.foreground", { dark: "#e3e4e229", light: "#33333333", hcDark: "#e3e4e229", hcLight: "#CCCCCC" }, localize("editorWhitespaces", "Color of whitespace characters in the editor."));
editorLineNumbers = registerColor("editorLineNumber.foreground", { dark: "#858585", light: "#237893", hcDark: Color.white, hcLight: "#292929" }, localize("editorLineNumbers", "Color of editor line numbers."));
deprecatedEditorIndentGuides = registerColor("editorIndentGuide.background", { dark: editorWhitespaces, light: editorWhitespaces, hcDark: editorWhitespaces, hcLight: editorWhitespaces }, localize("editorIndentGuides", "Color of the editor indentation guides."), false, localize("deprecatedEditorIndentGuides", "'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead."));
deprecatedEditorActiveIndentGuides = registerColor("editorIndentGuide.activeBackground", { dark: editorWhitespaces, light: editorWhitespaces, hcDark: editorWhitespaces, hcLight: editorWhitespaces }, localize("editorActiveIndentGuide", "Color of the active editor indentation guides."), false, localize("deprecatedEditorActiveIndentGuide", "'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead."));
editorIndentGuide1 = registerColor("editorIndentGuide.background1", { dark: deprecatedEditorIndentGuides, light: deprecatedEditorIndentGuides, hcDark: deprecatedEditorIndentGuides, hcLight: deprecatedEditorIndentGuides }, localize("editorIndentGuides1", "Color of the editor indentation guides (1)."));
editorIndentGuide2 = registerColor("editorIndentGuide.background2", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorIndentGuides2", "Color of the editor indentation guides (2)."));
editorIndentGuide3 = registerColor("editorIndentGuide.background3", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorIndentGuides3", "Color of the editor indentation guides (3)."));
editorIndentGuide4 = registerColor("editorIndentGuide.background4", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorIndentGuides4", "Color of the editor indentation guides (4)."));
editorIndentGuide5 = registerColor("editorIndentGuide.background5", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorIndentGuides5", "Color of the editor indentation guides (5)."));
editorIndentGuide6 = registerColor("editorIndentGuide.background6", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorIndentGuides6", "Color of the editor indentation guides (6)."));
editorActiveIndentGuide1 = registerColor("editorIndentGuide.activeBackground1", { dark: deprecatedEditorActiveIndentGuides, light: deprecatedEditorActiveIndentGuides, hcDark: deprecatedEditorActiveIndentGuides, hcLight: deprecatedEditorActiveIndentGuides }, localize("editorActiveIndentGuide1", "Color of the active editor indentation guides (1)."));
editorActiveIndentGuide2 = registerColor("editorIndentGuide.activeBackground2", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorActiveIndentGuide2", "Color of the active editor indentation guides (2)."));
editorActiveIndentGuide3 = registerColor("editorIndentGuide.activeBackground3", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorActiveIndentGuide3", "Color of the active editor indentation guides (3)."));
editorActiveIndentGuide4 = registerColor("editorIndentGuide.activeBackground4", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorActiveIndentGuide4", "Color of the active editor indentation guides (4)."));
editorActiveIndentGuide5 = registerColor("editorIndentGuide.activeBackground5", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorActiveIndentGuide5", "Color of the active editor indentation guides (5)."));
editorActiveIndentGuide6 = registerColor("editorIndentGuide.activeBackground6", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorActiveIndentGuide6", "Color of the active editor indentation guides (6)."));
deprecatedEditorActiveLineNumber = registerColor("editorActiveLineNumber.foreground", { dark: "#c6c6c6", light: "#0B216F", hcDark: activeContrastBorder, hcLight: activeContrastBorder }, localize("editorActiveLineNumber", "Color of editor active line number"), false, localize("deprecatedEditorActiveLineNumber", "Id is deprecated. Use 'editorLineNumber.activeForeground' instead."));
editorActiveLineNumber = registerColor("editorLineNumber.activeForeground", { dark: deprecatedEditorActiveLineNumber, light: deprecatedEditorActiveLineNumber, hcDark: deprecatedEditorActiveLineNumber, hcLight: deprecatedEditorActiveLineNumber }, localize("editorActiveLineNumber", "Color of editor active line number"));
editorDimmedLineNumber = registerColor("editorLineNumber.dimmedForeground", { dark: null, light: null, hcDark: null, hcLight: null }, localize("editorDimmedLineNumber", "Color of the final editor line when editor.renderFinalNewline is set to dimmed."));
editorRuler = registerColor("editorRuler.foreground", { dark: "#5A5A5A", light: Color.lightgrey, hcDark: Color.white, hcLight: "#292929" }, localize("editorRuler", "Color of the editor rulers."));
editorCodeLensForeground = registerColor("editorCodeLens.foreground", { dark: "#999999", light: "#919191", hcDark: "#999999", hcLight: "#292929" }, localize("editorCodeLensForeground", "Foreground color of editor CodeLens"));
editorBracketMatchBackground = registerColor("editorBracketMatch.background", { dark: "#0064001a", light: "#0064001a", hcDark: "#0064001a", hcLight: "#0000" }, localize("editorBracketMatchBackground", "Background color behind matching brackets"));
editorBracketMatchBorder = registerColor("editorBracketMatch.border", { dark: "#888", light: "#B9B9B9", hcDark: contrastBorder, hcLight: contrastBorder }, localize("editorBracketMatchBorder", "Color for matching brackets boxes"));
editorOverviewRulerBorder = registerColor("editorOverviewRuler.border", { dark: "#7f7f7f4d", light: "#7f7f7f4d", hcDark: "#7f7f7f4d", hcLight: "#666666" }, localize("editorOverviewRulerBorder", "Color of the overview ruler border."));
editorOverviewRulerBackground = registerColor("editorOverviewRuler.background", null, localize("editorOverviewRulerBackground", "Background color of the editor overview ruler."));
editorGutter = registerColor("editorGutter.background", { dark: editorBackground, light: editorBackground, hcDark: editorBackground, hcLight: editorBackground }, localize("editorGutter", "Background color of the editor gutter. The gutter contains the glyph margins and the line numbers."));
editorUnnecessaryCodeBorder = registerColor("editorUnnecessaryCode.border", { dark: null, light: null, hcDark: Color.fromHex("#fff").transparent(0.8), hcLight: contrastBorder }, localize("unnecessaryCodeBorder", "Border color of unnecessary (unused) source code in the editor."));
editorUnnecessaryCodeOpacity = registerColor("editorUnnecessaryCode.opacity", { dark: Color.fromHex("#000a"), light: Color.fromHex("#0007"), hcDark: null, hcLight: null }, 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.`));
ghostTextBorder = registerColor("editorGhostText.border", { dark: null, light: null, hcDark: Color.fromHex("#fff").transparent(0.8), hcLight: Color.fromHex("#292929").transparent(0.8) }, localize("editorGhostTextBorder", "Border color of ghost text in the editor."));
ghostTextForeground = registerColor("editorGhostText.foreground", { dark: Color.fromHex("#ffffff56"), light: Color.fromHex("#0007"), hcDark: null, hcLight: null }, localize("editorGhostTextForeground", "Foreground color of the ghost text in the editor."));
ghostTextBackground = registerColor("editorGhostText.background", { dark: null, light: null, hcDark: null, hcLight: null }, localize("editorGhostTextBackground", "Background color of the ghost text in the editor."));
rulerRangeDefault = new Color(new RGBA(0, 122, 204, 0.6));
overviewRulerRangeHighlight = registerColor("editorOverviewRuler.rangeHighlightForeground", { dark: rulerRangeDefault, light: rulerRangeDefault, hcDark: rulerRangeDefault, hcLight: rulerRangeDefault }, localize("overviewRulerRangeHighlight", "Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."), true);
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" }, localize("overviewRuleError", "Overview ruler marker color for errors."));
overviewRulerWarning = registerColor("editorOverviewRuler.warningForeground", { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, localize("overviewRuleWarning", "Overview ruler marker color for warnings."));
overviewRulerInfo = registerColor("editorOverviewRuler.infoForeground", { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, localize("overviewRuleInfo", "Overview ruler marker color for infos."));
editorBracketHighlightingForeground1 = registerColor("editorBracketHighlight.foreground1", { dark: "#FFD700", light: "#0431FAFF", hcDark: "#FFD700", hcLight: "#0431FAFF" }, localize("editorBracketHighlightForeground1", "Foreground color of brackets (1). Requires enabling bracket pair colorization."));
editorBracketHighlightingForeground2 = registerColor("editorBracketHighlight.foreground2", { dark: "#DA70D6", light: "#319331FF", hcDark: "#DA70D6", hcLight: "#319331FF" }, localize("editorBracketHighlightForeground2", "Foreground color of brackets (2). Requires enabling bracket pair colorization."));
editorBracketHighlightingForeground3 = registerColor("editorBracketHighlight.foreground3", { dark: "#179FFF", light: "#7B3814FF", hcDark: "#87CEFA", hcLight: "#7B3814FF" }, localize("editorBracketHighlightForeground3", "Foreground color of brackets (3). Requires enabling bracket pair colorization."));
editorBracketHighlightingForeground4 = registerColor("editorBracketHighlight.foreground4", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketHighlightForeground4", "Foreground color of brackets (4). Requires enabling bracket pair colorization."));
editorBracketHighlightingForeground5 = registerColor("editorBracketHighlight.foreground5", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketHighlightForeground5", "Foreground color of brackets (5). Requires enabling bracket pair colorization."));
editorBracketHighlightingForeground6 = registerColor("editorBracketHighlight.foreground6", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketHighlightForeground6", "Foreground color of brackets (6). Requires enabling bracket pair colorization."));
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: "" }, localize("editorBracketHighlightUnexpectedBracketForeground", "Foreground color of unexpected brackets."));
editorBracketPairGuideBackground1 = registerColor("editorBracketPairGuide.background1", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background1", "Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides."));
editorBracketPairGuideBackground2 = registerColor("editorBracketPairGuide.background2", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background2", "Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides."));
editorBracketPairGuideBackground3 = registerColor("editorBracketPairGuide.background3", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background3", "Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides."));
editorBracketPairGuideBackground4 = registerColor("editorBracketPairGuide.background4", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background4", "Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides."));
editorBracketPairGuideBackground5 = registerColor("editorBracketPairGuide.background5", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background5", "Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides."));
editorBracketPairGuideBackground6 = registerColor("editorBracketPairGuide.background6", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.background6", "Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground1 = registerColor("editorBracketPairGuide.activeBackground1", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground1", "Background color of active bracket pair guides (1). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground2 = registerColor("editorBracketPairGuide.activeBackground2", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground2", "Background color of active bracket pair guides (2). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground3 = registerColor("editorBracketPairGuide.activeBackground3", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground3", "Background color of active bracket pair guides (3). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground4 = registerColor("editorBracketPairGuide.activeBackground4", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground4", "Background color of active bracket pair guides (4). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground5 = registerColor("editorBracketPairGuide.activeBackground5", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground5", "Background color of active bracket pair guides (5). Requires enabling bracket pair guides."));
editorBracketPairGuideActiveBackground6 = registerColor("editorBracketPairGuide.activeBackground6", { dark: "#00000000", light: "#00000000", hcDark: "#00000000", hcLight: "#00000000" }, localize("editorBracketPairGuide.activeBackground6", "Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));
editorUnicodeHighlightBorder = registerColor("editorUnicodeHighlight.border", { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningForeground, hcLight: editorWarningForeground }, localize("editorUnicodeHighlight.border", "Border color used to highlight unicode characters."));
editorUnicodeHighlightBackground = registerColor("editorUnicodeHighlight.background", { dark: editorWarningBackground, light: editorWarningBackground, hcDark: editorWarningBackground, hcLight: editorWarningBackground }, localize("editorUnicodeHighlight.background", "Background color used to highlight unicode characters."));
registerThemingParticipant((theme, collector) => {
const background = theme.getColor(editorBackground);
const lineHighlight = theme.getColor(editorLineHighlight);
const imeBackground = lineHighlight && !lineHighlight.isTransparent() ? lineHighlight : background;
if (imeBackground) {
collector.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${imeBackground}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js
var LineNumbersOverlay;
var init_lineNumbers2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js"() {
init_lineNumbers();
init_platform();
init_dynamicViewOverlay();
init_position();
init_range();
init_themeService();
init_editorColorRegistry();
LineNumbersOverlay = class _LineNumbersOverlay extends DynamicViewOverlay {
constructor(context) {
super();
this._context = context;
this._readConfig();
this._lastCursorModelPosition = new Position(1, 1);
this._renderResult = null;
this._activeLineNumber = 1;
this._context.addEventHandler(this);
}
_readConfig() {
const options2 = this._context.configuration.options;
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
const lineNumbers = options2.get(
68
/* EditorOption.lineNumbers */
);
this._renderLineNumbers = lineNumbers.renderType;
this._renderCustomLineNumbers = lineNumbers.renderFn;
this._renderFinalNewline = options2.get(
95
/* EditorOption.renderFinalNewline */
);
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._lineNumbersLeft = layoutInfo.lineNumbersLeft;
this._lineNumbersWidth = layoutInfo.lineNumbersWidth;
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
this._readConfig();
return true;
}
onCursorStateChanged(e) {
const primaryViewPosition = e.selections[0].getPosition();
this._lastCursorModelPosition = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(primaryViewPosition);
let shouldRender = false;
if (this._activeLineNumber !== primaryViewPosition.lineNumber) {
this._activeLineNumber = primaryViewPosition.lineNumber;
shouldRender = true;
}
if (this._renderLineNumbers === 2 || this._renderLineNumbers === 3) {
shouldRender = true;
}
return shouldRender;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
onDecorationsChanged(e) {
return e.affectsLineNumber;
}
// --- end event handlers
_getLineRenderLineNumber(viewLineNumber) {
const modelPosition = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(viewLineNumber, 1));
if (modelPosition.column !== 1) {
return "";
}
const modelLineNumber = modelPosition.lineNumber;
if (this._renderCustomLineNumbers) {
return this._renderCustomLineNumbers(modelLineNumber);
}
if (this._renderLineNumbers === 2) {
const diff = Math.abs(this._lastCursorModelPosition.lineNumber - modelLineNumber);
if (diff === 0) {
return '' + modelLineNumber + "";
}
return String(diff);
}
if (this._renderLineNumbers === 3) {
if (this._lastCursorModelPosition.lineNumber === modelLineNumber) {
return String(modelLineNumber);
}
if (modelLineNumber % 10 === 0) {
return String(modelLineNumber);
}
const finalLineNumber = this._context.viewModel.getLineCount();
if (modelLineNumber === finalLineNumber) {
return String(modelLineNumber);
}
return "";
}
return String(modelLineNumber);
}
prepareRender(ctx) {
if (this._renderLineNumbers === 0) {
this._renderResult = null;
return;
}
const lineHeightClassName = isLinux ? this._lineHeight % 2 === 0 ? " lh-even" : " lh-odd" : "";
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const lineNoDecorations = this._context.viewModel.getDecorationsInViewport(ctx.visibleRange).filter((d) => !!d.options.lineNumberClassName);
lineNoDecorations.sort((a3, b) => Range.compareRangesUsingEnds(a3.range, b.range));
let decorationStartIndex = 0;
const lineCount = this._context.viewModel.getLineCount();
const output = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
let renderLineNumber = this._getLineRenderLineNumber(lineNumber);
let extraClassNames = "";
while (decorationStartIndex < lineNoDecorations.length && lineNoDecorations[decorationStartIndex].range.endLineNumber < lineNumber) {
decorationStartIndex++;
}
for (let i = decorationStartIndex; i < lineNoDecorations.length; i++) {
const { range: range2, options: options2 } = lineNoDecorations[i];
if (range2.startLineNumber <= lineNumber) {
extraClassNames += " " + options2.lineNumberClassName;
}
}
if (!renderLineNumber && !extraClassNames) {
output[lineIndex] = "";
continue;
}
if (lineNumber === lineCount && this._context.viewModel.getLineLength(lineNumber) === 0) {
if (this._renderFinalNewline === "off") {
renderLineNumber = "";
}
if (this._renderFinalNewline === "dimmed") {
extraClassNames += " dimmed-line-number";
}
}
if (lineNumber === this._activeLineNumber) {
extraClassNames += " active-line-number";
}
output[lineIndex] = ``;
}
this._renderResult = output;
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return "";
}
return this._renderResult[lineIndex];
}
};
LineNumbersOverlay.CLASS_NAME = "line-numbers";
registerThemingParticipant((theme, collector) => {
const editorLineNumbersColor = theme.getColor(editorLineNumbers);
const editorDimmedLineNumberColor = theme.getColor(editorDimmedLineNumber);
if (editorDimmedLineNumberColor) {
collector.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${editorDimmedLineNumberColor}; }`);
} else if (editorLineNumbersColor) {
collector.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${editorLineNumbersColor.transparent(0.4)}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.css
var init_margin = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.js
var Margin;
var init_margin2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.js"() {
init_margin();
init_fastDomNode();
init_viewPart();
Margin = class _Margin extends ViewPart {
constructor(context) {
super(context);
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._canUseLayerHinting = !options2.get(
32
/* EditorOption.disableLayerHinting */
);
this._contentLeft = layoutInfo.contentLeft;
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
this._domNode = createFastDomNode(document.createElement("div"));
this._domNode.setClassName(_Margin.OUTER_CLASS_NAME);
this._domNode.setPosition("absolute");
this._domNode.setAttribute("role", "presentation");
this._domNode.setAttribute("aria-hidden", "true");
this._glyphMarginBackgroundDomNode = createFastDomNode(document.createElement("div"));
this._glyphMarginBackgroundDomNode.setClassName(_Margin.CLASS_NAME);
this._domNode.appendChild(this._glyphMarginBackgroundDomNode);
}
dispose() {
super.dispose();
}
getDomNode() {
return this._domNode;
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._canUseLayerHinting = !options2.get(
32
/* EditorOption.disableLayerHinting */
);
this._contentLeft = layoutInfo.contentLeft;
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
return true;
}
onScrollChanged(e) {
return super.onScrollChanged(e) || e.scrollTopChanged;
}
// --- end event handlers
prepareRender(ctx) {
}
render(ctx) {
this._domNode.setLayerHinting(this._canUseLayerHinting);
this._domNode.setContain("strict");
const adjustedScrollTop = ctx.scrollTop - ctx.bigNumbersDelta;
this._domNode.setTop(-adjustedScrollTop);
const height = Math.min(ctx.scrollHeight, 1e6);
this._domNode.setHeight(height);
this._domNode.setWidth(this._contentLeft);
this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft);
this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth);
this._glyphMarginBackgroundDomNode.setHeight(height);
}
};
Margin.CLASS_NAME = "glyph-margin";
Margin.OUTER_CLASS_NAME = "margin";
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.css
var init_mouseCursor = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js
var MOUSE_CURSOR_TEXT_CSS_CLASS_NAME;
var init_mouseCursor2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js"() {
init_mouseCursor();
MOUSE_CURSOR_TEXT_CSS_CLASS_NAME = `monaco-mouse-cursor-text`;
}
});
// node_modules/monaco-editor/esm/vs/base/common/ime.js
var IMEImpl, IME;
var init_ime = __esm({
"node_modules/monaco-editor/esm/vs/base/common/ime.js"() {
init_event();
IMEImpl = class {
constructor() {
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
this._enabled = true;
}
get enabled() {
return this._enabled;
}
/**
* Enable IME
*/
enable() {
this._enabled = true;
this._onDidChange.fire();
}
/**
* Disable IME
*/
disable() {
this._enabled = false;
this._onDidChange.fire();
}
};
IME = new IMEImpl();
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js
var IKeybindingService;
var init_keybinding = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js"() {
init_instantiation();
IKeybindingService = createDecorator("keybindingService");
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.js
function measureText(targetDocument, text2, fontInfo, tabSize) {
if (text2.length === 0) {
return 0;
}
const container = targetDocument.createElement("div");
container.style.position = "absolute";
container.style.top = "-50000px";
container.style.width = "50000px";
const regularDomNode = targetDocument.createElement("span");
applyFontInfo(regularDomNode, fontInfo);
regularDomNode.style.whiteSpace = "pre";
regularDomNode.style.tabSize = `${tabSize * fontInfo.spaceWidth}px`;
regularDomNode.append(text2);
container.appendChild(regularDomNode);
targetDocument.body.appendChild(container);
const res = regularDomNode.offsetWidth;
targetDocument.body.removeChild(container);
return res;
}
var __decorate9, __param8, VisibleTextAreaData, canUseZeroSizeTextarea, TextAreaHandler;
var init_textAreaHandler2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.js"() {
init_textAreaHandler();
init_nls();
init_browser();
init_fastDomNode();
init_platform();
init_strings();
init_domFontInfo();
init_textAreaInput();
init_textAreaState();
init_viewPart();
init_lineNumbers2();
init_margin2();
init_editorOptions();
init_wordCharacterClassifier();
init_position();
init_range();
init_selection();
init_mouseCursor2();
init_languages();
init_color();
init_ime();
init_keybinding();
init_instantiation();
__decorate9 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param8 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
VisibleTextAreaData = class {
constructor(_context, modelLineNumber, distanceToModelLineStart, widthOfHiddenLineTextBefore, distanceToModelLineEnd) {
this._context = _context;
this.modelLineNumber = modelLineNumber;
this.distanceToModelLineStart = distanceToModelLineStart;
this.widthOfHiddenLineTextBefore = widthOfHiddenLineTextBefore;
this.distanceToModelLineEnd = distanceToModelLineEnd;
this._visibleTextAreaBrand = void 0;
this.startPosition = null;
this.endPosition = null;
this.visibleTextareaStart = null;
this.visibleTextareaEnd = null;
this._previousPresentation = null;
}
prepareRender(visibleRangeProvider) {
const startModelPosition = new Position(this.modelLineNumber, this.distanceToModelLineStart + 1);
const endModelPosition = new Position(this.modelLineNumber, this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber) - this.distanceToModelLineEnd);
this.startPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(startModelPosition);
this.endPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(endModelPosition);
if (this.startPosition.lineNumber === this.endPosition.lineNumber) {
this.visibleTextareaStart = visibleRangeProvider.visibleRangeForPosition(this.startPosition);
this.visibleTextareaEnd = visibleRangeProvider.visibleRangeForPosition(this.endPosition);
} else {
this.visibleTextareaStart = null;
this.visibleTextareaEnd = null;
}
}
definePresentation(tokenPresentation) {
if (!this._previousPresentation) {
if (tokenPresentation) {
this._previousPresentation = tokenPresentation;
} else {
this._previousPresentation = {
foreground: 1,
italic: false,
bold: false,
underline: false,
strikethrough: false
};
}
}
return this._previousPresentation;
}
};
canUseZeroSizeTextarea = isFirefox2;
TextAreaHandler = class TextAreaHandler2 extends ViewPart {
constructor(context, viewController, visibleRangeProvider, _keybindingService, _instantiationService) {
super(context);
this._keybindingService = _keybindingService;
this._instantiationService = _instantiationService;
this._primaryCursorPosition = new Position(1, 1);
this._primaryCursorVisibleRange = null;
this._viewController = viewController;
this._visibleRangeProvider = visibleRangeProvider;
this._scrollLeft = 0;
this._scrollTop = 0;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._setAccessibilityOptions(options2);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._contentHeight = layoutInfo.height;
this._fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._emptySelectionClipboard = options2.get(
37
/* EditorOption.emptySelectionClipboard */
);
this._copyWithSyntaxHighlighting = options2.get(
25
/* EditorOption.copyWithSyntaxHighlighting */
);
this._visibleTextArea = null;
this._selections = [new Selection(1, 1, 1, 1)];
this._modelSelections = [new Selection(1, 1, 1, 1)];
this._lastRenderPosition = null;
this.textArea = createFastDomNode(document.createElement("textarea"));
PartFingerprints.write(
this.textArea,
7
/* PartFingerprint.TextArea */
);
this.textArea.setClassName(`inputarea ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`);
this.textArea.setAttribute("wrap", this._textAreaWrapping && !this._visibleTextArea ? "on" : "off");
const { tabSize } = this._context.viewModel.model.getOptions();
this.textArea.domNode.style.tabSize = `${tabSize * 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(options2));
this.textArea.setAttribute("aria-required", options2.get(
5
/* EditorOption.ariaRequired */
) ? "true" : "false");
this.textArea.setAttribute("tabindex", String(options2.get(
124
/* EditorOption.tabIndex */
)));
this.textArea.setAttribute("role", "textbox");
this.textArea.setAttribute("aria-roledescription", localize("editor", "editor"));
this.textArea.setAttribute("aria-multiline", "true");
this.textArea.setAttribute("aria-autocomplete", options2.get(
91
/* EditorOption.readOnly */
) ? "none" : "both");
this._ensureReadOnlyAttribute();
this.textAreaCover = createFastDomNode(document.createElement("div"));
this.textAreaCover.setPosition("absolute");
const simpleModel = {
getLineCount: () => {
return this._context.viewModel.getLineCount();
},
getLineMaxColumn: (lineNumber) => {
return this._context.viewModel.getLineMaxColumn(lineNumber);
},
getValueInRange: (range2, eol) => {
return this._context.viewModel.getValueInRange(range2, eol);
},
getValueLengthInRange: (range2, eol) => {
return this._context.viewModel.getValueLengthInRange(range2, eol);
},
modifyPosition: (position, offset) => {
return this._context.viewModel.modifyPosition(position, offset);
}
};
const textAreaInputHost = {
getDataToCopy: () => {
const rawTextToCopy = this._context.viewModel.getPlainTextToCopy(this._modelSelections, this._emptySelectionClipboard, isWindows);
const newLineCharacter = this._context.viewModel.model.getEOL();
const isFromEmptySelection = this._emptySelectionClipboard && this._modelSelections.length === 1 && this._modelSelections[0].isEmpty();
const multicursorText = Array.isArray(rawTextToCopy) ? rawTextToCopy : null;
const text2 = Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy;
let html2 = void 0;
let mode = null;
if (CopyOptions.forceCopyWithSyntaxHighlighting || this._copyWithSyntaxHighlighting && text2.length < 65536) {
const richText = this._context.viewModel.getRichTextToCopy(this._modelSelections, this._emptySelectionClipboard);
if (richText) {
html2 = richText.html;
mode = richText.mode;
}
}
return {
isFromEmptySelection,
multicursorText,
text: text2,
html: html2,
mode
};
},
getScreenReaderContent: () => {
if (this._accessibilitySupport === 1) {
const selection = this._selections[0];
if (isMacintosh && selection.isEmpty()) {
const position = selection.getStartPosition();
let textBefore = this._getWordBeforePosition(position);
if (textBefore.length === 0) {
textBefore = this._getCharacterBeforePosition(position);
}
if (textBefore.length > 0) {
return new TextAreaState(textBefore, textBefore.length, textBefore.length, Range.fromPositions(position), 0);
}
}
const LIMIT_CHARS = 500;
if (isMacintosh && !selection.isEmpty() && simpleModel.getValueLengthInRange(
selection,
0
/* EndOfLinePreference.TextDefined */
) < LIMIT_CHARS) {
const text2 = simpleModel.getValueInRange(
selection,
0
/* EndOfLinePreference.TextDefined */
);
return new TextAreaState(text2, 0, text2.length, selection, 0);
}
if (isSafari2 && !selection.isEmpty()) {
const placeholderText = "vscode-placeholder";
return new TextAreaState(placeholderText, 0, placeholderText.length, null, void 0);
}
return TextAreaState.EMPTY;
}
if (isAndroid2) {
const selection = this._selections[0];
if (selection.isEmpty()) {
const position = selection.getStartPosition();
const [wordAtPosition, positionOffsetInWord] = this._getAndroidWordAtPosition(position);
if (wordAtPosition.length > 0) {
return new TextAreaState(wordAtPosition, positionOffsetInWord, positionOffsetInWord, Range.fromPositions(position), 0);
}
}
return TextAreaState.EMPTY;
}
return PagedScreenReaderStrategy.fromEditorSelection(
simpleModel,
this._selections[0],
this._accessibilityPageSize,
this._accessibilitySupport === 0
/* AccessibilitySupport.Unknown */
);
},
deduceModelPosition: (viewAnchorPosition, deltaOffset, lineFeedCnt) => {
return this._context.viewModel.deduceModelPositionRelativeToViewPosition(viewAnchorPosition, deltaOffset, lineFeedCnt);
}
};
const textAreaWrapper = this._register(new TextAreaWrapper(this.textArea.domNode));
this._textAreaInput = this._register(this._instantiationService.createInstance(TextAreaInput, textAreaInputHost, textAreaWrapper, OS, {
isAndroid: isAndroid2,
isChrome: isChrome2,
isFirefox: isFirefox2,
isSafari: isSafari2
}));
this._register(this._textAreaInput.onKeyDown((e) => {
this._viewController.emitKeyDown(e);
}));
this._register(this._textAreaInput.onKeyUp((e) => {
this._viewController.emitKeyUp(e);
}));
this._register(this._textAreaInput.onPaste((e) => {
let pasteOnNewLine = false;
let multicursorText = null;
let mode = null;
if (e.metadata) {
pasteOnNewLine = this._emptySelectionClipboard && !!e.metadata.isFromEmptySelection;
multicursorText = typeof e.metadata.multicursorText !== "undefined" ? e.metadata.multicursorText : null;
mode = e.metadata.mode;
}
this._viewController.paste(e.text, pasteOnNewLine, multicursorText, mode);
}));
this._register(this._textAreaInput.onCut(() => {
this._viewController.cut();
}));
this._register(this._textAreaInput.onType((e) => {
if (e.replacePrevCharCnt || e.replaceNextCharCnt || e.positionDelta) {
if (_debugComposition) {
console.log(` => compositionType: <<${e.text}>>, ${e.replacePrevCharCnt}, ${e.replaceNextCharCnt}, ${e.positionDelta}`);
}
this._viewController.compositionType(e.text, e.replacePrevCharCnt, e.replaceNextCharCnt, e.positionDelta);
} else {
if (_debugComposition) {
console.log(` => type: <<${e.text}>>`);
}
this._viewController.type(e.text);
}
}));
this._register(this._textAreaInput.onSelectionChangeRequest((modelSelection) => {
this._viewController.setSelection(modelSelection);
}));
this._register(this._textAreaInput.onCompositionStart((e) => {
const ta = this.textArea.domNode;
const modelSelection = this._modelSelections[0];
const { distanceToModelLineStart, widthOfHiddenTextBefore } = (() => {
const textBeforeSelection = ta.value.substring(0, Math.min(ta.selectionStart, ta.selectionEnd));
const lineFeedOffset1 = textBeforeSelection.lastIndexOf("\n");
const lineTextBeforeSelection = textBeforeSelection.substring(lineFeedOffset1 + 1);
const tabOffset1 = lineTextBeforeSelection.lastIndexOf(" ");
const desiredVisibleBeforeCharCount = lineTextBeforeSelection.length - tabOffset1 - 1;
const startModelPosition = modelSelection.getStartPosition();
const visibleBeforeCharCount = Math.min(startModelPosition.column - 1, desiredVisibleBeforeCharCount);
const distanceToModelLineStart2 = startModelPosition.column - 1 - visibleBeforeCharCount;
const hiddenLineTextBefore = lineTextBeforeSelection.substring(0, lineTextBeforeSelection.length - visibleBeforeCharCount);
const { tabSize: tabSize2 } = this._context.viewModel.model.getOptions();
const widthOfHiddenTextBefore2 = measureText(this.textArea.domNode.ownerDocument, hiddenLineTextBefore, this._fontInfo, tabSize2);
return { distanceToModelLineStart: distanceToModelLineStart2, widthOfHiddenTextBefore: widthOfHiddenTextBefore2 };
})();
const { distanceToModelLineEnd } = (() => {
const textAfterSelection = ta.value.substring(Math.max(ta.selectionStart, ta.selectionEnd));
const lineFeedOffset2 = textAfterSelection.indexOf("\n");
const lineTextAfterSelection = lineFeedOffset2 === -1 ? textAfterSelection : textAfterSelection.substring(0, lineFeedOffset2);
const tabOffset2 = lineTextAfterSelection.indexOf(" ");
const desiredVisibleAfterCharCount = tabOffset2 === -1 ? lineTextAfterSelection.length : lineTextAfterSelection.length - tabOffset2 - 1;
const endModelPosition = modelSelection.getEndPosition();
const visibleAfterCharCount = Math.min(this._context.viewModel.model.getLineMaxColumn(endModelPosition.lineNumber) - endModelPosition.column, desiredVisibleAfterCharCount);
const distanceToModelLineEnd2 = this._context.viewModel.model.getLineMaxColumn(endModelPosition.lineNumber) - endModelPosition.column - visibleAfterCharCount;
return { distanceToModelLineEnd: distanceToModelLineEnd2 };
})();
this._context.viewModel.revealRange(
"keyboard",
true,
Range.fromPositions(this._selections[0].getStartPosition()),
0,
1
/* ScrollType.Immediate */
);
this._visibleTextArea = new VisibleTextAreaData(this._context, modelSelection.startLineNumber, distanceToModelLineStart, widthOfHiddenTextBefore, distanceToModelLineEnd);
this.textArea.setAttribute("wrap", this._textAreaWrapping && !this._visibleTextArea ? "on" : "off");
this._visibleTextArea.prepareRender(this._visibleRangeProvider);
this._render();
this.textArea.setClassName(`inputarea ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME} ime-input`);
this._viewController.compositionStart();
this._context.viewModel.onCompositionStart();
}));
this._register(this._textAreaInput.onCompositionUpdate((e) => {
if (!this._visibleTextArea) {
return;
}
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 ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`);
this._viewController.compositionEnd();
this._context.viewModel.onCompositionEnd();
}));
this._register(this._textAreaInput.onFocus(() => {
this._context.viewModel.setHasFocus(true);
}));
this._register(this._textAreaInput.onBlur(() => {
this._context.viewModel.setHasFocus(false);
}));
this._register(IME.onDidChange(() => {
this._ensureReadOnlyAttribute();
}));
}
writeScreenReaderContent(reason) {
this._textAreaInput.writeNativeTextAreaContent(reason);
}
dispose() {
super.dispose();
}
_getAndroidWordAtPosition(position) {
const ANDROID_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;:",.<>/?';
const lineContent = this._context.viewModel.getLineContent(position.lineNumber);
const wordSeparators2 = getMapForWordSeparators(ANDROID_WORD_SEPARATORS, []);
let goingLeft = true;
let startColumn = position.column;
let goingRight = true;
let endColumn = position.column;
let distance = 0;
while (distance < 50 && (goingLeft || goingRight)) {
if (goingLeft && startColumn <= 1) {
goingLeft = false;
}
if (goingLeft) {
const charCode = lineContent.charCodeAt(startColumn - 2);
const charClass = wordSeparators2.get(charCode);
if (charClass !== 0) {
goingLeft = false;
} else {
startColumn--;
}
}
if (goingRight && endColumn > lineContent.length) {
goingRight = false;
}
if (goingRight) {
const charCode = lineContent.charCodeAt(endColumn - 1);
const charClass = wordSeparators2.get(charCode);
if (charClass !== 0) {
goingRight = false;
} else {
endColumn++;
}
}
distance++;
}
return [lineContent.substring(startColumn - 1, endColumn - 1), position.column - startColumn];
}
_getWordBeforePosition(position) {
const lineContent = this._context.viewModel.getLineContent(position.lineNumber);
const wordSeparators2 = getMapForWordSeparators(this._context.configuration.options.get(
131
/* EditorOption.wordSeparators */
), []);
let column = position.column;
let distance = 0;
while (column > 1) {
const charCode = lineContent.charCodeAt(column - 2);
const charClass = wordSeparators2.get(charCode);
if (charClass !== 0 || distance > 50) {
return lineContent.substring(column - 1, position.column - 1);
}
distance++;
column--;
}
return lineContent.substring(0, position.column - 1);
}
_getCharacterBeforePosition(position) {
if (position.column > 1) {
const lineContent = this._context.viewModel.getLineContent(position.lineNumber);
const charBefore = lineContent.charAt(position.column - 2);
if (!isHighSurrogate(charBefore.charCodeAt(0))) {
return charBefore;
}
}
return "";
}
_getAriaLabel(options2) {
var _a10, _b4, _c2;
const accessibilitySupport = options2.get(
2
/* EditorOption.accessibilitySupport */
);
if (accessibilitySupport === 1) {
const toggleKeybindingLabel = (_a10 = this._keybindingService.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")) === null || _a10 === void 0 ? void 0 : _a10.getAriaLabel();
const runCommandKeybindingLabel = (_b4 = this._keybindingService.lookupKeybinding("workbench.action.showCommands")) === null || _b4 === void 0 ? void 0 : _b4.getAriaLabel();
const keybindingEditorKeybindingLabel = (_c2 = this._keybindingService.lookupKeybinding("workbench.action.openGlobalKeybindings")) === null || _c2 === void 0 ? void 0 : _c2.getAriaLabel();
const editorNotAccessibleMessage = localize("accessibilityModeOff", "The editor is not accessible at this time.");
if (toggleKeybindingLabel) {
return localize("accessibilityOffAriaLabel", "{0} To enable screen reader optimized mode, use {1}", editorNotAccessibleMessage, toggleKeybindingLabel);
} else if (runCommandKeybindingLabel) {
return localize("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.", editorNotAccessibleMessage, runCommandKeybindingLabel);
} else if (keybindingEditorKeybindingLabel) {
return localize("accessibilityOffAriaLabelNoKbs", "{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.", editorNotAccessibleMessage, keybindingEditorKeybindingLabel);
} else {
return editorNotAccessibleMessage;
}
}
return options2.get(
4
/* EditorOption.ariaLabel */
);
}
_setAccessibilityOptions(options2) {
this._accessibilitySupport = options2.get(
2
/* EditorOption.accessibilitySupport */
);
const accessibilityPageSize = options2.get(
3
/* EditorOption.accessibilityPageSize */
);
if (this._accessibilitySupport === 2 && accessibilityPageSize === EditorOptions.accessibilityPageSize.defaultValue) {
this._accessibilityPageSize = 500;
} else {
this._accessibilityPageSize = accessibilityPageSize;
}
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const wrappingColumn = layoutInfo.wrappingColumn;
if (wrappingColumn !== -1 && this._accessibilitySupport !== 1) {
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._textAreaWrapping = true;
this._textAreaWidth = Math.round(wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth);
} else {
this._textAreaWrapping = false;
this._textAreaWidth = canUseZeroSizeTextarea ? 0 : 1;
}
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._setAccessibilityOptions(options2);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._contentHeight = layoutInfo.height;
this._fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._emptySelectionClipboard = options2.get(
37
/* EditorOption.emptySelectionClipboard */
);
this._copyWithSyntaxHighlighting = options2.get(
25
/* EditorOption.copyWithSyntaxHighlighting */
);
this.textArea.setAttribute("wrap", this._textAreaWrapping && !this._visibleTextArea ? "on" : "off");
const { tabSize } = this._context.viewModel.model.getOptions();
this.textArea.domNode.style.tabSize = `${tabSize * this._fontInfo.spaceWidth}px`;
this.textArea.setAttribute("aria-label", this._getAriaLabel(options2));
this.textArea.setAttribute("aria-required", options2.get(
5
/* EditorOption.ariaRequired */
) ? "true" : "false");
this.textArea.setAttribute("tabindex", String(options2.get(
124
/* EditorOption.tabIndex */
)));
if (e.hasChanged(
34
/* EditorOption.domReadOnly */
) || e.hasChanged(
91
/* EditorOption.readOnly */
)) {
this._ensureReadOnlyAttribute();
}
if (e.hasChanged(
2
/* EditorOption.accessibilitySupport */
)) {
this._textAreaInput.writeNativeTextAreaContent("strategy changed");
}
return true;
}
onCursorStateChanged(e) {
this._selections = e.selections.slice(0);
this._modelSelections = e.modelSelections.slice(0);
this._textAreaInput.writeNativeTextAreaContent("selection changed");
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
this._scrollLeft = e.scrollLeft;
this._scrollTop = e.scrollTop;
return true;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
// --- begin view API
isFocused() {
return this._textAreaInput.isFocused();
}
focusTextArea() {
this._textAreaInput.focusTextArea();
}
getLastRenderData() {
return this._lastRenderPosition;
}
setAriaOptions(options2) {
if (options2.activeDescendant) {
this.textArea.setAttribute("aria-haspopup", "true");
this.textArea.setAttribute("aria-autocomplete", "list");
this.textArea.setAttribute("aria-activedescendant", options2.activeDescendant);
} else {
this.textArea.setAttribute("aria-haspopup", "false");
this.textArea.setAttribute("aria-autocomplete", "both");
this.textArea.removeAttribute("aria-activedescendant");
}
if (options2.role) {
this.textArea.setAttribute("role", options2.role);
}
}
// --- end view API
_ensureReadOnlyAttribute() {
const options2 = this._context.configuration.options;
const useReadOnly = !IME.enabled || options2.get(
34
/* EditorOption.domReadOnly */
) && options2.get(
91
/* EditorOption.readOnly */
);
if (useReadOnly) {
this.textArea.setAttribute("readonly", "true");
} else {
this.textArea.removeAttribute("readonly");
}
}
prepareRender(ctx) {
var _a10;
this._primaryCursorPosition = new Position(this._selections[0].positionLineNumber, this._selections[0].positionColumn);
this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(this._primaryCursorPosition);
(_a10 = this._visibleTextArea) === null || _a10 === void 0 ? void 0 : _a10.prepareRender(ctx);
}
render(ctx) {
this._textAreaInput.writeNativeTextAreaContent("render");
this._render();
}
_render() {
var _a10;
if (this._visibleTextArea) {
const visibleStart = this._visibleTextArea.visibleTextareaStart;
const visibleEnd = this._visibleTextArea.visibleTextareaEnd;
const startPosition = this._visibleTextArea.startPosition;
const endPosition = this._visibleTextArea.endPosition;
if (startPosition && endPosition && visibleStart && visibleEnd && visibleEnd.left >= this._scrollLeft && visibleStart.left <= this._scrollLeft + this._contentWidth) {
const top2 = this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber) - this._scrollTop;
const lineCount = this._newlinecount(this.textArea.domNode.value.substr(0, this.textArea.domNode.selectionStart));
let scrollLeft = this._visibleTextArea.widthOfHiddenLineTextBefore;
let left2 = this._contentLeft + visibleStart.left - this._scrollLeft;
let width2 = visibleEnd.left - visibleStart.left + 1;
if (left2 < this._contentLeft) {
const delta = this._contentLeft - left2;
left2 += delta;
scrollLeft += delta;
width2 -= delta;
}
if (width2 > this._contentWidth) {
width2 = this._contentWidth;
}
const viewLineData = this._context.viewModel.getViewLineData(startPosition.lineNumber);
const startTokenIndex = viewLineData.tokens.findTokenIndexAtOffset(startPosition.column - 1);
const endTokenIndex = viewLineData.tokens.findTokenIndexAtOffset(endPosition.column - 1);
const textareaSpansSingleToken = startTokenIndex === endTokenIndex;
const presentation = this._visibleTextArea.definePresentation(textareaSpansSingleToken ? viewLineData.tokens.getPresentation(startTokenIndex) : null);
this.textArea.domNode.scrollTop = lineCount * this._lineHeight;
this.textArea.domNode.scrollLeft = scrollLeft;
this._doRender({
lastRenderPosition: null,
top: top2,
left: left2,
width: width2,
height: this._lineHeight,
useCover: false,
color: (TokenizationRegistry2.getColorMap() || [])[presentation.foreground],
italic: presentation.italic,
bold: presentation.bold,
underline: presentation.underline,
strikethrough: presentation.strikethrough
});
}
return;
}
if (!this._primaryCursorVisibleRange) {
this._renderAtTopLeft();
return;
}
const left = this._contentLeft + this._primaryCursorVisibleRange.left - this._scrollLeft;
if (left < this._contentLeft || left > this._contentLeft + this._contentWidth) {
this._renderAtTopLeft();
return;
}
const top = this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber) - this._scrollTop;
if (top < 0 || top > this._contentHeight) {
this._renderAtTopLeft();
return;
}
if (isMacintosh || this._accessibilitySupport === 2) {
this._doRender({
lastRenderPosition: this._primaryCursorPosition,
top,
left: this._textAreaWrapping ? this._contentLeft : left,
width: this._textAreaWidth,
height: this._lineHeight,
useCover: false
});
this.textArea.domNode.scrollLeft = this._primaryCursorVisibleRange.left;
const lineCount = (_a10 = this._textAreaInput.textAreaState.newlineCountBeforeSelection) !== null && _a10 !== void 0 ? _a10 : this._newlinecount(this.textArea.domNode.value.substr(0, this.textArea.domNode.selectionStart));
this.textArea.domNode.scrollTop = lineCount * this._lineHeight;
return;
}
this._doRender({
lastRenderPosition: this._primaryCursorPosition,
top,
left: this._textAreaWrapping ? this._contentLeft : left,
width: this._textAreaWidth,
height: canUseZeroSizeTextarea ? 0 : 1,
useCover: false
});
}
_newlinecount(text2) {
let result = 0;
let startIndex = -1;
do {
startIndex = text2.indexOf("\n", startIndex + 1);
if (startIndex === -1) {
break;
}
result++;
} while (true);
return result;
}
_renderAtTopLeft() {
this._doRender({
lastRenderPosition: null,
top: 0,
left: 0,
width: this._textAreaWidth,
height: canUseZeroSizeTextarea ? 0 : 1,
useCover: true
});
}
_doRender(renderData) {
this._lastRenderPosition = renderData.lastRenderPosition;
const ta = this.textArea;
const tac = this.textAreaCover;
applyFontInfo(ta, this._fontInfo);
ta.setTop(renderData.top);
ta.setLeft(renderData.left);
ta.setWidth(renderData.width);
ta.setHeight(renderData.height);
ta.setColor(renderData.color ? Color.Format.CSS.formatHex(renderData.color) : "");
ta.setFontStyle(renderData.italic ? "italic" : "");
if (renderData.bold) {
ta.setFontWeight("bold");
}
ta.setTextDecoration(`${renderData.underline ? " underline" : ""}${renderData.strikethrough ? " line-through" : ""}`);
tac.setTop(renderData.useCover ? renderData.top : 0);
tac.setLeft(renderData.useCover ? renderData.left : 0);
tac.setWidth(renderData.useCover ? renderData.width : 0);
tac.setHeight(renderData.useCover ? renderData.height : 0);
const options2 = this._context.configuration.options;
if (options2.get(
57
/* EditorOption.glyphMargin */
)) {
tac.setClassName("monaco-editor-background textAreaCover " + Margin.OUTER_CLASS_NAME);
} else {
if (options2.get(
68
/* EditorOption.lineNumbers */
).renderType !== 0) {
tac.setClassName("monaco-editor-background textAreaCover " + LineNumbersOverlay.CLASS_NAME);
} else {
tac.setClassName("monaco-editor-background textAreaCover");
}
}
}
};
TextAreaHandler = __decorate9([
__param8(3, IKeybindingService),
__param8(4, IInstantiationService)
], TextAreaHandler);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/indentation.js
function _normalizeIndentationFromWhitespace(str, indentSize, insertSpaces) {
let spacesCnt = 0;
for (let i = 0; i < str.length; i++) {
if (str.charAt(i) === " ") {
spacesCnt = CursorColumns.nextIndentTabStop(spacesCnt, indentSize);
} else {
spacesCnt++;
}
}
let result = "";
if (!insertSpaces) {
const tabsCnt = Math.floor(spacesCnt / indentSize);
spacesCnt = spacesCnt % indentSize;
for (let i = 0; i < tabsCnt; i++) {
result += " ";
}
}
for (let i = 0; i < spacesCnt; i++) {
result += " ";
}
return result;
}
function normalizeIndentation(str, indentSize, insertSpaces) {
let firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(str);
if (firstNonWhitespaceIndex2 === -1) {
firstNonWhitespaceIndex2 = str.length;
}
return _normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex2), indentSize, insertSpaces) + str.substring(firstNonWhitespaceIndex2);
}
var init_indentation = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/indentation.js"() {
init_strings();
init_cursorColumns();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursorCommon.js
function isQuote(ch) {
return ch === "'" || ch === '"' || ch === "`";
}
var autoCloseAlways, autoCloseNever, autoCloseBeforeWhitespace, CursorConfiguration, CursorState, PartialModelCursorState, PartialViewCursorState, SingleCursorState, EditOperationResult;
var init_cursorCommon = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursorCommon.js"() {
init_position();
init_range();
init_selection();
init_supports();
init_cursorColumns();
init_indentation();
autoCloseAlways = () => true;
autoCloseNever = () => false;
autoCloseBeforeWhitespace = (chr) => chr === " " || chr === " ";
CursorConfiguration = class {
static shouldRecreate(e) {
return e.hasChanged(
145
/* EditorOption.layoutInfo */
) || e.hasChanged(
131
/* EditorOption.wordSeparators */
) || e.hasChanged(
37
/* EditorOption.emptySelectionClipboard */
) || e.hasChanged(
77
/* EditorOption.multiCursorMergeOverlapping */
) || e.hasChanged(
79
/* EditorOption.multiCursorPaste */
) || e.hasChanged(
80
/* EditorOption.multiCursorLimit */
) || e.hasChanged(
6
/* EditorOption.autoClosingBrackets */
) || e.hasChanged(
7
/* EditorOption.autoClosingComments */
) || e.hasChanged(
11
/* EditorOption.autoClosingQuotes */
) || e.hasChanged(
9
/* EditorOption.autoClosingDelete */
) || e.hasChanged(
10
/* EditorOption.autoClosingOvertype */
) || e.hasChanged(
14
/* EditorOption.autoSurround */
) || e.hasChanged(
128
/* EditorOption.useTabStops */
) || e.hasChanged(
50
/* EditorOption.fontInfo */
) || e.hasChanged(
91
/* EditorOption.readOnly */
) || e.hasChanged(
130
/* EditorOption.wordSegmenterLocales */
);
}
constructor(languageId, modelOptions, configuration, languageConfigurationService) {
var _a10;
this.languageConfigurationService = languageConfigurationService;
this._cursorMoveConfigurationBrand = void 0;
this._languageId = languageId;
const options2 = configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this.readOnly = options2.get(
91
/* EditorOption.readOnly */
);
this.tabSize = modelOptions.tabSize;
this.indentSize = modelOptions.indentSize;
this.insertSpaces = modelOptions.insertSpaces;
this.stickyTabStops = options2.get(
116
/* EditorOption.stickyTabStops */
);
this.lineHeight = fontInfo.lineHeight;
this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this.pageSize = Math.max(1, Math.floor(layoutInfo.height / this.lineHeight) - 2);
this.useTabStops = options2.get(
128
/* EditorOption.useTabStops */
);
this.wordSeparators = options2.get(
131
/* EditorOption.wordSeparators */
);
this.emptySelectionClipboard = options2.get(
37
/* EditorOption.emptySelectionClipboard */
);
this.copyWithSyntaxHighlighting = options2.get(
25
/* EditorOption.copyWithSyntaxHighlighting */
);
this.multiCursorMergeOverlapping = options2.get(
77
/* EditorOption.multiCursorMergeOverlapping */
);
this.multiCursorPaste = options2.get(
79
/* EditorOption.multiCursorPaste */
);
this.multiCursorLimit = options2.get(
80
/* EditorOption.multiCursorLimit */
);
this.autoClosingBrackets = options2.get(
6
/* EditorOption.autoClosingBrackets */
);
this.autoClosingComments = options2.get(
7
/* EditorOption.autoClosingComments */
);
this.autoClosingQuotes = options2.get(
11
/* EditorOption.autoClosingQuotes */
);
this.autoClosingDelete = options2.get(
9
/* EditorOption.autoClosingDelete */
);
this.autoClosingOvertype = options2.get(
10
/* EditorOption.autoClosingOvertype */
);
this.autoSurround = options2.get(
14
/* EditorOption.autoSurround */
);
this.autoIndent = options2.get(
12
/* EditorOption.autoIndent */
);
this.wordSegmenterLocales = options2.get(
130
/* EditorOption.wordSegmenterLocales */
);
this.surroundingPairs = {};
this._electricChars = null;
this.shouldAutoCloseBefore = {
quote: this._getShouldAutoClose(languageId, this.autoClosingQuotes, true),
comment: this._getShouldAutoClose(languageId, this.autoClosingComments, false),
bracket: this._getShouldAutoClose(languageId, this.autoClosingBrackets, false)
};
this.autoClosingPairs = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoClosingPairs();
const surroundingPairs = this.languageConfigurationService.getLanguageConfiguration(languageId).getSurroundingPairs();
if (surroundingPairs) {
for (const pair of surroundingPairs) {
this.surroundingPairs[pair.open] = pair.close;
}
}
const commentsConfiguration = this.languageConfigurationService.getLanguageConfiguration(languageId).comments;
this.blockCommentStartToken = (_a10 = commentsConfiguration === null || commentsConfiguration === void 0 ? void 0 : commentsConfiguration.blockCommentStartToken) !== null && _a10 !== void 0 ? _a10 : null;
}
get electricChars() {
var _a10;
if (!this._electricChars) {
this._electricChars = {};
const electricChars = (_a10 = this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter) === null || _a10 === void 0 ? void 0 : _a10.getElectricCharacters();
if (electricChars) {
for (const char of electricChars) {
this._electricChars[char] = true;
}
}
}
return this._electricChars;
}
/**
* Should return opening bracket type to match indentation with
*/
onElectricCharacter(character, context, column) {
const scopedLineTokens = createScopedLineTokens(context, column - 1);
const electricCharacterSupport = this.languageConfigurationService.getLanguageConfiguration(scopedLineTokens.languageId).electricCharacter;
if (!electricCharacterSupport) {
return null;
}
return electricCharacterSupport.onElectricCharacter(character, scopedLineTokens, column - scopedLineTokens.firstCharOffset);
}
normalizeIndentation(str) {
return normalizeIndentation(str, this.indentSize, this.insertSpaces);
}
_getShouldAutoClose(languageId, autoCloseConfig, forQuotes) {
switch (autoCloseConfig) {
case "beforeWhitespace":
return autoCloseBeforeWhitespace;
case "languageDefined":
return this._getLanguageDefinedShouldAutoClose(languageId, forQuotes);
case "always":
return autoCloseAlways;
case "never":
return autoCloseNever;
}
}
_getLanguageDefinedShouldAutoClose(languageId, forQuotes) {
const autoCloseBeforeSet = this.languageConfigurationService.getLanguageConfiguration(languageId).getAutoCloseBeforeSet(forQuotes);
return (c) => autoCloseBeforeSet.indexOf(c) !== -1;
}
/**
* Returns a visible column from a column.
* @see {@link CursorColumns}
*/
visibleColumnFromColumn(model, position) {
return CursorColumns.visibleColumnFromColumn(model.getLineContent(position.lineNumber), position.column, this.tabSize);
}
/**
* Returns a visible column from a column.
* @see {@link CursorColumns}
*/
columnFromVisibleColumn(model, lineNumber, visibleColumn) {
const result = CursorColumns.columnFromVisibleColumn(model.getLineContent(lineNumber), visibleColumn, this.tabSize);
const minColumn = model.getLineMinColumn(lineNumber);
if (result < minColumn) {
return minColumn;
}
const maxColumn = model.getLineMaxColumn(lineNumber);
if (result > maxColumn) {
return maxColumn;
}
return result;
}
};
CursorState = class _CursorState {
static fromModelState(modelState) {
return new PartialModelCursorState(modelState);
}
static fromViewState(viewState) {
return new PartialViewCursorState(viewState);
}
static fromModelSelection(modelSelection) {
const selection = Selection.liftSelection(modelSelection);
const modelState = new SingleCursorState(Range.fromPositions(selection.getSelectionStart()), 0, 0, selection.getPosition(), 0);
return _CursorState.fromModelState(modelState);
}
static fromModelSelections(modelSelections) {
const states = [];
for (let i = 0, len = modelSelections.length; i < len; i++) {
states[i] = this.fromModelSelection(modelSelections[i]);
}
return states;
}
constructor(modelState, viewState) {
this._cursorStateBrand = void 0;
this.modelState = modelState;
this.viewState = viewState;
}
equals(other) {
return this.viewState.equals(other.viewState) && this.modelState.equals(other.modelState);
}
};
PartialModelCursorState = class {
constructor(modelState) {
this.modelState = modelState;
this.viewState = null;
}
};
PartialViewCursorState = class {
constructor(viewState) {
this.modelState = null;
this.viewState = viewState;
}
};
SingleCursorState = class _SingleCursorState {
constructor(selectionStart, selectionStartKind, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns) {
this.selectionStart = selectionStart;
this.selectionStartKind = selectionStartKind;
this.selectionStartLeftoverVisibleColumns = selectionStartLeftoverVisibleColumns;
this.position = position;
this.leftoverVisibleColumns = leftoverVisibleColumns;
this._singleCursorStateBrand = void 0;
this.selection = _SingleCursorState._computeSelection(this.selectionStart, this.position);
}
equals(other) {
return this.selectionStartLeftoverVisibleColumns === other.selectionStartLeftoverVisibleColumns && this.leftoverVisibleColumns === other.leftoverVisibleColumns && this.selectionStartKind === other.selectionStartKind && this.position.equals(other.position) && this.selectionStart.equalsRange(other.selectionStart);
}
hasSelection() {
return !this.selection.isEmpty() || !this.selectionStart.isEmpty();
}
move(inSelectionMode, lineNumber, column, leftoverVisibleColumns) {
if (inSelectionMode) {
return new _SingleCursorState(this.selectionStart, this.selectionStartKind, this.selectionStartLeftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);
} else {
return new _SingleCursorState(new Range(lineNumber, column, lineNumber, column), 0, leftoverVisibleColumns, new Position(lineNumber, column), leftoverVisibleColumns);
}
}
static _computeSelection(selectionStart, position) {
if (selectionStart.isEmpty() || !position.isBeforeOrEqual(selectionStart.getStartPosition())) {
return Selection.fromPositions(selectionStart.getStartPosition(), position);
} else {
return Selection.fromPositions(selectionStart.getEndPosition(), position);
}
}
};
EditOperationResult = class {
constructor(type, commands, opts) {
this._editOperationResultBrand = void 0;
this.type = type;
this.commands = commands;
this.shouldPushStackElementBefore = opts.shouldPushStackElementBefore;
this.shouldPushStackElementAfter = opts.shouldPushStackElementAfter;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorColumnSelection.js
var ColumnSelection;
var init_cursorColumnSelection = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorColumnSelection.js"() {
init_cursorCommon();
init_position();
init_range();
ColumnSelection = class _ColumnSelection {
static columnSelect(config, model, fromLineNumber, fromVisibleColumn, toLineNumber, toVisibleColumn) {
const lineCount = Math.abs(toLineNumber - fromLineNumber) + 1;
const reversed = fromLineNumber > toLineNumber;
const isRTL = fromVisibleColumn > toVisibleColumn;
const isLTR = fromVisibleColumn < toVisibleColumn;
const result = [];
for (let i = 0; i < lineCount; i++) {
const lineNumber = fromLineNumber + (reversed ? -i : i);
const startColumn = config.columnFromVisibleColumn(model, lineNumber, fromVisibleColumn);
const endColumn = config.columnFromVisibleColumn(model, lineNumber, toVisibleColumn);
const visibleStartColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, startColumn));
const visibleEndColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, endColumn));
if (isLTR) {
if (visibleStartColumn > toVisibleColumn) {
continue;
}
if (visibleEndColumn < fromVisibleColumn) {
continue;
}
}
if (isRTL) {
if (visibleEndColumn > fromVisibleColumn) {
continue;
}
if (visibleStartColumn < toVisibleColumn) {
continue;
}
}
result.push(new SingleCursorState(new Range(lineNumber, startColumn, lineNumber, startColumn), 0, 0, new Position(lineNumber, endColumn), 0));
}
if (result.length === 0) {
for (let i = 0; i < lineCount; i++) {
const lineNumber = fromLineNumber + (reversed ? -i : i);
const maxColumn = model.getLineMaxColumn(lineNumber);
result.push(new SingleCursorState(new Range(lineNumber, maxColumn, lineNumber, maxColumn), 0, 0, new Position(lineNumber, maxColumn), 0));
}
}
return {
viewStates: result,
reversed,
fromLineNumber,
fromVisualColumn: fromVisibleColumn,
toLineNumber,
toVisualColumn: toVisibleColumn
};
}
static columnSelectLeft(config, model, prevColumnSelectData) {
let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;
if (toViewVisualColumn > 0) {
toViewVisualColumn--;
}
return _ColumnSelection.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);
}
static columnSelectRight(config, model, prevColumnSelectData) {
let maxVisualViewColumn = 0;
const minViewLineNumber = Math.min(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);
const maxViewLineNumber = Math.max(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);
for (let lineNumber = minViewLineNumber; lineNumber <= maxViewLineNumber; lineNumber++) {
const lineMaxViewColumn = model.getLineMaxColumn(lineNumber);
const lineMaxVisualViewColumn = config.visibleColumnFromColumn(model, new Position(lineNumber, lineMaxViewColumn));
maxVisualViewColumn = Math.max(maxVisualViewColumn, lineMaxVisualViewColumn);
}
let toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;
if (toViewVisualColumn < maxVisualViewColumn) {
toViewVisualColumn++;
}
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);
}
static columnSelectUp(config, model, prevColumnSelectData, isPaged) {
const linesCount = isPaged ? config.pageSize : 1;
const toViewLineNumber = Math.max(1, prevColumnSelectData.toViewLineNumber - linesCount);
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);
}
static columnSelectDown(config, model, prevColumnSelectData, isPaged) {
const linesCount = isPaged ? config.pageSize : 1;
const toViewLineNumber = Math.min(model.getLineCount(), prevColumnSelectData.toViewLineNumber + linesCount);
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/commands/replaceCommand.js
var ReplaceCommand, ReplaceCommandThatSelectsText, ReplaceCommandWithoutChangingPosition, ReplaceCommandWithOffsetCursorState, ReplaceCommandThatPreservesSelection;
var init_replaceCommand = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/commands/replaceCommand.js"() {
init_selection();
ReplaceCommand = class {
constructor(range2, text2, insertsAutoWhitespace = false) {
this._range = range2;
this._text = text2;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const srcRange = inverseEditOperations[0].range;
return Selection.fromPositions(srcRange.getEndPosition());
}
};
ReplaceCommandThatSelectsText = class {
constructor(range2, text2) {
this._range = range2;
this._text = text2;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const srcRange = inverseEditOperations[0].range;
return Selection.fromRange(
srcRange,
0
/* SelectionDirection.LTR */
);
}
};
ReplaceCommandWithoutChangingPosition = class {
constructor(range2, text2, insertsAutoWhitespace = false) {
this._range = range2;
this._text = text2;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const srcRange = inverseEditOperations[0].range;
return Selection.fromPositions(srcRange.getStartPosition());
}
};
ReplaceCommandWithOffsetCursorState = class {
constructor(range2, text2, lineNumberDeltaOffset, columnDeltaOffset, insertsAutoWhitespace = false) {
this._range = range2;
this._text = text2;
this._columnDeltaOffset = columnDeltaOffset;
this._lineNumberDeltaOffset = lineNumberDeltaOffset;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const srcRange = inverseEditOperations[0].range;
return Selection.fromPositions(srcRange.getEndPosition().delta(this._lineNumberDeltaOffset, this._columnDeltaOffset));
}
};
ReplaceCommandThatPreservesSelection = class {
constructor(editRange, text2, initialSelection, forceMoveMarkers = false) {
this._range = editRange;
this._text = text2;
this._initialSelection = initialSelection;
this._forceMoveMarkers = forceMoveMarkers;
this._selectionId = null;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(this._range, this._text, this._forceMoveMarkers);
this._selectionId = builder.trackSelection(this._initialSelection);
}
computeCursorState(model, helper) {
return helper.getTrackedSelection(this._selectionId);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveOperations.js
var CursorPosition, MoveOperations;
var init_cursorMoveOperations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveOperations.js"() {
init_strings();
init_cursorColumns();
init_position();
init_range();
init_cursorAtomicMoveOperations();
init_cursorCommon();
CursorPosition = class {
constructor(lineNumber, column, leftoverVisibleColumns) {
this._cursorPositionBrand = void 0;
this.lineNumber = lineNumber;
this.column = column;
this.leftoverVisibleColumns = leftoverVisibleColumns;
}
};
MoveOperations = class _MoveOperations {
static leftPosition(model, position) {
if (position.column > model.getLineMinColumn(position.lineNumber)) {
return position.delta(void 0, -prevCharLength(model.getLineContent(position.lineNumber), position.column - 1));
} else if (position.lineNumber > 1) {
const newLineNumber = position.lineNumber - 1;
return new Position(newLineNumber, model.getLineMaxColumn(newLineNumber));
} else {
return position;
}
}
static leftPositionAtomicSoftTabs(model, position, tabSize) {
if (position.column <= model.getLineIndentColumn(position.lineNumber)) {
const minColumn = model.getLineMinColumn(position.lineNumber);
const lineContent = model.getLineContent(position.lineNumber);
const newPosition = AtomicTabMoveOperations.atomicPosition(
lineContent,
position.column - 1,
tabSize,
0
/* Direction.Left */
);
if (newPosition !== -1 && newPosition + 1 >= minColumn) {
return new Position(position.lineNumber, newPosition + 1);
}
}
return this.leftPosition(model, position);
}
static left(config, model, position) {
const pos = config.stickyTabStops ? _MoveOperations.leftPositionAtomicSoftTabs(model, position, config.tabSize) : _MoveOperations.leftPosition(model, position);
return new CursorPosition(pos.lineNumber, pos.column, 0);
}
/**
* @param noOfColumns Must be either `1`
* or `Math.round(viewModel.getLineContent(viewLineNumber).length / 2)` (for half lines).
*/
static moveLeft(config, model, cursor, inSelectionMode, noOfColumns) {
let lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
lineNumber = cursor.selection.startLineNumber;
column = cursor.selection.startColumn;
} else {
const pos = cursor.position.delta(void 0, -(noOfColumns - 1));
const normalizedPos = model.normalizePosition(
_MoveOperations.clipPositionColumn(pos, model),
0
/* PositionAffinity.Left */
);
const p = _MoveOperations.left(config, model, normalizedPos);
lineNumber = p.lineNumber;
column = p.column;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
}
/**
* Adjusts the column so that it is within min/max of the line.
*/
static clipPositionColumn(position, model) {
return new Position(position.lineNumber, _MoveOperations.clipRange(position.column, model.getLineMinColumn(position.lineNumber), model.getLineMaxColumn(position.lineNumber)));
}
static clipRange(value, min, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
}
static rightPosition(model, lineNumber, column) {
if (column < model.getLineMaxColumn(lineNumber)) {
column = column + nextCharLength(model.getLineContent(lineNumber), column - 1);
} else if (lineNumber < model.getLineCount()) {
lineNumber = lineNumber + 1;
column = model.getLineMinColumn(lineNumber);
}
return new Position(lineNumber, column);
}
static rightPositionAtomicSoftTabs(model, lineNumber, column, tabSize, indentSize) {
if (column < model.getLineIndentColumn(lineNumber)) {
const lineContent = model.getLineContent(lineNumber);
const newPosition = AtomicTabMoveOperations.atomicPosition(
lineContent,
column - 1,
tabSize,
1
/* Direction.Right */
);
if (newPosition !== -1) {
return new Position(lineNumber, newPosition + 1);
}
}
return this.rightPosition(model, lineNumber, column);
}
static right(config, model, position) {
const pos = config.stickyTabStops ? _MoveOperations.rightPositionAtomicSoftTabs(model, position.lineNumber, position.column, config.tabSize, config.indentSize) : _MoveOperations.rightPosition(model, position.lineNumber, position.column);
return new CursorPosition(pos.lineNumber, pos.column, 0);
}
static moveRight(config, model, cursor, inSelectionMode, noOfColumns) {
let lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
lineNumber = cursor.selection.endLineNumber;
column = cursor.selection.endColumn;
} else {
const pos = cursor.position.delta(void 0, noOfColumns - 1);
const normalizedPos = model.normalizePosition(
_MoveOperations.clipPositionColumn(pos, model),
1
/* PositionAffinity.Right */
);
const r = _MoveOperations.right(config, model, normalizedPos);
lineNumber = r.lineNumber;
column = r.column;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
}
static vertical(config, model, lineNumber, column, leftoverVisibleColumns, newLineNumber, allowMoveOnEdgeLine, normalizationAffinity) {
const currentVisibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;
const lineCount = model.getLineCount();
const wasOnFirstPosition = lineNumber === 1 && column === 1;
const wasOnLastPosition = lineNumber === lineCount && column === model.getLineMaxColumn(lineNumber);
const wasAtEdgePosition = newLineNumber < lineNumber ? wasOnFirstPosition : wasOnLastPosition;
lineNumber = newLineNumber;
if (lineNumber < 1) {
lineNumber = 1;
if (allowMoveOnEdgeLine) {
column = model.getLineMinColumn(lineNumber);
} else {
column = Math.min(model.getLineMaxColumn(lineNumber), column);
}
} else if (lineNumber > lineCount) {
lineNumber = lineCount;
if (allowMoveOnEdgeLine) {
column = model.getLineMaxColumn(lineNumber);
} else {
column = Math.min(model.getLineMaxColumn(lineNumber), column);
}
} else {
column = config.columnFromVisibleColumn(model, lineNumber, currentVisibleColumn);
}
if (wasAtEdgePosition) {
leftoverVisibleColumns = 0;
} else {
leftoverVisibleColumns = currentVisibleColumn - CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);
}
if (normalizationAffinity !== void 0) {
const position = new Position(lineNumber, column);
const newPosition = model.normalizePosition(position, normalizationAffinity);
leftoverVisibleColumns = leftoverVisibleColumns + (column - newPosition.column);
lineNumber = newPosition.lineNumber;
column = newPosition.column;
}
return new CursorPosition(lineNumber, column, leftoverVisibleColumns);
}
static down(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnLastLine) {
return this.vertical(
config,
model,
lineNumber,
column,
leftoverVisibleColumns,
lineNumber + count,
allowMoveOnLastLine,
4
/* PositionAffinity.RightOfInjectedText */
);
}
static moveDown(config, model, cursor, inSelectionMode, linesCount) {
let lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
lineNumber = cursor.selection.endLineNumber;
column = cursor.selection.endColumn;
} else {
lineNumber = cursor.position.lineNumber;
column = cursor.position.column;
}
let i = 0;
let r;
do {
r = _MoveOperations.down(config, model, lineNumber + i, column, cursor.leftoverVisibleColumns, linesCount, true);
const np = model.normalizePosition(
new Position(r.lineNumber, r.column),
2
/* PositionAffinity.None */
);
if (np.lineNumber > lineNumber) {
break;
}
} while (i++ < 10 && lineNumber + i < model.getLineCount());
return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);
}
static translateDown(config, model, cursor) {
const selection = cursor.selection;
const selectionStart = _MoveOperations.down(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);
const position = _MoveOperations.down(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);
return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), 0, selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);
}
static up(config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnFirstLine) {
return this.vertical(
config,
model,
lineNumber,
column,
leftoverVisibleColumns,
lineNumber - count,
allowMoveOnFirstLine,
3
/* PositionAffinity.LeftOfInjectedText */
);
}
static moveUp(config, model, cursor, inSelectionMode, linesCount) {
let lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
lineNumber = cursor.selection.startLineNumber;
column = cursor.selection.startColumn;
} else {
lineNumber = cursor.position.lineNumber;
column = cursor.position.column;
}
const r = _MoveOperations.up(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);
return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);
}
static translateUp(config, model, cursor) {
const selection = cursor.selection;
const selectionStart = _MoveOperations.up(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);
const position = _MoveOperations.up(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);
return new SingleCursorState(new Range(selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), 0, selectionStart.leftoverVisibleColumns, new Position(position.lineNumber, position.column), position.leftoverVisibleColumns);
}
static _isBlankLine(model, lineNumber) {
if (model.getLineFirstNonWhitespaceColumn(lineNumber) === 0) {
return true;
}
return false;
}
static moveToPrevBlankLine(config, model, cursor, inSelectionMode) {
let lineNumber = cursor.position.lineNumber;
while (lineNumber > 1 && this._isBlankLine(model, lineNumber)) {
lineNumber--;
}
while (lineNumber > 1 && !this._isBlankLine(model, lineNumber)) {
lineNumber--;
}
return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);
}
static moveToNextBlankLine(config, model, cursor, inSelectionMode) {
const lineCount = model.getLineCount();
let lineNumber = cursor.position.lineNumber;
while (lineNumber < lineCount && this._isBlankLine(model, lineNumber)) {
lineNumber++;
}
while (lineNumber < lineCount && !this._isBlankLine(model, lineNumber)) {
lineNumber++;
}
return cursor.move(inSelectionMode, lineNumber, model.getLineMinColumn(lineNumber), 0);
}
static moveToBeginningOfLine(config, model, cursor, inSelectionMode) {
const lineNumber = cursor.position.lineNumber;
const minColumn = model.getLineMinColumn(lineNumber);
const firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;
let column;
const relevantColumnNumber = cursor.position.column;
if (relevantColumnNumber === firstNonBlankColumn) {
column = minColumn;
} else {
column = firstNonBlankColumn;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
}
static moveToEndOfLine(config, model, cursor, inSelectionMode, sticky) {
const lineNumber = cursor.position.lineNumber;
const maxColumn = model.getLineMaxColumn(lineNumber);
return cursor.move(inSelectionMode, lineNumber, maxColumn, sticky ? 1073741824 - maxColumn : 0);
}
static moveToBeginningOfBuffer(config, model, cursor, inSelectionMode) {
return cursor.move(inSelectionMode, 1, 1, 0);
}
static moveToEndOfBuffer(config, model, cursor, inSelectionMode) {
const lastLineNumber = model.getLineCount();
const lastColumn = model.getLineMaxColumn(lastLineNumber);
return cursor.move(inSelectionMode, lastLineNumber, lastColumn, 0);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorDeleteOperations.js
var DeleteOperations;
var init_cursorDeleteOperations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorDeleteOperations.js"() {
init_strings();
init_replaceCommand();
init_cursorCommon();
init_cursorColumns();
init_cursorMoveOperations();
init_range();
init_position();
DeleteOperations = class _DeleteOperations {
static deleteRight(prevEditOperationType, config, model, selections) {
const commands = [];
let shouldPushStackElementBefore = prevEditOperationType !== 3;
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
let deleteSelection = selection;
if (deleteSelection.isEmpty()) {
const position = selection.getPosition();
const rightOfPosition = MoveOperations.right(config, model, position);
deleteSelection = new Range(rightOfPosition.lineNumber, rightOfPosition.column, position.lineNumber, position.column);
}
if (deleteSelection.isEmpty()) {
commands[i] = null;
continue;
}
if (deleteSelection.startLineNumber !== deleteSelection.endLineNumber) {
shouldPushStackElementBefore = true;
}
commands[i] = new ReplaceCommand(deleteSelection, "");
}
return [shouldPushStackElementBefore, commands];
}
static isAutoClosingPairDelete(autoClosingDelete, autoClosingBrackets, autoClosingQuotes, autoClosingPairsOpen, model, selections, autoClosedCharacters) {
if (autoClosingBrackets === "never" && autoClosingQuotes === "never") {
return false;
}
if (autoClosingDelete === "never") {
return false;
}
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
const position = selection.getPosition();
if (!selection.isEmpty()) {
return false;
}
const lineText = model.getLineContent(position.lineNumber);
if (position.column < 2 || position.column >= lineText.length + 1) {
return false;
}
const character = lineText.charAt(position.column - 2);
const autoClosingPairCandidates = autoClosingPairsOpen.get(character);
if (!autoClosingPairCandidates) {
return false;
}
if (isQuote(character)) {
if (autoClosingQuotes === "never") {
return false;
}
} else {
if (autoClosingBrackets === "never") {
return false;
}
}
const afterCharacter = lineText.charAt(position.column - 1);
let foundAutoClosingPair = false;
for (const autoClosingPairCandidate of autoClosingPairCandidates) {
if (autoClosingPairCandidate.open === character && autoClosingPairCandidate.close === afterCharacter) {
foundAutoClosingPair = true;
}
}
if (!foundAutoClosingPair) {
return false;
}
if (autoClosingDelete === "auto") {
let found = false;
for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {
const autoClosedCharacter = autoClosedCharacters[j];
if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
return true;
}
static _runAutoClosingPairDelete(config, model, selections) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const position = selections[i].getPosition();
const deleteSelection = new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column + 1);
commands[i] = new ReplaceCommand(deleteSelection, "");
}
return [true, commands];
}
static deleteLeft(prevEditOperationType, config, model, selections, autoClosedCharacters) {
if (this.isAutoClosingPairDelete(config.autoClosingDelete, config.autoClosingBrackets, config.autoClosingQuotes, config.autoClosingPairs.autoClosingPairsOpenByEnd, model, selections, autoClosedCharacters)) {
return this._runAutoClosingPairDelete(config, model, selections);
}
const commands = [];
let shouldPushStackElementBefore = prevEditOperationType !== 2;
for (let i = 0, len = selections.length; i < len; i++) {
const deleteRange = _DeleteOperations.getDeleteRange(selections[i], model, config);
if (deleteRange.isEmpty()) {
commands[i] = null;
continue;
}
if (deleteRange.startLineNumber !== deleteRange.endLineNumber) {
shouldPushStackElementBefore = true;
}
commands[i] = new ReplaceCommand(deleteRange, "");
}
return [shouldPushStackElementBefore, commands];
}
static getDeleteRange(selection, model, config) {
if (!selection.isEmpty()) {
return selection;
}
const position = selection.getPosition();
if (config.useTabStops && position.column > 1) {
const lineContent = model.getLineContent(position.lineNumber);
const firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(lineContent);
const lastIndentationColumn = firstNonWhitespaceIndex2 === -1 ? (
/* entire string is whitespace */
lineContent.length + 1
) : firstNonWhitespaceIndex2 + 1;
if (position.column <= lastIndentationColumn) {
const fromVisibleColumn = config.visibleColumnFromColumn(model, position);
const toVisibleColumn = CursorColumns.prevIndentTabStop(fromVisibleColumn, config.indentSize);
const toColumn = config.columnFromVisibleColumn(model, position.lineNumber, toVisibleColumn);
return new Range(position.lineNumber, toColumn, position.lineNumber, position.column);
}
}
return Range.fromPositions(_DeleteOperations.getPositionAfterDeleteLeft(position, model), position);
}
static getPositionAfterDeleteLeft(position, model) {
if (position.column > 1) {
const idx = getLeftDeleteOffset(position.column - 1, model.getLineContent(position.lineNumber));
return position.with(void 0, idx + 1);
} else if (position.lineNumber > 1) {
const newLine = position.lineNumber - 1;
return new Position(newLine, model.getLineMaxColumn(newLine));
} else {
return position;
}
}
static cut(config, model, selections) {
const commands = [];
let lastCutRange = null;
selections.sort((a3, b) => Position.compare(a3.getStartPosition(), b.getEndPosition()));
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
if (selection.isEmpty()) {
if (config.emptySelectionClipboard) {
const position = selection.getPosition();
let startLineNumber, startColumn, endLineNumber, endColumn;
if (position.lineNumber < model.getLineCount()) {
startLineNumber = position.lineNumber;
startColumn = 1;
endLineNumber = position.lineNumber + 1;
endColumn = 1;
} else if (position.lineNumber > 1 && (lastCutRange === null || lastCutRange === void 0 ? void 0 : lastCutRange.endLineNumber) !== position.lineNumber) {
startLineNumber = position.lineNumber - 1;
startColumn = model.getLineMaxColumn(position.lineNumber - 1);
endLineNumber = position.lineNumber;
endColumn = model.getLineMaxColumn(position.lineNumber);
} else {
startLineNumber = position.lineNumber;
startColumn = 1;
endLineNumber = position.lineNumber;
endColumn = model.getLineMaxColumn(position.lineNumber);
}
const deleteSelection = new Range(startLineNumber, startColumn, endLineNumber, endColumn);
lastCutRange = deleteSelection;
if (!deleteSelection.isEmpty()) {
commands[i] = new ReplaceCommand(deleteSelection, "");
} else {
commands[i] = null;
}
} else {
commands[i] = null;
}
} else {
commands[i] = new ReplaceCommand(selection, "");
}
}
return new EditOperationResult(0, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorWordOperations.js
function enforceDefined(arr) {
return arr.filter((el) => Boolean(el));
}
var WordOperations, WordPartOperations;
var init_cursorWordOperations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorWordOperations.js"() {
init_strings();
init_cursorCommon();
init_cursorDeleteOperations();
init_wordCharacterClassifier();
init_position();
init_range();
WordOperations = class _WordOperations {
static _createWord(lineContent, wordType, nextCharClass, start, end) {
return { start, end, wordType, nextCharClass };
}
static _createIntlWord(intlWord, nextCharClass) {
return { start: intlWord.index, end: intlWord.index + intlWord.segment.length, wordType: 1, nextCharClass };
}
static _findPreviousWordOnLine(wordSeparators2, model, position) {
const lineContent = model.getLineContent(position.lineNumber);
return this._doFindPreviousWordOnLine(lineContent, wordSeparators2, position);
}
static _doFindPreviousWordOnLine(lineContent, wordSeparators2, position) {
let wordType = 0;
const previousIntlWord = wordSeparators2.findPrevIntlWordBeforeOrAtOffset(lineContent, position.column - 2);
for (let chIndex = position.column - 2; chIndex >= 0; chIndex--) {
const chCode = lineContent.charCodeAt(chIndex);
const chClass = wordSeparators2.get(chCode);
if (previousIntlWord && chIndex === previousIntlWord.index) {
return this._createIntlWord(previousIntlWord, chClass);
}
if (chClass === 0) {
if (wordType === 2) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators2, wordType, chIndex + 1));
}
wordType = 1;
} else if (chClass === 2) {
if (wordType === 1) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators2, wordType, chIndex + 1));
}
wordType = 2;
} else if (chClass === 1) {
if (wordType !== 0) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators2, wordType, chIndex + 1));
}
}
}
if (wordType !== 0) {
return this._createWord(lineContent, wordType, 1, 0, this._findEndOfWord(lineContent, wordSeparators2, wordType, 0));
}
return null;
}
static _findEndOfWord(lineContent, wordSeparators2, wordType, startIndex) {
const nextIntlWord = wordSeparators2.findNextIntlWordAtOrAfterOffset(lineContent, startIndex);
const len = lineContent.length;
for (let chIndex = startIndex; chIndex < len; chIndex++) {
const chCode = lineContent.charCodeAt(chIndex);
const chClass = wordSeparators2.get(chCode);
if (nextIntlWord && chIndex === nextIntlWord.index + nextIntlWord.segment.length) {
return chIndex;
}
if (chClass === 1) {
return chIndex;
}
if (wordType === 1 && chClass === 2) {
return chIndex;
}
if (wordType === 2 && chClass === 0) {
return chIndex;
}
}
return len;
}
static _findNextWordOnLine(wordSeparators2, model, position) {
const lineContent = model.getLineContent(position.lineNumber);
return this._doFindNextWordOnLine(lineContent, wordSeparators2, position);
}
static _doFindNextWordOnLine(lineContent, wordSeparators2, position) {
let wordType = 0;
const len = lineContent.length;
const nextIntlWord = wordSeparators2.findNextIntlWordAtOrAfterOffset(lineContent, position.column - 1);
for (let chIndex = position.column - 1; chIndex < len; chIndex++) {
const chCode = lineContent.charCodeAt(chIndex);
const chClass = wordSeparators2.get(chCode);
if (nextIntlWord && chIndex === nextIntlWord.index) {
return this._createIntlWord(nextIntlWord, chClass);
}
if (chClass === 0) {
if (wordType === 2) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators2, wordType, chIndex - 1), chIndex);
}
wordType = 1;
} else if (chClass === 2) {
if (wordType === 1) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators2, wordType, chIndex - 1), chIndex);
}
wordType = 2;
} else if (chClass === 1) {
if (wordType !== 0) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators2, wordType, chIndex - 1), chIndex);
}
}
}
if (wordType !== 0) {
return this._createWord(lineContent, wordType, 1, this._findStartOfWord(lineContent, wordSeparators2, wordType, len - 1), len);
}
return null;
}
static _findStartOfWord(lineContent, wordSeparators2, wordType, startIndex) {
const previousIntlWord = wordSeparators2.findPrevIntlWordBeforeOrAtOffset(lineContent, startIndex);
for (let chIndex = startIndex; chIndex >= 0; chIndex--) {
const chCode = lineContent.charCodeAt(chIndex);
const chClass = wordSeparators2.get(chCode);
if (previousIntlWord && chIndex === previousIntlWord.index) {
return chIndex;
}
if (chClass === 1) {
return chIndex + 1;
}
if (wordType === 1 && chClass === 2) {
return chIndex + 1;
}
if (wordType === 2 && chClass === 0) {
return chIndex + 1;
}
}
return 0;
}
static moveWordLeft(wordSeparators2, model, position, wordNavigationType) {
let lineNumber = position.lineNumber;
let column = position.column;
if (column === 1) {
if (lineNumber > 1) {
lineNumber = lineNumber - 1;
column = model.getLineMaxColumn(lineNumber);
}
}
let prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, new Position(lineNumber, column));
if (wordNavigationType === 0) {
return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
if (wordNavigationType === 1) {
if (prevWordOnLine && prevWordOnLine.wordType === 2 && prevWordOnLine.end - prevWordOnLine.start === 1 && prevWordOnLine.nextCharClass === 0) {
prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, new Position(lineNumber, prevWordOnLine.start + 1));
}
return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
if (wordNavigationType === 3) {
while (prevWordOnLine && prevWordOnLine.wordType === 2) {
prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, new Position(lineNumber, prevWordOnLine.start + 1));
}
return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
if (prevWordOnLine && column <= prevWordOnLine.end + 1) {
prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, new Position(lineNumber, prevWordOnLine.start + 1));
}
return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.end + 1 : 1);
}
static _moveWordPartLeft(model, position) {
const lineNumber = position.lineNumber;
const maxColumn = model.getLineMaxColumn(lineNumber);
if (position.column === 1) {
return lineNumber > 1 ? new Position(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)) : position;
}
const lineContent = model.getLineContent(lineNumber);
for (let column = position.column - 1; column > 1; column--) {
const left = lineContent.charCodeAt(column - 2);
const right = lineContent.charCodeAt(column - 1);
if (left === 95 && right !== 95) {
return new Position(lineNumber, column);
}
if (left === 45 && right !== 45) {
return new Position(lineNumber, column);
}
if ((isLowerAsciiLetter(left) || isAsciiDigit(left)) && isUpperAsciiLetter(right)) {
return new Position(lineNumber, column);
}
if (isUpperAsciiLetter(left) && isUpperAsciiLetter(right)) {
if (column + 1 < maxColumn) {
const rightRight = lineContent.charCodeAt(column);
if (isLowerAsciiLetter(rightRight) || isAsciiDigit(rightRight)) {
return new Position(lineNumber, column);
}
}
}
}
return new Position(lineNumber, 1);
}
static moveWordRight(wordSeparators2, model, position, wordNavigationType) {
let lineNumber = position.lineNumber;
let column = position.column;
let movedDown = false;
if (column === model.getLineMaxColumn(lineNumber)) {
if (lineNumber < model.getLineCount()) {
movedDown = true;
lineNumber = lineNumber + 1;
column = 1;
}
}
let nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, column));
if (wordNavigationType === 2) {
if (nextWordOnLine && nextWordOnLine.wordType === 2) {
if (nextWordOnLine.end - nextWordOnLine.start === 1 && nextWordOnLine.nextCharClass === 0) {
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, nextWordOnLine.end + 1));
}
}
if (nextWordOnLine) {
column = nextWordOnLine.end + 1;
} else {
column = model.getLineMaxColumn(lineNumber);
}
} else if (wordNavigationType === 3) {
if (movedDown) {
column = 0;
}
while (nextWordOnLine && (nextWordOnLine.wordType === 2 || nextWordOnLine.start + 1 <= column)) {
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
} else {
column = model.getLineMaxColumn(lineNumber);
}
} else {
if (nextWordOnLine && !movedDown && column >= nextWordOnLine.start + 1) {
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
} else {
column = model.getLineMaxColumn(lineNumber);
}
}
return new Position(lineNumber, column);
}
static _moveWordPartRight(model, position) {
const lineNumber = position.lineNumber;
const maxColumn = model.getLineMaxColumn(lineNumber);
if (position.column === maxColumn) {
return lineNumber < model.getLineCount() ? new Position(lineNumber + 1, 1) : position;
}
const lineContent = model.getLineContent(lineNumber);
for (let column = position.column + 1; column < maxColumn; column++) {
const left = lineContent.charCodeAt(column - 2);
const right = lineContent.charCodeAt(column - 1);
if (left !== 95 && right === 95) {
return new Position(lineNumber, column);
}
if (left !== 45 && right === 45) {
return new Position(lineNumber, column);
}
if ((isLowerAsciiLetter(left) || isAsciiDigit(left)) && isUpperAsciiLetter(right)) {
return new Position(lineNumber, column);
}
if (isUpperAsciiLetter(left) && isUpperAsciiLetter(right)) {
if (column + 1 < maxColumn) {
const rightRight = lineContent.charCodeAt(column);
if (isLowerAsciiLetter(rightRight) || isAsciiDigit(rightRight)) {
return new Position(lineNumber, column);
}
}
}
}
return new Position(lineNumber, maxColumn);
}
static _deleteWordLeftWhitespace(model, position) {
const lineContent = model.getLineContent(position.lineNumber);
const startIndex = position.column - 2;
const lastNonWhitespace = lastNonWhitespaceIndex(lineContent, startIndex);
if (lastNonWhitespace + 1 < startIndex) {
return new Range(position.lineNumber, lastNonWhitespace + 2, position.lineNumber, position.column);
}
return null;
}
static deleteWordLeft(ctx, wordNavigationType) {
const wordSeparators2 = ctx.wordSeparators;
const model = ctx.model;
const selection = ctx.selection;
const whitespaceHeuristics = ctx.whitespaceHeuristics;
if (!selection.isEmpty()) {
return selection;
}
if (DeleteOperations.isAutoClosingPairDelete(ctx.autoClosingDelete, ctx.autoClosingBrackets, ctx.autoClosingQuotes, ctx.autoClosingPairs.autoClosingPairsOpenByEnd, ctx.model, [ctx.selection], ctx.autoClosedCharacters)) {
const position2 = ctx.selection.getPosition();
return new Range(position2.lineNumber, position2.column - 1, position2.lineNumber, position2.column + 1);
}
const position = new Position(selection.positionLineNumber, selection.positionColumn);
let lineNumber = position.lineNumber;
let column = position.column;
if (lineNumber === 1 && column === 1) {
return null;
}
if (whitespaceHeuristics) {
const r = this._deleteWordLeftWhitespace(model, position);
if (r) {
return r;
}
}
let prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, position);
if (wordNavigationType === 0) {
if (prevWordOnLine) {
column = prevWordOnLine.start + 1;
} else {
if (column > 1) {
column = 1;
} else {
lineNumber--;
column = model.getLineMaxColumn(lineNumber);
}
}
} else {
if (prevWordOnLine && column <= prevWordOnLine.end + 1) {
prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, new Position(lineNumber, prevWordOnLine.start + 1));
}
if (prevWordOnLine) {
column = prevWordOnLine.end + 1;
} else {
if (column > 1) {
column = 1;
} else {
lineNumber--;
column = model.getLineMaxColumn(lineNumber);
}
}
}
return new Range(lineNumber, column, position.lineNumber, position.column);
}
static deleteInsideWord(wordSeparators2, model, selection) {
if (!selection.isEmpty()) {
return selection;
}
const position = new Position(selection.positionLineNumber, selection.positionColumn);
const r = this._deleteInsideWordWhitespace(model, position);
if (r) {
return r;
}
return this._deleteInsideWordDetermineDeleteRange(wordSeparators2, model, position);
}
static _charAtIsWhitespace(str, index) {
const charCode = str.charCodeAt(index);
return charCode === 32 || charCode === 9;
}
static _deleteInsideWordWhitespace(model, position) {
const lineContent = model.getLineContent(position.lineNumber);
const lineContentLength = lineContent.length;
if (lineContentLength === 0) {
return null;
}
let leftIndex = Math.max(position.column - 2, 0);
if (!this._charAtIsWhitespace(lineContent, leftIndex)) {
return null;
}
let rightIndex = Math.min(position.column - 1, lineContentLength - 1);
if (!this._charAtIsWhitespace(lineContent, rightIndex)) {
return null;
}
while (leftIndex > 0 && this._charAtIsWhitespace(lineContent, leftIndex - 1)) {
leftIndex--;
}
while (rightIndex + 1 < lineContentLength && this._charAtIsWhitespace(lineContent, rightIndex + 1)) {
rightIndex++;
}
return new Range(position.lineNumber, leftIndex + 1, position.lineNumber, rightIndex + 2);
}
static _deleteInsideWordDetermineDeleteRange(wordSeparators2, model, position) {
const lineContent = model.getLineContent(position.lineNumber);
const lineLength = lineContent.length;
if (lineLength === 0) {
if (position.lineNumber > 1) {
return new Range(position.lineNumber - 1, model.getLineMaxColumn(position.lineNumber - 1), position.lineNumber, 1);
} else {
if (position.lineNumber < model.getLineCount()) {
return new Range(position.lineNumber, 1, position.lineNumber + 1, 1);
} else {
return new Range(position.lineNumber, 1, position.lineNumber, 1);
}
}
}
const touchesWord = (word) => {
return word.start + 1 <= position.column && position.column <= word.end + 1;
};
const createRangeWithPosition = (startColumn, endColumn) => {
startColumn = Math.min(startColumn, position.column);
endColumn = Math.max(endColumn, position.column);
return new Range(position.lineNumber, startColumn, position.lineNumber, endColumn);
};
const deleteWordAndAdjacentWhitespace = (word) => {
let startColumn = word.start + 1;
let endColumn = word.end + 1;
let expandedToTheRight = false;
while (endColumn - 1 < lineLength && this._charAtIsWhitespace(lineContent, endColumn - 1)) {
expandedToTheRight = true;
endColumn++;
}
if (!expandedToTheRight) {
while (startColumn > 1 && this._charAtIsWhitespace(lineContent, startColumn - 2)) {
startColumn--;
}
}
return createRangeWithPosition(startColumn, endColumn);
};
const prevWordOnLine = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, position);
if (prevWordOnLine && touchesWord(prevWordOnLine)) {
return deleteWordAndAdjacentWhitespace(prevWordOnLine);
}
const nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, position);
if (nextWordOnLine && touchesWord(nextWordOnLine)) {
return deleteWordAndAdjacentWhitespace(nextWordOnLine);
}
if (prevWordOnLine && nextWordOnLine) {
return createRangeWithPosition(prevWordOnLine.end + 1, nextWordOnLine.start + 1);
}
if (prevWordOnLine) {
return createRangeWithPosition(prevWordOnLine.start + 1, prevWordOnLine.end + 1);
}
if (nextWordOnLine) {
return createRangeWithPosition(nextWordOnLine.start + 1, nextWordOnLine.end + 1);
}
return createRangeWithPosition(1, lineLength + 1);
}
static _deleteWordPartLeft(model, selection) {
if (!selection.isEmpty()) {
return selection;
}
const pos = selection.getPosition();
const toPosition = _WordOperations._moveWordPartLeft(model, pos);
return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);
}
static _findFirstNonWhitespaceChar(str, startIndex) {
const len = str.length;
for (let chIndex = startIndex; chIndex < len; chIndex++) {
const ch = str.charAt(chIndex);
if (ch !== " " && ch !== " ") {
return chIndex;
}
}
return len;
}
static _deleteWordRightWhitespace(model, position) {
const lineContent = model.getLineContent(position.lineNumber);
const startIndex = position.column - 1;
const firstNonWhitespace = this._findFirstNonWhitespaceChar(lineContent, startIndex);
if (startIndex + 1 < firstNonWhitespace) {
return new Range(position.lineNumber, position.column, position.lineNumber, firstNonWhitespace + 1);
}
return null;
}
static deleteWordRight(ctx, wordNavigationType) {
const wordSeparators2 = ctx.wordSeparators;
const model = ctx.model;
const selection = ctx.selection;
const whitespaceHeuristics = ctx.whitespaceHeuristics;
if (!selection.isEmpty()) {
return selection;
}
const position = new Position(selection.positionLineNumber, selection.positionColumn);
let lineNumber = position.lineNumber;
let column = position.column;
const lineCount = model.getLineCount();
const maxColumn = model.getLineMaxColumn(lineNumber);
if (lineNumber === lineCount && column === maxColumn) {
return null;
}
if (whitespaceHeuristics) {
const r = this._deleteWordRightWhitespace(model, position);
if (r) {
return r;
}
}
let nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, position);
if (wordNavigationType === 2) {
if (nextWordOnLine) {
column = nextWordOnLine.end + 1;
} else {
if (column < maxColumn || lineNumber === lineCount) {
column = maxColumn;
} else {
lineNumber++;
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, 1));
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
} else {
column = model.getLineMaxColumn(lineNumber);
}
}
}
} else {
if (nextWordOnLine && column >= nextWordOnLine.start + 1) {
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
} else {
if (column < maxColumn || lineNumber === lineCount) {
column = maxColumn;
} else {
lineNumber++;
nextWordOnLine = _WordOperations._findNextWordOnLine(wordSeparators2, model, new Position(lineNumber, 1));
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
} else {
column = model.getLineMaxColumn(lineNumber);
}
}
}
}
return new Range(lineNumber, column, position.lineNumber, position.column);
}
static _deleteWordPartRight(model, selection) {
if (!selection.isEmpty()) {
return selection;
}
const pos = selection.getPosition();
const toPosition = _WordOperations._moveWordPartRight(model, pos);
return new Range(pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);
}
static _createWordAtPosition(model, lineNumber, word) {
const range2 = new Range(lineNumber, word.start + 1, lineNumber, word.end + 1);
return {
word: model.getValueInRange(range2),
startColumn: range2.startColumn,
endColumn: range2.endColumn
};
}
static getWordAtPosition(model, _wordSeparators, _intlSegmenterLocales, position) {
const wordSeparators2 = getMapForWordSeparators(_wordSeparators, _intlSegmenterLocales);
const prevWord = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, position);
if (prevWord && prevWord.wordType === 1 && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {
return _WordOperations._createWordAtPosition(model, position.lineNumber, prevWord);
}
const nextWord2 = _WordOperations._findNextWordOnLine(wordSeparators2, model, position);
if (nextWord2 && nextWord2.wordType === 1 && nextWord2.start <= position.column - 1 && position.column - 1 <= nextWord2.end) {
return _WordOperations._createWordAtPosition(model, position.lineNumber, nextWord2);
}
return null;
}
static word(config, model, cursor, inSelectionMode, position) {
const wordSeparators2 = getMapForWordSeparators(config.wordSeparators, config.wordSegmenterLocales);
const prevWord = _WordOperations._findPreviousWordOnLine(wordSeparators2, model, position);
const nextWord2 = _WordOperations._findNextWordOnLine(wordSeparators2, model, position);
if (!inSelectionMode) {
let startColumn2;
let endColumn2;
if (prevWord && prevWord.wordType === 1 && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {
startColumn2 = prevWord.start + 1;
endColumn2 = prevWord.end + 1;
} else if (nextWord2 && nextWord2.wordType === 1 && nextWord2.start <= position.column - 1 && position.column - 1 <= nextWord2.end) {
startColumn2 = nextWord2.start + 1;
endColumn2 = nextWord2.end + 1;
} else {
if (prevWord) {
startColumn2 = prevWord.end + 1;
} else {
startColumn2 = 1;
}
if (nextWord2) {
endColumn2 = nextWord2.start + 1;
} else {
endColumn2 = model.getLineMaxColumn(position.lineNumber);
}
}
return new SingleCursorState(new Range(position.lineNumber, startColumn2, position.lineNumber, endColumn2), 1, 0, new Position(position.lineNumber, endColumn2), 0);
}
let startColumn;
let endColumn;
if (prevWord && prevWord.wordType === 1 && prevWord.start < position.column - 1 && position.column - 1 < prevWord.end) {
startColumn = prevWord.start + 1;
endColumn = prevWord.end + 1;
} else if (nextWord2 && nextWord2.wordType === 1 && nextWord2.start < position.column - 1 && position.column - 1 < nextWord2.end) {
startColumn = nextWord2.start + 1;
endColumn = nextWord2.end + 1;
} else {
startColumn = position.column;
endColumn = position.column;
}
const lineNumber = position.lineNumber;
let column;
if (cursor.selectionStart.containsPosition(position)) {
column = cursor.selectionStart.endColumn;
} else if (position.isBeforeOrEqual(cursor.selectionStart.getStartPosition())) {
column = startColumn;
const possiblePosition = new Position(lineNumber, column);
if (cursor.selectionStart.containsPosition(possiblePosition)) {
column = cursor.selectionStart.endColumn;
}
} else {
column = endColumn;
const possiblePosition = new Position(lineNumber, column);
if (cursor.selectionStart.containsPosition(possiblePosition)) {
column = cursor.selectionStart.startColumn;
}
}
return cursor.move(true, lineNumber, column, 0);
}
};
WordPartOperations = class extends WordOperations {
static deleteWordPartLeft(ctx) {
const candidates = enforceDefined([
WordOperations.deleteWordLeft(
ctx,
0
/* WordNavigationType.WordStart */
),
WordOperations.deleteWordLeft(
ctx,
2
/* WordNavigationType.WordEnd */
),
WordOperations._deleteWordPartLeft(ctx.model, ctx.selection)
]);
candidates.sort(Range.compareRangesUsingEnds);
return candidates[2];
}
static deleteWordPartRight(ctx) {
const candidates = enforceDefined([
WordOperations.deleteWordRight(
ctx,
0
/* WordNavigationType.WordStart */
),
WordOperations.deleteWordRight(
ctx,
2
/* WordNavigationType.WordEnd */
),
WordOperations._deleteWordPartRight(ctx.model, ctx.selection)
]);
candidates.sort(Range.compareRangesUsingStarts);
return candidates[0];
}
static moveWordPartLeft(wordSeparators2, model, position) {
const candidates = enforceDefined([
WordOperations.moveWordLeft(
wordSeparators2,
model,
position,
0
/* WordNavigationType.WordStart */
),
WordOperations.moveWordLeft(
wordSeparators2,
model,
position,
2
/* WordNavigationType.WordEnd */
),
WordOperations._moveWordPartLeft(model, position)
]);
candidates.sort(Position.compare);
return candidates[2];
}
static moveWordPartRight(wordSeparators2, model, position) {
const candidates = enforceDefined([
WordOperations.moveWordRight(
wordSeparators2,
model,
position,
0
/* WordNavigationType.WordStart */
),
WordOperations.moveWordRight(
wordSeparators2,
model,
position,
2
/* WordNavigationType.WordEnd */
),
WordOperations._moveWordPartRight(model, position)
]);
candidates.sort(Position.compare);
return candidates[0];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveCommands.js
var CursorMoveCommands, CursorMove;
var init_cursorMoveCommands = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorMoveCommands.js"() {
init_types();
init_cursorCommon();
init_cursorMoveOperations();
init_cursorWordOperations();
init_position();
init_range();
CursorMoveCommands = class {
static addCursorDown(viewModel, cursors, useLogicalLine) {
const result = [];
let resultLen = 0;
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);
if (useLogicalLine) {
result[resultLen++] = CursorState.fromModelState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel.model, cursor.modelState));
} else {
result[resultLen++] = CursorState.fromViewState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel, cursor.viewState));
}
}
return result;
}
static addCursorUp(viewModel, cursors, useLogicalLine) {
const result = [];
let resultLen = 0;
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);
if (useLogicalLine) {
result[resultLen++] = CursorState.fromModelState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel.model, cursor.modelState));
} else {
result[resultLen++] = CursorState.fromViewState(MoveOperations.translateUp(viewModel.cursorConfig, viewModel, cursor.viewState));
}
}
return result;
}
static moveToBeginningOfLine(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = this._moveToLineStart(viewModel, cursor, inSelectionMode);
}
return result;
}
static _moveToLineStart(viewModel, cursor, inSelectionMode) {
const currentViewStateColumn = cursor.viewState.position.column;
const currentModelStateColumn = cursor.modelState.position.column;
const isFirstLineOfWrappedLine = currentViewStateColumn === currentModelStateColumn;
const currentViewStatelineNumber = cursor.viewState.position.lineNumber;
const firstNonBlankColumn = viewModel.getLineFirstNonWhitespaceColumn(currentViewStatelineNumber);
const isBeginningOfViewLine = currentViewStateColumn === firstNonBlankColumn;
if (!isFirstLineOfWrappedLine && !isBeginningOfViewLine) {
return this._moveToLineStartByView(viewModel, cursor, inSelectionMode);
} else {
return this._moveToLineStartByModel(viewModel, cursor, inSelectionMode);
}
}
static _moveToLineStartByView(viewModel, cursor, inSelectionMode) {
return CursorState.fromViewState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode));
}
static _moveToLineStartByModel(viewModel, cursor, inSelectionMode) {
return CursorState.fromModelState(MoveOperations.moveToBeginningOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));
}
static moveToEndOfLine(viewModel, cursors, inSelectionMode, sticky) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = this._moveToLineEnd(viewModel, cursor, inSelectionMode, sticky);
}
return result;
}
static _moveToLineEnd(viewModel, cursor, inSelectionMode, sticky) {
const viewStatePosition = cursor.viewState.position;
const viewModelMaxColumn = viewModel.getLineMaxColumn(viewStatePosition.lineNumber);
const isEndOfViewLine = viewStatePosition.column === viewModelMaxColumn;
const modelStatePosition = cursor.modelState.position;
const modelMaxColumn = viewModel.model.getLineMaxColumn(modelStatePosition.lineNumber);
const isEndLineOfWrappedLine = viewModelMaxColumn - viewStatePosition.column === modelMaxColumn - modelStatePosition.column;
if (isEndOfViewLine || isEndLineOfWrappedLine) {
return this._moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky);
} else {
return this._moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky);
}
}
static _moveToLineEndByView(viewModel, cursor, inSelectionMode, sticky) {
return CursorState.fromViewState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, sticky));
}
static _moveToLineEndByModel(viewModel, cursor, inSelectionMode, sticky) {
return CursorState.fromModelState(MoveOperations.moveToEndOfLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, sticky));
}
static expandLineSelection(viewModel, cursors) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const startLineNumber = cursor.modelState.selection.startLineNumber;
const lineCount = viewModel.model.getLineCount();
let endLineNumber = cursor.modelState.selection.endLineNumber;
let endColumn;
if (endLineNumber === lineCount) {
endColumn = viewModel.model.getLineMaxColumn(lineCount);
} else {
endLineNumber++;
endColumn = 1;
}
result[i] = CursorState.fromModelState(new SingleCursorState(new Range(startLineNumber, 1, startLineNumber, 1), 0, 0, new Position(endLineNumber, endColumn), 0));
}
return result;
}
static moveToBeginningOfBuffer(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromModelState(MoveOperations.moveToBeginningOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));
}
return result;
}
static moveToEndOfBuffer(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromModelState(MoveOperations.moveToEndOfBuffer(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode));
}
return result;
}
static selectAll(viewModel, cursor) {
const lineCount = viewModel.model.getLineCount();
const maxColumn = viewModel.model.getLineMaxColumn(lineCount);
return CursorState.fromModelState(new SingleCursorState(new Range(1, 1, 1, 1), 0, 0, new Position(lineCount, maxColumn), 0));
}
static line(viewModel, cursor, inSelectionMode, _position, _viewPosition) {
const position = viewModel.model.validatePosition(_position);
const viewPosition = _viewPosition ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position) : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position);
if (!inSelectionMode) {
const lineCount = viewModel.model.getLineCount();
let selectToLineNumber = position.lineNumber + 1;
let selectToColumn = 1;
if (selectToLineNumber > lineCount) {
selectToLineNumber = lineCount;
selectToColumn = viewModel.model.getLineMaxColumn(selectToLineNumber);
}
return CursorState.fromModelState(new SingleCursorState(new Range(position.lineNumber, 1, selectToLineNumber, selectToColumn), 2, 0, new Position(selectToLineNumber, selectToColumn), 0));
}
const enteringLineNumber = cursor.modelState.selectionStart.getStartPosition().lineNumber;
if (position.lineNumber < enteringLineNumber) {
return CursorState.fromViewState(cursor.viewState.move(true, viewPosition.lineNumber, 1, 0));
} else if (position.lineNumber > enteringLineNumber) {
const lineCount = viewModel.getLineCount();
let selectToViewLineNumber = viewPosition.lineNumber + 1;
let selectToViewColumn = 1;
if (selectToViewLineNumber > lineCount) {
selectToViewLineNumber = lineCount;
selectToViewColumn = viewModel.getLineMaxColumn(selectToViewLineNumber);
}
return CursorState.fromViewState(cursor.viewState.move(true, selectToViewLineNumber, selectToViewColumn, 0));
} else {
const endPositionOfSelectionStart = cursor.modelState.selectionStart.getEndPosition();
return CursorState.fromModelState(cursor.modelState.move(true, endPositionOfSelectionStart.lineNumber, endPositionOfSelectionStart.column, 0));
}
}
static word(viewModel, cursor, inSelectionMode, _position) {
const position = viewModel.model.validatePosition(_position);
return CursorState.fromModelState(WordOperations.word(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, position));
}
static cancelSelection(viewModel, cursor) {
if (!cursor.modelState.hasSelection()) {
return new CursorState(cursor.modelState, cursor.viewState);
}
const lineNumber = cursor.viewState.position.lineNumber;
const column = cursor.viewState.position.column;
return CursorState.fromViewState(new SingleCursorState(new Range(lineNumber, column, lineNumber, column), 0, 0, new Position(lineNumber, column), 0));
}
static moveTo(viewModel, cursor, inSelectionMode, _position, _viewPosition) {
if (inSelectionMode) {
if (cursor.modelState.selectionStartKind === 1) {
return this.word(viewModel, cursor, inSelectionMode, _position);
}
if (cursor.modelState.selectionStartKind === 2) {
return this.line(viewModel, cursor, inSelectionMode, _position, _viewPosition);
}
}
const position = viewModel.model.validatePosition(_position);
const viewPosition = _viewPosition ? viewModel.coordinatesConverter.validateViewPosition(new Position(_viewPosition.lineNumber, _viewPosition.column), position) : viewModel.coordinatesConverter.convertModelPositionToViewPosition(position);
return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, viewPosition.lineNumber, viewPosition.column, 0));
}
static simpleMove(viewModel, cursors, direction, inSelectionMode, value, unit) {
switch (direction) {
case 0: {
if (unit === 4) {
return this._moveHalfLineLeft(viewModel, cursors, inSelectionMode);
} else {
return this._moveLeft(viewModel, cursors, inSelectionMode, value);
}
}
case 1: {
if (unit === 4) {
return this._moveHalfLineRight(viewModel, cursors, inSelectionMode);
} else {
return this._moveRight(viewModel, cursors, inSelectionMode, value);
}
}
case 2: {
if (unit === 2) {
return this._moveUpByViewLines(viewModel, cursors, inSelectionMode, value);
} else {
return this._moveUpByModelLines(viewModel, cursors, inSelectionMode, value);
}
}
case 3: {
if (unit === 2) {
return this._moveDownByViewLines(viewModel, cursors, inSelectionMode, value);
} else {
return this._moveDownByModelLines(viewModel, cursors, inSelectionMode, value);
}
}
case 4: {
if (unit === 2) {
return cursors.map((cursor) => CursorState.fromViewState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));
} else {
return cursors.map((cursor) => CursorState.fromModelState(MoveOperations.moveToPrevBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));
}
}
case 5: {
if (unit === 2) {
return cursors.map((cursor) => CursorState.fromViewState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode)));
} else {
return cursors.map((cursor) => CursorState.fromModelState(MoveOperations.moveToNextBlankLine(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode)));
}
}
case 6: {
return this._moveToViewMinColumn(viewModel, cursors, inSelectionMode);
}
case 7: {
return this._moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode);
}
case 8: {
return this._moveToViewCenterColumn(viewModel, cursors, inSelectionMode);
}
case 9: {
return this._moveToViewMaxColumn(viewModel, cursors, inSelectionMode);
}
case 10: {
return this._moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode);
}
default:
return null;
}
}
static viewportMove(viewModel, cursors, direction, inSelectionMode, value) {
const visibleViewRange = viewModel.getCompletelyVisibleViewRange();
const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);
switch (direction) {
case 11: {
const modelLineNumber = this._firstLineNumberInRange(viewModel.model, visibleModelRange, value);
const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];
}
case 13: {
const modelLineNumber = this._lastLineNumberInRange(viewModel.model, visibleModelRange, value);
const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];
}
case 12: {
const modelLineNumber = Math.round((visibleModelRange.startLineNumber + visibleModelRange.endLineNumber) / 2);
const modelColumn = viewModel.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(viewModel, cursors[0], inSelectionMode, modelLineNumber, modelColumn)];
}
case 14: {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = this.findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode);
}
return result;
}
default:
return null;
}
}
static findPositionInViewportIfOutside(viewModel, cursor, visibleViewRange, inSelectionMode) {
const viewLineNumber = cursor.viewState.position.lineNumber;
if (visibleViewRange.startLineNumber <= viewLineNumber && viewLineNumber <= visibleViewRange.endLineNumber - 1) {
return new CursorState(cursor.modelState, cursor.viewState);
} else {
let newViewLineNumber;
if (viewLineNumber > visibleViewRange.endLineNumber - 1) {
newViewLineNumber = visibleViewRange.endLineNumber - 1;
} else if (viewLineNumber < visibleViewRange.startLineNumber) {
newViewLineNumber = visibleViewRange.startLineNumber;
} else {
newViewLineNumber = viewLineNumber;
}
const position = MoveOperations.vertical(viewModel.cursorConfig, viewModel, viewLineNumber, cursor.viewState.position.column, cursor.viewState.leftoverVisibleColumns, newViewLineNumber, false);
return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, position.lineNumber, position.column, position.leftoverVisibleColumns));
}
}
/**
* Find the nth line start included in the range (from the start).
*/
static _firstLineNumberInRange(model, range2, count) {
let startLineNumber = range2.startLineNumber;
if (range2.startColumn !== model.getLineMinColumn(startLineNumber)) {
startLineNumber++;
}
return Math.min(range2.endLineNumber, startLineNumber + count - 1);
}
/**
* Find the nth line start included in the range (from the end).
*/
static _lastLineNumberInRange(model, range2, count) {
let startLineNumber = range2.startLineNumber;
if (range2.startColumn !== model.getLineMinColumn(startLineNumber)) {
startLineNumber++;
}
return Math.max(startLineNumber, range2.endLineNumber - count + 1);
}
static _moveLeft(viewModel, cursors, inSelectionMode, noOfColumns) {
return cursors.map((cursor) => CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));
}
static _moveHalfLineLeft(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const halfLine = Math.round(viewModel.getLineLength(viewLineNumber) / 2);
result[i] = CursorState.fromViewState(MoveOperations.moveLeft(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));
}
return result;
}
static _moveRight(viewModel, cursors, inSelectionMode, noOfColumns) {
return cursors.map((cursor) => CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, noOfColumns)));
}
static _moveHalfLineRight(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const halfLine = Math.round(viewModel.getLineLength(viewLineNumber) / 2);
result[i] = CursorState.fromViewState(MoveOperations.moveRight(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, halfLine));
}
return result;
}
static _moveDownByViewLines(viewModel, cursors, inSelectionMode, linesCount) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromViewState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));
}
return result;
}
static _moveDownByModelLines(viewModel, cursors, inSelectionMode, linesCount) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromModelState(MoveOperations.moveDown(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));
}
return result;
}
static _moveUpByViewLines(viewModel, cursors, inSelectionMode, linesCount) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromViewState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel, cursor.viewState, inSelectionMode, linesCount));
}
return result;
}
static _moveUpByModelLines(viewModel, cursors, inSelectionMode, linesCount) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
result[i] = CursorState.fromModelState(MoveOperations.moveUp(viewModel.cursorConfig, viewModel.model, cursor.modelState, inSelectionMode, linesCount));
}
return result;
}
static _moveToViewPosition(viewModel, cursor, inSelectionMode, toViewLineNumber, toViewColumn) {
return CursorState.fromViewState(cursor.viewState.move(inSelectionMode, toViewLineNumber, toViewColumn, 0));
}
static _moveToModelPosition(viewModel, cursor, inSelectionMode, toModelLineNumber, toModelColumn) {
return CursorState.fromModelState(cursor.modelState.move(inSelectionMode, toModelLineNumber, toModelColumn, 0));
}
static _moveToViewMinColumn(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const viewColumn = viewModel.getLineMinColumn(viewLineNumber);
result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
}
static _moveToViewFirstNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const viewColumn = viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);
result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
}
static _moveToViewCenterColumn(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const viewColumn = Math.round((viewModel.getLineMaxColumn(viewLineNumber) + viewModel.getLineMinColumn(viewLineNumber)) / 2);
result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
}
static _moveToViewMaxColumn(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const viewColumn = viewModel.getLineMaxColumn(viewLineNumber);
result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
}
static _moveToViewLastNonWhitespaceColumn(viewModel, cursors, inSelectionMode) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const viewLineNumber = cursor.viewState.position.lineNumber;
const viewColumn = viewModel.getLineLastNonWhitespaceColumn(viewLineNumber);
result[i] = this._moveToViewPosition(viewModel, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
}
};
(function(CursorMove2) {
const isCursorMoveArgs = function(arg) {
if (!isObject(arg)) {
return false;
}
const cursorMoveArg = arg;
if (!isString(cursorMoveArg.to)) {
return false;
}
if (!isUndefined(cursorMoveArg.select) && !isBoolean(cursorMoveArg.select)) {
return false;
}
if (!isUndefined(cursorMoveArg.by) && !isString(cursorMoveArg.by)) {
return false;
}
if (!isUndefined(cursorMoveArg.value) && !isNumber(cursorMoveArg.value)) {
return false;
}
return true;
};
CursorMove2.metadata = {
description: "Move cursor to a logical position in the view",
args: [
{
name: "Cursor move argument object",
description: `Property-value pairs that can be passed through this argument:
* 'to': A mandatory logical position value providing where to move the cursor.
\`\`\`
'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
\`\`\`
* 'by': Unit to move. Default is computed based on 'to' value.
\`\`\`
'line', 'wrappedLine', 'character', 'halfLine'
\`\`\`
* 'value': Number of units to move. Default is '1'.
* 'select': If 'true' makes the selection. Default is 'false'.
`,
constraint: isCursorMoveArgs,
schema: {
"type": "object",
"required": ["to"],
"properties": {
"to": {
"type": "string",
"enum": ["left", "right", "up", "down", "prevBlankLine", "nextBlankLine", "wrappedLineStart", "wrappedLineEnd", "wrappedLineColumnCenter", "wrappedLineFirstNonWhitespaceCharacter", "wrappedLineLastNonWhitespaceCharacter", "viewPortTop", "viewPortCenter", "viewPortBottom", "viewPortIfOutside"]
},
"by": {
"type": "string",
"enum": ["line", "wrappedLine", "character", "halfLine"]
},
"value": {
"type": "number",
"default": 1
},
"select": {
"type": "boolean",
"default": false
}
}
}
}
]
};
CursorMove2.RawDirection = {
Left: "left",
Right: "right",
Up: "up",
Down: "down",
PrevBlankLine: "prevBlankLine",
NextBlankLine: "nextBlankLine",
WrappedLineStart: "wrappedLineStart",
WrappedLineFirstNonWhitespaceCharacter: "wrappedLineFirstNonWhitespaceCharacter",
WrappedLineColumnCenter: "wrappedLineColumnCenter",
WrappedLineEnd: "wrappedLineEnd",
WrappedLineLastNonWhitespaceCharacter: "wrappedLineLastNonWhitespaceCharacter",
ViewPortTop: "viewPortTop",
ViewPortCenter: "viewPortCenter",
ViewPortBottom: "viewPortBottom",
ViewPortIfOutside: "viewPortIfOutside"
};
CursorMove2.RawUnit = {
Line: "line",
WrappedLine: "wrappedLine",
Character: "character",
HalfLine: "halfLine"
};
function parse5(args) {
if (!args.to) {
return null;
}
let direction;
switch (args.to) {
case CursorMove2.RawDirection.Left:
direction = 0;
break;
case CursorMove2.RawDirection.Right:
direction = 1;
break;
case CursorMove2.RawDirection.Up:
direction = 2;
break;
case CursorMove2.RawDirection.Down:
direction = 3;
break;
case CursorMove2.RawDirection.PrevBlankLine:
direction = 4;
break;
case CursorMove2.RawDirection.NextBlankLine:
direction = 5;
break;
case CursorMove2.RawDirection.WrappedLineStart:
direction = 6;
break;
case CursorMove2.RawDirection.WrappedLineFirstNonWhitespaceCharacter:
direction = 7;
break;
case CursorMove2.RawDirection.WrappedLineColumnCenter:
direction = 8;
break;
case CursorMove2.RawDirection.WrappedLineEnd:
direction = 9;
break;
case CursorMove2.RawDirection.WrappedLineLastNonWhitespaceCharacter:
direction = 10;
break;
case CursorMove2.RawDirection.ViewPortTop:
direction = 11;
break;
case CursorMove2.RawDirection.ViewPortBottom:
direction = 13;
break;
case CursorMove2.RawDirection.ViewPortCenter:
direction = 12;
break;
case CursorMove2.RawDirection.ViewPortIfOutside:
direction = 14;
break;
default:
return null;
}
let unit = 0;
switch (args.by) {
case CursorMove2.RawUnit.Line:
unit = 1;
break;
case CursorMove2.RawUnit.WrappedLine:
unit = 2;
break;
case CursorMove2.RawUnit.Character:
unit = 3;
break;
case CursorMove2.RawUnit.HalfLine:
unit = 4;
break;
}
return {
direction,
unit,
select: !!args.select,
value: args.value || 1
};
}
CursorMove2.parse = parse5;
})(CursorMove || (CursorMove = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/indentationLineProcessor.js
function isLanguageDifferentFromLineStart(model, position) {
model.tokenization.forceTokenization(position.lineNumber);
const lineTokens = model.tokenization.getLineTokens(position.lineNumber);
const scopedLineTokens = createScopedLineTokens(lineTokens, position.column - 1);
const doesScopeStartAtOffsetZero = scopedLineTokens.firstCharOffset === 0;
const isScopedLanguageEqualToFirstLanguageOnLine = lineTokens.getLanguageId(0) === scopedLineTokens.languageId;
const languageIsDifferentFromLineStart = !doesScopeStartAtOffsetZero && !isScopedLanguageEqualToFirstLanguageOnLine;
return languageIsDifferentFromLineStart;
}
var ProcessedIndentRulesSupport, IndentationContextProcessor, IndentationLineProcessor;
var init_indentationLineProcessor = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/indentationLineProcessor.js"() {
init_strings();
init_supports();
init_lineTokens();
ProcessedIndentRulesSupport = class {
constructor(model, indentRulesSupport, languageConfigurationService) {
this._indentRulesSupport = indentRulesSupport;
this._indentationLineProcessor = new IndentationLineProcessor(model, languageConfigurationService);
}
/**
* Apply the new indentation and return whether the indentation level should be increased after the given line number
*/
shouldIncrease(lineNumber, newIndentation) {
const processedLine = this._indentationLineProcessor.getProcessedLine(lineNumber, newIndentation);
return this._indentRulesSupport.shouldIncrease(processedLine);
}
/**
* Apply the new indentation and return whether the indentation level should be decreased after the given line number
*/
shouldDecrease(lineNumber, newIndentation) {
const processedLine = this._indentationLineProcessor.getProcessedLine(lineNumber, newIndentation);
return this._indentRulesSupport.shouldDecrease(processedLine);
}
/**
* Apply the new indentation and return whether the indentation level should remain unchanged at the given line number
*/
shouldIgnore(lineNumber, newIndentation) {
const processedLine = this._indentationLineProcessor.getProcessedLine(lineNumber, newIndentation);
return this._indentRulesSupport.shouldIgnore(processedLine);
}
/**
* Apply the new indentation and return whether the indentation level should increase on the line after the given line number
*/
shouldIndentNextLine(lineNumber, newIndentation) {
const processedLine = this._indentationLineProcessor.getProcessedLine(lineNumber, newIndentation);
return this._indentRulesSupport.shouldIndentNextLine(processedLine);
}
};
IndentationContextProcessor = class {
constructor(model, languageConfigurationService) {
this.model = model;
this.indentationLineProcessor = new IndentationLineProcessor(model, languageConfigurationService);
}
/**
* Returns the processed text, stripped from the language configuration brackets within the string, comment and regex tokens, around the given range
*/
getProcessedTokenContextAroundRange(range2) {
const beforeRangeProcessedTokens = this._getProcessedTokensBeforeRange(range2);
const afterRangeProcessedTokens = this._getProcessedTokensAfterRange(range2);
const previousLineProcessedTokens = this._getProcessedPreviousLineTokens(range2);
return { beforeRangeProcessedTokens, afterRangeProcessedTokens, previousLineProcessedTokens };
}
_getProcessedTokensBeforeRange(range2) {
this.model.tokenization.forceTokenization(range2.startLineNumber);
const lineTokens = this.model.tokenization.getLineTokens(range2.startLineNumber);
const scopedLineTokens = createScopedLineTokens(lineTokens, range2.startColumn - 1);
let slicedTokens;
if (isLanguageDifferentFromLineStart(this.model, range2.getStartPosition())) {
const columnIndexWithinScope = range2.startColumn - 1 - scopedLineTokens.firstCharOffset;
const firstCharacterOffset = scopedLineTokens.firstCharOffset;
const lastCharacterOffset = firstCharacterOffset + columnIndexWithinScope;
slicedTokens = lineTokens.sliceAndInflate(firstCharacterOffset, lastCharacterOffset, 0);
} else {
const columnWithinLine = range2.startColumn - 1;
slicedTokens = lineTokens.sliceAndInflate(0, columnWithinLine, 0);
}
const processedTokens = this.indentationLineProcessor.getProcessedTokens(slicedTokens);
return processedTokens;
}
_getProcessedTokensAfterRange(range2) {
const position = range2.isEmpty() ? range2.getStartPosition() : range2.getEndPosition();
this.model.tokenization.forceTokenization(position.lineNumber);
const lineTokens = this.model.tokenization.getLineTokens(position.lineNumber);
const scopedLineTokens = createScopedLineTokens(lineTokens, position.column - 1);
const columnIndexWithinScope = position.column - 1 - scopedLineTokens.firstCharOffset;
const firstCharacterOffset = scopedLineTokens.firstCharOffset + columnIndexWithinScope;
const lastCharacterOffset = scopedLineTokens.firstCharOffset + scopedLineTokens.getLineLength();
const slicedTokens = lineTokens.sliceAndInflate(firstCharacterOffset, lastCharacterOffset, 0);
const processedTokens = this.indentationLineProcessor.getProcessedTokens(slicedTokens);
return processedTokens;
}
_getProcessedPreviousLineTokens(range2) {
const getScopedLineTokensAtEndColumnOfLine = (lineNumber) => {
this.model.tokenization.forceTokenization(lineNumber);
const lineTokens2 = this.model.tokenization.getLineTokens(lineNumber);
const endColumnOfLine = this.model.getLineMaxColumn(lineNumber) - 1;
const scopedLineTokensAtEndColumn = createScopedLineTokens(lineTokens2, endColumnOfLine);
return scopedLineTokensAtEndColumn;
};
this.model.tokenization.forceTokenization(range2.startLineNumber);
const lineTokens = this.model.tokenization.getLineTokens(range2.startLineNumber);
const scopedLineTokens = createScopedLineTokens(lineTokens, range2.startColumn - 1);
const emptyTokens = LineTokens.createEmpty("", scopedLineTokens.languageIdCodec);
const previousLineNumber = range2.startLineNumber - 1;
const isFirstLine = previousLineNumber === 0;
if (isFirstLine) {
return emptyTokens;
}
const canScopeExtendOnPreviousLine = scopedLineTokens.firstCharOffset === 0;
if (!canScopeExtendOnPreviousLine) {
return emptyTokens;
}
const scopedLineTokensAtEndColumnOfPreviousLine = getScopedLineTokensAtEndColumnOfLine(previousLineNumber);
const doesLanguageContinueOnPreviousLine = scopedLineTokens.languageId === scopedLineTokensAtEndColumnOfPreviousLine.languageId;
if (!doesLanguageContinueOnPreviousLine) {
return emptyTokens;
}
const previousSlicedLineTokens = scopedLineTokensAtEndColumnOfPreviousLine.toIViewLineTokens();
const processedTokens = this.indentationLineProcessor.getProcessedTokens(previousSlicedLineTokens);
return processedTokens;
}
};
IndentationLineProcessor = class {
constructor(model, languageConfigurationService) {
this.model = model;
this.languageConfigurationService = languageConfigurationService;
}
/**
* Get the processed line for the given line number and potentially adjust the indentation level.
* Remove the language configuration brackets from the regex, string and comment tokens.
*/
getProcessedLine(lineNumber, newIndentation) {
var _a10, _b4;
const replaceIndentation = (line, newIndentation2) => {
const currentIndentation = getLeadingWhitespace(line);
const adjustedLine = newIndentation2 + line.substring(currentIndentation.length);
return adjustedLine;
};
(_b4 = (_a10 = this.model.tokenization).forceTokenization) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, lineNumber);
const tokens = this.model.tokenization.getLineTokens(lineNumber);
let processedLine = this.getProcessedTokens(tokens).getLineContent();
if (newIndentation !== void 0) {
processedLine = replaceIndentation(processedLine, newIndentation);
}
return processedLine;
}
/**
* Process the line with the given tokens, remove the language configuration brackets from the regex, string and comment tokens.
*/
getProcessedTokens(tokens) {
const shouldRemoveBracketsFromTokenType = (tokenType) => {
return tokenType === 2 || tokenType === 3 || tokenType === 1;
};
const languageId = tokens.getLanguageId(0);
const bracketsConfiguration = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;
const bracketsRegExp = bracketsConfiguration.getBracketRegExp({ global: true });
const textAndMetadata = [];
tokens.forEach((tokenIndex) => {
const tokenType = tokens.getStandardTokenType(tokenIndex);
let text2 = tokens.getTokenText(tokenIndex);
if (shouldRemoveBracketsFromTokenType(tokenType)) {
text2 = text2.replace(bracketsRegExp, "");
}
const metadata = tokens.getMetadata(tokenIndex);
textAndMetadata.push({ text: text2, metadata });
});
const processedLineTokens = LineTokens.createFromTextAndMetadata(textAndMetadata, tokens.languageIdCodec);
return processedLineTokens;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/enterAction.js
function getEnterAction(autoIndent, model, range2, languageConfigurationService) {
model.tokenization.forceTokenization(range2.startLineNumber);
const languageId = model.getLanguageIdAtPosition(range2.startLineNumber, range2.startColumn);
const richEditSupport = languageConfigurationService.getLanguageConfiguration(languageId);
if (!richEditSupport) {
return null;
}
const indentationContextProcessor = new IndentationContextProcessor(model, languageConfigurationService);
const processedContextTokens = indentationContextProcessor.getProcessedTokenContextAroundRange(range2);
const previousLineText = processedContextTokens.previousLineProcessedTokens.getLineContent();
const beforeEnterText = processedContextTokens.beforeRangeProcessedTokens.getLineContent();
const afterEnterText = processedContextTokens.afterRangeProcessedTokens.getLineContent();
const enterResult = richEditSupport.onEnter(autoIndent, previousLineText, beforeEnterText, afterEnterText);
if (!enterResult) {
return null;
}
const indentAction = enterResult.indentAction;
let appendText = enterResult.appendText;
const removeText = enterResult.removeText || 0;
if (!appendText) {
if (indentAction === IndentAction2.Indent || indentAction === IndentAction2.IndentOutdent) {
appendText = " ";
} else {
appendText = "";
}
} else if (indentAction === IndentAction2.Indent) {
appendText = " " + appendText;
}
let indentation = getIndentationAtPosition(model, range2.startLineNumber, range2.startColumn);
if (removeText) {
indentation = indentation.substring(0, indentation.length - removeText);
}
return {
indentAction,
appendText,
removeText,
indentation
};
}
var init_enterAction = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/enterAction.js"() {
init_languageConfiguration();
init_languageConfigurationRegistry();
init_indentationLineProcessor();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/commands/shiftCommand.js
function cachedStringRepeat(str, count) {
if (count <= 0) {
return "";
}
if (!repeatCache[str]) {
repeatCache[str] = ["", str];
}
const cache = repeatCache[str];
for (let i = cache.length; i <= count; i++) {
cache[i] = cache[i - 1] + str;
}
return cache[count];
}
var __decorate10, __param9, ShiftCommand_1, repeatCache, ShiftCommand;
var init_shiftCommand = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/commands/shiftCommand.js"() {
init_strings();
init_cursorColumns();
init_range();
init_selection();
init_enterAction();
init_languageConfigurationRegistry();
__decorate10 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param9 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
repeatCache = /* @__PURE__ */ Object.create(null);
ShiftCommand = ShiftCommand_1 = class ShiftCommand2 {
static unshiftIndent(line, column, tabSize, indentSize, insertSpaces) {
const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);
if (insertSpaces) {
const indent = cachedStringRepeat(" ", indentSize);
const desiredTabStop = CursorColumns.prevIndentTabStop(contentStartVisibleColumn, indentSize);
const indentCount = desiredTabStop / indentSize;
return cachedStringRepeat(indent, indentCount);
} else {
const indent = " ";
const desiredTabStop = CursorColumns.prevRenderTabStop(contentStartVisibleColumn, tabSize);
const indentCount = desiredTabStop / tabSize;
return cachedStringRepeat(indent, indentCount);
}
}
static shiftIndent(line, column, tabSize, indentSize, insertSpaces) {
const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);
if (insertSpaces) {
const indent = cachedStringRepeat(" ", indentSize);
const desiredTabStop = CursorColumns.nextIndentTabStop(contentStartVisibleColumn, indentSize);
const indentCount = desiredTabStop / indentSize;
return cachedStringRepeat(indent, indentCount);
} else {
const indent = " ";
const desiredTabStop = CursorColumns.nextRenderTabStop(contentStartVisibleColumn, tabSize);
const indentCount = desiredTabStop / tabSize;
return cachedStringRepeat(indent, indentCount);
}
}
constructor(range2, opts, _languageConfigurationService) {
this._languageConfigurationService = _languageConfigurationService;
this._opts = opts;
this._selection = range2;
this._selectionId = null;
this._useLastEditRangeForCursorEndPosition = false;
this._selectionStartColumnStaysPut = false;
}
_addEditOperation(builder, range2, text2) {
if (this._useLastEditRangeForCursorEndPosition) {
builder.addTrackedEditOperation(range2, text2);
} else {
builder.addEditOperation(range2, text2);
}
}
getEditOperations(model, builder) {
const startLine = this._selection.startLineNumber;
let endLine = this._selection.endLineNumber;
if (this._selection.endColumn === 1 && startLine !== endLine) {
endLine = endLine - 1;
}
const { tabSize, indentSize, insertSpaces } = this._opts;
const shouldIndentEmptyLines = startLine === endLine;
if (this._opts.useTabStops) {
if (this._selection.isEmpty()) {
if (/^\s*$/.test(model.getLineContent(startLine))) {
this._useLastEditRangeForCursorEndPosition = true;
}
}
let previousLineExtraSpaces = 0, extraSpaces = 0;
for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++, previousLineExtraSpaces = extraSpaces) {
extraSpaces = 0;
const lineText = model.getLineContent(lineNumber);
let indentationEndIndex = firstNonWhitespaceIndex(lineText);
if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {
continue;
}
if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {
continue;
}
if (indentationEndIndex === -1) {
indentationEndIndex = lineText.length;
}
if (lineNumber > 1) {
const contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(lineText, indentationEndIndex + 1, tabSize);
if (contentStartVisibleColumn % indentSize !== 0) {
if (model.tokenization.isCheapToTokenize(lineNumber - 1)) {
const enterAction = getEnterAction(this._opts.autoIndent, model, new Range(lineNumber - 1, model.getLineMaxColumn(lineNumber - 1), lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)), this._languageConfigurationService);
if (enterAction) {
extraSpaces = previousLineExtraSpaces;
if (enterAction.appendText) {
for (let j = 0, lenJ = enterAction.appendText.length; j < lenJ && extraSpaces < indentSize; j++) {
if (enterAction.appendText.charCodeAt(j) === 32) {
extraSpaces++;
} else {
break;
}
}
}
if (enterAction.removeText) {
extraSpaces = Math.max(0, extraSpaces - enterAction.removeText);
}
for (let j = 0; j < extraSpaces; j++) {
if (indentationEndIndex === 0 || lineText.charCodeAt(indentationEndIndex - 1) !== 32) {
break;
}
indentationEndIndex--;
}
}
}
}
}
if (this._opts.isUnshift && indentationEndIndex === 0) {
continue;
}
let desiredIndent;
if (this._opts.isUnshift) {
desiredIndent = ShiftCommand_1.unshiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);
} else {
desiredIndent = ShiftCommand_1.shiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);
}
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);
if (lineNumber === startLine && !this._selection.isEmpty()) {
this._selectionStartColumnStaysPut = this._selection.startColumn <= indentationEndIndex + 1;
}
}
} else {
if (!this._opts.isUnshift && this._selection.isEmpty() && model.getLineLength(startLine) === 0) {
this._useLastEditRangeForCursorEndPosition = true;
}
const oneIndent = insertSpaces ? cachedStringRepeat(" ", indentSize) : " ";
for (let lineNumber = startLine; lineNumber <= endLine; lineNumber++) {
const lineText = model.getLineContent(lineNumber);
let indentationEndIndex = firstNonWhitespaceIndex(lineText);
if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {
continue;
}
if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {
continue;
}
if (indentationEndIndex === -1) {
indentationEndIndex = lineText.length;
}
if (this._opts.isUnshift && indentationEndIndex === 0) {
continue;
}
if (this._opts.isUnshift) {
indentationEndIndex = Math.min(indentationEndIndex, indentSize);
for (let i = 0; i < indentationEndIndex; i++) {
const chr = lineText.charCodeAt(i);
if (chr === 9) {
indentationEndIndex = i + 1;
break;
}
}
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, indentationEndIndex + 1), "");
} else {
this._addEditOperation(builder, new Range(lineNumber, 1, lineNumber, 1), oneIndent);
if (lineNumber === startLine && !this._selection.isEmpty()) {
this._selectionStartColumnStaysPut = this._selection.startColumn === 1;
}
}
}
}
this._selectionId = builder.trackSelection(this._selection);
}
computeCursorState(model, helper) {
if (this._useLastEditRangeForCursorEndPosition) {
const lastOp = helper.getInverseEditOperations()[0];
return new Selection(lastOp.range.endLineNumber, lastOp.range.endColumn, lastOp.range.endLineNumber, lastOp.range.endColumn);
}
const result = helper.getTrackedSelection(this._selectionId);
if (this._selectionStartColumnStaysPut) {
const initialStartColumn = this._selection.startColumn;
const resultStartColumn = result.startColumn;
if (resultStartColumn <= initialStartColumn) {
return result;
}
if (result.getDirection() === 0) {
return new Selection(result.startLineNumber, initialStartColumn, result.endLineNumber, result.endColumn);
}
return new Selection(result.endLineNumber, result.endColumn, result.startLineNumber, initialStartColumn);
}
return result;
}
};
ShiftCommand = ShiftCommand_1 = __decorate10([
__param9(2, ILanguageConfigurationService)
], ShiftCommand);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/commands/surroundSelectionCommand.js
var SurroundSelectionCommand, CompositionSurroundSelectionCommand;
var init_surroundSelectionCommand = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/commands/surroundSelectionCommand.js"() {
init_range();
init_selection();
SurroundSelectionCommand = class {
constructor(range2, charBeforeSelection, charAfterSelection) {
this._range = range2;
this._charBeforeSelection = charBeforeSelection;
this._charAfterSelection = charAfterSelection;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(new Range(this._range.startLineNumber, this._range.startColumn, this._range.startLineNumber, this._range.startColumn), this._charBeforeSelection);
builder.addTrackedEditOperation(new Range(this._range.endLineNumber, this._range.endColumn, this._range.endLineNumber, this._range.endColumn), this._charAfterSelection);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const firstOperationRange = inverseEditOperations[0].range;
const secondOperationRange = inverseEditOperations[1].range;
return new Selection(firstOperationRange.endLineNumber, firstOperationRange.endColumn, secondOperationRange.endLineNumber, secondOperationRange.endColumn - this._charAfterSelection.length);
}
};
CompositionSurroundSelectionCommand = class {
constructor(_position, _text, _charAfter) {
this._position = _position;
this._text = _text;
this._charAfter = _charAfter;
}
getEditOperations(model, builder) {
builder.addTrackedEditOperation(new Range(this._position.lineNumber, this._position.column, this._position.lineNumber, this._position.column), this._text + this._charAfter);
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const opRange = inverseEditOperations[0].range;
return new Selection(opRange.endLineNumber, opRange.startColumn, opRange.endLineNumber, opRange.endColumn - this._charAfter.length);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/autoIndent.js
function getPrecedingValidLine(model, lineNumber, processedIndentRulesSupport) {
const languageId = model.tokenization.getLanguageIdAtPosition(lineNumber, 0);
if (lineNumber > 1) {
let lastLineNumber;
let resultLineNumber = -1;
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
if (model.tokenization.getLanguageIdAtPosition(lastLineNumber, 0) !== languageId) {
return resultLineNumber;
}
const text2 = model.getLineContent(lastLineNumber);
if (processedIndentRulesSupport.shouldIgnore(lastLineNumber) || /^\s+$/.test(text2) || text2 === "") {
resultLineNumber = lastLineNumber;
continue;
}
return lastLineNumber;
}
}
return -1;
}
function getInheritIndentForLine(autoIndent, model, lineNumber, honorIntentialIndent = true, languageConfigurationService) {
if (autoIndent < 4) {
return null;
}
const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(model.tokenization.getLanguageId()).indentRulesSupport;
if (!indentRulesSupport) {
return null;
}
const processedIndentRulesSupport = new ProcessedIndentRulesSupport(model, indentRulesSupport, languageConfigurationService);
if (lineNumber <= 1) {
return {
indentation: "",
action: null
};
}
for (let priorLineNumber = lineNumber - 1; priorLineNumber > 0; priorLineNumber--) {
if (model.getLineContent(priorLineNumber) !== "") {
break;
}
if (priorLineNumber === 1) {
return {
indentation: "",
action: null
};
}
}
const precedingUnIgnoredLine = getPrecedingValidLine(model, lineNumber, processedIndentRulesSupport);
if (precedingUnIgnoredLine < 0) {
return null;
} else if (precedingUnIgnoredLine < 1) {
return {
indentation: "",
action: null
};
}
if (processedIndentRulesSupport.shouldIncrease(precedingUnIgnoredLine) || processedIndentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLine)) {
const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);
return {
indentation: getLeadingWhitespace(precedingUnIgnoredLineContent),
action: IndentAction2.Indent,
line: precedingUnIgnoredLine
};
} else if (processedIndentRulesSupport.shouldDecrease(precedingUnIgnoredLine)) {
const precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);
return {
indentation: getLeadingWhitespace(precedingUnIgnoredLineContent),
action: null,
line: precedingUnIgnoredLine
};
} else {
if (precedingUnIgnoredLine === 1) {
return {
indentation: getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),
action: null,
line: precedingUnIgnoredLine
};
}
const previousLine = precedingUnIgnoredLine - 1;
const previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine));
if (!(previousLineIndentMetadata & (1 | 2)) && previousLineIndentMetadata & 4) {
let stopLine = 0;
for (let i = previousLine - 1; i > 0; i--) {
if (processedIndentRulesSupport.shouldIndentNextLine(i)) {
continue;
}
stopLine = i;
break;
}
return {
indentation: getLeadingWhitespace(model.getLineContent(stopLine + 1)),
action: null,
line: stopLine + 1
};
}
if (honorIntentialIndent) {
return {
indentation: getLeadingWhitespace(model.getLineContent(precedingUnIgnoredLine)),
action: null,
line: precedingUnIgnoredLine
};
} else {
for (let i = precedingUnIgnoredLine; i > 0; i--) {
if (processedIndentRulesSupport.shouldIncrease(i)) {
return {
indentation: getLeadingWhitespace(model.getLineContent(i)),
action: IndentAction2.Indent,
line: i
};
} else if (processedIndentRulesSupport.shouldIndentNextLine(i)) {
let stopLine = 0;
for (let j = i - 1; j > 0; j--) {
if (processedIndentRulesSupport.shouldIndentNextLine(i)) {
continue;
}
stopLine = j;
break;
}
return {
indentation: getLeadingWhitespace(model.getLineContent(stopLine + 1)),
action: null,
line: stopLine + 1
};
} else if (processedIndentRulesSupport.shouldDecrease(i)) {
return {
indentation: getLeadingWhitespace(model.getLineContent(i)),
action: null,
line: i
};
}
}
return {
indentation: getLeadingWhitespace(model.getLineContent(1)),
action: null,
line: 1
};
}
}
}
function getGoodIndentForLine(autoIndent, virtualModel, languageId, lineNumber, indentConverter, languageConfigurationService) {
if (autoIndent < 4) {
return null;
}
const richEditSupport = languageConfigurationService.getLanguageConfiguration(languageId);
if (!richEditSupport) {
return null;
}
const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(languageId).indentRulesSupport;
if (!indentRulesSupport) {
return null;
}
const processedIndentRulesSupport = new ProcessedIndentRulesSupport(virtualModel, indentRulesSupport, languageConfigurationService);
const indent = getInheritIndentForLine(autoIndent, virtualModel, lineNumber, void 0, languageConfigurationService);
if (indent) {
const inheritLine = indent.line;
if (inheritLine !== void 0) {
let shouldApplyEnterRules = true;
for (let inBetweenLine = inheritLine; inBetweenLine < lineNumber - 1; inBetweenLine++) {
if (!/^\s*$/.test(virtualModel.getLineContent(inBetweenLine))) {
shouldApplyEnterRules = false;
break;
}
}
if (shouldApplyEnterRules) {
const enterResult = richEditSupport.onEnter(autoIndent, "", virtualModel.getLineContent(inheritLine), "");
if (enterResult) {
let indentation = getLeadingWhitespace(virtualModel.getLineContent(inheritLine));
if (enterResult.removeText) {
indentation = indentation.substring(0, indentation.length - enterResult.removeText);
}
if (enterResult.indentAction === IndentAction2.Indent || enterResult.indentAction === IndentAction2.IndentOutdent) {
indentation = indentConverter.shiftIndent(indentation);
} else if (enterResult.indentAction === IndentAction2.Outdent) {
indentation = indentConverter.unshiftIndent(indentation);
}
if (processedIndentRulesSupport.shouldDecrease(lineNumber)) {
indentation = indentConverter.unshiftIndent(indentation);
}
if (enterResult.appendText) {
indentation += enterResult.appendText;
}
return getLeadingWhitespace(indentation);
}
}
}
if (processedIndentRulesSupport.shouldDecrease(lineNumber)) {
if (indent.action === IndentAction2.Indent) {
return indent.indentation;
} else {
return indentConverter.unshiftIndent(indent.indentation);
}
} else {
if (indent.action === IndentAction2.Indent) {
return indentConverter.shiftIndent(indent.indentation);
} else {
return indent.indentation;
}
}
}
return null;
}
function getIndentForEnter(autoIndent, model, range2, indentConverter, languageConfigurationService) {
if (autoIndent < 4) {
return null;
}
const languageId = model.getLanguageIdAtPosition(range2.startLineNumber, range2.startColumn);
const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(languageId).indentRulesSupport;
if (!indentRulesSupport) {
return null;
}
model.tokenization.forceTokenization(range2.startLineNumber);
const indentationContextProcessor = new IndentationContextProcessor(model, languageConfigurationService);
const processedContextTokens = indentationContextProcessor.getProcessedTokenContextAroundRange(range2);
const afterEnterProcessedTokens = processedContextTokens.afterRangeProcessedTokens;
const beforeEnterProcessedTokens = processedContextTokens.beforeRangeProcessedTokens;
const beforeEnterIndent = getLeadingWhitespace(beforeEnterProcessedTokens.getLineContent());
const virtualModel = createVirtualModelWithModifiedTokensAtLine(model, range2.startLineNumber, beforeEnterProcessedTokens);
const languageIsDifferentFromLineStart = isLanguageDifferentFromLineStart(model, range2.getStartPosition());
const currentLine = model.getLineContent(range2.startLineNumber);
const currentLineIndent = getLeadingWhitespace(currentLine);
const afterEnterAction = getInheritIndentForLine(autoIndent, virtualModel, range2.startLineNumber + 1, void 0, languageConfigurationService);
if (!afterEnterAction) {
const beforeEnter = languageIsDifferentFromLineStart ? currentLineIndent : beforeEnterIndent;
return {
beforeEnter,
afterEnter: beforeEnter
};
}
let afterEnterIndent = languageIsDifferentFromLineStart ? currentLineIndent : afterEnterAction.indentation;
if (afterEnterAction.action === IndentAction2.Indent) {
afterEnterIndent = indentConverter.shiftIndent(afterEnterIndent);
}
if (indentRulesSupport.shouldDecrease(afterEnterProcessedTokens.getLineContent())) {
afterEnterIndent = indentConverter.unshiftIndent(afterEnterIndent);
}
return {
beforeEnter: languageIsDifferentFromLineStart ? currentLineIndent : beforeEnterIndent,
afterEnter: afterEnterIndent
};
}
function getIndentActionForType(autoIndent, model, range2, ch, indentConverter, languageConfigurationService) {
if (autoIndent < 4) {
return null;
}
const languageIsDifferentFromLineStart = isLanguageDifferentFromLineStart(model, range2.getStartPosition());
if (languageIsDifferentFromLineStart) {
return null;
}
const languageId = model.getLanguageIdAtPosition(range2.startLineNumber, range2.startColumn);
const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(languageId).indentRulesSupport;
if (!indentRulesSupport) {
return null;
}
const indentationContextProcessor = new IndentationContextProcessor(model, languageConfigurationService);
const processedContextTokens = indentationContextProcessor.getProcessedTokenContextAroundRange(range2);
const beforeRangeText = processedContextTokens.beforeRangeProcessedTokens.getLineContent();
const afterRangeText = processedContextTokens.afterRangeProcessedTokens.getLineContent();
const textAroundRange = beforeRangeText + afterRangeText;
const textAroundRangeWithCharacter = beforeRangeText + ch + afterRangeText;
if (!indentRulesSupport.shouldDecrease(textAroundRange) && indentRulesSupport.shouldDecrease(textAroundRangeWithCharacter)) {
const r = getInheritIndentForLine(autoIndent, model, range2.startLineNumber, false, languageConfigurationService);
if (!r) {
return null;
}
let indentation = r.indentation;
if (r.action !== IndentAction2.Indent) {
indentation = indentConverter.unshiftIndent(indentation);
}
return indentation;
}
return null;
}
function getIndentMetadata(model, lineNumber, languageConfigurationService) {
const indentRulesSupport = languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).indentRulesSupport;
if (!indentRulesSupport) {
return null;
}
if (lineNumber < 1 || lineNumber > model.getLineCount()) {
return null;
}
return indentRulesSupport.getIndentMetadata(model.getLineContent(lineNumber));
}
function createVirtualModelWithModifiedTokensAtLine(model, modifiedLineNumber, modifiedTokens) {
const virtualModel = {
tokenization: {
getLineTokens: (lineNumber) => {
if (lineNumber === modifiedLineNumber) {
return modifiedTokens;
} else {
return model.tokenization.getLineTokens(lineNumber);
}
},
getLanguageId: () => {
return model.getLanguageId();
},
getLanguageIdAtPosition: (lineNumber, column) => {
return model.getLanguageIdAtPosition(lineNumber, column);
}
},
getLineContent: (lineNumber) => {
if (lineNumber === modifiedLineNumber) {
return modifiedTokens.getLineContent();
} else {
return model.getLineContent(lineNumber);
}
}
};
return virtualModel;
}
var init_autoIndent = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/autoIndent.js"() {
init_strings();
init_languageConfiguration();
init_indentationLineProcessor();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorTypeOperations.js
function getTypingOperation(typedText, previousTypingOperation) {
if (typedText === " ") {
return previousTypingOperation === 5 || previousTypingOperation === 6 ? 6 : 5;
}
return 4;
}
function shouldPushStackElementBetween(previousTypingOperation, typingOperation) {
if (isTypingOperation(previousTypingOperation) && !isTypingOperation(typingOperation)) {
return true;
}
if (previousTypingOperation === 5) {
return false;
}
return normalizeOperationType(previousTypingOperation) !== normalizeOperationType(typingOperation);
}
function normalizeOperationType(type) {
return type === 6 || type === 5 ? "space" : type;
}
function isTypingOperation(type) {
return type === 4 || type === 5 || type === 6;
}
var TypeOperations, TypeWithAutoClosingCommand, CompositionOutcome;
var init_cursorTypeOperations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorTypeOperations.js"() {
init_errors();
init_strings();
init_replaceCommand();
init_shiftCommand();
init_surroundSelectionCommand();
init_cursorCommon();
init_wordCharacterClassifier();
init_range();
init_position();
init_languageConfiguration();
init_languageConfigurationRegistry();
init_supports();
init_autoIndent();
init_enterAction();
TypeOperations = class _TypeOperations {
static indent(config, model, selections) {
if (model === null || selections === null) {
return [];
}
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = new ShiftCommand(selections[i], {
isUnshift: false,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
}, config.languageConfigurationService);
}
return commands;
}
static outdent(config, model, selections) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = new ShiftCommand(selections[i], {
isUnshift: true,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
}, config.languageConfigurationService);
}
return commands;
}
static shiftIndent(config, indentation, count) {
count = count || 1;
return ShiftCommand.shiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
}
static unshiftIndent(config, indentation, count) {
count = count || 1;
return ShiftCommand.unshiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
}
static _distributedPaste(config, model, selections, text2) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = new ReplaceCommand(selections[i], text2[i]);
}
return new EditOperationResult(0, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
static _simplePaste(config, model, selections, text2, pasteOnNewLine) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
const position = selection.getPosition();
if (pasteOnNewLine && !selection.isEmpty()) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && text2.indexOf("\n") !== text2.length - 1) {
pasteOnNewLine = false;
}
if (pasteOnNewLine) {
const typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1);
commands[i] = new ReplaceCommandThatPreservesSelection(typeSelection, text2, selection, true);
} else {
commands[i] = new ReplaceCommand(selection, text2);
}
}
return new EditOperationResult(0, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
static _distributePasteToCursors(config, selections, text2, pasteOnNewLine, multicursorText) {
if (pasteOnNewLine) {
return null;
}
if (selections.length === 1) {
return null;
}
if (multicursorText && multicursorText.length === selections.length) {
return multicursorText;
}
if (config.multiCursorPaste === "spread") {
if (text2.charCodeAt(text2.length - 1) === 10) {
text2 = text2.substr(0, text2.length - 1);
}
if (text2.charCodeAt(text2.length - 1) === 13) {
text2 = text2.substr(0, text2.length - 1);
}
const lines = splitLines(text2);
if (lines.length === selections.length) {
return lines;
}
}
return null;
}
static paste(config, model, selections, text2, pasteOnNewLine, multicursorText) {
const distributedPaste = this._distributePasteToCursors(config, selections, text2, pasteOnNewLine, multicursorText);
if (distributedPaste) {
selections = selections.sort(Range.compareRangesUsingStarts);
return this._distributedPaste(config, model, selections, distributedPaste);
} else {
return this._simplePaste(config, model, selections, text2, pasteOnNewLine);
}
}
static _goodIndentForLine(config, model, lineNumber) {
let action = null;
let indentation = "";
const expectedIndentAction = getInheritIndentForLine(config.autoIndent, model, lineNumber, false, config.languageConfigurationService);
if (expectedIndentAction) {
action = expectedIndentAction.action;
indentation = expectedIndentAction.indentation;
} else if (lineNumber > 1) {
let lastLineNumber;
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
const lineText = model.getLineContent(lastLineNumber);
const nonWhitespaceIdx = lastNonWhitespaceIndex(lineText);
if (nonWhitespaceIdx >= 0) {
break;
}
}
if (lastLineNumber < 1) {
return null;
}
const maxColumn = model.getLineMaxColumn(lastLineNumber);
const expectedEnterAction = getEnterAction(config.autoIndent, model, new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn), config.languageConfigurationService);
if (expectedEnterAction) {
indentation = expectedEnterAction.indentation + expectedEnterAction.appendText;
}
}
if (action) {
if (action === IndentAction2.Indent) {
indentation = _TypeOperations.shiftIndent(config, indentation);
}
if (action === IndentAction2.Outdent) {
indentation = _TypeOperations.unshiftIndent(config, indentation);
}
indentation = config.normalizeIndentation(indentation);
}
if (!indentation) {
return null;
}
return indentation;
}
static _replaceJumpToNextIndent(config, model, selection, insertsAutoWhitespace) {
let typeText = "";
const position = selection.getStartPosition();
if (config.insertSpaces) {
const visibleColumnFromColumn = config.visibleColumnFromColumn(model, position);
const indentSize = config.indentSize;
const spacesCnt = indentSize - visibleColumnFromColumn % indentSize;
for (let i = 0; i < spacesCnt; i++) {
typeText += " ";
}
} else {
typeText = " ";
}
return new ReplaceCommand(selection, typeText, insertsAutoWhitespace);
}
static tab(config, model, selections) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
if (selection.isEmpty()) {
const lineText = model.getLineContent(selection.startLineNumber);
if (/^\s*$/.test(lineText) && model.tokenization.isCheapToTokenize(selection.startLineNumber)) {
let goodIndent = this._goodIndentForLine(config, model, selection.startLineNumber);
goodIndent = goodIndent || " ";
const possibleTypeText = config.normalizeIndentation(goodIndent);
if (!lineText.startsWith(possibleTypeText)) {
commands[i] = new ReplaceCommand(new Range(selection.startLineNumber, 1, selection.startLineNumber, lineText.length + 1), possibleTypeText, true);
continue;
}
}
commands[i] = this._replaceJumpToNextIndent(config, model, selection, true);
} else {
if (selection.startLineNumber === selection.endLineNumber) {
const lineMaxColumn = model.getLineMaxColumn(selection.startLineNumber);
if (selection.startColumn !== 1 || selection.endColumn !== lineMaxColumn) {
commands[i] = this._replaceJumpToNextIndent(config, model, selection, false);
continue;
}
}
commands[i] = new ShiftCommand(selection, {
isUnshift: false,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
}, config.languageConfigurationService);
}
}
return commands;
}
static compositionType(prevEditOperationType, config, model, selections, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
const commands = selections.map((selection) => this._compositionType(model, selection, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta));
return new EditOperationResult(4, commands, {
shouldPushStackElementBefore: shouldPushStackElementBetween(
prevEditOperationType,
4
/* EditOperationType.TypingOther */
),
shouldPushStackElementAfter: false
});
}
static _compositionType(model, selection, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
if (!selection.isEmpty()) {
return null;
}
const pos = selection.getPosition();
const startColumn = Math.max(1, pos.column - replacePrevCharCnt);
const endColumn = Math.min(model.getLineMaxColumn(pos.lineNumber), pos.column + replaceNextCharCnt);
const range2 = new Range(pos.lineNumber, startColumn, pos.lineNumber, endColumn);
const oldText = model.getValueInRange(range2);
if (oldText === text2 && positionDelta === 0) {
return null;
}
return new ReplaceCommandWithOffsetCursorState(range2, text2, 0, positionDelta);
}
static _typeCommand(range2, text2, keepPosition) {
if (keepPosition) {
return new ReplaceCommandWithoutChangingPosition(range2, text2, true);
} else {
return new ReplaceCommand(range2, text2, true);
}
}
static _enter(config, model, keepPosition, range2) {
if (config.autoIndent === 0) {
return _TypeOperations._typeCommand(range2, "\n", keepPosition);
}
if (!model.tokenization.isCheapToTokenize(range2.getStartPosition().lineNumber) || config.autoIndent === 1) {
const lineText2 = model.getLineContent(range2.startLineNumber);
const indentation2 = getLeadingWhitespace(lineText2).substring(0, range2.startColumn - 1);
return _TypeOperations._typeCommand(range2, "\n" + config.normalizeIndentation(indentation2), keepPosition);
}
const r = getEnterAction(config.autoIndent, model, range2, config.languageConfigurationService);
if (r) {
if (r.indentAction === IndentAction2.None) {
return _TypeOperations._typeCommand(range2, "\n" + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
} else if (r.indentAction === IndentAction2.Indent) {
return _TypeOperations._typeCommand(range2, "\n" + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
} else if (r.indentAction === IndentAction2.IndentOutdent) {
const normalIndent = config.normalizeIndentation(r.indentation);
const increasedIndent = config.normalizeIndentation(r.indentation + r.appendText);
const typeText = "\n" + increasedIndent + "\n" + normalIndent;
if (keepPosition) {
return new ReplaceCommandWithoutChangingPosition(range2, typeText, true);
} else {
return new ReplaceCommandWithOffsetCursorState(range2, typeText, -1, increasedIndent.length - normalIndent.length, true);
}
} else if (r.indentAction === IndentAction2.Outdent) {
const actualIndentation = _TypeOperations.unshiftIndent(config, r.indentation);
return _TypeOperations._typeCommand(range2, "\n" + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition);
}
}
const lineText = model.getLineContent(range2.startLineNumber);
const indentation = getLeadingWhitespace(lineText).substring(0, range2.startColumn - 1);
if (config.autoIndent >= 4) {
const ir = getIndentForEnter(config.autoIndent, model, range2, {
unshiftIndent: (indent) => {
return _TypeOperations.unshiftIndent(config, indent);
},
shiftIndent: (indent) => {
return _TypeOperations.shiftIndent(config, indent);
},
normalizeIndentation: (indent) => {
return config.normalizeIndentation(indent);
}
}, config.languageConfigurationService);
if (ir) {
let oldEndViewColumn = config.visibleColumnFromColumn(model, range2.getEndPosition());
const oldEndColumn = range2.endColumn;
const newLineContent = model.getLineContent(range2.endLineNumber);
const firstNonWhitespace = firstNonWhitespaceIndex(newLineContent);
if (firstNonWhitespace >= 0) {
range2 = range2.setEndPosition(range2.endLineNumber, Math.max(range2.endColumn, firstNonWhitespace + 1));
} else {
range2 = range2.setEndPosition(range2.endLineNumber, model.getLineMaxColumn(range2.endLineNumber));
}
if (keepPosition) {
return new ReplaceCommandWithoutChangingPosition(range2, "\n" + config.normalizeIndentation(ir.afterEnter), true);
} else {
let offset = 0;
if (oldEndColumn <= firstNonWhitespace + 1) {
if (!config.insertSpaces) {
oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize);
}
offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0);
}
return new ReplaceCommandWithOffsetCursorState(range2, "\n" + config.normalizeIndentation(ir.afterEnter), 0, offset, true);
}
}
}
return _TypeOperations._typeCommand(range2, "\n" + config.normalizeIndentation(indentation), keepPosition);
}
static _isAutoIndentType(config, model, selections) {
if (config.autoIndent < 4) {
return false;
}
for (let i = 0, len = selections.length; i < len; i++) {
if (!model.tokenization.isCheapToTokenize(selections[i].getEndPosition().lineNumber)) {
return false;
}
}
return true;
}
static _runAutoIndentType(config, model, range2, ch) {
const currentIndentation = getIndentationAtPosition(model, range2.startLineNumber, range2.startColumn);
const actualIndentation = getIndentActionForType(config.autoIndent, model, range2, ch, {
shiftIndent: (indentation) => {
return _TypeOperations.shiftIndent(config, indentation);
},
unshiftIndent: (indentation) => {
return _TypeOperations.unshiftIndent(config, indentation);
}
}, config.languageConfigurationService);
if (actualIndentation === null) {
return null;
}
if (actualIndentation !== config.normalizeIndentation(currentIndentation)) {
const firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range2.startLineNumber);
if (firstNonWhitespace === 0) {
return _TypeOperations._typeCommand(new Range(range2.startLineNumber, 1, range2.endLineNumber, range2.endColumn), config.normalizeIndentation(actualIndentation) + ch, false);
} else {
return _TypeOperations._typeCommand(new Range(range2.startLineNumber, 1, range2.endLineNumber, range2.endColumn), config.normalizeIndentation(actualIndentation) + model.getLineContent(range2.startLineNumber).substring(firstNonWhitespace - 1, range2.startColumn - 1) + ch, false);
}
}
return null;
}
static _isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch) {
if (config.autoClosingOvertype === "never") {
return false;
}
if (!config.autoClosingPairs.autoClosingPairsCloseSingleChar.has(ch)) {
return false;
}
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
if (!selection.isEmpty()) {
return false;
}
const position = selection.getPosition();
const lineText = model.getLineContent(position.lineNumber);
const afterCharacter = lineText.charAt(position.column - 1);
if (afterCharacter !== ch) {
return false;
}
const chIsQuote = isQuote(ch);
const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : 0;
if (beforeCharacter === 92 && chIsQuote) {
return false;
}
if (config.autoClosingOvertype === "auto") {
let found = false;
for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {
const autoClosedCharacter = autoClosedCharacters[j];
if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
return true;
}
static _runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
const position = selection.getPosition();
const typeSelection = new Range(position.lineNumber, position.column, position.lineNumber, position.column + 1);
commands[i] = new ReplaceCommand(typeSelection, ch);
}
return new EditOperationResult(4, commands, {
shouldPushStackElementBefore: shouldPushStackElementBetween(
prevEditOperationType,
4
/* EditOperationType.TypingOther */
),
shouldPushStackElementAfter: false
});
}
static _isBeforeClosingBrace(config, lineAfter) {
const nextChar = lineAfter.charAt(0);
const potentialStartingBraces = config.autoClosingPairs.autoClosingPairsOpenByStart.get(nextChar) || [];
const potentialClosingBraces = config.autoClosingPairs.autoClosingPairsCloseByStart.get(nextChar) || [];
const isBeforeStartingBrace = potentialStartingBraces.some((x) => lineAfter.startsWith(x.open));
const isBeforeClosingBrace = potentialClosingBraces.some((x) => lineAfter.startsWith(x.close));
return !isBeforeStartingBrace && isBeforeClosingBrace;
}
/**
* Determine if typing `ch` at all `positions` in the `model` results in an
* auto closing open sequence being typed.
*
* Auto closing open sequences can consist of multiple characters, which
* can lead to ambiguities. In such a case, the longest auto-closing open
* sequence is returned.
*/
static _findAutoClosingPairOpen(config, model, positions, ch) {
const candidates = config.autoClosingPairs.autoClosingPairsOpenByEnd.get(ch);
if (!candidates) {
return null;
}
let result = null;
for (const candidate of candidates) {
if (result === null || candidate.open.length > result.open.length) {
let candidateIsMatch = true;
for (const position of positions) {
const relevantText = model.getValueInRange(new Range(position.lineNumber, position.column - candidate.open.length + 1, position.lineNumber, position.column));
if (relevantText + ch !== candidate.open) {
candidateIsMatch = false;
break;
}
}
if (candidateIsMatch) {
result = candidate;
}
}
}
return result;
}
/**
* Find another auto-closing pair that is contained by the one passed in.
*
* e.g. when having [(,)] and [(*,*)] as auto-closing pairs
* this method will find [(,)] as a containment pair for [(*,*)]
*/
static _findContainedAutoClosingPair(config, pair) {
if (pair.open.length <= 1) {
return null;
}
const lastChar = pair.close.charAt(pair.close.length - 1);
const candidates = config.autoClosingPairs.autoClosingPairsCloseByEnd.get(lastChar) || [];
let result = null;
for (const candidate of candidates) {
if (candidate.open !== pair.open && pair.open.includes(candidate.open) && pair.close.endsWith(candidate.close)) {
if (!result || candidate.open.length > result.open.length) {
result = candidate;
}
}
}
return result;
}
static _getAutoClosingPairClose(config, model, selections, ch, chIsAlreadyTyped) {
for (const selection of selections) {
if (!selection.isEmpty()) {
return null;
}
}
const positions = selections.map((s) => {
const position = s.getPosition();
if (chIsAlreadyTyped) {
return { lineNumber: position.lineNumber, beforeColumn: position.column - ch.length, afterColumn: position.column };
} else {
return { lineNumber: position.lineNumber, beforeColumn: position.column, afterColumn: position.column };
}
});
const pair = this._findAutoClosingPairOpen(config, model, positions.map((p) => new Position(p.lineNumber, p.beforeColumn)), ch);
if (!pair) {
return null;
}
let autoCloseConfig;
let shouldAutoCloseBefore;
const chIsQuote = isQuote(ch);
if (chIsQuote) {
autoCloseConfig = config.autoClosingQuotes;
shouldAutoCloseBefore = config.shouldAutoCloseBefore.quote;
} else {
const pairIsForComments = config.blockCommentStartToken ? pair.open.includes(config.blockCommentStartToken) : false;
if (pairIsForComments) {
autoCloseConfig = config.autoClosingComments;
shouldAutoCloseBefore = config.shouldAutoCloseBefore.comment;
} else {
autoCloseConfig = config.autoClosingBrackets;
shouldAutoCloseBefore = config.shouldAutoCloseBefore.bracket;
}
}
if (autoCloseConfig === "never") {
return null;
}
const containedPair = this._findContainedAutoClosingPair(config, pair);
const containedPairClose = containedPair ? containedPair.close : "";
let isContainedPairPresent = true;
for (const position of positions) {
const { lineNumber, beforeColumn, afterColumn } = position;
const lineText = model.getLineContent(lineNumber);
const lineBefore = lineText.substring(0, beforeColumn - 1);
const lineAfter = lineText.substring(afterColumn - 1);
if (!lineAfter.startsWith(containedPairClose)) {
isContainedPairPresent = false;
}
if (lineAfter.length > 0) {
const characterAfter = lineAfter.charAt(0);
const isBeforeCloseBrace = _TypeOperations._isBeforeClosingBrace(config, lineAfter);
if (!isBeforeCloseBrace && !shouldAutoCloseBefore(characterAfter)) {
return null;
}
}
if (pair.open.length === 1 && (ch === "'" || ch === '"') && autoCloseConfig !== "always") {
const wordSeparators2 = getMapForWordSeparators(config.wordSeparators, []);
if (lineBefore.length > 0) {
const characterBefore = lineBefore.charCodeAt(lineBefore.length - 1);
if (wordSeparators2.get(characterBefore) === 0) {
return null;
}
}
}
if (!model.tokenization.isCheapToTokenize(lineNumber)) {
return null;
}
model.tokenization.forceTokenization(lineNumber);
const lineTokens = model.tokenization.getLineTokens(lineNumber);
const scopedLineTokens = createScopedLineTokens(lineTokens, beforeColumn - 1);
if (!pair.shouldAutoClose(scopedLineTokens, beforeColumn - scopedLineTokens.firstCharOffset)) {
return null;
}
const neutralCharacter = pair.findNeutralCharacter();
if (neutralCharacter) {
const tokenType = model.tokenization.getTokenTypeIfInsertingCharacter(lineNumber, beforeColumn, neutralCharacter);
if (!pair.isOK(tokenType)) {
return null;
}
}
}
if (isContainedPairPresent) {
return pair.close.substring(0, pair.close.length - containedPairClose.length);
} else {
return pair.close;
}
}
static _runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, chIsAlreadyTyped, autoClosingPairClose) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
commands[i] = new TypeWithAutoClosingCommand(selection, ch, !chIsAlreadyTyped, autoClosingPairClose);
}
return new EditOperationResult(4, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
static _shouldSurroundChar(config, ch) {
if (isQuote(ch)) {
return config.autoSurround === "quotes" || config.autoSurround === "languageDefined";
} else {
return config.autoSurround === "brackets" || config.autoSurround === "languageDefined";
}
}
static _isSurroundSelectionType(config, model, selections, ch) {
if (!_TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {
return false;
}
const isTypingAQuoteCharacter = isQuote(ch);
for (const selection of selections) {
if (selection.isEmpty()) {
return false;
}
let selectionContainsOnlyWhitespace = true;
for (let lineNumber = selection.startLineNumber; lineNumber <= selection.endLineNumber; lineNumber++) {
const lineText = model.getLineContent(lineNumber);
const startIndex = lineNumber === selection.startLineNumber ? selection.startColumn - 1 : 0;
const endIndex = lineNumber === selection.endLineNumber ? selection.endColumn - 1 : lineText.length;
const selectedText = lineText.substring(startIndex, endIndex);
if (/[^ \t]/.test(selectedText)) {
selectionContainsOnlyWhitespace = false;
break;
}
}
if (selectionContainsOnlyWhitespace) {
return false;
}
if (isTypingAQuoteCharacter && selection.startLineNumber === selection.endLineNumber && selection.startColumn + 1 === selection.endColumn) {
const selectionText = model.getValueInRange(selection);
if (isQuote(selectionText)) {
return false;
}
}
}
return true;
}
static _runSurroundSelectionType(prevEditOperationType, config, model, selections, ch) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
const closeCharacter = config.surroundingPairs[ch];
commands[i] = new SurroundSelectionCommand(selection, ch, closeCharacter);
}
return new EditOperationResult(0, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
static _isTypeInterceptorElectricChar(config, model, selections) {
if (selections.length === 1 && model.tokenization.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {
return true;
}
return false;
}
static _typeInterceptorElectricChar(prevEditOperationType, config, model, selection, ch) {
if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {
return null;
}
const position = selection.getPosition();
model.tokenization.forceTokenization(position.lineNumber);
const lineTokens = model.tokenization.getLineTokens(position.lineNumber);
let electricAction;
try {
electricAction = config.onElectricCharacter(ch, lineTokens, position.column);
} catch (e) {
onUnexpectedError(e);
return null;
}
if (!electricAction) {
return null;
}
if (electricAction.matchOpenBracket) {
const endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;
const match2 = model.bracketPairs.findMatchingBracketUp(
electricAction.matchOpenBracket,
{
lineNumber: position.lineNumber,
column: endColumn
},
500
/* give at most 500ms to compute */
);
if (match2) {
if (match2.startLineNumber === position.lineNumber) {
return null;
}
const matchLine = model.getLineContent(match2.startLineNumber);
const matchLineIndentation = getLeadingWhitespace(matchLine);
const newIndentation = config.normalizeIndentation(matchLineIndentation);
const lineText = model.getLineContent(position.lineNumber);
const lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;
const prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);
const typeText = newIndentation + prefix + ch;
const typeSelection = new Range(position.lineNumber, 1, position.lineNumber, position.column);
const command = new ReplaceCommand(typeSelection, typeText);
return new EditOperationResult(getTypingOperation(typeText, prevEditOperationType), [command], {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: true
});
}
}
return null;
}
/**
* This is very similar with typing, but the character is already in the text buffer!
*/
static compositionEndWithInterceptors(prevEditOperationType, config, model, compositions, selections, autoClosedCharacters) {
if (!compositions) {
return null;
}
let insertedText = null;
for (const composition of compositions) {
if (insertedText === null) {
insertedText = composition.insertedText;
} else if (insertedText !== composition.insertedText) {
return null;
}
}
if (!insertedText || insertedText.length !== 1) {
return null;
}
const ch = insertedText;
let hasDeletion = false;
for (const composition of compositions) {
if (composition.deletedText.length !== 0) {
hasDeletion = true;
break;
}
}
if (hasDeletion) {
if (!_TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {
return null;
}
const isTypingAQuoteCharacter = isQuote(ch);
for (const composition of compositions) {
if (composition.deletedSelectionStart !== 0 || composition.deletedSelectionEnd !== composition.deletedText.length) {
return null;
}
if (/^[ \t]+$/.test(composition.deletedText)) {
return null;
}
if (isTypingAQuoteCharacter && isQuote(composition.deletedText)) {
return null;
}
}
const positions = [];
for (const selection of selections) {
if (!selection.isEmpty()) {
return null;
}
positions.push(selection.getPosition());
}
if (positions.length !== compositions.length) {
return null;
}
const commands = [];
for (let i = 0, len = positions.length; i < len; i++) {
commands.push(new CompositionSurroundSelectionCommand(positions[i], compositions[i].deletedText, config.surroundingPairs[ch]));
}
return new EditOperationResult(4, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
const commands = selections.map((s) => new ReplaceCommand(new Range(s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), "", false));
return new EditOperationResult(4, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, true);
if (autoClosingPairClose !== null) {
return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, true, autoClosingPairClose);
}
return null;
}
static typeWithInterceptors(isDoingComposition, prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {
if (!isDoingComposition && ch === "\n") {
const commands2 = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands2[i] = _TypeOperations._enter(config, model, false, selections[i]);
}
return new EditOperationResult(4, commands2, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
if (!isDoingComposition && this._isAutoIndentType(config, model, selections)) {
const commands2 = [];
let autoIndentFails = false;
for (let i = 0, len = selections.length; i < len; i++) {
commands2[i] = this._runAutoIndentType(config, model, selections[i], ch);
if (!commands2[i]) {
autoIndentFails = true;
break;
}
}
if (!autoIndentFails) {
return new EditOperationResult(4, commands2, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
}
if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch);
}
if (!isDoingComposition) {
const autoClosingPairClose = this._getAutoClosingPairClose(config, model, selections, ch, false);
if (autoClosingPairClose) {
return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, false, autoClosingPairClose);
}
}
if (!isDoingComposition && this._isSurroundSelectionType(config, model, selections, ch)) {
return this._runSurroundSelectionType(prevEditOperationType, config, model, selections, ch);
}
if (!isDoingComposition && this._isTypeInterceptorElectricChar(config, model, selections)) {
const r = this._typeInterceptorElectricChar(prevEditOperationType, config, model, selections[0], ch);
if (r) {
return r;
}
}
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = new ReplaceCommand(selections[i], ch);
}
const opType = getTypingOperation(ch, prevEditOperationType);
return new EditOperationResult(opType, commands, {
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),
shouldPushStackElementAfter: false
});
}
static typeWithoutInterceptors(prevEditOperationType, config, model, selections, str) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = new ReplaceCommand(selections[i], str);
}
const opType = getTypingOperation(str, prevEditOperationType);
return new EditOperationResult(opType, commands, {
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),
shouldPushStackElementAfter: false
});
}
static lineInsertBefore(config, model, selections) {
if (model === null || selections === null) {
return [];
}
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
let lineNumber = selections[i].positionLineNumber;
if (lineNumber === 1) {
commands[i] = new ReplaceCommandWithoutChangingPosition(new Range(1, 1, 1, 1), "\n");
} else {
lineNumber--;
const column = model.getLineMaxColumn(lineNumber);
commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));
}
}
return commands;
}
static lineInsertAfter(config, model, selections) {
if (model === null || selections === null) {
return [];
}
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
const lineNumber = selections[i].positionLineNumber;
const column = model.getLineMaxColumn(lineNumber);
commands[i] = this._enter(config, model, false, new Range(lineNumber, column, lineNumber, column));
}
return commands;
}
static lineBreakInsert(config, model, selections) {
const commands = [];
for (let i = 0, len = selections.length; i < len; i++) {
commands[i] = this._enter(config, model, true, selections[i]);
}
return commands;
}
};
TypeWithAutoClosingCommand = class extends ReplaceCommandWithOffsetCursorState {
constructor(selection, openCharacter, insertOpenCharacter, closeCharacter) {
super(selection, (insertOpenCharacter ? openCharacter : "") + closeCharacter, 0, -closeCharacter.length);
this._openCharacter = openCharacter;
this._closeCharacter = closeCharacter;
this.closeCharacterRange = null;
this.enclosingRange = null;
}
computeCursorState(model, helper) {
const inverseEditOperations = helper.getInverseEditOperations();
const range2 = inverseEditOperations[0].range;
this.closeCharacterRange = new Range(range2.startLineNumber, range2.endColumn - this._closeCharacter.length, range2.endLineNumber, range2.endColumn);
this.enclosingRange = new Range(range2.startLineNumber, range2.endColumn - this._openCharacter.length - this._closeCharacter.length, range2.endLineNumber, range2.endColumn);
return super.computeCursorState(model, helper);
}
};
CompositionOutcome = class {
constructor(deletedText, deletedSelectionStart, deletedSelectionEnd, insertedText, insertedSelectionStart, insertedSelectionEnd) {
this.deletedText = deletedText;
this.deletedSelectionStart = deletedSelectionStart;
this.deletedSelectionEnd = deletedSelectionEnd;
this.insertedText = insertedText;
this.insertedSelectionStart = insertedSelectionStart;
this.insertedSelectionEnd = insertedSelectionEnd;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js
var EditorContextKeys;
var init_editorContextKeys = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js"() {
init_nls();
init_contextkey();
(function(EditorContextKeys2) {
EditorContextKeys2.editorSimpleInput = new RawContextKey("editorSimpleInput", false, true);
EditorContextKeys2.editorTextFocus = new RawContextKey("editorTextFocus", false, localize("editorTextFocus", "Whether the editor text has focus (cursor is blinking)"));
EditorContextKeys2.focus = new RawContextKey("editorFocus", false, localize("editorFocus", "Whether the editor or an editor widget has focus (e.g. focus is in the find widget)"));
EditorContextKeys2.textInputFocus = new RawContextKey("textInputFocus", false, localize("textInputFocus", "Whether an editor or a rich text input has focus (cursor is blinking)"));
EditorContextKeys2.readOnly = new RawContextKey("editorReadonly", false, localize("editorReadonly", "Whether the editor is read-only"));
EditorContextKeys2.inDiffEditor = new RawContextKey("inDiffEditor", false, localize("inDiffEditor", "Whether the context is a diff editor"));
EditorContextKeys2.isEmbeddedDiffEditor = new RawContextKey("isEmbeddedDiffEditor", false, localize("isEmbeddedDiffEditor", "Whether the context is an embedded diff editor"));
EditorContextKeys2.inMultiDiffEditor = new RawContextKey("inMultiDiffEditor", false, localize("inMultiDiffEditor", "Whether the context is a multi diff editor"));
EditorContextKeys2.multiDiffEditorAllCollapsed = new RawContextKey("multiDiffEditorAllCollapsed", void 0, localize("multiDiffEditorAllCollapsed", "Whether all files in multi diff editor are collapsed"));
EditorContextKeys2.hasChanges = new RawContextKey("diffEditorHasChanges", false, localize("diffEditorHasChanges", "Whether the diff editor has changes"));
EditorContextKeys2.comparingMovedCode = new RawContextKey("comparingMovedCode", false, localize("comparingMovedCode", "Whether a moved code block is selected for comparison"));
EditorContextKeys2.accessibleDiffViewerVisible = new RawContextKey("accessibleDiffViewerVisible", false, localize("accessibleDiffViewerVisible", "Whether the accessible diff viewer is visible"));
EditorContextKeys2.diffEditorRenderSideBySideInlineBreakpointReached = new RawContextKey("diffEditorRenderSideBySideInlineBreakpointReached", false, localize("diffEditorRenderSideBySideInlineBreakpointReached", "Whether the diff editor render side by side inline breakpoint is reached"));
EditorContextKeys2.diffEditorInlineMode = new RawContextKey("diffEditorInlineMode", false, localize("diffEditorInlineMode", "Whether inline mode is active"));
EditorContextKeys2.diffEditorOriginalWritable = new RawContextKey("diffEditorOriginalWritable", false, localize("diffEditorOriginalWritable", "Whether modified is writable in the diff editor"));
EditorContextKeys2.diffEditorModifiedWritable = new RawContextKey("diffEditorModifiedWritable", false, localize("diffEditorModifiedWritable", "Whether modified is writable in the diff editor"));
EditorContextKeys2.diffEditorOriginalUri = new RawContextKey("diffEditorOriginalUri", "", localize("diffEditorOriginalUri", "The uri of the original document"));
EditorContextKeys2.diffEditorModifiedUri = new RawContextKey("diffEditorModifiedUri", "", localize("diffEditorModifiedUri", "The uri of the modified document"));
EditorContextKeys2.columnSelection = new RawContextKey("editorColumnSelection", false, localize("editorColumnSelection", "Whether `editor.columnSelection` is enabled"));
EditorContextKeys2.writable = EditorContextKeys2.readOnly.toNegated();
EditorContextKeys2.hasNonEmptySelection = new RawContextKey("editorHasSelection", false, localize("editorHasSelection", "Whether the editor has text selected"));
EditorContextKeys2.hasOnlyEmptySelection = EditorContextKeys2.hasNonEmptySelection.toNegated();
EditorContextKeys2.hasMultipleSelections = new RawContextKey("editorHasMultipleSelections", false, localize("editorHasMultipleSelections", "Whether the editor has multiple selections"));
EditorContextKeys2.hasSingleSelection = EditorContextKeys2.hasMultipleSelections.toNegated();
EditorContextKeys2.tabMovesFocus = new RawContextKey("editorTabMovesFocus", false, localize("editorTabMovesFocus", "Whether `Tab` will move focus out of the editor"));
EditorContextKeys2.tabDoesNotMoveFocus = EditorContextKeys2.tabMovesFocus.toNegated();
EditorContextKeys2.isInEmbeddedEditor = new RawContextKey("isInEmbeddedEditor", false, true);
EditorContextKeys2.canUndo = new RawContextKey("canUndo", false, true);
EditorContextKeys2.canRedo = new RawContextKey("canRedo", false, true);
EditorContextKeys2.hoverVisible = new RawContextKey("editorHoverVisible", false, localize("editorHoverVisible", "Whether the editor hover is visible"));
EditorContextKeys2.hoverFocused = new RawContextKey("editorHoverFocused", false, localize("editorHoverFocused", "Whether the editor hover is focused"));
EditorContextKeys2.stickyScrollFocused = new RawContextKey("stickyScrollFocused", false, localize("stickyScrollFocused", "Whether the sticky scroll is focused"));
EditorContextKeys2.stickyScrollVisible = new RawContextKey("stickyScrollVisible", false, localize("stickyScrollVisible", "Whether the sticky scroll is visible"));
EditorContextKeys2.standaloneColorPickerVisible = new RawContextKey("standaloneColorPickerVisible", false, localize("standaloneColorPickerVisible", "Whether the standalone color picker is visible"));
EditorContextKeys2.standaloneColorPickerFocused = new RawContextKey("standaloneColorPickerFocused", false, localize("standaloneColorPickerFocused", "Whether the standalone color picker is focused"));
EditorContextKeys2.inCompositeEditor = new RawContextKey("inCompositeEditor", void 0, localize("inCompositeEditor", "Whether the editor is part of a larger editor (e.g. notebooks)"));
EditorContextKeys2.notInCompositeEditor = EditorContextKeys2.inCompositeEditor.toNegated();
EditorContextKeys2.languageId = new RawContextKey("editorLangId", "", localize("editorLangId", "The language identifier of the editor"));
EditorContextKeys2.hasCompletionItemProvider = new RawContextKey("editorHasCompletionItemProvider", false, localize("editorHasCompletionItemProvider", "Whether the editor has a completion item provider"));
EditorContextKeys2.hasCodeActionsProvider = new RawContextKey("editorHasCodeActionsProvider", false, localize("editorHasCodeActionsProvider", "Whether the editor has a code actions provider"));
EditorContextKeys2.hasCodeLensProvider = new RawContextKey("editorHasCodeLensProvider", false, localize("editorHasCodeLensProvider", "Whether the editor has a code lens provider"));
EditorContextKeys2.hasDefinitionProvider = new RawContextKey("editorHasDefinitionProvider", false, localize("editorHasDefinitionProvider", "Whether the editor has a definition provider"));
EditorContextKeys2.hasDeclarationProvider = new RawContextKey("editorHasDeclarationProvider", false, localize("editorHasDeclarationProvider", "Whether the editor has a declaration provider"));
EditorContextKeys2.hasImplementationProvider = new RawContextKey("editorHasImplementationProvider", false, localize("editorHasImplementationProvider", "Whether the editor has an implementation provider"));
EditorContextKeys2.hasTypeDefinitionProvider = new RawContextKey("editorHasTypeDefinitionProvider", false, localize("editorHasTypeDefinitionProvider", "Whether the editor has a type definition provider"));
EditorContextKeys2.hasHoverProvider = new RawContextKey("editorHasHoverProvider", false, localize("editorHasHoverProvider", "Whether the editor has a hover provider"));
EditorContextKeys2.hasDocumentHighlightProvider = new RawContextKey("editorHasDocumentHighlightProvider", false, localize("editorHasDocumentHighlightProvider", "Whether the editor has a document highlight provider"));
EditorContextKeys2.hasDocumentSymbolProvider = new RawContextKey("editorHasDocumentSymbolProvider", false, localize("editorHasDocumentSymbolProvider", "Whether the editor has a document symbol provider"));
EditorContextKeys2.hasReferenceProvider = new RawContextKey("editorHasReferenceProvider", false, localize("editorHasReferenceProvider", "Whether the editor has a reference provider"));
EditorContextKeys2.hasRenameProvider = new RawContextKey("editorHasRenameProvider", false, localize("editorHasRenameProvider", "Whether the editor has a rename provider"));
EditorContextKeys2.hasSignatureHelpProvider = new RawContextKey("editorHasSignatureHelpProvider", false, localize("editorHasSignatureHelpProvider", "Whether the editor has a signature help provider"));
EditorContextKeys2.hasInlayHintsProvider = new RawContextKey("editorHasInlayHintsProvider", false, localize("editorHasInlayHintsProvider", "Whether the editor has an inline hints provider"));
EditorContextKeys2.hasDocumentFormattingProvider = new RawContextKey("editorHasDocumentFormattingProvider", false, localize("editorHasDocumentFormattingProvider", "Whether the editor has a document formatting provider"));
EditorContextKeys2.hasDocumentSelectionFormattingProvider = new RawContextKey("editorHasDocumentSelectionFormattingProvider", false, localize("editorHasDocumentSelectionFormattingProvider", "Whether the editor has a document selection formatting provider"));
EditorContextKeys2.hasMultipleDocumentFormattingProvider = new RawContextKey("editorHasMultipleDocumentFormattingProvider", false, localize("editorHasMultipleDocumentFormattingProvider", "Whether the editor has multiple document formatting providers"));
EditorContextKeys2.hasMultipleDocumentSelectionFormattingProvider = new RawContextKey("editorHasMultipleDocumentSelectionFormattingProvider", false, localize("editorHasMultipleDocumentSelectionFormattingProvider", "Whether the editor has multiple document selection formatting providers"));
})(EditorContextKeys || (EditorContextKeys = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/coreCommands.js
function registerColumnSelection(id, keybinding) {
KeybindingsRegistry.registerKeybindingRule({
id,
primary: keybinding,
when: columnSelectionCondition,
weight: CORE_WEIGHT + 1
});
}
function registerCommand2(command) {
command.register();
return command;
}
function registerOverwritableCommand(handlerId, metadata) {
registerCommand2(new EditorHandlerCommand("default:" + handlerId, handlerId));
registerCommand2(new EditorHandlerCommand(handlerId, handlerId, metadata));
}
var CORE_WEIGHT, CoreEditorCommand, EditorScroll_, RevealLine_, EditorOrNativeTextInputCommand, CoreNavigationCommands, columnSelectionCondition, CoreEditingCommands, EditorHandlerCommand;
var init_coreCommands = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/coreCommands.js"() {
init_nls();
init_browser();
init_types();
init_aria2();
init_editorExtensions();
init_codeEditorService();
init_cursorColumnSelection();
init_cursorCommon();
init_cursorDeleteOperations();
init_cursorMoveCommands();
init_cursorTypeOperations();
init_position();
init_range();
init_editorContextKeys();
init_contextkey();
init_keybindingsRegistry();
init_dom();
CORE_WEIGHT = 0;
CoreEditorCommand = class extends EditorCommand {
runEditorCommand(accessor, editor2, args) {
const viewModel = editor2._getViewModel();
if (!viewModel) {
return;
}
this.runCoreEditorCommand(viewModel, args || {});
}
};
(function(EditorScroll_2) {
const isEditorScrollArgs = function(arg) {
if (!isObject(arg)) {
return false;
}
const scrollArg = arg;
if (!isString(scrollArg.to)) {
return false;
}
if (!isUndefined(scrollArg.by) && !isString(scrollArg.by)) {
return false;
}
if (!isUndefined(scrollArg.value) && !isNumber(scrollArg.value)) {
return false;
}
if (!isUndefined(scrollArg.revealCursor) && !isBoolean(scrollArg.revealCursor)) {
return false;
}
return true;
};
EditorScroll_2.metadata = {
description: "Scroll editor in the given direction",
args: [
{
name: "Editor scroll argument object",
description: `Property-value pairs that can be passed through this argument:
* 'to': A mandatory direction value.
\`\`\`
'up', 'down'
\`\`\`
* 'by': Unit to move. Default is computed based on 'to' value.
\`\`\`
'line', 'wrappedLine', 'page', 'halfPage', 'editor'
\`\`\`
* 'value': Number of units to move. Default is '1'.
* 'revealCursor': If 'true' reveals the cursor if it is outside view port.
`,
constraint: isEditorScrollArgs,
schema: {
"type": "object",
"required": ["to"],
"properties": {
"to": {
"type": "string",
"enum": ["up", "down"]
},
"by": {
"type": "string",
"enum": ["line", "wrappedLine", "page", "halfPage", "editor"]
},
"value": {
"type": "number",
"default": 1
},
"revealCursor": {
"type": "boolean"
}
}
}
}
]
};
EditorScroll_2.RawDirection = {
Up: "up",
Right: "right",
Down: "down",
Left: "left"
};
EditorScroll_2.RawUnit = {
Line: "line",
WrappedLine: "wrappedLine",
Page: "page",
HalfPage: "halfPage",
Editor: "editor",
Column: "column"
};
function parse5(args) {
let direction;
switch (args.to) {
case EditorScroll_2.RawDirection.Up:
direction = 1;
break;
case EditorScroll_2.RawDirection.Right:
direction = 2;
break;
case EditorScroll_2.RawDirection.Down:
direction = 3;
break;
case EditorScroll_2.RawDirection.Left:
direction = 4;
break;
default:
return null;
}
let unit;
switch (args.by) {
case EditorScroll_2.RawUnit.Line:
unit = 1;
break;
case EditorScroll_2.RawUnit.WrappedLine:
unit = 2;
break;
case EditorScroll_2.RawUnit.Page:
unit = 3;
break;
case EditorScroll_2.RawUnit.HalfPage:
unit = 4;
break;
case EditorScroll_2.RawUnit.Editor:
unit = 5;
break;
case EditorScroll_2.RawUnit.Column:
unit = 6;
break;
default:
unit = 2;
}
const value = Math.floor(args.value || 1);
const revealCursor = !!args.revealCursor;
return {
direction,
unit,
value,
revealCursor,
select: !!args.select
};
}
EditorScroll_2.parse = parse5;
})(EditorScroll_ || (EditorScroll_ = {}));
(function(RevealLine_2) {
const isRevealLineArgs = function(arg) {
if (!isObject(arg)) {
return false;
}
const reveaLineArg = arg;
if (!isNumber(reveaLineArg.lineNumber) && !isString(reveaLineArg.lineNumber)) {
return false;
}
if (!isUndefined(reveaLineArg.at) && !isString(reveaLineArg.at)) {
return false;
}
return true;
};
RevealLine_2.metadata = {
description: "Reveal the given line at the given logical position",
args: [
{
name: "Reveal line argument object",
description: `Property-value pairs that can be passed through this argument:
* 'lineNumber': A mandatory line number value.
* 'at': Logical position at which line has to be revealed.
\`\`\`
'top', 'center', 'bottom'
\`\`\`
`,
constraint: isRevealLineArgs,
schema: {
"type": "object",
"required": ["lineNumber"],
"properties": {
"lineNumber": {
"type": ["number", "string"]
},
"at": {
"type": "string",
"enum": ["top", "center", "bottom"]
}
}
}
}
]
};
RevealLine_2.RawAtArgument = {
Top: "top",
Center: "center",
Bottom: "bottom"
};
})(RevealLine_ || (RevealLine_ = {}));
EditorOrNativeTextInputCommand = class {
constructor(target) {
target.addImplementation(1e4, "code-editor", (accessor, args) => {
const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
if (focusedEditor && focusedEditor.hasTextFocus()) {
return this._runEditorCommand(accessor, focusedEditor, args);
}
return false;
});
target.addImplementation(1e3, "generic-dom-input-textarea", (accessor, args) => {
const activeElement = getActiveElement();
if (activeElement && ["input", "textarea"].indexOf(activeElement.tagName.toLowerCase()) >= 0) {
this.runDOMCommand(activeElement);
return true;
}
return false;
});
target.addImplementation(0, "generic-dom", (accessor, args) => {
const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor();
if (activeEditor) {
activeEditor.focus();
return this._runEditorCommand(accessor, activeEditor, args);
}
return false;
});
}
_runEditorCommand(accessor, editor2, args) {
const result = this.runEditorCommand(accessor, editor2, args);
if (result) {
return result;
}
return true;
}
};
(function(CoreNavigationCommands2) {
class BaseMoveToCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
viewModel.model.pushStackElement();
const cursorStateChanged = viewModel.setCursorStates(args.source, 3, [
CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)
]);
if (cursorStateChanged && args.revealType !== 2) {
viewModel.revealAllCursors(args.source, true, true);
}
}
}
CoreNavigationCommands2.MoveTo = registerEditorCommand(new BaseMoveToCommand({
id: "_moveTo",
inSelectionMode: false,
precondition: void 0
}));
CoreNavigationCommands2.MoveToSelect = registerEditorCommand(new BaseMoveToCommand({
id: "_moveToSelect",
inSelectionMode: true,
precondition: void 0
}));
class ColumnSelectCommand extends CoreEditorCommand {
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
const result = this._getColumnSelectResult(viewModel, viewModel.getPrimaryCursorState(), viewModel.getCursorColumnSelectData(), args);
if (result === null) {
return;
}
viewModel.setCursorStates(args.source, 3, result.viewStates.map((viewState) => CursorState.fromViewState(viewState)));
viewModel.setCursorColumnSelectData({
isReal: true,
fromViewLineNumber: result.fromLineNumber,
fromViewVisualColumn: result.fromVisualColumn,
toViewLineNumber: result.toLineNumber,
toViewVisualColumn: result.toVisualColumn
});
if (result.reversed) {
viewModel.revealTopMostCursor(args.source);
} else {
viewModel.revealBottomMostCursor(args.source);
}
}
}
CoreNavigationCommands2.ColumnSelect = registerEditorCommand(new class extends ColumnSelectCommand {
constructor() {
super({
id: "columnSelect",
precondition: void 0
});
}
_getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {
if (typeof args.position === "undefined" || typeof args.viewPosition === "undefined" || typeof args.mouseColumn === "undefined") {
return null;
}
const validatedPosition = viewModel.model.validatePosition(args.position);
const validatedViewPosition = viewModel.coordinatesConverter.validateViewPosition(new Position(args.viewPosition.lineNumber, args.viewPosition.column), validatedPosition);
const fromViewLineNumber = args.doColumnSelect ? prevColumnSelectData.fromViewLineNumber : validatedViewPosition.lineNumber;
const fromViewVisualColumn = args.doColumnSelect ? prevColumnSelectData.fromViewVisualColumn : args.mouseColumn - 1;
return ColumnSelection.columnSelect(viewModel.cursorConfig, viewModel, fromViewLineNumber, fromViewVisualColumn, validatedViewPosition.lineNumber, args.mouseColumn - 1);
}
}());
CoreNavigationCommands2.CursorColumnSelectLeft = registerEditorCommand(new class extends ColumnSelectCommand {
constructor() {
super({
id: "cursorColumnSelectLeft",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 15,
linux: { primary: 0 }
}
});
}
_getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {
return ColumnSelection.columnSelectLeft(viewModel.cursorConfig, viewModel, prevColumnSelectData);
}
}());
CoreNavigationCommands2.CursorColumnSelectRight = registerEditorCommand(new class extends ColumnSelectCommand {
constructor() {
super({
id: "cursorColumnSelectRight",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 17,
linux: { primary: 0 }
}
});
}
_getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {
return ColumnSelection.columnSelectRight(viewModel.cursorConfig, viewModel, prevColumnSelectData);
}
}());
class ColumnSelectUpCommand extends ColumnSelectCommand {
constructor(opts) {
super(opts);
this._isPaged = opts.isPaged;
}
_getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {
return ColumnSelection.columnSelectUp(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);
}
}
CoreNavigationCommands2.CursorColumnSelectUp = registerEditorCommand(new ColumnSelectUpCommand({
isPaged: false,
id: "cursorColumnSelectUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 16,
linux: { primary: 0 }
}
}));
CoreNavigationCommands2.CursorColumnSelectPageUp = registerEditorCommand(new ColumnSelectUpCommand({
isPaged: true,
id: "cursorColumnSelectPageUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 11,
linux: { primary: 0 }
}
}));
class ColumnSelectDownCommand extends ColumnSelectCommand {
constructor(opts) {
super(opts);
this._isPaged = opts.isPaged;
}
_getColumnSelectResult(viewModel, primary, prevColumnSelectData, args) {
return ColumnSelection.columnSelectDown(viewModel.cursorConfig, viewModel, prevColumnSelectData, this._isPaged);
}
}
CoreNavigationCommands2.CursorColumnSelectDown = registerEditorCommand(new ColumnSelectDownCommand({
isPaged: false,
id: "cursorColumnSelectDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 18,
linux: { primary: 0 }
}
}));
CoreNavigationCommands2.CursorColumnSelectPageDown = registerEditorCommand(new ColumnSelectDownCommand({
isPaged: true,
id: "cursorColumnSelectPageDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 512 | 12,
linux: { primary: 0 }
}
}));
class CursorMoveImpl extends CoreEditorCommand {
constructor() {
super({
id: "cursorMove",
precondition: void 0,
metadata: CursorMove.metadata
});
}
runCoreEditorCommand(viewModel, args) {
const parsed = CursorMove.parse(args);
if (!parsed) {
return;
}
this._runCursorMove(viewModel, args.source, parsed);
}
_runCursorMove(viewModel, source, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(source, 3, CursorMoveImpl._move(viewModel, viewModel.getCursorStates(), args));
viewModel.revealAllCursors(source, true);
}
static _move(viewModel, cursors, args) {
const inSelectionMode = args.select;
const value = args.value;
switch (args.direction) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
return CursorMoveCommands.simpleMove(viewModel, cursors, args.direction, inSelectionMode, value, args.unit);
case 11:
case 13:
case 12:
case 14:
return CursorMoveCommands.viewportMove(viewModel, cursors, args.direction, inSelectionMode, value);
default:
return null;
}
}
}
CoreNavigationCommands2.CursorMoveImpl = CursorMoveImpl;
CoreNavigationCommands2.CursorMove = registerEditorCommand(new CursorMoveImpl());
class CursorMoveBasedCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._staticArgs = opts.args;
}
runCoreEditorCommand(viewModel, dynamicArgs) {
let args = this._staticArgs;
if (this._staticArgs.value === -1) {
args = {
direction: this._staticArgs.direction,
unit: this._staticArgs.unit,
select: this._staticArgs.select,
value: dynamicArgs.pageSize || viewModel.cursorConfig.pageSize
};
}
viewModel.model.pushStackElement();
viewModel.setCursorStates(dynamicArgs.source, 3, CursorMoveCommands.simpleMove(viewModel, viewModel.getCursorStates(), args.direction, args.select, args.value, args.unit));
viewModel.revealAllCursors(dynamicArgs.source, true);
}
}
CoreNavigationCommands2.CursorLeft = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 0,
unit: 0,
select: false,
value: 1
},
id: "cursorLeft",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 15,
mac: { primary: 15, secondary: [
256 | 32
/* KeyCode.KeyB */
] }
}
}));
CoreNavigationCommands2.CursorLeftSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 0,
unit: 0,
select: true,
value: 1
},
id: "cursorLeftSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 15
/* KeyCode.LeftArrow */
}
}));
CoreNavigationCommands2.CursorRight = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 1,
unit: 0,
select: false,
value: 1
},
id: "cursorRight",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 17,
mac: { primary: 17, secondary: [
256 | 36
/* KeyCode.KeyF */
] }
}
}));
CoreNavigationCommands2.CursorRightSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 1,
unit: 0,
select: true,
value: 1
},
id: "cursorRightSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 17
/* KeyCode.RightArrow */
}
}));
CoreNavigationCommands2.CursorUp = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 2,
unit: 2,
select: false,
value: 1
},
id: "cursorUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 16,
mac: { primary: 16, secondary: [
256 | 46
/* KeyCode.KeyP */
] }
}
}));
CoreNavigationCommands2.CursorUpSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 2,
unit: 2,
select: true,
value: 1
},
id: "cursorUpSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 16,
secondary: [
2048 | 1024 | 16
/* KeyCode.UpArrow */
],
mac: {
primary: 1024 | 16
/* KeyCode.UpArrow */
},
linux: {
primary: 1024 | 16
/* KeyCode.UpArrow */
}
}
}));
CoreNavigationCommands2.CursorPageUp = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 2,
unit: 2,
select: false,
value: -1
/* Constants.PAGE_SIZE_MARKER */
},
id: "cursorPageUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 11
/* KeyCode.PageUp */
}
}));
CoreNavigationCommands2.CursorPageUpSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 2,
unit: 2,
select: true,
value: -1
/* Constants.PAGE_SIZE_MARKER */
},
id: "cursorPageUpSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 11
/* KeyCode.PageUp */
}
}));
CoreNavigationCommands2.CursorDown = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 3,
unit: 2,
select: false,
value: 1
},
id: "cursorDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 18,
mac: { primary: 18, secondary: [
256 | 44
/* KeyCode.KeyN */
] }
}
}));
CoreNavigationCommands2.CursorDownSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 3,
unit: 2,
select: true,
value: 1
},
id: "cursorDownSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 18,
secondary: [
2048 | 1024 | 18
/* KeyCode.DownArrow */
],
mac: {
primary: 1024 | 18
/* KeyCode.DownArrow */
},
linux: {
primary: 1024 | 18
/* KeyCode.DownArrow */
}
}
}));
CoreNavigationCommands2.CursorPageDown = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 3,
unit: 2,
select: false,
value: -1
/* Constants.PAGE_SIZE_MARKER */
},
id: "cursorPageDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 12
/* KeyCode.PageDown */
}
}));
CoreNavigationCommands2.CursorPageDownSelect = registerEditorCommand(new CursorMoveBasedCommand({
args: {
direction: 3,
unit: 2,
select: true,
value: -1
/* Constants.PAGE_SIZE_MARKER */
},
id: "cursorPageDownSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 12
/* KeyCode.PageDown */
}
}));
CoreNavigationCommands2.CreateCursor = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "createCursor",
precondition: void 0
});
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
let newState;
if (args.wholeLine) {
newState = CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);
} else {
newState = CursorMoveCommands.moveTo(viewModel, viewModel.getPrimaryCursorState(), false, args.position, args.viewPosition);
}
const states = viewModel.getCursorStates();
if (states.length > 1) {
const newModelPosition = newState.modelState ? newState.modelState.position : null;
const newViewPosition = newState.viewState ? newState.viewState.position : null;
for (let i = 0, len = states.length; i < len; i++) {
const state = states[i];
if (newModelPosition && !state.modelState.selection.containsPosition(newModelPosition)) {
continue;
}
if (newViewPosition && !state.viewState.selection.containsPosition(newViewPosition)) {
continue;
}
states.splice(i, 1);
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, states);
return;
}
}
states.push(newState);
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, states);
}
}());
CoreNavigationCommands2.LastCursorMoveToSelect = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "_lastCursorMoveToSelect",
precondition: void 0
});
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();
const states = viewModel.getCursorStates();
const newStates = states.slice(0);
newStates[lastAddedCursorIndex] = CursorMoveCommands.moveTo(viewModel, states[lastAddedCursorIndex], true, args.position, args.viewPosition);
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, newStates);
}
}());
class HomeCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, CursorMoveCommands.moveToBeginningOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode));
viewModel.revealAllCursors(args.source, true);
}
}
CoreNavigationCommands2.CursorHome = registerEditorCommand(new HomeCommand({
inSelectionMode: false,
id: "cursorHome",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 14,
mac: { primary: 14, secondary: [
2048 | 15
/* KeyCode.LeftArrow */
] }
}
}));
CoreNavigationCommands2.CursorHomeSelect = registerEditorCommand(new HomeCommand({
inSelectionMode: true,
id: "cursorHomeSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 14,
mac: { primary: 1024 | 14, secondary: [
2048 | 1024 | 15
/* KeyCode.LeftArrow */
] }
}
}));
class LineStartCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, this._exec(viewModel.getCursorStates()));
viewModel.revealAllCursors(args.source, true);
}
_exec(cursors) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const lineNumber = cursor.modelState.position.lineNumber;
result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, 1, 0));
}
return result;
}
}
CoreNavigationCommands2.CursorLineStart = registerEditorCommand(new LineStartCommand({
inSelectionMode: false,
id: "cursorLineStart",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,
mac: {
primary: 256 | 31
/* KeyCode.KeyA */
}
}
}));
CoreNavigationCommands2.CursorLineStartSelect = registerEditorCommand(new LineStartCommand({
inSelectionMode: true,
id: "cursorLineStartSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,
mac: {
primary: 256 | 1024 | 31
/* KeyCode.KeyA */
}
}
}));
class EndCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, CursorMoveCommands.moveToEndOfLine(viewModel, viewModel.getCursorStates(), this._inSelectionMode, args.sticky || false));
viewModel.revealAllCursors(args.source, true);
}
}
CoreNavigationCommands2.CursorEnd = registerEditorCommand(new EndCommand({
inSelectionMode: false,
id: "cursorEnd",
precondition: void 0,
kbOpts: {
args: { sticky: false },
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 13,
mac: { primary: 13, secondary: [
2048 | 17
/* KeyCode.RightArrow */
] }
},
metadata: {
description: `Go to End`,
args: [{
name: "args",
schema: {
type: "object",
properties: {
"sticky": {
description: localize("stickydesc", "Stick to the end even when going to longer lines"),
type: "boolean",
default: false
}
}
}
}]
}
}));
CoreNavigationCommands2.CursorEndSelect = registerEditorCommand(new EndCommand({
inSelectionMode: true,
id: "cursorEndSelect",
precondition: void 0,
kbOpts: {
args: { sticky: false },
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1024 | 13,
mac: { primary: 1024 | 13, secondary: [
2048 | 1024 | 17
/* KeyCode.RightArrow */
] }
},
metadata: {
description: `Select to End`,
args: [{
name: "args",
schema: {
type: "object",
properties: {
"sticky": {
description: localize("stickydesc", "Stick to the end even when going to longer lines"),
type: "boolean",
default: false
}
}
}
}]
}
}));
class LineEndCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, this._exec(viewModel, viewModel.getCursorStates()));
viewModel.revealAllCursors(args.source, true);
}
_exec(viewModel, cursors) {
const result = [];
for (let i = 0, len = cursors.length; i < len; i++) {
const cursor = cursors[i];
const lineNumber = cursor.modelState.position.lineNumber;
const maxColumn = viewModel.model.getLineMaxColumn(lineNumber);
result[i] = CursorState.fromModelState(cursor.modelState.move(this._inSelectionMode, lineNumber, maxColumn, 0));
}
return result;
}
}
CoreNavigationCommands2.CursorLineEnd = registerEditorCommand(new LineEndCommand({
inSelectionMode: false,
id: "cursorLineEnd",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,
mac: {
primary: 256 | 35
/* KeyCode.KeyE */
}
}
}));
CoreNavigationCommands2.CursorLineEndSelect = registerEditorCommand(new LineEndCommand({
inSelectionMode: true,
id: "cursorLineEndSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,
mac: {
primary: 256 | 1024 | 35
/* KeyCode.KeyE */
}
}
}));
class TopCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, CursorMoveCommands.moveToBeginningOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));
viewModel.revealAllCursors(args.source, true);
}
}
CoreNavigationCommands2.CursorTop = registerEditorCommand(new TopCommand({
inSelectionMode: false,
id: "cursorTop",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 14,
mac: {
primary: 2048 | 16
/* KeyCode.UpArrow */
}
}
}));
CoreNavigationCommands2.CursorTopSelect = registerEditorCommand(new TopCommand({
inSelectionMode: true,
id: "cursorTopSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 14,
mac: {
primary: 2048 | 1024 | 16
/* KeyCode.UpArrow */
}
}
}));
class BottomCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, CursorMoveCommands.moveToEndOfBuffer(viewModel, viewModel.getCursorStates(), this._inSelectionMode));
viewModel.revealAllCursors(args.source, true);
}
}
CoreNavigationCommands2.CursorBottom = registerEditorCommand(new BottomCommand({
inSelectionMode: false,
id: "cursorBottom",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 13,
mac: {
primary: 2048 | 18
/* KeyCode.DownArrow */
}
}
}));
CoreNavigationCommands2.CursorBottomSelect = registerEditorCommand(new BottomCommand({
inSelectionMode: true,
id: "cursorBottomSelect",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 1024 | 13,
mac: {
primary: 2048 | 1024 | 18
/* KeyCode.DownArrow */
}
}
}));
class EditorScrollImpl extends CoreEditorCommand {
constructor() {
super({
id: "editorScroll",
precondition: void 0,
metadata: EditorScroll_.metadata
});
}
determineScrollMethod(args) {
const horizontalUnits = [
6
/* EditorScroll_.Unit.Column */
];
const verticalUnits = [
1,
2,
3,
4,
5,
6
/* EditorScroll_.Unit.Column */
];
const horizontalDirections = [
4,
2
/* EditorScroll_.Direction.Right */
];
const verticalDirections = [
1,
3
/* EditorScroll_.Direction.Down */
];
if (horizontalUnits.includes(args.unit) && horizontalDirections.includes(args.direction)) {
return this._runHorizontalEditorScroll.bind(this);
}
if (verticalUnits.includes(args.unit) && verticalDirections.includes(args.direction)) {
return this._runVerticalEditorScroll.bind(this);
}
return null;
}
runCoreEditorCommand(viewModel, args) {
const parsed = EditorScroll_.parse(args);
if (!parsed) {
return;
}
const runEditorScroll = this.determineScrollMethod(parsed);
if (!runEditorScroll) {
return;
}
runEditorScroll(viewModel, args.source, parsed);
}
_runVerticalEditorScroll(viewModel, source, args) {
const desiredScrollTop = this._computeDesiredScrollTop(viewModel, args);
if (args.revealCursor) {
const desiredVisibleViewRange = viewModel.getCompletelyVisibleViewRangeAtScrollTop(desiredScrollTop);
viewModel.setCursorStates(source, 3, [
CursorMoveCommands.findPositionInViewportIfOutside(viewModel, viewModel.getPrimaryCursorState(), desiredVisibleViewRange, args.select)
]);
}
viewModel.viewLayout.setScrollPosition(
{ scrollTop: desiredScrollTop },
0
/* ScrollType.Smooth */
);
}
_computeDesiredScrollTop(viewModel, args) {
if (args.unit === 1) {
const futureViewport = viewModel.viewLayout.getFutureViewport();
const visibleViewRange = viewModel.getCompletelyVisibleViewRangeAtScrollTop(futureViewport.top);
const visibleModelRange = viewModel.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);
let desiredTopModelLineNumber;
if (args.direction === 1) {
desiredTopModelLineNumber = Math.max(1, visibleModelRange.startLineNumber - args.value);
} else {
desiredTopModelLineNumber = Math.min(viewModel.model.getLineCount(), visibleModelRange.startLineNumber + args.value);
}
const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(new Position(desiredTopModelLineNumber, 1));
return viewModel.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
}
if (args.unit === 5) {
let desiredTopModelLineNumber = 0;
if (args.direction === 3) {
desiredTopModelLineNumber = viewModel.model.getLineCount() - viewModel.cursorConfig.pageSize;
}
return viewModel.viewLayout.getVerticalOffsetForLineNumber(desiredTopModelLineNumber);
}
let noOfLines;
if (args.unit === 3) {
noOfLines = viewModel.cursorConfig.pageSize * args.value;
} else if (args.unit === 4) {
noOfLines = Math.round(viewModel.cursorConfig.pageSize / 2) * args.value;
} else {
noOfLines = args.value;
}
const deltaLines = (args.direction === 1 ? -1 : 1) * noOfLines;
return viewModel.viewLayout.getCurrentScrollTop() + deltaLines * viewModel.cursorConfig.lineHeight;
}
_runHorizontalEditorScroll(viewModel, source, args) {
const desiredScrollLeft = this._computeDesiredScrollLeft(viewModel, args);
viewModel.viewLayout.setScrollPosition(
{ scrollLeft: desiredScrollLeft },
0
/* ScrollType.Smooth */
);
}
_computeDesiredScrollLeft(viewModel, args) {
const deltaColumns = (args.direction === 4 ? -1 : 1) * args.value;
return viewModel.viewLayout.getCurrentScrollLeft() + deltaColumns * viewModel.cursorConfig.typicalHalfwidthCharacterWidth;
}
}
CoreNavigationCommands2.EditorScrollImpl = EditorScrollImpl;
CoreNavigationCommands2.EditorScroll = registerEditorCommand(new EditorScrollImpl());
CoreNavigationCommands2.ScrollLineUp = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollLineUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 16,
mac: {
primary: 256 | 11
/* KeyCode.PageUp */
}
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Up,
by: EditorScroll_.RawUnit.WrappedLine,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollPageUp = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollPageUp",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 11,
win: {
primary: 512 | 11
/* KeyCode.PageUp */
},
linux: {
primary: 512 | 11
/* KeyCode.PageUp */
}
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Up,
by: EditorScroll_.RawUnit.Page,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollEditorTop = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollEditorTop",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Up,
by: EditorScroll_.RawUnit.Editor,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollLineDown = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollLineDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 18,
mac: {
primary: 256 | 12
/* KeyCode.PageDown */
}
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Down,
by: EditorScroll_.RawUnit.WrappedLine,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollPageDown = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollPageDown",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 2048 | 12,
win: {
primary: 512 | 12
/* KeyCode.PageDown */
},
linux: {
primary: 512 | 12
/* KeyCode.PageDown */
}
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Down,
by: EditorScroll_.RawUnit.Page,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollEditorBottom = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollEditorBottom",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Down,
by: EditorScroll_.RawUnit.Editor,
value: 1,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollLeft = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollLeft",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Left,
by: EditorScroll_.RawUnit.Column,
value: 2,
revealCursor: false,
select: false,
source: args.source
});
}
}());
CoreNavigationCommands2.ScrollRight = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "scrollRight",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus
}
});
}
runCoreEditorCommand(viewModel, args) {
CoreNavigationCommands2.EditorScroll.runCoreEditorCommand(viewModel, {
to: EditorScroll_.RawDirection.Right,
by: EditorScroll_.RawUnit.Column,
value: 2,
revealCursor: false,
select: false,
source: args.source
});
}
}());
class WordCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, [
CursorMoveCommands.word(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position)
]);
if (args.revealType !== 2) {
viewModel.revealAllCursors(args.source, true, true);
}
}
}
CoreNavigationCommands2.WordSelect = registerEditorCommand(new WordCommand({
inSelectionMode: false,
id: "_wordSelect",
precondition: void 0
}));
CoreNavigationCommands2.WordSelectDrag = registerEditorCommand(new WordCommand({
inSelectionMode: true,
id: "_wordSelectDrag",
precondition: void 0
}));
CoreNavigationCommands2.LastCursorWordSelect = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "lastCursorWordSelect",
precondition: void 0
});
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();
const states = viewModel.getCursorStates();
const newStates = states.slice(0);
const lastAddedState = states[lastAddedCursorIndex];
newStates[lastAddedCursorIndex] = CursorMoveCommands.word(viewModel, lastAddedState, lastAddedState.modelState.hasSelection(), args.position);
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, newStates);
}
}());
class LineCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, [
CursorMoveCommands.line(viewModel, viewModel.getPrimaryCursorState(), this._inSelectionMode, args.position, args.viewPosition)
]);
if (args.revealType !== 2) {
viewModel.revealAllCursors(args.source, false, true);
}
}
}
CoreNavigationCommands2.LineSelect = registerEditorCommand(new LineCommand({
inSelectionMode: false,
id: "_lineSelect",
precondition: void 0
}));
CoreNavigationCommands2.LineSelectDrag = registerEditorCommand(new LineCommand({
inSelectionMode: true,
id: "_lineSelectDrag",
precondition: void 0
}));
class LastCursorLineCommand extends CoreEditorCommand {
constructor(opts) {
super(opts);
this._inSelectionMode = opts.inSelectionMode;
}
runCoreEditorCommand(viewModel, args) {
if (!args.position) {
return;
}
const lastAddedCursorIndex = viewModel.getLastAddedCursorIndex();
const states = viewModel.getCursorStates();
const newStates = states.slice(0);
newStates[lastAddedCursorIndex] = CursorMoveCommands.line(viewModel, states[lastAddedCursorIndex], this._inSelectionMode, args.position, args.viewPosition);
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, newStates);
}
}
CoreNavigationCommands2.LastCursorLineSelect = registerEditorCommand(new LastCursorLineCommand({
inSelectionMode: false,
id: "lastCursorLineSelect",
precondition: void 0
}));
CoreNavigationCommands2.LastCursorLineSelectDrag = registerEditorCommand(new LastCursorLineCommand({
inSelectionMode: true,
id: "lastCursorLineSelectDrag",
precondition: void 0
}));
CoreNavigationCommands2.CancelSelection = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "cancelSelection",
precondition: EditorContextKeys.hasNonEmptySelection,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 9,
secondary: [
1024 | 9
/* KeyCode.Escape */
]
}
});
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, [
CursorMoveCommands.cancelSelection(viewModel, viewModel.getPrimaryCursorState())
]);
viewModel.revealAllCursors(args.source, true);
}
}());
CoreNavigationCommands2.RemoveSecondaryCursors = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "removeSecondaryCursors",
precondition: EditorContextKeys.hasMultipleSelections,
kbOpts: {
weight: CORE_WEIGHT + 1,
kbExpr: EditorContextKeys.textInputFocus,
primary: 9,
secondary: [
1024 | 9
/* KeyCode.Escape */
]
}
});
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, [
viewModel.getPrimaryCursorState()
]);
viewModel.revealAllCursors(args.source, true);
status(localize("removedCursor", "Removed secondary cursors"));
}
}());
CoreNavigationCommands2.RevealLine = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "revealLine",
precondition: void 0,
metadata: RevealLine_.metadata
});
}
runCoreEditorCommand(viewModel, args) {
const revealLineArg = args;
const lineNumberArg = revealLineArg.lineNumber || 0;
let lineNumber = typeof lineNumberArg === "number" ? lineNumberArg + 1 : parseInt(lineNumberArg) + 1;
if (lineNumber < 1) {
lineNumber = 1;
}
const lineCount = viewModel.model.getLineCount();
if (lineNumber > lineCount) {
lineNumber = lineCount;
}
const range2 = new Range(lineNumber, 1, lineNumber, viewModel.model.getLineMaxColumn(lineNumber));
let revealAt = 0;
if (revealLineArg.at) {
switch (revealLineArg.at) {
case RevealLine_.RawAtArgument.Top:
revealAt = 3;
break;
case RevealLine_.RawAtArgument.Center:
revealAt = 1;
break;
case RevealLine_.RawAtArgument.Bottom:
revealAt = 4;
break;
default:
break;
}
}
const viewRange = viewModel.coordinatesConverter.convertModelRangeToViewRange(range2);
viewModel.revealRange(
args.source,
false,
viewRange,
revealAt,
0
/* ScrollType.Smooth */
);
}
}());
CoreNavigationCommands2.SelectAll = new class extends EditorOrNativeTextInputCommand {
constructor() {
super(SelectAllCommand);
}
runDOMCommand(activeElement) {
if (isFirefox2) {
activeElement.focus();
activeElement.select();
}
activeElement.ownerDocument.execCommand("selectAll");
}
runEditorCommand(accessor, editor2, args) {
const viewModel = editor2._getViewModel();
if (!viewModel) {
return;
}
this.runCoreEditorCommand(viewModel, args);
}
runCoreEditorCommand(viewModel, args) {
viewModel.model.pushStackElement();
viewModel.setCursorStates("keyboard", 3, [
CursorMoveCommands.selectAll(viewModel, viewModel.getPrimaryCursorState())
]);
}
}();
CoreNavigationCommands2.SetSelection = registerEditorCommand(new class extends CoreEditorCommand {
constructor() {
super({
id: "setSelection",
precondition: void 0
});
}
runCoreEditorCommand(viewModel, args) {
if (!args.selection) {
return;
}
viewModel.model.pushStackElement();
viewModel.setCursorStates(args.source, 3, [
CursorState.fromModelSelection(args.selection)
]);
}
}());
})(CoreNavigationCommands || (CoreNavigationCommands = {}));
columnSelectionCondition = ContextKeyExpr.and(EditorContextKeys.textInputFocus, EditorContextKeys.columnSelection);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectLeft.id,
1024 | 15
/* KeyCode.LeftArrow */
);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectRight.id,
1024 | 17
/* KeyCode.RightArrow */
);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectUp.id,
1024 | 16
/* KeyCode.UpArrow */
);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectPageUp.id,
1024 | 11
/* KeyCode.PageUp */
);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectDown.id,
1024 | 18
/* KeyCode.DownArrow */
);
registerColumnSelection(
CoreNavigationCommands.CursorColumnSelectPageDown.id,
1024 | 12
/* KeyCode.PageDown */
);
(function(CoreEditingCommands2) {
class CoreEditingCommand extends EditorCommand {
runEditorCommand(accessor, editor2, args) {
const viewModel = editor2._getViewModel();
if (!viewModel) {
return;
}
this.runCoreEditingCommand(editor2, viewModel, args || {});
}
}
CoreEditingCommands2.CoreEditingCommand = CoreEditingCommand;
CoreEditingCommands2.LineBreakInsert = registerEditorCommand(new class extends CoreEditingCommand {
constructor() {
super({
id: "lineBreakInsert",
precondition: EditorContextKeys.writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 0,
mac: {
primary: 256 | 45
/* KeyCode.KeyO */
}
}
});
}
runCoreEditingCommand(editor2, viewModel, args) {
editor2.pushUndoStop();
editor2.executeCommands(this.id, TypeOperations.lineBreakInsert(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map((s) => s.modelState.selection)));
}
}());
CoreEditingCommands2.Outdent = registerEditorCommand(new class extends CoreEditingCommand {
constructor() {
super({
id: "outdent",
precondition: EditorContextKeys.writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),
primary: 1024 | 2
/* KeyCode.Tab */
}
});
}
runCoreEditingCommand(editor2, viewModel, args) {
editor2.pushUndoStop();
editor2.executeCommands(this.id, TypeOperations.outdent(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map((s) => s.modelState.selection)));
editor2.pushUndoStop();
}
}());
CoreEditingCommands2.Tab = registerEditorCommand(new class extends CoreEditingCommand {
constructor() {
super({
id: "tab",
precondition: EditorContextKeys.writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus),
primary: 2
/* KeyCode.Tab */
}
});
}
runCoreEditingCommand(editor2, viewModel, args) {
editor2.pushUndoStop();
editor2.executeCommands(this.id, TypeOperations.tab(viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map((s) => s.modelState.selection)));
editor2.pushUndoStop();
}
}());
CoreEditingCommands2.DeleteLeft = registerEditorCommand(new class extends CoreEditingCommand {
constructor() {
super({
id: "deleteLeft",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 1,
secondary: [
1024 | 1
/* KeyCode.Backspace */
],
mac: { primary: 1, secondary: [
1024 | 1,
256 | 38,
256 | 1
/* KeyCode.Backspace */
] }
}
});
}
runCoreEditingCommand(editor2, viewModel, args) {
const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteLeft(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map((s) => s.modelState.selection), viewModel.getCursorAutoClosedCharacters());
if (shouldPushStackElementBefore) {
editor2.pushUndoStop();
}
editor2.executeCommands(this.id, commands);
viewModel.setPrevEditOperationType(
2
/* EditOperationType.DeletingLeft */
);
}
}());
CoreEditingCommands2.DeleteRight = registerEditorCommand(new class extends CoreEditingCommand {
constructor() {
super({
id: "deleteRight",
precondition: void 0,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: EditorContextKeys.textInputFocus,
primary: 20,
mac: { primary: 20, secondary: [
256 | 34,
256 | 20
/* KeyCode.Delete */
] }
}
});
}
runCoreEditingCommand(editor2, viewModel, args) {
const [shouldPushStackElementBefore, commands] = DeleteOperations.deleteRight(viewModel.getPrevEditOperationType(), viewModel.cursorConfig, viewModel.model, viewModel.getCursorStates().map((s) => s.modelState.selection));
if (shouldPushStackElementBefore) {
editor2.pushUndoStop();
}
editor2.executeCommands(this.id, commands);
viewModel.setPrevEditOperationType(
3
/* EditOperationType.DeletingRight */
);
}
}());
CoreEditingCommands2.Undo = new class extends EditorOrNativeTextInputCommand {
constructor() {
super(UndoCommand);
}
runDOMCommand(activeElement) {
activeElement.ownerDocument.execCommand("undo");
}
runEditorCommand(accessor, editor2, args) {
if (!editor2.hasModel() || editor2.getOption(
91
/* EditorOption.readOnly */
) === true) {
return;
}
return editor2.getModel().undo();
}
}();
CoreEditingCommands2.Redo = new class extends EditorOrNativeTextInputCommand {
constructor() {
super(RedoCommand);
}
runDOMCommand(activeElement) {
activeElement.ownerDocument.execCommand("redo");
}
runEditorCommand(accessor, editor2, args) {
if (!editor2.hasModel() || editor2.getOption(
91
/* EditorOption.readOnly */
) === true) {
return;
}
return editor2.getModel().redo();
}
}();
})(CoreEditingCommands || (CoreEditingCommands = {}));
EditorHandlerCommand = class extends Command2 {
constructor(id, handlerId, metadata) {
super({
id,
precondition: void 0,
metadata
});
this._handlerId = handlerId;
}
runCommand(accessor, args) {
const editor2 = accessor.get(ICodeEditorService).getFocusedCodeEditor();
if (!editor2) {
return;
}
editor2.trigger("keyboard", this._handlerId, args);
}
};
registerOverwritableCommand("type", {
description: `Type`,
args: [{
name: "args",
schema: {
"type": "object",
"required": ["text"],
"properties": {
"text": {
"type": "string"
}
}
}
}]
});
registerOverwritableCommand(
"replacePreviousChar"
/* Handler.ReplacePreviousChar */
);
registerOverwritableCommand(
"compositionType"
/* Handler.CompositionType */
);
registerOverwritableCommand(
"compositionStart"
/* Handler.CompositionStart */
);
registerOverwritableCommand(
"compositionEnd"
/* Handler.CompositionEnd */
);
registerOverwritableCommand(
"paste"
/* Handler.Paste */
);
registerOverwritableCommand(
"cut"
/* Handler.Cut */
);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/viewController.js
var ViewController;
var init_viewController = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/viewController.js"() {
init_coreCommands();
init_position();
init_platform();
ViewController = class {
constructor(configuration, viewModel, userInputEvents, commandDelegate) {
this.configuration = configuration;
this.viewModel = viewModel;
this.userInputEvents = userInputEvents;
this.commandDelegate = commandDelegate;
}
paste(text2, pasteOnNewLine, multicursorText, mode) {
this.commandDelegate.paste(text2, pasteOnNewLine, multicursorText, mode);
}
type(text2) {
this.commandDelegate.type(text2);
}
compositionType(text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
this.commandDelegate.compositionType(text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta);
}
compositionStart() {
this.commandDelegate.startComposition();
}
compositionEnd() {
this.commandDelegate.endComposition();
}
cut() {
this.commandDelegate.cut();
}
setSelection(modelSelection) {
CoreNavigationCommands.SetSelection.runCoreEditorCommand(this.viewModel, {
source: "keyboard",
selection: modelSelection
});
}
_validateViewColumn(viewPosition) {
const minColumn = this.viewModel.getLineMinColumn(viewPosition.lineNumber);
if (viewPosition.column < minColumn) {
return new Position(viewPosition.lineNumber, minColumn);
}
return viewPosition;
}
_hasMulticursorModifier(data) {
switch (this.configuration.options.get(
78
/* EditorOption.multiCursorModifier */
)) {
case "altKey":
return data.altKey;
case "ctrlKey":
return data.ctrlKey;
case "metaKey":
return data.metaKey;
default:
return false;
}
}
_hasNonMulticursorModifier(data) {
switch (this.configuration.options.get(
78
/* EditorOption.multiCursorModifier */
)) {
case "altKey":
return data.ctrlKey || data.metaKey;
case "ctrlKey":
return data.altKey || data.metaKey;
case "metaKey":
return data.ctrlKey || data.altKey;
default:
return false;
}
}
dispatchMouse(data) {
const options2 = this.configuration.options;
const selectionClipboardIsOn = isLinux && options2.get(
107
/* EditorOption.selectionClipboard */
);
const columnSelection = options2.get(
22
/* EditorOption.columnSelection */
);
if (data.middleButton && !selectionClipboardIsOn) {
this._columnSelect(data.position, data.mouseColumn, data.inSelectionMode);
} else if (data.startedOnLineNumbers) {
if (this._hasMulticursorModifier(data)) {
if (data.inSelectionMode) {
this._lastCursorLineSelect(data.position, data.revealType);
} else {
this._createCursor(data.position, true);
}
} else {
if (data.inSelectionMode) {
this._lineSelectDrag(data.position, data.revealType);
} else {
this._lineSelect(data.position, data.revealType);
}
}
} else if (data.mouseDownCount >= 4) {
this._selectAll();
} else if (data.mouseDownCount === 3) {
if (this._hasMulticursorModifier(data)) {
if (data.inSelectionMode) {
this._lastCursorLineSelectDrag(data.position, data.revealType);
} else {
this._lastCursorLineSelect(data.position, data.revealType);
}
} else {
if (data.inSelectionMode) {
this._lineSelectDrag(data.position, data.revealType);
} else {
this._lineSelect(data.position, data.revealType);
}
}
} else if (data.mouseDownCount === 2) {
if (!data.onInjectedText) {
if (this._hasMulticursorModifier(data)) {
this._lastCursorWordSelect(data.position, data.revealType);
} else {
if (data.inSelectionMode) {
this._wordSelectDrag(data.position, data.revealType);
} else {
this._wordSelect(data.position, data.revealType);
}
}
}
} else {
if (this._hasMulticursorModifier(data)) {
if (!this._hasNonMulticursorModifier(data)) {
if (data.shiftKey) {
this._columnSelect(data.position, data.mouseColumn, true);
} else {
if (data.inSelectionMode) {
this._lastCursorMoveToSelect(data.position, data.revealType);
} else {
this._createCursor(data.position, false);
}
}
}
} else {
if (data.inSelectionMode) {
if (data.altKey) {
this._columnSelect(data.position, data.mouseColumn, true);
} else {
if (columnSelection) {
this._columnSelect(data.position, data.mouseColumn, true);
} else {
this._moveToSelect(data.position, data.revealType);
}
}
} else {
this.moveTo(data.position, data.revealType);
}
}
}
}
_usualArgs(viewPosition, revealType) {
viewPosition = this._validateViewColumn(viewPosition);
return {
source: "mouse",
position: this._convertViewToModelPosition(viewPosition),
viewPosition,
revealType
};
}
moveTo(viewPosition, revealType) {
CoreNavigationCommands.MoveTo.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_moveToSelect(viewPosition, revealType) {
CoreNavigationCommands.MoveToSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_columnSelect(viewPosition, mouseColumn, doColumnSelect) {
viewPosition = this._validateViewColumn(viewPosition);
CoreNavigationCommands.ColumnSelect.runCoreEditorCommand(this.viewModel, {
source: "mouse",
position: this._convertViewToModelPosition(viewPosition),
viewPosition,
mouseColumn,
doColumnSelect
});
}
_createCursor(viewPosition, wholeLine) {
viewPosition = this._validateViewColumn(viewPosition);
CoreNavigationCommands.CreateCursor.runCoreEditorCommand(this.viewModel, {
source: "mouse",
position: this._convertViewToModelPosition(viewPosition),
viewPosition,
wholeLine
});
}
_lastCursorMoveToSelect(viewPosition, revealType) {
CoreNavigationCommands.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_wordSelect(viewPosition, revealType) {
CoreNavigationCommands.WordSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_wordSelectDrag(viewPosition, revealType) {
CoreNavigationCommands.WordSelectDrag.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_lastCursorWordSelect(viewPosition, revealType) {
CoreNavigationCommands.LastCursorWordSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_lineSelect(viewPosition, revealType) {
CoreNavigationCommands.LineSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_lineSelectDrag(viewPosition, revealType) {
CoreNavigationCommands.LineSelectDrag.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_lastCursorLineSelect(viewPosition, revealType) {
CoreNavigationCommands.LastCursorLineSelect.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_lastCursorLineSelectDrag(viewPosition, revealType) {
CoreNavigationCommands.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel, this._usualArgs(viewPosition, revealType));
}
_selectAll() {
CoreNavigationCommands.SelectAll.runCoreEditorCommand(this.viewModel, { source: "mouse" });
}
// ----------------------
_convertViewToModelPosition(viewPosition) {
return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(viewPosition);
}
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);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/viewLayer.js
var RenderedLinesCollection, VisibleLinesCollection, ViewLayerRenderer;
var init_viewLayer = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/viewLayer.js"() {
init_fastDomNode();
init_trustedTypes();
init_errors();
init_stringBuilder();
RenderedLinesCollection = class {
constructor(createLine) {
this._createLine = createLine;
this._set(1, []);
}
flush() {
this._set(1, []);
}
_set(rendLineNumberStart, lines) {
this._lines = lines;
this._rendLineNumberStart = rendLineNumberStart;
}
_get() {
return {
rendLineNumberStart: this._rendLineNumberStart,
lines: this._lines
};
}
/**
* @returns Inclusive line number that is inside this collection
*/
getStartLineNumber() {
return this._rendLineNumberStart;
}
/**
* @returns Inclusive line number that is inside this collection
*/
getEndLineNumber() {
return this._rendLineNumberStart + this._lines.length - 1;
}
getCount() {
return this._lines.length;
}
getLine(lineNumber) {
const lineIndex = lineNumber - this._rendLineNumberStart;
if (lineIndex < 0 || lineIndex >= this._lines.length) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._lines[lineIndex];
}
/**
* @returns Lines that were removed from this collection
*/
onLinesDeleted(deleteFromLineNumber, deleteToLineNumber) {
if (this.getCount() === 0) {
return null;
}
const startLineNumber = this.getStartLineNumber();
const endLineNumber = this.getEndLineNumber();
if (deleteToLineNumber < startLineNumber) {
const deleteCnt = deleteToLineNumber - deleteFromLineNumber + 1;
this._rendLineNumberStart -= deleteCnt;
return null;
}
if (deleteFromLineNumber > endLineNumber) {
return null;
}
let deleteStartIndex = 0;
let deleteCount = 0;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const lineIndex = lineNumber - this._rendLineNumberStart;
if (deleteFromLineNumber <= lineNumber && lineNumber <= deleteToLineNumber) {
if (deleteCount === 0) {
deleteStartIndex = lineIndex;
deleteCount = 1;
} else {
deleteCount++;
}
}
}
if (deleteFromLineNumber < startLineNumber) {
let deleteAboveCount = 0;
if (deleteToLineNumber < startLineNumber) {
deleteAboveCount = deleteToLineNumber - deleteFromLineNumber + 1;
} else {
deleteAboveCount = startLineNumber - deleteFromLineNumber;
}
this._rendLineNumberStart -= deleteAboveCount;
}
const deleted = this._lines.splice(deleteStartIndex, deleteCount);
return deleted;
}
onLinesChanged(changeFromLineNumber, changeCount) {
const changeToLineNumber = changeFromLineNumber + changeCount - 1;
if (this.getCount() === 0) {
return false;
}
const startLineNumber = this.getStartLineNumber();
const endLineNumber = this.getEndLineNumber();
let someoneNotified = false;
for (let changedLineNumber = changeFromLineNumber; changedLineNumber <= changeToLineNumber; changedLineNumber++) {
if (changedLineNumber >= startLineNumber && changedLineNumber <= endLineNumber) {
this._lines[changedLineNumber - this._rendLineNumberStart].onContentChanged();
someoneNotified = true;
}
}
return someoneNotified;
}
onLinesInserted(insertFromLineNumber, insertToLineNumber) {
if (this.getCount() === 0) {
return null;
}
const insertCnt = insertToLineNumber - insertFromLineNumber + 1;
const startLineNumber = this.getStartLineNumber();
const endLineNumber = this.getEndLineNumber();
if (insertFromLineNumber <= startLineNumber) {
this._rendLineNumberStart += insertCnt;
return null;
}
if (insertFromLineNumber > endLineNumber) {
return null;
}
if (insertCnt + insertFromLineNumber > endLineNumber) {
const deleted = this._lines.splice(insertFromLineNumber - this._rendLineNumberStart, endLineNumber - insertFromLineNumber + 1);
return deleted;
}
const newLines = [];
for (let i = 0; i < insertCnt; i++) {
newLines[i] = this._createLine();
}
const insertIndex = insertFromLineNumber - this._rendLineNumberStart;
const beforeLines = this._lines.slice(0, insertIndex);
const afterLines = this._lines.slice(insertIndex, this._lines.length - insertCnt);
const deletedLines = this._lines.slice(this._lines.length - insertCnt, this._lines.length);
this._lines = beforeLines.concat(newLines).concat(afterLines);
return deletedLines;
}
onTokensChanged(ranges) {
if (this.getCount() === 0) {
return false;
}
const startLineNumber = this.getStartLineNumber();
const endLineNumber = this.getEndLineNumber();
let notifiedSomeone = false;
for (let i = 0, len = ranges.length; i < len; i++) {
const rng = ranges[i];
if (rng.toLineNumber < startLineNumber || rng.fromLineNumber > endLineNumber) {
continue;
}
const from = Math.max(startLineNumber, rng.fromLineNumber);
const to = Math.min(endLineNumber, rng.toLineNumber);
for (let lineNumber = from; lineNumber <= to; lineNumber++) {
const lineIndex = lineNumber - this._rendLineNumberStart;
this._lines[lineIndex].onTokensChanged();
notifiedSomeone = true;
}
}
return notifiedSomeone;
}
};
VisibleLinesCollection = class {
constructor(host) {
this._host = host;
this.domNode = this._createDomNode();
this._linesCollection = new RenderedLinesCollection(() => this._host.createVisibleLine());
}
_createDomNode() {
const domNode = createFastDomNode(document.createElement("div"));
domNode.setClassName("view-layer");
domNode.setPosition("absolute");
domNode.domNode.setAttribute("role", "presentation");
domNode.domNode.setAttribute("aria-hidden", "true");
return domNode;
}
// ---- begin view event handlers
onConfigurationChanged(e) {
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
return true;
}
return false;
}
onFlushed(e) {
this._linesCollection.flush();
return true;
}
onLinesChanged(e) {
return this._linesCollection.onLinesChanged(e.fromLineNumber, e.count);
}
onLinesDeleted(e) {
const deleted = this._linesCollection.onLinesDeleted(e.fromLineNumber, e.toLineNumber);
if (deleted) {
for (let i = 0, len = deleted.length; i < len; i++) {
const lineDomNode = deleted[i].getDomNode();
if (lineDomNode) {
this.domNode.domNode.removeChild(lineDomNode);
}
}
}
return true;
}
onLinesInserted(e) {
const deleted = this._linesCollection.onLinesInserted(e.fromLineNumber, e.toLineNumber);
if (deleted) {
for (let i = 0, len = deleted.length; i < len; i++) {
const lineDomNode = deleted[i].getDomNode();
if (lineDomNode) {
this.domNode.domNode.removeChild(lineDomNode);
}
}
}
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onTokensChanged(e) {
return this._linesCollection.onTokensChanged(e.ranges);
}
onZonesChanged(e) {
return true;
}
// ---- end view event handlers
getStartLineNumber() {
return this._linesCollection.getStartLineNumber();
}
getEndLineNumber() {
return this._linesCollection.getEndLineNumber();
}
getVisibleLine(lineNumber) {
return this._linesCollection.getLine(lineNumber);
}
renderLines(viewportData) {
const inp = this._linesCollection._get();
const renderer = new ViewLayerRenderer(this.domNode.domNode, this._host, viewportData);
const ctx = {
rendLineNumberStart: inp.rendLineNumberStart,
lines: inp.lines,
linesLength: inp.lines.length
};
const resCtx = renderer.render(ctx, viewportData.startLineNumber, viewportData.endLineNumber, viewportData.relativeVerticalOffset);
this._linesCollection._set(resCtx.rendLineNumberStart, resCtx.lines);
}
};
ViewLayerRenderer = class _ViewLayerRenderer {
constructor(domNode, host, viewportData) {
this.domNode = domNode;
this.host = host;
this.viewportData = viewportData;
}
render(inContext, startLineNumber, stopLineNumber, deltaTop) {
const ctx = {
rendLineNumberStart: inContext.rendLineNumberStart,
lines: inContext.lines.slice(0),
linesLength: inContext.linesLength
};
if (ctx.rendLineNumberStart + ctx.linesLength - 1 < startLineNumber || stopLineNumber < ctx.rendLineNumberStart) {
ctx.rendLineNumberStart = startLineNumber;
ctx.linesLength = stopLineNumber - startLineNumber + 1;
ctx.lines = [];
for (let x = startLineNumber; x <= stopLineNumber; x++) {
ctx.lines[x - startLineNumber] = this.host.createVisibleLine();
}
this._finishRendering(ctx, true, deltaTop);
return ctx;
}
this._renderUntouchedLines(ctx, Math.max(startLineNumber - ctx.rendLineNumberStart, 0), Math.min(stopLineNumber - ctx.rendLineNumberStart, ctx.linesLength - 1), deltaTop, startLineNumber);
if (ctx.rendLineNumberStart > startLineNumber) {
const fromLineNumber = startLineNumber;
const toLineNumber = Math.min(stopLineNumber, ctx.rendLineNumberStart - 1);
if (fromLineNumber <= toLineNumber) {
this._insertLinesBefore(ctx, fromLineNumber, toLineNumber, deltaTop, startLineNumber);
ctx.linesLength += toLineNumber - fromLineNumber + 1;
}
} else if (ctx.rendLineNumberStart < startLineNumber) {
const removeCnt = Math.min(ctx.linesLength, startLineNumber - ctx.rendLineNumberStart);
if (removeCnt > 0) {
this._removeLinesBefore(ctx, removeCnt);
ctx.linesLength -= removeCnt;
}
}
ctx.rendLineNumberStart = startLineNumber;
if (ctx.rendLineNumberStart + ctx.linesLength - 1 < stopLineNumber) {
const fromLineNumber = ctx.rendLineNumberStart + ctx.linesLength;
const toLineNumber = stopLineNumber;
if (fromLineNumber <= toLineNumber) {
this._insertLinesAfter(ctx, fromLineNumber, toLineNumber, deltaTop, startLineNumber);
ctx.linesLength += toLineNumber - fromLineNumber + 1;
}
} else if (ctx.rendLineNumberStart + ctx.linesLength - 1 > stopLineNumber) {
const fromLineNumber = Math.max(0, stopLineNumber - ctx.rendLineNumberStart + 1);
const toLineNumber = ctx.linesLength - 1;
const removeCnt = toLineNumber - fromLineNumber + 1;
if (removeCnt > 0) {
this._removeLinesAfter(ctx, removeCnt);
ctx.linesLength -= removeCnt;
}
}
this._finishRendering(ctx, false, deltaTop);
return ctx;
}
_renderUntouchedLines(ctx, startIndex, endIndex, deltaTop, deltaLN) {
const rendLineNumberStart = ctx.rendLineNumberStart;
const lines = ctx.lines;
for (let i = startIndex; i <= endIndex; i++) {
const lineNumber = rendLineNumberStart + i;
lines[i].layoutLine(lineNumber, deltaTop[lineNumber - deltaLN], this.viewportData.lineHeight);
}
}
_insertLinesBefore(ctx, fromLineNumber, toLineNumber, deltaTop, deltaLN) {
const newLines = [];
let newLinesLen = 0;
for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
newLines[newLinesLen++] = this.host.createVisibleLine();
}
ctx.lines = newLines.concat(ctx.lines);
}
_removeLinesBefore(ctx, removeCount) {
for (let i = 0; i < removeCount; i++) {
const lineDomNode = ctx.lines[i].getDomNode();
if (lineDomNode) {
this.domNode.removeChild(lineDomNode);
}
}
ctx.lines.splice(0, removeCount);
}
_insertLinesAfter(ctx, fromLineNumber, toLineNumber, deltaTop, deltaLN) {
const newLines = [];
let newLinesLen = 0;
for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
newLines[newLinesLen++] = this.host.createVisibleLine();
}
ctx.lines = ctx.lines.concat(newLines);
}
_removeLinesAfter(ctx, removeCount) {
const removeIndex = ctx.linesLength - removeCount;
for (let i = 0; i < removeCount; i++) {
const lineDomNode = ctx.lines[removeIndex + i].getDomNode();
if (lineDomNode) {
this.domNode.removeChild(lineDomNode);
}
}
ctx.lines.splice(removeIndex, removeCount);
}
_finishRenderingNewLines(ctx, domNodeIsEmpty, newLinesHTML, wasNew) {
if (_ViewLayerRenderer._ttPolicy) {
newLinesHTML = _ViewLayerRenderer._ttPolicy.createHTML(newLinesHTML);
}
const lastChild = this.domNode.lastChild;
if (domNodeIsEmpty || !lastChild) {
this.domNode.innerHTML = newLinesHTML;
} else {
lastChild.insertAdjacentHTML("afterend", newLinesHTML);
}
let currChild = this.domNode.lastChild;
for (let i = ctx.linesLength - 1; i >= 0; i--) {
const line = ctx.lines[i];
if (wasNew[i]) {
line.setDomNode(currChild);
currChild = currChild.previousSibling;
}
}
}
_finishRenderingInvalidLines(ctx, invalidLinesHTML, wasInvalid) {
const hugeDomNode = document.createElement("div");
if (_ViewLayerRenderer._ttPolicy) {
invalidLinesHTML = _ViewLayerRenderer._ttPolicy.createHTML(invalidLinesHTML);
}
hugeDomNode.innerHTML = invalidLinesHTML;
for (let i = 0; i < ctx.linesLength; i++) {
const line = ctx.lines[i];
if (wasInvalid[i]) {
const source = hugeDomNode.firstChild;
const lineDomNode = line.getDomNode();
lineDomNode.parentNode.replaceChild(source, lineDomNode);
line.setDomNode(source);
}
}
}
_finishRendering(ctx, domNodeIsEmpty, deltaTop) {
const sb = _ViewLayerRenderer._sb;
const linesLength = ctx.linesLength;
const lines = ctx.lines;
const rendLineNumberStart = ctx.rendLineNumberStart;
const wasNew = [];
{
sb.reset();
let hadNewLine = false;
for (let i = 0; i < linesLength; i++) {
const line = lines[i];
wasNew[i] = false;
const lineDomNode = line.getDomNode();
if (lineDomNode) {
continue;
}
const renderResult = line.renderLine(i + rendLineNumberStart, deltaTop[i], this.viewportData.lineHeight, this.viewportData, sb);
if (!renderResult) {
continue;
}
wasNew[i] = true;
hadNewLine = true;
}
if (hadNewLine) {
this._finishRenderingNewLines(ctx, domNodeIsEmpty, sb.build(), wasNew);
}
}
{
sb.reset();
let hadInvalidLine = false;
const wasInvalid = [];
for (let i = 0; i < linesLength; i++) {
const line = lines[i];
wasInvalid[i] = false;
if (wasNew[i]) {
continue;
}
const renderResult = line.renderLine(i + rendLineNumberStart, deltaTop[i], this.viewportData.lineHeight, this.viewportData, sb);
if (!renderResult) {
continue;
}
wasInvalid[i] = true;
hadInvalidLine = true;
}
if (hadInvalidLine) {
this._finishRenderingInvalidLines(ctx, sb.build(), wasInvalid);
}
}
}
};
ViewLayerRenderer._ttPolicy = createTrustedTypesPolicy("editorViewLayer", { createHTML: (value) => value });
ViewLayerRenderer._sb = new StringBuilder(1e5);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/viewOverlays.js
var ViewOverlays, ViewOverlayLine, ContentViewOverlays, MarginViewOverlays;
var init_viewOverlays = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/viewOverlays.js"() {
init_fastDomNode();
init_domFontInfo();
init_viewLayer();
init_viewPart();
ViewOverlays = class extends ViewPart {
constructor(context) {
super(context);
this._visibleLines = new VisibleLinesCollection(this);
this.domNode = this._visibleLines.domNode;
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
applyFontInfo(this.domNode, fontInfo);
this._dynamicOverlays = [];
this._isFocused = false;
this.domNode.setClassName("view-overlays");
}
shouldRender() {
if (super.shouldRender()) {
return true;
}
for (let i = 0, len = this._dynamicOverlays.length; i < len; i++) {
const dynamicOverlay = this._dynamicOverlays[i];
if (dynamicOverlay.shouldRender()) {
return true;
}
}
return false;
}
dispose() {
super.dispose();
for (let i = 0, len = this._dynamicOverlays.length; i < len; i++) {
const dynamicOverlay = this._dynamicOverlays[i];
dynamicOverlay.dispose();
}
this._dynamicOverlays = [];
}
getDomNode() {
return this.domNode;
}
// ---- begin IVisibleLinesHost
createVisibleLine() {
return new ViewOverlayLine(this._dynamicOverlays);
}
// ---- end IVisibleLinesHost
addDynamicOverlay(overlay) {
this._dynamicOverlays.push(overlay);
}
// ----- event handlers
onConfigurationChanged(e) {
this._visibleLines.onConfigurationChanged(e);
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
applyFontInfo(this.domNode, fontInfo);
return true;
}
onFlushed(e) {
return this._visibleLines.onFlushed(e);
}
onFocusChanged(e) {
this._isFocused = e.isFocused;
return true;
}
onLinesChanged(e) {
return this._visibleLines.onLinesChanged(e);
}
onLinesDeleted(e) {
return this._visibleLines.onLinesDeleted(e);
}
onLinesInserted(e) {
return this._visibleLines.onLinesInserted(e);
}
onScrollChanged(e) {
return this._visibleLines.onScrollChanged(e) || true;
}
onTokensChanged(e) {
return this._visibleLines.onTokensChanged(e);
}
onZonesChanged(e) {
return this._visibleLines.onZonesChanged(e);
}
// ----- end event handlers
prepareRender(ctx) {
const toRender = this._dynamicOverlays.filter((overlay) => overlay.shouldRender());
for (let i = 0, len = toRender.length; i < len; i++) {
const dynamicOverlay = toRender[i];
dynamicOverlay.prepareRender(ctx);
dynamicOverlay.onDidRender();
}
}
render(ctx) {
this._viewOverlaysRender(ctx);
this.domNode.toggleClassName("focused", this._isFocused);
}
_viewOverlaysRender(ctx) {
this._visibleLines.renderLines(ctx.viewportData);
}
};
ViewOverlayLine = class {
constructor(dynamicOverlays) {
this._dynamicOverlays = dynamicOverlays;
this._domNode = null;
this._renderedContent = null;
}
getDomNode() {
if (!this._domNode) {
return null;
}
return this._domNode.domNode;
}
setDomNode(domNode) {
this._domNode = createFastDomNode(domNode);
}
onContentChanged() {
}
onTokensChanged() {
}
renderLine(lineNumber, deltaTop, lineHeight, viewportData, sb) {
let result = "";
for (let i = 0, len = this._dynamicOverlays.length; i < len; i++) {
const dynamicOverlay = this._dynamicOverlays[i];
result += dynamicOverlay.render(viewportData.startLineNumber, lineNumber);
}
if (this._renderedContent === result) {
return false;
}
this._renderedContent = result;
sb.appendString('');
sb.appendString(result);
sb.appendString("
");
return true;
}
layoutLine(lineNumber, deltaTop, lineHeight) {
if (this._domNode) {
this._domNode.setTop(deltaTop);
this._domNode.setHeight(lineHeight);
}
}
};
ContentViewOverlays = class extends ViewOverlays {
constructor(context) {
super(context);
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._contentWidth = layoutInfo.contentWidth;
this.domNode.setHeight(0);
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._contentWidth = layoutInfo.contentWidth;
return super.onConfigurationChanged(e) || true;
}
onScrollChanged(e) {
return super.onScrollChanged(e) || e.scrollWidthChanged;
}
// --- end event handlers
_viewOverlaysRender(ctx) {
super._viewOverlaysRender(ctx);
this.domNode.setWidth(Math.max(ctx.scrollWidth, this._contentWidth));
}
};
MarginViewOverlays = class extends ViewOverlays {
constructor(context) {
super(context);
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._contentLeft = layoutInfo.contentLeft;
this.domNode.setClassName("margin-view-overlays");
this.domNode.setWidth(1);
applyFontInfo(this.domNode, options2.get(
50
/* EditorOption.fontInfo */
));
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
applyFontInfo(this.domNode, options2.get(
50
/* EditorOption.fontInfo */
));
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._contentLeft = layoutInfo.contentLeft;
return super.onConfigurationChanged(e) || true;
}
onScrollChanged(e) {
return super.onScrollChanged(e) || e.scrollHeightChanged;
}
_viewOverlaysRender(ctx) {
super._viewOverlaysRender(ctx);
const height = Math.min(ctx.scrollHeight, 1e6);
this.domNode.setHeight(height);
this.domNode.setWidth(this._contentLeft);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/viewUserInputEvents.js
var ViewUserInputEvents;
var init_viewUserInputEvents = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/viewUserInputEvents.js"() {
init_position();
ViewUserInputEvents = class _ViewUserInputEvents {
constructor(coordinatesConverter) {
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 = coordinatesConverter;
}
emitKeyDown(e) {
var _a10;
(_a10 = this.onKeyDown) === null || _a10 === void 0 ? void 0 : _a10.call(this, e);
}
emitKeyUp(e) {
var _a10;
(_a10 = this.onKeyUp) === null || _a10 === void 0 ? void 0 : _a10.call(this, e);
}
emitContextMenu(e) {
var _a10;
(_a10 = this.onContextMenu) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseMove(e) {
var _a10;
(_a10 = this.onMouseMove) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseLeave(e) {
var _a10;
(_a10 = this.onMouseLeave) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseDown(e) {
var _a10;
(_a10 = this.onMouseDown) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseUp(e) {
var _a10;
(_a10 = this.onMouseUp) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseDrag(e) {
var _a10;
(_a10 = this.onMouseDrag) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseDrop(e) {
var _a10;
(_a10 = this.onMouseDrop) === null || _a10 === void 0 ? void 0 : _a10.call(this, this._convertViewToModelMouseEvent(e));
}
emitMouseDropCanceled() {
var _a10;
(_a10 = this.onMouseDropCanceled) === null || _a10 === void 0 ? void 0 : _a10.call(this);
}
emitMouseWheel(e) {
var _a10;
(_a10 = this.onMouseWheel) === null || _a10 === void 0 ? void 0 : _a10.call(this, e);
}
_convertViewToModelMouseEvent(e) {
if (e.target) {
return {
event: e.event,
target: this._convertViewToModelMouseTarget(e.target)
};
}
return e;
}
_convertViewToModelMouseTarget(target) {
return _ViewUserInputEvents.convertViewToModelMouseTarget(target, this._coordinatesConverter);
}
static convertViewToModelMouseTarget(target, coordinatesConverter) {
const result = __spreadValues({}, target);
if (result.position) {
result.position = coordinatesConverter.convertViewPositionToModelPosition(result.position);
}
if (result.range) {
result.range = coordinatesConverter.convertViewRangeToModelRange(result.range);
}
if (result.type === 5 || result.type === 8) {
result.detail = this.convertViewToModelViewZoneData(result.detail, coordinatesConverter);
}
return result;
}
static convertViewToModelViewZoneData(data, coordinatesConverter) {
return {
viewZoneId: data.viewZoneId,
positionBefore: data.positionBefore ? coordinatesConverter.convertViewPositionToModelPosition(data.positionBefore) : data.positionBefore,
positionAfter: data.positionAfter ? coordinatesConverter.convertViewPositionToModelPosition(data.positionAfter) : data.positionAfter,
position: coordinatesConverter.convertViewPositionToModelPosition(data.position),
afterLineNumber: coordinatesConverter.convertViewPositionToModelPosition(new Position(data.afterLineNumber, 1)).lineNumber
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.css
var init_blockDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js
var BlockDecorations;
var init_blockDecorations2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js"() {
init_fastDomNode();
init_blockDecorations();
init_viewPart();
BlockDecorations = class extends ViewPart {
constructor(context) {
super(context);
this.blocks = [];
this.contentWidth = -1;
this.contentLeft = 0;
this.domNode = createFastDomNode(document.createElement("div"));
this.domNode.setAttribute("role", "presentation");
this.domNode.setAttribute("aria-hidden", "true");
this.domNode.setClassName("blockDecorations-container");
this.update();
}
update() {
let didChange = false;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const newContentWidth = layoutInfo.contentWidth - layoutInfo.verticalScrollbarWidth;
if (this.contentWidth !== newContentWidth) {
this.contentWidth = newContentWidth;
didChange = true;
}
const newContentLeft = layoutInfo.contentLeft;
if (this.contentLeft !== newContentLeft) {
this.contentLeft = newContentLeft;
didChange = true;
}
return didChange;
}
dispose() {
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
return this.update();
}
onScrollChanged(e) {
return e.scrollTopChanged || e.scrollLeftChanged;
}
onDecorationsChanged(e) {
return true;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
prepareRender(ctx) {
}
render(ctx) {
var _a10;
let count = 0;
const decorations = ctx.getDecorationsInViewport();
for (const decoration3 of decorations) {
if (!decoration3.options.blockClassName) {
continue;
}
let block = this.blocks[count];
if (!block) {
block = this.blocks[count] = createFastDomNode(document.createElement("div"));
this.domNode.appendChild(block);
}
let top;
let bottom;
if (decoration3.options.blockIsAfterEnd) {
top = ctx.getVerticalOffsetAfterLineNumber(decoration3.range.endLineNumber, false);
bottom = ctx.getVerticalOffsetAfterLineNumber(decoration3.range.endLineNumber, true);
} else {
top = ctx.getVerticalOffsetForLineNumber(decoration3.range.startLineNumber, true);
bottom = decoration3.range.isEmpty() && !decoration3.options.blockDoesNotCollapse ? ctx.getVerticalOffsetForLineNumber(decoration3.range.startLineNumber, false) : ctx.getVerticalOffsetAfterLineNumber(decoration3.range.endLineNumber, true);
}
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = (_a10 = decoration3.options.blockPadding) !== null && _a10 !== void 0 ? _a10 : [0, 0, 0, 0];
block.setClassName("blockDecorations-block " + decoration3.options.blockClassName);
block.setLeft(this.contentLeft - paddingLeft);
block.setWidth(this.contentWidth + paddingLeft + paddingRight);
block.setTop(top - ctx.scrollTop - paddingTop);
block.setHeight(bottom - top + paddingTop + paddingBottom);
count++;
}
for (let i = count; i < this.blocks.length; i++) {
this.blocks[i].domNode.remove();
}
this.blocks.length = count;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js
function safeInvoke(fn, thisArg, ...args) {
try {
return fn.call(thisArg, ...args);
} catch (_a10) {
return null;
}
}
var ViewContentWidgets, Widget2, PositionPair, Coordinate, AnchorCoordinate;
var init_contentWidgets = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js"() {
init_dom();
init_fastDomNode();
init_viewPart();
ViewContentWidgets = class extends ViewPart {
constructor(context, viewDomNode) {
super(context);
this._viewDomNode = viewDomNode;
this._widgets = {};
this.domNode = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this.domNode,
1
/* PartFingerprint.ContentWidgets */
);
this.domNode.setClassName("contentWidgets");
this.domNode.setPosition("absolute");
this.domNode.setTop(0);
this.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this.overflowingContentWidgetsDomNode,
2
/* PartFingerprint.OverflowingContentWidgets */
);
this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets");
}
dispose() {
super.dispose();
this._widgets = {};
}
// --- begin event handlers
onConfigurationChanged(e) {
const keys = Object.keys(this._widgets);
for (const widgetId of keys) {
this._widgets[widgetId].onConfigurationChanged(e);
}
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLineMappingChanged(e) {
this._updateAnchorsViewPositions();
return true;
}
onLinesChanged(e) {
this._updateAnchorsViewPositions();
return true;
}
onLinesDeleted(e) {
this._updateAnchorsViewPositions();
return true;
}
onLinesInserted(e) {
this._updateAnchorsViewPositions();
return true;
}
onScrollChanged(e) {
return true;
}
onZonesChanged(e) {
return true;
}
// ---- end view event handlers
_updateAnchorsViewPositions() {
const keys = Object.keys(this._widgets);
for (const widgetId of keys) {
this._widgets[widgetId].updateAnchorViewPosition();
}
}
addWidget(_widget) {
const myWidget = new Widget2(this._context, this._viewDomNode, _widget);
this._widgets[myWidget.id] = myWidget;
if (myWidget.allowEditorOverflow) {
this.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);
} else {
this.domNode.appendChild(myWidget.domNode);
}
this.setShouldRender();
}
setWidgetPosition(widget, primaryAnchor, secondaryAnchor, preference, affinity) {
const myWidget = this._widgets[widget.getId()];
myWidget.setPosition(primaryAnchor, secondaryAnchor, preference, affinity);
this.setShouldRender();
}
removeWidget(widget) {
const widgetId = widget.getId();
if (this._widgets.hasOwnProperty(widgetId)) {
const myWidget = this._widgets[widgetId];
delete this._widgets[widgetId];
const domNode = myWidget.domNode.domNode;
domNode.parentNode.removeChild(domNode);
domNode.removeAttribute("monaco-visible-content-widget");
this.setShouldRender();
}
}
shouldSuppressMouseDownOnWidget(widgetId) {
if (this._widgets.hasOwnProperty(widgetId)) {
return this._widgets[widgetId].suppressMouseDown;
}
return false;
}
onBeforeRender(viewportData) {
const keys = Object.keys(this._widgets);
for (const widgetId of keys) {
this._widgets[widgetId].onBeforeRender(viewportData);
}
}
prepareRender(ctx) {
const keys = Object.keys(this._widgets);
for (const widgetId of keys) {
this._widgets[widgetId].prepareRender(ctx);
}
}
render(ctx) {
const keys = Object.keys(this._widgets);
for (const widgetId of keys) {
this._widgets[widgetId].render(ctx);
}
}
};
Widget2 = class {
constructor(context, viewDomNode, actual) {
this._primaryAnchor = new PositionPair(null, null);
this._secondaryAnchor = new PositionPair(null, null);
this._context = context;
this._viewDomNode = viewDomNode;
this._actual = actual;
this.domNode = createFastDomNode(this._actual.getDomNode());
this.id = this._actual.getId();
this.allowEditorOverflow = this._actual.allowEditorOverflow || false;
this.suppressMouseDown = this._actual.suppressMouseDown || false;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._fixedOverflowWidgets = options2.get(
42
/* EditorOption.fixedOverflowWidgets */
);
this._contentWidth = layoutInfo.contentWidth;
this._contentLeft = layoutInfo.contentLeft;
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._affinity = null;
this._preference = [];
this._cachedDomNodeOffsetWidth = -1;
this._cachedDomNodeOffsetHeight = -1;
this._maxWidth = this._getMaxWidth();
this._isVisible = false;
this._renderData = null;
this.domNode.setPosition(this._fixedOverflowWidgets && this.allowEditorOverflow ? "fixed" : "absolute");
this.domNode.setDisplay("none");
this.domNode.setVisibility("hidden");
this.domNode.setAttribute("widgetId", this.id);
this.domNode.setMaxWidth(this._maxWidth);
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._maxWidth = this._getMaxWidth();
}
}
updateAnchorViewPosition() {
this._setPosition(this._affinity, this._primaryAnchor.modelPosition, this._secondaryAnchor.modelPosition);
}
_setPosition(affinity, primaryAnchor, secondaryAnchor) {
this._affinity = affinity;
this._primaryAnchor = getValidPositionPair(primaryAnchor, this._context.viewModel, this._affinity);
this._secondaryAnchor = getValidPositionPair(secondaryAnchor, this._context.viewModel, this._affinity);
function getValidPositionPair(position, viewModel, affinity2) {
if (!position) {
return new PositionPair(null, null);
}
const validModelPosition = viewModel.model.validatePosition(position);
if (viewModel.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {
const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition, affinity2 !== null && affinity2 !== void 0 ? affinity2 : void 0);
return new PositionPair(position, viewPosition);
}
return new PositionPair(position, null);
}
}
_getMaxWidth() {
const elDocument = this.domNode.domNode.ownerDocument;
const elWindow = elDocument.defaultView;
return this.allowEditorOverflow ? (elWindow === null || elWindow === void 0 ? void 0 : elWindow.innerWidth) || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth : this._contentWidth;
}
setPosition(primaryAnchor, secondaryAnchor, preference, affinity) {
this._setPosition(affinity, primaryAnchor, secondaryAnchor);
this._preference = preference;
if (this._primaryAnchor.viewPosition && this._preference && this._preference.length > 0) {
this.domNode.setDisplay("block");
} else {
this.domNode.setDisplay("none");
}
this._cachedDomNodeOffsetWidth = -1;
this._cachedDomNodeOffsetHeight = -1;
}
_layoutBoxInViewport(anchor, width2, height, ctx) {
const aboveLineTop = anchor.top;
const heightAvailableAboveLine = aboveLineTop;
const underLineTop = anchor.top + anchor.height;
const heightAvailableUnderLine = ctx.viewportHeight - underLineTop;
const aboveTop = aboveLineTop - height;
const fitsAbove = heightAvailableAboveLine >= height;
const belowTop = underLineTop;
const fitsBelow = heightAvailableUnderLine >= height;
let left = anchor.left;
if (left + width2 > ctx.scrollLeft + ctx.viewportWidth) {
left = ctx.scrollLeft + ctx.viewportWidth - width2;
}
if (left < ctx.scrollLeft) {
left = ctx.scrollLeft;
}
return { fitsAbove, aboveTop, fitsBelow, belowTop, left };
}
_layoutHorizontalSegmentInPage(windowSize, domNodePosition, left, width2) {
var _a10;
const LEFT_PADDING = 15;
const RIGHT_PADDING = 15;
const MIN_LIMIT = Math.max(LEFT_PADDING, domNodePosition.left - width2);
const MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width2, windowSize.width - RIGHT_PADDING);
const elDocument = this._viewDomNode.domNode.ownerDocument;
const elWindow = elDocument.defaultView;
let absoluteLeft = domNodePosition.left + left - ((_a10 = elWindow === null || elWindow === void 0 ? void 0 : elWindow.scrollX) !== null && _a10 !== void 0 ? _a10 : 0);
if (absoluteLeft + width2 > MAX_LIMIT) {
const delta = absoluteLeft - (MAX_LIMIT - width2);
absoluteLeft -= delta;
left -= delta;
}
if (absoluteLeft < MIN_LIMIT) {
const delta = absoluteLeft - MIN_LIMIT;
absoluteLeft -= delta;
left -= delta;
}
return [left, absoluteLeft];
}
_layoutBoxInPage(anchor, width2, height, ctx) {
var _a10, _b4;
const aboveTop = anchor.top - height;
const belowTop = anchor.top + anchor.height;
const domNodePosition = getDomNodePagePosition(this._viewDomNode.domNode);
const elDocument = this._viewDomNode.domNode.ownerDocument;
const elWindow = elDocument.defaultView;
const absoluteAboveTop = domNodePosition.top + aboveTop - ((_a10 = elWindow === null || elWindow === void 0 ? void 0 : elWindow.scrollY) !== null && _a10 !== void 0 ? _a10 : 0);
const absoluteBelowTop = domNodePosition.top + belowTop - ((_b4 = elWindow === null || elWindow === void 0 ? void 0 : elWindow.scrollY) !== null && _b4 !== void 0 ? _b4 : 0);
const windowSize = getClientArea(elDocument.body);
const [left, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, anchor.left - ctx.scrollLeft + this._contentLeft, width2);
const TOP_PADDING = 22;
const BOTTOM_PADDING = 22;
const fitsAbove = absoluteAboveTop >= TOP_PADDING;
const fitsBelow = absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING;
if (this._fixedOverflowWidgets) {
return {
fitsAbove,
aboveTop: Math.max(absoluteAboveTop, TOP_PADDING),
fitsBelow,
belowTop: absoluteBelowTop,
left: absoluteAboveLeft
};
}
return { fitsAbove, aboveTop, fitsBelow, belowTop, left };
}
_prepareRenderWidgetAtExactPositionOverflowing(topLeft) {
return new Coordinate(topLeft.top, topLeft.left + this._contentLeft);
}
/**
* Compute the coordinates above and below the primary and secondary anchors.
* The content widget *must* touch the primary anchor.
* The content widget should touch if possible the secondary anchor.
*/
_getAnchorsCoordinates(ctx) {
var _a10, _b4;
const primary = getCoordinates(this._primaryAnchor.viewPosition, this._affinity, this._lineHeight);
const secondaryViewPosition = ((_a10 = this._secondaryAnchor.viewPosition) === null || _a10 === void 0 ? void 0 : _a10.lineNumber) === ((_b4 = this._primaryAnchor.viewPosition) === null || _b4 === void 0 ? void 0 : _b4.lineNumber) ? this._secondaryAnchor.viewPosition : null;
const secondary = getCoordinates(secondaryViewPosition, this._affinity, this._lineHeight);
return { primary, secondary };
function getCoordinates(position, affinity, lineHeight) {
if (!position) {
return null;
}
const horizontalPosition = ctx.visibleRangeForPosition(position);
if (!horizontalPosition) {
return null;
}
const left = position.column === 1 && affinity === 3 ? 0 : horizontalPosition.left;
const top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.scrollTop;
return new AnchorCoordinate(top, left, lineHeight);
}
}
_reduceAnchorCoordinates(primary, secondary, width2) {
if (!secondary) {
return primary;
}
const fontInfo = this._context.configuration.options.get(
50
/* EditorOption.fontInfo */
);
let left = secondary.left;
if (left < primary.left) {
left = Math.max(left, primary.left - width2 + fontInfo.typicalFullwidthCharacterWidth);
} else {
left = Math.min(left, primary.left + width2 - fontInfo.typicalFullwidthCharacterWidth);
}
return new AnchorCoordinate(primary.top, left, primary.height);
}
_prepareRenderWidget(ctx) {
if (!this._preference || this._preference.length === 0) {
return null;
}
const { primary, secondary } = this._getAnchorsCoordinates(ctx);
if (!primary) {
return {
kind: "offViewport",
preserveFocus: this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)
};
}
if (this._cachedDomNodeOffsetWidth === -1 || this._cachedDomNodeOffsetHeight === -1) {
let preferredDimensions = null;
if (typeof this._actual.beforeRender === "function") {
preferredDimensions = safeInvoke(this._actual.beforeRender, this._actual);
}
if (preferredDimensions) {
this._cachedDomNodeOffsetWidth = preferredDimensions.width;
this._cachedDomNodeOffsetHeight = preferredDimensions.height;
} else {
const domNode = this.domNode.domNode;
const clientRect = domNode.getBoundingClientRect();
this._cachedDomNodeOffsetWidth = Math.round(clientRect.width);
this._cachedDomNodeOffsetHeight = Math.round(clientRect.height);
}
}
const anchor = this._reduceAnchorCoordinates(primary, secondary, this._cachedDomNodeOffsetWidth);
let placement;
if (this.allowEditorOverflow) {
placement = this._layoutBoxInPage(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);
} else {
placement = this._layoutBoxInViewport(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);
}
for (let pass = 1; pass <= 2; pass++) {
for (const pref of this._preference) {
if (pref === 1) {
if (!placement) {
return null;
}
if (pass === 2 || placement.fitsAbove) {
return {
kind: "inViewport",
coordinate: new Coordinate(placement.aboveTop, placement.left),
position: 1
/* ContentWidgetPositionPreference.ABOVE */
};
}
} else if (pref === 2) {
if (!placement) {
return null;
}
if (pass === 2 || placement.fitsBelow) {
return {
kind: "inViewport",
coordinate: new Coordinate(placement.belowTop, placement.left),
position: 2
/* ContentWidgetPositionPreference.BELOW */
};
}
} else {
if (this.allowEditorOverflow) {
return {
kind: "inViewport",
coordinate: this._prepareRenderWidgetAtExactPositionOverflowing(new Coordinate(anchor.top, anchor.left)),
position: 0
/* ContentWidgetPositionPreference.EXACT */
};
} else {
return {
kind: "inViewport",
coordinate: new Coordinate(anchor.top, anchor.left),
position: 0
/* ContentWidgetPositionPreference.EXACT */
};
}
}
}
}
return null;
}
/**
* On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.
*/
onBeforeRender(viewportData) {
if (!this._primaryAnchor.viewPosition || !this._preference) {
return;
}
if (this._primaryAnchor.viewPosition.lineNumber < viewportData.startLineNumber || this._primaryAnchor.viewPosition.lineNumber > viewportData.endLineNumber) {
return;
}
this.domNode.setMaxWidth(this._maxWidth);
}
prepareRender(ctx) {
this._renderData = this._prepareRenderWidget(ctx);
}
render(ctx) {
var _a10;
if (!this._renderData || this._renderData.kind === "offViewport") {
if (this._isVisible) {
this.domNode.removeAttribute("monaco-visible-content-widget");
this._isVisible = false;
if (((_a10 = this._renderData) === null || _a10 === void 0 ? void 0 : _a10.kind) === "offViewport" && this._renderData.preserveFocus) {
this.domNode.setTop(-1e3);
} else {
this.domNode.setVisibility("hidden");
}
}
if (typeof this._actual.afterRender === "function") {
safeInvoke(this._actual.afterRender, this._actual, null);
}
return;
}
if (this.allowEditorOverflow) {
this.domNode.setTop(this._renderData.coordinate.top);
this.domNode.setLeft(this._renderData.coordinate.left);
} else {
this.domNode.setTop(this._renderData.coordinate.top + ctx.scrollTop - ctx.bigNumbersDelta);
this.domNode.setLeft(this._renderData.coordinate.left);
}
if (!this._isVisible) {
this.domNode.setVisibility("inherit");
this.domNode.setAttribute("monaco-visible-content-widget", "true");
this._isVisible = true;
}
if (typeof this._actual.afterRender === "function") {
safeInvoke(this._actual.afterRender, this._actual, this._renderData.position);
}
}
};
PositionPair = class {
constructor(modelPosition, viewPosition) {
this.modelPosition = modelPosition;
this.viewPosition = viewPosition;
}
};
Coordinate = class {
constructor(top, left) {
this.top = top;
this.left = left;
this._coordinateBrand = void 0;
}
};
AnchorCoordinate = class {
constructor(top, left, height) {
this.top = top;
this.left = left;
this.height = height;
this._anchorCoordinateBrand = void 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.css
var init_currentLineHighlight = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js
var AbstractLineHighlightOverlay, CurrentLineHighlightOverlay, CurrentLineMarginHighlightOverlay;
var init_currentLineHighlight2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js"() {
init_currentLineHighlight();
init_dynamicViewOverlay();
init_editorColorRegistry();
init_arrays();
init_themeService();
init_selection();
init_theme();
init_position();
AbstractLineHighlightOverlay = class extends DynamicViewOverlay {
constructor(context) {
super();
this._context = context;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._renderLineHighlight = options2.get(
96
/* EditorOption.renderLineHighlight */
);
this._renderLineHighlightOnlyWhenFocus = options2.get(
97
/* EditorOption.renderLineHighlightOnlyWhenFocus */
);
this._wordWrap = layoutInfo.isViewportWrapping;
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._selectionIsEmpty = true;
this._focused = false;
this._cursorLineNumbers = [1];
this._selections = [new Selection(1, 1, 1, 1)];
this._renderData = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
super.dispose();
}
_readFromSelections() {
let hasChanged = false;
const lineNumbers = /* @__PURE__ */ new Set();
for (const selection of this._selections) {
lineNumbers.add(selection.positionLineNumber);
}
const cursorsLineNumbers = Array.from(lineNumbers);
cursorsLineNumbers.sort((a3, b) => a3 - b);
if (!equals(this._cursorLineNumbers, cursorsLineNumbers)) {
this._cursorLineNumbers = cursorsLineNumbers;
hasChanged = true;
}
const selectionIsEmpty = this._selections.every((s) => s.isEmpty());
if (this._selectionIsEmpty !== selectionIsEmpty) {
this._selectionIsEmpty = selectionIsEmpty;
hasChanged = true;
}
return hasChanged;
}
// --- begin event handlers
onThemeChanged(e) {
return this._readFromSelections();
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._renderLineHighlight = options2.get(
96
/* EditorOption.renderLineHighlight */
);
this._renderLineHighlightOnlyWhenFocus = options2.get(
97
/* EditorOption.renderLineHighlightOnlyWhenFocus */
);
this._wordWrap = layoutInfo.isViewportWrapping;
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
return true;
}
onCursorStateChanged(e) {
this._selections = e.selections;
return this._readFromSelections();
}
onFlushed(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollWidthChanged || e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
onFocusChanged(e) {
if (!this._renderLineHighlightOnlyWhenFocus) {
return false;
}
this._focused = e.isFocused;
return true;
}
// --- end event handlers
prepareRender(ctx) {
if (!this._shouldRenderThis()) {
this._renderData = null;
return;
}
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const renderData = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
renderData[lineIndex] = "";
}
if (this._wordWrap) {
const renderedLineWrapped = this._renderOne(ctx, false);
for (const cursorLineNumber of this._cursorLineNumbers) {
const coordinatesConverter = this._context.viewModel.coordinatesConverter;
const modelLineNumber = coordinatesConverter.convertViewPositionToModelPosition(new Position(cursorLineNumber, 1)).lineNumber;
const firstViewLineNumber = coordinatesConverter.convertModelPositionToViewPosition(new Position(modelLineNumber, 1)).lineNumber;
const lastViewLineNumber = coordinatesConverter.convertModelPositionToViewPosition(new Position(modelLineNumber, this._context.viewModel.model.getLineMaxColumn(modelLineNumber))).lineNumber;
const firstLine = Math.max(firstViewLineNumber, visibleStartLineNumber);
const lastLine = Math.min(lastViewLineNumber, visibleEndLineNumber);
for (let lineNumber = firstLine; lineNumber <= lastLine; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
renderData[lineIndex] = renderedLineWrapped;
}
}
}
const renderedLineExact = this._renderOne(ctx, true);
for (const cursorLineNumber of this._cursorLineNumbers) {
if (cursorLineNumber < visibleStartLineNumber || cursorLineNumber > visibleEndLineNumber) {
continue;
}
const lineIndex = cursorLineNumber - visibleStartLineNumber;
renderData[lineIndex] = renderedLineExact;
}
this._renderData = renderData;
}
render(startLineNumber, lineNumber) {
if (!this._renderData) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex >= this._renderData.length) {
return "";
}
return this._renderData[lineIndex];
}
_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);
}
};
CurrentLineHighlightOverlay = class extends AbstractLineHighlightOverlay {
_renderOne(ctx, exact) {
const className = "current-line" + (this._shouldRenderInMargin() ? " current-line-both" : "") + (exact ? " current-line-exact" : "");
return ``;
}
_shouldRenderThis() {
return this._shouldRenderInContent();
}
_shouldRenderOther() {
return this._shouldRenderInMargin();
}
};
CurrentLineMarginHighlightOverlay = class extends AbstractLineHighlightOverlay {
_renderOne(ctx, exact) {
const className = "current-line" + (this._shouldRenderInMargin() ? " current-line-margin" : "") + (this._shouldRenderOther() ? " current-line-margin-both" : "") + (this._shouldRenderInMargin() && exact ? " current-line-exact-margin" : "");
return ``;
}
_shouldRenderThis() {
return true;
}
_shouldRenderOther() {
return this._shouldRenderInContent();
}
};
registerThemingParticipant((theme, collector) => {
const lineHighlight = theme.getColor(editorLineHighlight);
if (lineHighlight) {
collector.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${lineHighlight}; }`);
collector.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${lineHighlight}; border: none; }`);
}
if (!lineHighlight || lineHighlight.isTransparent() || theme.defines(editorLineHighlightBorder)) {
const lineHighlightBorder = theme.getColor(editorLineHighlightBorder);
if (lineHighlightBorder) {
collector.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${lineHighlightBorder}; }`);
collector.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${lineHighlightBorder}; }`);
if (isHighContrast(theme.type)) {
collector.addRule(`.monaco-editor .view-overlays .current-line-exact { border-width: 1px; }`);
collector.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }`);
}
}
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.css
var init_decorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.js
var DecorationsOverlay;
var init_decorations2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.js"() {
init_decorations();
init_dynamicViewOverlay();
init_renderingContext();
init_range();
DecorationsOverlay = class extends DynamicViewOverlay {
constructor(context) {
super();
this._context = context;
const options2 = this._context.configuration.options;
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
this._renderResult = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged || e.scrollWidthChanged;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
prepareRender(ctx) {
const _decorations = ctx.getDecorationsInViewport();
let decorations = [];
let decorationsLen = 0;
for (let i = 0, len = _decorations.length; i < len; i++) {
const d = _decorations[i];
if (d.options.className) {
decorations[decorationsLen++] = d;
}
}
decorations = decorations.sort((a3, b) => {
if (a3.options.zIndex < b.options.zIndex) {
return -1;
}
if (a3.options.zIndex > b.options.zIndex) {
return 1;
}
const aClassName = a3.options.className;
const bClassName = b.options.className;
if (aClassName < bClassName) {
return -1;
}
if (aClassName > bClassName) {
return 1;
}
return Range.compareRangesUsingStarts(a3.range, b.range);
});
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const output = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = "";
}
this._renderWholeLineDecorations(ctx, decorations, output);
this._renderNormalDecorations(ctx, decorations, output);
this._renderResult = output;
}
_renderWholeLineDecorations(ctx, decorations, output) {
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
for (let i = 0, lenI = decorations.length; i < lenI; i++) {
const d = decorations[i];
if (!d.options.isWholeLine) {
continue;
}
const decorationOutput = '';
const startLineNumber = Math.max(d.range.startLineNumber, visibleStartLineNumber);
const endLineNumber = Math.min(d.range.endLineNumber, visibleEndLineNumber);
for (let j = startLineNumber; j <= endLineNumber; j++) {
const lineIndex = j - visibleStartLineNumber;
output[lineIndex] += decorationOutput;
}
}
}
_renderNormalDecorations(ctx, decorations, output) {
var _a10;
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
let prevClassName = null;
let prevShowIfCollapsed = false;
let prevRange = null;
let prevShouldFillLineOnLineBreak = false;
for (let i = 0, lenI = decorations.length; i < lenI; i++) {
const d = decorations[i];
if (d.options.isWholeLine) {
continue;
}
const className = d.options.className;
const showIfCollapsed = Boolean(d.options.showIfCollapsed);
let range2 = d.range;
if (showIfCollapsed && range2.endColumn === 1 && range2.endLineNumber !== range2.startLineNumber) {
range2 = new Range(range2.startLineNumber, range2.startColumn, range2.endLineNumber - 1, this._context.viewModel.getLineMaxColumn(range2.endLineNumber - 1));
}
if (prevClassName === className && prevShowIfCollapsed === showIfCollapsed && Range.areIntersectingOrTouching(prevRange, range2)) {
prevRange = Range.plusRange(prevRange, range2);
continue;
}
if (prevClassName !== null) {
this._renderNormalDecoration(ctx, prevRange, prevClassName, prevShouldFillLineOnLineBreak, prevShowIfCollapsed, visibleStartLineNumber, output);
}
prevClassName = className;
prevShowIfCollapsed = showIfCollapsed;
prevRange = range2;
prevShouldFillLineOnLineBreak = (_a10 = d.options.shouldFillLineOnLineBreak) !== null && _a10 !== void 0 ? _a10 : false;
}
if (prevClassName !== null) {
this._renderNormalDecoration(ctx, prevRange, prevClassName, prevShouldFillLineOnLineBreak, prevShowIfCollapsed, visibleStartLineNumber, output);
}
}
_renderNormalDecoration(ctx, range2, className, shouldFillLineOnLineBreak, showIfCollapsed, visibleStartLineNumber, output) {
const linesVisibleRanges = ctx.linesVisibleRangesForRange(
range2,
/*TODO@Alex*/
className === "findMatch"
);
if (!linesVisibleRanges) {
return;
}
for (let j = 0, lenJ = linesVisibleRanges.length; j < lenJ; j++) {
const lineVisibleRanges = linesVisibleRanges[j];
if (lineVisibleRanges.outsideRenderedLine) {
continue;
}
const lineIndex = lineVisibleRanges.lineNumber - visibleStartLineNumber;
if (showIfCollapsed && lineVisibleRanges.ranges.length === 1) {
const singleVisibleRange = lineVisibleRanges.ranges[0];
if (singleVisibleRange.width < this._typicalHalfwidthCharacterWidth) {
const center = Math.round(singleVisibleRange.left + singleVisibleRange.width / 2);
const left = Math.max(0, Math.round(center - this._typicalHalfwidthCharacterWidth / 2));
lineVisibleRanges.ranges[0] = new HorizontalRange(left, this._typicalHalfwidthCharacterWidth);
}
}
for (let k = 0, lenK = lineVisibleRanges.ranges.length; k < lenK; k++) {
const expandToLeft = shouldFillLineOnLineBreak && lineVisibleRanges.continuesOnNextLine && lenK === 1;
const visibleRange = lineVisibleRanges.ranges[k];
const decorationOutput = '';
output[lineIndex] += decorationOutput;
}
}
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return "";
}
return this._renderResult[lineIndex];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js
var EditorScrollbar2;
var init_editorScrollbar = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js"() {
init_dom();
init_fastDomNode();
init_scrollableElement();
init_viewPart();
init_themeService();
EditorScrollbar2 = class extends ViewPart {
constructor(context, linesContent, viewDomNode, overflowGuardDomNode) {
super(context);
const options2 = this._context.configuration.options;
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
const mouseWheelScrollSensitivity = options2.get(
75
/* EditorOption.mouseWheelScrollSensitivity */
);
const fastScrollSensitivity = options2.get(
40
/* EditorOption.fastScrollSensitivity */
);
const scrollPredominantAxis = options2.get(
106
/* EditorOption.scrollPredominantAxis */
);
const scrollbarOptions = {
listenOnDomNode: viewDomNode.domNode,
className: "editor-scrollable " + getThemeTypeSelector(context.theme.type),
useShadows: false,
lazyRender: true,
vertical: scrollbar.vertical,
horizontal: scrollbar.horizontal,
verticalHasArrows: scrollbar.verticalHasArrows,
horizontalHasArrows: scrollbar.horizontalHasArrows,
verticalScrollbarSize: scrollbar.verticalScrollbarSize,
verticalSliderSize: scrollbar.verticalSliderSize,
horizontalScrollbarSize: scrollbar.horizontalScrollbarSize,
horizontalSliderSize: scrollbar.horizontalSliderSize,
handleMouseWheel: scrollbar.handleMouseWheel,
alwaysConsumeMouseWheel: scrollbar.alwaysConsumeMouseWheel,
arrowSize: scrollbar.arrowSize,
mouseWheelScrollSensitivity,
fastScrollSensitivity,
scrollPredominantAxis,
scrollByPage: scrollbar.scrollByPage
};
this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.getScrollable()));
PartFingerprints.write(
this.scrollbar.getDomNode(),
6
/* PartFingerprint.ScrollableElement */
);
this.scrollbarDomNode = createFastDomNode(this.scrollbar.getDomNode());
this.scrollbarDomNode.setPosition("absolute");
this._setLayout();
const onBrowserDesperateReveal = (domNode, lookAtScrollTop, lookAtScrollLeft) => {
const newScrollPosition = {};
if (lookAtScrollTop) {
const deltaTop = domNode.scrollTop;
if (deltaTop) {
newScrollPosition.scrollTop = this._context.viewLayout.getCurrentScrollTop() + deltaTop;
domNode.scrollTop = 0;
}
}
if (lookAtScrollLeft) {
const deltaLeft = domNode.scrollLeft;
if (deltaLeft) {
newScrollPosition.scrollLeft = this._context.viewLayout.getCurrentScrollLeft() + deltaLeft;
domNode.scrollLeft = 0;
}
}
this._context.viewModel.viewLayout.setScrollPosition(
newScrollPosition,
1
/* ScrollType.Immediate */
);
};
this._register(addDisposableListener(viewDomNode.domNode, "scroll", (e) => onBrowserDesperateReveal(viewDomNode.domNode, true, true)));
this._register(addDisposableListener(linesContent.domNode, "scroll", (e) => onBrowserDesperateReveal(linesContent.domNode, true, false)));
this._register(addDisposableListener(overflowGuardDomNode.domNode, "scroll", (e) => onBrowserDesperateReveal(overflowGuardDomNode.domNode, true, false)));
this._register(addDisposableListener(this.scrollbarDomNode.domNode, "scroll", (e) => onBrowserDesperateReveal(this.scrollbarDomNode.domNode, true, false)));
}
dispose() {
super.dispose();
}
_setLayout() {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this.scrollbarDomNode.setLeft(layoutInfo.contentLeft);
const minimap = options2.get(
73
/* EditorOption.minimap */
);
const side = minimap.side;
if (side === "right") {
this.scrollbarDomNode.setWidth(layoutInfo.contentWidth + layoutInfo.minimap.minimapWidth);
} else {
this.scrollbarDomNode.setWidth(layoutInfo.contentWidth);
}
this.scrollbarDomNode.setHeight(layoutInfo.height);
}
getOverviewRulerLayoutInfo() {
return this.scrollbar.getOverviewRulerLayoutInfo();
}
getDomNode() {
return this.scrollbarDomNode;
}
delegateVerticalScrollbarPointerDown(browserEvent) {
this.scrollbar.delegateVerticalScrollbarPointerDown(browserEvent);
}
delegateScrollFromMouseWheelEvent(browserEvent) {
this.scrollbar.delegateScrollFromMouseWheelEvent(browserEvent);
}
// --- begin event handlers
onConfigurationChanged(e) {
if (e.hasChanged(
103
/* EditorOption.scrollbar */
) || e.hasChanged(
75
/* EditorOption.mouseWheelScrollSensitivity */
) || e.hasChanged(
40
/* EditorOption.fastScrollSensitivity */
)) {
const options2 = this._context.configuration.options;
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
const mouseWheelScrollSensitivity = options2.get(
75
/* EditorOption.mouseWheelScrollSensitivity */
);
const fastScrollSensitivity = options2.get(
40
/* EditorOption.fastScrollSensitivity */
);
const scrollPredominantAxis = options2.get(
106
/* EditorOption.scrollPredominantAxis */
);
const newOpts = {
vertical: scrollbar.vertical,
horizontal: scrollbar.horizontal,
verticalScrollbarSize: scrollbar.verticalScrollbarSize,
horizontalScrollbarSize: scrollbar.horizontalScrollbarSize,
scrollByPage: scrollbar.scrollByPage,
handleMouseWheel: scrollbar.handleMouseWheel,
mouseWheelScrollSensitivity,
fastScrollSensitivity,
scrollPredominantAxis
};
this.scrollbar.updateOptions(newOpts);
}
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
this._setLayout();
}
return true;
}
onScrollChanged(e) {
return true;
}
onThemeChanged(e) {
this.scrollbar.updateClassName("editor-scrollable " + getThemeTypeSelector(this._context.theme.type));
return true;
}
// --- end event handlers
prepareRender(ctx) {
}
render(ctx) {
this.scrollbar.renderNow();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.css
var init_glyphMargin = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js
var DecorationToRender, LineDecorationToRender, VisibleLineDecorationsToRender, DedupOverlay, GlyphMarginWidgets, DecorationBasedGlyphRenderRequest, WidgetBasedGlyphRenderRequest, DecorationBasedGlyph;
var init_glyphMargin2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js"() {
init_fastDomNode();
init_arrays();
init_glyphMargin();
init_dynamicViewOverlay();
init_viewPart();
init_position();
init_range();
init_model2();
DecorationToRender = class {
constructor(startLineNumber, endLineNumber, className, tooltip, zIndex) {
this.startLineNumber = startLineNumber;
this.endLineNumber = endLineNumber;
this.className = className;
this.tooltip = tooltip;
this._decorationToRenderBrand = void 0;
this.zIndex = zIndex !== null && zIndex !== void 0 ? zIndex : 0;
}
};
LineDecorationToRender = class {
constructor(className, zIndex, tooltip) {
this.className = className;
this.zIndex = zIndex;
this.tooltip = tooltip;
}
};
VisibleLineDecorationsToRender = class {
constructor() {
this.decorations = [];
}
add(decoration3) {
this.decorations.push(decoration3);
}
getDecorations() {
return this.decorations;
}
};
DedupOverlay = class extends DynamicViewOverlay {
/**
* Returns an array with an element for each visible line number.
*/
_render(visibleStartLineNumber, visibleEndLineNumber, decorations) {
const output = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = new VisibleLineDecorationsToRender();
}
if (decorations.length === 0) {
return output;
}
decorations.sort((a3, b) => {
if (a3.className === b.className) {
if (a3.startLineNumber === b.startLineNumber) {
return a3.endLineNumber - b.endLineNumber;
}
return a3.startLineNumber - b.startLineNumber;
}
return a3.className < b.className ? -1 : 1;
});
let prevClassName = null;
let prevEndLineIndex = 0;
for (let i = 0, len = decorations.length; i < len; i++) {
const d = decorations[i];
const className = d.className;
const zIndex = d.zIndex;
let startLineIndex = Math.max(d.startLineNumber, visibleStartLineNumber) - visibleStartLineNumber;
const endLineIndex = Math.min(d.endLineNumber, visibleEndLineNumber) - visibleStartLineNumber;
if (prevClassName === className) {
startLineIndex = Math.max(prevEndLineIndex + 1, startLineIndex);
prevEndLineIndex = Math.max(prevEndLineIndex, endLineIndex);
} else {
prevClassName = className;
prevEndLineIndex = endLineIndex;
}
for (let i2 = startLineIndex; i2 <= prevEndLineIndex; i2++) {
output[i2].add(new LineDecorationToRender(className, zIndex, d.tooltip));
}
}
return output;
}
};
GlyphMarginWidgets = class extends ViewPart {
constructor(context) {
super(context);
this._widgets = {};
this._context = context;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this.domNode = createFastDomNode(document.createElement("div"));
this.domNode.setClassName("glyph-margin-widgets");
this.domNode.setPosition("absolute");
this.domNode.setTop(0);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._glyphMargin = options2.get(
57
/* EditorOption.glyphMargin */
);
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
this._glyphMarginDecorationLaneCount = layoutInfo.glyphMarginDecorationLaneCount;
this._managedDomNodes = [];
this._decorationGlyphsToRender = [];
}
dispose() {
this._managedDomNodes = [];
this._decorationGlyphsToRender = [];
this._widgets = {};
super.dispose();
}
getWidgets() {
return Object.values(this._widgets);
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._glyphMargin = options2.get(
57
/* EditorOption.glyphMargin */
);
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
this._glyphMarginDecorationLaneCount = layoutInfo.glyphMarginDecorationLaneCount;
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
// --- begin widget management
addWidget(widget) {
const domNode = createFastDomNode(widget.getDomNode());
this._widgets[widget.getId()] = {
widget,
preference: widget.getPosition(),
domNode,
renderInfo: null
};
domNode.setPosition("absolute");
domNode.setDisplay("none");
domNode.setAttribute("widgetId", widget.getId());
this.domNode.appendChild(domNode);
this.setShouldRender();
}
setWidgetPosition(widget, preference) {
const myWidget = this._widgets[widget.getId()];
if (myWidget.preference.lane === preference.lane && myWidget.preference.zIndex === preference.zIndex && Range.equalsRange(myWidget.preference.range, preference.range)) {
return false;
}
myWidget.preference = preference;
this.setShouldRender();
return true;
}
removeWidget(widget) {
var _a10;
const widgetId = widget.getId();
if (this._widgets[widgetId]) {
const widgetData = this._widgets[widgetId];
const domNode = widgetData.domNode.domNode;
delete this._widgets[widgetId];
(_a10 = domNode.parentNode) === null || _a10 === void 0 ? void 0 : _a10.removeChild(domNode);
this.setShouldRender();
}
}
// --- end widget management
_collectDecorationBasedGlyphRenderRequest(ctx, requests) {
var _a10, _b4, _c2;
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const decorations = ctx.getDecorationsInViewport();
for (const d of decorations) {
const glyphMarginClassName = d.options.glyphMarginClassName;
if (!glyphMarginClassName) {
continue;
}
const startLineNumber = Math.max(d.range.startLineNumber, visibleStartLineNumber);
const endLineNumber = Math.min(d.range.endLineNumber, visibleEndLineNumber);
const lane = (_b4 = (_a10 = d.options.glyphMargin) === null || _a10 === void 0 ? void 0 : _a10.position) !== null && _b4 !== void 0 ? _b4 : GlyphMarginLane2.Center;
const zIndex = (_c2 = d.options.zIndex) !== null && _c2 !== void 0 ? _c2 : 0;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const modelPosition = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(lineNumber, 0));
const laneIndex = this._context.viewModel.glyphLanes.getLanesAtLine(modelPosition.lineNumber).indexOf(lane);
requests.push(new DecorationBasedGlyphRenderRequest(lineNumber, laneIndex, zIndex, glyphMarginClassName));
}
}
}
_collectWidgetBasedGlyphRenderRequest(ctx, requests) {
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
for (const widget of Object.values(this._widgets)) {
const range2 = widget.preference.range;
const { startLineNumber, endLineNumber } = this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(Range.lift(range2));
if (!startLineNumber || !endLineNumber || endLineNumber < visibleStartLineNumber || startLineNumber > visibleEndLineNumber) {
continue;
}
const widgetLineNumber = Math.max(startLineNumber, visibleStartLineNumber);
const modelPosition = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(widgetLineNumber, 0));
const laneIndex = this._context.viewModel.glyphLanes.getLanesAtLine(modelPosition.lineNumber).indexOf(widget.preference.lane);
requests.push(new WidgetBasedGlyphRenderRequest(widgetLineNumber, laneIndex, widget.preference.zIndex, widget));
}
}
_collectSortedGlyphRenderRequests(ctx) {
const requests = [];
this._collectDecorationBasedGlyphRenderRequest(ctx, requests);
this._collectWidgetBasedGlyphRenderRequest(ctx, requests);
requests.sort((a3, b) => {
if (a3.lineNumber === b.lineNumber) {
if (a3.laneIndex === b.laneIndex) {
if (a3.zIndex === b.zIndex) {
if (b.type === a3.type) {
if (a3.type === 0 && b.type === 0) {
return a3.className < b.className ? -1 : 1;
}
return 0;
}
return b.type - a3.type;
}
return b.zIndex - a3.zIndex;
}
return a3.laneIndex - b.laneIndex;
}
return a3.lineNumber - b.lineNumber;
});
return requests;
}
/**
* Will store render information in each widget's renderInfo and in `_decorationGlyphsToRender`.
*/
prepareRender(ctx) {
if (!this._glyphMargin) {
this._decorationGlyphsToRender = [];
return;
}
for (const widget of Object.values(this._widgets)) {
widget.renderInfo = null;
}
const requests = new ArrayQueue(this._collectSortedGlyphRenderRequests(ctx));
const decorationGlyphsToRender = [];
while (requests.length > 0) {
const first2 = requests.peek();
if (!first2) {
break;
}
const requestsAtLocation = requests.takeWhile((el) => el.lineNumber === first2.lineNumber && el.laneIndex === first2.laneIndex);
if (!requestsAtLocation || requestsAtLocation.length === 0) {
break;
}
const winner = requestsAtLocation[0];
if (winner.type === 0) {
const classNames = [];
for (const request of requestsAtLocation) {
if (request.zIndex !== winner.zIndex || request.type !== winner.type) {
break;
}
if (classNames.length === 0 || classNames[classNames.length - 1] !== request.className) {
classNames.push(request.className);
}
}
decorationGlyphsToRender.push(winner.accept(classNames.join(" ")));
} else {
winner.widget.renderInfo = {
lineNumber: winner.lineNumber,
laneIndex: winner.laneIndex
};
}
}
this._decorationGlyphsToRender = decorationGlyphsToRender;
}
render(ctx) {
if (!this._glyphMargin) {
for (const widget of Object.values(this._widgets)) {
widget.domNode.setDisplay("none");
}
while (this._managedDomNodes.length > 0) {
const domNode = this._managedDomNodes.pop();
domNode === null || domNode === void 0 ? void 0 : domNode.domNode.remove();
}
return;
}
const width2 = Math.round(this._glyphMarginWidth / this._glyphMarginDecorationLaneCount);
for (const widget of Object.values(this._widgets)) {
if (!widget.renderInfo) {
widget.domNode.setDisplay("none");
} else {
const top = ctx.viewportData.relativeVerticalOffset[widget.renderInfo.lineNumber - ctx.viewportData.startLineNumber];
const left = this._glyphMarginLeft + widget.renderInfo.laneIndex * this._lineHeight;
widget.domNode.setDisplay("block");
widget.domNode.setTop(top);
widget.domNode.setLeft(left);
widget.domNode.setWidth(width2);
widget.domNode.setHeight(this._lineHeight);
}
}
for (let i = 0; i < this._decorationGlyphsToRender.length; i++) {
const dec = this._decorationGlyphsToRender[i];
const top = ctx.viewportData.relativeVerticalOffset[dec.lineNumber - ctx.viewportData.startLineNumber];
const left = this._glyphMarginLeft + dec.laneIndex * this._lineHeight;
let domNode;
if (i < this._managedDomNodes.length) {
domNode = this._managedDomNodes[i];
} else {
domNode = createFastDomNode(document.createElement("div"));
this._managedDomNodes.push(domNode);
this.domNode.appendChild(domNode);
}
domNode.setClassName(`cgmr codicon ` + dec.combinedClassName);
domNode.setPosition(`absolute`);
domNode.setTop(top);
domNode.setLeft(left);
domNode.setWidth(width2);
domNode.setHeight(this._lineHeight);
}
while (this._managedDomNodes.length > this._decorationGlyphsToRender.length) {
const domNode = this._managedDomNodes.pop();
domNode === null || domNode === void 0 ? void 0 : domNode.domNode.remove();
}
}
};
DecorationBasedGlyphRenderRequest = class {
constructor(lineNumber, laneIndex, zIndex, className) {
this.lineNumber = lineNumber;
this.laneIndex = laneIndex;
this.zIndex = zIndex;
this.className = className;
this.type = 0;
}
accept(combinedClassName) {
return new DecorationBasedGlyph(this.lineNumber, this.laneIndex, combinedClassName);
}
};
WidgetBasedGlyphRenderRequest = class {
constructor(lineNumber, laneIndex, zIndex, widget) {
this.lineNumber = lineNumber;
this.laneIndex = laneIndex;
this.zIndex = zIndex;
this.widget = widget;
this.type = 1;
}
};
DecorationBasedGlyph = class {
constructor(lineNumber, laneIndex, combinedClassName) {
this.lineNumber = lineNumber;
this.laneIndex = laneIndex;
this.combinedClassName = combinedClassName;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.css
var init_indentGuides = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/textModelPart.js
var TextModelPart;
var init_textModelPart = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/textModelPart.js"() {
init_lifecycle();
TextModelPart = class extends Disposable {
constructor() {
super(...arguments);
this._isDisposed = false;
}
dispose() {
super.dispose();
this._isDisposed = true;
}
assertNotDisposed() {
if (this._isDisposed) {
throw new Error("TextModelPart is disposed!");
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/utils.js
function computeIndentLevel(line, tabSize) {
let indent = 0;
let i = 0;
const len = line.length;
while (i < len) {
const chCode = line.charCodeAt(i);
if (chCode === 32) {
indent++;
} else if (chCode === 9) {
indent = indent - indent % tabSize + tabSize;
} else {
break;
}
i++;
}
if (i === len) {
return -1;
}
return indent;
}
var init_utils2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/utils.js"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/textModelGuides.js
var HorizontalGuidesState, IndentGuide, IndentGuideHorizontalLine;
var init_textModelGuides = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/textModelGuides.js"() {
(function(HorizontalGuidesState2) {
HorizontalGuidesState2[HorizontalGuidesState2["Disabled"] = 0] = "Disabled";
HorizontalGuidesState2[HorizontalGuidesState2["EnabledForActive"] = 1] = "EnabledForActive";
HorizontalGuidesState2[HorizontalGuidesState2["Enabled"] = 2] = "Enabled";
})(HorizontalGuidesState || (HorizontalGuidesState = {}));
IndentGuide = class {
constructor(visibleColumn, column, className, horizontalLine, forWrappedLinesAfterColumn, forWrappedLinesBeforeOrAtColumn) {
this.visibleColumn = visibleColumn;
this.column = column;
this.className = className;
this.horizontalLine = horizontalLine;
this.forWrappedLinesAfterColumn = forWrappedLinesAfterColumn;
this.forWrappedLinesBeforeOrAtColumn = forWrappedLinesBeforeOrAtColumn;
if (visibleColumn !== -1 === (column !== -1)) {
throw new Error();
}
}
};
IndentGuideHorizontalLine = class {
constructor(top, endColumn) {
this.top = top;
this.endColumn = endColumn;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/guidesTextModelPart.js
var GuidesTextModelPart, BracketPairGuidesClassNames;
var init_guidesTextModelPart = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/guidesTextModelPart.js"() {
init_arraysFind();
init_strings();
init_cursorColumns();
init_range();
init_textModelPart();
init_utils2();
init_textModelGuides();
init_errors();
GuidesTextModelPart = class extends TextModelPart {
constructor(textModel, languageConfigurationService) {
super();
this.textModel = textModel;
this.languageConfigurationService = languageConfigurationService;
}
getLanguageConfiguration(languageId) {
return this.languageConfigurationService.getLanguageConfiguration(languageId);
}
_computeIndentLevel(lineIndex) {
return computeIndentLevel(this.textModel.getLineContent(lineIndex + 1), this.textModel.getOptions().tabSize);
}
getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber) {
this.assertNotDisposed();
const lineCount = this.textModel.getLineCount();
if (lineNumber < 1 || lineNumber > lineCount) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
const foldingRules = this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules;
const offSide = Boolean(foldingRules && foldingRules.offSide);
let up_aboveContentLineIndex = -2;
let up_aboveContentLineIndent = -1;
let up_belowContentLineIndex = -2;
let up_belowContentLineIndent = -1;
const up_resolveIndents = (lineNumber2) => {
if (up_aboveContentLineIndex !== -1 && (up_aboveContentLineIndex === -2 || up_aboveContentLineIndex > lineNumber2 - 1)) {
up_aboveContentLineIndex = -1;
up_aboveContentLineIndent = -1;
for (let lineIndex = lineNumber2 - 2; lineIndex >= 0; lineIndex--) {
const indent2 = this._computeIndentLevel(lineIndex);
if (indent2 >= 0) {
up_aboveContentLineIndex = lineIndex;
up_aboveContentLineIndent = indent2;
break;
}
}
}
if (up_belowContentLineIndex === -2) {
up_belowContentLineIndex = -1;
up_belowContentLineIndent = -1;
for (let lineIndex = lineNumber2; lineIndex < lineCount; lineIndex++) {
const indent2 = this._computeIndentLevel(lineIndex);
if (indent2 >= 0) {
up_belowContentLineIndex = lineIndex;
up_belowContentLineIndent = indent2;
break;
}
}
}
};
let down_aboveContentLineIndex = -2;
let down_aboveContentLineIndent = -1;
let down_belowContentLineIndex = -2;
let down_belowContentLineIndent = -1;
const down_resolveIndents = (lineNumber2) => {
if (down_aboveContentLineIndex === -2) {
down_aboveContentLineIndex = -1;
down_aboveContentLineIndent = -1;
for (let lineIndex = lineNumber2 - 2; lineIndex >= 0; lineIndex--) {
const indent2 = this._computeIndentLevel(lineIndex);
if (indent2 >= 0) {
down_aboveContentLineIndex = lineIndex;
down_aboveContentLineIndent = indent2;
break;
}
}
}
if (down_belowContentLineIndex !== -1 && (down_belowContentLineIndex === -2 || down_belowContentLineIndex < lineNumber2 - 1)) {
down_belowContentLineIndex = -1;
down_belowContentLineIndent = -1;
for (let lineIndex = lineNumber2; lineIndex < lineCount; lineIndex++) {
const indent2 = this._computeIndentLevel(lineIndex);
if (indent2 >= 0) {
down_belowContentLineIndex = lineIndex;
down_belowContentLineIndent = indent2;
break;
}
}
}
};
let startLineNumber = 0;
let goUp = true;
let endLineNumber = 0;
let goDown = true;
let indent = 0;
let initialIndent = 0;
for (let distance = 0; goUp || goDown; distance++) {
const upLineNumber = lineNumber - distance;
const downLineNumber = lineNumber + distance;
if (distance > 1 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {
goUp = false;
}
if (distance > 1 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) {
goDown = false;
}
if (distance > 5e4) {
goUp = false;
goDown = false;
}
let upLineIndentLevel = -1;
if (goUp && upLineNumber >= 1) {
const currentIndent = this._computeIndentLevel(upLineNumber - 1);
if (currentIndent >= 0) {
up_belowContentLineIndex = upLineNumber - 1;
up_belowContentLineIndent = currentIndent;
upLineIndentLevel = Math.ceil(currentIndent / this.textModel.getOptions().indentSize);
} else {
up_resolveIndents(upLineNumber);
upLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, up_aboveContentLineIndent, up_belowContentLineIndent);
}
}
let downLineIndentLevel = -1;
if (goDown && downLineNumber <= lineCount) {
const currentIndent = this._computeIndentLevel(downLineNumber - 1);
if (currentIndent >= 0) {
down_aboveContentLineIndex = downLineNumber - 1;
down_aboveContentLineIndent = currentIndent;
downLineIndentLevel = Math.ceil(currentIndent / this.textModel.getOptions().indentSize);
} else {
down_resolveIndents(downLineNumber);
downLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, down_aboveContentLineIndent, down_belowContentLineIndent);
}
}
if (distance === 0) {
initialIndent = upLineIndentLevel;
continue;
}
if (distance === 1) {
if (downLineNumber <= lineCount && downLineIndentLevel >= 0 && initialIndent + 1 === downLineIndentLevel) {
goUp = false;
startLineNumber = downLineNumber;
endLineNumber = downLineNumber;
indent = downLineIndentLevel;
continue;
}
if (upLineNumber >= 1 && upLineIndentLevel >= 0 && upLineIndentLevel - 1 === initialIndent) {
goDown = false;
startLineNumber = upLineNumber;
endLineNumber = upLineNumber;
indent = upLineIndentLevel;
continue;
}
startLineNumber = lineNumber;
endLineNumber = lineNumber;
indent = initialIndent;
if (indent === 0) {
return { startLineNumber, endLineNumber, indent };
}
}
if (goUp) {
if (upLineIndentLevel >= indent) {
startLineNumber = upLineNumber;
} else {
goUp = false;
}
}
if (goDown) {
if (downLineIndentLevel >= indent) {
endLineNumber = downLineNumber;
} else {
goDown = false;
}
}
}
return { startLineNumber, endLineNumber, indent };
}
getLinesBracketGuides(startLineNumber, endLineNumber, activePosition, options2) {
var _a10;
const result = [];
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
result.push([]);
}
const includeSingleLinePairs = true;
const bracketPairs = this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new Range(startLineNumber, 1, endLineNumber, this.textModel.getLineMaxColumn(endLineNumber))).toArray();
let activeBracketPairRange = void 0;
if (activePosition && bracketPairs.length > 0) {
const bracketsContainingActivePosition = (startLineNumber <= activePosition.lineNumber && activePosition.lineNumber <= endLineNumber ? bracketPairs : this.textModel.bracketPairs.getBracketPairsInRange(Range.fromPositions(activePosition)).toArray()).filter((bp) => Range.strictContainsPosition(bp.range, activePosition));
activeBracketPairRange = (_a10 = findLast(bracketsContainingActivePosition, (i) => includeSingleLinePairs || i.range.startLineNumber !== i.range.endLineNumber)) === null || _a10 === void 0 ? void 0 : _a10.range;
}
const independentColorPoolPerBracketType = this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType;
const colorProvider = new BracketPairGuidesClassNames();
for (const pair of bracketPairs) {
if (!pair.closingBracketRange) {
continue;
}
const isActive = activeBracketPairRange && pair.range.equalsRange(activeBracketPairRange);
if (!isActive && !options2.includeInactive) {
continue;
}
const className = colorProvider.getInlineClassName(pair.nestingLevel, pair.nestingLevelOfEqualBracketType, independentColorPoolPerBracketType) + (options2.highlightActive && isActive ? " " + colorProvider.activeClassName : "");
const start = pair.openingBracketRange.getStartPosition();
const end = pair.closingBracketRange.getStartPosition();
const horizontalGuides = options2.horizontalGuides === HorizontalGuidesState.Enabled || options2.horizontalGuides === HorizontalGuidesState.EnabledForActive && isActive;
if (pair.range.startLineNumber === pair.range.endLineNumber) {
if (includeSingleLinePairs && horizontalGuides) {
result[pair.range.startLineNumber - startLineNumber].push(new IndentGuide(-1, pair.openingBracketRange.getEndPosition().column, className, new IndentGuideHorizontalLine(false, end.column), -1, -1));
}
continue;
}
const endVisibleColumn = this.getVisibleColumnFromPosition(end);
const startVisibleColumn = this.getVisibleColumnFromPosition(pair.openingBracketRange.getStartPosition());
const guideVisibleColumn = Math.min(startVisibleColumn, endVisibleColumn, pair.minVisibleColumnIndentation + 1);
let renderHorizontalEndLineAtTheBottom = false;
const firstNonWsIndex = firstNonWhitespaceIndex(this.textModel.getLineContent(pair.closingBracketRange.startLineNumber));
const hasTextBeforeClosingBracket = firstNonWsIndex < pair.closingBracketRange.startColumn - 1;
if (hasTextBeforeClosingBracket) {
renderHorizontalEndLineAtTheBottom = true;
}
const visibleGuideStartLineNumber = Math.max(start.lineNumber, startLineNumber);
const visibleGuideEndLineNumber = Math.min(end.lineNumber, endLineNumber);
const offset = renderHorizontalEndLineAtTheBottom ? 1 : 0;
for (let l = visibleGuideStartLineNumber; l < visibleGuideEndLineNumber + offset; l++) {
result[l - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, null, l === start.lineNumber ? start.column : -1, l === end.lineNumber ? end.column : -1));
}
if (horizontalGuides) {
if (start.lineNumber >= startLineNumber && startVisibleColumn > guideVisibleColumn) {
result[start.lineNumber - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, new IndentGuideHorizontalLine(false, start.column), -1, -1));
}
if (end.lineNumber <= endLineNumber && endVisibleColumn > guideVisibleColumn) {
result[end.lineNumber - startLineNumber].push(new IndentGuide(guideVisibleColumn, -1, className, new IndentGuideHorizontalLine(!renderHorizontalEndLineAtTheBottom, end.column), -1, -1));
}
}
}
for (const guides of result) {
guides.sort((a3, b) => a3.visibleColumn - b.visibleColumn);
}
return result;
}
getVisibleColumnFromPosition(position) {
return CursorColumns.visibleColumnFromColumn(this.textModel.getLineContent(position.lineNumber), position.column, this.textModel.getOptions().tabSize) + 1;
}
getLinesIndentGuides(startLineNumber, endLineNumber) {
this.assertNotDisposed();
const lineCount = this.textModel.getLineCount();
if (startLineNumber < 1 || startLineNumber > lineCount) {
throw new Error("Illegal value for startLineNumber");
}
if (endLineNumber < 1 || endLineNumber > lineCount) {
throw new Error("Illegal value for endLineNumber");
}
const options2 = this.textModel.getOptions();
const foldingRules = this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules;
const offSide = Boolean(foldingRules && foldingRules.offSide);
const result = new Array(endLineNumber - startLineNumber + 1);
let aboveContentLineIndex = -2;
let aboveContentLineIndent = -1;
let belowContentLineIndex = -2;
let belowContentLineIndent = -1;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const resultIndex = lineNumber - startLineNumber;
const currentIndent = this._computeIndentLevel(lineNumber - 1);
if (currentIndent >= 0) {
aboveContentLineIndex = lineNumber - 1;
aboveContentLineIndent = currentIndent;
result[resultIndex] = Math.ceil(currentIndent / options2.indentSize);
continue;
}
if (aboveContentLineIndex === -2) {
aboveContentLineIndex = -1;
aboveContentLineIndent = -1;
for (let lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
const indent = this._computeIndentLevel(lineIndex);
if (indent >= 0) {
aboveContentLineIndex = lineIndex;
aboveContentLineIndent = indent;
break;
}
}
}
if (belowContentLineIndex !== -1 && (belowContentLineIndex === -2 || belowContentLineIndex < lineNumber - 1)) {
belowContentLineIndex = -1;
belowContentLineIndent = -1;
for (let lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
const indent = this._computeIndentLevel(lineIndex);
if (indent >= 0) {
belowContentLineIndex = lineIndex;
belowContentLineIndent = indent;
break;
}
}
}
result[resultIndex] = this._getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent);
}
return result;
}
_getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent) {
const options2 = this.textModel.getOptions();
if (aboveContentLineIndent === -1 || belowContentLineIndent === -1) {
return 0;
} else if (aboveContentLineIndent < belowContentLineIndent) {
return 1 + Math.floor(aboveContentLineIndent / options2.indentSize);
} else if (aboveContentLineIndent === belowContentLineIndent) {
return Math.ceil(belowContentLineIndent / options2.indentSize);
} else {
if (offSide) {
return Math.ceil(belowContentLineIndent / options2.indentSize);
} else {
return 1 + Math.floor(belowContentLineIndent / options2.indentSize);
}
}
}
};
BracketPairGuidesClassNames = class {
constructor() {
this.activeClassName = "indent-active";
}
getInlineClassName(nestingLevel, nestingLevelOfEqualBracketType, independentColorPoolPerBracketType) {
return this.getInlineClassNameOfLevel(independentColorPoolPerBracketType ? nestingLevelOfEqualBracketType : nestingLevel);
}
getInlineClassNameOfLevel(level) {
return `bracket-indent-guide lvl-${level % 30}`;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js
function transparentToUndefined(color) {
if (color && color.isTransparent()) {
return void 0;
}
return color;
}
var IndentGuidesOverlay;
var init_indentGuides2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js"() {
init_indentGuides();
init_dynamicViewOverlay();
init_editorColorRegistry();
init_themeService();
init_position();
init_arrays();
init_types();
init_guidesTextModelPart();
init_textModelGuides();
IndentGuidesOverlay = class extends DynamicViewOverlay {
constructor(context) {
super();
this._context = context;
this._primaryPosition = null;
const options2 = this._context.configuration.options;
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._spaceWidth = fontInfo.spaceWidth;
this._maxIndentLeft = wrappingInfo.wrappingColumn === -1 ? -1 : wrappingInfo.wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth;
this._bracketPairGuideOptions = options2.get(
16
/* EditorOption.guides */
);
this._renderResult = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._spaceWidth = fontInfo.spaceWidth;
this._maxIndentLeft = wrappingInfo.wrappingColumn === -1 ? -1 : wrappingInfo.wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth;
this._bracketPairGuideOptions = options2.get(
16
/* EditorOption.guides */
);
return true;
}
onCursorStateChanged(e) {
var _a10;
const selection = e.selections[0];
const newPosition = selection.getPosition();
if (!((_a10 = this._primaryPosition) === null || _a10 === void 0 ? void 0 : _a10.equals(newPosition))) {
this._primaryPosition = newPosition;
return true;
}
return false;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
onLanguageConfigurationChanged(e) {
return true;
}
// --- end event handlers
prepareRender(ctx) {
var _a10, _b4, _c2, _d2;
if (!this._bracketPairGuideOptions.indentation && this._bracketPairGuideOptions.bracketPairs === false) {
this._renderResult = null;
return;
}
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const scrollWidth = ctx.scrollWidth;
const activeCursorPosition = this._primaryPosition;
const indents = this.getGuidesByLine(visibleStartLineNumber, Math.min(visibleEndLineNumber + 1, this._context.viewModel.getLineCount()), activeCursorPosition);
const output = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
const indent = indents[lineIndex];
let result = "";
const leftOffset = (_b4 = (_a10 = ctx.visibleRangeForPosition(new Position(lineNumber, 1))) === null || _a10 === void 0 ? void 0 : _a10.left) !== null && _b4 !== void 0 ? _b4 : 0;
for (const guide of indent) {
const left = guide.column === -1 ? leftOffset + (guide.visibleColumn - 1) * this._spaceWidth : ctx.visibleRangeForPosition(new Position(lineNumber, guide.column)).left;
if (left > scrollWidth || this._maxIndentLeft > 0 && left > this._maxIndentLeft) {
break;
}
const className = guide.horizontalLine ? guide.horizontalLine.top ? "horizontal-top" : "horizontal-bottom" : "vertical";
const width2 = guide.horizontalLine ? ((_d2 = (_c2 = ctx.visibleRangeForPosition(new Position(lineNumber, guide.horizontalLine.endColumn))) === null || _c2 === void 0 ? void 0 : _c2.left) !== null && _d2 !== void 0 ? _d2 : left + this._spaceWidth) - left : this._spaceWidth;
result += ``;
}
output[lineIndex] = result;
}
this._renderResult = output;
}
getGuidesByLine(visibleStartLineNumber, visibleEndLineNumber, activeCursorPosition) {
const bracketGuides = this._bracketPairGuideOptions.bracketPairs !== false ? this._context.viewModel.getBracketGuidesInRangeByLine(visibleStartLineNumber, visibleEndLineNumber, activeCursorPosition, {
highlightActive: this._bracketPairGuideOptions.highlightActiveBracketPair,
horizontalGuides: this._bracketPairGuideOptions.bracketPairsHorizontal === true ? HorizontalGuidesState.Enabled : this._bracketPairGuideOptions.bracketPairsHorizontal === "active" ? HorizontalGuidesState.EnabledForActive : HorizontalGuidesState.Disabled,
includeInactive: this._bracketPairGuideOptions.bracketPairs === true
}) : null;
const indentGuides = this._bracketPairGuideOptions.indentation ? this._context.viewModel.getLinesIndentGuides(visibleStartLineNumber, visibleEndLineNumber) : null;
let activeIndentStartLineNumber = 0;
let activeIndentEndLineNumber = 0;
let activeIndentLevel = 0;
if (this._bracketPairGuideOptions.highlightActiveIndentation !== false && activeCursorPosition) {
const activeIndentInfo = this._context.viewModel.getActiveIndentGuide(activeCursorPosition.lineNumber, visibleStartLineNumber, visibleEndLineNumber);
activeIndentStartLineNumber = activeIndentInfo.startLineNumber;
activeIndentEndLineNumber = activeIndentInfo.endLineNumber;
activeIndentLevel = activeIndentInfo.indent;
}
const { indentSize } = this._context.viewModel.model.getOptions();
const result = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineGuides = new Array();
result.push(lineGuides);
const bracketGuidesInLine = bracketGuides ? bracketGuides[lineNumber - visibleStartLineNumber] : [];
const bracketGuidesInLineQueue = new ArrayQueue(bracketGuidesInLine);
const indentGuidesInLine = indentGuides ? indentGuides[lineNumber - visibleStartLineNumber] : 0;
for (let indentLvl = 1; indentLvl <= indentGuidesInLine; indentLvl++) {
const indentGuide = (indentLvl - 1) * indentSize + 1;
const isActive = (
// Disable active indent guide if there are bracket guides.
(this._bracketPairGuideOptions.highlightActiveIndentation === "always" || bracketGuidesInLine.length === 0) && activeIndentStartLineNumber <= lineNumber && lineNumber <= activeIndentEndLineNumber && indentLvl === activeIndentLevel
);
lineGuides.push(...bracketGuidesInLineQueue.takeWhile((g) => g.visibleColumn < indentGuide) || []);
const peeked = bracketGuidesInLineQueue.peek();
if (!peeked || peeked.visibleColumn !== indentGuide || peeked.horizontalLine) {
lineGuides.push(new IndentGuide(indentGuide, -1, `core-guide-indent lvl-${(indentLvl - 1) % 30}` + (isActive ? " indent-active" : ""), null, -1, -1));
}
}
lineGuides.push(...bracketGuidesInLineQueue.takeWhile((g) => true) || []);
}
return result;
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return "";
}
return this._renderResult[lineIndex];
}
};
registerThemingParticipant((theme, collector) => {
const colors2 = [
{ bracketColor: editorBracketHighlightingForeground1, guideColor: editorBracketPairGuideBackground1, guideColorActive: editorBracketPairGuideActiveBackground1 },
{ bracketColor: editorBracketHighlightingForeground2, guideColor: editorBracketPairGuideBackground2, guideColorActive: editorBracketPairGuideActiveBackground2 },
{ bracketColor: editorBracketHighlightingForeground3, guideColor: editorBracketPairGuideBackground3, guideColorActive: editorBracketPairGuideActiveBackground3 },
{ bracketColor: editorBracketHighlightingForeground4, guideColor: editorBracketPairGuideBackground4, guideColorActive: editorBracketPairGuideActiveBackground4 },
{ bracketColor: editorBracketHighlightingForeground5, guideColor: editorBracketPairGuideBackground5, guideColorActive: editorBracketPairGuideActiveBackground5 },
{ bracketColor: editorBracketHighlightingForeground6, guideColor: editorBracketPairGuideBackground6, guideColorActive: editorBracketPairGuideActiveBackground6 }
];
const colorProvider = new BracketPairGuidesClassNames();
const indentColors = [
{ indentColor: editorIndentGuide1, indentColorActive: editorActiveIndentGuide1 },
{ indentColor: editorIndentGuide2, indentColorActive: editorActiveIndentGuide2 },
{ indentColor: editorIndentGuide3, indentColorActive: editorActiveIndentGuide3 },
{ indentColor: editorIndentGuide4, indentColorActive: editorActiveIndentGuide4 },
{ indentColor: editorIndentGuide5, indentColorActive: editorActiveIndentGuide5 },
{ indentColor: editorIndentGuide6, indentColorActive: editorActiveIndentGuide6 }
];
const colorValues = colors2.map((c) => {
var _a10, _b4;
const bracketColor = theme.getColor(c.bracketColor);
const guideColor = theme.getColor(c.guideColor);
const guideColorActive = theme.getColor(c.guideColorActive);
const effectiveGuideColor = transparentToUndefined((_a10 = transparentToUndefined(guideColor)) !== null && _a10 !== void 0 ? _a10 : bracketColor === null || bracketColor === void 0 ? void 0 : bracketColor.transparent(0.3));
const effectiveGuideColorActive = transparentToUndefined((_b4 = transparentToUndefined(guideColorActive)) !== null && _b4 !== void 0 ? _b4 : bracketColor);
if (!effectiveGuideColor || !effectiveGuideColorActive) {
return void 0;
}
return {
guideColor: effectiveGuideColor,
guideColorActive: effectiveGuideColorActive
};
}).filter(isDefined);
const indentColorValues = indentColors.map((c) => {
const indentColor = theme.getColor(c.indentColor);
const indentColorActive = theme.getColor(c.indentColorActive);
const effectiveIndentColor = transparentToUndefined(indentColor);
const effectiveIndentColorActive = transparentToUndefined(indentColorActive);
if (!effectiveIndentColor || !effectiveIndentColorActive) {
return void 0;
}
return {
indentColor: effectiveIndentColor,
indentColorActive: effectiveIndentColorActive
};
}).filter(isDefined);
if (colorValues.length > 0) {
for (let level = 0; level < 30; level++) {
const colors3 = colorValues[level % colorValues.length];
collector.addRule(`.monaco-editor .${colorProvider.getInlineClassNameOfLevel(level).replace(/ /g, ".")} { --guide-color: ${colors3.guideColor}; --guide-color-active: ${colors3.guideColorActive}; }`);
}
collector.addRule(`.monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }`);
collector.addRule(`.monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }`);
collector.addRule(`.monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }`);
collector.addRule(`.monaco-editor .vertical.${colorProvider.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`);
collector.addRule(`.monaco-editor .horizontal-top.${colorProvider.activeClassName} { border-top: 1px solid var(--guide-color-active); }`);
collector.addRule(`.monaco-editor .horizontal-bottom.${colorProvider.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`);
}
if (indentColorValues.length > 0) {
for (let level = 0; level < 30; level++) {
const colors3 = indentColorValues[level % indentColorValues.length];
collector.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${level} { --indent-color: ${colors3.indentColor}; --indent-color-active: ${colors3.indentColorActive}; }`);
}
collector.addRule(`.monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }`);
collector.addRule(`.monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.css
var init_viewLines = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/domReadingContext.js
var DomReadingContext;
var init_domReadingContext = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/domReadingContext.js"() {
DomReadingContext = class {
get didDomLayout() {
return this._didDomLayout;
}
readClientRect() {
if (!this._clientRectRead) {
this._clientRectRead = true;
const rect = this._domNode.getBoundingClientRect();
this.markDidDomLayout();
this._clientRectDeltaLeft = rect.left;
this._clientRectScale = rect.width / this._domNode.offsetWidth;
}
}
get clientRectDeltaLeft() {
if (!this._clientRectRead) {
this.readClientRect();
}
return this._clientRectDeltaLeft;
}
get clientRectScale() {
if (!this._clientRectRead) {
this.readClientRect();
}
return this._clientRectScale;
}
constructor(_domNode, endNode) {
this._domNode = _domNode;
this.endNode = endNode;
this._didDomLayout = false;
this._clientRectDeltaLeft = 0;
this._clientRectScale = 1;
this._clientRectRead = false;
}
markDidDomLayout() {
this._didDomLayout = true;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.js
var LastRenderedData, HorizontalRevealRangeRequest, HorizontalRevealSelectionsRequest, ViewLines;
var init_viewLines2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.js"() {
init_mouseCursor2();
init_async();
init_platform();
init_viewLines();
init_domFontInfo();
init_renderingContext();
init_viewLayer();
init_viewPart();
init_domReadingContext();
init_viewLine();
init_position();
init_range();
LastRenderedData = class {
constructor() {
this._currentVisibleRange = new Range(1, 1, 1, 1);
}
getCurrentVisibleRange() {
return this._currentVisibleRange;
}
setCurrentVisibleRange(currentVisibleRange) {
this._currentVisibleRange = currentVisibleRange;
}
};
HorizontalRevealRangeRequest = class {
constructor(minimalReveal, lineNumber, startColumn, endColumn, startScrollTop, stopScrollTop, scrollType) {
this.minimalReveal = minimalReveal;
this.lineNumber = lineNumber;
this.startColumn = startColumn;
this.endColumn = endColumn;
this.startScrollTop = startScrollTop;
this.stopScrollTop = stopScrollTop;
this.scrollType = scrollType;
this.type = "range";
this.minLineNumber = lineNumber;
this.maxLineNumber = lineNumber;
}
};
HorizontalRevealSelectionsRequest = class {
constructor(minimalReveal, selections, startScrollTop, stopScrollTop, scrollType) {
this.minimalReveal = minimalReveal;
this.selections = selections;
this.startScrollTop = startScrollTop;
this.stopScrollTop = stopScrollTop;
this.scrollType = scrollType;
this.type = "selections";
let minLineNumber = selections[0].startLineNumber;
let maxLineNumber = selections[0].endLineNumber;
for (let i = 1, len = selections.length; i < len; i++) {
const selection = selections[i];
minLineNumber = Math.min(minLineNumber, selection.startLineNumber);
maxLineNumber = Math.max(maxLineNumber, selection.endLineNumber);
}
this.minLineNumber = minLineNumber;
this.maxLineNumber = maxLineNumber;
}
};
ViewLines = class _ViewLines extends ViewPart {
constructor(context, linesContent) {
super(context);
this._linesContent = linesContent;
this._textRangeRestingSpot = document.createElement("div");
this._visibleLines = new VisibleLinesCollection(this);
this.domNode = this._visibleLines.domNode;
const conf81 = this._context.configuration;
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._isViewportWrapping = wrappingInfo.isViewportWrapping;
this._revealHorizontalRightPadding = options2.get(
100
/* EditorOption.revealHorizontalRightPadding */
);
this._cursorSurroundingLines = options2.get(
29
/* EditorOption.cursorSurroundingLines */
);
this._cursorSurroundingLinesStyle = options2.get(
30
/* EditorOption.cursorSurroundingLinesStyle */
);
this._canUseLayerHinting = !options2.get(
32
/* EditorOption.disableLayerHinting */
);
this._viewLineOptions = new ViewLineOptions(conf81, this._context.theme.type);
PartFingerprints.write(
this.domNode,
8
/* PartFingerprint.ViewLines */
);
this.domNode.setClassName(`view-lines ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`);
applyFontInfo(this.domNode, fontInfo);
this._maxLineWidth = 0;
this._asyncUpdateLineWidths = new RunOnceScheduler(() => {
this._updateLineWidthsSlow();
}, 200);
this._asyncCheckMonospaceFontAssumptions = new RunOnceScheduler(() => {
this._checkMonospaceFontAssumptions();
}, 2e3);
this._lastRenderedData = new LastRenderedData();
this._horizontalRevealRequest = null;
this._stickyScrollEnabled = options2.get(
115
/* EditorOption.stickyScroll */
).enabled;
this._maxNumberStickyLines = options2.get(
115
/* EditorOption.stickyScroll */
).maxLineCount;
}
dispose() {
this._asyncUpdateLineWidths.dispose();
this._asyncCheckMonospaceFontAssumptions.dispose();
super.dispose();
}
getDomNode() {
return this.domNode;
}
// ---- begin IVisibleLinesHost
createVisibleLine() {
return new ViewLine(this._viewLineOptions);
}
// ---- end IVisibleLinesHost
// ---- begin view event handlers
onConfigurationChanged(e) {
this._visibleLines.onConfigurationChanged(e);
if (e.hasChanged(
146
/* EditorOption.wrappingInfo */
)) {
this._maxLineWidth = 0;
}
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._isViewportWrapping = wrappingInfo.isViewportWrapping;
this._revealHorizontalRightPadding = options2.get(
100
/* EditorOption.revealHorizontalRightPadding */
);
this._cursorSurroundingLines = options2.get(
29
/* EditorOption.cursorSurroundingLines */
);
this._cursorSurroundingLinesStyle = options2.get(
30
/* EditorOption.cursorSurroundingLinesStyle */
);
this._canUseLayerHinting = !options2.get(
32
/* EditorOption.disableLayerHinting */
);
this._stickyScrollEnabled = options2.get(
115
/* EditorOption.stickyScroll */
).enabled;
this._maxNumberStickyLines = options2.get(
115
/* EditorOption.stickyScroll */
).maxLineCount;
applyFontInfo(this.domNode, fontInfo);
this._onOptionsMaybeChanged();
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
this._maxLineWidth = 0;
}
return true;
}
_onOptionsMaybeChanged() {
const conf81 = this._context.configuration;
const newViewLineOptions = new ViewLineOptions(conf81, this._context.theme.type);
if (!this._viewLineOptions.equals(newViewLineOptions)) {
this._viewLineOptions = newViewLineOptions;
const startLineNumber = this._visibleLines.getStartLineNumber();
const endLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const line = this._visibleLines.getVisibleLine(lineNumber);
line.onOptionsChanged(this._viewLineOptions);
}
return true;
}
return false;
}
onCursorStateChanged(e) {
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
let r = false;
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
r = this._visibleLines.getVisibleLine(lineNumber).onSelectionChanged() || r;
}
return r;
}
onDecorationsChanged(e) {
if (true) {
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
this._visibleLines.getVisibleLine(lineNumber).onDecorationsChanged();
}
}
return true;
}
onFlushed(e) {
const shouldRender = this._visibleLines.onFlushed(e);
this._maxLineWidth = 0;
return shouldRender;
}
onLinesChanged(e) {
return this._visibleLines.onLinesChanged(e);
}
onLinesDeleted(e) {
return this._visibleLines.onLinesDeleted(e);
}
onLinesInserted(e) {
return this._visibleLines.onLinesInserted(e);
}
onRevealRangeRequest(e) {
const desiredScrollTop = this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(), e.source, e.minimalReveal, e.range, e.selections, e.verticalType);
if (desiredScrollTop === -1) {
return false;
}
let newScrollPosition = this._context.viewLayout.validateScrollPosition({ scrollTop: desiredScrollTop });
if (e.revealHorizontal) {
if (e.range && e.range.startLineNumber !== e.range.endLineNumber) {
newScrollPosition = {
scrollTop: newScrollPosition.scrollTop,
scrollLeft: 0
};
} else if (e.range) {
this._horizontalRevealRequest = new HorizontalRevealRangeRequest(e.minimalReveal, e.range.startLineNumber, e.range.startColumn, e.range.endColumn, this._context.viewLayout.getCurrentScrollTop(), newScrollPosition.scrollTop, e.scrollType);
} else if (e.selections && e.selections.length > 0) {
this._horizontalRevealRequest = new HorizontalRevealSelectionsRequest(e.minimalReveal, e.selections, this._context.viewLayout.getCurrentScrollTop(), newScrollPosition.scrollTop, e.scrollType);
}
} else {
this._horizontalRevealRequest = null;
}
const scrollTopDelta = Math.abs(this._context.viewLayout.getCurrentScrollTop() - newScrollPosition.scrollTop);
const scrollType = scrollTopDelta <= this._lineHeight ? 1 : e.scrollType;
this._context.viewModel.viewLayout.setScrollPosition(newScrollPosition, scrollType);
return true;
}
onScrollChanged(e) {
if (this._horizontalRevealRequest && e.scrollLeftChanged) {
this._horizontalRevealRequest = null;
}
if (this._horizontalRevealRequest && e.scrollTopChanged) {
const min = Math.min(this._horizontalRevealRequest.startScrollTop, this._horizontalRevealRequest.stopScrollTop);
const max = Math.max(this._horizontalRevealRequest.startScrollTop, this._horizontalRevealRequest.stopScrollTop);
if (e.scrollTop < min || e.scrollTop > max) {
this._horizontalRevealRequest = null;
}
}
this.domNode.setWidth(e.scrollWidth);
return this._visibleLines.onScrollChanged(e) || true;
}
onTokensChanged(e) {
return this._visibleLines.onTokensChanged(e);
}
onZonesChanged(e) {
this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth);
return this._visibleLines.onZonesChanged(e);
}
onThemeChanged(e) {
return this._onOptionsMaybeChanged();
}
// ---- end view event handlers
// ----------- HELPERS FOR OTHERS
getPositionFromDOMInfo(spanNode, offset) {
const viewLineDomNode = this._getViewLineDomNode(spanNode);
if (viewLineDomNode === null) {
return null;
}
const lineNumber = this._getLineNumberFor(viewLineDomNode);
if (lineNumber === -1) {
return null;
}
if (lineNumber < 1 || lineNumber > this._context.viewModel.getLineCount()) {
return null;
}
if (this._context.viewModel.getLineMaxColumn(lineNumber) === 1) {
return new Position(lineNumber, 1);
}
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
return null;
}
let column = this._visibleLines.getVisibleLine(lineNumber).getColumnOfNodeOffset(spanNode, offset);
const minColumn = this._context.viewModel.getLineMinColumn(lineNumber);
if (column < minColumn) {
column = minColumn;
}
return new Position(lineNumber, column);
}
_getViewLineDomNode(node) {
while (node && node.nodeType === 1) {
if (node.className === ViewLine.CLASS_NAME) {
return node;
}
node = node.parentElement;
}
return null;
}
/**
* @returns the line number of this view line dom node.
*/
_getLineNumberFor(domNode) {
const startLineNumber = this._visibleLines.getStartLineNumber();
const endLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const line = this._visibleLines.getVisibleLine(lineNumber);
if (domNode === line.getDomNode()) {
return lineNumber;
}
}
return -1;
}
getLineWidth(lineNumber) {
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
return -1;
}
const context = new DomReadingContext(this.domNode.domNode, this._textRangeRestingSpot);
const result = this._visibleLines.getVisibleLine(lineNumber).getWidth(context);
this._updateLineWidthsSlowIfDomDidLayout(context);
return result;
}
linesVisibleRangesForRange(_range, includeNewLines) {
if (this.shouldRender()) {
return null;
}
const originalEndLineNumber = _range.endLineNumber;
const range2 = Range.intersectRanges(_range, this._lastRenderedData.getCurrentVisibleRange());
if (!range2) {
return null;
}
const visibleRanges = [];
let visibleRangesLen = 0;
const domReadingContext = new DomReadingContext(this.domNode.domNode, this._textRangeRestingSpot);
let nextLineModelLineNumber = 0;
if (includeNewLines) {
nextLineModelLineNumber = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(range2.startLineNumber, 1)).lineNumber;
}
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = range2.startLineNumber; lineNumber <= range2.endLineNumber; lineNumber++) {
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
continue;
}
const startColumn = lineNumber === range2.startLineNumber ? range2.startColumn : 1;
const continuesInNextLine = lineNumber !== range2.endLineNumber;
const endColumn = continuesInNextLine ? this._context.viewModel.getLineMaxColumn(lineNumber) : range2.endColumn;
const visibleRangesForLine = this._visibleLines.getVisibleLine(lineNumber).getVisibleRangesForRange(lineNumber, startColumn, endColumn, domReadingContext);
if (!visibleRangesForLine) {
continue;
}
if (includeNewLines && lineNumber < originalEndLineNumber) {
const currentLineModelLineNumber = nextLineModelLineNumber;
nextLineModelLineNumber = this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(lineNumber + 1, 1)).lineNumber;
if (currentLineModelLineNumber !== nextLineModelLineNumber) {
visibleRangesForLine.ranges[visibleRangesForLine.ranges.length - 1].width += this._typicalHalfwidthCharacterWidth;
}
}
visibleRanges[visibleRangesLen++] = new LineVisibleRanges(visibleRangesForLine.outsideRenderedLine, lineNumber, HorizontalRange.from(visibleRangesForLine.ranges), continuesInNextLine);
}
this._updateLineWidthsSlowIfDomDidLayout(domReadingContext);
if (visibleRangesLen === 0) {
return null;
}
return visibleRanges;
}
_visibleRangesForLineRange(lineNumber, startColumn, endColumn) {
if (this.shouldRender()) {
return null;
}
if (lineNumber < this._visibleLines.getStartLineNumber() || lineNumber > this._visibleLines.getEndLineNumber()) {
return null;
}
const domReadingContext = new DomReadingContext(this.domNode.domNode, this._textRangeRestingSpot);
const result = this._visibleLines.getVisibleLine(lineNumber).getVisibleRangesForRange(lineNumber, startColumn, endColumn, domReadingContext);
this._updateLineWidthsSlowIfDomDidLayout(domReadingContext);
return result;
}
visibleRangeForPosition(position) {
const visibleRanges = this._visibleRangesForLineRange(position.lineNumber, position.column, position.column);
if (!visibleRanges) {
return null;
}
return new HorizontalPosition(visibleRanges.outsideRenderedLine, visibleRanges.ranges[0].left);
}
/**
* Updates the max line width if it is fast to compute.
* Returns true if all lines were taken into account.
* Returns false if some lines need to be reevaluated (in a slow fashion).
*/
_updateLineWidthsFast() {
return this._updateLineWidths(true);
}
_updateLineWidthsSlow() {
this._updateLineWidths(false);
}
/**
* Update the line widths using DOM layout information after someone else
* has caused a synchronous layout.
*/
_updateLineWidthsSlowIfDomDidLayout(domReadingContext) {
if (!domReadingContext.didDomLayout) {
return;
}
if (this._asyncUpdateLineWidths.isScheduled()) {
return;
}
this._asyncUpdateLineWidths.cancel();
this._updateLineWidthsSlow();
}
_updateLineWidths(fast) {
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
let localMaxLineWidth = 1;
let allWidthsComputed = true;
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
const visibleLine = this._visibleLines.getVisibleLine(lineNumber);
if (fast && !visibleLine.getWidthIsFast()) {
allWidthsComputed = false;
continue;
}
localMaxLineWidth = Math.max(localMaxLineWidth, visibleLine.getWidth(null));
}
if (allWidthsComputed && rendStartLineNumber === 1 && rendEndLineNumber === this._context.viewModel.getLineCount()) {
this._maxLineWidth = 0;
}
this._ensureMaxLineWidth(localMaxLineWidth);
return allWidthsComputed;
}
_checkMonospaceFontAssumptions() {
let longestLineNumber = -1;
let longestWidth = -1;
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
const visibleLine = this._visibleLines.getVisibleLine(lineNumber);
if (visibleLine.needsMonospaceFontCheck()) {
const lineWidth = visibleLine.getWidth(null);
if (lineWidth > longestWidth) {
longestWidth = lineWidth;
longestLineNumber = lineNumber;
}
}
}
if (longestLineNumber === -1) {
return;
}
if (!this._visibleLines.getVisibleLine(longestLineNumber).monospaceAssumptionsAreValid()) {
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
const visibleLine = this._visibleLines.getVisibleLine(lineNumber);
visibleLine.onMonospaceAssumptionsInvalidated();
}
}
}
prepareRender() {
throw new Error("Not supported");
}
render() {
throw new Error("Not supported");
}
renderText(viewportData) {
this._visibleLines.renderLines(viewportData);
this._lastRenderedData.setCurrentVisibleRange(viewportData.visibleRange);
this.domNode.setWidth(this._context.viewLayout.getScrollWidth());
this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(), 1e6));
if (this._horizontalRevealRequest) {
const horizontalRevealRequest = this._horizontalRevealRequest;
if (viewportData.startLineNumber <= horizontalRevealRequest.minLineNumber && horizontalRevealRequest.maxLineNumber <= viewportData.endLineNumber) {
this._horizontalRevealRequest = null;
this.onDidRender();
const newScrollLeft = this._computeScrollLeftToReveal(horizontalRevealRequest);
if (newScrollLeft) {
if (!this._isViewportWrapping) {
this._ensureMaxLineWidth(newScrollLeft.maxHorizontalOffset);
}
this._context.viewModel.viewLayout.setScrollPosition({
scrollLeft: newScrollLeft.scrollLeft
}, horizontalRevealRequest.scrollType);
}
}
}
if (!this._updateLineWidthsFast()) {
this._asyncUpdateLineWidths.schedule();
} else {
this._asyncUpdateLineWidths.cancel();
}
if (isLinux && !this._asyncCheckMonospaceFontAssumptions.isScheduled()) {
const rendStartLineNumber = this._visibleLines.getStartLineNumber();
const rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
const visibleLine = this._visibleLines.getVisibleLine(lineNumber);
if (visibleLine.needsMonospaceFontCheck()) {
this._asyncCheckMonospaceFontAssumptions.schedule();
break;
}
}
}
this._linesContent.setLayerHinting(this._canUseLayerHinting);
this._linesContent.setContain("strict");
const adjustedScrollTop = this._context.viewLayout.getCurrentScrollTop() - viewportData.bigNumbersDelta;
this._linesContent.setTop(-adjustedScrollTop);
this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft());
}
// --- width
_ensureMaxLineWidth(lineWidth) {
const iLineWidth = Math.ceil(lineWidth);
if (this._maxLineWidth < iLineWidth) {
this._maxLineWidth = iLineWidth;
this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth);
}
}
_computeScrollTopToRevealRange(viewport, source, minimalReveal, range2, selections, verticalType) {
const viewportStartY = viewport.top;
const viewportHeight = viewport.height;
const viewportEndY = viewportStartY + viewportHeight;
let boxIsSingleRange;
let boxStartY;
let boxEndY;
if (selections && selections.length > 0) {
let minLineNumber = selections[0].startLineNumber;
let maxLineNumber = selections[0].endLineNumber;
for (let i = 1, len = selections.length; i < len; i++) {
const selection = selections[i];
minLineNumber = Math.min(minLineNumber, selection.startLineNumber);
maxLineNumber = Math.max(maxLineNumber, selection.endLineNumber);
}
boxIsSingleRange = false;
boxStartY = this._context.viewLayout.getVerticalOffsetForLineNumber(minLineNumber);
boxEndY = this._context.viewLayout.getVerticalOffsetForLineNumber(maxLineNumber) + this._lineHeight;
} else if (range2) {
boxIsSingleRange = true;
boxStartY = this._context.viewLayout.getVerticalOffsetForLineNumber(range2.startLineNumber);
boxEndY = this._context.viewLayout.getVerticalOffsetForLineNumber(range2.endLineNumber) + this._lineHeight;
} else {
return -1;
}
const shouldIgnoreScrollOff = (source === "mouse" || minimalReveal) && this._cursorSurroundingLinesStyle === "default";
let paddingTop = 0;
let paddingBottom = 0;
if (!shouldIgnoreScrollOff) {
const context = Math.min(viewportHeight / this._lineHeight / 2, this._cursorSurroundingLines);
if (this._stickyScrollEnabled) {
paddingTop = Math.max(context, this._maxNumberStickyLines) * this._lineHeight;
} else {
paddingTop = context * this._lineHeight;
}
paddingBottom = Math.max(0, context - 1) * this._lineHeight;
} else {
if (!minimalReveal) {
paddingTop = this._lineHeight;
}
}
if (!minimalReveal) {
if (verticalType === 0 || verticalType === 4) {
paddingBottom += this._lineHeight;
}
}
boxStartY -= paddingTop;
boxEndY += paddingBottom;
let newScrollTop;
if (boxEndY - boxStartY > viewportHeight) {
if (!boxIsSingleRange) {
return -1;
}
newScrollTop = boxStartY;
} else if (verticalType === 5 || verticalType === 6) {
if (verticalType === 6 && viewportStartY <= boxStartY && boxEndY <= viewportEndY) {
newScrollTop = viewportStartY;
} else {
const desiredGapAbove = Math.max(5 * this._lineHeight, viewportHeight * 0.2);
const desiredScrollTop = boxStartY - desiredGapAbove;
const minScrollTop = boxEndY - viewportHeight;
newScrollTop = Math.max(minScrollTop, desiredScrollTop);
}
} else if (verticalType === 1 || verticalType === 2) {
if (verticalType === 2 && viewportStartY <= boxStartY && boxEndY <= viewportEndY) {
newScrollTop = viewportStartY;
} else {
const boxMiddleY = (boxStartY + boxEndY) / 2;
newScrollTop = Math.max(0, boxMiddleY - viewportHeight / 2);
}
} else {
newScrollTop = this._computeMinimumScrolling(
viewportStartY,
viewportEndY,
boxStartY,
boxEndY,
verticalType === 3,
verticalType === 4
/* viewEvents.VerticalRevealType.Bottom */
);
}
return newScrollTop;
}
_computeScrollLeftToReveal(horizontalRevealRequest) {
const viewport = this._context.viewLayout.getCurrentViewport();
const layoutInfo = this._context.configuration.options.get(
145
/* EditorOption.layoutInfo */
);
const viewportStartX = viewport.left;
const viewportEndX = viewportStartX + viewport.width - layoutInfo.verticalScrollbarWidth;
let boxStartX = 1073741824;
let boxEndX = 0;
if (horizontalRevealRequest.type === "range") {
const visibleRanges = this._visibleRangesForLineRange(horizontalRevealRequest.lineNumber, horizontalRevealRequest.startColumn, horizontalRevealRequest.endColumn);
if (!visibleRanges) {
return null;
}
for (const visibleRange of visibleRanges.ranges) {
boxStartX = Math.min(boxStartX, Math.round(visibleRange.left));
boxEndX = Math.max(boxEndX, Math.round(visibleRange.left + visibleRange.width));
}
} else {
for (const selection of horizontalRevealRequest.selections) {
if (selection.startLineNumber !== selection.endLineNumber) {
return null;
}
const visibleRanges = this._visibleRangesForLineRange(selection.startLineNumber, selection.startColumn, selection.endColumn);
if (!visibleRanges) {
return null;
}
for (const visibleRange of visibleRanges.ranges) {
boxStartX = Math.min(boxStartX, Math.round(visibleRange.left));
boxEndX = Math.max(boxEndX, Math.round(visibleRange.left + visibleRange.width));
}
}
}
if (!horizontalRevealRequest.minimalReveal) {
boxStartX = Math.max(0, boxStartX - _ViewLines.HORIZONTAL_EXTRA_PX);
boxEndX += this._revealHorizontalRightPadding;
}
if (horizontalRevealRequest.type === "selections" && boxEndX - boxStartX > viewport.width) {
return null;
}
const newScrollLeft = this._computeMinimumScrolling(viewportStartX, viewportEndX, boxStartX, boxEndX);
return {
scrollLeft: newScrollLeft,
maxHorizontalOffset: boxEndX
};
}
_computeMinimumScrolling(viewportStart, viewportEnd, boxStart, boxEnd, revealAtStart, revealAtEnd) {
viewportStart = viewportStart | 0;
viewportEnd = viewportEnd | 0;
boxStart = boxStart | 0;
boxEnd = boxEnd | 0;
revealAtStart = !!revealAtStart;
revealAtEnd = !!revealAtEnd;
const viewportLength = viewportEnd - viewportStart;
const boxLength = boxEnd - boxStart;
if (boxLength < viewportLength) {
if (revealAtStart) {
return boxStart;
}
if (revealAtEnd) {
return Math.max(0, boxEnd - viewportLength);
}
if (boxStart < viewportStart) {
return boxStart;
} else if (boxEnd > viewportEnd) {
return Math.max(0, boxEnd - viewportLength);
}
} else {
return boxStart;
}
return viewportStart;
}
};
ViewLines.HORIZONTAL_EXTRA_PX = 30;
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.css
var init_linesDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js
var LinesDecorationsOverlay;
var init_linesDecorations2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js"() {
init_linesDecorations();
init_glyphMargin2();
LinesDecorationsOverlay = class extends DedupOverlay {
constructor(context) {
super();
this._context = context;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._decorationsLeft = layoutInfo.decorationsLeft;
this._decorationsWidth = layoutInfo.decorationsWidth;
this._renderResult = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._decorationsLeft = layoutInfo.decorationsLeft;
this._decorationsWidth = layoutInfo.decorationsWidth;
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
_getDecorations(ctx) {
var _a10, _b4;
const decorations = ctx.getDecorationsInViewport();
const r = [];
let rLen = 0;
for (let i = 0, len = decorations.length; i < len; i++) {
const d = decorations[i];
const linesDecorationsClassName = d.options.linesDecorationsClassName;
const zIndex = d.options.zIndex;
if (linesDecorationsClassName) {
r[rLen++] = new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, linesDecorationsClassName, (_a10 = d.options.linesDecorationsTooltip) !== null && _a10 !== void 0 ? _a10 : null, zIndex);
}
const firstLineDecorationClassName = d.options.firstLineDecorationClassName;
if (firstLineDecorationClassName) {
r[rLen++] = new DecorationToRender(d.range.startLineNumber, d.range.startLineNumber, firstLineDecorationClassName, (_b4 = d.options.linesDecorationsTooltip) !== null && _b4 !== void 0 ? _b4 : null, zIndex);
}
}
return r;
}
prepareRender(ctx) {
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const toRender = this._render(visibleStartLineNumber, visibleEndLineNumber, this._getDecorations(ctx));
const left = this._decorationsLeft.toString();
const width2 = this._decorationsWidth.toString();
const common = '" style="left:' + left + "px;width:" + width2 + 'px;">';
const output = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
const decorations = toRender[lineIndex].getDecorations();
let lineOutput = "";
for (const decoration3 of decorations) {
let addition = '';
}
output[lineIndex] = lineOutput;
}
this._renderResult = output;
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
return this._renderResult[lineNumber - startLineNumber];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.css
var init_minimap = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/rgba.js
var RGBA8;
var init_rgba = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/rgba.js"() {
RGBA8 = class _RGBA8 {
constructor(r, g, b, a3) {
this._rgba8Brand = void 0;
this.r = _RGBA8._clamp(r);
this.g = _RGBA8._clamp(g);
this.b = _RGBA8._clamp(b);
this.a = _RGBA8._clamp(a3);
}
equals(other) {
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
}
static _clamp(c) {
if (c < 0) {
return 0;
}
if (c > 255) {
return 255;
}
return c | 0;
}
};
RGBA8.Empty = new RGBA8(0, 0, 0, 0);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js
var MinimapTokensColorTracker;
var init_minimapTokensColorTracker = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js"() {
init_event();
init_lifecycle();
init_rgba();
init_languages();
MinimapTokensColorTracker = class _MinimapTokensColorTracker extends Disposable {
static getInstance() {
if (!this._INSTANCE) {
this._INSTANCE = markAsSingleton(new _MinimapTokensColorTracker());
}
return this._INSTANCE;
}
constructor() {
super();
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
this._updateColorMap();
this._register(TokenizationRegistry2.onDidChange((e) => {
if (e.changedColorMap) {
this._updateColorMap();
}
}));
}
_updateColorMap() {
const colorMap = TokenizationRegistry2.getColorMap();
if (!colorMap) {
this._colors = [RGBA8.Empty];
this._backgroundIsLight = true;
return;
}
this._colors = [RGBA8.Empty];
for (let colorId = 1; colorId < colorMap.length; colorId++) {
const source = colorMap[colorId].rgba;
this._colors[colorId] = new RGBA8(source.r, source.g, source.b, Math.round(source.a * 255));
}
const backgroundLuminosity = colorMap[
2
/* ColorId.DefaultBackground */
].getRelativeLuminance();
this._backgroundIsLight = backgroundLuminosity >= 0.5;
this._onDidChange.fire(void 0);
}
getColor(colorId) {
if (colorId < 1 || colorId >= this._colors.length) {
colorId = 2;
}
return this._colors[colorId];
}
backgroundIsLight() {
return this._backgroundIsLight;
}
};
MinimapTokensColorTracker._INSTANCE = null;
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js
var allCharCodes, getCharIndex;
var init_minimapCharSheet = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js"() {
allCharCodes = (() => {
const v = [];
for (let i = 32; i <= 126; i++) {
v.push(i);
}
v.push(
65533
/* Constants.UNKNOWN_CODE */
);
return v;
})();
getCharIndex = (chCode, fontScale) => {
chCode -= 32;
if (chCode < 0 || chCode > 96) {
if (fontScale <= 2) {
return (chCode + 96) % 96;
}
return 96 - 1;
}
return chCode;
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js
var MinimapCharRenderer;
var init_minimapCharRenderer = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js"() {
init_minimapCharSheet();
init_uint();
MinimapCharRenderer = class _MinimapCharRenderer {
constructor(charData, scale) {
this.scale = scale;
this._minimapCharRendererBrand = void 0;
this.charDataNormal = _MinimapCharRenderer.soften(charData, 12 / 15);
this.charDataLight = _MinimapCharRenderer.soften(charData, 50 / 60);
}
static soften(input, ratio) {
const result = new Uint8ClampedArray(input.length);
for (let i = 0, len = input.length; i < len; i++) {
result[i] = toUint8(input[i] * ratio);
}
return result;
}
renderChar(target, dx, dy, chCode, color, foregroundAlpha, backgroundColor, backgroundAlpha, fontScale, useLighterFont, force1pxHeight) {
const charWidth = 1 * this.scale;
const charHeight = 2 * this.scale;
const renderHeight = force1pxHeight ? 1 : charHeight;
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
console.warn("bad render request outside image data");
return;
}
const charData = useLighterFont ? this.charDataLight : this.charDataNormal;
const charIndex = getCharIndex(chCode, fontScale);
const destWidth = target.width * 4;
const backgroundR = backgroundColor.r;
const backgroundG = backgroundColor.g;
const backgroundB = backgroundColor.b;
const deltaR = color.r - backgroundR;
const deltaG = color.g - backgroundG;
const deltaB = color.b - backgroundB;
const destAlpha = Math.max(foregroundAlpha, backgroundAlpha);
const dest = target.data;
let sourceOffset = charIndex * charWidth * charHeight;
let row = dy * destWidth + dx * 4;
for (let y = 0; y < renderHeight; y++) {
let column = row;
for (let x = 0; x < charWidth; x++) {
const c = charData[sourceOffset++] / 255 * (foregroundAlpha / 255);
dest[column++] = backgroundR + deltaR * c;
dest[column++] = backgroundG + deltaG * c;
dest[column++] = backgroundB + deltaB * c;
dest[column++] = destAlpha;
}
row += destWidth;
}
}
blockRenderChar(target, dx, dy, color, foregroundAlpha, backgroundColor, backgroundAlpha, force1pxHeight) {
const charWidth = 1 * this.scale;
const charHeight = 2 * this.scale;
const renderHeight = force1pxHeight ? 1 : charHeight;
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
console.warn("bad render request outside image data");
return;
}
const destWidth = target.width * 4;
const c = 0.5 * (foregroundAlpha / 255);
const backgroundR = backgroundColor.r;
const backgroundG = backgroundColor.g;
const backgroundB = backgroundColor.b;
const deltaR = color.r - backgroundR;
const deltaG = color.g - backgroundG;
const deltaB = color.b - backgroundB;
const colorR = backgroundR + deltaR * c;
const colorG = backgroundG + deltaG * c;
const colorB = backgroundB + deltaB * c;
const destAlpha = Math.max(foregroundAlpha, backgroundAlpha);
const dest = target.data;
let row = dy * destWidth + dx * 4;
for (let y = 0; y < renderHeight; y++) {
let column = row;
for (let x = 0; x < charWidth; x++) {
dest[column++] = colorR;
dest[column++] = colorG;
dest[column++] = colorB;
dest[column++] = destAlpha;
}
row += destWidth;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js
var charTable, decodeData, prebakedMiniMaps;
var init_minimapPreBaked = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js"() {
init_functional();
charTable = {
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
A: 10,
B: 11,
C: 12,
D: 13,
E: 14,
F: 15
};
decodeData = (str) => {
const output = new Uint8ClampedArray(str.length / 2);
for (let i = 0; i < str.length; i += 2) {
output[i >> 1] = charTable[str[i]] << 4 | charTable[str[i + 1]] & 15;
}
return output;
};
prebakedMiniMaps = {
1: createSingleCallFunction(() => decodeData("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),
2: createSingleCallFunction(() => decodeData("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js
var MinimapCharRendererFactory;
var init_minimapCharRendererFactory = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js"() {
init_minimapCharRenderer();
init_minimapCharSheet();
init_minimapPreBaked();
init_uint();
MinimapCharRendererFactory = class _MinimapCharRendererFactory {
/**
* Creates a new character renderer factory with the given scale.
*/
static create(scale, fontFamily) {
if (this.lastCreated && scale === this.lastCreated.scale && fontFamily === this.lastFontFamily) {
return this.lastCreated;
}
let factory;
if (prebakedMiniMaps[scale]) {
factory = new MinimapCharRenderer(prebakedMiniMaps[scale](), scale);
} else {
factory = _MinimapCharRendererFactory.createFromSampleData(_MinimapCharRendererFactory.createSampleData(fontFamily).data, scale);
}
this.lastFontFamily = fontFamily;
this.lastCreated = factory;
return factory;
}
/**
* Creates the font sample data, writing to a canvas.
*/
static createSampleData(fontFamily) {
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
canvas.style.height = `${16}px`;
canvas.height = 16;
canvas.width = 96 * 10;
canvas.style.width = 96 * 10 + "px";
ctx.fillStyle = "#ffffff";
ctx.font = `bold ${16}px ${fontFamily}`;
ctx.textBaseline = "middle";
let x = 0;
for (const code of allCharCodes) {
ctx.fillText(String.fromCharCode(code), x, 16 / 2);
x += 10;
}
return ctx.getImageData(
0,
0,
96 * 10,
16
/* Constants.SAMPLED_CHAR_HEIGHT */
);
}
/**
* Creates a character renderer from the canvas sample data.
*/
static createFromSampleData(source, scale) {
const expectedLength = 16 * 10 * 4 * 96;
if (source.length !== expectedLength) {
throw new Error("Unexpected source in MinimapCharRenderer");
}
const charData = _MinimapCharRendererFactory._downsample(source, scale);
return new MinimapCharRenderer(charData, scale);
}
static _downsampleChar(source, sourceOffset, dest, destOffset, scale) {
const width2 = 1 * scale;
const height = 2 * scale;
let targetIndex = destOffset;
let brightest = 0;
for (let y = 0; y < height; y++) {
const sourceY1 = y / height * 16;
const sourceY2 = (y + 1) / height * 16;
for (let x = 0; x < width2; x++) {
const sourceX1 = x / width2 * 10;
const sourceX2 = (x + 1) / width2 * 10;
let value = 0;
let samples = 0;
for (let sy = sourceY1; sy < sourceY2; sy++) {
const sourceRow = sourceOffset + Math.floor(sy) * 3840;
const yBalance = 1 - (sy - Math.floor(sy));
for (let sx = sourceX1; sx < sourceX2; sx++) {
const xBalance = 1 - (sx - Math.floor(sx));
const sourceIndex = sourceRow + Math.floor(sx) * 4;
const weight5 = xBalance * yBalance;
samples += weight5;
value += source[sourceIndex] * source[sourceIndex + 3] / 255 * weight5;
}
}
const final = value / samples;
brightest = Math.max(brightest, final);
dest[targetIndex++] = toUint8(final);
}
}
return brightest;
}
static _downsample(data, scale) {
const pixelsPerCharacter = 2 * scale * 1 * scale;
const resultLen = pixelsPerCharacter * 96;
const result = new Uint8ClampedArray(resultLen);
let resultOffset = 0;
let sourceOffset = 0;
let brightest = 0;
for (let charIndex = 0; charIndex < 96; charIndex++) {
brightest = Math.max(brightest, this._downsampleChar(data, sourceOffset, result, resultOffset, scale));
resultOffset += pixelsPerCharacter;
sourceOffset += 10 * 4;
}
if (brightest > 0) {
const adjust = 255 / brightest;
for (let i = 0; i < resultLen; i++) {
result[i] *= adjust;
}
}
return result;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/fonts.js
var DEFAULT_FONT_FAMILY;
var init_fonts = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/fonts.js"() {
init_platform();
DEFAULT_FONT_FAMILY = isWindows ? '"Segoe WPC", "Segoe UI", sans-serif' : isMacintosh ? "-apple-system, BlinkMacSystemFont, sans-serif" : 'system-ui, "Ubuntu", "Droid Sans", sans-serif';
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.js
var POINTER_DRAG_RESET_DISTANCE2, GUTTER_DECORATION_WIDTH, MinimapOptions, MinimapLayout, MinimapLine, RenderData, MinimapBuffers, MinimapSamplingState, Minimap, InnerMinimap, ContiguousLineMap;
var init_minimap2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.js"() {
init_minimap();
init_dom();
init_fastDomNode();
init_globalPointerMoveMonitor();
init_lifecycle();
init_platform();
init_strings();
init_viewLayer();
init_viewPart();
init_editorOptions();
init_range();
init_rgba();
init_minimapTokensColorTracker();
init_viewModel();
init_colorRegistry();
init_selection();
init_touch();
init_minimapCharRendererFactory();
init_functional();
init_map();
init_fonts();
POINTER_DRAG_RESET_DISTANCE2 = 140;
GUTTER_DECORATION_WIDTH = 2;
MinimapOptions = class _MinimapOptions {
constructor(configuration, theme, tokensColorTracker) {
const options2 = configuration.options;
const pixelRatio = options2.get(
143
/* EditorOption.pixelRatio */
);
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const minimapLayout = layoutInfo.minimap;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const minimapOpts = options2.get(
73
/* EditorOption.minimap */
);
this.renderMinimap = minimapLayout.renderMinimap;
this.size = minimapOpts.size;
this.minimapHeightIsEditorHeight = minimapLayout.minimapHeightIsEditorHeight;
this.scrollBeyondLastLine = options2.get(
105
/* EditorOption.scrollBeyondLastLine */
);
this.paddingTop = options2.get(
84
/* EditorOption.padding */
).top;
this.paddingBottom = options2.get(
84
/* EditorOption.padding */
).bottom;
this.showSlider = minimapOpts.showSlider;
this.autohide = minimapOpts.autohide;
this.pixelRatio = pixelRatio;
this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this.lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this.minimapLeft = minimapLayout.minimapLeft;
this.minimapWidth = minimapLayout.minimapWidth;
this.minimapHeight = layoutInfo.height;
this.canvasInnerWidth = minimapLayout.minimapCanvasInnerWidth;
this.canvasInnerHeight = minimapLayout.minimapCanvasInnerHeight;
this.canvasOuterWidth = minimapLayout.minimapCanvasOuterWidth;
this.canvasOuterHeight = minimapLayout.minimapCanvasOuterHeight;
this.isSampling = minimapLayout.minimapIsSampling;
this.editorHeight = layoutInfo.height;
this.fontScale = minimapLayout.minimapScale;
this.minimapLineHeight = minimapLayout.minimapLineHeight;
this.minimapCharWidth = 1 * this.fontScale;
this.sectionHeaderFontFamily = DEFAULT_FONT_FAMILY;
this.sectionHeaderFontSize = minimapOpts.sectionHeaderFontSize * pixelRatio;
this.sectionHeaderLetterSpacing = minimapOpts.sectionHeaderLetterSpacing;
this.sectionHeaderFontColor = _MinimapOptions._getSectionHeaderColor(theme, tokensColorTracker.getColor(
1
/* ColorId.DefaultForeground */
));
this.charRenderer = createSingleCallFunction(() => MinimapCharRendererFactory.create(this.fontScale, fontInfo.fontFamily));
this.defaultBackgroundColor = tokensColorTracker.getColor(
2
/* ColorId.DefaultBackground */
);
this.backgroundColor = _MinimapOptions._getMinimapBackground(theme, this.defaultBackgroundColor);
this.foregroundAlpha = _MinimapOptions._getMinimapForegroundOpacity(theme);
}
static _getMinimapBackground(theme, defaultBackgroundColor) {
const themeColor = theme.getColor(minimapBackground);
if (themeColor) {
return new RGBA8(themeColor.rgba.r, themeColor.rgba.g, themeColor.rgba.b, Math.round(255 * themeColor.rgba.a));
}
return defaultBackgroundColor;
}
static _getMinimapForegroundOpacity(theme) {
const themeColor = theme.getColor(minimapForegroundOpacity);
if (themeColor) {
return RGBA8._clamp(Math.round(255 * themeColor.rgba.a));
}
return 255;
}
static _getSectionHeaderColor(theme, defaultForegroundColor) {
const themeColor = theme.getColor(editorForeground);
if (themeColor) {
return new RGBA8(themeColor.rgba.r, themeColor.rgba.g, themeColor.rgba.b, Math.round(255 * themeColor.rgba.a));
}
return defaultForegroundColor;
}
equals(other) {
return this.renderMinimap === other.renderMinimap && this.size === other.size && this.minimapHeightIsEditorHeight === other.minimapHeightIsEditorHeight && this.scrollBeyondLastLine === other.scrollBeyondLastLine && this.paddingTop === other.paddingTop && this.paddingBottom === other.paddingBottom && this.showSlider === other.showSlider && this.autohide === other.autohide && this.pixelRatio === other.pixelRatio && this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth && this.lineHeight === other.lineHeight && this.minimapLeft === other.minimapLeft && this.minimapWidth === other.minimapWidth && this.minimapHeight === other.minimapHeight && this.canvasInnerWidth === other.canvasInnerWidth && this.canvasInnerHeight === other.canvasInnerHeight && this.canvasOuterWidth === other.canvasOuterWidth && this.canvasOuterHeight === other.canvasOuterHeight && this.isSampling === other.isSampling && this.editorHeight === other.editorHeight && this.fontScale === other.fontScale && this.minimapLineHeight === other.minimapLineHeight && this.minimapCharWidth === other.minimapCharWidth && this.sectionHeaderFontSize === other.sectionHeaderFontSize && this.sectionHeaderLetterSpacing === other.sectionHeaderLetterSpacing && this.defaultBackgroundColor && this.defaultBackgroundColor.equals(other.defaultBackgroundColor) && this.backgroundColor && this.backgroundColor.equals(other.backgroundColor) && this.foregroundAlpha === other.foregroundAlpha;
}
};
MinimapLayout = class _MinimapLayout {
constructor(scrollTop, scrollHeight, sliderNeeded, _computedSliderRatio, sliderTop, sliderHeight, topPaddingLineCount, startLineNumber, endLineNumber) {
this.scrollTop = scrollTop;
this.scrollHeight = scrollHeight;
this.sliderNeeded = sliderNeeded;
this._computedSliderRatio = _computedSliderRatio;
this.sliderTop = sliderTop;
this.sliderHeight = sliderHeight;
this.topPaddingLineCount = topPaddingLineCount;
this.startLineNumber = startLineNumber;
this.endLineNumber = endLineNumber;
}
/**
* Compute a desired `scrollPosition` such that the slider moves by `delta`.
*/
getDesiredScrollTopFromDelta(delta) {
return Math.round(this.scrollTop + delta / this._computedSliderRatio);
}
getDesiredScrollTopFromTouchLocation(pageY) {
return Math.round((pageY - this.sliderHeight / 2) / this._computedSliderRatio);
}
/**
* Intersect a line range with `this.startLineNumber` and `this.endLineNumber`.
*/
intersectWithViewport(range2) {
const startLineNumber = Math.max(this.startLineNumber, range2.startLineNumber);
const endLineNumber = Math.min(this.endLineNumber, range2.endLineNumber);
if (startLineNumber > endLineNumber) {
return null;
}
return [startLineNumber, endLineNumber];
}
/**
* Get the inner minimap y coordinate for a line number.
*/
getYForLineNumber(lineNumber, minimapLineHeight) {
return +(lineNumber - this.startLineNumber + this.topPaddingLineCount) * minimapLineHeight;
}
static create(options2, viewportStartLineNumber, viewportEndLineNumber, viewportStartLineNumberVerticalOffset, viewportHeight, viewportContainsWhitespaceGaps, lineCount, realLineCount, scrollTop, scrollHeight, previousLayout) {
const pixelRatio = options2.pixelRatio;
const minimapLineHeight = options2.minimapLineHeight;
const minimapLinesFitting = Math.floor(options2.canvasInnerHeight / minimapLineHeight);
const lineHeight = options2.lineHeight;
if (options2.minimapHeightIsEditorHeight) {
let logicalScrollHeight = realLineCount * options2.lineHeight + options2.paddingTop + options2.paddingBottom;
if (options2.scrollBeyondLastLine) {
logicalScrollHeight += Math.max(0, viewportHeight - options2.lineHeight - options2.paddingBottom);
}
const sliderHeight2 = Math.max(1, Math.floor(viewportHeight * viewportHeight / logicalScrollHeight));
const maxMinimapSliderTop2 = Math.max(0, options2.minimapHeight - sliderHeight2);
const computedSliderRatio2 = maxMinimapSliderTop2 / (scrollHeight - viewportHeight);
const sliderTop2 = scrollTop * computedSliderRatio2;
const sliderNeeded = maxMinimapSliderTop2 > 0;
const maxLinesFitting = Math.floor(options2.canvasInnerHeight / options2.minimapLineHeight);
const topPaddingLineCount = Math.floor(options2.paddingTop / options2.lineHeight);
return new _MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio2, sliderTop2, sliderHeight2, topPaddingLineCount, 1, Math.min(lineCount, maxLinesFitting));
}
let sliderHeight;
if (viewportContainsWhitespaceGaps && viewportEndLineNumber !== lineCount) {
const viewportLineCount = viewportEndLineNumber - viewportStartLineNumber + 1;
sliderHeight = Math.floor(viewportLineCount * minimapLineHeight / pixelRatio);
} else {
const expectedViewportLineCount = viewportHeight / lineHeight;
sliderHeight = Math.floor(expectedViewportLineCount * minimapLineHeight / pixelRatio);
}
const extraLinesAtTheTop = Math.floor(options2.paddingTop / lineHeight);
let extraLinesAtTheBottom = Math.floor(options2.paddingBottom / lineHeight);
if (options2.scrollBeyondLastLine) {
const expectedViewportLineCount = viewportHeight / lineHeight;
extraLinesAtTheBottom = Math.max(extraLinesAtTheBottom, expectedViewportLineCount - 1);
}
let maxMinimapSliderTop;
if (extraLinesAtTheBottom > 0) {
const expectedViewportLineCount = viewportHeight / lineHeight;
maxMinimapSliderTop = (extraLinesAtTheTop + lineCount + extraLinesAtTheBottom - expectedViewportLineCount - 1) * minimapLineHeight / pixelRatio;
} else {
maxMinimapSliderTop = Math.max(0, (extraLinesAtTheTop + lineCount) * minimapLineHeight / pixelRatio - sliderHeight);
}
maxMinimapSliderTop = Math.min(options2.minimapHeight - sliderHeight, maxMinimapSliderTop);
const computedSliderRatio = maxMinimapSliderTop / (scrollHeight - viewportHeight);
const sliderTop = scrollTop * computedSliderRatio;
if (minimapLinesFitting >= extraLinesAtTheTop + lineCount + extraLinesAtTheBottom) {
const sliderNeeded = maxMinimapSliderTop > 0;
return new _MinimapLayout(scrollTop, scrollHeight, sliderNeeded, computedSliderRatio, sliderTop, sliderHeight, extraLinesAtTheTop, 1, lineCount);
} else {
let consideringStartLineNumber;
if (viewportStartLineNumber > 1) {
consideringStartLineNumber = viewportStartLineNumber + extraLinesAtTheTop;
} else {
consideringStartLineNumber = Math.max(1, scrollTop / lineHeight);
}
let topPaddingLineCount;
let startLineNumber = Math.max(1, Math.floor(consideringStartLineNumber - sliderTop * pixelRatio / minimapLineHeight));
if (startLineNumber < extraLinesAtTheTop) {
topPaddingLineCount = extraLinesAtTheTop - startLineNumber + 1;
startLineNumber = 1;
} else {
topPaddingLineCount = 0;
startLineNumber = Math.max(1, startLineNumber - extraLinesAtTheTop);
}
if (previousLayout && previousLayout.scrollHeight === scrollHeight) {
if (previousLayout.scrollTop > scrollTop) {
startLineNumber = Math.min(startLineNumber, previousLayout.startLineNumber);
topPaddingLineCount = Math.max(topPaddingLineCount, previousLayout.topPaddingLineCount);
}
if (previousLayout.scrollTop < scrollTop) {
startLineNumber = Math.max(startLineNumber, previousLayout.startLineNumber);
topPaddingLineCount = Math.min(topPaddingLineCount, previousLayout.topPaddingLineCount);
}
}
const endLineNumber = Math.min(lineCount, startLineNumber - topPaddingLineCount + minimapLinesFitting - 1);
const partialLine = (scrollTop - viewportStartLineNumberVerticalOffset) / lineHeight;
let sliderTopAligned;
if (scrollTop >= options2.paddingTop) {
sliderTopAligned = (viewportStartLineNumber - startLineNumber + topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
} else {
sliderTopAligned = scrollTop / options2.paddingTop * (topPaddingLineCount + partialLine) * minimapLineHeight / pixelRatio;
}
return new _MinimapLayout(scrollTop, scrollHeight, true, computedSliderRatio, sliderTopAligned, sliderHeight, topPaddingLineCount, startLineNumber, endLineNumber);
}
}
};
MinimapLine = class {
constructor(dy) {
this.dy = dy;
}
onContentChanged() {
this.dy = -1;
}
onTokensChanged() {
this.dy = -1;
}
};
MinimapLine.INVALID = new MinimapLine(-1);
RenderData = class {
constructor(renderedLayout, imageData, lines) {
this.renderedLayout = renderedLayout;
this._imageData = imageData;
this._renderedLines = new RenderedLinesCollection(() => MinimapLine.INVALID);
this._renderedLines._set(renderedLayout.startLineNumber, lines);
}
/**
* Check if the current RenderData matches accurately the new desired layout and no painting is needed.
*/
linesEquals(layout2) {
if (!this.scrollEquals(layout2)) {
return false;
}
const tmp = this._renderedLines._get();
const lines = tmp.lines;
for (let i = 0, len = lines.length; i < len; i++) {
if (lines[i].dy === -1) {
return false;
}
}
return true;
}
/**
* Check if the current RenderData matches the new layout's scroll position
*/
scrollEquals(layout2) {
return this.renderedLayout.startLineNumber === layout2.startLineNumber && this.renderedLayout.endLineNumber === layout2.endLineNumber;
}
_get() {
const tmp = this._renderedLines._get();
return {
imageData: this._imageData,
rendLineNumberStart: tmp.rendLineNumberStart,
lines: tmp.lines
};
}
onLinesChanged(changeFromLineNumber, changeCount) {
return this._renderedLines.onLinesChanged(changeFromLineNumber, changeCount);
}
onLinesDeleted(deleteFromLineNumber, deleteToLineNumber) {
this._renderedLines.onLinesDeleted(deleteFromLineNumber, deleteToLineNumber);
}
onLinesInserted(insertFromLineNumber, insertToLineNumber) {
this._renderedLines.onLinesInserted(insertFromLineNumber, insertToLineNumber);
}
onTokensChanged(ranges) {
return this._renderedLines.onTokensChanged(ranges);
}
};
MinimapBuffers = class _MinimapBuffers {
constructor(ctx, WIDTH, HEIGHT, background) {
this._backgroundFillData = _MinimapBuffers._createBackgroundFillData(WIDTH, HEIGHT, background);
this._buffers = [
ctx.createImageData(WIDTH, HEIGHT),
ctx.createImageData(WIDTH, HEIGHT)
];
this._lastUsedBuffer = 0;
}
getBuffer() {
this._lastUsedBuffer = 1 - this._lastUsedBuffer;
const result = this._buffers[this._lastUsedBuffer];
result.data.set(this._backgroundFillData);
return result;
}
static _createBackgroundFillData(WIDTH, HEIGHT, background) {
const backgroundR = background.r;
const backgroundG = background.g;
const backgroundB = background.b;
const backgroundA = background.a;
const result = new Uint8ClampedArray(WIDTH * HEIGHT * 4);
let offset = 0;
for (let i = 0; i < HEIGHT; i++) {
for (let j = 0; j < WIDTH; j++) {
result[offset] = backgroundR;
result[offset + 1] = backgroundG;
result[offset + 2] = backgroundB;
result[offset + 3] = backgroundA;
offset += 4;
}
}
return result;
}
};
MinimapSamplingState = class _MinimapSamplingState {
static compute(options2, viewLineCount, oldSamplingState) {
if (options2.renderMinimap === 0 || !options2.isSampling) {
return [null, []];
}
const { minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({
viewLineCount,
scrollBeyondLastLine: options2.scrollBeyondLastLine,
paddingTop: options2.paddingTop,
paddingBottom: options2.paddingBottom,
height: options2.editorHeight,
lineHeight: options2.lineHeight,
pixelRatio: options2.pixelRatio
});
const ratio = viewLineCount / minimapLineCount;
const halfRatio = ratio / 2;
if (!oldSamplingState || oldSamplingState.minimapLines.length === 0) {
const result2 = [];
result2[0] = 1;
if (minimapLineCount > 1) {
for (let i = 0, lastIndex = minimapLineCount - 1; i < lastIndex; i++) {
result2[i] = Math.round(i * ratio + halfRatio);
}
result2[minimapLineCount - 1] = viewLineCount;
}
return [new _MinimapSamplingState(ratio, result2), []];
}
const oldMinimapLines = oldSamplingState.minimapLines;
const oldLength = oldMinimapLines.length;
const result = [];
let oldIndex = 0;
let oldDeltaLineCount = 0;
let minViewLineNumber = 1;
const MAX_EVENT_COUNT = 10;
let events = [];
let lastEvent = null;
for (let i = 0; i < minimapLineCount; i++) {
const fromViewLineNumber = Math.max(minViewLineNumber, Math.round(i * ratio));
const toViewLineNumber = Math.max(fromViewLineNumber, Math.round((i + 1) * ratio));
while (oldIndex < oldLength && oldMinimapLines[oldIndex] < fromViewLineNumber) {
if (events.length < MAX_EVENT_COUNT) {
const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount;
if (lastEvent && lastEvent.type === "deleted" && lastEvent._oldIndex === oldIndex - 1) {
lastEvent.deleteToLineNumber++;
} else {
lastEvent = { type: "deleted", _oldIndex: oldIndex, deleteFromLineNumber: oldMinimapLineNumber, deleteToLineNumber: oldMinimapLineNumber };
events.push(lastEvent);
}
oldDeltaLineCount--;
}
oldIndex++;
}
let selectedViewLineNumber;
if (oldIndex < oldLength && oldMinimapLines[oldIndex] <= toViewLineNumber) {
selectedViewLineNumber = oldMinimapLines[oldIndex];
oldIndex++;
} else {
if (i === 0) {
selectedViewLineNumber = 1;
} else if (i + 1 === minimapLineCount) {
selectedViewLineNumber = viewLineCount;
} else {
selectedViewLineNumber = Math.round(i * ratio + halfRatio);
}
if (events.length < MAX_EVENT_COUNT) {
const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount;
if (lastEvent && lastEvent.type === "inserted" && lastEvent._i === i - 1) {
lastEvent.insertToLineNumber++;
} else {
lastEvent = { type: "inserted", _i: i, insertFromLineNumber: oldMinimapLineNumber, insertToLineNumber: oldMinimapLineNumber };
events.push(lastEvent);
}
oldDeltaLineCount++;
}
}
result[i] = selectedViewLineNumber;
minViewLineNumber = selectedViewLineNumber;
}
if (events.length < MAX_EVENT_COUNT) {
while (oldIndex < oldLength) {
const oldMinimapLineNumber = oldIndex + 1 + oldDeltaLineCount;
if (lastEvent && lastEvent.type === "deleted" && lastEvent._oldIndex === oldIndex - 1) {
lastEvent.deleteToLineNumber++;
} else {
lastEvent = { type: "deleted", _oldIndex: oldIndex, deleteFromLineNumber: oldMinimapLineNumber, deleteToLineNumber: oldMinimapLineNumber };
events.push(lastEvent);
}
oldDeltaLineCount--;
oldIndex++;
}
} else {
events = [{ type: "flush" }];
}
return [new _MinimapSamplingState(ratio, result), events];
}
constructor(samplingRatio, minimapLines) {
this.samplingRatio = samplingRatio;
this.minimapLines = minimapLines;
}
modelLineToMinimapLine(lineNumber) {
return Math.min(this.minimapLines.length, Math.max(1, Math.round(lineNumber / this.samplingRatio)));
}
/**
* Will return null if the model line ranges are not intersecting with a sampled model line.
*/
modelLineRangeToMinimapLineRange(fromLineNumber, toLineNumber) {
let fromLineIndex = this.modelLineToMinimapLine(fromLineNumber) - 1;
while (fromLineIndex > 0 && this.minimapLines[fromLineIndex - 1] >= fromLineNumber) {
fromLineIndex--;
}
let toLineIndex = this.modelLineToMinimapLine(toLineNumber) - 1;
while (toLineIndex + 1 < this.minimapLines.length && this.minimapLines[toLineIndex + 1] <= toLineNumber) {
toLineIndex++;
}
if (fromLineIndex === toLineIndex) {
const sampledLineNumber = this.minimapLines[fromLineIndex];
if (sampledLineNumber < fromLineNumber || sampledLineNumber > toLineNumber) {
return null;
}
}
return [fromLineIndex + 1, toLineIndex + 1];
}
/**
* Will always return a range, even if it is not intersecting with a sampled model line.
*/
decorationLineRangeToMinimapLineRange(startLineNumber, endLineNumber) {
let minimapLineStart = this.modelLineToMinimapLine(startLineNumber);
let minimapLineEnd = this.modelLineToMinimapLine(endLineNumber);
if (startLineNumber !== endLineNumber && minimapLineEnd === minimapLineStart) {
if (minimapLineEnd === this.minimapLines.length) {
if (minimapLineStart > 1) {
minimapLineStart--;
}
} else {
minimapLineEnd++;
}
}
return [minimapLineStart, minimapLineEnd];
}
onLinesDeleted(e) {
const deletedLineCount = e.toLineNumber - e.fromLineNumber + 1;
let changeStartIndex = this.minimapLines.length;
let changeEndIndex = 0;
for (let i = this.minimapLines.length - 1; i >= 0; i--) {
if (this.minimapLines[i] < e.fromLineNumber) {
break;
}
if (this.minimapLines[i] <= e.toLineNumber) {
this.minimapLines[i] = Math.max(1, e.fromLineNumber - 1);
changeStartIndex = Math.min(changeStartIndex, i);
changeEndIndex = Math.max(changeEndIndex, i);
} else {
this.minimapLines[i] -= deletedLineCount;
}
}
return [changeStartIndex, changeEndIndex];
}
onLinesInserted(e) {
const insertedLineCount = e.toLineNumber - e.fromLineNumber + 1;
for (let i = this.minimapLines.length - 1; i >= 0; i--) {
if (this.minimapLines[i] < e.fromLineNumber) {
break;
}
this.minimapLines[i] += insertedLineCount;
}
}
};
Minimap = class extends ViewPart {
constructor(context) {
super(context);
this._sectionHeaderCache = new LRUCache(10, 1.5);
this.tokensColorTracker = MinimapTokensColorTracker.getInstance();
this._selections = [];
this._minimapSelections = null;
this.options = new MinimapOptions(this._context.configuration, this._context.theme, this.tokensColorTracker);
const [samplingState] = MinimapSamplingState.compute(this.options, this._context.viewModel.getLineCount(), null);
this._samplingState = samplingState;
this._shouldCheckSampling = false;
this._actual = new InnerMinimap(context.theme, this);
}
dispose() {
this._actual.dispose();
super.dispose();
}
getDomNode() {
return this._actual.getDomNode();
}
_onOptionsMaybeChanged() {
const opts = new MinimapOptions(this._context.configuration, this._context.theme, this.tokensColorTracker);
if (this.options.equals(opts)) {
return false;
}
this.options = opts;
this._recreateLineSampling();
this._actual.onDidChangeOptions();
return true;
}
// ---- begin view event handlers
onConfigurationChanged(e) {
return this._onOptionsMaybeChanged();
}
onCursorStateChanged(e) {
this._selections = e.selections;
this._minimapSelections = null;
return this._actual.onSelectionChanged();
}
onDecorationsChanged(e) {
if (e.affectsMinimap) {
return this._actual.onDecorationsChanged();
}
return false;
}
onFlushed(e) {
if (this._samplingState) {
this._shouldCheckSampling = true;
}
return this._actual.onFlushed();
}
onLinesChanged(e) {
if (this._samplingState) {
const minimapLineRange = this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber, e.fromLineNumber + e.count - 1);
if (minimapLineRange) {
return this._actual.onLinesChanged(minimapLineRange[0], minimapLineRange[1] - minimapLineRange[0] + 1);
} else {
return false;
}
} else {
return this._actual.onLinesChanged(e.fromLineNumber, e.count);
}
}
onLinesDeleted(e) {
if (this._samplingState) {
const [changeStartIndex, changeEndIndex] = this._samplingState.onLinesDeleted(e);
if (changeStartIndex <= changeEndIndex) {
this._actual.onLinesChanged(changeStartIndex + 1, changeEndIndex - changeStartIndex + 1);
}
this._shouldCheckSampling = true;
return true;
} else {
return this._actual.onLinesDeleted(e.fromLineNumber, e.toLineNumber);
}
}
onLinesInserted(e) {
if (this._samplingState) {
this._samplingState.onLinesInserted(e);
this._shouldCheckSampling = true;
return true;
} else {
return this._actual.onLinesInserted(e.fromLineNumber, e.toLineNumber);
}
}
onScrollChanged(e) {
return this._actual.onScrollChanged();
}
onThemeChanged(e) {
this._actual.onThemeChanged();
this._onOptionsMaybeChanged();
return true;
}
onTokensChanged(e) {
if (this._samplingState) {
const ranges = [];
for (const range2 of e.ranges) {
const minimapLineRange = this._samplingState.modelLineRangeToMinimapLineRange(range2.fromLineNumber, range2.toLineNumber);
if (minimapLineRange) {
ranges.push({ fromLineNumber: minimapLineRange[0], toLineNumber: minimapLineRange[1] });
}
}
if (ranges.length) {
return this._actual.onTokensChanged(ranges);
} else {
return false;
}
} else {
return this._actual.onTokensChanged(e.ranges);
}
}
onTokensColorsChanged(e) {
this._onOptionsMaybeChanged();
return this._actual.onTokensColorsChanged();
}
onZonesChanged(e) {
return this._actual.onZonesChanged();
}
// --- end event handlers
prepareRender(ctx) {
if (this._shouldCheckSampling) {
this._shouldCheckSampling = false;
this._recreateLineSampling();
}
}
render(ctx) {
let viewportStartLineNumber = ctx.visibleRange.startLineNumber;
let viewportEndLineNumber = ctx.visibleRange.endLineNumber;
if (this._samplingState) {
viewportStartLineNumber = this._samplingState.modelLineToMinimapLine(viewportStartLineNumber);
viewportEndLineNumber = this._samplingState.modelLineToMinimapLine(viewportEndLineNumber);
}
const minimapCtx = {
viewportContainsWhitespaceGaps: ctx.viewportData.whitespaceViewportData.length > 0,
scrollWidth: ctx.scrollWidth,
scrollHeight: ctx.scrollHeight,
viewportStartLineNumber,
viewportEndLineNumber,
viewportStartLineNumberVerticalOffset: ctx.getVerticalOffsetForLineNumber(viewportStartLineNumber),
scrollTop: ctx.scrollTop,
scrollLeft: ctx.scrollLeft,
viewportWidth: ctx.viewportWidth,
viewportHeight: ctx.viewportHeight
};
this._actual.render(minimapCtx);
}
//#region IMinimapModel
_recreateLineSampling() {
this._minimapSelections = null;
const wasSampling = Boolean(this._samplingState);
const [samplingState, events] = MinimapSamplingState.compute(this.options, this._context.viewModel.getLineCount(), this._samplingState);
this._samplingState = samplingState;
if (wasSampling && this._samplingState) {
for (const event of events) {
switch (event.type) {
case "deleted":
this._actual.onLinesDeleted(event.deleteFromLineNumber, event.deleteToLineNumber);
break;
case "inserted":
this._actual.onLinesInserted(event.insertFromLineNumber, event.insertToLineNumber);
break;
case "flush":
this._actual.onFlushed();
break;
}
}
}
}
getLineCount() {
if (this._samplingState) {
return this._samplingState.minimapLines.length;
}
return this._context.viewModel.getLineCount();
}
getRealLineCount() {
return this._context.viewModel.getLineCount();
}
getLineContent(lineNumber) {
if (this._samplingState) {
return this._context.viewModel.getLineContent(this._samplingState.minimapLines[lineNumber - 1]);
}
return this._context.viewModel.getLineContent(lineNumber);
}
getLineMaxColumn(lineNumber) {
if (this._samplingState) {
return this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[lineNumber - 1]);
}
return this._context.viewModel.getLineMaxColumn(lineNumber);
}
getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed) {
if (this._samplingState) {
const result = [];
for (let lineIndex = 0, lineCount = endLineNumber - startLineNumber + 1; lineIndex < lineCount; lineIndex++) {
if (needed[lineIndex]) {
result[lineIndex] = this._context.viewModel.getViewLineData(this._samplingState.minimapLines[startLineNumber + lineIndex - 1]);
} else {
result[lineIndex] = null;
}
}
return result;
}
return this._context.viewModel.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed).data;
}
getSelections() {
if (this._minimapSelections === null) {
if (this._samplingState) {
this._minimapSelections = [];
for (const selection of this._selections) {
const [minimapLineStart, minimapLineEnd] = this._samplingState.decorationLineRangeToMinimapLineRange(selection.startLineNumber, selection.endLineNumber);
this._minimapSelections.push(new Selection(minimapLineStart, selection.startColumn, minimapLineEnd, selection.endColumn));
}
} else {
this._minimapSelections = this._selections;
}
}
return this._minimapSelections;
}
getMinimapDecorationsInViewport(startLineNumber, endLineNumber) {
const decorations = this._getMinimapDecorationsInViewport(startLineNumber, endLineNumber).filter((decoration3) => {
var _a10;
return !((_a10 = decoration3.options.minimap) === null || _a10 === void 0 ? void 0 : _a10.sectionHeaderStyle);
});
if (this._samplingState) {
const result = [];
for (const decoration3 of decorations) {
if (!decoration3.options.minimap) {
continue;
}
const range2 = decoration3.range;
const minimapStartLineNumber = this._samplingState.modelLineToMinimapLine(range2.startLineNumber);
const minimapEndLineNumber = this._samplingState.modelLineToMinimapLine(range2.endLineNumber);
result.push(new ViewModelDecoration(new Range(minimapStartLineNumber, range2.startColumn, minimapEndLineNumber, range2.endColumn), decoration3.options));
}
return result;
}
return decorations;
}
getSectionHeaderDecorationsInViewport(startLineNumber, endLineNumber) {
const minimapLineHeight = this.options.minimapLineHeight;
const sectionHeaderFontSize = this.options.sectionHeaderFontSize;
const headerHeightInMinimapLines = sectionHeaderFontSize / minimapLineHeight;
startLineNumber = Math.floor(Math.max(1, startLineNumber - headerHeightInMinimapLines));
return this._getMinimapDecorationsInViewport(startLineNumber, endLineNumber).filter((decoration3) => {
var _a10;
return !!((_a10 = decoration3.options.minimap) === null || _a10 === void 0 ? void 0 : _a10.sectionHeaderStyle);
});
}
_getMinimapDecorationsInViewport(startLineNumber, endLineNumber) {
let visibleRange;
if (this._samplingState) {
const modelStartLineNumber = this._samplingState.minimapLines[startLineNumber - 1];
const modelEndLineNumber = this._samplingState.minimapLines[endLineNumber - 1];
visibleRange = new Range(modelStartLineNumber, 1, modelEndLineNumber, this._context.viewModel.getLineMaxColumn(modelEndLineNumber));
} else {
visibleRange = new Range(startLineNumber, 1, endLineNumber, this._context.viewModel.getLineMaxColumn(endLineNumber));
}
return this._context.viewModel.getMinimapDecorationsInRange(visibleRange);
}
getSectionHeaderText(decoration3, fitWidth) {
var _a10;
const headerText = (_a10 = decoration3.options.minimap) === null || _a10 === void 0 ? void 0 : _a10.sectionHeaderText;
if (!headerText) {
return null;
}
const cachedText = this._sectionHeaderCache.get(headerText);
if (cachedText) {
return cachedText;
}
const fittedText = fitWidth(headerText);
this._sectionHeaderCache.set(headerText, fittedText);
return fittedText;
}
getOptions() {
return this._context.viewModel.model.getOptions();
}
revealLineNumber(lineNumber) {
if (this._samplingState) {
lineNumber = this._samplingState.minimapLines[lineNumber - 1];
}
this._context.viewModel.revealRange(
"mouse",
false,
new Range(lineNumber, 1, lineNumber, 1),
1,
0
/* ScrollType.Smooth */
);
}
setScrollTop(scrollTop) {
this._context.viewModel.viewLayout.setScrollPosition(
{
scrollTop
},
1
/* ScrollType.Immediate */
);
}
};
InnerMinimap = class _InnerMinimap extends Disposable {
constructor(theme, model) {
super();
this._renderDecorations = false;
this._gestureInProgress = false;
this._theme = theme;
this._model = model;
this._lastRenderData = null;
this._buffers = null;
this._selectionColor = this._theme.getColor(minimapSelection);
this._domNode = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this._domNode,
9
/* PartFingerprint.Minimap */
);
this._domNode.setClassName(this._getMinimapDomNodeClassName());
this._domNode.setPosition("absolute");
this._domNode.setAttribute("role", "presentation");
this._domNode.setAttribute("aria-hidden", "true");
this._shadow = createFastDomNode(document.createElement("div"));
this._shadow.setClassName("minimap-shadow-hidden");
this._domNode.appendChild(this._shadow);
this._canvas = createFastDomNode(document.createElement("canvas"));
this._canvas.setPosition("absolute");
this._canvas.setLeft(0);
this._domNode.appendChild(this._canvas);
this._decorationsCanvas = createFastDomNode(document.createElement("canvas"));
this._decorationsCanvas.setPosition("absolute");
this._decorationsCanvas.setClassName("minimap-decorations-layer");
this._decorationsCanvas.setLeft(0);
this._domNode.appendChild(this._decorationsCanvas);
this._slider = createFastDomNode(document.createElement("div"));
this._slider.setPosition("absolute");
this._slider.setClassName("minimap-slider");
this._slider.setLayerHinting(true);
this._slider.setContain("strict");
this._domNode.appendChild(this._slider);
this._sliderHorizontal = createFastDomNode(document.createElement("div"));
this._sliderHorizontal.setPosition("absolute");
this._sliderHorizontal.setClassName("minimap-slider-horizontal");
this._slider.appendChild(this._sliderHorizontal);
this._applyLayout();
this._pointerDownListener = addStandardDisposableListener(this._domNode.domNode, EventType.POINTER_DOWN, (e) => {
e.preventDefault();
const renderMinimap = this._model.options.renderMinimap;
if (renderMinimap === 0) {
return;
}
if (!this._lastRenderData) {
return;
}
if (this._model.options.size !== "proportional") {
if (e.button === 0 && this._lastRenderData) {
const position = getDomNodePagePosition(this._slider.domNode);
const initialPosY = position.top + position.height / 2;
this._startSliderDragging(e, initialPosY, this._lastRenderData.renderedLayout);
}
return;
}
const minimapLineHeight = this._model.options.minimapLineHeight;
const internalOffsetY = this._model.options.canvasInnerHeight / this._model.options.canvasOuterHeight * e.offsetY;
const lineIndex = Math.floor(internalOffsetY / minimapLineHeight);
let lineNumber = lineIndex + this._lastRenderData.renderedLayout.startLineNumber - this._lastRenderData.renderedLayout.topPaddingLineCount;
lineNumber = Math.min(lineNumber, this._model.getLineCount());
this._model.revealLineNumber(lineNumber);
});
this._sliderPointerMoveMonitor = new GlobalPointerMoveMonitor();
this._sliderPointerDownListener = addStandardDisposableListener(this._slider.domNode, EventType.POINTER_DOWN, (e) => {
e.preventDefault();
e.stopPropagation();
if (e.button === 0 && this._lastRenderData) {
this._startSliderDragging(e, e.pageY, this._lastRenderData.renderedLayout);
}
});
this._gestureDisposable = Gesture.addTarget(this._domNode.domNode);
this._sliderTouchStartListener = addDisposableListener(this._domNode.domNode, EventType2.Start, (e) => {
e.preventDefault();
e.stopPropagation();
if (this._lastRenderData) {
this._slider.toggleClassName("active", true);
this._gestureInProgress = true;
this.scrollDueToTouchEvent(e);
}
}, { passive: false });
this._sliderTouchMoveListener = addDisposableListener(this._domNode.domNode, EventType2.Change, (e) => {
e.preventDefault();
e.stopPropagation();
if (this._lastRenderData && this._gestureInProgress) {
this.scrollDueToTouchEvent(e);
}
}, { passive: false });
this._sliderTouchEndListener = addStandardDisposableListener(this._domNode.domNode, EventType2.End, (e) => {
e.preventDefault();
e.stopPropagation();
this._gestureInProgress = false;
this._slider.toggleClassName("active", false);
});
}
_startSliderDragging(e, initialPosY, initialSliderState) {
if (!e.target || !(e.target instanceof Element)) {
return;
}
const initialPosX = e.pageX;
this._slider.toggleClassName("active", true);
const handlePointerMove = (posy, posx) => {
const minimapPosition = getDomNodePagePosition(this._domNode.domNode);
const pointerOrthogonalDelta = Math.min(Math.abs(posx - initialPosX), Math.abs(posx - minimapPosition.left), Math.abs(posx - minimapPosition.left - minimapPosition.width));
if (isWindows && pointerOrthogonalDelta > POINTER_DRAG_RESET_DISTANCE2) {
this._model.setScrollTop(initialSliderState.scrollTop);
return;
}
const pointerDelta = posy - initialPosY;
this._model.setScrollTop(initialSliderState.getDesiredScrollTopFromDelta(pointerDelta));
};
if (e.pageY !== initialPosY) {
handlePointerMove(e.pageY, initialPosX);
}
this._sliderPointerMoveMonitor.startMonitoring(e.target, e.pointerId, e.buttons, (pointerMoveData) => handlePointerMove(pointerMoveData.pageY, pointerMoveData.pageX), () => {
this._slider.toggleClassName("active", false);
});
}
scrollDueToTouchEvent(touch) {
const startY = this._domNode.domNode.getBoundingClientRect().top;
const scrollTop = this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(touch.pageY - startY);
this._model.setScrollTop(scrollTop);
}
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() {
const class_ = ["minimap"];
if (this._model.options.showSlider === "always") {
class_.push("slider-always");
} else {
class_.push("slider-mouseover");
}
if (this._model.options.autohide) {
class_.push("autohide");
}
return class_.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() {
if (!this._buffers) {
if (this._model.options.canvasInnerWidth > 0 && this._model.options.canvasInnerHeight > 0) {
this._buffers = new MinimapBuffers(this._canvas.domNode.getContext("2d"), this._model.options.canvasInnerWidth, this._model.options.canvasInnerHeight, this._model.options.backgroundColor);
}
}
return this._buffers ? this._buffers.getBuffer() : null;
}
// ---- begin view event handlers
onDidChangeOptions() {
this._lastRenderData = null;
this._buffers = null;
this._applyLayout();
this._domNode.setClassName(this._getMinimapDomNodeClassName());
}
onSelectionChanged() {
this._renderDecorations = true;
return true;
}
onDecorationsChanged() {
this._renderDecorations = true;
return true;
}
onFlushed() {
this._lastRenderData = null;
return true;
}
onLinesChanged(changeFromLineNumber, changeCount) {
if (this._lastRenderData) {
return this._lastRenderData.onLinesChanged(changeFromLineNumber, changeCount);
}
return false;
}
onLinesDeleted(deleteFromLineNumber, deleteToLineNumber) {
var _a10;
(_a10 = this._lastRenderData) === null || _a10 === void 0 ? void 0 : _a10.onLinesDeleted(deleteFromLineNumber, deleteToLineNumber);
return true;
}
onLinesInserted(insertFromLineNumber, insertToLineNumber) {
var _a10;
(_a10 = this._lastRenderData) === null || _a10 === void 0 ? void 0 : _a10.onLinesInserted(insertFromLineNumber, insertToLineNumber);
return true;
}
onScrollChanged() {
this._renderDecorations = true;
return true;
}
onThemeChanged() {
this._selectionColor = this._theme.getColor(minimapSelection);
this._renderDecorations = true;
return true;
}
onTokensChanged(ranges) {
if (this._lastRenderData) {
return this._lastRenderData.onTokensChanged(ranges);
}
return false;
}
onTokensColorsChanged() {
this._lastRenderData = null;
this._buffers = null;
return true;
}
onZonesChanged() {
this._lastRenderData = null;
return true;
}
// --- end event handlers
render(renderingCtx) {
const renderMinimap = this._model.options.renderMinimap;
if (renderMinimap === 0) {
this._shadow.setClassName("minimap-shadow-hidden");
this._sliderHorizontal.setWidth(0);
this._sliderHorizontal.setHeight(0);
return;
}
if (renderingCtx.scrollLeft + renderingCtx.viewportWidth >= renderingCtx.scrollWidth) {
this._shadow.setClassName("minimap-shadow-hidden");
} else {
this._shadow.setClassName("minimap-shadow-visible");
}
const layout2 = MinimapLayout.create(this._model.options, renderingCtx.viewportStartLineNumber, renderingCtx.viewportEndLineNumber, renderingCtx.viewportStartLineNumberVerticalOffset, renderingCtx.viewportHeight, renderingCtx.viewportContainsWhitespaceGaps, this._model.getLineCount(), this._model.getRealLineCount(), renderingCtx.scrollTop, renderingCtx.scrollHeight, this._lastRenderData ? this._lastRenderData.renderedLayout : null);
this._slider.setDisplay(layout2.sliderNeeded ? "block" : "none");
this._slider.setTop(layout2.sliderTop);
this._slider.setHeight(layout2.sliderHeight);
this._sliderHorizontal.setLeft(0);
this._sliderHorizontal.setWidth(this._model.options.minimapWidth);
this._sliderHorizontal.setTop(0);
this._sliderHorizontal.setHeight(layout2.sliderHeight);
this.renderDecorations(layout2);
this._lastRenderData = this.renderLines(layout2);
}
renderDecorations(layout2) {
if (this._renderDecorations) {
this._renderDecorations = false;
const selections = this._model.getSelections();
selections.sort(Range.compareRangesUsingStarts);
const decorations = this._model.getMinimapDecorationsInViewport(layout2.startLineNumber, layout2.endLineNumber);
decorations.sort((a3, b) => (a3.options.zIndex || 0) - (b.options.zIndex || 0));
const { canvasInnerWidth, canvasInnerHeight } = this._model.options;
const minimapLineHeight = this._model.options.minimapLineHeight;
const minimapCharWidth = this._model.options.minimapCharWidth;
const tabSize = this._model.getOptions().tabSize;
const canvasContext = this._decorationsCanvas.domNode.getContext("2d");
canvasContext.clearRect(0, 0, canvasInnerWidth, canvasInnerHeight);
const highlightedLines = new ContiguousLineMap(layout2.startLineNumber, layout2.endLineNumber, false);
this._renderSelectionLineHighlights(canvasContext, selections, highlightedLines, layout2, minimapLineHeight);
this._renderDecorationsLineHighlights(canvasContext, decorations, highlightedLines, layout2, minimapLineHeight);
const lineOffsetMap = new ContiguousLineMap(layout2.startLineNumber, layout2.endLineNumber, null);
this._renderSelectionsHighlights(canvasContext, selections, lineOffsetMap, layout2, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
this._renderDecorationsHighlights(canvasContext, decorations, lineOffsetMap, layout2, minimapLineHeight, tabSize, minimapCharWidth, canvasInnerWidth);
this._renderSectionHeaders(layout2);
}
}
_renderSelectionLineHighlights(canvasContext, selections, highlightedLines, layout2, minimapLineHeight) {
if (!this._selectionColor || this._selectionColor.isTransparent()) {
return;
}
canvasContext.fillStyle = this._selectionColor.transparent(0.5).toString();
let y1 = 0;
let y2 = 0;
for (const selection of selections) {
const intersection2 = layout2.intersectWithViewport(selection);
if (!intersection2) {
continue;
}
const [startLineNumber, endLineNumber] = intersection2;
for (let line = startLineNumber; line <= endLineNumber; line++) {
highlightedLines.set(line, true);
}
const yy1 = layout2.getYForLineNumber(startLineNumber, minimapLineHeight);
const yy2 = layout2.getYForLineNumber(endLineNumber, minimapLineHeight);
if (y2 >= yy1) {
y2 = yy2;
} else {
if (y2 > y1) {
canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y1, canvasContext.canvas.width, y2 - y1);
}
y1 = yy1;
y2 = yy2;
}
}
if (y2 > y1) {
canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y1, canvasContext.canvas.width, y2 - y1);
}
}
_renderDecorationsLineHighlights(canvasContext, decorations, highlightedLines, layout2, minimapLineHeight) {
const highlightColors = /* @__PURE__ */ new Map();
for (let i = decorations.length - 1; i >= 0; i--) {
const decoration3 = decorations[i];
const minimapOptions = decoration3.options.minimap;
if (!minimapOptions || minimapOptions.position !== 1) {
continue;
}
const intersection2 = layout2.intersectWithViewport(decoration3.range);
if (!intersection2) {
continue;
}
const [startLineNumber, endLineNumber] = intersection2;
const decorationColor = minimapOptions.getColor(this._theme.value);
if (!decorationColor || decorationColor.isTransparent()) {
continue;
}
let highlightColor = highlightColors.get(decorationColor.toString());
if (!highlightColor) {
highlightColor = decorationColor.transparent(0.5).toString();
highlightColors.set(decorationColor.toString(), highlightColor);
}
canvasContext.fillStyle = highlightColor;
for (let line = startLineNumber; line <= endLineNumber; line++) {
if (highlightedLines.has(line)) {
continue;
}
highlightedLines.set(line, true);
const y = layout2.getYForLineNumber(startLineNumber, minimapLineHeight);
canvasContext.fillRect(MINIMAP_GUTTER_WIDTH, y, canvasContext.canvas.width, minimapLineHeight);
}
}
}
_renderSelectionsHighlights(canvasContext, selections, lineOffsetMap, layout2, lineHeight, tabSize, characterWidth, canvasInnerWidth) {
if (!this._selectionColor || this._selectionColor.isTransparent()) {
return;
}
for (const selection of selections) {
const intersection2 = layout2.intersectWithViewport(selection);
if (!intersection2) {
continue;
}
const [startLineNumber, endLineNumber] = intersection2;
for (let line = startLineNumber; line <= endLineNumber; line++) {
this.renderDecorationOnLine(canvasContext, lineOffsetMap, selection, this._selectionColor, layout2, line, lineHeight, lineHeight, tabSize, characterWidth, canvasInnerWidth);
}
}
}
_renderDecorationsHighlights(canvasContext, decorations, lineOffsetMap, layout2, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth) {
for (const decoration3 of decorations) {
const minimapOptions = decoration3.options.minimap;
if (!minimapOptions) {
continue;
}
const intersection2 = layout2.intersectWithViewport(decoration3.range);
if (!intersection2) {
continue;
}
const [startLineNumber, endLineNumber] = intersection2;
const decorationColor = minimapOptions.getColor(this._theme.value);
if (!decorationColor || decorationColor.isTransparent()) {
continue;
}
for (let line = startLineNumber; line <= endLineNumber; line++) {
switch (minimapOptions.position) {
case 1:
this.renderDecorationOnLine(canvasContext, lineOffsetMap, decoration3.range, decorationColor, layout2, line, minimapLineHeight, minimapLineHeight, tabSize, characterWidth, canvasInnerWidth);
continue;
case 2: {
const y = layout2.getYForLineNumber(line, minimapLineHeight);
const x = 2;
this.renderDecoration(canvasContext, decorationColor, x, y, GUTTER_DECORATION_WIDTH, minimapLineHeight);
continue;
}
}
}
}
}
renderDecorationOnLine(canvasContext, lineOffsetMap, decorationRange, decorationColor, layout2, lineNumber, height, minimapLineHeight, tabSize, charWidth, canvasInnerWidth) {
const y = layout2.getYForLineNumber(lineNumber, minimapLineHeight);
if (y + height < 0 || y > this._model.options.canvasInnerHeight) {
return;
}
const { startLineNumber, endLineNumber } = decorationRange;
const startColumn = startLineNumber === lineNumber ? decorationRange.startColumn : 1;
const endColumn = endLineNumber === lineNumber ? decorationRange.endColumn : this._model.getLineMaxColumn(lineNumber);
const x1 = this.getXOffsetForPosition(lineOffsetMap, lineNumber, startColumn, tabSize, charWidth, canvasInnerWidth);
const x2 = this.getXOffsetForPosition(lineOffsetMap, lineNumber, endColumn, tabSize, charWidth, canvasInnerWidth);
this.renderDecoration(canvasContext, decorationColor, x1, y, x2 - x1, height);
}
getXOffsetForPosition(lineOffsetMap, lineNumber, column, tabSize, charWidth, canvasInnerWidth) {
if (column === 1) {
return MINIMAP_GUTTER_WIDTH;
}
const minimumXOffset = (column - 1) * charWidth;
if (minimumXOffset >= canvasInnerWidth) {
return canvasInnerWidth;
}
let lineIndexToXOffset = lineOffsetMap.get(lineNumber);
if (!lineIndexToXOffset) {
const lineData = this._model.getLineContent(lineNumber);
lineIndexToXOffset = [MINIMAP_GUTTER_WIDTH];
let prevx = MINIMAP_GUTTER_WIDTH;
for (let i = 1; i < lineData.length + 1; i++) {
const charCode = lineData.charCodeAt(i - 1);
const dx = charCode === 9 ? tabSize * charWidth : isFullWidthCharacter(charCode) ? 2 * charWidth : charWidth;
const x = prevx + dx;
if (x >= canvasInnerWidth) {
lineIndexToXOffset[i] = canvasInnerWidth;
break;
}
lineIndexToXOffset[i] = x;
prevx = x;
}
lineOffsetMap.set(lineNumber, lineIndexToXOffset);
}
if (column - 1 < lineIndexToXOffset.length) {
return lineIndexToXOffset[column - 1];
}
return canvasInnerWidth;
}
renderDecoration(canvasContext, decorationColor, x, y, width2, height) {
canvasContext.fillStyle = decorationColor && decorationColor.toString() || "";
canvasContext.fillRect(x, y, width2, height);
}
_renderSectionHeaders(layout2) {
var _a10;
const minimapLineHeight = this._model.options.minimapLineHeight;
const sectionHeaderFontSize = this._model.options.sectionHeaderFontSize;
const sectionHeaderLetterSpacing = this._model.options.sectionHeaderLetterSpacing;
const backgroundFillHeight = sectionHeaderFontSize * 1.5;
const { canvasInnerWidth } = this._model.options;
const backgroundColor = this._model.options.backgroundColor;
const backgroundFill = `rgb(${backgroundColor.r} ${backgroundColor.g} ${backgroundColor.b} / .7)`;
const foregroundColor = this._model.options.sectionHeaderFontColor;
const foregroundFill = `rgb(${foregroundColor.r} ${foregroundColor.g} ${foregroundColor.b})`;
const separatorStroke = foregroundFill;
const canvasContext = this._decorationsCanvas.domNode.getContext("2d");
canvasContext.letterSpacing = sectionHeaderLetterSpacing + "px";
canvasContext.font = "500 " + sectionHeaderFontSize + "px " + this._model.options.sectionHeaderFontFamily;
canvasContext.strokeStyle = separatorStroke;
canvasContext.lineWidth = 0.2;
const decorations = this._model.getSectionHeaderDecorationsInViewport(layout2.startLineNumber, layout2.endLineNumber);
decorations.sort((a3, b) => a3.range.startLineNumber - b.range.startLineNumber);
const fitWidth = _InnerMinimap._fitSectionHeader.bind(null, canvasContext, canvasInnerWidth - MINIMAP_GUTTER_WIDTH);
for (const decoration3 of decorations) {
const y = layout2.getYForLineNumber(decoration3.range.startLineNumber, minimapLineHeight) + sectionHeaderFontSize;
const backgroundFillY = y - sectionHeaderFontSize;
const separatorY = backgroundFillY + 2;
const headerText = this._model.getSectionHeaderText(decoration3, fitWidth);
_InnerMinimap._renderSectionLabel(canvasContext, headerText, ((_a10 = decoration3.options.minimap) === null || _a10 === void 0 ? void 0 : _a10.sectionHeaderStyle) === 2, backgroundFill, foregroundFill, canvasInnerWidth, backgroundFillY, backgroundFillHeight, y, separatorY);
}
}
static _fitSectionHeader(target, maxWidth, headerText) {
if (!headerText) {
return headerText;
}
const ellipsis = "\u2026";
const width2 = target.measureText(headerText).width;
const ellipsisWidth = target.measureText(ellipsis).width;
if (width2 <= maxWidth || width2 <= ellipsisWidth) {
return headerText;
}
const len = headerText.length;
const averageCharWidth = width2 / headerText.length;
const maxCharCount = Math.floor((maxWidth - ellipsisWidth) / averageCharWidth) - 1;
let halfCharCount = Math.ceil(maxCharCount / 2);
while (halfCharCount > 0 && /\s/.test(headerText[halfCharCount - 1])) {
--halfCharCount;
}
return headerText.substring(0, halfCharCount) + ellipsis + headerText.substring(len - (maxCharCount - halfCharCount));
}
static _renderSectionLabel(target, headerText, hasSeparatorLine, backgroundFill, foregroundFill, minimapWidth, backgroundFillY, backgroundFillHeight, textY, separatorY) {
if (headerText) {
target.fillStyle = backgroundFill;
target.fillRect(0, backgroundFillY, minimapWidth, backgroundFillHeight);
target.fillStyle = foregroundFill;
target.fillText(headerText, MINIMAP_GUTTER_WIDTH, textY);
}
if (hasSeparatorLine) {
target.beginPath();
target.moveTo(0, separatorY);
target.lineTo(minimapWidth, separatorY);
target.closePath();
target.stroke();
}
}
renderLines(layout2) {
const startLineNumber = layout2.startLineNumber;
const endLineNumber = layout2.endLineNumber;
const minimapLineHeight = this._model.options.minimapLineHeight;
if (this._lastRenderData && this._lastRenderData.linesEquals(layout2)) {
const _lastData = this._lastRenderData._get();
return new RenderData(layout2, _lastData.imageData, _lastData.lines);
}
const imageData = this._getBuffer();
if (!imageData) {
return null;
}
const [_dirtyY1, _dirtyY2, needed] = _InnerMinimap._renderUntouchedLines(imageData, layout2.topPaddingLineCount, startLineNumber, endLineNumber, minimapLineHeight, this._lastRenderData);
const lineInfo = this._model.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed);
const tabSize = this._model.getOptions().tabSize;
const defaultBackground = this._model.options.defaultBackgroundColor;
const background = this._model.options.backgroundColor;
const foregroundAlpha = this._model.options.foregroundAlpha;
const tokensColorTracker = this._model.tokensColorTracker;
const useLighterFont = tokensColorTracker.backgroundIsLight();
const renderMinimap = this._model.options.renderMinimap;
const charRenderer = this._model.options.charRenderer();
const fontScale = this._model.options.fontScale;
const minimapCharWidth = this._model.options.minimapCharWidth;
const baseCharHeight = renderMinimap === 1 ? 2 : 2 + 1;
const renderMinimapLineHeight = baseCharHeight * fontScale;
const innerLinePadding = minimapLineHeight > renderMinimapLineHeight ? Math.floor((minimapLineHeight - renderMinimapLineHeight) / 2) : 0;
const backgroundA = background.a / 255;
const renderBackground = new RGBA8(Math.round((background.r - defaultBackground.r) * backgroundA + defaultBackground.r), Math.round((background.g - defaultBackground.g) * backgroundA + defaultBackground.g), Math.round((background.b - defaultBackground.b) * backgroundA + defaultBackground.b), 255);
let dy = layout2.topPaddingLineCount * minimapLineHeight;
const renderedLines = [];
for (let lineIndex = 0, lineCount = endLineNumber - startLineNumber + 1; lineIndex < lineCount; lineIndex++) {
if (needed[lineIndex]) {
_InnerMinimap._renderLine(imageData, renderBackground, background.a, useLighterFont, renderMinimap, minimapCharWidth, tokensColorTracker, foregroundAlpha, charRenderer, dy, innerLinePadding, tabSize, lineInfo[lineIndex], fontScale, minimapLineHeight);
}
renderedLines[lineIndex] = new MinimapLine(dy);
dy += minimapLineHeight;
}
const dirtyY1 = _dirtyY1 === -1 ? 0 : _dirtyY1;
const dirtyY2 = _dirtyY2 === -1 ? imageData.height : _dirtyY2;
const dirtyHeight = dirtyY2 - dirtyY1;
const ctx = this._canvas.domNode.getContext("2d");
ctx.putImageData(imageData, 0, 0, 0, dirtyY1, imageData.width, dirtyHeight);
return new RenderData(layout2, imageData, renderedLines);
}
static _renderUntouchedLines(target, topPaddingLineCount, startLineNumber, endLineNumber, minimapLineHeight, lastRenderData) {
const needed = [];
if (!lastRenderData) {
for (let i = 0, len = endLineNumber - startLineNumber + 1; i < len; i++) {
needed[i] = true;
}
return [-1, -1, needed];
}
const _lastData = lastRenderData._get();
const lastTargetData = _lastData.imageData.data;
const lastStartLineNumber = _lastData.rendLineNumberStart;
const lastLines = _lastData.lines;
const lastLinesLength = lastLines.length;
const WIDTH = target.width;
const targetData = target.data;
const maxDestPixel = (endLineNumber - startLineNumber + 1) * minimapLineHeight * WIDTH * 4;
let dirtyPixel1 = -1;
let dirtyPixel2 = -1;
let copySourceStart = -1;
let copySourceEnd = -1;
let copyDestStart = -1;
let copyDestEnd = -1;
let dest_dy = topPaddingLineCount * minimapLineHeight;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const lineIndex = lineNumber - startLineNumber;
const lastLineIndex = lineNumber - lastStartLineNumber;
const source_dy = lastLineIndex >= 0 && lastLineIndex < lastLinesLength ? lastLines[lastLineIndex].dy : -1;
if (source_dy === -1) {
needed[lineIndex] = true;
dest_dy += minimapLineHeight;
continue;
}
const sourceStart = source_dy * WIDTH * 4;
const sourceEnd = (source_dy + minimapLineHeight) * WIDTH * 4;
const destStart = dest_dy * WIDTH * 4;
const destEnd = (dest_dy + minimapLineHeight) * WIDTH * 4;
if (copySourceEnd === sourceStart && copyDestEnd === destStart) {
copySourceEnd = sourceEnd;
copyDestEnd = destEnd;
} else {
if (copySourceStart !== -1) {
targetData.set(lastTargetData.subarray(copySourceStart, copySourceEnd), copyDestStart);
if (dirtyPixel1 === -1 && copySourceStart === 0 && copySourceStart === copyDestStart) {
dirtyPixel1 = copySourceEnd;
}
if (dirtyPixel2 === -1 && copySourceEnd === maxDestPixel && copySourceStart === copyDestStart) {
dirtyPixel2 = copySourceStart;
}
}
copySourceStart = sourceStart;
copySourceEnd = sourceEnd;
copyDestStart = destStart;
copyDestEnd = destEnd;
}
needed[lineIndex] = false;
dest_dy += minimapLineHeight;
}
if (copySourceStart !== -1) {
targetData.set(lastTargetData.subarray(copySourceStart, copySourceEnd), copyDestStart);
if (dirtyPixel1 === -1 && copySourceStart === 0 && copySourceStart === copyDestStart) {
dirtyPixel1 = copySourceEnd;
}
if (dirtyPixel2 === -1 && copySourceEnd === maxDestPixel && copySourceStart === copyDestStart) {
dirtyPixel2 = copySourceStart;
}
}
const dirtyY1 = dirtyPixel1 === -1 ? -1 : dirtyPixel1 / (WIDTH * 4);
const dirtyY2 = dirtyPixel2 === -1 ? -1 : dirtyPixel2 / (WIDTH * 4);
return [dirtyY1, dirtyY2, needed];
}
static _renderLine(target, backgroundColor, backgroundAlpha, useLighterFont, renderMinimap, charWidth, colorTracker, foregroundAlpha, minimapCharRenderer, dy, innerLinePadding, tabSize, lineData, fontScale, minimapLineHeight) {
const content = lineData.content;
const tokens = lineData.tokens;
const maxDx = target.width - charWidth;
const force1pxHeight = minimapLineHeight === 1;
let dx = MINIMAP_GUTTER_WIDTH;
let charIndex = 0;
let tabsCharDelta = 0;
for (let tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {
const tokenEndIndex = tokens.getEndOffset(tokenIndex);
const tokenColorId = tokens.getForeground(tokenIndex);
const tokenColor = colorTracker.getColor(tokenColorId);
for (; charIndex < tokenEndIndex; charIndex++) {
if (dx > maxDx) {
return;
}
const charCode = content.charCodeAt(charIndex);
if (charCode === 9) {
const insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
tabsCharDelta += insertSpacesCount - 1;
dx += insertSpacesCount * charWidth;
} else if (charCode === 32) {
dx += charWidth;
} else {
const count = isFullWidthCharacter(charCode) ? 2 : 1;
for (let i = 0; i < count; i++) {
if (renderMinimap === 2) {
minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, foregroundAlpha, backgroundColor, backgroundAlpha, force1pxHeight);
} else {
minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, foregroundAlpha, backgroundColor, backgroundAlpha, fontScale, useLighterFont, force1pxHeight);
}
dx += charWidth;
if (dx > maxDx) {
return;
}
}
}
}
}
}
};
ContiguousLineMap = class {
constructor(startLineNumber, endLineNumber, defaultValue) {
this._startLineNumber = startLineNumber;
this._endLineNumber = endLineNumber;
this._defaultValue = defaultValue;
this._values = [];
for (let i = 0, count = this._endLineNumber - this._startLineNumber + 1; i < count; i++) {
this._values[i] = defaultValue;
}
}
has(lineNumber) {
return this.get(lineNumber) !== this._defaultValue;
}
set(lineNumber, value) {
if (lineNumber < this._startLineNumber || lineNumber > this._endLineNumber) {
return;
}
this._values[lineNumber - this._startLineNumber] = value;
}
get(lineNumber) {
if (lineNumber < this._startLineNumber || lineNumber > this._endLineNumber) {
return this._defaultValue;
}
return this._values[lineNumber - this._startLineNumber];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.css
var init_overlayWidgets = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js
var ViewOverlayWidgets;
var init_overlayWidgets2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js"() {
init_overlayWidgets();
init_fastDomNode();
init_viewPart();
init_dom();
ViewOverlayWidgets = class extends ViewPart {
constructor(context, viewDomNode) {
super(context);
this._viewDomNode = viewDomNode;
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._widgets = {};
this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
this._minimapWidth = layoutInfo.minimap.minimapWidth;
this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
this._editorHeight = layoutInfo.height;
this._editorWidth = layoutInfo.width;
this._viewDomNodeRect = { top: 0, left: 0, width: 0, height: 0 };
this._domNode = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this._domNode,
4
/* PartFingerprint.OverlayWidgets */
);
this._domNode.setClassName("overlayWidgets");
this.overflowingOverlayWidgetsDomNode = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this.overflowingOverlayWidgetsDomNode,
5
/* PartFingerprint.OverflowingOverlayWidgets */
);
this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets");
}
dispose() {
super.dispose();
this._widgets = {};
}
getDomNode() {
return this._domNode;
}
// ---- begin view event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
this._minimapWidth = layoutInfo.minimap.minimapWidth;
this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
this._editorHeight = layoutInfo.height;
this._editorWidth = layoutInfo.width;
return true;
}
// ---- end view event handlers
addWidget(widget) {
const domNode = createFastDomNode(widget.getDomNode());
this._widgets[widget.getId()] = {
widget,
preference: null,
domNode
};
domNode.setPosition("absolute");
domNode.setAttribute("widgetId", widget.getId());
if (widget.allowEditorOverflow) {
this.overflowingOverlayWidgetsDomNode.appendChild(domNode);
} else {
this._domNode.appendChild(domNode);
}
this.setShouldRender();
this._updateMaxMinWidth();
}
setWidgetPosition(widget, position) {
const widgetData = this._widgets[widget.getId()];
const preference = position ? position.preference : null;
const stack = position === null || position === void 0 ? void 0 : position.stackOridinal;
if (widgetData.preference === preference && widgetData.stack === stack) {
this._updateMaxMinWidth();
return false;
}
widgetData.preference = preference;
widgetData.stack = stack;
this.setShouldRender();
this._updateMaxMinWidth();
return true;
}
removeWidget(widget) {
const widgetId = widget.getId();
if (this._widgets.hasOwnProperty(widgetId)) {
const widgetData = this._widgets[widgetId];
const domNode = widgetData.domNode.domNode;
delete this._widgets[widgetId];
domNode.remove();
this.setShouldRender();
this._updateMaxMinWidth();
}
}
_updateMaxMinWidth() {
var _a10, _b4;
let maxMinWidth = 0;
const keys = Object.keys(this._widgets);
for (let i = 0, len = keys.length; i < len; i++) {
const widgetId = keys[i];
const widget = this._widgets[widgetId];
const widgetMinWidthInPx = (_b4 = (_a10 = widget.widget).getMinContentWidthInPx) === null || _b4 === void 0 ? void 0 : _b4.call(_a10);
if (typeof widgetMinWidthInPx !== "undefined") {
maxMinWidth = Math.max(maxMinWidth, widgetMinWidthInPx);
}
}
this._context.viewLayout.setOverlayWidgetsMinWidth(maxMinWidth);
}
_renderWidget(widgetData, stackCoordinates) {
const domNode = widgetData.domNode;
if (widgetData.preference === null) {
domNode.setTop("");
return;
}
const maxRight = 2 * this._verticalScrollbarWidth + this._minimapWidth;
if (widgetData.preference === 0 || widgetData.preference === 1) {
if (widgetData.preference === 1) {
const widgetHeight = domNode.domNode.clientHeight;
domNode.setTop(this._editorHeight - widgetHeight - 2 * this._horizontalScrollbarHeight);
} else {
domNode.setTop(0);
}
if (widgetData.stack !== void 0) {
domNode.setTop(stackCoordinates[widgetData.preference]);
stackCoordinates[widgetData.preference] += domNode.domNode.clientWidth;
} else {
domNode.setRight(maxRight);
}
} else if (widgetData.preference === 2) {
domNode.domNode.style.right = "50%";
if (widgetData.stack !== void 0) {
domNode.setTop(stackCoordinates[
2
/* OverlayWidgetPositionPreference.TOP_CENTER */
]);
stackCoordinates[
2
/* OverlayWidgetPositionPreference.TOP_CENTER */
] += domNode.domNode.clientHeight;
} else {
domNode.setTop(0);
}
} else {
const { top, left } = widgetData.preference;
const fixedOverflowWidgets = this._context.configuration.options.get(
42
/* EditorOption.fixedOverflowWidgets */
);
if (fixedOverflowWidgets && widgetData.widget.allowEditorOverflow) {
const editorBoundingBox = this._viewDomNodeRect;
domNode.setTop(top + editorBoundingBox.top);
domNode.setLeft(left + editorBoundingBox.left);
domNode.setPosition("fixed");
} else {
domNode.setTop(top);
domNode.setLeft(left);
domNode.setPosition("absolute");
}
}
}
prepareRender(ctx) {
this._viewDomNodeRect = getDomNodePagePosition(this._viewDomNode.domNode);
}
render(ctx) {
this._domNode.setWidth(this._editorWidth);
const keys = Object.keys(this._widgets);
const stackCoordinates = Array.from({ length: 2 + 1 }, () => 0);
keys.sort((a3, b) => (this._widgets[a3].stack || 0) - (this._widgets[b].stack || 0));
for (let i = 0, len = keys.length; i < len; i++) {
const widgetId = keys[i];
this._renderWidget(this._widgets[widgetId], stackCoordinates);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js
var Settings, DecorationsOverviewRuler;
var init_decorationsOverviewRuler = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js"() {
init_fastDomNode();
init_color();
init_viewPart();
init_position();
init_languages();
init_editorColorRegistry();
init_viewModel();
init_arrays();
Settings = class {
constructor(config, theme) {
const options2 = config.options;
this.lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this.pixelRatio = options2.get(
143
/* EditorOption.pixelRatio */
);
this.overviewRulerLanes = options2.get(
83
/* EditorOption.overviewRulerLanes */
);
this.renderBorder = options2.get(
82
/* EditorOption.overviewRulerBorder */
);
const borderColor = theme.getColor(editorOverviewRulerBorder);
this.borderColor = borderColor ? borderColor.toString() : null;
this.hideCursor = options2.get(
59
/* EditorOption.hideCursorInOverviewRuler */
);
const cursorColorSingle = theme.getColor(editorCursorForeground);
this.cursorColorSingle = cursorColorSingle ? cursorColorSingle.transparent(0.7).toString() : null;
const cursorColorPrimary = theme.getColor(editorMultiCursorPrimaryForeground);
this.cursorColorPrimary = cursorColorPrimary ? cursorColorPrimary.transparent(0.7).toString() : null;
const cursorColorSecondary = theme.getColor(editorMultiCursorSecondaryForeground);
this.cursorColorSecondary = cursorColorSecondary ? cursorColorSecondary.transparent(0.7).toString() : null;
this.themeType = theme.type;
const minimapOpts = options2.get(
73
/* EditorOption.minimap */
);
const minimapEnabled = minimapOpts.enabled;
const minimapSide = minimapOpts.side;
const themeColor = theme.getColor(editorOverviewRulerBackground);
const defaultBackground = TokenizationRegistry2.getDefaultBackground();
if (themeColor) {
this.backgroundColor = themeColor;
} else if (minimapEnabled && minimapSide === "right") {
this.backgroundColor = defaultBackground;
} else {
this.backgroundColor = null;
}
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const position = layoutInfo.overviewRuler;
this.top = position.top;
this.right = position.right;
this.domWidth = position.width;
this.domHeight = position.height;
if (this.overviewRulerLanes === 0) {
this.canvasWidth = 0;
this.canvasHeight = 0;
} else {
this.canvasWidth = this.domWidth * this.pixelRatio | 0;
this.canvasHeight = this.domHeight * this.pixelRatio | 0;
}
const [x, w] = this._initLanes(1, this.canvasWidth, this.overviewRulerLanes);
this.x = x;
this.w = w;
}
_initLanes(canvasLeftOffset, canvasWidth, laneCount) {
const remainingWidth = canvasWidth - canvasLeftOffset;
if (laneCount >= 3) {
const leftWidth = Math.floor(remainingWidth / 3);
const rightWidth = Math.floor(remainingWidth / 3);
const centerWidth = remainingWidth - leftWidth - rightWidth;
const leftOffset = canvasLeftOffset;
const centerOffset = leftOffset + leftWidth;
const rightOffset = leftOffset + leftWidth + centerWidth;
return [
[
0,
leftOffset,
// Left
centerOffset,
// Center
leftOffset,
// Left | Center
rightOffset,
// Right
leftOffset,
// Left | Right
centerOffset,
// Center | Right
leftOffset
// Left | Center | Right
],
[
0,
leftWidth,
// Left
centerWidth,
// Center
leftWidth + centerWidth,
// Left | Center
rightWidth,
// Right
leftWidth + centerWidth + rightWidth,
// Left | Right
centerWidth + rightWidth,
// Center | Right
leftWidth + centerWidth + rightWidth
// Left | Center | Right
]
];
} else if (laneCount === 2) {
const leftWidth = Math.floor(remainingWidth / 2);
const rightWidth = remainingWidth - leftWidth;
const leftOffset = canvasLeftOffset;
const rightOffset = leftOffset + leftWidth;
return [
[
0,
leftOffset,
// Left
leftOffset,
// Center
leftOffset,
// Left | Center
rightOffset,
// Right
leftOffset,
// Left | Right
leftOffset,
// Center | Right
leftOffset
// Left | Center | Right
],
[
0,
leftWidth,
// Left
leftWidth,
// Center
leftWidth,
// Left | Center
rightWidth,
// Right
leftWidth + rightWidth,
// Left | Right
leftWidth + rightWidth,
// Center | Right
leftWidth + rightWidth
// Left | Center | Right
]
];
} else {
const offset = canvasLeftOffset;
const width2 = remainingWidth;
return [
[
0,
offset,
// Left
offset,
// Center
offset,
// Left | Center
offset,
// Right
offset,
// Left | Right
offset,
// Center | Right
offset
// Left | Center | Right
],
[
0,
width2,
// Left
width2,
// Center
width2,
// Left | Center
width2,
// Right
width2,
// Left | Right
width2,
// Center | Right
width2
// Left | Center | Right
]
];
}
}
equals(other) {
return this.lineHeight === other.lineHeight && this.pixelRatio === other.pixelRatio && this.overviewRulerLanes === other.overviewRulerLanes && this.renderBorder === other.renderBorder && this.borderColor === other.borderColor && this.hideCursor === other.hideCursor && this.cursorColorSingle === other.cursorColorSingle && this.cursorColorPrimary === other.cursorColorPrimary && this.cursorColorSecondary === other.cursorColorSecondary && this.themeType === other.themeType && Color.equals(this.backgroundColor, other.backgroundColor) && this.top === other.top && this.right === other.right && this.domWidth === other.domWidth && this.domHeight === other.domHeight && this.canvasWidth === other.canvasWidth && this.canvasHeight === other.canvasHeight;
}
};
DecorationsOverviewRuler = class extends ViewPart {
constructor(context) {
super(context);
this._actualShouldRender = 0;
this._renderedDecorations = [];
this._renderedCursorPositions = [];
this._domNode = createFastDomNode(document.createElement("canvas"));
this._domNode.setClassName("decorationsOverviewRuler");
this._domNode.setPosition("absolute");
this._domNode.setLayerHinting(true);
this._domNode.setContain("strict");
this._domNode.setAttribute("aria-hidden", "true");
this._updateSettings(false);
this._tokensColorTrackerListener = TokenizationRegistry2.onDidChange((e) => {
if (e.changedColorMap) {
this._updateSettings(true);
}
});
this._cursorPositions = [{ position: new Position(1, 1), color: this._settings.cursorColorSingle }];
}
dispose() {
super.dispose();
this._tokensColorTrackerListener.dispose();
}
_updateSettings(renderNow) {
const newSettings = new Settings(this._context.configuration, this._context.theme);
if (this._settings && this._settings.equals(newSettings)) {
return false;
}
this._settings = newSettings;
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;
if (renderNow) {
this._render();
}
return true;
}
// ---- begin view event handlers
_markRenderingIsNeeded() {
this._actualShouldRender = 2;
return true;
}
_markRenderingIsMaybeNeeded() {
this._actualShouldRender = 1;
return true;
}
onConfigurationChanged(e) {
return this._updateSettings(false) ? this._markRenderingIsNeeded() : false;
}
onCursorStateChanged(e) {
this._cursorPositions = [];
for (let i = 0, len = e.selections.length; i < len; i++) {
let color = this._settings.cursorColorSingle;
if (len > 1) {
color = i === 0 ? this._settings.cursorColorPrimary : this._settings.cursorColorSecondary;
}
this._cursorPositions.push({ position: e.selections[i].getPosition(), color });
}
this._cursorPositions.sort((a3, b) => Position.compare(a3.position, b.position));
return this._markRenderingIsMaybeNeeded();
}
onDecorationsChanged(e) {
if (e.affectsOverviewRuler) {
return this._markRenderingIsMaybeNeeded();
}
return false;
}
onFlushed(e) {
return this._markRenderingIsNeeded();
}
onScrollChanged(e) {
return e.scrollHeightChanged ? this._markRenderingIsNeeded() : false;
}
onZonesChanged(e) {
return this._markRenderingIsNeeded();
}
onThemeChanged(e) {
return this._updateSettings(false) ? this._markRenderingIsNeeded() : false;
}
// ---- end view event handlers
getDomNode() {
return this._domNode.domNode;
}
prepareRender(ctx) {
}
render(editorCtx) {
this._render();
this._actualShouldRender = 0;
}
_render() {
const backgroundColor = this._settings.backgroundColor;
if (this._settings.overviewRulerLanes === 0) {
this._domNode.setBackgroundColor(backgroundColor ? Color.Format.CSS.formatHexA(backgroundColor) : "");
this._domNode.setDisplay("none");
return;
}
const decorations = this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);
decorations.sort(OverviewRulerDecorationsGroup.compareByRenderingProps);
if (this._actualShouldRender === 1 && !OverviewRulerDecorationsGroup.equalsArr(this._renderedDecorations, decorations)) {
this._actualShouldRender = 2;
}
if (this._actualShouldRender === 1 && !equals(this._renderedCursorPositions, this._cursorPositions, (a3, b) => a3.position.lineNumber === b.position.lineNumber && a3.color === b.color)) {
this._actualShouldRender = 2;
}
if (this._actualShouldRender === 1) {
return;
}
this._renderedDecorations = decorations;
this._renderedCursorPositions = this._cursorPositions;
this._domNode.setDisplay("block");
const canvasWidth = this._settings.canvasWidth;
const canvasHeight = this._settings.canvasHeight;
const lineHeight = this._settings.lineHeight;
const viewLayout = this._context.viewLayout;
const outerHeight = this._context.viewLayout.getScrollHeight();
const heightRatio = canvasHeight / outerHeight;
const minDecorationHeight = 6 * this._settings.pixelRatio | 0;
const halfMinDecorationHeight = minDecorationHeight / 2 | 0;
const canvasCtx = this._domNode.domNode.getContext("2d");
if (backgroundColor) {
if (backgroundColor.isOpaque()) {
canvasCtx.fillStyle = Color.Format.CSS.formatHexA(backgroundColor);
canvasCtx.fillRect(0, 0, canvasWidth, canvasHeight);
} else {
canvasCtx.clearRect(0, 0, canvasWidth, canvasHeight);
canvasCtx.fillStyle = Color.Format.CSS.formatHexA(backgroundColor);
canvasCtx.fillRect(0, 0, canvasWidth, canvasHeight);
}
} else {
canvasCtx.clearRect(0, 0, canvasWidth, canvasHeight);
}
const x = this._settings.x;
const w = this._settings.w;
for (const decorationGroup of decorations) {
const color = decorationGroup.color;
const decorationGroupData = decorationGroup.data;
canvasCtx.fillStyle = color;
let prevLane = 0;
let prevY1 = 0;
let prevY2 = 0;
for (let i = 0, len = decorationGroupData.length / 3; i < len; i++) {
const lane = decorationGroupData[3 * i];
const startLineNumber = decorationGroupData[3 * i + 1];
const endLineNumber = decorationGroupData[3 * i + 2];
let y1 = viewLayout.getVerticalOffsetForLineNumber(startLineNumber) * heightRatio | 0;
let y2 = (viewLayout.getVerticalOffsetForLineNumber(endLineNumber) + lineHeight) * heightRatio | 0;
const height = y2 - y1;
if (height < minDecorationHeight) {
let yCenter = (y1 + y2) / 2 | 0;
if (yCenter < halfMinDecorationHeight) {
yCenter = halfMinDecorationHeight;
} else if (yCenter + halfMinDecorationHeight > canvasHeight) {
yCenter = canvasHeight - halfMinDecorationHeight;
}
y1 = yCenter - halfMinDecorationHeight;
y2 = yCenter + halfMinDecorationHeight;
}
if (y1 > prevY2 + 1 || lane !== prevLane) {
if (i !== 0) {
canvasCtx.fillRect(x[prevLane], prevY1, w[prevLane], prevY2 - prevY1);
}
prevLane = lane;
prevY1 = y1;
prevY2 = y2;
} else {
if (y2 > prevY2) {
prevY2 = y2;
}
}
}
canvasCtx.fillRect(x[prevLane], prevY1, w[prevLane], prevY2 - prevY1);
}
if (!this._settings.hideCursor) {
const cursorHeight = 2 * this._settings.pixelRatio | 0;
const halfCursorHeight = cursorHeight / 2 | 0;
const cursorX = this._settings.x[
7
/* OverviewRulerLane.Full */
];
const cursorW = this._settings.w[
7
/* OverviewRulerLane.Full */
];
let prevY1 = -100;
let prevY2 = -100;
let prevColor = null;
for (let i = 0, len = this._cursorPositions.length; i < len; i++) {
const color = this._cursorPositions[i].color;
if (!color) {
continue;
}
const cursor = this._cursorPositions[i].position;
let yCenter = viewLayout.getVerticalOffsetForLineNumber(cursor.lineNumber) * heightRatio | 0;
if (yCenter < halfCursorHeight) {
yCenter = halfCursorHeight;
} else if (yCenter + halfCursorHeight > canvasHeight) {
yCenter = canvasHeight - halfCursorHeight;
}
const y1 = yCenter - halfCursorHeight;
const y2 = y1 + cursorHeight;
if (y1 > prevY2 + 1 || color !== prevColor) {
if (i !== 0 && prevColor) {
canvasCtx.fillRect(cursorX, prevY1, cursorW, prevY2 - prevY1);
}
prevY1 = y1;
prevY2 = y2;
} else {
if (y2 > prevY2) {
prevY2 = y2;
}
}
prevColor = color;
canvasCtx.fillStyle = color;
}
if (prevColor) {
canvasCtx.fillRect(cursorX, prevY1, cursorW, prevY2 - prevY1);
}
}
if (this._settings.renderBorder && this._settings.borderColor && this._settings.overviewRulerLanes > 0) {
canvasCtx.beginPath();
canvasCtx.lineWidth = 1;
canvasCtx.strokeStyle = this._settings.borderColor;
canvasCtx.moveTo(0, 0);
canvasCtx.lineTo(0, canvasHeight);
canvasCtx.stroke();
canvasCtx.moveTo(0, 0);
canvasCtx.lineTo(canvasWidth, 0);
canvasCtx.stroke();
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/overviewZoneManager.js
var ColorZone, OverviewRulerZone, OverviewZoneManager;
var init_overviewZoneManager = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/overviewZoneManager.js"() {
ColorZone = class {
constructor(from, to, colorId) {
this._colorZoneBrand = void 0;
this.from = from | 0;
this.to = to | 0;
this.colorId = colorId | 0;
}
static compare(a3, b) {
if (a3.colorId === b.colorId) {
if (a3.from === b.from) {
return a3.to - b.to;
}
return a3.from - b.from;
}
return a3.colorId - b.colorId;
}
};
OverviewRulerZone = class {
constructor(startLineNumber, endLineNumber, heightInLines, color) {
this._overviewRulerZoneBrand = void 0;
this.startLineNumber = startLineNumber;
this.endLineNumber = endLineNumber;
this.heightInLines = heightInLines;
this.color = color;
this._colorZone = null;
}
static compare(a3, b) {
if (a3.color === b.color) {
if (a3.startLineNumber === b.startLineNumber) {
if (a3.heightInLines === b.heightInLines) {
return a3.endLineNumber - b.endLineNumber;
}
return a3.heightInLines - b.heightInLines;
}
return a3.startLineNumber - b.startLineNumber;
}
return a3.color < b.color ? -1 : 1;
}
setColorZone(colorZone) {
this._colorZone = colorZone;
}
getColorZones() {
return this._colorZone;
}
};
OverviewZoneManager = class {
constructor(getVerticalOffsetForLine) {
this._getVerticalOffsetForLine = getVerticalOffsetForLine;
this._zones = [];
this._colorZonesInvalid = false;
this._lineHeight = 0;
this._domWidth = 0;
this._domHeight = 0;
this._outerHeight = 0;
this._pixelRatio = 1;
this._lastAssignedId = 0;
this._color2Id = /* @__PURE__ */ Object.create(null);
this._id2Color = [];
}
getId2Color() {
return this._id2Color;
}
setZones(newZones) {
this._zones = newZones;
this._zones.sort(OverviewRulerZone.compare);
}
setLineHeight(lineHeight) {
if (this._lineHeight === lineHeight) {
return false;
}
this._lineHeight = lineHeight;
this._colorZonesInvalid = true;
return true;
}
setPixelRatio(pixelRatio) {
this._pixelRatio = pixelRatio;
this._colorZonesInvalid = true;
}
getDOMWidth() {
return this._domWidth;
}
getCanvasWidth() {
return this._domWidth * this._pixelRatio;
}
setDOMWidth(width2) {
if (this._domWidth === width2) {
return false;
}
this._domWidth = width2;
this._colorZonesInvalid = true;
return true;
}
getDOMHeight() {
return this._domHeight;
}
getCanvasHeight() {
return this._domHeight * this._pixelRatio;
}
setDOMHeight(height) {
if (this._domHeight === height) {
return false;
}
this._domHeight = height;
this._colorZonesInvalid = true;
return true;
}
getOuterHeight() {
return this._outerHeight;
}
setOuterHeight(outerHeight) {
if (this._outerHeight === outerHeight) {
return false;
}
this._outerHeight = outerHeight;
this._colorZonesInvalid = true;
return true;
}
resolveColorZones() {
const colorZonesInvalid = this._colorZonesInvalid;
const lineHeight = Math.floor(this._lineHeight);
const totalHeight = Math.floor(this.getCanvasHeight());
const outerHeight = Math.floor(this._outerHeight);
const heightRatio = totalHeight / outerHeight;
const halfMinimumHeight = Math.floor(4 * this._pixelRatio / 2);
const allColorZones = [];
for (let i = 0, len = this._zones.length; i < len; i++) {
const zone = this._zones[i];
if (!colorZonesInvalid) {
const colorZone2 = zone.getColorZones();
if (colorZone2) {
allColorZones.push(colorZone2);
continue;
}
}
const offset1 = this._getVerticalOffsetForLine(zone.startLineNumber);
const offset2 = zone.heightInLines === 0 ? this._getVerticalOffsetForLine(zone.endLineNumber) + lineHeight : offset1 + zone.heightInLines * lineHeight;
const y1 = Math.floor(heightRatio * offset1);
const y2 = Math.floor(heightRatio * offset2);
let ycenter = Math.floor((y1 + y2) / 2);
let halfHeight = y2 - ycenter;
if (halfHeight < halfMinimumHeight) {
halfHeight = halfMinimumHeight;
}
if (ycenter - halfHeight < 0) {
ycenter = halfHeight;
}
if (ycenter + halfHeight > totalHeight) {
ycenter = totalHeight - halfHeight;
}
const color = zone.color;
let colorId = this._color2Id[color];
if (!colorId) {
colorId = ++this._lastAssignedId;
this._color2Id[color] = colorId;
this._id2Color[colorId] = color;
}
const colorZone = new ColorZone(ycenter - halfHeight, ycenter + halfHeight, colorId);
zone.setColorZone(colorZone);
allColorZones.push(colorZone);
}
this._colorZonesInvalid = false;
allColorZones.sort(ColorZone.compare);
return allColorZones;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js
var OverviewRuler;
var init_overviewRuler = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js"() {
init_fastDomNode();
init_overviewZoneManager();
init_viewEventHandler();
OverviewRuler = class extends ViewEventHandler {
constructor(context, cssClassName) {
super();
this._context = context;
const options2 = this._context.configuration.options;
this._domNode = createFastDomNode(document.createElement("canvas"));
this._domNode.setClassName(cssClassName);
this._domNode.setPosition("absolute");
this._domNode.setLayerHinting(true);
this._domNode.setContain("strict");
this._zoneManager = new OverviewZoneManager((lineNumber) => this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber));
this._zoneManager.setDOMWidth(0);
this._zoneManager.setDOMHeight(0);
this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight());
this._zoneManager.setLineHeight(options2.get(
67
/* EditorOption.lineHeight */
));
this._zoneManager.setPixelRatio(options2.get(
143
/* EditorOption.pixelRatio */
));
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
super.dispose();
}
// ---- begin view event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
if (e.hasChanged(
67
/* EditorOption.lineHeight */
)) {
this._zoneManager.setLineHeight(options2.get(
67
/* EditorOption.lineHeight */
));
this._render();
}
if (e.hasChanged(
143
/* EditorOption.pixelRatio */
)) {
this._zoneManager.setPixelRatio(options2.get(
143
/* EditorOption.pixelRatio */
));
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();
}
return true;
}
onFlushed(e) {
this._render();
return true;
}
onScrollChanged(e) {
if (e.scrollHeightChanged) {
this._zoneManager.setOuterHeight(e.scrollHeight);
this._render();
}
return true;
}
onZonesChanged(e) {
this._render();
return true;
}
// ---- end view event handlers
getDomNode() {
return this._domNode.domNode;
}
setLayout(position) {
this._domNode.setTop(position.top);
this._domNode.setRight(position.right);
let hasChanged = false;
hasChanged = this._zoneManager.setDOMWidth(position.width) || hasChanged;
hasChanged = this._zoneManager.setDOMHeight(position.height) || hasChanged;
if (hasChanged) {
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(zones) {
this._zoneManager.setZones(zones);
this._render();
}
_render() {
if (this._zoneManager.getOuterHeight() === 0) {
return false;
}
const width2 = this._zoneManager.getCanvasWidth();
const height = this._zoneManager.getCanvasHeight();
const colorZones = this._zoneManager.resolveColorZones();
const id2Color = this._zoneManager.getId2Color();
const ctx = this._domNode.domNode.getContext("2d");
ctx.clearRect(0, 0, width2, height);
if (colorZones.length > 0) {
this._renderOneLane(ctx, colorZones, id2Color, width2);
}
return true;
}
_renderOneLane(ctx, colorZones, id2Color, width2) {
let currentColorId = 0;
let currentFrom = 0;
let currentTo = 0;
for (const zone of colorZones) {
const zoneColorId = zone.colorId;
const zoneFrom = zone.from;
const zoneTo = zone.to;
if (zoneColorId !== currentColorId) {
ctx.fillRect(0, currentFrom, width2, currentTo - currentFrom);
currentColorId = zoneColorId;
ctx.fillStyle = id2Color[currentColorId];
currentFrom = zoneFrom;
currentTo = zoneTo;
} else {
if (currentTo >= zoneFrom) {
currentTo = Math.max(currentTo, zoneTo);
} else {
ctx.fillRect(0, currentFrom, width2, currentTo - currentFrom);
currentFrom = zoneFrom;
currentTo = zoneTo;
}
}
}
ctx.fillRect(0, currentFrom, width2, currentTo - currentFrom);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.css
var init_rulers = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.js
var Rulers;
var init_rulers2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.js"() {
init_rulers();
init_fastDomNode();
init_viewPart();
Rulers = class extends ViewPart {
constructor(context) {
super(context);
this.domNode = createFastDomNode(document.createElement("div"));
this.domNode.setAttribute("role", "presentation");
this.domNode.setAttribute("aria-hidden", "true");
this.domNode.setClassName("view-rulers");
this._renderedRulers = [];
const options2 = this._context.configuration.options;
this._rulers = options2.get(
102
/* EditorOption.rulers */
);
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
}
dispose() {
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
this._rulers = options2.get(
102
/* EditorOption.rulers */
);
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
return true;
}
onScrollChanged(e) {
return e.scrollHeightChanged;
}
// --- end event handlers
prepareRender(ctx) {
}
_ensureRulersCount() {
const currentCount = this._renderedRulers.length;
const desiredCount = this._rulers.length;
if (currentCount === desiredCount) {
return;
}
if (currentCount < desiredCount) {
const { tabSize } = this._context.viewModel.model.getOptions();
const rulerWidth = tabSize;
let addCount = desiredCount - currentCount;
while (addCount > 0) {
const node = createFastDomNode(document.createElement("div"));
node.setClassName("view-ruler");
node.setWidth(rulerWidth);
this.domNode.appendChild(node);
this._renderedRulers.push(node);
addCount--;
}
return;
}
let removeCount = currentCount - desiredCount;
while (removeCount > 0) {
const node = this._renderedRulers.pop();
this.domNode.removeChild(node);
removeCount--;
}
}
render(ctx) {
this._ensureRulersCount();
for (let i = 0, len = this._rulers.length; i < len; i++) {
const node = this._renderedRulers[i];
const ruler = this._rulers[i];
node.setBoxShadow(ruler.color ? `1px 0 0 0 ${ruler.color} inset` : ``);
node.setHeight(Math.min(ctx.scrollHeight, 1e6));
node.setLeft(ruler.column * this._typicalHalfwidthCharacterWidth);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.css
var init_scrollDecoration = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js
var ScrollDecorationViewPart;
var init_scrollDecoration2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js"() {
init_scrollDecoration();
init_fastDomNode();
init_viewPart();
ScrollDecorationViewPart = class extends ViewPart {
constructor(context) {
super(context);
this._scrollTop = 0;
this._width = 0;
this._updateWidth();
this._shouldShow = false;
const options2 = this._context.configuration.options;
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
this._useShadows = scrollbar.useShadows;
this._domNode = createFastDomNode(document.createElement("div"));
this._domNode.setAttribute("role", "presentation");
this._domNode.setAttribute("aria-hidden", "true");
}
dispose() {
super.dispose();
}
_updateShouldShow() {
const newShouldShow = this._useShadows && this._scrollTop > 0;
if (this._shouldShow !== newShouldShow) {
this._shouldShow = newShouldShow;
return true;
}
return false;
}
getDomNode() {
return this._domNode;
}
_updateWidth() {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
if (layoutInfo.minimap.renderMinimap === 0 || layoutInfo.minimap.minimapWidth > 0 && layoutInfo.minimap.minimapLeft === 0) {
this._width = layoutInfo.width;
} else {
this._width = layoutInfo.width - layoutInfo.verticalScrollbarWidth;
}
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
this._useShadows = scrollbar.useShadows;
this._updateWidth();
this._updateShouldShow();
return true;
}
onScrollChanged(e) {
this._scrollTop = e.scrollTop;
return this._updateShouldShow();
}
// --- end event handlers
prepareRender(ctx) {
}
render(ctx) {
this._domNode.setWidth(this._width);
this._domNode.setClassName(this._shouldShow ? "scroll-decoration" : "");
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.css
var init_selections = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.js
function toStyledRange(item) {
return new HorizontalRangeWithStyle(item);
}
function toStyled(item) {
return new LineVisibleRangesWithStyle(item.lineNumber, item.ranges.map(toStyledRange));
}
function abs(n) {
return n < 0 ? -n : n;
}
var HorizontalRangeWithStyle, LineVisibleRangesWithStyle, SelectionsOverlay;
var init_selections2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.js"() {
init_selections();
init_dynamicViewOverlay();
init_colorRegistry();
init_themeService();
HorizontalRangeWithStyle = class {
constructor(other) {
this.left = other.left;
this.width = other.width;
this.startStyle = null;
this.endStyle = null;
}
};
LineVisibleRangesWithStyle = class {
constructor(lineNumber, ranges) {
this.lineNumber = lineNumber;
this.ranges = ranges;
}
};
SelectionsOverlay = class _SelectionsOverlay extends DynamicViewOverlay {
constructor(context) {
super();
this._previousFrameVisibleRangesWithStyle = [];
this._context = context;
const options2 = this._context.configuration.options;
this._roundedSelection = options2.get(
101
/* EditorOption.roundedSelection */
);
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
this._selections = [];
this._renderResult = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
this._roundedSelection = options2.get(
101
/* EditorOption.roundedSelection */
);
this._typicalHalfwidthCharacterWidth = options2.get(
50
/* EditorOption.fontInfo */
).typicalHalfwidthCharacterWidth;
return true;
}
onCursorStateChanged(e) {
this._selections = e.selections.slice(0);
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
_visibleRangesHaveGaps(linesVisibleRanges) {
for (let i = 0, len = linesVisibleRanges.length; i < len; i++) {
const lineVisibleRanges = linesVisibleRanges[i];
if (lineVisibleRanges.ranges.length > 1) {
return true;
}
}
return false;
}
_enrichVisibleRangesWithStyle(viewport, linesVisibleRanges, previousFrame) {
const epsilon = this._typicalHalfwidthCharacterWidth / 4;
let previousFrameTop = null;
let previousFrameBottom = null;
if (previousFrame && previousFrame.length > 0 && linesVisibleRanges.length > 0) {
const topLineNumber = linesVisibleRanges[0].lineNumber;
if (topLineNumber === viewport.startLineNumber) {
for (let i = 0; !previousFrameTop && i < previousFrame.length; i++) {
if (previousFrame[i].lineNumber === topLineNumber) {
previousFrameTop = previousFrame[i].ranges[0];
}
}
}
const bottomLineNumber = linesVisibleRanges[linesVisibleRanges.length - 1].lineNumber;
if (bottomLineNumber === viewport.endLineNumber) {
for (let i = previousFrame.length - 1; !previousFrameBottom && i >= 0; i--) {
if (previousFrame[i].lineNumber === bottomLineNumber) {
previousFrameBottom = previousFrame[i].ranges[0];
}
}
}
if (previousFrameTop && !previousFrameTop.startStyle) {
previousFrameTop = null;
}
if (previousFrameBottom && !previousFrameBottom.startStyle) {
previousFrameBottom = null;
}
}
for (let i = 0, len = linesVisibleRanges.length; i < len; i++) {
const curLineRange = linesVisibleRanges[i].ranges[0];
const curLeft = curLineRange.left;
const curRight = curLineRange.left + curLineRange.width;
const startStyle = {
top: 0,
bottom: 0
/* CornerStyle.EXTERN */
};
const endStyle = {
top: 0,
bottom: 0
/* CornerStyle.EXTERN */
};
if (i > 0) {
const prevLeft = linesVisibleRanges[i - 1].ranges[0].left;
const prevRight = linesVisibleRanges[i - 1].ranges[0].left + linesVisibleRanges[i - 1].ranges[0].width;
if (abs(curLeft - prevLeft) < epsilon) {
startStyle.top = 2;
} else if (curLeft > prevLeft) {
startStyle.top = 1;
}
if (abs(curRight - prevRight) < epsilon) {
endStyle.top = 2;
} else if (prevLeft < curRight && curRight < prevRight) {
endStyle.top = 1;
}
} else if (previousFrameTop) {
startStyle.top = previousFrameTop.startStyle.top;
endStyle.top = previousFrameTop.endStyle.top;
}
if (i + 1 < len) {
const nextLeft = linesVisibleRanges[i + 1].ranges[0].left;
const nextRight = linesVisibleRanges[i + 1].ranges[0].left + linesVisibleRanges[i + 1].ranges[0].width;
if (abs(curLeft - nextLeft) < epsilon) {
startStyle.bottom = 2;
} else if (nextLeft < curLeft && curLeft < nextRight) {
startStyle.bottom = 1;
}
if (abs(curRight - nextRight) < epsilon) {
endStyle.bottom = 2;
} else if (curRight < nextRight) {
endStyle.bottom = 1;
}
} else if (previousFrameBottom) {
startStyle.bottom = previousFrameBottom.startStyle.bottom;
endStyle.bottom = previousFrameBottom.endStyle.bottom;
}
curLineRange.startStyle = startStyle;
curLineRange.endStyle = endStyle;
}
}
_getVisibleRangesWithStyle(selection, ctx, previousFrame) {
const _linesVisibleRanges = ctx.linesVisibleRangesForRange(selection, true) || [];
const linesVisibleRanges = _linesVisibleRanges.map(toStyled);
const visibleRangesHaveGaps = this._visibleRangesHaveGaps(linesVisibleRanges);
if (!visibleRangesHaveGaps && this._roundedSelection) {
this._enrichVisibleRangesWithStyle(ctx.visibleRange, linesVisibleRanges, previousFrame);
}
return linesVisibleRanges;
}
_createSelectionPiece(top, bottom, className, left, width2) {
return '';
}
_actualRenderOneSelection(output2, visibleStartLineNumber, hasMultipleSelections, visibleRanges) {
if (visibleRanges.length === 0) {
return;
}
const visibleRangesHaveStyle = !!visibleRanges[0].ranges[0].startStyle;
const firstLineNumber = visibleRanges[0].lineNumber;
const lastLineNumber = visibleRanges[visibleRanges.length - 1].lineNumber;
for (let i = 0, len = visibleRanges.length; i < len; i++) {
const lineVisibleRanges = visibleRanges[i];
const lineNumber = lineVisibleRanges.lineNumber;
const lineIndex = lineNumber - visibleStartLineNumber;
const top = hasMultipleSelections ? lineNumber === firstLineNumber ? 1 : 0 : 0;
const bottom = hasMultipleSelections ? lineNumber !== firstLineNumber && lineNumber === lastLineNumber ? 1 : 0 : 0;
let innerCornerOutput = "";
let restOfSelectionOutput = "";
for (let j = 0, lenJ = lineVisibleRanges.ranges.length; j < lenJ; j++) {
const visibleRange = lineVisibleRanges.ranges[j];
if (visibleRangesHaveStyle) {
const startStyle = visibleRange.startStyle;
const endStyle = visibleRange.endStyle;
if (startStyle.top === 1 || startStyle.bottom === 1) {
innerCornerOutput += this._createSelectionPiece(top, bottom, _SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left - _SelectionsOverlay.ROUNDED_PIECE_WIDTH, _SelectionsOverlay.ROUNDED_PIECE_WIDTH);
let className2 = _SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME;
if (startStyle.top === 1) {
className2 += " " + _SelectionsOverlay.SELECTION_TOP_RIGHT;
}
if (startStyle.bottom === 1) {
className2 += " " + _SelectionsOverlay.SELECTION_BOTTOM_RIGHT;
}
innerCornerOutput += this._createSelectionPiece(top, bottom, className2, visibleRange.left - _SelectionsOverlay.ROUNDED_PIECE_WIDTH, _SelectionsOverlay.ROUNDED_PIECE_WIDTH);
}
if (endStyle.top === 1 || endStyle.bottom === 1) {
innerCornerOutput += this._createSelectionPiece(top, bottom, _SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left + visibleRange.width, _SelectionsOverlay.ROUNDED_PIECE_WIDTH);
let className2 = _SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME;
if (endStyle.top === 1) {
className2 += " " + _SelectionsOverlay.SELECTION_TOP_LEFT;
}
if (endStyle.bottom === 1) {
className2 += " " + _SelectionsOverlay.SELECTION_BOTTOM_LEFT;
}
innerCornerOutput += this._createSelectionPiece(top, bottom, className2, visibleRange.left + visibleRange.width, _SelectionsOverlay.ROUNDED_PIECE_WIDTH);
}
}
let className = _SelectionsOverlay.SELECTION_CLASS_NAME;
if (visibleRangesHaveStyle) {
const startStyle = visibleRange.startStyle;
const endStyle = visibleRange.endStyle;
if (startStyle.top === 0) {
className += " " + _SelectionsOverlay.SELECTION_TOP_LEFT;
}
if (startStyle.bottom === 0) {
className += " " + _SelectionsOverlay.SELECTION_BOTTOM_LEFT;
}
if (endStyle.top === 0) {
className += " " + _SelectionsOverlay.SELECTION_TOP_RIGHT;
}
if (endStyle.bottom === 0) {
className += " " + _SelectionsOverlay.SELECTION_BOTTOM_RIGHT;
}
}
restOfSelectionOutput += this._createSelectionPiece(top, bottom, className, visibleRange.left, visibleRange.width);
}
output2[lineIndex][0] += innerCornerOutput;
output2[lineIndex][1] += restOfSelectionOutput;
}
}
prepareRender(ctx) {
const output = [];
const visibleStartLineNumber = ctx.visibleRange.startLineNumber;
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = ["", ""];
}
const thisFrameVisibleRangesWithStyle = [];
for (let i = 0, len = this._selections.length; i < len; i++) {
const selection = this._selections[i];
if (selection.isEmpty()) {
thisFrameVisibleRangesWithStyle[i] = null;
continue;
}
const visibleRangesWithStyle = this._getVisibleRangesWithStyle(selection, ctx, this._previousFrameVisibleRangesWithStyle[i]);
thisFrameVisibleRangesWithStyle[i] = visibleRangesWithStyle;
this._actualRenderOneSelection(output, visibleStartLineNumber, this._selections.length > 1, visibleRangesWithStyle);
}
this._previousFrameVisibleRangesWithStyle = thisFrameVisibleRangesWithStyle;
this._renderResult = output.map(([internalCorners, restOfSelection]) => internalCorners + restOfSelection);
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return "";
}
return this._renderResult[lineIndex];
}
};
SelectionsOverlay.SELECTION_CLASS_NAME = "selected-text";
SelectionsOverlay.SELECTION_TOP_LEFT = "top-left-radius";
SelectionsOverlay.SELECTION_BOTTOM_LEFT = "bottom-left-radius";
SelectionsOverlay.SELECTION_TOP_RIGHT = "top-right-radius";
SelectionsOverlay.SELECTION_BOTTOM_RIGHT = "bottom-right-radius";
SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME = "monaco-editor-background";
SelectionsOverlay.ROUNDED_PIECE_WIDTH = 10;
registerThemingParticipant((theme, collector) => {
const editorSelectionForegroundColor = theme.getColor(editorSelectionForeground);
if (editorSelectionForegroundColor && !editorSelectionForegroundColor.isTransparent()) {
collector.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${editorSelectionForegroundColor}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.css
var init_viewCursors = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js
var ViewCursorRenderData, CursorPlurality, ViewCursor;
var init_viewCursor = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js"() {
init_dom();
init_fastDomNode();
init_strings();
init_domFontInfo();
init_editorOptions();
init_position();
init_range();
init_mouseCursor2();
ViewCursorRenderData = class {
constructor(top, left, paddingLeft, width2, height, textContent, textContentClassName) {
this.top = top;
this.left = left;
this.paddingLeft = paddingLeft;
this.width = width2;
this.height = height;
this.textContent = textContent;
this.textContentClassName = textContentClassName;
}
};
(function(CursorPlurality2) {
CursorPlurality2[CursorPlurality2["Single"] = 0] = "Single";
CursorPlurality2[CursorPlurality2["MultiPrimary"] = 1] = "MultiPrimary";
CursorPlurality2[CursorPlurality2["MultiSecondary"] = 2] = "MultiSecondary";
})(CursorPlurality || (CursorPlurality = {}));
ViewCursor = class {
constructor(context, plurality) {
this._context = context;
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._cursorStyle = options2.get(
28
/* EditorOption.cursorStyle */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._lineCursorWidth = Math.min(options2.get(
31
/* EditorOption.cursorWidth */
), this._typicalHalfwidthCharacterWidth);
this._isVisible = true;
this._domNode = createFastDomNode(document.createElement("div"));
this._domNode.setClassName(`cursor ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`);
this._domNode.setHeight(this._lineHeight);
this._domNode.setTop(0);
this._domNode.setLeft(0);
applyFontInfo(this._domNode, fontInfo);
this._domNode.setDisplay("none");
this._position = new Position(1, 1);
this._pluralityClass = "";
this.setPlurality(plurality);
this._lastRenderedContent = "";
this._renderData = null;
}
getDomNode() {
return this._domNode;
}
getPosition() {
return this._position;
}
setPlurality(plurality) {
switch (plurality) {
default:
case CursorPlurality.Single:
this._pluralityClass = "";
break;
case CursorPlurality.MultiPrimary:
this._pluralityClass = "cursor-primary";
break;
case CursorPlurality.MultiSecondary:
this._pluralityClass = "cursor-secondary";
break;
}
}
show() {
if (!this._isVisible) {
this._domNode.setVisibility("inherit");
this._isVisible = true;
}
}
hide() {
if (this._isVisible) {
this._domNode.setVisibility("hidden");
this._isVisible = false;
}
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
this._cursorStyle = options2.get(
28
/* EditorOption.cursorStyle */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._lineCursorWidth = Math.min(options2.get(
31
/* EditorOption.cursorWidth */
), this._typicalHalfwidthCharacterWidth);
applyFontInfo(this._domNode, fontInfo);
return true;
}
onCursorPositionChanged(position, pauseAnimation) {
if (pauseAnimation) {
this._domNode.domNode.style.transitionProperty = "none";
} else {
this._domNode.domNode.style.transitionProperty = "";
}
this._position = position;
return true;
}
/**
* If `this._position` is inside a grapheme, returns the position where the grapheme starts.
* Also returns the next grapheme.
*/
_getGraphemeAwarePosition() {
const { lineNumber, column } = this._position;
const lineContent = this._context.viewModel.getLineContent(lineNumber);
const [startOffset, endOffset] = getCharContainingOffset(lineContent, column - 1);
return [new Position(lineNumber, startOffset + 1), lineContent.substring(startOffset, endOffset)];
}
_prepareRender(ctx) {
let textContent = "";
let textContentClassName = "";
const [position, nextGrapheme] = this._getGraphemeAwarePosition();
if (this._cursorStyle === TextEditorCursorStyle.Line || this._cursorStyle === TextEditorCursorStyle.LineThin) {
const visibleRange = ctx.visibleRangeForPosition(position);
if (!visibleRange || visibleRange.outsideRenderedLine) {
return null;
}
const window2 = getWindow(this._domNode.domNode);
let width3;
if (this._cursorStyle === TextEditorCursorStyle.Line) {
width3 = computeScreenAwareSize(window2, this._lineCursorWidth > 0 ? this._lineCursorWidth : 2);
if (width3 > 2) {
textContent = nextGrapheme;
textContentClassName = this._getTokenClassName(position);
}
} else {
width3 = computeScreenAwareSize(window2, 1);
}
let left = visibleRange.left;
let paddingLeft = 0;
if (width3 >= 2 && left >= 1) {
paddingLeft = 1;
left -= paddingLeft;
}
const top2 = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.bigNumbersDelta;
return new ViewCursorRenderData(top2, left, paddingLeft, width3, this._lineHeight, textContent, textContentClassName);
}
const visibleRangeForCharacter = ctx.linesVisibleRangesForRange(new Range(position.lineNumber, position.column, position.lineNumber, position.column + nextGrapheme.length), false);
if (!visibleRangeForCharacter || visibleRangeForCharacter.length === 0) {
return null;
}
const firstVisibleRangeForCharacter = visibleRangeForCharacter[0];
if (firstVisibleRangeForCharacter.outsideRenderedLine || firstVisibleRangeForCharacter.ranges.length === 0) {
return null;
}
const range2 = firstVisibleRangeForCharacter.ranges[0];
const width2 = nextGrapheme === " " ? this._typicalHalfwidthCharacterWidth : range2.width < 1 ? this._typicalHalfwidthCharacterWidth : range2.width;
if (this._cursorStyle === TextEditorCursorStyle.Block) {
textContent = nextGrapheme;
textContentClassName = this._getTokenClassName(position);
}
let top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.bigNumbersDelta;
let height = this._lineHeight;
if (this._cursorStyle === TextEditorCursorStyle.Underline || this._cursorStyle === TextEditorCursorStyle.UnderlineThin) {
top += this._lineHeight - 2;
height = 2;
}
return new ViewCursorRenderData(top, range2.left, 0, width2, height, textContent, textContentClassName);
}
_getTokenClassName(position) {
const lineData = this._context.viewModel.getViewLineData(position.lineNumber);
const tokenIndex = lineData.tokens.findTokenIndexAtOffset(position.column - 1);
return lineData.tokens.getClassName(tokenIndex);
}
prepareRender(ctx) {
this._renderData = this._prepareRender(ctx);
}
render(ctx) {
if (!this._renderData) {
this._domNode.setDisplay("none");
return null;
}
if (this._lastRenderedContent !== this._renderData.textContent) {
this._lastRenderedContent = this._renderData.textContent;
this._domNode.domNode.textContent = this._lastRenderedContent;
}
this._domNode.setClassName(`cursor ${this._pluralityClass} ${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME} ${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);
return {
domNode: this._domNode.domNode,
position: this._position,
contentLeft: this._renderData.left,
height: this._renderData.height,
width: 2
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js
var ViewCursors;
var init_viewCursors2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js"() {
init_viewCursors();
init_fastDomNode();
init_async();
init_viewPart();
init_viewCursor();
init_editorOptions();
init_editorColorRegistry();
init_themeService();
init_theme();
init_dom();
ViewCursors = class _ViewCursors extends ViewPart {
constructor(context) {
super(context);
const options2 = this._context.configuration.options;
this._readOnly = options2.get(
91
/* EditorOption.readOnly */
);
this._cursorBlinking = options2.get(
26
/* EditorOption.cursorBlinking */
);
this._cursorStyle = options2.get(
28
/* EditorOption.cursorStyle */
);
this._cursorSmoothCaretAnimation = options2.get(
27
/* EditorOption.cursorSmoothCaretAnimation */
);
this._selectionIsEmpty = true;
this._isComposingInput = false;
this._isVisible = false;
this._primaryCursor = new ViewCursor(this._context, CursorPlurality.Single);
this._secondaryCursors = [];
this._renderData = [];
this._domNode = createFastDomNode(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 TimeoutTimer();
this._cursorFlatBlinkInterval = new WindowIntervalTimer();
this._blinkingEnabled = false;
this._editorHasFocus = false;
this._updateBlinking();
}
dispose() {
super.dispose();
this._startCursorBlinkAnimation.dispose();
this._cursorFlatBlinkInterval.dispose();
}
getDomNode() {
return this._domNode;
}
// --- begin event handlers
onCompositionStart(e) {
this._isComposingInput = true;
this._updateBlinking();
return true;
}
onCompositionEnd(e) {
this._isComposingInput = false;
this._updateBlinking();
return true;
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
this._readOnly = options2.get(
91
/* EditorOption.readOnly */
);
this._cursorBlinking = options2.get(
26
/* EditorOption.cursorBlinking */
);
this._cursorStyle = options2.get(
28
/* EditorOption.cursorStyle */
);
this._cursorSmoothCaretAnimation = options2.get(
27
/* EditorOption.cursorSmoothCaretAnimation */
);
this._updateBlinking();
this._updateDomClassName();
this._primaryCursor.onConfigurationChanged(e);
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].onConfigurationChanged(e);
}
return true;
}
_onCursorPositionChanged(position, secondaryPositions, reason) {
const pauseAnimation = this._secondaryCursors.length !== secondaryPositions.length || this._cursorSmoothCaretAnimation === "explicit" && reason !== 3;
this._primaryCursor.setPlurality(secondaryPositions.length ? CursorPlurality.MultiPrimary : CursorPlurality.Single);
this._primaryCursor.onCursorPositionChanged(position, pauseAnimation);
this._updateBlinking();
if (this._secondaryCursors.length < secondaryPositions.length) {
const addCnt = secondaryPositions.length - this._secondaryCursors.length;
for (let i = 0; i < addCnt; i++) {
const newCursor = new ViewCursor(this._context, CursorPlurality.MultiSecondary);
this._domNode.domNode.insertBefore(newCursor.getDomNode().domNode, this._primaryCursor.getDomNode().domNode.nextSibling);
this._secondaryCursors.push(newCursor);
}
} else if (this._secondaryCursors.length > secondaryPositions.length) {
const removeCnt = this._secondaryCursors.length - secondaryPositions.length;
for (let i = 0; i < removeCnt; i++) {
this._domNode.removeChild(this._secondaryCursors[0].getDomNode());
this._secondaryCursors.splice(0, 1);
}
}
for (let i = 0; i < secondaryPositions.length; i++) {
this._secondaryCursors[i].onCursorPositionChanged(secondaryPositions[i], pauseAnimation);
}
}
onCursorStateChanged(e) {
const positions = [];
for (let i = 0, len = e.selections.length; i < len; i++) {
positions[i] = e.selections[i].getPosition();
}
this._onCursorPositionChanged(positions[0], positions.slice(1), e.reason);
const selectionIsEmpty = e.selections[0].isEmpty();
if (this._selectionIsEmpty !== selectionIsEmpty) {
this._selectionIsEmpty = selectionIsEmpty;
this._updateDomClassName();
}
return true;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onFocusChanged(e) {
this._editorHasFocus = e.isFocused;
this._updateBlinking();
return false;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return true;
}
onTokensChanged(e) {
const shouldRender = (position) => {
for (let i = 0, len = e.ranges.length; i < len; i++) {
if (e.ranges[i].fromLineNumber <= position.lineNumber && position.lineNumber <= e.ranges[i].toLineNumber) {
return true;
}
}
return false;
};
if (shouldRender(this._primaryCursor.getPosition())) {
return true;
}
for (const secondaryCursor of this._secondaryCursors) {
if (shouldRender(secondaryCursor.getPosition())) {
return true;
}
}
return false;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
// ---- blinking logic
_getCursorBlinking() {
if (this._isComposingInput) {
return 0;
}
if (!this._editorHasFocus) {
return 0;
}
if (this._readOnly) {
return 5;
}
return this._cursorBlinking;
}
_updateBlinking() {
this._startCursorBlinkAnimation.cancel();
this._cursorFlatBlinkInterval.cancel();
const blinkingStyle = this._getCursorBlinking();
const isHidden = blinkingStyle === 0;
const isSolid = blinkingStyle === 5;
if (isHidden) {
this._hide();
} else {
this._show();
}
this._blinkingEnabled = false;
this._updateDomClassName();
if (!isHidden && !isSolid) {
if (blinkingStyle === 1) {
this._cursorFlatBlinkInterval.cancelAndSet(() => {
if (this._isVisible) {
this._hide();
} else {
this._show();
}
}, _ViewCursors.BLINK_INTERVAL, getWindow(this._domNode.domNode));
} else {
this._startCursorBlinkAnimation.setIfNotSet(() => {
this._blinkingEnabled = true;
this._updateDomClassName();
}, _ViewCursors.BLINK_INTERVAL);
}
}
}
// --- end blinking logic
_updateDomClassName() {
this._domNode.setClassName(this._getClassName());
}
_getClassName() {
let result = "cursors-layer";
if (!this._selectionIsEmpty) {
result += " has-selection";
}
switch (this._cursorStyle) {
case TextEditorCursorStyle.Line:
result += " cursor-line-style";
break;
case TextEditorCursorStyle.Block:
result += " cursor-block-style";
break;
case TextEditorCursorStyle.Underline:
result += " cursor-underline-style";
break;
case TextEditorCursorStyle.LineThin:
result += " cursor-line-thin-style";
break;
case TextEditorCursorStyle.BlockOutline:
result += " cursor-block-outline-style";
break;
case TextEditorCursorStyle.UnderlineThin:
result += " cursor-underline-thin-style";
break;
default:
result += " cursor-line-style";
}
if (this._blinkingEnabled) {
switch (this._getCursorBlinking()) {
case 1:
result += " cursor-blink";
break;
case 2:
result += " cursor-smooth";
break;
case 3:
result += " cursor-phase";
break;
case 4:
result += " cursor-expand";
break;
case 5:
result += " cursor-solid";
break;
default:
result += " cursor-solid";
}
} else {
result += " cursor-solid";
}
if (this._cursorSmoothCaretAnimation === "on" || this._cursorSmoothCaretAnimation === "explicit") {
result += " cursor-smooth-caret-animation";
}
return result;
}
_show() {
this._primaryCursor.show();
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].show();
}
this._isVisible = true;
}
_hide() {
this._primaryCursor.hide();
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].hide();
}
this._isVisible = false;
}
// ---- IViewPart implementation
prepareRender(ctx) {
this._primaryCursor.prepareRender(ctx);
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].prepareRender(ctx);
}
}
render(ctx) {
const renderData = [];
let renderDataLen = 0;
const primaryRenderData = this._primaryCursor.render(ctx);
if (primaryRenderData) {
renderData[renderDataLen++] = primaryRenderData;
}
for (let i = 0, len = this._secondaryCursors.length; i < len; i++) {
const secondaryRenderData = this._secondaryCursors[i].render(ctx);
if (secondaryRenderData) {
renderData[renderDataLen++] = secondaryRenderData;
}
}
this._renderData = renderData;
}
getLastRenderData() {
return this._renderData;
}
};
ViewCursors.BLINK_INTERVAL = 500;
registerThemingParticipant((theme, collector) => {
const cursorThemes = [
{ class: ".cursor", foreground: editorCursorForeground, background: editorCursorBackground },
{ class: ".cursor-primary", foreground: editorMultiCursorPrimaryForeground, background: editorMultiCursorPrimaryBackground },
{ class: ".cursor-secondary", foreground: editorMultiCursorSecondaryForeground, background: editorMultiCursorSecondaryBackground }
];
for (const cursorTheme of cursorThemes) {
const caret = theme.getColor(cursorTheme.foreground);
if (caret) {
let caretBackground = theme.getColor(cursorTheme.background);
if (!caretBackground) {
caretBackground = caret.opposite();
}
collector.addRule(`.monaco-editor .cursors-layer ${cursorTheme.class} { background-color: ${caret}; border-color: ${caret}; color: ${caretBackground}; }`);
if (isHighContrast(theme.type)) {
collector.addRule(`.monaco-editor .cursors-layer.has-selection ${cursorTheme.class} { border-left: 1px solid ${caretBackground}; border-right: 1px solid ${caretBackground}; }`);
}
}
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewZones/viewZones.js
function safeInvoke1Arg(func, arg1) {
try {
return func(arg1);
} catch (e) {
onUnexpectedError(e);
}
}
var invalidFunc, ViewZones;
var init_viewZones = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewZones/viewZones.js"() {
init_fastDomNode();
init_errors();
init_viewPart();
init_position();
invalidFunc = () => {
throw new Error(`Invalid change accessor`);
};
ViewZones = class extends ViewPart {
constructor(context) {
super(context);
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._contentWidth = layoutInfo.contentWidth;
this._contentLeft = layoutInfo.contentLeft;
this.domNode = createFastDomNode(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 = createFastDomNode(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 = {};
}
// ---- begin view event handlers
_recomputeWhitespacesProps() {
const whitespaces = this._context.viewLayout.getWhitespaces();
const oldWhitespaces = /* @__PURE__ */ new Map();
for (const whitespace of whitespaces) {
oldWhitespaces.set(whitespace.id, whitespace);
}
let hadAChange = false;
this._context.viewModel.changeWhitespace((whitespaceAccessor) => {
const keys = Object.keys(this._zones);
for (let i = 0, len = keys.length; i < len; i++) {
const id = keys[i];
const zone = this._zones[id];
const props = this._computeWhitespaceProps(zone.delegate);
zone.isInHiddenArea = props.isInHiddenArea;
const oldWhitespace = oldWhitespaces.get(id);
if (oldWhitespace && (oldWhitespace.afterLineNumber !== props.afterViewLineNumber || oldWhitespace.height !== props.heightInPx)) {
whitespaceAccessor.changeOneWhitespace(id, props.afterViewLineNumber, props.heightInPx);
this._safeCallOnComputedHeight(zone.delegate, props.heightInPx);
hadAChange = true;
}
}
});
return hadAChange;
}
onConfigurationChanged(e) {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this._lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this._contentWidth = layoutInfo.contentWidth;
this._contentLeft = layoutInfo.contentLeft;
if (e.hasChanged(
67
/* EditorOption.lineHeight */
)) {
this._recomputeWhitespacesProps();
}
return true;
}
onLineMappingChanged(e) {
return this._recomputeWhitespacesProps();
}
onLinesDeleted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged || e.scrollWidthChanged;
}
onZonesChanged(e) {
return true;
}
onLinesInserted(e) {
return true;
}
// ---- end view event handlers
_getZoneOrdinal(zone) {
var _a10, _b4;
return (_b4 = (_a10 = zone.ordinal) !== null && _a10 !== void 0 ? _a10 : zone.afterColumn) !== null && _b4 !== void 0 ? _b4 : 1e4;
}
_computeWhitespaceProps(zone) {
if (zone.afterLineNumber === 0) {
return {
isInHiddenArea: false,
afterViewLineNumber: 0,
heightInPx: this._heightInPixels(zone),
minWidthInPx: this._minWidthInPixels(zone)
};
}
let zoneAfterModelPosition;
if (typeof zone.afterColumn !== "undefined") {
zoneAfterModelPosition = this._context.viewModel.model.validatePosition({
lineNumber: zone.afterLineNumber,
column: zone.afterColumn
});
} else {
const validAfterLineNumber = this._context.viewModel.model.validatePosition({
lineNumber: zone.afterLineNumber,
column: 1
}).lineNumber;
zoneAfterModelPosition = new Position(validAfterLineNumber, this._context.viewModel.model.getLineMaxColumn(validAfterLineNumber));
}
let zoneBeforeModelPosition;
if (zoneAfterModelPosition.column === this._context.viewModel.model.getLineMaxColumn(zoneAfterModelPosition.lineNumber)) {
zoneBeforeModelPosition = this._context.viewModel.model.validatePosition({
lineNumber: zoneAfterModelPosition.lineNumber + 1,
column: 1
});
} else {
zoneBeforeModelPosition = this._context.viewModel.model.validatePosition({
lineNumber: zoneAfterModelPosition.lineNumber,
column: zoneAfterModelPosition.column + 1
});
}
const viewPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(zoneAfterModelPosition, zone.afterColumnAffinity, true);
const isVisible = zone.showInHiddenAreas || this._context.viewModel.coordinatesConverter.modelPositionIsVisible(zoneBeforeModelPosition);
return {
isInHiddenArea: !isVisible,
afterViewLineNumber: viewPosition.lineNumber,
heightInPx: isVisible ? this._heightInPixels(zone) : 0,
minWidthInPx: this._minWidthInPixels(zone)
};
}
changeViewZones(callback) {
let zonesHaveChanged = false;
this._context.viewModel.changeWhitespace((whitespaceAccessor) => {
const changeAccessor = {
addZone: (zone) => {
zonesHaveChanged = true;
return this._addZone(whitespaceAccessor, zone);
},
removeZone: (id) => {
if (!id) {
return;
}
zonesHaveChanged = this._removeZone(whitespaceAccessor, id) || zonesHaveChanged;
},
layoutZone: (id) => {
if (!id) {
return;
}
zonesHaveChanged = this._layoutZone(whitespaceAccessor, id) || zonesHaveChanged;
}
};
safeInvoke1Arg(callback, changeAccessor);
changeAccessor.addZone = invalidFunc;
changeAccessor.removeZone = invalidFunc;
changeAccessor.layoutZone = invalidFunc;
});
return zonesHaveChanged;
}
_addZone(whitespaceAccessor, zone) {
const props = this._computeWhitespaceProps(zone);
const whitespaceId = whitespaceAccessor.insertWhitespace(props.afterViewLineNumber, this._getZoneOrdinal(zone), props.heightInPx, props.minWidthInPx);
const myZone = {
whitespaceId,
delegate: zone,
isInHiddenArea: props.isInHiddenArea,
isVisible: false,
domNode: createFastDomNode(zone.domNode),
marginDomNode: zone.marginDomNode ? createFastDomNode(zone.marginDomNode) : null
};
this._safeCallOnComputedHeight(myZone.delegate, props.heightInPx);
myZone.domNode.setPosition("absolute");
myZone.domNode.domNode.style.width = "100%";
myZone.domNode.setDisplay("none");
myZone.domNode.setAttribute("monaco-view-zone", myZone.whitespaceId);
this.domNode.appendChild(myZone.domNode);
if (myZone.marginDomNode) {
myZone.marginDomNode.setPosition("absolute");
myZone.marginDomNode.domNode.style.width = "100%";
myZone.marginDomNode.setDisplay("none");
myZone.marginDomNode.setAttribute("monaco-view-zone", myZone.whitespaceId);
this.marginDomNode.appendChild(myZone.marginDomNode);
}
this._zones[myZone.whitespaceId] = myZone;
this.setShouldRender();
return myZone.whitespaceId;
}
_removeZone(whitespaceAccessor, id) {
if (this._zones.hasOwnProperty(id)) {
const zone = this._zones[id];
delete this._zones[id];
whitespaceAccessor.removeWhitespace(zone.whitespaceId);
zone.domNode.removeAttribute("monaco-visible-view-zone");
zone.domNode.removeAttribute("monaco-view-zone");
zone.domNode.domNode.parentNode.removeChild(zone.domNode.domNode);
if (zone.marginDomNode) {
zone.marginDomNode.removeAttribute("monaco-visible-view-zone");
zone.marginDomNode.removeAttribute("monaco-view-zone");
zone.marginDomNode.domNode.parentNode.removeChild(zone.marginDomNode.domNode);
}
this.setShouldRender();
return true;
}
return false;
}
_layoutZone(whitespaceAccessor, id) {
if (this._zones.hasOwnProperty(id)) {
const zone = this._zones[id];
const props = this._computeWhitespaceProps(zone.delegate);
zone.isInHiddenArea = props.isInHiddenArea;
whitespaceAccessor.changeOneWhitespace(zone.whitespaceId, props.afterViewLineNumber, props.heightInPx);
this._safeCallOnComputedHeight(zone.delegate, props.heightInPx);
this.setShouldRender();
return true;
}
return false;
}
shouldSuppressMouseDownOnViewZone(id) {
if (this._zones.hasOwnProperty(id)) {
const zone = this._zones[id];
return Boolean(zone.delegate.suppressMouseDown);
}
return false;
}
_heightInPixels(zone) {
if (typeof zone.heightInPx === "number") {
return zone.heightInPx;
}
if (typeof zone.heightInLines === "number") {
return this._lineHeight * zone.heightInLines;
}
return this._lineHeight;
}
_minWidthInPixels(zone) {
if (typeof zone.minWidthInPx === "number") {
return zone.minWidthInPx;
}
return 0;
}
_safeCallOnComputedHeight(zone, height) {
if (typeof zone.onComputedHeight === "function") {
try {
zone.onComputedHeight(height);
} catch (e) {
onUnexpectedError(e);
}
}
}
_safeCallOnDomNodeTop(zone, top) {
if (typeof zone.onDomNodeTop === "function") {
try {
zone.onDomNodeTop(top);
} catch (e) {
onUnexpectedError(e);
}
}
}
prepareRender(ctx) {
}
render(ctx) {
const visibleWhitespaces = ctx.viewportData.whitespaceViewportData;
const visibleZones = {};
let hasVisibleZone = false;
for (const visibleWhitespace of visibleWhitespaces) {
if (this._zones[visibleWhitespace.id].isInHiddenArea) {
continue;
}
visibleZones[visibleWhitespace.id] = visibleWhitespace;
hasVisibleZone = true;
}
const keys = Object.keys(this._zones);
for (let i = 0, len = keys.length; i < len; i++) {
const id = keys[i];
const zone = this._zones[id];
let newTop = 0;
let newHeight = 0;
let newDisplay = "none";
if (visibleZones.hasOwnProperty(id)) {
newTop = visibleZones[id].verticalOffset - ctx.bigNumbersDelta;
newHeight = visibleZones[id].height;
newDisplay = "block";
if (!zone.isVisible) {
zone.domNode.setAttribute("monaco-visible-view-zone", "true");
zone.isVisible = true;
}
this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(visibleZones[id].verticalOffset));
} else {
if (zone.isVisible) {
zone.domNode.removeAttribute("monaco-visible-view-zone");
zone.isVisible = false;
}
this._safeCallOnDomNodeTop(zone.delegate, ctx.getScrolledTopFromAbsoluteTop(-1e6));
}
zone.domNode.setTop(newTop);
zone.domNode.setHeight(newHeight);
zone.domNode.setDisplay(newDisplay);
if (zone.marginDomNode) {
zone.marginDomNode.setTop(newTop);
zone.marginDomNode.setHeight(newHeight);
zone.marginDomNode.setDisplay(newDisplay);
}
}
if (hasVisibleZone) {
this.domNode.setWidth(Math.max(ctx.scrollWidth, this._contentWidth));
this.marginDomNode.setWidth(this._contentLeft);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/whitespace/whitespace.css
var init_whitespace = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/whitespace/whitespace.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/viewParts/whitespace/whitespace.js
var WhitespaceOverlay, WhitespaceOptions;
var init_whitespace2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/viewParts/whitespace/whitespace.js"() {
init_whitespace();
init_dynamicViewOverlay();
init_strings();
init_viewLineRenderer();
init_position();
init_editorColorRegistry();
WhitespaceOverlay = class extends DynamicViewOverlay {
constructor(context) {
super();
this._context = context;
this._options = new WhitespaceOptions(this._context.configuration);
this._selection = [];
this._renderResult = null;
this._context.addEventHandler(this);
}
dispose() {
this._context.removeEventHandler(this);
this._renderResult = null;
super.dispose();
}
// --- begin event handlers
onConfigurationChanged(e) {
const newOptions = new WhitespaceOptions(this._context.configuration);
if (this._options.equals(newOptions)) {
return e.hasChanged(
145
/* EditorOption.layoutInfo */
);
}
this._options = newOptions;
return true;
}
onCursorStateChanged(e) {
this._selection = e.selections;
if (this._options.renderWhitespace === "selection") {
return true;
}
return false;
}
onDecorationsChanged(e) {
return true;
}
onFlushed(e) {
return true;
}
onLinesChanged(e) {
return true;
}
onLinesDeleted(e) {
return true;
}
onLinesInserted(e) {
return true;
}
onScrollChanged(e) {
return e.scrollTopChanged;
}
onZonesChanged(e) {
return true;
}
// --- end event handlers
prepareRender(ctx) {
if (this._options.renderWhitespace === "none") {
this._renderResult = null;
return;
}
const startLineNumber = ctx.visibleRange.startLineNumber;
const endLineNumber = ctx.visibleRange.endLineNumber;
const lineCount = endLineNumber - startLineNumber + 1;
const needed = new Array(lineCount);
for (let i = 0; i < lineCount; i++) {
needed[i] = true;
}
const viewportData = this._context.viewModel.getMinimapLinesRenderingData(ctx.viewportData.startLineNumber, ctx.viewportData.endLineNumber, needed);
this._renderResult = [];
for (let lineNumber = ctx.viewportData.startLineNumber; lineNumber <= ctx.viewportData.endLineNumber; lineNumber++) {
const lineIndex = lineNumber - ctx.viewportData.startLineNumber;
const lineData = viewportData.data[lineIndex];
let selectionsOnLine = null;
if (this._options.renderWhitespace === "selection") {
const selections = this._selection;
for (const selection of selections) {
if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {
continue;
}
const startColumn = selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn;
const endColumn = selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn;
if (startColumn < endColumn) {
if (!selectionsOnLine) {
selectionsOnLine = [];
}
selectionsOnLine.push(new LineRange2(startColumn - 1, endColumn - 1));
}
}
}
this._renderResult[lineIndex] = this._applyRenderWhitespace(ctx, lineNumber, selectionsOnLine, lineData);
}
}
_applyRenderWhitespace(ctx, lineNumber, selections, lineData) {
if (this._options.renderWhitespace === "selection" && !selections) {
return "";
}
if (this._options.renderWhitespace === "trailing" && lineData.continuesWithWrappedLine) {
return "";
}
const color = this._context.theme.getColor(editorWhitespaces);
const USE_SVG = this._options.renderWithSVG;
const lineContent = lineData.content;
const len = this._options.stopRenderingLineAfter === -1 ? lineContent.length : Math.min(this._options.stopRenderingLineAfter, lineContent.length);
const continuesWithWrappedLine = lineData.continuesWithWrappedLine;
const fauxIndentLength = lineData.minColumn - 1;
const onlyBoundary = this._options.renderWhitespace === "boundary";
const onlyTrailing = this._options.renderWhitespace === "trailing";
const lineHeight = this._options.lineHeight;
const middotWidth = this._options.middotWidth;
const wsmiddotWidth = this._options.wsmiddotWidth;
const spaceWidth = this._options.spaceWidth;
const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);
const middotDiff = Math.abs(middotWidth - spaceWidth);
const renderSpaceCharCode = wsmiddotDiff < middotDiff ? 11825 : 183;
const canUseHalfwidthRightwardsArrow = this._options.canUseHalfwidthRightwardsArrow;
let result = "";
let lineIsEmptyOrWhitespace = false;
let firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(lineContent);
let lastNonWhitespaceIndex2;
if (firstNonWhitespaceIndex2 === -1) {
lineIsEmptyOrWhitespace = true;
firstNonWhitespaceIndex2 = len;
lastNonWhitespaceIndex2 = len;
} else {
lastNonWhitespaceIndex2 = lastNonWhitespaceIndex(lineContent);
}
let currentSelectionIndex = 0;
let currentSelection = selections && selections[currentSelectionIndex];
let maxLeft = 0;
for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {
const chCode = lineContent.charCodeAt(charIndex);
if (currentSelection && charIndex >= currentSelection.endOffset) {
currentSelectionIndex++;
currentSelection = selections && selections[currentSelectionIndex];
}
if (chCode !== 9 && chCode !== 32) {
continue;
}
if (onlyTrailing && !lineIsEmptyOrWhitespace && charIndex <= lastNonWhitespaceIndex2) {
continue;
}
if (onlyBoundary && charIndex >= firstNonWhitespaceIndex2 && charIndex <= lastNonWhitespaceIndex2 && chCode === 32) {
const prevChCode = charIndex - 1 >= 0 ? lineContent.charCodeAt(charIndex - 1) : 0;
const nextChCode = charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0;
if (prevChCode !== 32 && nextChCode !== 32) {
continue;
}
}
if (onlyBoundary && continuesWithWrappedLine && charIndex === len - 1) {
const prevCharCode = charIndex - 1 >= 0 ? lineContent.charCodeAt(charIndex - 1) : 0;
const isSingleTrailingSpace = chCode === 32 && (prevCharCode !== 32 && prevCharCode !== 9);
if (isSingleTrailingSpace) {
continue;
}
}
if (selections && (!currentSelection || currentSelection.startOffset > charIndex || currentSelection.endOffset <= charIndex)) {
continue;
}
const visibleRange = ctx.visibleRangeForPosition(new Position(lineNumber, charIndex + 1));
if (!visibleRange) {
continue;
}
if (USE_SVG) {
maxLeft = Math.max(maxLeft, visibleRange.left);
if (chCode === 9) {
result += this._renderArrow(lineHeight, spaceWidth, visibleRange.left);
} else {
result += ``;
}
} else {
if (chCode === 9) {
result += `${canUseHalfwidthRightwardsArrow ? String.fromCharCode(65515) : String.fromCharCode(8594)}
`;
} else {
result += `${String.fromCharCode(renderSpaceCharCode)}
`;
}
}
}
if (USE_SVG) {
maxLeft = Math.round(maxLeft + spaceWidth);
return ``;
}
return result;
}
_renderArrow(lineHeight, spaceWidth, left) {
const strokeWidth = spaceWidth / 7;
const width2 = spaceWidth;
const dy = lineHeight / 2;
const dx = left;
const p1 = { x: 0, y: strokeWidth / 2 };
const p2 = { x: 100 / 125 * width2, y: p1.y };
const p3 = { x: p2.x - 0.2 * p2.x, y: p2.y + 0.2 * p2.x };
const p4 = { x: p3.x + 0.1 * p2.x, y: p3.y + 0.1 * p2.x };
const p5 = { x: p4.x + 0.35 * p2.x, y: p4.y - 0.35 * p2.x };
const p6 = { x: p5.x, y: -p5.y };
const p7 = { x: p4.x, y: -p4.y };
const p8 = { x: p3.x, y: -p3.y };
const p9 = { x: p2.x, y: -p2.y };
const p10 = { x: p1.x, y: -p1.y };
const p = [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10];
const parts = p.map((p11) => `${(dx + p11.x).toFixed(2)} ${(dy + p11.y).toFixed(2)}`).join(" L ");
return ``;
}
render(startLineNumber, lineNumber) {
if (!this._renderResult) {
return "";
}
const lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return "";
}
return this._renderResult[lineIndex];
}
};
WhitespaceOptions = class {
constructor(config) {
const options2 = config.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const experimentalWhitespaceRendering = options2.get(
38
/* EditorOption.experimentalWhitespaceRendering */
);
if (experimentalWhitespaceRendering === "off") {
this.renderWhitespace = "none";
this.renderWithSVG = false;
} else if (experimentalWhitespaceRendering === "svg") {
this.renderWhitespace = options2.get(
99
/* EditorOption.renderWhitespace */
);
this.renderWithSVG = true;
} else {
this.renderWhitespace = options2.get(
99
/* EditorOption.renderWhitespace */
);
this.renderWithSVG = false;
}
this.spaceWidth = fontInfo.spaceWidth;
this.middotWidth = fontInfo.middotWidth;
this.wsmiddotWidth = fontInfo.wsmiddotWidth;
this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;
this.lineHeight = options2.get(
67
/* EditorOption.lineHeight */
);
this.stopRenderingLineAfter = options2.get(
117
/* EditorOption.stopRenderingLineAfter */
);
}
equals(other) {
return this.renderWhitespace === other.renderWhitespace && this.renderWithSVG === other.renderWithSVG && this.spaceWidth === other.spaceWidth && this.middotWidth === other.middotWidth && this.wsmiddotWidth === other.wsmiddotWidth && this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow && this.lineHeight === other.lineHeight && this.stopRenderingLineAfter === other.stopRenderingLineAfter;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLinesViewportData.js
var ViewportData;
var init_viewLinesViewportData = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLinesViewportData.js"() {
init_range();
ViewportData = class {
constructor(selections, partialData, whitespaceViewportData, model) {
this.selections = selections;
this.startLineNumber = partialData.startLineNumber | 0;
this.endLineNumber = partialData.endLineNumber | 0;
this.relativeVerticalOffset = partialData.relativeVerticalOffset;
this.bigNumbersDelta = partialData.bigNumbersDelta | 0;
this.lineHeight = partialData.lineHeight | 0;
this.whitespaceViewportData = whitespaceViewportData;
this._model = model;
this.visibleRange = new Range(partialData.startLineNumber, this._model.getLineMinColumn(partialData.startLineNumber), partialData.endLineNumber, this._model.getLineMaxColumn(partialData.endLineNumber));
}
getViewLineRenderingData(lineNumber) {
return this._model.getViewportViewLineRenderingData(this.visibleRange, lineNumber);
}
getDecorationsInViewport() {
return this._model.getDecorationsInViewport(this.visibleRange);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/editorTheme.js
var EditorTheme;
var init_editorTheme = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/editorTheme.js"() {
EditorTheme = class {
get type() {
return this._theme.type;
}
get value() {
return this._theme;
}
constructor(theme) {
this._theme = theme;
}
update(theme) {
this._theme = theme;
}
getColor(color) {
return this._theme.getColor(color);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewContext.js
var ViewContext;
var init_viewContext = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewContext.js"() {
init_editorTheme();
ViewContext = class {
constructor(configuration, theme, model) {
this.configuration = configuration;
this.theme = new EditorTheme(theme);
this.viewModel = model;
this.viewLayout = model.viewLayout;
}
addEventHandler(eventHandler) {
this.viewModel.addViewEventHandler(eventHandler);
}
removeEventHandler(eventHandler) {
this.viewModel.removeViewEventHandler(eventHandler);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view.js
function safeInvokeNoArg(func) {
try {
return func();
} catch (e) {
onUnexpectedError(e);
return null;
}
}
var __decorate11, __param10, View, EditorRenderingCoordinator;
var init_view = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view.js"() {
init_dom();
init_fastDomNode();
init_performance();
init_errors();
init_mouseTarget();
init_pointerHandler();
init_textAreaHandler2();
init_renderingContext();
init_viewController();
init_viewOverlays();
init_viewPart();
init_viewUserInputEvents();
init_blockDecorations2();
init_contentWidgets();
init_currentLineHighlight2();
init_decorations2();
init_editorScrollbar();
init_glyphMargin2();
init_indentGuides2();
init_lineNumbers2();
init_viewLines2();
init_linesDecorations2();
init_margin2();
init_marginDecorations2();
init_minimap2();
init_overlayWidgets2();
init_decorationsOverviewRuler();
init_overviewRuler();
init_rulers2();
init_scrollDecoration2();
init_selections2();
init_viewCursors2();
init_viewZones();
init_whitespace2();
init_position();
init_range();
init_selection();
init_model2();
init_viewEventHandler();
init_viewLinesViewportData();
init_viewContext();
init_instantiation();
init_themeService();
__decorate11 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param10 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
View = class View2 extends ViewEventHandler {
constructor(commandDelegate, configuration, colorTheme, model, userInputEvents, overflowWidgetsDomNode, _instantiationService) {
super();
this._instantiationService = _instantiationService;
this._shouldRecomputeGlyphMarginLanes = false;
this._selections = [new Selection(1, 1, 1, 1)];
this._renderAnimationFrame = null;
const viewController = new ViewController(configuration, model, userInputEvents, commandDelegate);
this._context = new ViewContext(configuration, colorTheme, model);
this._context.addEventHandler(this);
this._viewParts = [];
this._textAreaHandler = this._instantiationService.createInstance(TextAreaHandler, this._context, viewController, this._createTextAreaHandlerHelper());
this._viewParts.push(this._textAreaHandler);
this._linesContent = createFastDomNode(document.createElement("div"));
this._linesContent.setClassName("lines-content monaco-editor-background");
this._linesContent.setPosition("absolute");
this.domNode = createFastDomNode(document.createElement("div"));
this.domNode.setClassName(this._getEditorClassName());
this.domNode.setAttribute("role", "code");
this._overflowGuardContainer = createFastDomNode(document.createElement("div"));
PartFingerprints.write(
this._overflowGuardContainer,
3
/* PartFingerprint.OverflowGuard */
);
this._overflowGuardContainer.setClassName("overflow-guard");
this._scrollbar = new EditorScrollbar2(this._context, this._linesContent, this.domNode, this._overflowGuardContainer);
this._viewParts.push(this._scrollbar);
this._viewLines = new ViewLines(this._context, this._linesContent);
this._viewZones = new ViewZones(this._context);
this._viewParts.push(this._viewZones);
const decorationsOverviewRuler = new DecorationsOverviewRuler(this._context);
this._viewParts.push(decorationsOverviewRuler);
const scrollDecoration = new ScrollDecorationViewPart(this._context);
this._viewParts.push(scrollDecoration);
const contentViewOverlays = new ContentViewOverlays(this._context);
this._viewParts.push(contentViewOverlays);
contentViewOverlays.addDynamicOverlay(new CurrentLineHighlightOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new SelectionsOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new IndentGuidesOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new DecorationsOverlay(this._context));
contentViewOverlays.addDynamicOverlay(new WhitespaceOverlay(this._context));
const marginViewOverlays = new MarginViewOverlays(this._context);
this._viewParts.push(marginViewOverlays);
marginViewOverlays.addDynamicOverlay(new CurrentLineMarginHighlightOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new MarginViewLineDecorationsOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new LinesDecorationsOverlay(this._context));
marginViewOverlays.addDynamicOverlay(new LineNumbersOverlay(this._context));
this._glyphMarginWidgets = new GlyphMarginWidgets(this._context);
this._viewParts.push(this._glyphMarginWidgets);
const margin = new Margin(this._context);
margin.getDomNode().appendChild(this._viewZones.marginDomNode);
margin.getDomNode().appendChild(marginViewOverlays.getDomNode());
margin.getDomNode().appendChild(this._glyphMarginWidgets.domNode);
this._viewParts.push(margin);
this._contentWidgets = new ViewContentWidgets(this._context, this.domNode);
this._viewParts.push(this._contentWidgets);
this._viewCursors = new ViewCursors(this._context);
this._viewParts.push(this._viewCursors);
this._overlayWidgets = new ViewOverlayWidgets(this._context, this.domNode);
this._viewParts.push(this._overlayWidgets);
const rulers = new Rulers(this._context);
this._viewParts.push(rulers);
const blockOutline = new BlockDecorations(this._context);
this._viewParts.push(blockOutline);
const minimap = new Minimap(this._context);
this._viewParts.push(minimap);
if (decorationsOverviewRuler) {
const overviewRulerData = this._scrollbar.getOverviewRulerLayoutInfo();
overviewRulerData.parent.insertBefore(decorationsOverviewRuler.getDomNode(), overviewRulerData.insertBefore);
}
this._linesContent.appendChild(contentViewOverlays.getDomNode());
this._linesContent.appendChild(rulers.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(margin.getDomNode());
this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode());
this._overflowGuardContainer.appendChild(scrollDecoration.getDomNode());
this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea);
this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover);
this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode());
this._overflowGuardContainer.appendChild(minimap.getDomNode());
this._overflowGuardContainer.appendChild(blockOutline.domNode);
this.domNode.appendChild(this._overflowGuardContainer);
if (overflowWidgetsDomNode) {
overflowWidgetsDomNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode);
overflowWidgetsDomNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode);
} else {
this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode);
this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode);
}
this._applyLayout();
this._pointerHandler = this._register(new PointerHandler(this._context, viewController, this._createPointerHandlerHelper()));
}
_computeGlyphMarginLanes() {
const model = this._context.viewModel.model;
const laneModel = this._context.viewModel.glyphLanes;
let glyphs = [];
let maxLineNumber = 0;
glyphs = glyphs.concat(model.getAllMarginDecorations().map((decoration3) => {
var _a10, _b4, _c2;
const lane = (_b4 = (_a10 = decoration3.options.glyphMargin) === null || _a10 === void 0 ? void 0 : _a10.position) !== null && _b4 !== void 0 ? _b4 : GlyphMarginLane2.Center;
maxLineNumber = Math.max(maxLineNumber, decoration3.range.endLineNumber);
return { range: decoration3.range, lane, persist: (_c2 = decoration3.options.glyphMargin) === null || _c2 === void 0 ? void 0 : _c2.persistLane };
}));
glyphs = glyphs.concat(this._glyphMarginWidgets.getWidgets().map((widget) => {
const range2 = model.validateRange(widget.preference.range);
maxLineNumber = Math.max(maxLineNumber, range2.endLineNumber);
return { range: range2, lane: widget.preference.lane };
}));
glyphs.sort((a3, b) => Range.compareRangesUsingStarts(a3.range, b.range));
laneModel.reset(maxLineNumber);
for (const glyph of glyphs) {
laneModel.push(glyph.lane, glyph.range, glyph.persist);
}
return laneModel;
}
_createPointerHandlerHelper() {
return {
viewDomNode: this.domNode.domNode,
linesContentDomNode: this._linesContent.domNode,
viewLinesDomNode: this._viewLines.getDomNode().domNode,
focusTextArea: () => {
this.focus();
},
dispatchTextAreaEvent: (event) => {
this._textAreaHandler.textArea.domNode.dispatchEvent(event);
},
getLastRenderData: () => {
const lastViewCursorsRenderData = this._viewCursors.getLastRenderData() || [];
const lastTextareaPosition = this._textAreaHandler.getLastRenderData();
return new PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition);
},
renderNow: () => {
this.render(true, false);
},
shouldSuppressMouseDownOnViewZone: (viewZoneId) => {
return this._viewZones.shouldSuppressMouseDownOnViewZone(viewZoneId);
},
shouldSuppressMouseDownOnWidget: (widgetId) => {
return this._contentWidgets.shouldSuppressMouseDownOnWidget(widgetId);
},
getPositionFromDOMInfo: (spanNode, offset) => {
this._flushAccumulatedAndRenderNow();
return this._viewLines.getPositionFromDOMInfo(spanNode, offset);
},
visibleRangeForPosition: (lineNumber, column) => {
this._flushAccumulatedAndRenderNow();
return this._viewLines.visibleRangeForPosition(new Position(lineNumber, column));
},
getLineWidth: (lineNumber) => {
this._flushAccumulatedAndRenderNow();
return this._viewLines.getLineWidth(lineNumber);
}
};
}
_createTextAreaHandlerHelper() {
return {
visibleRangeForPosition: (position) => {
this._flushAccumulatedAndRenderNow();
return this._viewLines.visibleRangeForPosition(position);
}
};
}
_applyLayout() {
const options2 = this._context.configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
this.domNode.setWidth(layoutInfo.width);
this.domNode.setHeight(layoutInfo.height);
this._overflowGuardContainer.setWidth(layoutInfo.width);
this._overflowGuardContainer.setHeight(layoutInfo.height);
this._linesContent.setWidth(16777216);
this._linesContent.setHeight(16777216);
}
_getEditorClassName() {
const focused = this._textAreaHandler.isFocused() ? " focused" : "";
return this._context.configuration.options.get(
142
/* EditorOption.editorClassName */
) + " " + getThemeTypeSelector(this._context.theme.type) + focused;
}
// --- begin event handlers
handleEvents(events) {
super.handleEvents(events);
this._scheduleRender();
}
onConfigurationChanged(e) {
this.domNode.setClassName(this._getEditorClassName());
this._applyLayout();
return false;
}
onCursorStateChanged(e) {
this._selections = e.selections;
return false;
}
onDecorationsChanged(e) {
if (e.affectsGlyphMargin) {
this._shouldRecomputeGlyphMarginLanes = true;
}
return false;
}
onFocusChanged(e) {
this.domNode.setClassName(this._getEditorClassName());
return false;
}
onThemeChanged(e) {
this._context.theme.update(e.theme);
this.domNode.setClassName(this._getEditorClassName());
return false;
}
// --- end event handlers
dispose() {
if (this._renderAnimationFrame !== null) {
this._renderAnimationFrame.dispose();
this._renderAnimationFrame = null;
}
this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove();
this._context.removeEventHandler(this);
this._viewLines.dispose();
for (const viewPart of this._viewParts) {
viewPart.dispose();
}
super.dispose();
}
_scheduleRender() {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
if (this._renderAnimationFrame === null) {
const rendering = this._createCoordinatedRendering();
this._renderAnimationFrame = EditorRenderingCoordinator.INSTANCE.scheduleCoordinatedRendering({
window: getWindow(this.domNode.domNode),
prepareRenderText: () => {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
try {
return rendering.prepareRenderText();
} finally {
this._renderAnimationFrame = null;
}
},
renderText: () => {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
return rendering.renderText();
},
prepareRender: (viewParts, ctx) => {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
return rendering.prepareRender(viewParts, ctx);
},
render: (viewParts, ctx) => {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
return rendering.render(viewParts, ctx);
}
});
}
}
_flushAccumulatedAndRenderNow() {
const rendering = this._createCoordinatedRendering();
safeInvokeNoArg(() => rendering.prepareRenderText());
const data = safeInvokeNoArg(() => rendering.renderText());
if (data) {
const [viewParts, ctx] = data;
safeInvokeNoArg(() => rendering.prepareRender(viewParts, ctx));
safeInvokeNoArg(() => rendering.render(viewParts, ctx));
}
}
_getViewPartsToRender() {
const result = [];
let resultLen = 0;
for (const viewPart of this._viewParts) {
if (viewPart.shouldRender()) {
result[resultLen++] = viewPart;
}
}
return result;
}
_createCoordinatedRendering() {
return {
prepareRenderText: () => {
if (this._shouldRecomputeGlyphMarginLanes) {
this._shouldRecomputeGlyphMarginLanes = false;
const model = this._computeGlyphMarginLanes();
this._context.configuration.setGlyphMarginDecorationLaneCount(model.requiredLanes);
}
inputLatency.onRenderStart();
},
renderText: () => {
if (!this.domNode.domNode.isConnected) {
return null;
}
let viewPartsToRender = this._getViewPartsToRender();
if (!this._viewLines.shouldRender() && viewPartsToRender.length === 0) {
return null;
}
const partialViewportData = this._context.viewLayout.getLinesViewportData();
this._context.viewModel.setViewport(partialViewportData.startLineNumber, partialViewportData.endLineNumber, partialViewportData.centeredLineNumber);
const viewportData = new ViewportData(this._selections, partialViewportData, this._context.viewLayout.getWhitespaceViewportData(), this._context.viewModel);
if (this._contentWidgets.shouldRender()) {
this._contentWidgets.onBeforeRender(viewportData);
}
if (this._viewLines.shouldRender()) {
this._viewLines.renderText(viewportData);
this._viewLines.onDidRender();
viewPartsToRender = this._getViewPartsToRender();
}
return [viewPartsToRender, new RenderingContext(this._context.viewLayout, viewportData, this._viewLines)];
},
prepareRender: (viewPartsToRender, ctx) => {
for (const viewPart of viewPartsToRender) {
viewPart.prepareRender(ctx);
}
},
render: (viewPartsToRender, ctx) => {
for (const viewPart of viewPartsToRender) {
viewPart.render(ctx);
viewPart.onDidRender();
}
}
};
}
// --- BEGIN CodeEditor helpers
delegateVerticalScrollbarPointerDown(browserEvent) {
this._scrollbar.delegateVerticalScrollbarPointerDown(browserEvent);
}
delegateScrollFromMouseWheelEvent(browserEvent) {
this._scrollbar.delegateScrollFromMouseWheelEvent(browserEvent);
}
restoreState(scrollPosition) {
this._context.viewModel.viewLayout.setScrollPosition(
{
scrollTop: scrollPosition.scrollTop,
scrollLeft: scrollPosition.scrollLeft
},
1
/* ScrollType.Immediate */
);
this._context.viewModel.visibleLinesStabilized();
}
getOffsetForColumn(modelLineNumber, modelColumn) {
const modelPosition = this._context.viewModel.model.validatePosition({
lineNumber: modelLineNumber,
column: modelColumn
});
const viewPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
this._flushAccumulatedAndRenderNow();
const visibleRange = this._viewLines.visibleRangeForPosition(new Position(viewPosition.lineNumber, viewPosition.column));
if (!visibleRange) {
return -1;
}
return visibleRange.left;
}
getTargetAtClientPoint(clientX, clientY) {
const mouseTarget = this._pointerHandler.getTargetAtClientPoint(clientX, clientY);
if (!mouseTarget) {
return null;
}
return ViewUserInputEvents.convertViewToModelMouseTarget(mouseTarget, this._context.viewModel.coordinatesConverter);
}
createOverviewRuler(cssClassName) {
return new OverviewRuler(this._context, cssClassName);
}
change(callback) {
this._viewZones.changeViewZones(callback);
this._scheduleRender();
}
render(now, everything) {
if (everything) {
this._viewLines.forceShouldRender();
for (const viewPart of this._viewParts) {
viewPart.forceShouldRender();
}
}
if (now) {
this._flushAccumulatedAndRenderNow();
} else {
this._scheduleRender();
}
}
writeScreenReaderContent(reason) {
this._textAreaHandler.writeScreenReaderContent(reason);
}
focus() {
this._textAreaHandler.focusTextArea();
}
isFocused() {
return this._textAreaHandler.isFocused();
}
setAriaOptions(options2) {
this._textAreaHandler.setAriaOptions(options2);
}
addContentWidget(widgetData) {
this._contentWidgets.addWidget(widgetData.widget);
this.layoutContentWidget(widgetData);
this._scheduleRender();
}
layoutContentWidget(widgetData) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2;
this._contentWidgets.setWidgetPosition(widgetData.widget, (_b4 = (_a10 = widgetData.position) === null || _a10 === void 0 ? void 0 : _a10.position) !== null && _b4 !== void 0 ? _b4 : null, (_d2 = (_c2 = widgetData.position) === null || _c2 === void 0 ? void 0 : _c2.secondaryPosition) !== null && _d2 !== void 0 ? _d2 : null, (_f3 = (_e2 = widgetData.position) === null || _e2 === void 0 ? void 0 : _e2.preference) !== null && _f3 !== void 0 ? _f3 : null, (_h2 = (_g2 = widgetData.position) === null || _g2 === void 0 ? void 0 : _g2.positionAffinity) !== null && _h2 !== void 0 ? _h2 : null);
this._scheduleRender();
}
removeContentWidget(widgetData) {
this._contentWidgets.removeWidget(widgetData.widget);
this._scheduleRender();
}
addOverlayWidget(widgetData) {
this._overlayWidgets.addWidget(widgetData.widget);
this.layoutOverlayWidget(widgetData);
this._scheduleRender();
}
layoutOverlayWidget(widgetData) {
const shouldRender = this._overlayWidgets.setWidgetPosition(widgetData.widget, widgetData.position);
if (shouldRender) {
this._scheduleRender();
}
}
removeOverlayWidget(widgetData) {
this._overlayWidgets.removeWidget(widgetData.widget);
this._scheduleRender();
}
addGlyphMarginWidget(widgetData) {
this._glyphMarginWidgets.addWidget(widgetData.widget);
this._shouldRecomputeGlyphMarginLanes = true;
this._scheduleRender();
}
layoutGlyphMarginWidget(widgetData) {
const newPreference = widgetData.position;
const shouldRender = this._glyphMarginWidgets.setWidgetPosition(widgetData.widget, newPreference);
if (shouldRender) {
this._shouldRecomputeGlyphMarginLanes = true;
this._scheduleRender();
}
}
removeGlyphMarginWidget(widgetData) {
this._glyphMarginWidgets.removeWidget(widgetData.widget);
this._shouldRecomputeGlyphMarginLanes = true;
this._scheduleRender();
}
};
View = __decorate11([
__param10(6, IInstantiationService)
], View);
EditorRenderingCoordinator = class {
constructor() {
this._coordinatedRenderings = [];
this._animationFrameRunners = /* @__PURE__ */ new Map();
}
scheduleCoordinatedRendering(rendering) {
this._coordinatedRenderings.push(rendering);
this._scheduleRender(rendering.window);
return {
dispose: () => {
const renderingIndex = this._coordinatedRenderings.indexOf(rendering);
if (renderingIndex === -1) {
return;
}
this._coordinatedRenderings.splice(renderingIndex, 1);
if (this._coordinatedRenderings.length === 0) {
for (const [_, disposable] of this._animationFrameRunners) {
disposable.dispose();
}
this._animationFrameRunners.clear();
}
}
};
}
_scheduleRender(window2) {
if (!this._animationFrameRunners.has(window2)) {
const runner = () => {
this._animationFrameRunners.delete(window2);
this._onRenderScheduled();
};
this._animationFrameRunners.set(window2, runAtThisOrScheduleAtNextAnimationFrame(window2, runner, 100));
}
}
_onRenderScheduled() {
const coordinatedRenderings = this._coordinatedRenderings.slice(0);
this._coordinatedRenderings = [];
for (const rendering of coordinatedRenderings) {
safeInvokeNoArg(() => rendering.prepareRenderText());
}
const datas = [];
for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {
const rendering = coordinatedRenderings[i];
datas[i] = safeInvokeNoArg(() => rendering.renderText());
}
for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {
const rendering = coordinatedRenderings[i];
const data = datas[i];
if (!data) {
continue;
}
const [viewParts, ctx] = data;
safeInvokeNoArg(() => rendering.prepareRender(viewParts, ctx));
}
for (let i = 0, len = coordinatedRenderings.length; i < len; i++) {
const rendering = coordinatedRenderings[i];
const data = datas[i];
if (!data) {
continue;
}
const [viewParts, ctx] = data;
safeInvokeNoArg(() => rendering.render(viewParts, ctx));
}
}
};
EditorRenderingCoordinator.INSTANCE = new EditorRenderingCoordinator();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/modelLineProjectionData.js
function hasRightCursorStop(cursorStop) {
if (cursorStop === null || cursorStop === void 0) {
return true;
}
return cursorStop === InjectedTextCursorStops2.Right || cursorStop === InjectedTextCursorStops2.Both;
}
function hasLeftCursorStop(cursorStop) {
if (cursorStop === null || cursorStop === void 0) {
return true;
}
return cursorStop === InjectedTextCursorStops2.Left || cursorStop === InjectedTextCursorStops2.Both;
}
var ModelLineProjectionData, OutputPosition;
var init_modelLineProjectionData = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/modelLineProjectionData.js"() {
init_assert();
init_position();
init_model2();
ModelLineProjectionData = class {
constructor(injectionOffsets, injectionOptions, breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength) {
this.injectionOffsets = injectionOffsets;
this.injectionOptions = injectionOptions;
this.breakOffsets = breakOffsets;
this.breakOffsetsVisibleColumn = breakOffsetsVisibleColumn;
this.wrappedTextIndentLength = wrappedTextIndentLength;
}
getOutputLineCount() {
return this.breakOffsets.length;
}
getMinOutputOffset(outputLineIndex) {
if (outputLineIndex > 0) {
return this.wrappedTextIndentLength;
}
return 0;
}
getLineLength(outputLineIndex) {
const startOffset = outputLineIndex > 0 ? this.breakOffsets[outputLineIndex - 1] : 0;
const endOffset = this.breakOffsets[outputLineIndex];
let lineLength = endOffset - startOffset;
if (outputLineIndex > 0) {
lineLength += this.wrappedTextIndentLength;
}
return lineLength;
}
getMaxOutputOffset(outputLineIndex) {
return this.getLineLength(outputLineIndex);
}
translateToInputOffset(outputLineIndex, outputOffset) {
if (outputLineIndex > 0) {
outputOffset = Math.max(0, outputOffset - this.wrappedTextIndentLength);
}
const offsetInInputWithInjection = outputLineIndex === 0 ? outputOffset : this.breakOffsets[outputLineIndex - 1] + outputOffset;
let offsetInInput = offsetInInputWithInjection;
if (this.injectionOffsets !== null) {
for (let i = 0; i < this.injectionOffsets.length; i++) {
if (offsetInInput > this.injectionOffsets[i]) {
if (offsetInInput < this.injectionOffsets[i] + this.injectionOptions[i].content.length) {
offsetInInput = this.injectionOffsets[i];
} else {
offsetInInput -= this.injectionOptions[i].content.length;
}
} else {
break;
}
}
}
return offsetInInput;
}
translateToOutputPosition(inputOffset, affinity = 2) {
let inputOffsetInInputWithInjection = inputOffset;
if (this.injectionOffsets !== null) {
for (let i = 0; i < this.injectionOffsets.length; i++) {
if (inputOffset < this.injectionOffsets[i]) {
break;
}
if (affinity !== 1 && inputOffset === this.injectionOffsets[i]) {
break;
}
inputOffsetInInputWithInjection += this.injectionOptions[i].content.length;
}
}
return this.offsetInInputWithInjectionsToOutputPosition(inputOffsetInInputWithInjection, affinity);
}
offsetInInputWithInjectionsToOutputPosition(offsetInInputWithInjections, affinity = 2) {
let low = 0;
let high = this.breakOffsets.length - 1;
let mid = 0;
let midStart = 0;
while (low <= high) {
mid = low + (high - low) / 2 | 0;
const midStop = this.breakOffsets[mid];
midStart = mid > 0 ? this.breakOffsets[mid - 1] : 0;
if (affinity === 0) {
if (offsetInInputWithInjections <= midStart) {
high = mid - 1;
} else if (offsetInInputWithInjections > midStop) {
low = mid + 1;
} else {
break;
}
} else {
if (offsetInInputWithInjections < midStart) {
high = mid - 1;
} else if (offsetInInputWithInjections >= midStop) {
low = mid + 1;
} else {
break;
}
}
}
let outputOffset = offsetInInputWithInjections - midStart;
if (mid > 0) {
outputOffset += this.wrappedTextIndentLength;
}
return new OutputPosition(mid, outputOffset);
}
normalizeOutputPosition(outputLineIndex, outputOffset, affinity) {
if (this.injectionOffsets !== null) {
const offsetInInputWithInjections = this.outputPositionToOffsetInInputWithInjections(outputLineIndex, outputOffset);
const normalizedOffsetInUnwrappedLine = this.normalizeOffsetInInputWithInjectionsAroundInjections(offsetInInputWithInjections, affinity);
if (normalizedOffsetInUnwrappedLine !== offsetInInputWithInjections) {
return this.offsetInInputWithInjectionsToOutputPosition(normalizedOffsetInUnwrappedLine, affinity);
}
}
if (affinity === 0) {
if (outputLineIndex > 0 && outputOffset === this.getMinOutputOffset(outputLineIndex)) {
return new OutputPosition(outputLineIndex - 1, this.getMaxOutputOffset(outputLineIndex - 1));
}
} else if (affinity === 1) {
const maxOutputLineIndex = this.getOutputLineCount() - 1;
if (outputLineIndex < maxOutputLineIndex && outputOffset === this.getMaxOutputOffset(outputLineIndex)) {
return new OutputPosition(outputLineIndex + 1, this.getMinOutputOffset(outputLineIndex + 1));
}
}
return new OutputPosition(outputLineIndex, outputOffset);
}
outputPositionToOffsetInInputWithInjections(outputLineIndex, outputOffset) {
if (outputLineIndex > 0) {
outputOffset = Math.max(0, outputOffset - this.wrappedTextIndentLength);
}
const result = (outputLineIndex > 0 ? this.breakOffsets[outputLineIndex - 1] : 0) + outputOffset;
return result;
}
normalizeOffsetInInputWithInjectionsAroundInjections(offsetInInputWithInjections, affinity) {
const injectedText = this.getInjectedTextAtOffset(offsetInInputWithInjections);
if (!injectedText) {
return offsetInInputWithInjections;
}
if (affinity === 2) {
if (offsetInInputWithInjections === injectedText.offsetInInputWithInjections + injectedText.length && hasRightCursorStop(this.injectionOptions[injectedText.injectedTextIndex].cursorStops)) {
return injectedText.offsetInInputWithInjections + injectedText.length;
} else {
let result = injectedText.offsetInInputWithInjections;
if (hasLeftCursorStop(this.injectionOptions[injectedText.injectedTextIndex].cursorStops)) {
return result;
}
let index = injectedText.injectedTextIndex - 1;
while (index >= 0 && this.injectionOffsets[index] === this.injectionOffsets[injectedText.injectedTextIndex]) {
if (hasRightCursorStop(this.injectionOptions[index].cursorStops)) {
break;
}
result -= this.injectionOptions[index].content.length;
if (hasLeftCursorStop(this.injectionOptions[index].cursorStops)) {
break;
}
index--;
}
return result;
}
} else if (affinity === 1 || affinity === 4) {
let result = injectedText.offsetInInputWithInjections + injectedText.length;
let index = injectedText.injectedTextIndex;
while (index + 1 < this.injectionOffsets.length && this.injectionOffsets[index + 1] === this.injectionOffsets[index]) {
result += this.injectionOptions[index + 1].content.length;
index++;
}
return result;
} else if (affinity === 0 || affinity === 3) {
let result = injectedText.offsetInInputWithInjections;
let index = injectedText.injectedTextIndex;
while (index - 1 >= 0 && this.injectionOffsets[index - 1] === this.injectionOffsets[index]) {
result -= this.injectionOptions[index - 1].content.length;
index--;
}
return result;
}
assertNever(affinity);
}
getInjectedText(outputLineIndex, outputOffset) {
const offset = this.outputPositionToOffsetInInputWithInjections(outputLineIndex, outputOffset);
const injectedText = this.getInjectedTextAtOffset(offset);
if (!injectedText) {
return null;
}
return {
options: this.injectionOptions[injectedText.injectedTextIndex]
};
}
getInjectedTextAtOffset(offsetInInputWithInjections) {
const injectionOffsets = this.injectionOffsets;
const injectionOptions = this.injectionOptions;
if (injectionOffsets !== null) {
let totalInjectedTextLengthBefore = 0;
for (let i = 0; i < injectionOffsets.length; i++) {
const length = injectionOptions[i].content.length;
const injectedTextStartOffsetInInputWithInjections = injectionOffsets[i] + totalInjectedTextLengthBefore;
const injectedTextEndOffsetInInputWithInjections = injectionOffsets[i] + totalInjectedTextLengthBefore + length;
if (injectedTextStartOffsetInInputWithInjections > offsetInInputWithInjections) {
break;
}
if (offsetInInputWithInjections <= injectedTextEndOffsetInInputWithInjections) {
return {
injectedTextIndex: i,
offsetInInputWithInjections: injectedTextStartOffsetInInputWithInjections,
length
};
}
totalInjectedTextLengthBefore += length;
}
}
return void 0;
}
};
OutputPosition = class {
constructor(outputLineIndex, outputOffset) {
this.outputLineIndex = outputLineIndex;
this.outputOffset = outputOffset;
}
toString() {
return `${this.outputLineIndex}:${this.outputOffset}`;
}
toPosition(baseLineNumber) {
return new Position(baseLineNumber + this.outputLineIndex, this.outputOffset + 1);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/textModelEvents.js
var ModelRawFlush, LineInjectedText, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted, ModelRawEOLChanged, ModelRawContentChangedEvent, ModelInjectedTextChangedEvent, InternalModelContentChangeEvent;
var init_textModelEvents = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/textModelEvents.js"() {
ModelRawFlush = class {
constructor() {
this.changeType = 1;
}
};
LineInjectedText = class _LineInjectedText {
static applyInjectedText(lineText, injectedTexts) {
if (!injectedTexts || injectedTexts.length === 0) {
return lineText;
}
let result = "";
let lastOriginalOffset = 0;
for (const injectedText of injectedTexts) {
result += lineText.substring(lastOriginalOffset, injectedText.column - 1);
lastOriginalOffset = injectedText.column - 1;
result += injectedText.options.content;
}
result += lineText.substring(lastOriginalOffset);
return result;
}
static fromDecorations(decorations) {
const result = [];
for (const decoration3 of decorations) {
if (decoration3.options.before && decoration3.options.before.content.length > 0) {
result.push(new _LineInjectedText(decoration3.ownerId, decoration3.range.startLineNumber, decoration3.range.startColumn, decoration3.options.before, 0));
}
if (decoration3.options.after && decoration3.options.after.content.length > 0) {
result.push(new _LineInjectedText(decoration3.ownerId, decoration3.range.endLineNumber, decoration3.range.endColumn, decoration3.options.after, 1));
}
}
result.sort((a3, b) => {
if (a3.lineNumber === b.lineNumber) {
if (a3.column === b.column) {
return a3.order - b.order;
}
return a3.column - b.column;
}
return a3.lineNumber - b.lineNumber;
});
return result;
}
constructor(ownerId2, lineNumber, column, options2, order) {
this.ownerId = ownerId2;
this.lineNumber = lineNumber;
this.column = column;
this.options = options2;
this.order = order;
}
};
ModelRawLineChanged = class {
constructor(lineNumber, detail, injectedText) {
this.changeType = 2;
this.lineNumber = lineNumber;
this.detail = detail;
this.injectedText = injectedText;
}
};
ModelRawLinesDeleted = class {
constructor(fromLineNumber, toLineNumber) {
this.changeType = 3;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
};
ModelRawLinesInserted = class {
constructor(fromLineNumber, toLineNumber, detail, injectedTexts) {
this.changeType = 4;
this.injectedTexts = injectedTexts;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
this.detail = detail;
}
};
ModelRawEOLChanged = class {
constructor() {
this.changeType = 5;
}
};
ModelRawContentChangedEvent = class _ModelRawContentChangedEvent {
constructor(changes, versionId, isUndoing, isRedoing) {
this.changes = changes;
this.versionId = versionId;
this.isUndoing = isUndoing;
this.isRedoing = isRedoing;
this.resultingSelection = null;
}
containsEvent(type) {
for (let i = 0, len = this.changes.length; i < len; i++) {
const change = this.changes[i];
if (change.changeType === type) {
return true;
}
}
return false;
}
static merge(a3, b) {
const changes = [].concat(a3.changes).concat(b.changes);
const versionId = b.versionId;
const isUndoing = a3.isUndoing || b.isUndoing;
const isRedoing = a3.isRedoing || b.isRedoing;
return new _ModelRawContentChangedEvent(changes, versionId, isUndoing, isRedoing);
}
};
ModelInjectedTextChangedEvent = class {
constructor(changes) {
this.changes = changes;
}
};
InternalModelContentChangeEvent = class _InternalModelContentChangeEvent {
constructor(rawContentChangedEvent, contentChangedEvent) {
this.rawContentChangedEvent = rawContentChangedEvent;
this.contentChangedEvent = contentChangedEvent;
}
merge(other) {
const rawContentChangedEvent = ModelRawContentChangedEvent.merge(this.rawContentChangedEvent, other.rawContentChangedEvent);
const contentChangedEvent = _InternalModelContentChangeEvent._mergeChangeEvents(this.contentChangedEvent, other.contentChangedEvent);
return new _InternalModelContentChangeEvent(rawContentChangedEvent, contentChangedEvent);
}
static _mergeChangeEvents(a3, b) {
const changes = [].concat(a3.changes).concat(b.changes);
const eol = b.eol;
const versionId = b.versionId;
const isUndoing = a3.isUndoing || b.isUndoing;
const isRedoing = a3.isRedoing || b.isRedoing;
const isFlush = a3.isFlush || b.isFlush;
const isEolChange = a3.isEolChange && b.isEolChange;
return {
changes,
eol,
isEolChange,
versionId,
isUndoing,
isRedoing,
isFlush
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/view/domLineBreaksComputer.js
function createLineBreaks(targetWindow, requests, fontInfo, tabSize, firstLineBreakColumn, wrappingIndent, wordBreak, injectedTextsPerLine) {
var _a10;
function createEmptyLineBreakWithPossiblyInjectedText(requestIdx) {
const injectedTexts = injectedTextsPerLine[requestIdx];
if (injectedTexts) {
const lineText = LineInjectedText.applyInjectedText(requests[requestIdx], injectedTexts);
const injectionOptions = injectedTexts.map((t4) => t4.options);
const injectionOffsets = injectedTexts.map((text2) => text2.column - 1);
return new ModelLineProjectionData(injectionOffsets, injectionOptions, [lineText.length], [], 0);
} else {
return null;
}
}
if (firstLineBreakColumn === -1) {
const result2 = [];
for (let i = 0, len = requests.length; i < len; i++) {
result2[i] = createEmptyLineBreakWithPossiblyInjectedText(i);
}
return result2;
}
const overallWidth = Math.round(firstLineBreakColumn * fontInfo.typicalHalfwidthCharacterWidth);
const additionalIndent = wrappingIndent === 3 ? 2 : wrappingIndent === 2 ? 1 : 0;
const additionalIndentSize = Math.round(tabSize * additionalIndent);
const additionalIndentLength = Math.ceil(fontInfo.spaceWidth * additionalIndentSize);
const containerDomNode = document.createElement("div");
applyFontInfo(containerDomNode, fontInfo);
const sb = new StringBuilder(1e4);
const firstNonWhitespaceIndices = [];
const wrappedTextIndentLengths = [];
const renderLineContents = [];
const allCharOffsets = [];
const allVisibleColumns = [];
for (let i = 0; i < requests.length; i++) {
const lineContent = LineInjectedText.applyInjectedText(requests[i], injectedTextsPerLine[i]);
let firstNonWhitespaceIndex2 = 0;
let wrappedTextIndentLength = 0;
let width2 = overallWidth;
if (wrappingIndent !== 0) {
firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(lineContent);
if (firstNonWhitespaceIndex2 === -1) {
firstNonWhitespaceIndex2 = 0;
} else {
for (let i2 = 0; i2 < firstNonWhitespaceIndex2; i2++) {
const charWidth = lineContent.charCodeAt(i2) === 9 ? tabSize - wrappedTextIndentLength % tabSize : 1;
wrappedTextIndentLength += charWidth;
}
const indentWidth = Math.ceil(fontInfo.spaceWidth * wrappedTextIndentLength);
if (indentWidth + fontInfo.typicalFullwidthCharacterWidth > overallWidth) {
firstNonWhitespaceIndex2 = 0;
wrappedTextIndentLength = 0;
} else {
width2 = overallWidth - indentWidth;
}
}
}
const renderLineContent = lineContent.substr(firstNonWhitespaceIndex2);
const tmp = renderLine(renderLineContent, wrappedTextIndentLength, tabSize, width2, sb, additionalIndentLength);
firstNonWhitespaceIndices[i] = firstNonWhitespaceIndex2;
wrappedTextIndentLengths[i] = wrappedTextIndentLength;
renderLineContents[i] = renderLineContent;
allCharOffsets[i] = tmp[0];
allVisibleColumns[i] = tmp[1];
}
const html2 = sb.build();
const trustedhtml = (_a10 = ttPolicy3 === null || ttPolicy3 === void 0 ? void 0 : ttPolicy3.createHTML(html2)) !== null && _a10 !== void 0 ? _a10 : html2;
containerDomNode.innerHTML = trustedhtml;
containerDomNode.style.position = "absolute";
containerDomNode.style.top = "10000";
if (wordBreak === "keepAll") {
containerDomNode.style.wordBreak = "keep-all";
containerDomNode.style.overflowWrap = "anywhere";
} else {
containerDomNode.style.wordBreak = "inherit";
containerDomNode.style.overflowWrap = "break-word";
}
targetWindow.document.body.appendChild(containerDomNode);
const range2 = document.createRange();
const lineDomNodes = Array.prototype.slice.call(containerDomNode.children, 0);
const result = [];
for (let i = 0; i < requests.length; i++) {
const lineDomNode = lineDomNodes[i];
const breakOffsets = readLineBreaks(range2, lineDomNode, renderLineContents[i], allCharOffsets[i]);
if (breakOffsets === null) {
result[i] = createEmptyLineBreakWithPossiblyInjectedText(i);
continue;
}
const firstNonWhitespaceIndex2 = firstNonWhitespaceIndices[i];
const wrappedTextIndentLength = wrappedTextIndentLengths[i] + additionalIndentSize;
const visibleColumns = allVisibleColumns[i];
const breakOffsetsVisibleColumn = [];
for (let j = 0, len = breakOffsets.length; j < len; j++) {
breakOffsetsVisibleColumn[j] = visibleColumns[breakOffsets[j]];
}
if (firstNonWhitespaceIndex2 !== 0) {
for (let j = 0, len = breakOffsets.length; j < len; j++) {
breakOffsets[j] += firstNonWhitespaceIndex2;
}
}
let injectionOptions;
let injectionOffsets;
const curInjectedTexts = injectedTextsPerLine[i];
if (curInjectedTexts) {
injectionOptions = curInjectedTexts.map((t4) => t4.options);
injectionOffsets = curInjectedTexts.map((text2) => text2.column - 1);
} else {
injectionOptions = null;
injectionOffsets = null;
}
result[i] = new ModelLineProjectionData(injectionOffsets, injectionOptions, breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength);
}
targetWindow.document.body.removeChild(containerDomNode);
return result;
}
function renderLine(lineContent, initialVisibleColumn, tabSize, width2, sb, wrappingIndentLength) {
if (wrappingIndentLength !== 0) {
const hangingOffset = String(wrappingIndentLength);
sb.appendString('');
const len = lineContent.length;
let visibleColumn = initialVisibleColumn;
let charOffset = 0;
const charOffsets = [];
const visibleColumns = [];
let nextCharCode = 0 < len ? lineContent.charCodeAt(0) : 0;
sb.appendString("");
for (let charIndex = 0; charIndex < len; charIndex++) {
if (charIndex !== 0 && charIndex % 16384 === 0) {
sb.appendString("");
}
charOffsets[charIndex] = charOffset;
visibleColumns[charIndex] = visibleColumn;
const charCode = nextCharCode;
nextCharCode = charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0;
let producedCharacters = 1;
let charWidth = 1;
switch (charCode) {
case 9:
producedCharacters = tabSize - visibleColumn % tabSize;
charWidth = producedCharacters;
for (let space = 1; space <= producedCharacters; space++) {
if (space < producedCharacters) {
sb.appendCharCode(160);
} else {
sb.appendASCIICharCode(
32
/* CharCode.Space */
);
}
}
break;
case 32:
if (nextCharCode === 32) {
sb.appendCharCode(160);
} else {
sb.appendASCIICharCode(
32
/* CharCode.Space */
);
}
break;
case 60:
sb.appendString("<");
break;
case 62:
sb.appendString(">");
break;
case 38:
sb.appendString("&");
break;
case 0:
sb.appendString("");
break;
case 65279:
case 8232:
case 8233:
case 133:
sb.appendCharCode(65533);
break;
default:
if (isFullWidthCharacter(charCode)) {
charWidth++;
}
if (charCode < 32) {
sb.appendCharCode(9216 + charCode);
} else {
sb.appendCharCode(charCode);
}
}
charOffset += producedCharacters;
visibleColumn += charWidth;
}
sb.appendString("");
charOffsets[lineContent.length] = charOffset;
visibleColumns[lineContent.length] = visibleColumn;
sb.appendString("
");
return [charOffsets, visibleColumns];
}
function readLineBreaks(range2, lineDomNode, lineContent, charOffsets) {
if (lineContent.length <= 1) {
return null;
}
const spans = Array.prototype.slice.call(lineDomNode.children, 0);
const breakOffsets = [];
try {
discoverBreaks(range2, spans, charOffsets, 0, null, lineContent.length - 1, null, breakOffsets);
} catch (err) {
console.log(err);
return null;
}
if (breakOffsets.length === 0) {
return null;
}
breakOffsets.push(lineContent.length);
return breakOffsets;
}
function discoverBreaks(range2, spans, charOffsets, low, lowRects, high, highRects, result) {
if (low === high) {
return;
}
lowRects = lowRects || readClientRect(range2, spans, charOffsets[low], charOffsets[low + 1]);
highRects = highRects || readClientRect(range2, spans, charOffsets[high], charOffsets[high + 1]);
if (Math.abs(lowRects[0].top - highRects[0].top) <= 0.1) {
return;
}
if (low + 1 === high) {
result.push(high);
return;
}
const mid = low + (high - low) / 2 | 0;
const midRects = readClientRect(range2, spans, charOffsets[mid], charOffsets[mid + 1]);
discoverBreaks(range2, spans, charOffsets, low, lowRects, mid, midRects, result);
discoverBreaks(range2, spans, charOffsets, mid, midRects, high, highRects, result);
}
function readClientRect(range2, spans, startOffset, endOffset) {
range2.setStart(
spans[startOffset / 16384 | 0].firstChild,
startOffset % 16384
/* Constants.SPAN_MODULO_LIMIT */
);
range2.setEnd(
spans[endOffset / 16384 | 0].firstChild,
endOffset % 16384
/* Constants.SPAN_MODULO_LIMIT */
);
return range2.getClientRects();
}
var ttPolicy3, DOMLineBreaksComputerFactory;
var init_domLineBreaksComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/view/domLineBreaksComputer.js"() {
init_trustedTypes();
init_strings();
init_types();
init_domFontInfo();
init_stringBuilder();
init_modelLineProjectionData();
init_textModelEvents();
ttPolicy3 = createTrustedTypesPolicy("domLineBreaksComputer", { createHTML: (value) => value });
DOMLineBreaksComputerFactory = class _DOMLineBreaksComputerFactory {
static create(targetWindow) {
return new _DOMLineBreaksComputerFactory(new WeakRef(targetWindow));
}
constructor(targetWindow) {
this.targetWindow = targetWindow;
}
createLineBreaksComputer(fontInfo, tabSize, wrappingColumn, wrappingIndent, wordBreak) {
const requests = [];
const injectedTexts = [];
return {
addRequest: (lineText, injectedText, previousLineBreakData) => {
requests.push(lineText);
injectedTexts.push(injectedText);
},
finalize: () => {
return createLineBreaks(assertIsDefined(this.targetWindow.deref()), requests, fontInfo, tabSize, wrappingColumn, wrappingIndent, wordBreak, injectedTexts);
}
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorContributions.js
var CodeEditorContributions;
var init_codeEditorContributions = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorContributions.js"() {
init_dom();
init_errors();
init_lifecycle();
CodeEditorContributions = class extends Disposable {
constructor() {
super();
this._editor = null;
this._instantiationService = null;
this._instances = this._register(new DisposableMap());
this._pending = /* @__PURE__ */ new Map();
this._finishedInstantiation = [];
this._finishedInstantiation[
0
/* EditorContributionInstantiation.Eager */
] = false;
this._finishedInstantiation[
1
/* EditorContributionInstantiation.AfterFirstRender */
] = false;
this._finishedInstantiation[
2
/* EditorContributionInstantiation.BeforeFirstInteraction */
] = false;
this._finishedInstantiation[
3
/* EditorContributionInstantiation.Eventually */
] = false;
}
initialize(editor2, contributions, instantiationService) {
this._editor = editor2;
this._instantiationService = instantiationService;
for (const desc of contributions) {
if (this._pending.has(desc.id)) {
onUnexpectedError(new Error(`Cannot have two contributions with the same id ${desc.id}`));
continue;
}
this._pending.set(desc.id, desc);
}
this._instantiateSome(
0
/* EditorContributionInstantiation.Eager */
);
this._register(runWhenWindowIdle(getWindow(this._editor.getDomNode()), () => {
this._instantiateSome(
1
/* EditorContributionInstantiation.AfterFirstRender */
);
}));
this._register(runWhenWindowIdle(getWindow(this._editor.getDomNode()), () => {
this._instantiateSome(
2
/* EditorContributionInstantiation.BeforeFirstInteraction */
);
}));
this._register(runWhenWindowIdle(getWindow(this._editor.getDomNode()), () => {
this._instantiateSome(
3
/* EditorContributionInstantiation.Eventually */
);
}, 5e3));
}
saveViewState() {
const contributionsState = {};
for (const [id, contribution] of this._instances) {
if (typeof contribution.saveViewState === "function") {
contributionsState[id] = contribution.saveViewState();
}
}
return contributionsState;
}
restoreViewState(contributionsState) {
for (const [id, contribution] of this._instances) {
if (typeof contribution.restoreViewState === "function") {
contribution.restoreViewState(contributionsState[id]);
}
}
}
get(id) {
this._instantiateById(id);
return this._instances.get(id) || null;
}
onBeforeInteractionEvent() {
this._instantiateSome(
2
/* EditorContributionInstantiation.BeforeFirstInteraction */
);
}
onAfterModelAttached() {
var _a10;
return runWhenWindowIdle(getWindow((_a10 = this._editor) === null || _a10 === void 0 ? void 0 : _a10.getDomNode()), () => {
this._instantiateSome(
1
/* EditorContributionInstantiation.AfterFirstRender */
);
}, 50);
}
_instantiateSome(instantiation) {
if (this._finishedInstantiation[instantiation]) {
return;
}
this._finishedInstantiation[instantiation] = true;
const contribs = this._findPendingContributionsByInstantiation(instantiation);
for (const contrib of contribs) {
this._instantiateById(contrib.id);
}
}
_findPendingContributionsByInstantiation(instantiation) {
const result = [];
for (const [, desc] of this._pending) {
if (desc.instantiation === instantiation) {
result.push(desc);
}
}
return result;
}
_instantiateById(id) {
const desc = this._pending.get(id);
if (!desc) {
return;
}
this._pending.delete(id);
if (!this._instantiationService || !this._editor) {
throw new Error(`Cannot instantiate contributions before being initialized!`);
}
try {
const instance = this._instantiationService.createInstance(desc.ctor, this._editor);
this._instances.set(desc.id, instance);
if (typeof instance.restoreViewState === "function" && desc.instantiation !== 0) {
console.warn(`Editor contribution '${desc.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`);
}
} catch (err) {
onUnexpectedError(err);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/editorAction.js
var InternalEditorAction;
var init_editorAction = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/editorAction.js"() {
InternalEditorAction = class {
constructor(id, label, alias, metadata, _precondition, _run, _contextKeyService) {
this.id = id;
this.label = label;
this.alias = alias;
this.metadata = metadata;
this._precondition = _precondition;
this._run = _run;
this._contextKeyService = _contextKeyService;
}
isSupported() {
return this._contextKeyService.contextMatchesRules(this._precondition);
}
run(args) {
if (!this.isSupported()) {
return Promise.resolve(void 0);
}
return this._run(args);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/eolCounter.js
function countEOL(text2) {
let eolCount = 0;
let firstLineLength = 0;
let lastLineStart = 0;
let eol = 0;
for (let i = 0, len = text2.length; i < len; i++) {
const chr = text2.charCodeAt(i);
if (chr === 13) {
if (eolCount === 0) {
firstLineLength = i;
}
eolCount++;
if (i + 1 < len && text2.charCodeAt(i + 1) === 10) {
eol |= 2;
i++;
} else {
eol |= 3;
}
lastLineStart = i + 1;
} else if (chr === 10) {
eol |= 1;
if (eolCount === 0) {
firstLineLength = i;
}
eolCount++;
lastLineStart = i + 1;
}
}
if (eolCount === 0) {
firstLineLength = text2.length;
}
return [eolCount, firstLineLength, text2.length - lastLineStart, eol];
}
var init_eolCounter = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/eolCounter.js"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/textModelBracketPairs.js
var BracketInfo, BracketPairInfo, BracketPairWithMinIndentationInfo;
var init_textModelBracketPairs = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/textModelBracketPairs.js"() {
BracketInfo = class {
constructor(range2, nestingLevel, nestingLevelOfEqualBracketType, isInvalid) {
this.range = range2;
this.nestingLevel = nestingLevel;
this.nestingLevelOfEqualBracketType = nestingLevelOfEqualBracketType;
this.isInvalid = isInvalid;
}
};
BracketPairInfo = class {
constructor(range2, openingBracketRange, closingBracketRange, nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode) {
this.range = range2;
this.openingBracketRange = openingBracketRange;
this.closingBracketRange = closingBracketRange;
this.nestingLevel = nestingLevel;
this.nestingLevelOfEqualBracketType = nestingLevelOfEqualBracketType;
this.bracketPairNode = bracketPairNode;
}
get openingBracketInfo() {
return this.bracketPairNode.openingBracket.bracketInfo;
}
};
BracketPairWithMinIndentationInfo = class extends BracketPairInfo {
constructor(range2, openingBracketRange, closingBracketRange, nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode, minVisibleColumnIndentation) {
super(range2, openingBracketRange, closingBracketRange, nestingLevel, nestingLevelOfEqualBracketType, bracketPairNode);
this.minVisibleColumnIndentation = minVisibleColumnIndentation;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js
function lengthDiff(startLineCount, startColumnCount, endLineCount, endColumnCount) {
return startLineCount !== endLineCount ? toLength(endLineCount - startLineCount, endColumnCount) : toLength(0, endColumnCount - startColumnCount);
}
function lengthIsZero(length) {
return length === 0;
}
function toLength(lineCount, columnCount) {
return lineCount * factor + columnCount;
}
function lengthToObj(length) {
const l = length;
const lineCount = Math.floor(l / factor);
const columnCount = l - lineCount * factor;
return new TextLength(lineCount, columnCount);
}
function lengthGetLineCount(length) {
return Math.floor(length / factor);
}
function lengthGetColumnCountIfZeroLineCount(length) {
return length;
}
function lengthAdd(l1, l2) {
let r = l1 + l2;
if (l2 >= factor) {
r = r - l1 % factor;
}
return r;
}
function sumLengths(items, lengthFn) {
return items.reduce((a3, b) => lengthAdd(a3, lengthFn(b)), lengthZero);
}
function lengthEquals(length1, length2) {
return length1 === length2;
}
function lengthDiffNonNegative(length1, length2) {
const l1 = length1;
const l2 = length2;
const diff = l2 - l1;
if (diff <= 0) {
return lengthZero;
}
const lineCount1 = Math.floor(l1 / factor);
const lineCount2 = Math.floor(l2 / factor);
const colCount2 = l2 - lineCount2 * factor;
if (lineCount1 === lineCount2) {
const colCount1 = l1 - lineCount1 * factor;
return toLength(0, colCount2 - colCount1);
} else {
return toLength(lineCount2 - lineCount1, colCount2);
}
}
function lengthLessThan(length1, length2) {
return length1 < length2;
}
function lengthLessThanEqual(length1, length2) {
return length1 <= length2;
}
function lengthGreaterThanEqual(length1, length2) {
return length1 >= length2;
}
function positionToLength(position) {
return toLength(position.lineNumber - 1, position.column - 1);
}
function lengthsToRange(lengthStart, lengthEnd) {
const l = lengthStart;
const lineCount = Math.floor(l / factor);
const colCount = l - lineCount * factor;
const l2 = lengthEnd;
const lineCount2 = Math.floor(l2 / factor);
const colCount2 = l2 - lineCount2 * factor;
return new Range(lineCount + 1, colCount + 1, lineCount2 + 1, colCount2 + 1);
}
function lengthOfString(str) {
const lines = splitLines(str);
return toLength(lines.length - 1, lines[lines.length - 1].length);
}
var lengthZero, factor;
var init_length = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js"() {
init_strings();
init_range();
init_textLength();
lengthZero = 0;
factor = __pow(2, 26);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper.js
var TextEditInfo, BeforeEditPositionMapper, TextEditInfoCache;
var init_beforeEditPositionMapper = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/beforeEditPositionMapper.js"() {
init_range();
init_length();
TextEditInfo = class _TextEditInfo {
static fromModelContentChanges(changes) {
const edits = changes.map((c) => {
const range2 = Range.lift(c.range);
return new _TextEditInfo(positionToLength(range2.getStartPosition()), positionToLength(range2.getEndPosition()), lengthOfString(c.text));
}).reverse();
return edits;
}
constructor(startOffset, endOffset, newLength) {
this.startOffset = startOffset;
this.endOffset = endOffset;
this.newLength = newLength;
}
toString() {
return `[${lengthToObj(this.startOffset)}...${lengthToObj(this.endOffset)}) -> ${lengthToObj(this.newLength)}`;
}
};
BeforeEditPositionMapper = class {
/**
* @param edits Must be sorted by offset in ascending order.
*/
constructor(edits) {
this.nextEditIdx = 0;
this.deltaOldToNewLineCount = 0;
this.deltaOldToNewColumnCount = 0;
this.deltaLineIdxInOld = -1;
this.edits = edits.map((edit) => TextEditInfoCache.from(edit));
}
/**
* @param offset Must be equal to or greater than the last offset this method has been called with.
*/
getOffsetBeforeChange(offset) {
this.adjustNextEdit(offset);
return this.translateCurToOld(offset);
}
/**
* @param offset Must be equal to or greater than the last offset this method has been called with.
* Returns null if there is no edit anymore.
*/
getDistanceToNextChange(offset) {
this.adjustNextEdit(offset);
const nextEdit = this.edits[this.nextEditIdx];
const nextChangeOffset = nextEdit ? this.translateOldToCur(nextEdit.offsetObj) : null;
if (nextChangeOffset === null) {
return null;
}
return lengthDiffNonNegative(offset, nextChangeOffset);
}
translateOldToCur(oldOffsetObj) {
if (oldOffsetObj.lineCount === this.deltaLineIdxInOld) {
return toLength(oldOffsetObj.lineCount + this.deltaOldToNewLineCount, oldOffsetObj.columnCount + this.deltaOldToNewColumnCount);
} else {
return toLength(oldOffsetObj.lineCount + this.deltaOldToNewLineCount, oldOffsetObj.columnCount);
}
}
translateCurToOld(newOffset) {
const offsetObj = lengthToObj(newOffset);
if (offsetObj.lineCount - this.deltaOldToNewLineCount === this.deltaLineIdxInOld) {
return toLength(offsetObj.lineCount - this.deltaOldToNewLineCount, offsetObj.columnCount - this.deltaOldToNewColumnCount);
} else {
return toLength(offsetObj.lineCount - this.deltaOldToNewLineCount, offsetObj.columnCount);
}
}
adjustNextEdit(offset) {
while (this.nextEditIdx < this.edits.length) {
const nextEdit = this.edits[this.nextEditIdx];
const nextEditEndOffsetInCur = this.translateOldToCur(nextEdit.endOffsetAfterObj);
if (lengthLessThanEqual(nextEditEndOffsetInCur, offset)) {
this.nextEditIdx++;
const nextEditEndOffsetInCurObj = lengthToObj(nextEditEndOffsetInCur);
const nextEditEndOffsetBeforeInCurObj = lengthToObj(this.translateOldToCur(nextEdit.endOffsetBeforeObj));
const lineDelta = nextEditEndOffsetInCurObj.lineCount - nextEditEndOffsetBeforeInCurObj.lineCount;
this.deltaOldToNewLineCount += lineDelta;
const previousColumnDelta = this.deltaLineIdxInOld === nextEdit.endOffsetBeforeObj.lineCount ? this.deltaOldToNewColumnCount : 0;
const columnDelta = nextEditEndOffsetInCurObj.columnCount - nextEditEndOffsetBeforeInCurObj.columnCount;
this.deltaOldToNewColumnCount = previousColumnDelta + columnDelta;
this.deltaLineIdxInOld = nextEdit.endOffsetBeforeObj.lineCount;
} else {
break;
}
}
}
};
TextEditInfoCache = class _TextEditInfoCache {
static from(edit) {
return new _TextEditInfoCache(edit.startOffset, edit.endOffset, edit.newLength);
}
constructor(startOffset, endOffset, textLength) {
this.endOffsetBeforeObj = lengthToObj(endOffset);
this.endOffsetAfterObj = lengthToObj(lengthAdd(startOffset, textLength));
this.offsetObj = lengthToObj(startOffset);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js
var emptyArr, SmallImmutableSet, identityKeyProvider, DenseKeyProvider;
var init_smallImmutableSet = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js"() {
emptyArr = [];
SmallImmutableSet = class _SmallImmutableSet {
static create(items, additionalItems) {
if (items <= 128 && additionalItems.length === 0) {
let cached = _SmallImmutableSet.cache[items];
if (!cached) {
cached = new _SmallImmutableSet(items, additionalItems);
_SmallImmutableSet.cache[items] = cached;
}
return cached;
}
return new _SmallImmutableSet(items, additionalItems);
}
static getEmpty() {
return this.empty;
}
constructor(items, additionalItems) {
this.items = items;
this.additionalItems = additionalItems;
}
add(value, keyProvider) {
const key = keyProvider.getKey(value);
let idx = key >> 5;
if (idx === 0) {
const newItem = 1 << key | this.items;
if (newItem === this.items) {
return this;
}
return _SmallImmutableSet.create(newItem, this.additionalItems);
}
idx--;
const newItems = this.additionalItems.slice(0);
while (newItems.length < idx) {
newItems.push(0);
}
newItems[idx] |= 1 << (key & 31);
return _SmallImmutableSet.create(this.items, newItems);
}
merge(other) {
const merged = this.items | other.items;
if (this.additionalItems === emptyArr && other.additionalItems === emptyArr) {
if (merged === this.items) {
return this;
}
if (merged === other.items) {
return other;
}
return _SmallImmutableSet.create(merged, emptyArr);
}
const newItems = [];
for (let i = 0; i < Math.max(this.additionalItems.length, other.additionalItems.length); i++) {
const item1 = this.additionalItems[i] || 0;
const item2 = other.additionalItems[i] || 0;
newItems.push(item1 | item2);
}
return _SmallImmutableSet.create(merged, newItems);
}
intersects(other) {
if ((this.items & other.items) !== 0) {
return true;
}
for (let i = 0; i < Math.min(this.additionalItems.length, other.additionalItems.length); i++) {
if ((this.additionalItems[i] & other.additionalItems[i]) !== 0) {
return true;
}
}
return false;
}
};
SmallImmutableSet.cache = new Array(129);
SmallImmutableSet.empty = SmallImmutableSet.create(0, emptyArr);
identityKeyProvider = {
getKey(value) {
return value;
}
};
DenseKeyProvider = class {
constructor() {
this.items = /* @__PURE__ */ new Map();
}
getKey(value) {
let existing = this.items.get(value);
if (existing === void 0) {
existing = this.items.size;
this.items.set(value, existing);
}
return existing;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js
var BaseAstNode, PairAstNode, ListAstNode, TwoThreeListAstNode, Immutable23ListAstNode, ArrayListAstNode, ImmutableArrayListAstNode, emptyArray, ImmutableLeafAstNode, TextAstNode, BracketAstNode, InvalidBracketAstNode;
var init_ast = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js"() {
init_errors();
init_cursorColumns();
init_length();
init_smallImmutableSet();
BaseAstNode = class {
/**
* The length of the entire node, which should equal the sum of lengths of all children.
*/
get length() {
return this._length;
}
constructor(length) {
this._length = length;
}
};
PairAstNode = class _PairAstNode extends BaseAstNode {
static create(openingBracket, child, closingBracket) {
let length = openingBracket.length;
if (child) {
length = lengthAdd(length, child.length);
}
if (closingBracket) {
length = lengthAdd(length, closingBracket.length);
}
return new _PairAstNode(length, openingBracket, child, closingBracket, child ? child.missingOpeningBracketIds : SmallImmutableSet.getEmpty());
}
get kind() {
return 2;
}
get listHeight() {
return 0;
}
get childrenLength() {
return 3;
}
getChild(idx) {
switch (idx) {
case 0:
return this.openingBracket;
case 1:
return this.child;
case 2:
return this.closingBracket;
}
throw new Error("Invalid child index");
}
/**
* Avoid using this property, it allocates an array!
*/
get children() {
const result = [];
result.push(this.openingBracket);
if (this.child) {
result.push(this.child);
}
if (this.closingBracket) {
result.push(this.closingBracket);
}
return result;
}
constructor(length, openingBracket, child, closingBracket, missingOpeningBracketIds) {
super(length);
this.openingBracket = openingBracket;
this.child = child;
this.closingBracket = closingBracket;
this.missingOpeningBracketIds = missingOpeningBracketIds;
}
canBeReused(openBracketIds) {
if (this.closingBracket === null) {
return false;
}
if (openBracketIds.intersects(this.missingOpeningBracketIds)) {
return false;
}
return true;
}
deepClone() {
return new _PairAstNode(this.length, this.openingBracket.deepClone(), this.child && this.child.deepClone(), this.closingBracket && this.closingBracket.deepClone(), this.missingOpeningBracketIds);
}
computeMinIndentation(offset, textModel) {
return this.child ? this.child.computeMinIndentation(lengthAdd(offset, this.openingBracket.length), textModel) : Number.MAX_SAFE_INTEGER;
}
};
ListAstNode = class extends BaseAstNode {
/**
* This method uses more memory-efficient list nodes that can only store 2 or 3 children.
*/
static create23(item1, item2, item3, immutable = false) {
let length = item1.length;
let missingBracketIds = item1.missingOpeningBracketIds;
if (item1.listHeight !== item2.listHeight) {
throw new Error("Invalid list heights");
}
length = lengthAdd(length, item2.length);
missingBracketIds = missingBracketIds.merge(item2.missingOpeningBracketIds);
if (item3) {
if (item1.listHeight !== item3.listHeight) {
throw new Error("Invalid list heights");
}
length = lengthAdd(length, item3.length);
missingBracketIds = missingBracketIds.merge(item3.missingOpeningBracketIds);
}
return immutable ? new Immutable23ListAstNode(length, item1.listHeight + 1, item1, item2, item3, missingBracketIds) : new TwoThreeListAstNode(length, item1.listHeight + 1, item1, item2, item3, missingBracketIds);
}
static getEmpty() {
return new ImmutableArrayListAstNode(lengthZero, 0, [], SmallImmutableSet.getEmpty());
}
get kind() {
return 4;
}
get missingOpeningBracketIds() {
return this._missingOpeningBracketIds;
}
/**
* Use ListAstNode.create.
*/
constructor(length, listHeight, _missingOpeningBracketIds) {
super(length);
this.listHeight = listHeight;
this._missingOpeningBracketIds = _missingOpeningBracketIds;
this.cachedMinIndentation = -1;
}
throwIfImmutable() {
}
makeLastElementMutable() {
this.throwIfImmutable();
const childCount = this.childrenLength;
if (childCount === 0) {
return void 0;
}
const lastChild = this.getChild(childCount - 1);
const mutable = lastChild.kind === 4 ? lastChild.toMutable() : lastChild;
if (lastChild !== mutable) {
this.setChild(childCount - 1, mutable);
}
return mutable;
}
makeFirstElementMutable() {
this.throwIfImmutable();
const childCount = this.childrenLength;
if (childCount === 0) {
return void 0;
}
const firstChild = this.getChild(0);
const mutable = firstChild.kind === 4 ? firstChild.toMutable() : firstChild;
if (firstChild !== mutable) {
this.setChild(0, mutable);
}
return mutable;
}
canBeReused(openBracketIds) {
if (openBracketIds.intersects(this.missingOpeningBracketIds)) {
return false;
}
if (this.childrenLength === 0) {
return false;
}
let lastChild = this;
while (lastChild.kind === 4) {
const lastLength = lastChild.childrenLength;
if (lastLength === 0) {
throw new BugIndicatingError();
}
lastChild = lastChild.getChild(lastLength - 1);
}
return lastChild.canBeReused(openBracketIds);
}
handleChildrenChanged() {
this.throwIfImmutable();
const count = this.childrenLength;
let length = this.getChild(0).length;
let unopenedBrackets = this.getChild(0).missingOpeningBracketIds;
for (let i = 1; i < count; i++) {
const child = this.getChild(i);
length = lengthAdd(length, child.length);
unopenedBrackets = unopenedBrackets.merge(child.missingOpeningBracketIds);
}
this._length = length;
this._missingOpeningBracketIds = unopenedBrackets;
this.cachedMinIndentation = -1;
}
computeMinIndentation(offset, textModel) {
if (this.cachedMinIndentation !== -1) {
return this.cachedMinIndentation;
}
let minIndentation = Number.MAX_SAFE_INTEGER;
let childOffset = offset;
for (let i = 0; i < this.childrenLength; i++) {
const child = this.getChild(i);
if (child) {
minIndentation = Math.min(minIndentation, child.computeMinIndentation(childOffset, textModel));
childOffset = lengthAdd(childOffset, child.length);
}
}
this.cachedMinIndentation = minIndentation;
return minIndentation;
}
};
TwoThreeListAstNode = class _TwoThreeListAstNode extends ListAstNode {
get childrenLength() {
return this._item3 !== null ? 3 : 2;
}
getChild(idx) {
switch (idx) {
case 0:
return this._item1;
case 1:
return this._item2;
case 2:
return this._item3;
}
throw new Error("Invalid child index");
}
setChild(idx, node) {
switch (idx) {
case 0:
this._item1 = node;
return;
case 1:
this._item2 = node;
return;
case 2:
this._item3 = node;
return;
}
throw new Error("Invalid child index");
}
get children() {
return this._item3 ? [this._item1, this._item2, this._item3] : [this._item1, this._item2];
}
get item1() {
return this._item1;
}
get item2() {
return this._item2;
}
get item3() {
return this._item3;
}
constructor(length, listHeight, _item1, _item2, _item3, missingOpeningBracketIds) {
super(length, listHeight, missingOpeningBracketIds);
this._item1 = _item1;
this._item2 = _item2;
this._item3 = _item3;
}
deepClone() {
return new _TwoThreeListAstNode(this.length, this.listHeight, this._item1.deepClone(), this._item2.deepClone(), this._item3 ? this._item3.deepClone() : null, this.missingOpeningBracketIds);
}
appendChildOfSameHeight(node) {
if (this._item3) {
throw new Error("Cannot append to a full (2,3) tree node");
}
this.throwIfImmutable();
this._item3 = node;
this.handleChildrenChanged();
}
unappendChild() {
if (!this._item3) {
throw new Error("Cannot remove from a non-full (2,3) tree node");
}
this.throwIfImmutable();
const result = this._item3;
this._item3 = null;
this.handleChildrenChanged();
return result;
}
prependChildOfSameHeight(node) {
if (this._item3) {
throw new Error("Cannot prepend to a full (2,3) tree node");
}
this.throwIfImmutable();
this._item3 = this._item2;
this._item2 = this._item1;
this._item1 = node;
this.handleChildrenChanged();
}
unprependChild() {
if (!this._item3) {
throw new Error("Cannot remove from a non-full (2,3) tree node");
}
this.throwIfImmutable();
const result = this._item1;
this._item1 = this._item2;
this._item2 = this._item3;
this._item3 = null;
this.handleChildrenChanged();
return result;
}
toMutable() {
return this;
}
};
Immutable23ListAstNode = class extends TwoThreeListAstNode {
toMutable() {
return new TwoThreeListAstNode(this.length, this.listHeight, this.item1, this.item2, this.item3, this.missingOpeningBracketIds);
}
throwIfImmutable() {
throw new Error("this instance is immutable");
}
};
ArrayListAstNode = class _ArrayListAstNode extends ListAstNode {
get childrenLength() {
return this._children.length;
}
getChild(idx) {
return this._children[idx];
}
setChild(idx, child) {
this._children[idx] = child;
}
get children() {
return this._children;
}
constructor(length, listHeight, _children, missingOpeningBracketIds) {
super(length, listHeight, missingOpeningBracketIds);
this._children = _children;
}
deepClone() {
const children = new Array(this._children.length);
for (let i = 0; i < this._children.length; i++) {
children[i] = this._children[i].deepClone();
}
return new _ArrayListAstNode(this.length, this.listHeight, children, this.missingOpeningBracketIds);
}
appendChildOfSameHeight(node) {
this.throwIfImmutable();
this._children.push(node);
this.handleChildrenChanged();
}
unappendChild() {
this.throwIfImmutable();
const item = this._children.pop();
this.handleChildrenChanged();
return item;
}
prependChildOfSameHeight(node) {
this.throwIfImmutable();
this._children.unshift(node);
this.handleChildrenChanged();
}
unprependChild() {
this.throwIfImmutable();
const item = this._children.shift();
this.handleChildrenChanged();
return item;
}
toMutable() {
return this;
}
};
ImmutableArrayListAstNode = class extends ArrayListAstNode {
toMutable() {
return new ArrayListAstNode(this.length, this.listHeight, [...this.children], this.missingOpeningBracketIds);
}
throwIfImmutable() {
throw new Error("this instance is immutable");
}
};
emptyArray = [];
ImmutableLeafAstNode = class extends BaseAstNode {
get listHeight() {
return 0;
}
get childrenLength() {
return 0;
}
getChild(idx) {
return null;
}
get children() {
return emptyArray;
}
deepClone() {
return this;
}
};
TextAstNode = class extends ImmutableLeafAstNode {
get kind() {
return 0;
}
get missingOpeningBracketIds() {
return SmallImmutableSet.getEmpty();
}
canBeReused(_openedBracketIds) {
return true;
}
computeMinIndentation(offset, textModel) {
const start = lengthToObj(offset);
const startLineNumber = (start.columnCount === 0 ? start.lineCount : start.lineCount + 1) + 1;
const endLineNumber = lengthGetLineCount(lengthAdd(offset, this.length)) + 1;
let result = Number.MAX_SAFE_INTEGER;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const firstNonWsColumn = textModel.getLineFirstNonWhitespaceColumn(lineNumber);
const lineContent = textModel.getLineContent(lineNumber);
if (firstNonWsColumn === 0) {
continue;
}
const visibleColumn = CursorColumns.visibleColumnFromColumn(lineContent, firstNonWsColumn, textModel.getOptions().tabSize);
result = Math.min(result, visibleColumn);
}
return result;
}
};
BracketAstNode = class _BracketAstNode extends ImmutableLeafAstNode {
static create(length, bracketInfo, bracketIds) {
const node = new _BracketAstNode(length, bracketInfo, bracketIds);
return node;
}
get kind() {
return 1;
}
get missingOpeningBracketIds() {
return SmallImmutableSet.getEmpty();
}
constructor(length, bracketInfo, bracketIds) {
super(length);
this.bracketInfo = bracketInfo;
this.bracketIds = bracketIds;
}
get text() {
return this.bracketInfo.bracketText;
}
get languageId() {
return this.bracketInfo.languageId;
}
canBeReused(_openedBracketIds) {
return false;
}
computeMinIndentation(offset, textModel) {
return Number.MAX_SAFE_INTEGER;
}
};
InvalidBracketAstNode = class extends ImmutableLeafAstNode {
get kind() {
return 3;
}
constructor(closingBrackets, length) {
super(length);
this.missingOpeningBracketIds = closingBrackets;
}
canBeReused(openedBracketIds) {
return !openedBracketIds.intersects(this.missingOpeningBracketIds);
}
computeMinIndentation(offset, textModel) {
return Number.MAX_SAFE_INTEGER;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.js
var Token2, TextBufferTokenizer, NonPeekableTextBufferTokenizer, FastTokenizer;
var init_tokenizer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/tokenizer.js"() {
init_errors();
init_encodedTokenAttributes();
init_ast();
init_length();
init_smallImmutableSet();
Token2 = class {
constructor(length, kind, bracketId, bracketIds, astNode) {
this.length = length;
this.kind = kind;
this.bracketId = bracketId;
this.bracketIds = bracketIds;
this.astNode = astNode;
}
};
TextBufferTokenizer = class {
constructor(textModel, bracketTokens) {
this.textModel = textModel;
this.bracketTokens = bracketTokens;
this.reader = new NonPeekableTextBufferTokenizer(this.textModel, this.bracketTokens);
this._offset = lengthZero;
this.didPeek = false;
this.peeked = null;
this.textBufferLineCount = textModel.getLineCount();
this.textBufferLastLineLength = textModel.getLineLength(this.textBufferLineCount);
}
get offset() {
return this._offset;
}
get length() {
return toLength(this.textBufferLineCount - 1, this.textBufferLastLineLength);
}
skip(length) {
this.didPeek = false;
this._offset = lengthAdd(this._offset, length);
const obj = lengthToObj(this._offset);
this.reader.setPosition(obj.lineCount, obj.columnCount);
}
read() {
let token;
if (this.peeked) {
this.didPeek = false;
token = this.peeked;
} else {
token = this.reader.read();
}
if (token) {
this._offset = lengthAdd(this._offset, token.length);
}
return token;
}
peek() {
if (!this.didPeek) {
this.peeked = this.reader.read();
this.didPeek = true;
}
return this.peeked;
}
};
NonPeekableTextBufferTokenizer = class {
constructor(textModel, bracketTokens) {
this.textModel = textModel;
this.bracketTokens = bracketTokens;
this.lineIdx = 0;
this.line = null;
this.lineCharOffset = 0;
this.lineTokens = null;
this.lineTokenOffset = 0;
this.peekedToken = null;
this.textBufferLineCount = textModel.getLineCount();
this.textBufferLastLineLength = textModel.getLineLength(this.textBufferLineCount);
}
setPosition(lineIdx, column) {
if (lineIdx === this.lineIdx) {
this.lineCharOffset = column;
if (this.line !== null) {
this.lineTokenOffset = this.lineCharOffset === 0 ? 0 : this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset);
}
} else {
this.lineIdx = lineIdx;
this.lineCharOffset = column;
this.line = null;
}
this.peekedToken = null;
}
read() {
if (this.peekedToken) {
const token = this.peekedToken;
this.peekedToken = null;
this.lineCharOffset += lengthGetColumnCountIfZeroLineCount(token.length);
return token;
}
if (this.lineIdx > this.textBufferLineCount - 1 || this.lineIdx === this.textBufferLineCount - 1 && this.lineCharOffset >= this.textBufferLastLineLength) {
return null;
}
if (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);
}
const startLineIdx = this.lineIdx;
const startLineCharOffset = this.lineCharOffset;
let lengthHeuristic = 0;
while (true) {
const lineTokens = this.lineTokens;
const tokenCount = lineTokens.getCount();
let peekedBracketToken = null;
if (this.lineTokenOffset < tokenCount) {
const tokenMetadata = lineTokens.getMetadata(this.lineTokenOffset);
while (this.lineTokenOffset + 1 < tokenCount && tokenMetadata === lineTokens.getMetadata(this.lineTokenOffset + 1)) {
this.lineTokenOffset++;
}
const isOther = TokenMetadata.getTokenType(tokenMetadata) === 0;
const containsBracketType = TokenMetadata.containsBalancedBrackets(tokenMetadata);
const endOffset = lineTokens.getEndOffset(this.lineTokenOffset);
if (containsBracketType && isOther && this.lineCharOffset < endOffset) {
const languageId = lineTokens.getLanguageId(this.lineTokenOffset);
const text2 = this.line.substring(this.lineCharOffset, endOffset);
const brackets = this.bracketTokens.getSingleLanguageBracketTokens(languageId);
const regexp = brackets.regExpGlobal;
if (regexp) {
regexp.lastIndex = 0;
const match2 = regexp.exec(text2);
if (match2) {
peekedBracketToken = brackets.getToken(match2[0]);
if (peekedBracketToken) {
this.lineCharOffset += match2.index;
}
}
}
}
lengthHeuristic += endOffset - this.lineCharOffset;
if (peekedBracketToken) {
if (startLineIdx !== this.lineIdx || startLineCharOffset !== this.lineCharOffset) {
this.peekedToken = peekedBracketToken;
break;
} else {
this.lineCharOffset += lengthGetColumnCountIfZeroLineCount(peekedBracketToken.length);
return peekedBracketToken;
}
} else {
this.lineTokenOffset++;
this.lineCharOffset = endOffset;
}
} else {
if (this.lineIdx === this.textBufferLineCount - 1) {
break;
}
this.lineIdx++;
this.lineTokens = this.textModel.tokenization.getLineTokens(this.lineIdx + 1);
this.lineTokenOffset = 0;
this.line = this.lineTokens.getLineContent();
this.lineCharOffset = 0;
lengthHeuristic += 33;
if (lengthHeuristic > 1e3) {
break;
}
}
if (lengthHeuristic > 1500) {
break;
}
}
const length = lengthDiff(startLineIdx, startLineCharOffset, this.lineIdx, this.lineCharOffset);
return new Token2(length, 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));
}
};
FastTokenizer = class {
constructor(text2, brackets) {
this.text = text2;
this._offset = lengthZero;
this.idx = 0;
const regExpStr = brackets.getRegExpStr();
const regexp = regExpStr ? new RegExp(regExpStr + "|\n", "gi") : null;
const tokens = [];
let match2;
let curLineCount = 0;
let lastLineBreakOffset = 0;
let lastTokenEndOffset = 0;
let lastTokenEndLine = 0;
const smallTextTokens0Line = [];
for (let i = 0; i < 60; i++) {
smallTextTokens0Line.push(new Token2(toLength(0, i), 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(toLength(0, i))));
}
const smallTextTokens1Line = [];
for (let i = 0; i < 60; i++) {
smallTextTokens1Line.push(new Token2(toLength(1, i), 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(toLength(1, i))));
}
if (regexp) {
regexp.lastIndex = 0;
while ((match2 = regexp.exec(text2)) !== null) {
const curOffset = match2.index;
const value = match2[0];
if (value === "\n") {
curLineCount++;
lastLineBreakOffset = curOffset + 1;
} else {
if (lastTokenEndOffset !== curOffset) {
let token;
if (lastTokenEndLine === curLineCount) {
const colCount = curOffset - lastTokenEndOffset;
if (colCount < smallTextTokens0Line.length) {
token = smallTextTokens0Line[colCount];
} else {
const length = toLength(0, colCount);
token = new Token2(length, 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));
}
} else {
const lineCount = curLineCount - lastTokenEndLine;
const colCount = curOffset - lastLineBreakOffset;
if (lineCount === 1 && colCount < smallTextTokens1Line.length) {
token = smallTextTokens1Line[colCount];
} else {
const length = toLength(lineCount, colCount);
token = new Token2(length, 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length));
}
}
tokens.push(token);
}
tokens.push(brackets.getToken(value));
lastTokenEndOffset = curOffset + value.length;
lastTokenEndLine = curLineCount;
}
}
}
const offset = text2.length;
if (lastTokenEndOffset !== offset) {
const length = lastTokenEndLine === curLineCount ? toLength(0, offset - lastTokenEndOffset) : toLength(curLineCount - lastTokenEndLine, offset - lastLineBreakOffset);
tokens.push(new Token2(length, 0, -1, SmallImmutableSet.getEmpty(), new TextAstNode(length)));
}
this.length = toLength(curLineCount, offset - lastLineBreakOffset);
this.tokens = tokens;
}
get offset() {
return this._offset;
}
read() {
return this.tokens[this.idx++] || null;
}
peek() {
return this.tokens[this.idx] || null;
}
skip(length) {
throw new NotSupportedError();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/brackets.js
function prepareBracketForRegExp2(str) {
let escaped = escapeRegExpCharacters(str);
if (/^[\w ]+/.test(str)) {
escaped = `\\b${escaped}`;
}
if (/[\w ]+$/.test(str)) {
escaped = `${escaped}\\b`;
}
return escaped;
}
var BracketTokens, LanguageAgnosticBracketTokens;
var init_brackets = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/brackets.js"() {
init_strings();
init_ast();
init_length();
init_smallImmutableSet();
init_tokenizer();
BracketTokens = class _BracketTokens {
static createFromLanguage(configuration, denseKeyProvider) {
function getId(bracketInfo) {
return denseKeyProvider.getKey(`${bracketInfo.languageId}:::${bracketInfo.bracketText}`);
}
const map = /* @__PURE__ */ new Map();
for (const openingBracket of configuration.bracketsNew.openingBrackets) {
const length = toLength(0, openingBracket.bracketText.length);
const openingTextId = getId(openingBracket);
const bracketIds = SmallImmutableSet.getEmpty().add(openingTextId, identityKeyProvider);
map.set(openingBracket.bracketText, new Token2(length, 1, openingTextId, bracketIds, BracketAstNode.create(length, openingBracket, bracketIds)));
}
for (const closingBracket of configuration.bracketsNew.closingBrackets) {
const length = toLength(0, closingBracket.bracketText.length);
let bracketIds = SmallImmutableSet.getEmpty();
const closingBrackets = closingBracket.getOpeningBrackets();
for (const bracket of closingBrackets) {
bracketIds = bracketIds.add(getId(bracket), identityKeyProvider);
}
map.set(closingBracket.bracketText, new Token2(length, 2, getId(closingBrackets[0]), bracketIds, BracketAstNode.create(length, closingBracket, bracketIds)));
}
return new _BracketTokens(map);
}
constructor(map) {
this.map = map;
this.hasRegExp = false;
this._regExpGlobal = null;
}
getRegExpStr() {
if (this.isEmpty) {
return null;
} else {
const keys = [...this.map.keys()];
keys.sort();
keys.reverse();
return keys.map((k) => prepareBracketForRegExp2(k)).join("|");
}
}
/**
* Returns null if there is no such regexp (because there are no brackets).
*/
get regExpGlobal() {
if (!this.hasRegExp) {
const regExpStr = this.getRegExpStr();
this._regExpGlobal = regExpStr ? new RegExp(regExpStr, "gi") : null;
this.hasRegExp = true;
}
return this._regExpGlobal;
}
getToken(value) {
return this.map.get(value.toLowerCase());
}
findClosingTokenText(openingBracketIds) {
for (const [closingText, info] of this.map) {
if (info.kind === 2 && info.bracketIds.intersects(openingBracketIds)) {
return closingText;
}
}
return void 0;
}
get isEmpty() {
return this.map.size === 0;
}
};
LanguageAgnosticBracketTokens = class {
constructor(denseKeyProvider, getLanguageConfiguration) {
this.denseKeyProvider = denseKeyProvider;
this.getLanguageConfiguration = getLanguageConfiguration;
this.languageIdToBracketTokens = /* @__PURE__ */ new Map();
}
didLanguageChange(languageId) {
return this.languageIdToBracketTokens.has(languageId);
}
getSingleLanguageBracketTokens(languageId) {
let singleLanguageBracketTokens = this.languageIdToBracketTokens.get(languageId);
if (!singleLanguageBracketTokens) {
singleLanguageBracketTokens = BracketTokens.createFromLanguage(this.getLanguageConfiguration(languageId), this.denseKeyProvider);
this.languageIdToBracketTokens.set(languageId, singleLanguageBracketTokens);
}
return singleLanguageBracketTokens;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js
function concat23Trees(items) {
if (items.length === 0) {
return null;
}
if (items.length === 1) {
return items[0];
}
let i = 0;
function readNode() {
if (i >= items.length) {
return null;
}
const start = i;
const height = items[start].listHeight;
i++;
while (i < items.length && items[i].listHeight === height) {
i++;
}
if (i - start >= 2) {
return concat23TreesOfSameHeight(start === 0 && i === items.length ? items : items.slice(start, i), false);
} else {
return items[start];
}
}
let first2 = readNode();
let second = readNode();
if (!second) {
return first2;
}
for (let item = readNode(); item; item = readNode()) {
if (heightDiff(first2, second) <= heightDiff(second, item)) {
first2 = concat(first2, second);
second = item;
} else {
second = concat(second, item);
}
}
const result = concat(first2, second);
return result;
}
function concat23TreesOfSameHeight(items, createImmutableLists = false) {
if (items.length === 0) {
return null;
}
if (items.length === 1) {
return items[0];
}
let length = items.length;
while (length > 3) {
const newLength = length >> 1;
for (let i = 0; i < newLength; i++) {
const j = i << 1;
items[i] = ListAstNode.create23(items[j], items[j + 1], j + 3 === length ? items[j + 2] : null, createImmutableLists);
}
length = newLength;
}
return ListAstNode.create23(items[0], items[1], length >= 3 ? items[2] : null, createImmutableLists);
}
function heightDiff(node1, node2) {
return Math.abs(node1.listHeight - node2.listHeight);
}
function concat(node1, node2) {
if (node1.listHeight === node2.listHeight) {
return ListAstNode.create23(node1, node2, null, false);
} else if (node1.listHeight > node2.listHeight) {
return append2(node1, node2);
} else {
return prepend2(node2, node1);
}
}
function append2(list, nodeToAppend) {
list = list.toMutable();
let curNode = list;
const parents = [];
let nodeToAppendOfCorrectHeight;
while (true) {
if (nodeToAppend.listHeight === curNode.listHeight) {
nodeToAppendOfCorrectHeight = nodeToAppend;
break;
}
if (curNode.kind !== 4) {
throw new Error("unexpected");
}
parents.push(curNode);
curNode = curNode.makeLastElementMutable();
}
for (let i = parents.length - 1; i >= 0; i--) {
const parent = parents[i];
if (nodeToAppendOfCorrectHeight) {
if (parent.childrenLength >= 3) {
nodeToAppendOfCorrectHeight = ListAstNode.create23(parent.unappendChild(), nodeToAppendOfCorrectHeight, null, false);
} else {
parent.appendChildOfSameHeight(nodeToAppendOfCorrectHeight);
nodeToAppendOfCorrectHeight = void 0;
}
} else {
parent.handleChildrenChanged();
}
}
if (nodeToAppendOfCorrectHeight) {
return ListAstNode.create23(list, nodeToAppendOfCorrectHeight, null, false);
} else {
return list;
}
}
function prepend2(list, nodeToAppend) {
list = list.toMutable();
let curNode = list;
const parents = [];
while (nodeToAppend.listHeight !== curNode.listHeight) {
if (curNode.kind !== 4) {
throw new Error("unexpected");
}
parents.push(curNode);
curNode = curNode.makeFirstElementMutable();
}
let nodeToPrependOfCorrectHeight = nodeToAppend;
for (let i = parents.length - 1; i >= 0; i--) {
const parent = parents[i];
if (nodeToPrependOfCorrectHeight) {
if (parent.childrenLength >= 3) {
nodeToPrependOfCorrectHeight = ListAstNode.create23(nodeToPrependOfCorrectHeight, parent.unprependChild(), null, false);
} else {
parent.prependChildOfSameHeight(nodeToPrependOfCorrectHeight);
nodeToPrependOfCorrectHeight = void 0;
}
} else {
parent.handleChildrenChanged();
}
}
if (nodeToPrependOfCorrectHeight) {
return ListAstNode.create23(nodeToPrependOfCorrectHeight, list, null, false);
} else {
return list;
}
}
var init_concat23Trees = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js"() {
init_ast();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/nodeReader.js
function getNextChildIdx(node, curIdx = -1) {
while (true) {
curIdx++;
if (curIdx >= node.childrenLength) {
return -1;
}
if (node.getChild(curIdx)) {
return curIdx;
}
}
}
function lastOrUndefined(arr) {
return arr.length > 0 ? arr[arr.length - 1] : void 0;
}
var NodeReader;
var init_nodeReader = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/nodeReader.js"() {
init_length();
NodeReader = class {
constructor(node) {
this.lastOffset = lengthZero;
this.nextNodes = [node];
this.offsets = [lengthZero];
this.idxs = [];
}
/**
* Returns the longest node at `offset` that satisfies the predicate.
* @param offset must be greater than or equal to the last offset this method has been called with!
*/
readLongestNodeAt(offset, predicate) {
if (lengthLessThan(offset, this.lastOffset)) {
throw new Error("Invalid offset");
}
this.lastOffset = offset;
while (true) {
const curNode = lastOrUndefined(this.nextNodes);
if (!curNode) {
return void 0;
}
const curNodeOffset = lastOrUndefined(this.offsets);
if (lengthLessThan(offset, curNodeOffset)) {
return void 0;
}
if (lengthLessThan(curNodeOffset, offset)) {
if (lengthAdd(curNodeOffset, curNode.length) <= offset) {
this.nextNodeAfterCurrent();
} else {
const nextChildIdx = getNextChildIdx(curNode);
if (nextChildIdx !== -1) {
this.nextNodes.push(curNode.getChild(nextChildIdx));
this.offsets.push(curNodeOffset);
this.idxs.push(nextChildIdx);
} else {
this.nextNodeAfterCurrent();
}
}
} else {
if (predicate(curNode)) {
this.nextNodeAfterCurrent();
return curNode;
} else {
const nextChildIdx = getNextChildIdx(curNode);
if (nextChildIdx === -1) {
this.nextNodeAfterCurrent();
return void 0;
} else {
this.nextNodes.push(curNode.getChild(nextChildIdx));
this.offsets.push(curNodeOffset);
this.idxs.push(nextChildIdx);
}
}
}
}
}
// Navigates to the longest node that continues after the current node.
nextNodeAfterCurrent() {
while (true) {
const currentOffset = lastOrUndefined(this.offsets);
const currentNode = lastOrUndefined(this.nextNodes);
this.nextNodes.pop();
this.offsets.pop();
if (this.idxs.length === 0) {
break;
}
const parent = lastOrUndefined(this.nextNodes);
const nextChildIdx = getNextChildIdx(parent, this.idxs[this.idxs.length - 1]);
if (nextChildIdx !== -1) {
this.nextNodes.push(parent.getChild(nextChildIdx));
this.offsets.push(lengthAdd(currentOffset, currentNode.length));
this.idxs[this.idxs.length - 1] = nextChildIdx;
break;
} else {
this.idxs.pop();
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/parser.js
function parseDocument(tokenizer, edits, oldNode, createImmutableLists) {
const parser2 = new Parser2(tokenizer, edits, oldNode, createImmutableLists);
return parser2.parseDocument();
}
var Parser2;
var init_parser = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/parser.js"() {
init_ast();
init_beforeEditPositionMapper();
init_smallImmutableSet();
init_length();
init_concat23Trees();
init_nodeReader();
Parser2 = class {
constructor(tokenizer, edits, oldNode, createImmutableLists) {
this.tokenizer = tokenizer;
this.createImmutableLists = createImmutableLists;
this._itemsConstructed = 0;
this._itemsFromCache = 0;
if (oldNode && createImmutableLists) {
throw new Error("Not supported");
}
this.oldNodeReader = oldNode ? new NodeReader(oldNode) : void 0;
this.positionMapper = new BeforeEditPositionMapper(edits);
}
parseDocument() {
this._itemsConstructed = 0;
this._itemsFromCache = 0;
let result = this.parseList(SmallImmutableSet.getEmpty(), 0);
if (!result) {
result = ListAstNode.getEmpty();
}
return result;
}
parseList(openedBracketIds, level) {
const items = [];
while (true) {
let child = this.tryReadChildFromCache(openedBracketIds);
if (!child) {
const token = this.tokenizer.peek();
if (!token || token.kind === 2 && token.bracketIds.intersects(openedBracketIds)) {
break;
}
child = this.parseChild(openedBracketIds, level + 1);
}
if (child.kind === 4 && child.childrenLength === 0) {
continue;
}
items.push(child);
}
const result = this.oldNodeReader ? concat23Trees(items) : concat23TreesOfSameHeight(items, this.createImmutableLists);
return result;
}
tryReadChildFromCache(openedBracketIds) {
if (this.oldNodeReader) {
const maxCacheableLength = this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);
if (maxCacheableLength === null || !lengthIsZero(maxCacheableLength)) {
const cachedNode = this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset), (curNode) => {
if (maxCacheableLength !== null && !lengthLessThan(curNode.length, maxCacheableLength)) {
return false;
}
const canBeReused = curNode.canBeReused(openedBracketIds);
return canBeReused;
});
if (cachedNode) {
this._itemsFromCache++;
this.tokenizer.skip(cachedNode.length);
return cachedNode;
}
}
}
return void 0;
}
parseChild(openedBracketIds, level) {
this._itemsConstructed++;
const token = this.tokenizer.read();
switch (token.kind) {
case 2:
return new InvalidBracketAstNode(token.bracketIds, token.length);
case 0:
return token.astNode;
case 1: {
if (level > 300) {
return new TextAstNode(token.length);
}
const set = openedBracketIds.merge(token.bracketIds);
const child = this.parseList(set, level + 1);
const nextToken = this.tokenizer.peek();
if (nextToken && nextToken.kind === 2 && (nextToken.bracketId === token.bracketId || nextToken.bracketIds.intersects(token.bracketIds))) {
this.tokenizer.read();
return PairAstNode.create(token.astNode, child, nextToken.astNode);
} else {
return PairAstNode.create(token.astNode, child, null);
}
}
default:
throw new Error("unexpected");
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos.js
function combineTextEditInfos(textEditInfoFirst, textEditInfoSecond) {
if (textEditInfoFirst.length === 0) {
return textEditInfoSecond;
}
if (textEditInfoSecond.length === 0) {
return textEditInfoFirst;
}
const s0ToS1Map = new ArrayQueue(toLengthMapping(textEditInfoFirst));
const s1ToS2Map = toLengthMapping(textEditInfoSecond);
s1ToS2Map.push({ modified: false, lengthBefore: void 0, lengthAfter: void 0 });
let curItem = s0ToS1Map.dequeue();
function nextS0ToS1MapWithS1LengthOf(s1Length) {
if (s1Length === void 0) {
const arr = s0ToS1Map.takeWhile((v) => true) || [];
if (curItem) {
arr.unshift(curItem);
}
return arr;
}
const result2 = [];
while (curItem && !lengthIsZero(s1Length)) {
const [item, remainingItem] = curItem.splitAt(s1Length);
result2.push(item);
s1Length = lengthDiffNonNegative(item.lengthAfter, s1Length);
curItem = remainingItem !== null && remainingItem !== void 0 ? remainingItem : s0ToS1Map.dequeue();
}
if (!lengthIsZero(s1Length)) {
result2.push(new LengthMapping(false, s1Length, s1Length));
}
return result2;
}
const result = [];
function pushEdit(startOffset, endOffset, newLength) {
if (result.length > 0 && lengthEquals(result[result.length - 1].endOffset, startOffset)) {
const lastResult = result[result.length - 1];
result[result.length - 1] = new TextEditInfo(lastResult.startOffset, endOffset, lengthAdd(lastResult.newLength, newLength));
} else {
result.push({ startOffset, endOffset, newLength });
}
}
let s0offset = lengthZero;
for (const s1ToS2 of s1ToS2Map) {
const s0ToS1Map2 = nextS0ToS1MapWithS1LengthOf(s1ToS2.lengthBefore);
if (s1ToS2.modified) {
const s0Length = sumLengths(s0ToS1Map2, (s) => s.lengthBefore);
const s0EndOffset = lengthAdd(s0offset, s0Length);
pushEdit(s0offset, s0EndOffset, s1ToS2.lengthAfter);
s0offset = s0EndOffset;
} else {
for (const s1 of s0ToS1Map2) {
const s0startOffset = s0offset;
s0offset = lengthAdd(s0offset, s1.lengthBefore);
if (s1.modified) {
pushEdit(s0startOffset, s0offset, s1.lengthAfter);
}
}
}
}
return result;
}
function toLengthMapping(textEditInfos) {
const result = [];
let lastOffset = lengthZero;
for (const textEditInfo of textEditInfos) {
const spaceLength = lengthDiffNonNegative(lastOffset, textEditInfo.startOffset);
if (!lengthIsZero(spaceLength)) {
result.push(new LengthMapping(false, spaceLength, spaceLength));
}
const lengthBefore = lengthDiffNonNegative(textEditInfo.startOffset, textEditInfo.endOffset);
result.push(new LengthMapping(true, lengthBefore, textEditInfo.newLength));
lastOffset = textEditInfo.endOffset;
}
return result;
}
var LengthMapping;
var init_combineTextEditInfos = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/combineTextEditInfos.js"() {
init_arrays();
init_beforeEditPositionMapper();
init_length();
LengthMapping = class _LengthMapping {
constructor(modified, lengthBefore, lengthAfter) {
this.modified = modified;
this.lengthBefore = lengthBefore;
this.lengthAfter = lengthAfter;
}
splitAt(lengthAfter) {
const remainingLengthAfter = lengthDiffNonNegative(lengthAfter, this.lengthAfter);
if (lengthEquals(remainingLengthAfter, lengthZero)) {
return [this, void 0];
} else if (this.modified) {
return [
new _LengthMapping(this.modified, this.lengthBefore, lengthAfter),
new _LengthMapping(this.modified, lengthZero, remainingLengthAfter)
];
} else {
return [
new _LengthMapping(this.modified, lengthAfter, lengthAfter),
new _LengthMapping(this.modified, remainingLengthAfter, remainingLengthAfter)
];
}
}
toString() {
return `${this.modified ? "M" : "U"}:${lengthToObj(this.lengthBefore)} -> ${lengthToObj(this.lengthAfter)}`;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.js
function getFirstBracketBefore(node, nodeOffsetStart, nodeOffsetEnd, position) {
if (node.kind === 4 || node.kind === 2) {
const lengths = [];
for (const child of node.children) {
nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);
lengths.push({ nodeOffsetStart, nodeOffsetEnd });
nodeOffsetStart = nodeOffsetEnd;
}
for (let i = lengths.length - 1; i >= 0; i--) {
const { nodeOffsetStart: nodeOffsetStart2, nodeOffsetEnd: nodeOffsetEnd2 } = lengths[i];
if (lengthLessThan(nodeOffsetStart2, position)) {
const result = getFirstBracketBefore(node.children[i], nodeOffsetStart2, nodeOffsetEnd2, position);
if (result) {
return result;
}
}
}
return null;
} else if (node.kind === 3) {
return null;
} else if (node.kind === 1) {
const range2 = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
return {
bracketInfo: node.bracketInfo,
range: range2
};
}
return null;
}
function getFirstBracketAfter(node, nodeOffsetStart, nodeOffsetEnd, position) {
if (node.kind === 4 || node.kind === 2) {
for (const child of node.children) {
nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);
if (lengthLessThan(position, nodeOffsetEnd)) {
const result = getFirstBracketAfter(child, nodeOffsetStart, nodeOffsetEnd, position);
if (result) {
return result;
}
}
nodeOffsetStart = nodeOffsetEnd;
}
return null;
} else if (node.kind === 3) {
return null;
} else if (node.kind === 1) {
const range2 = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
return {
bracketInfo: node.bracketInfo,
range: range2
};
}
return null;
}
function collectBrackets(node, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, level, nestingLevelOfEqualBracketType, levelPerBracketType, onlyColorizedBrackets, parentPairIsIncomplete = false) {
if (level > 200) {
return true;
}
whileLoop: while (true) {
switch (node.kind) {
case 4: {
const childCount = node.childrenLength;
for (let i = 0; i < childCount; i++) {
const child = node.getChild(i);
if (!child) {
continue;
}
nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);
if (lengthLessThanEqual(nodeOffsetStart, endOffset) && lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {
const childEndsAfterEnd = lengthGreaterThanEqual(nodeOffsetEnd, endOffset);
if (childEndsAfterEnd) {
node = child;
continue whileLoop;
}
const shouldContinue = collectBrackets(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, level, 0, levelPerBracketType, onlyColorizedBrackets);
if (!shouldContinue) {
return false;
}
}
nodeOffsetStart = nodeOffsetEnd;
}
return true;
}
case 2: {
const colorize2 = !onlyColorizedBrackets || !node.closingBracket || node.closingBracket.bracketInfo.closesColorized(node.openingBracket.bracketInfo);
let levelPerBracket = 0;
if (levelPerBracketType) {
let existing = levelPerBracketType.get(node.openingBracket.text);
if (existing === void 0) {
existing = 0;
}
levelPerBracket = existing;
if (colorize2) {
existing++;
levelPerBracketType.set(node.openingBracket.text, existing);
}
}
const childCount = node.childrenLength;
for (let i = 0; i < childCount; i++) {
const child = node.getChild(i);
if (!child) {
continue;
}
nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);
if (lengthLessThanEqual(nodeOffsetStart, endOffset) && lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {
const childEndsAfterEnd = lengthGreaterThanEqual(nodeOffsetEnd, endOffset);
if (childEndsAfterEnd && child.kind !== 1) {
node = child;
if (colorize2) {
level++;
nestingLevelOfEqualBracketType = levelPerBracket + 1;
} else {
nestingLevelOfEqualBracketType = levelPerBracket;
}
continue whileLoop;
}
if (colorize2 || child.kind !== 1 || !node.closingBracket) {
const shouldContinue = collectBrackets(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, push, colorize2 ? level + 1 : level, colorize2 ? levelPerBracket + 1 : levelPerBracket, levelPerBracketType, onlyColorizedBrackets, !node.closingBracket);
if (!shouldContinue) {
return false;
}
}
}
nodeOffsetStart = nodeOffsetEnd;
}
levelPerBracketType === null || levelPerBracketType === void 0 ? void 0 : levelPerBracketType.set(node.openingBracket.text, levelPerBracket);
return true;
}
case 3: {
const range2 = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
return push(new BracketInfo(range2, level - 1, 0, true));
}
case 1: {
const range2 = lengthsToRange(nodeOffsetStart, nodeOffsetEnd);
return push(new BracketInfo(range2, level - 1, nestingLevelOfEqualBracketType - 1, parentPairIsIncomplete));
}
case 0:
return true;
}
}
}
function collectBracketPairs(node, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, context, level, levelPerBracketType) {
var _a10;
if (level > 200) {
return true;
}
let shouldContinue = true;
if (node.kind === 2) {
let levelPerBracket = 0;
if (levelPerBracketType) {
let existing = levelPerBracketType.get(node.openingBracket.text);
if (existing === void 0) {
existing = 0;
}
levelPerBracket = existing;
existing++;
levelPerBracketType.set(node.openingBracket.text, existing);
}
const openingBracketEnd = lengthAdd(nodeOffsetStart, node.openingBracket.length);
let minIndentation = -1;
if (context.includeMinIndentation) {
minIndentation = node.computeMinIndentation(nodeOffsetStart, context.textModel);
}
shouldContinue = context.push(new BracketPairWithMinIndentationInfo(lengthsToRange(nodeOffsetStart, nodeOffsetEnd), lengthsToRange(nodeOffsetStart, openingBracketEnd), node.closingBracket ? lengthsToRange(lengthAdd(openingBracketEnd, ((_a10 = node.child) === null || _a10 === void 0 ? void 0 : _a10.length) || lengthZero), nodeOffsetEnd) : void 0, level, levelPerBracket, node, minIndentation));
nodeOffsetStart = openingBracketEnd;
if (shouldContinue && node.child) {
const child = node.child;
nodeOffsetEnd = lengthAdd(nodeOffsetStart, child.length);
if (lengthLessThanEqual(nodeOffsetStart, endOffset) && lengthGreaterThanEqual(nodeOffsetEnd, startOffset)) {
shouldContinue = collectBracketPairs(child, nodeOffsetStart, nodeOffsetEnd, startOffset, endOffset, context, level + 1, levelPerBracketType);
if (!shouldContinue) {
return false;
}
}
}
levelPerBracketType === null || levelPerBracketType === void 0 ? void 0 : levelPerBracketType.set(node.openingBracket.text, levelPerBracket);
} else {
let curOffset = nodeOffsetStart;
for (const child of node.children) {
const childOffset = curOffset;
curOffset = lengthAdd(curOffset, child.length);
if (lengthLessThanEqual(childOffset, endOffset) && lengthLessThanEqual(startOffset, curOffset)) {
shouldContinue = collectBracketPairs(child, childOffset, curOffset, startOffset, endOffset, context, level, levelPerBracketType);
if (!shouldContinue) {
return false;
}
}
}
}
return shouldContinue;
}
var BracketPairsTree, CollectBracketPairsContext;
var init_bracketPairsTree = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/bracketPairsTree.js"() {
init_event();
init_lifecycle();
init_textModelBracketPairs();
init_beforeEditPositionMapper();
init_brackets();
init_length();
init_parser();
init_smallImmutableSet();
init_tokenizer();
init_arrays();
init_combineTextEditInfos();
BracketPairsTree = class extends Disposable {
didLanguageChange(languageId) {
return this.brackets.didLanguageChange(languageId);
}
constructor(textModel, getLanguageConfiguration) {
super();
this.textModel = textModel;
this.getLanguageConfiguration = getLanguageConfiguration;
this.didChangeEmitter = new Emitter();
this.denseKeyProvider = new DenseKeyProvider();
this.brackets = new LanguageAgnosticBracketTokens(this.denseKeyProvider, this.getLanguageConfiguration);
this.onDidChange = this.didChangeEmitter.event;
this.queuedTextEditsForInitialAstWithoutTokens = [];
this.queuedTextEdits = [];
if (!textModel.tokenization.hasTokens) {
const brackets = this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId());
const tokenizer = new FastTokenizer(this.textModel.getValue(), brackets);
this.initialAstWithoutTokens = parseDocument(tokenizer, [], void 0, true);
this.astWithTokens = this.initialAstWithoutTokens;
} else if (textModel.tokenization.backgroundTokenizationState === 2) {
this.initialAstWithoutTokens = void 0;
this.astWithTokens = this.parseDocumentFromTextBuffer([], void 0, false);
} else {
this.initialAstWithoutTokens = this.parseDocumentFromTextBuffer([], void 0, true);
this.astWithTokens = this.initialAstWithoutTokens;
}
}
//#region TextModel events
handleDidChangeBackgroundTokenizationState() {
if (this.textModel.tokenization.backgroundTokenizationState === 2) {
const wasUndefined = this.initialAstWithoutTokens === void 0;
this.initialAstWithoutTokens = void 0;
if (!wasUndefined) {
this.didChangeEmitter.fire();
}
}
}
handleDidChangeTokens({ ranges }) {
const edits = ranges.map((r) => new TextEditInfo(toLength(r.fromLineNumber - 1, 0), toLength(r.toLineNumber, 0), toLength(r.toLineNumber - r.fromLineNumber + 1, 0)));
this.handleEdits(edits, true);
if (!this.initialAstWithoutTokens) {
this.didChangeEmitter.fire();
}
}
handleContentChanged(change) {
const edits = TextEditInfo.fromModelContentChanges(change.changes);
this.handleEdits(edits, false);
}
handleEdits(edits, tokenChange) {
const result = combineTextEditInfos(this.queuedTextEdits, edits);
this.queuedTextEdits = result;
if (this.initialAstWithoutTokens && !tokenChange) {
this.queuedTextEditsForInitialAstWithoutTokens = combineTextEditInfos(this.queuedTextEditsForInitialAstWithoutTokens, edits);
}
}
//#endregion
flushQueue() {
if (this.queuedTextEdits.length > 0) {
this.astWithTokens = this.parseDocumentFromTextBuffer(this.queuedTextEdits, this.astWithTokens, false);
this.queuedTextEdits = [];
}
if (this.queuedTextEditsForInitialAstWithoutTokens.length > 0) {
if (this.initialAstWithoutTokens) {
this.initialAstWithoutTokens = this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens, this.initialAstWithoutTokens, false);
}
this.queuedTextEditsForInitialAstWithoutTokens = [];
}
}
/**
* @pure (only if isPure = true)
*/
parseDocumentFromTextBuffer(edits, previousAst, immutable) {
const isPure = false;
const previousAstClone = isPure ? previousAst === null || previousAst === void 0 ? void 0 : previousAst.deepClone() : previousAst;
const tokenizer = new TextBufferTokenizer(this.textModel, this.brackets);
const result = parseDocument(tokenizer, edits, previousAstClone, immutable);
return result;
}
getBracketsInRange(range2, onlyColorizedBrackets) {
this.flushQueue();
const startOffset = toLength(range2.startLineNumber - 1, range2.startColumn - 1);
const endOffset = toLength(range2.endLineNumber - 1, range2.endColumn - 1);
return new CallbackIterable((cb) => {
const node = this.initialAstWithoutTokens || this.astWithTokens;
collectBrackets(node, lengthZero, node.length, startOffset, endOffset, cb, 0, 0, /* @__PURE__ */ new Map(), onlyColorizedBrackets);
});
}
getBracketPairsInRange(range2, includeMinIndentation) {
this.flushQueue();
const startLength = positionToLength(range2.getStartPosition());
const endLength = positionToLength(range2.getEndPosition());
return new CallbackIterable((cb) => {
const node = this.initialAstWithoutTokens || this.astWithTokens;
const context = new CollectBracketPairsContext(cb, includeMinIndentation, this.textModel);
collectBracketPairs(node, lengthZero, node.length, startLength, endLength, context, 0, /* @__PURE__ */ new Map());
});
}
getFirstBracketAfter(position) {
this.flushQueue();
const node = this.initialAstWithoutTokens || this.astWithTokens;
return getFirstBracketAfter(node, lengthZero, node.length, positionToLength(position));
}
getFirstBracketBefore(position) {
this.flushQueue();
const node = this.initialAstWithoutTokens || this.astWithTokens;
return getFirstBracketBefore(node, lengthZero, node.length, positionToLength(position));
}
};
CollectBracketPairsContext = class {
constructor(push, includeMinIndentation, textModel) {
this.push = push;
this.includeMinIndentation = includeMinIndentation;
this.textModel = textModel;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.js
function createDisposableRef(object, disposable) {
return {
object,
dispose: () => disposable === null || disposable === void 0 ? void 0 : disposable.dispose()
};
}
function createTimeBasedContinueBracketSearchPredicate(maxDuration) {
if (typeof maxDuration === "undefined") {
return () => true;
} else {
const startTime = Date.now();
return () => {
return Date.now() - startTime <= maxDuration;
};
}
}
function stripBracketSearchCanceled(result) {
if (result instanceof BracketSearchCanceled) {
return null;
}
return result;
}
var BracketPairsTextModelPart, BracketSearchCanceled;
var init_bracketPairsImpl = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.js"() {
init_arrays();
init_event();
init_lifecycle();
init_range();
init_supports();
init_richEditBrackets();
init_bracketPairsTree();
BracketPairsTextModelPart = class extends Disposable {
get canBuildAST() {
const maxSupportedDocumentLength = (
/* max lines */
5e4 * /* average column count */
100
);
return this.textModel.getValueLength() <= maxSupportedDocumentLength;
}
constructor(textModel, languageConfigurationService) {
super();
this.textModel = textModel;
this.languageConfigurationService = languageConfigurationService;
this.bracketPairsTree = this._register(new MutableDisposable());
this.onDidChangeEmitter = new Emitter();
this.onDidChange = this.onDidChangeEmitter.event;
this.bracketsRequested = false;
this._register(this.languageConfigurationService.onDidChange((e) => {
var _a10;
if (!e.languageId || ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.didLanguageChange(e.languageId))) {
this.bracketPairsTree.clear();
this.updateBracketPairsTree();
}
}));
}
//#region TextModel events
handleDidChangeOptions(e) {
this.bracketPairsTree.clear();
this.updateBracketPairsTree();
}
handleDidChangeLanguage(e) {
this.bracketPairsTree.clear();
this.updateBracketPairsTree();
}
handleDidChangeContent(change) {
var _a10;
(_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.handleContentChanged(change);
}
handleDidChangeBackgroundTokenizationState() {
var _a10;
(_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.handleDidChangeBackgroundTokenizationState();
}
handleDidChangeTokens(e) {
var _a10;
(_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.handleDidChangeTokens(e);
}
//#endregion
updateBracketPairsTree() {
if (this.bracketsRequested && this.canBuildAST) {
if (!this.bracketPairsTree.value) {
const store = new DisposableStore();
this.bracketPairsTree.value = createDisposableRef(store.add(new BracketPairsTree(this.textModel, (languageId) => {
return this.languageConfigurationService.getLanguageConfiguration(languageId);
})), store);
store.add(this.bracketPairsTree.value.object.onDidChange((e) => this.onDidChangeEmitter.fire(e)));
this.onDidChangeEmitter.fire();
}
} else {
if (this.bracketPairsTree.value) {
this.bracketPairsTree.clear();
this.onDidChangeEmitter.fire();
}
}
}
/**
* Returns all bracket pairs that intersect the given range.
* The result is sorted by the start position.
*/
getBracketPairsInRange(range2) {
var _a10;
this.bracketsRequested = true;
this.updateBracketPairsTree();
return ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.getBracketPairsInRange(range2, false)) || CallbackIterable.empty;
}
getBracketPairsInRangeWithMinIndentation(range2) {
var _a10;
this.bracketsRequested = true;
this.updateBracketPairsTree();
return ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.getBracketPairsInRange(range2, true)) || CallbackIterable.empty;
}
getBracketsInRange(range2, onlyColorizedBrackets = false) {
var _a10;
this.bracketsRequested = true;
this.updateBracketPairsTree();
return ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.getBracketsInRange(range2, onlyColorizedBrackets)) || CallbackIterable.empty;
}
findMatchingBracketUp(_bracket, _position, maxDuration) {
const position = this.textModel.validatePosition(_position);
const languageId = this.textModel.getLanguageIdAtPosition(position.lineNumber, position.column);
if (this.canBuildAST) {
const closingBracketInfo = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew.getClosingBracketInfo(_bracket);
if (!closingBracketInfo) {
return null;
}
const bracketPair = this.getBracketPairsInRange(Range.fromPositions(_position, _position)).findLast((b) => closingBracketInfo.closes(b.openingBracketInfo));
if (bracketPair) {
return bracketPair.openingBracketRange;
}
return null;
} else {
const bracket = _bracket.toLowerCase();
const bracketsSupport = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
if (!bracketsSupport) {
return null;
}
const data = bracketsSupport.textIsBracket[bracket];
if (!data) {
return null;
}
return stripBracketSearchCanceled(this._findMatchingBracketUp(data, position, createTimeBasedContinueBracketSearchPredicate(maxDuration)));
}
}
matchBracket(position, maxDuration) {
if (this.canBuildAST) {
const bracketPair = this.getBracketPairsInRange(Range.fromPositions(position, position)).filter((item) => item.closingBracketRange !== void 0 && (item.openingBracketRange.containsPosition(position) || item.closingBracketRange.containsPosition(position))).findLastMaxBy(compareBy((item) => item.openingBracketRange.containsPosition(position) ? item.openingBracketRange : item.closingBracketRange, Range.compareRangesUsingStarts));
if (bracketPair) {
return [bracketPair.openingBracketRange, bracketPair.closingBracketRange];
}
return null;
} else {
const continueSearchPredicate = createTimeBasedContinueBracketSearchPredicate(maxDuration);
return this._matchBracket(this.textModel.validatePosition(position), continueSearchPredicate);
}
}
_establishBracketSearchOffsets(position, lineTokens, modeBrackets, tokenIndex) {
const tokenCount = lineTokens.getCount();
const currentLanguageId = lineTokens.getLanguageId(tokenIndex);
let searchStartOffset = Math.max(0, position.column - 1 - modeBrackets.maxBracketLength);
for (let i = tokenIndex - 1; i >= 0; i--) {
const tokenEndOffset = lineTokens.getEndOffset(i);
if (tokenEndOffset <= searchStartOffset) {
break;
}
if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {
searchStartOffset = tokenEndOffset;
break;
}
}
let searchEndOffset = Math.min(lineTokens.getLineContent().length, position.column - 1 + modeBrackets.maxBracketLength);
for (let i = tokenIndex + 1; i < tokenCount; i++) {
const tokenStartOffset = lineTokens.getStartOffset(i);
if (tokenStartOffset >= searchEndOffset) {
break;
}
if (ignoreBracketsInToken(lineTokens.getStandardTokenType(i)) || lineTokens.getLanguageId(i) !== currentLanguageId) {
searchEndOffset = tokenStartOffset;
break;
}
}
return { searchStartOffset, searchEndOffset };
}
_matchBracket(position, continueSearchPredicate) {
const lineNumber = position.lineNumber;
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const lineText = this.textModel.getLineContent(lineNumber);
const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
if (tokenIndex < 0) {
return null;
}
const currentModeBrackets = this.languageConfigurationService.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex)).brackets;
if (currentModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex))) {
let { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, currentModeBrackets, tokenIndex);
let bestResult = null;
while (true) {
const foundBracket = BracketsUtils.findNextBracketInRange(currentModeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!foundBracket) {
break;
}
if (foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {
const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();
const r = this._matchFoundBracket(foundBracket, currentModeBrackets.textIsBracket[foundBracketText], currentModeBrackets.textIsOpenBracket[foundBracketText], continueSearchPredicate);
if (r) {
if (r instanceof BracketSearchCanceled) {
return null;
}
bestResult = r;
}
}
searchStartOffset = foundBracket.endColumn - 1;
}
if (bestResult) {
return bestResult;
}
}
if (tokenIndex > 0 && lineTokens.getStartOffset(tokenIndex) === position.column - 1) {
const prevTokenIndex = tokenIndex - 1;
const prevModeBrackets = this.languageConfigurationService.getLanguageConfiguration(lineTokens.getLanguageId(prevTokenIndex)).brackets;
if (prevModeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(prevTokenIndex))) {
const { searchStartOffset, searchEndOffset } = this._establishBracketSearchOffsets(position, lineTokens, prevModeBrackets, prevTokenIndex);
const foundBracket = BracketsUtils.findPrevBracketInRange(prevModeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (foundBracket && foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {
const foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();
const r = this._matchFoundBracket(foundBracket, prevModeBrackets.textIsBracket[foundBracketText], prevModeBrackets.textIsOpenBracket[foundBracketText], continueSearchPredicate);
if (r) {
if (r instanceof BracketSearchCanceled) {
return null;
}
return r;
}
}
}
}
return null;
}
_matchFoundBracket(foundBracket, data, isOpen, continueSearchPredicate) {
if (!data) {
return null;
}
const matched = isOpen ? this._findMatchingBracketDown(data, foundBracket.getEndPosition(), continueSearchPredicate) : this._findMatchingBracketUp(data, foundBracket.getStartPosition(), continueSearchPredicate);
if (!matched) {
return null;
}
if (matched instanceof BracketSearchCanceled) {
return matched;
}
return [foundBracket, matched];
}
_findMatchingBracketUp(bracket, position, continueSearchPredicate) {
const languageId = bracket.languageId;
const reversedBracketRegex = bracket.reversedRegex;
let count = -1;
let totalCallCount = 0;
const searchPrevMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {
while (true) {
if (continueSearchPredicate && ++totalCallCount % 100 === 0 && !continueSearchPredicate()) {
return BracketSearchCanceled.INSTANCE;
}
const r = BracketsUtils.findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
if (bracket.isOpen(hitText)) {
count++;
} else if (bracket.isClose(hitText)) {
count--;
}
if (count === 0) {
return r;
}
searchEndOffset = r.startColumn - 1;
}
return null;
};
for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const tokenCount = lineTokens.getCount();
const lineText = this.textModel.getLineContent(lineNumber);
let tokenIndex = tokenCount - 1;
let searchStartOffset = lineText.length;
let searchEndOffset = lineText.length;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
}
let prevSearchInToken = true;
for (; tokenIndex >= 0; tokenIndex--) {
const searchInToken = lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex));
if (searchInToken) {
if (prevSearchInToken) {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
} else {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
} else {
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
prevSearchInToken = searchInToken;
}
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
return null;
}
_findMatchingBracketDown(bracket, position, continueSearchPredicate) {
const languageId = bracket.languageId;
const bracketRegex = bracket.forwardRegex;
let count = 1;
let totalCallCount = 0;
const searchNextMatchingBracketInRange = (lineNumber, lineText, searchStartOffset, searchEndOffset) => {
while (true) {
if (continueSearchPredicate && ++totalCallCount % 100 === 0 && !continueSearchPredicate()) {
return BracketSearchCanceled.INSTANCE;
}
const r = BracketsUtils.findNextBracketInRange(bracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
if (bracket.isOpen(hitText)) {
count++;
} else if (bracket.isClose(hitText)) {
count--;
}
if (count === 0) {
return r;
}
searchStartOffset = r.endColumn - 1;
}
return null;
};
const lineCount = this.textModel.getLineCount();
for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const tokenCount = lineTokens.getCount();
const lineText = this.textModel.getLineContent(lineNumber);
let tokenIndex = 0;
let searchStartOffset = 0;
let searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
}
let prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
const searchInToken = lineTokens.getLanguageId(tokenIndex) === languageId && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex));
if (searchInToken) {
if (prevSearchInToken) {
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
} else {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
} else {
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
prevSearchInToken = searchInToken;
}
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
return null;
}
findPrevBracket(_position) {
var _a10;
const position = this.textModel.validatePosition(_position);
if (this.canBuildAST) {
this.bracketsRequested = true;
this.updateBracketPairsTree();
return ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.getFirstBracketBefore(position)) || null;
}
let languageId = null;
let modeBrackets = null;
let bracketConfig = null;
for (let lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const tokenCount = lineTokens.getCount();
const lineText = this.textModel.getLineContent(lineNumber);
let tokenIndex = tokenCount - 1;
let searchStartOffset = lineText.length;
let searchEndOffset = lineText.length;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;
}
}
let prevSearchInToken = true;
for (; tokenIndex >= 0; tokenIndex--) {
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
if (modeBrackets && bracketConfig && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;
}
const searchInToken = !!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex));
if (searchInToken) {
if (prevSearchInToken) {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
} else {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
} else {
if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
}
}
prevSearchInToken = searchInToken;
}
if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
}
}
return null;
}
findNextBracket(_position) {
var _a10;
const position = this.textModel.validatePosition(_position);
if (this.canBuildAST) {
this.bracketsRequested = true;
this.updateBracketPairsTree();
return ((_a10 = this.bracketPairsTree.value) === null || _a10 === void 0 ? void 0 : _a10.object.getFirstBracketAfter(position)) || null;
}
const lineCount = this.textModel.getLineCount();
let languageId = null;
let modeBrackets = null;
let bracketConfig = null;
for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const tokenCount = lineTokens.getCount();
const lineText = this.textModel.getLineContent(lineNumber);
let tokenIndex = 0;
let searchStartOffset = 0;
let searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;
}
}
let prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
bracketConfig = this.languageConfigurationService.getLanguageConfiguration(languageId).bracketsNew;
}
const searchInToken = !!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex));
if (searchInToken) {
if (prevSearchInToken) {
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
} else {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
} else {
if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
}
}
prevSearchInToken = searchInToken;
}
if (bracketConfig && modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = BracketsUtils.findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(bracketConfig, r);
}
}
}
return null;
}
findEnclosingBrackets(_position, maxDuration) {
const position = this.textModel.validatePosition(_position);
if (this.canBuildAST) {
const range2 = Range.fromPositions(position);
const bracketPair = this.getBracketPairsInRange(Range.fromPositions(position, position)).findLast((item) => item.closingBracketRange !== void 0 && item.range.strictContainsRange(range2));
if (bracketPair) {
return [bracketPair.openingBracketRange, bracketPair.closingBracketRange];
}
return null;
}
const continueSearchPredicate = createTimeBasedContinueBracketSearchPredicate(maxDuration);
const lineCount = this.textModel.getLineCount();
const savedCounts = /* @__PURE__ */ new Map();
let counts = [];
const resetCounts = (languageId2, modeBrackets2) => {
if (!savedCounts.has(languageId2)) {
const tmp = [];
for (let i = 0, len = modeBrackets2 ? modeBrackets2.brackets.length : 0; i < len; i++) {
tmp[i] = 0;
}
savedCounts.set(languageId2, tmp);
}
counts = savedCounts.get(languageId2);
};
let totalCallCount = 0;
const searchInRange = (modeBrackets2, lineNumber, lineText, searchStartOffset, searchEndOffset) => {
while (true) {
if (continueSearchPredicate && ++totalCallCount % 100 === 0 && !continueSearchPredicate()) {
return BracketSearchCanceled.INSTANCE;
}
const r = BracketsUtils.findNextBracketInRange(modeBrackets2.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
const hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
const bracket = modeBrackets2.textIsBracket[hitText];
if (bracket) {
if (bracket.isOpen(hitText)) {
counts[bracket.index]++;
} else if (bracket.isClose(hitText)) {
counts[bracket.index]--;
}
if (counts[bracket.index] === -1) {
return this._matchFoundBracket(r, bracket, false, continueSearchPredicate);
}
}
searchStartOffset = r.endColumn - 1;
}
return null;
};
let languageId = null;
let modeBrackets = null;
for (let lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
const lineTokens = this.textModel.tokenization.getLineTokens(lineNumber);
const tokenCount = lineTokens.getCount();
const lineText = this.textModel.getLineContent(lineNumber);
let tokenIndex = 0;
let searchStartOffset = 0;
let searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
resetCounts(languageId, modeBrackets);
}
}
let prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
const tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return stripBracketSearchCanceled(r);
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = this.languageConfigurationService.getLanguageConfiguration(languageId).brackets;
resetCounts(languageId, modeBrackets);
}
const searchInToken = !!modeBrackets && !ignoreBracketsInToken(lineTokens.getStandardTokenType(tokenIndex));
if (searchInToken) {
if (prevSearchInToken) {
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
} else {
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
} else {
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return stripBracketSearchCanceled(r);
}
}
}
prevSearchInToken = searchInToken;
}
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
const r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return stripBracketSearchCanceled(r);
}
}
}
return null;
}
_toFoundBracket(bracketConfig, r) {
if (!r) {
return null;
}
let text2 = this.textModel.getValueInRange(r);
text2 = text2.toLowerCase();
const bracketInfo = bracketConfig.getBracketInfo(text2);
if (!bracketInfo) {
return null;
}
return {
range: r,
bracketInfo
};
}
};
BracketSearchCanceled = class {
constructor() {
this._searchCanceledBrand = void 0;
}
};
BracketSearchCanceled.INSTANCE = new BracketSearchCanceled();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js
var ColorizedBracketPairsDecorationProvider, ColorProvider;
var init_colorizedBracketPairsDecorationProvider = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js"() {
init_event();
init_lifecycle();
init_range();
init_editorColorRegistry();
init_themeService();
ColorizedBracketPairsDecorationProvider = class extends Disposable {
constructor(textModel) {
super();
this.textModel = textModel;
this.colorProvider = new ColorProvider();
this.onDidChangeEmitter = new Emitter();
this.onDidChange = this.onDidChangeEmitter.event;
this.colorizationOptions = textModel.getOptions().bracketPairColorizationOptions;
this._register(textModel.bracketPairs.onDidChange((e) => {
this.onDidChangeEmitter.fire();
}));
}
//#region TextModel events
handleDidChangeOptions(e) {
this.colorizationOptions = this.textModel.getOptions().bracketPairColorizationOptions;
}
//#endregion
getDecorationsInRange(range2, ownerId2, filterOutValidation, onlyMinimapDecorations) {
if (onlyMinimapDecorations) {
return [];
}
if (ownerId2 === void 0) {
return [];
}
if (!this.colorizationOptions.enabled) {
return [];
}
const result = this.textModel.bracketPairs.getBracketsInRange(range2, true).map((bracket) => ({
id: `bracket${bracket.range.toString()}-${bracket.nestingLevel}`,
options: {
description: "BracketPairColorization",
inlineClassName: this.colorProvider.getInlineClassName(bracket, this.colorizationOptions.independentColorPoolPerBracketType)
},
ownerId: 0,
range: bracket.range
})).toArray();
return result;
}
getAllDecorations(ownerId2, filterOutValidation) {
if (ownerId2 === void 0) {
return [];
}
if (!this.colorizationOptions.enabled) {
return [];
}
return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId2, filterOutValidation);
}
};
ColorProvider = class {
constructor() {
this.unexpectedClosingBracketClassName = "unexpected-closing-bracket";
}
getInlineClassName(bracket, independentColorPoolPerBracketType) {
if (bracket.isInvalid) {
return this.unexpectedClosingBracketClassName;
}
return this.getInlineClassNameOfLevel(independentColorPoolPerBracketType ? bracket.nestingLevelOfEqualBracketType : bracket.nestingLevel);
}
getInlineClassNameOfLevel(level) {
return `bracket-highlighting-${level % 30}`;
}
};
registerThemingParticipant((theme, collector) => {
const colors2 = [
editorBracketHighlightingForeground1,
editorBracketHighlightingForeground2,
editorBracketHighlightingForeground3,
editorBracketHighlightingForeground4,
editorBracketHighlightingForeground5,
editorBracketHighlightingForeground6
];
const colorProvider = new ColorProvider();
collector.addRule(`.monaco-editor .${colorProvider.unexpectedClosingBracketClassName} { color: ${theme.getColor(editorBracketHighlightingUnexpectedBracketForeground)}; }`);
const colorValues = colors2.map((c) => theme.getColor(c)).filter((c) => !!c).filter((c) => !c.isTransparent());
for (let level = 0; level < 30; level++) {
const color = colorValues[level % colorValues.length];
collector.addRule(`.monaco-editor .${colorProvider.getInlineClassNameOfLevel(level)} { color: ${color}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/textChange.js
function escapeNewLine(str) {
return str.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
}
function compressConsecutiveTextChanges(prevEdits, currEdits) {
if (prevEdits === null || prevEdits.length === 0) {
return currEdits;
}
const compressor = new TextChangeCompressor(prevEdits, currEdits);
return compressor.compress();
}
var TextChange, TextChangeCompressor;
var init_textChange = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/textChange.js"() {
init_buffer();
init_stringBuilder();
TextChange = class _TextChange {
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(oldPosition, oldText, newPosition, newText) {
this.oldPosition = oldPosition;
this.oldText = oldText;
this.newPosition = newPosition;
this.newText = newText;
}
toString() {
if (this.oldText.length === 0) {
return `(insert@${this.oldPosition} "${escapeNewLine(this.newText)}")`;
}
if (this.newText.length === 0) {
return `(delete@${this.oldPosition} "${escapeNewLine(this.oldText)}")`;
}
return `(replace@${this.oldPosition} "${escapeNewLine(this.oldText)}" with "${escapeNewLine(this.newText)}")`;
}
static _writeStringSize(str) {
return 4 + 2 * str.length;
}
static _writeString(b, str, offset) {
const len = str.length;
writeUInt32BE(b, len, offset);
offset += 4;
for (let i = 0; i < len; i++) {
writeUInt16LE(b, str.charCodeAt(i), offset);
offset += 2;
}
return offset;
}
static _readString(b, offset) {
const len = readUInt32BE(b, offset);
offset += 4;
return decodeUTF16LE(b, offset, len);
}
writeSize() {
return 4 + 4 + _TextChange._writeStringSize(this.oldText) + _TextChange._writeStringSize(this.newText);
}
write(b, offset) {
writeUInt32BE(b, this.oldPosition, offset);
offset += 4;
writeUInt32BE(b, this.newPosition, offset);
offset += 4;
offset = _TextChange._writeString(b, this.oldText, offset);
offset = _TextChange._writeString(b, this.newText, offset);
return offset;
}
static read(b, offset, dest) {
const oldPosition = readUInt32BE(b, offset);
offset += 4;
const newPosition = readUInt32BE(b, offset);
offset += 4;
const oldText = _TextChange._readString(b, offset);
offset += _TextChange._writeStringSize(oldText);
const newText = _TextChange._readString(b, offset);
offset += _TextChange._writeStringSize(newText);
dest.push(new _TextChange(oldPosition, oldText, newPosition, newText));
return offset;
}
};
TextChangeCompressor = class _TextChangeCompressor {
constructor(prevEdits, currEdits) {
this._prevEdits = prevEdits;
this._currEdits = currEdits;
this._result = [];
this._resultLen = 0;
this._prevLen = this._prevEdits.length;
this._prevDeltaOffset = 0;
this._currLen = this._currEdits.length;
this._currDeltaOffset = 0;
}
compress() {
let prevIndex = 0;
let currIndex = 0;
let prevEdit = this._getPrev(prevIndex);
let currEdit = this._getCurr(currIndex);
while (prevIndex < this._prevLen || currIndex < this._currLen) {
if (prevEdit === null) {
this._acceptCurr(currEdit);
currEdit = this._getCurr(++currIndex);
continue;
}
if (currEdit === null) {
this._acceptPrev(prevEdit);
prevEdit = this._getPrev(++prevIndex);
continue;
}
if (currEdit.oldEnd <= prevEdit.newPosition) {
this._acceptCurr(currEdit);
currEdit = this._getCurr(++currIndex);
continue;
}
if (prevEdit.newEnd <= currEdit.oldPosition) {
this._acceptPrev(prevEdit);
prevEdit = this._getPrev(++prevIndex);
continue;
}
if (currEdit.oldPosition < prevEdit.newPosition) {
const [e1, e2] = _TextChangeCompressor._splitCurr(currEdit, prevEdit.newPosition - currEdit.oldPosition);
this._acceptCurr(e1);
currEdit = e2;
continue;
}
if (prevEdit.newPosition < currEdit.oldPosition) {
const [e1, e2] = _TextChangeCompressor._splitPrev(prevEdit, currEdit.oldPosition - prevEdit.newPosition);
this._acceptPrev(e1);
prevEdit = e2;
continue;
}
let mergePrev;
let mergeCurr;
if (currEdit.oldEnd === prevEdit.newEnd) {
mergePrev = prevEdit;
mergeCurr = currEdit;
prevEdit = this._getPrev(++prevIndex);
currEdit = this._getCurr(++currIndex);
} else if (currEdit.oldEnd < prevEdit.newEnd) {
const [e1, e2] = _TextChangeCompressor._splitPrev(prevEdit, currEdit.oldLength);
mergePrev = e1;
mergeCurr = currEdit;
prevEdit = e2;
currEdit = this._getCurr(++currIndex);
} else {
const [e1, e2] = _TextChangeCompressor._splitCurr(currEdit, prevEdit.newLength);
mergePrev = prevEdit;
mergeCurr = e1;
prevEdit = this._getPrev(++prevIndex);
currEdit = e2;
}
this._result[this._resultLen++] = new TextChange(mergePrev.oldPosition, mergePrev.oldText, mergeCurr.newPosition, mergeCurr.newText);
this._prevDeltaOffset += mergePrev.newLength - mergePrev.oldLength;
this._currDeltaOffset += mergeCurr.newLength - mergeCurr.oldLength;
}
const merged = _TextChangeCompressor._merge(this._result);
const cleaned = _TextChangeCompressor._removeNoOps(merged);
return cleaned;
}
_acceptCurr(currEdit) {
this._result[this._resultLen++] = _TextChangeCompressor._rebaseCurr(this._prevDeltaOffset, currEdit);
this._currDeltaOffset += currEdit.newLength - currEdit.oldLength;
}
_getCurr(currIndex) {
return currIndex < this._currLen ? this._currEdits[currIndex] : null;
}
_acceptPrev(prevEdit) {
this._result[this._resultLen++] = _TextChangeCompressor._rebasePrev(this._currDeltaOffset, prevEdit);
this._prevDeltaOffset += prevEdit.newLength - prevEdit.oldLength;
}
_getPrev(prevIndex) {
return prevIndex < this._prevLen ? this._prevEdits[prevIndex] : null;
}
static _rebaseCurr(prevDeltaOffset, currEdit) {
return new TextChange(currEdit.oldPosition - prevDeltaOffset, currEdit.oldText, currEdit.newPosition, currEdit.newText);
}
static _rebasePrev(currDeltaOffset, prevEdit) {
return new TextChange(prevEdit.oldPosition, prevEdit.oldText, prevEdit.newPosition + currDeltaOffset, prevEdit.newText);
}
static _splitPrev(edit, offset) {
const preText = edit.newText.substr(0, offset);
const postText = edit.newText.substr(offset);
return [
new TextChange(edit.oldPosition, edit.oldText, edit.newPosition, preText),
new TextChange(edit.oldEnd, "", edit.newPosition + offset, postText)
];
}
static _splitCurr(edit, offset) {
const preText = edit.oldText.substr(0, offset);
const postText = edit.oldText.substr(offset);
return [
new TextChange(edit.oldPosition, preText, edit.newPosition, edit.newText),
new TextChange(edit.oldPosition + offset, postText, edit.newEnd, "")
];
}
static _merge(edits) {
if (edits.length === 0) {
return edits;
}
const result = [];
let resultLen = 0;
let prev = edits[0];
for (let i = 1; i < edits.length; i++) {
const curr = edits[i];
if (prev.oldEnd === curr.oldPosition) {
prev = new TextChange(prev.oldPosition, prev.oldText + curr.oldText, prev.newPosition, prev.newText + curr.newText);
} else {
result[resultLen++] = prev;
prev = curr;
}
}
result[resultLen++] = prev;
return result;
}
static _removeNoOps(edits) {
if (edits.length === 0) {
return edits;
}
const result = [];
let resultLen = 0;
for (let i = 0; i < edits.length; i++) {
const edit = edits[i];
if (edit.oldText === edit.newText) {
continue;
}
result[resultLen++] = edit;
}
return result;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/extpath.js
function isPathSeparator2(code) {
return code === 47 || code === 92;
}
function toSlashes(osPath) {
return osPath.replace(/[\\/]/g, posix.sep);
}
function toPosixPath(osPath) {
if (osPath.indexOf("/") === -1) {
osPath = toSlashes(osPath);
}
if (/^[a-zA-Z]:(\/|$)/.test(osPath)) {
osPath = "/" + osPath;
}
return osPath;
}
function getRoot(path, sep2 = posix.sep) {
if (!path) {
return "";
}
const len = path.length;
const firstLetter = path.charCodeAt(0);
if (isPathSeparator2(firstLetter)) {
if (isPathSeparator2(path.charCodeAt(1))) {
if (!isPathSeparator2(path.charCodeAt(2))) {
let pos2 = 3;
const start = pos2;
for (; pos2 < len; pos2++) {
if (isPathSeparator2(path.charCodeAt(pos2))) {
break;
}
}
if (start !== pos2 && !isPathSeparator2(path.charCodeAt(pos2 + 1))) {
pos2 += 1;
for (; pos2 < len; pos2++) {
if (isPathSeparator2(path.charCodeAt(pos2))) {
return path.slice(0, pos2 + 1).replace(/[\\/]/g, sep2);
}
}
}
}
}
return sep2;
} else if (isWindowsDriveLetter(firstLetter)) {
if (path.charCodeAt(1) === 58) {
if (isPathSeparator2(path.charCodeAt(2))) {
return path.slice(0, 2) + sep2;
} else {
return path.slice(0, 2);
}
}
}
let pos = path.indexOf("://");
if (pos !== -1) {
pos += 3;
for (; pos < len; pos++) {
if (isPathSeparator2(path.charCodeAt(pos))) {
return path.slice(0, pos + 1);
}
}
}
return "";
}
function isEqualOrParent(base, parentCandidate, ignoreCase, separator = sep) {
if (base === parentCandidate) {
return true;
}
if (!base || !parentCandidate) {
return false;
}
if (parentCandidate.length > base.length) {
return false;
}
if (ignoreCase) {
const beginsWith = startsWithIgnoreCase(base, parentCandidate);
if (!beginsWith) {
return false;
}
if (parentCandidate.length === base.length) {
return true;
}
let sepOffset = parentCandidate.length;
if (parentCandidate.charAt(parentCandidate.length - 1) === separator) {
sepOffset--;
}
return base.charAt(sepOffset) === separator;
}
if (parentCandidate.charAt(parentCandidate.length - 1) !== separator) {
parentCandidate += separator;
}
return base.indexOf(parentCandidate) === 0;
}
function isWindowsDriveLetter(char0) {
return char0 >= 65 && char0 <= 90 || char0 >= 97 && char0 <= 122;
}
function hasDriveLetter(path, isWindowsOS = isWindows) {
if (isWindowsOS) {
return isWindowsDriveLetter(path.charCodeAt(0)) && path.charCodeAt(1) === 58;
}
return false;
}
var init_extpath = __esm({
"node_modules/monaco-editor/esm/vs/base/common/extpath.js"() {
init_path();
init_platform();
init_strings();
}
});
// node_modules/monaco-editor/esm/vs/base/common/resources.js
function originalFSPath(uri) {
return uriToFsPath(uri, true);
}
var ExtUri, extUri, extUriBiasedIgnorePathCase, extUriIgnorePathCase, isEqual, isEqualOrParent2, getComparisonKey, basenameOrAuthority, basename2, extname2, dirname2, joinPath, normalizePath, relativePath, resolvePath, isAbsolutePath, isEqualAuthority, hasTrailingPathSeparator, removeTrailingPathSeparator, addTrailingPathSeparator, DataUri;
var init_resources = __esm({
"node_modules/monaco-editor/esm/vs/base/common/resources.js"() {
init_extpath();
init_network();
init_path();
init_platform();
init_strings();
init_uri();
ExtUri = class {
constructor(_ignorePathCasing) {
this._ignorePathCasing = _ignorePathCasing;
}
compare(uri1, uri2, ignoreFragment = false) {
if (uri1 === uri2) {
return 0;
}
return compare(this.getComparisonKey(uri1, ignoreFragment), this.getComparisonKey(uri2, ignoreFragment));
}
isEqual(uri1, uri2, ignoreFragment = false) {
if (uri1 === uri2) {
return true;
}
if (!uri1 || !uri2) {
return false;
}
return this.getComparisonKey(uri1, ignoreFragment) === this.getComparisonKey(uri2, ignoreFragment);
}
getComparisonKey(uri, ignoreFragment = false) {
return uri.with({
path: this._ignorePathCasing(uri) ? uri.path.toLowerCase() : void 0,
fragment: ignoreFragment ? null : void 0
}).toString();
}
isEqualOrParent(base, parentCandidate, ignoreFragment = false) {
if (base.scheme === parentCandidate.scheme) {
if (base.scheme === Schemas.file) {
return isEqualOrParent(originalFSPath(base), originalFSPath(parentCandidate), this._ignorePathCasing(base)) && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
}
if (isEqualAuthority(base.authority, parentCandidate.authority)) {
return isEqualOrParent(base.path, parentCandidate.path, this._ignorePathCasing(base), "/") && base.query === parentCandidate.query && (ignoreFragment || base.fragment === parentCandidate.fragment);
}
}
return false;
}
// --- path math
joinPath(resource, ...pathFragment) {
return URI.joinPath(resource, ...pathFragment);
}
basenameOrAuthority(resource) {
return basename2(resource) || resource.authority;
}
basename(resource) {
return posix.basename(resource.path);
}
extname(resource) {
return posix.extname(resource.path);
}
dirname(resource) {
if (resource.path.length === 0) {
return resource;
}
let dirname4;
if (resource.scheme === Schemas.file) {
dirname4 = URI.file(dirname(originalFSPath(resource))).path;
} else {
dirname4 = posix.dirname(resource.path);
if (resource.authority && dirname4.length && dirname4.charCodeAt(0) !== 47) {
console.error(`dirname("${resource.toString})) resulted in a relative path`);
dirname4 = "/";
}
}
return resource.with({
path: dirname4
});
}
normalizePath(resource) {
if (!resource.path.length) {
return resource;
}
let normalizedPath;
if (resource.scheme === Schemas.file) {
normalizedPath = URI.file(normalize(originalFSPath(resource))).path;
} else {
normalizedPath = posix.normalize(resource.path);
}
return resource.with({
path: normalizedPath
});
}
relativePath(from, to) {
if (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) {
return void 0;
}
if (from.scheme === Schemas.file) {
const relativePath2 = relative(originalFSPath(from), originalFSPath(to));
return isWindows ? toSlashes(relativePath2) : relativePath2;
}
let fromPath = from.path || "/";
const toPath = to.path || "/";
if (this._ignorePathCasing(from)) {
let i = 0;
for (const len = Math.min(fromPath.length, toPath.length); i < len; i++) {
if (fromPath.charCodeAt(i) !== toPath.charCodeAt(i)) {
if (fromPath.charAt(i).toLowerCase() !== toPath.charAt(i).toLowerCase()) {
break;
}
}
}
fromPath = toPath.substr(0, i) + fromPath.substr(i);
}
return posix.relative(fromPath, toPath);
}
resolvePath(base, path) {
if (base.scheme === Schemas.file) {
const newURI = URI.file(resolve(originalFSPath(base), path));
return base.with({
authority: newURI.authority,
path: newURI.path
});
}
path = toPosixPath(path);
return base.with({
path: posix.resolve(base.path, path)
});
}
// --- misc
isAbsolutePath(resource) {
return !!resource.path && resource.path[0] === "/";
}
isEqualAuthority(a1, a22) {
return a1 === a22 || a1 !== void 0 && a22 !== void 0 && equalsIgnoreCase(a1, a22);
}
hasTrailingPathSeparator(resource, sep2 = sep) {
if (resource.scheme === Schemas.file) {
const fsp = originalFSPath(resource);
return fsp.length > getRoot(fsp).length && fsp[fsp.length - 1] === sep2;
} else {
const p = resource.path;
return p.length > 1 && p.charCodeAt(p.length - 1) === 47 && !/^[a-zA-Z]:(\/$|\\$)/.test(resource.fsPath);
}
}
removeTrailingPathSeparator(resource, sep2 = sep) {
if (hasTrailingPathSeparator(resource, sep2)) {
return resource.with({ path: resource.path.substr(0, resource.path.length - 1) });
}
return resource;
}
addTrailingPathSeparator(resource, sep2 = sep) {
let isRootSep = false;
if (resource.scheme === Schemas.file) {
const fsp = originalFSPath(resource);
isRootSep = fsp !== void 0 && fsp.length === getRoot(fsp).length && fsp[fsp.length - 1] === sep2;
} else {
sep2 = "/";
const p = resource.path;
isRootSep = p.length === 1 && p.charCodeAt(p.length - 1) === 47;
}
if (!isRootSep && !hasTrailingPathSeparator(resource, sep2)) {
return resource.with({ path: resource.path + "/" });
}
return resource;
}
};
extUri = new ExtUri(() => false);
extUriBiasedIgnorePathCase = new ExtUri((uri) => {
return uri.scheme === Schemas.file ? !isLinux : true;
});
extUriIgnorePathCase = new ExtUri((_) => true);
isEqual = extUri.isEqual.bind(extUri);
isEqualOrParent2 = extUri.isEqualOrParent.bind(extUri);
getComparisonKey = extUri.getComparisonKey.bind(extUri);
basenameOrAuthority = extUri.basenameOrAuthority.bind(extUri);
basename2 = extUri.basename.bind(extUri);
extname2 = extUri.extname.bind(extUri);
dirname2 = extUri.dirname.bind(extUri);
joinPath = extUri.joinPath.bind(extUri);
normalizePath = extUri.normalizePath.bind(extUri);
relativePath = extUri.relativePath.bind(extUri);
resolvePath = extUri.resolvePath.bind(extUri);
isAbsolutePath = extUri.isAbsolutePath.bind(extUri);
isEqualAuthority = extUri.isEqualAuthority.bind(extUri);
hasTrailingPathSeparator = extUri.hasTrailingPathSeparator.bind(extUri);
removeTrailingPathSeparator = extUri.removeTrailingPathSeparator.bind(extUri);
addTrailingPathSeparator = extUri.addTrailingPathSeparator.bind(extUri);
(function(DataUri2) {
DataUri2.META_DATA_LABEL = "label";
DataUri2.META_DATA_DESCRIPTION = "description";
DataUri2.META_DATA_SIZE = "size";
DataUri2.META_DATA_MIME = "mime";
function parseMetaData(dataUri) {
const metadata = /* @__PURE__ */ new Map();
const meta = dataUri.path.substring(dataUri.path.indexOf(";") + 1, dataUri.path.lastIndexOf(";"));
meta.split(";").forEach((property) => {
const [key, value] = property.split(":");
if (key && value) {
metadata.set(key, value);
}
});
const mime = dataUri.path.substring(0, dataUri.path.indexOf(";"));
if (mime) {
metadata.set(DataUri2.META_DATA_MIME, mime);
}
return metadata;
}
DataUri2.parseMetaData = parseMetaData;
})(DataUri || (DataUri = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/editStack.js
function uriGetComparisonKey(resource) {
return resource.toString();
}
function getModelEOL(model) {
const eol = model.getEOL();
if (eol === "\n") {
return 0;
} else {
return 1;
}
}
function isEditStackElement(element) {
if (!element) {
return false;
}
return element instanceof SingleModelEditStackElement || element instanceof MultiModelEditStackElement;
}
var SingleModelEditStackData, SingleModelEditStackElement, MultiModelEditStackElement, EditStack;
var init_editStack = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/editStack.js"() {
init_nls();
init_errors();
init_selection();
init_uri();
init_textChange();
init_buffer();
init_resources();
SingleModelEditStackData = class _SingleModelEditStackData {
static create(model, beforeCursorState) {
const alternativeVersionId = model.getAlternativeVersionId();
const eol = getModelEOL(model);
return new _SingleModelEditStackData(alternativeVersionId, alternativeVersionId, eol, eol, beforeCursorState, beforeCursorState, []);
}
constructor(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes) {
this.beforeVersionId = beforeVersionId;
this.afterVersionId = afterVersionId;
this.beforeEOL = beforeEOL;
this.afterEOL = afterEOL;
this.beforeCursorState = beforeCursorState;
this.afterCursorState = afterCursorState;
this.changes = changes;
}
append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {
if (textChanges.length > 0) {
this.changes = compressConsecutiveTextChanges(this.changes, textChanges);
}
this.afterEOL = afterEOL;
this.afterVersionId = afterVersionId;
this.afterCursorState = afterCursorState;
}
static _writeSelectionsSize(selections) {
return 4 + 4 * 4 * (selections ? selections.length : 0);
}
static _writeSelections(b, selections, offset) {
writeUInt32BE(b, selections ? selections.length : 0, offset);
offset += 4;
if (selections) {
for (const selection of selections) {
writeUInt32BE(b, selection.selectionStartLineNumber, offset);
offset += 4;
writeUInt32BE(b, selection.selectionStartColumn, offset);
offset += 4;
writeUInt32BE(b, selection.positionLineNumber, offset);
offset += 4;
writeUInt32BE(b, selection.positionColumn, offset);
offset += 4;
}
}
return offset;
}
static _readSelections(b, offset, dest) {
const count = readUInt32BE(b, offset);
offset += 4;
for (let i = 0; i < count; i++) {
const selectionStartLineNumber = readUInt32BE(b, offset);
offset += 4;
const selectionStartColumn = readUInt32BE(b, offset);
offset += 4;
const positionLineNumber = readUInt32BE(b, offset);
offset += 4;
const positionColumn = readUInt32BE(b, offset);
offset += 4;
dest.push(new Selection(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn));
}
return offset;
}
serialize() {
let necessarySize = 4 + 4 + 1 + 1 + _SingleModelEditStackData._writeSelectionsSize(this.beforeCursorState) + _SingleModelEditStackData._writeSelectionsSize(this.afterCursorState) + 4;
for (const change of this.changes) {
necessarySize += change.writeSize();
}
const b = new Uint8Array(necessarySize);
let offset = 0;
writeUInt32BE(b, this.beforeVersionId, offset);
offset += 4;
writeUInt32BE(b, this.afterVersionId, offset);
offset += 4;
writeUInt8(b, this.beforeEOL, offset);
offset += 1;
writeUInt8(b, this.afterEOL, offset);
offset += 1;
offset = _SingleModelEditStackData._writeSelections(b, this.beforeCursorState, offset);
offset = _SingleModelEditStackData._writeSelections(b, this.afterCursorState, offset);
writeUInt32BE(b, this.changes.length, offset);
offset += 4;
for (const change of this.changes) {
offset = change.write(b, offset);
}
return b.buffer;
}
static deserialize(source) {
const b = new Uint8Array(source);
let offset = 0;
const beforeVersionId = readUInt32BE(b, offset);
offset += 4;
const afterVersionId = readUInt32BE(b, offset);
offset += 4;
const beforeEOL = readUInt8(b, offset);
offset += 1;
const afterEOL = readUInt8(b, offset);
offset += 1;
const beforeCursorState = [];
offset = _SingleModelEditStackData._readSelections(b, offset, beforeCursorState);
const afterCursorState = [];
offset = _SingleModelEditStackData._readSelections(b, offset, afterCursorState);
const changeCount = readUInt32BE(b, offset);
offset += 4;
const changes = [];
for (let i = 0; i < changeCount; i++) {
offset = TextChange.read(b, offset, changes);
}
return new _SingleModelEditStackData(beforeVersionId, afterVersionId, beforeEOL, afterEOL, beforeCursorState, afterCursorState, changes);
}
};
SingleModelEditStackElement = class {
get type() {
return 0;
}
get resource() {
if (URI.isUri(this.model)) {
return this.model;
}
return this.model.uri;
}
constructor(label, code, model, beforeCursorState) {
this.label = label;
this.code = code;
this.model = model;
this._data = SingleModelEditStackData.create(model, beforeCursorState);
}
toString() {
const data = this._data instanceof SingleModelEditStackData ? this._data : SingleModelEditStackData.deserialize(this._data);
return data.changes.map((change) => change.toString()).join(", ");
}
matchesResource(resource) {
const uri = URI.isUri(this.model) ? this.model : this.model.uri;
return uri.toString() === resource.toString();
}
setModel(model) {
this.model = model;
}
canAppend(model) {
return this.model === model && this._data instanceof SingleModelEditStackData;
}
append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {
if (this._data instanceof SingleModelEditStackData) {
this._data.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);
}
}
close() {
if (this._data instanceof SingleModelEditStackData) {
this._data = this._data.serialize();
}
}
open() {
if (!(this._data instanceof SingleModelEditStackData)) {
this._data = SingleModelEditStackData.deserialize(this._data);
}
}
undo() {
if (URI.isUri(this.model)) {
throw new Error(`Invalid SingleModelEditStackElement`);
}
if (this._data instanceof SingleModelEditStackData) {
this._data = this._data.serialize();
}
const data = SingleModelEditStackData.deserialize(this._data);
this.model._applyUndo(data.changes, data.beforeEOL, data.beforeVersionId, data.beforeCursorState);
}
redo() {
if (URI.isUri(this.model)) {
throw new Error(`Invalid SingleModelEditStackElement`);
}
if (this._data instanceof SingleModelEditStackData) {
this._data = this._data.serialize();
}
const data = SingleModelEditStackData.deserialize(this._data);
this.model._applyRedo(data.changes, data.afterEOL, data.afterVersionId, data.afterCursorState);
}
heapSize() {
if (this._data instanceof SingleModelEditStackData) {
this._data = this._data.serialize();
}
return this._data.byteLength + 168;
}
};
MultiModelEditStackElement = class {
get resources() {
return this._editStackElementsArr.map((editStackElement) => editStackElement.resource);
}
constructor(label, code, editStackElements) {
this.label = label;
this.code = code;
this.type = 1;
this._isOpen = true;
this._editStackElementsArr = editStackElements.slice(0);
this._editStackElementsMap = /* @__PURE__ */ new Map();
for (const editStackElement of this._editStackElementsArr) {
const key = uriGetComparisonKey(editStackElement.resource);
this._editStackElementsMap.set(key, editStackElement);
}
this._delegate = null;
}
prepareUndoRedo() {
if (this._delegate) {
return this._delegate.prepareUndoRedo(this);
}
}
matchesResource(resource) {
const key = uriGetComparisonKey(resource);
return this._editStackElementsMap.has(key);
}
setModel(model) {
const key = uriGetComparisonKey(URI.isUri(model) ? model : model.uri);
if (this._editStackElementsMap.has(key)) {
this._editStackElementsMap.get(key).setModel(model);
}
}
canAppend(model) {
if (!this._isOpen) {
return false;
}
const key = uriGetComparisonKey(model.uri);
if (this._editStackElementsMap.has(key)) {
const editStackElement = this._editStackElementsMap.get(key);
return editStackElement.canAppend(model);
}
return false;
}
append(model, textChanges, afterEOL, afterVersionId, afterCursorState) {
const key = uriGetComparisonKey(model.uri);
const editStackElement = this._editStackElementsMap.get(key);
editStackElement.append(model, textChanges, afterEOL, afterVersionId, afterCursorState);
}
close() {
this._isOpen = false;
}
open() {
}
undo() {
this._isOpen = false;
for (const editStackElement of this._editStackElementsArr) {
editStackElement.undo();
}
}
redo() {
for (const editStackElement of this._editStackElementsArr) {
editStackElement.redo();
}
}
heapSize(resource) {
const key = uriGetComparisonKey(resource);
if (this._editStackElementsMap.has(key)) {
const editStackElement = this._editStackElementsMap.get(key);
return editStackElement.heapSize();
}
return 0;
}
split() {
return this._editStackElementsArr;
}
toString() {
const result = [];
for (const editStackElement of this._editStackElementsArr) {
result.push(`${basename2(editStackElement.resource)}: ${editStackElement}`);
}
return `{${result.join(", ")}}`;
}
};
EditStack = class _EditStack {
constructor(model, undoRedoService) {
this._model = model;
this._undoRedoService = undoRedoService;
}
pushStackElement() {
const lastElement = this._undoRedoService.getLastElement(this._model.uri);
if (isEditStackElement(lastElement)) {
lastElement.close();
}
}
popStackElement() {
const lastElement = this._undoRedoService.getLastElement(this._model.uri);
if (isEditStackElement(lastElement)) {
lastElement.open();
}
}
clear() {
this._undoRedoService.removeElements(this._model.uri);
}
_getOrCreateEditStackElement(beforeCursorState, group) {
const lastElement = this._undoRedoService.getLastElement(this._model.uri);
if (isEditStackElement(lastElement) && lastElement.canAppend(this._model)) {
return lastElement;
}
const newElement = new SingleModelEditStackElement(localize("edit", "Typing"), "undoredo.textBufferEdit", this._model, beforeCursorState);
this._undoRedoService.pushElement(newElement, group);
return newElement;
}
pushEOL(eol) {
const editStackElement = this._getOrCreateEditStackElement(null, void 0);
this._model.setEOL(eol);
editStackElement.append(this._model, [], getModelEOL(this._model), this._model.getAlternativeVersionId(), null);
}
pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group) {
const editStackElement = this._getOrCreateEditStackElement(beforeCursorState, group);
const inverseEditOperations = this._model.applyEdits(editOperations, true);
const afterCursorState = _EditStack._computeCursorState(cursorStateComputer, inverseEditOperations);
const textChanges = inverseEditOperations.map((op, index) => ({ index, textChange: op.textChange }));
textChanges.sort((a3, b) => {
if (a3.textChange.oldPosition === b.textChange.oldPosition) {
return a3.index - b.index;
}
return a3.textChange.oldPosition - b.textChange.oldPosition;
});
editStackElement.append(this._model, textChanges.map((op) => op.textChange), getModelEOL(this._model), this._model.getAlternativeVersionId(), afterCursorState);
return afterCursorState;
}
static _computeCursorState(cursorStateComputer, inverseEditOperations) {
try {
return cursorStateComputer ? cursorStateComputer(inverseEditOperations) : null;
} catch (e) {
onUnexpectedError(e);
return null;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/indentationGuesser.js
function spacesDiff(a3, aLength, b, bLength, result) {
result.spacesDiff = 0;
result.looksLikeAlignment = false;
let i;
for (i = 0; i < aLength && i < bLength; i++) {
const aCharCode = a3.charCodeAt(i);
const bCharCode = b.charCodeAt(i);
if (aCharCode !== bCharCode) {
break;
}
}
let aSpacesCnt = 0, aTabsCount = 0;
for (let j = i; j < aLength; j++) {
const aCharCode = a3.charCodeAt(j);
if (aCharCode === 32) {
aSpacesCnt++;
} else {
aTabsCount++;
}
}
let bSpacesCnt = 0, bTabsCount = 0;
for (let j = i; j < bLength; j++) {
const bCharCode = b.charCodeAt(j);
if (bCharCode === 32) {
bSpacesCnt++;
} else {
bTabsCount++;
}
}
if (aSpacesCnt > 0 && aTabsCount > 0) {
return;
}
if (bSpacesCnt > 0 && bTabsCount > 0) {
return;
}
const tabsDiff = Math.abs(aTabsCount - bTabsCount);
const spacesDiff2 = Math.abs(aSpacesCnt - bSpacesCnt);
if (tabsDiff === 0) {
result.spacesDiff = spacesDiff2;
if (spacesDiff2 > 0 && 0 <= bSpacesCnt - 1 && bSpacesCnt - 1 < a3.length && bSpacesCnt < b.length) {
if (b.charCodeAt(bSpacesCnt) !== 32 && a3.charCodeAt(bSpacesCnt - 1) === 32) {
if (a3.charCodeAt(a3.length - 1) === 44) {
result.looksLikeAlignment = true;
}
}
}
return;
}
if (spacesDiff2 % tabsDiff === 0) {
result.spacesDiff = spacesDiff2 / tabsDiff;
return;
}
}
function guessIndentation(source, defaultTabSize, defaultInsertSpaces) {
const linesCount = Math.min(source.getLineCount(), 1e4);
let linesIndentedWithTabsCount = 0;
let linesIndentedWithSpacesCount = 0;
let previousLineText = "";
let previousLineIndentation = 0;
const ALLOWED_TAB_SIZE_GUESSES = [2, 4, 6, 8, 3, 5, 7];
const MAX_ALLOWED_TAB_SIZE_GUESS = 8;
const spacesDiffCount = [0, 0, 0, 0, 0, 0, 0, 0, 0];
const tmp = new SpacesDiffResult();
for (let lineNumber = 1; lineNumber <= linesCount; lineNumber++) {
const currentLineLength = source.getLineLength(lineNumber);
const currentLineText = source.getLineContent(lineNumber);
const useCurrentLineText = currentLineLength <= 65536;
let currentLineHasContent = false;
let currentLineIndentation = 0;
let currentLineSpacesCount = 0;
let currentLineTabsCount = 0;
for (let j = 0, lenJ = currentLineLength; j < lenJ; j++) {
const charCode = useCurrentLineText ? currentLineText.charCodeAt(j) : source.getLineCharCode(lineNumber, j);
if (charCode === 9) {
currentLineTabsCount++;
} else if (charCode === 32) {
currentLineSpacesCount++;
} else {
currentLineHasContent = true;
currentLineIndentation = j;
break;
}
}
if (!currentLineHasContent) {
continue;
}
if (currentLineTabsCount > 0) {
linesIndentedWithTabsCount++;
} else if (currentLineSpacesCount > 1) {
linesIndentedWithSpacesCount++;
}
spacesDiff(previousLineText, previousLineIndentation, currentLineText, currentLineIndentation, tmp);
if (tmp.looksLikeAlignment) {
if (!(defaultInsertSpaces && defaultTabSize === tmp.spacesDiff)) {
continue;
}
}
const currentSpacesDiff = tmp.spacesDiff;
if (currentSpacesDiff <= MAX_ALLOWED_TAB_SIZE_GUESS) {
spacesDiffCount[currentSpacesDiff]++;
}
previousLineText = currentLineText;
previousLineIndentation = currentLineIndentation;
}
let insertSpaces = defaultInsertSpaces;
if (linesIndentedWithTabsCount !== linesIndentedWithSpacesCount) {
insertSpaces = linesIndentedWithTabsCount < linesIndentedWithSpacesCount;
}
let tabSize = defaultTabSize;
if (insertSpaces) {
let tabSizeScore = insertSpaces ? 0 : 0.1 * linesCount;
ALLOWED_TAB_SIZE_GUESSES.forEach((possibleTabSize) => {
const possibleTabSizeScore = spacesDiffCount[possibleTabSize];
if (possibleTabSizeScore > tabSizeScore) {
tabSizeScore = possibleTabSizeScore;
tabSize = possibleTabSize;
}
});
if (tabSize === 4 && spacesDiffCount[4] > 0 && spacesDiffCount[2] > 0 && spacesDiffCount[2] >= spacesDiffCount[4] / 2) {
tabSize = 2;
}
}
return {
insertSpaces,
tabSize
};
}
var SpacesDiffResult;
var init_indentationGuesser = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/indentationGuesser.js"() {
SpacesDiffResult = class {
constructor() {
this.spacesDiff = 0;
this.looksLikeAlignment = false;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/intervalTree.js
function getNodeColor(node) {
return (node.metadata & 1) >>> 0;
}
function setNodeColor(node, color) {
node.metadata = node.metadata & 254 | color << 0;
}
function getNodeIsVisited(node) {
return (node.metadata & 2) >>> 1 === 1;
}
function setNodeIsVisited(node, value) {
node.metadata = node.metadata & 253 | (value ? 1 : 0) << 1;
}
function getNodeIsForValidation(node) {
return (node.metadata & 4) >>> 2 === 1;
}
function setNodeIsForValidation(node, value) {
node.metadata = node.metadata & 251 | (value ? 1 : 0) << 2;
}
function getNodeIsInGlyphMargin(node) {
return (node.metadata & 64) >>> 6 === 1;
}
function setNodeIsInGlyphMargin(node, value) {
node.metadata = node.metadata & 191 | (value ? 1 : 0) << 6;
}
function getNodeStickiness(node) {
return (node.metadata & 24) >>> 3;
}
function _setNodeStickiness(node, stickiness) {
node.metadata = node.metadata & 231 | stickiness << 3;
}
function getCollapseOnReplaceEdit(node) {
return (node.metadata & 32) >>> 5 === 1;
}
function setCollapseOnReplaceEdit(node, value) {
node.metadata = node.metadata & 223 | (value ? 1 : 0) << 5;
}
function normalizeDelta(T) {
let node = T.root;
let delta = 0;
while (node !== SENTINEL) {
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
node = node.left;
continue;
}
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
delta += node.delta;
node = node.right;
continue;
}
node.start = delta + node.start;
node.end = delta + node.end;
node.delta = 0;
recomputeMaxEnd(node);
setNodeIsVisited(node, true);
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
if (node === node.parent.right) {
delta -= node.parent.delta;
}
node = node.parent;
}
setNodeIsVisited(T.root, false);
}
function adjustMarkerBeforeColumn(markerOffset, markerStickToPreviousCharacter, checkOffset, moveSemantics) {
if (markerOffset < checkOffset) {
return true;
}
if (markerOffset > checkOffset) {
return false;
}
if (moveSemantics === 1) {
return false;
}
if (moveSemantics === 2) {
return true;
}
return markerStickToPreviousCharacter;
}
function nodeAcceptEdit(node, start, end, textLength, forceMoveMarkers) {
const nodeStickiness = getNodeStickiness(node);
const startStickToPreviousCharacter = nodeStickiness === 0 || nodeStickiness === 2;
const endStickToPreviousCharacter = nodeStickiness === 1 || nodeStickiness === 2;
const deletingCnt = end - start;
const insertingCnt = textLength;
const commonLength = Math.min(deletingCnt, insertingCnt);
const nodeStart = node.start;
let startDone = false;
const nodeEnd = node.end;
let endDone = false;
if (start <= nodeStart && nodeEnd <= end && getCollapseOnReplaceEdit(node)) {
node.start = start;
startDone = true;
node.end = start;
endDone = true;
}
{
const moveSemantics = forceMoveMarkers ? 1 : deletingCnt > 0 ? 2 : 0;
if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start, moveSemantics)) {
startDone = true;
}
if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start, moveSemantics)) {
endDone = true;
}
}
if (commonLength > 0 && !forceMoveMarkers) {
const moveSemantics = deletingCnt > insertingCnt ? 2 : 0;
if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start + commonLength, moveSemantics)) {
startDone = true;
}
if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start + commonLength, moveSemantics)) {
endDone = true;
}
}
{
const moveSemantics = forceMoveMarkers ? 1 : 0;
if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, end, moveSemantics)) {
node.start = start + insertingCnt;
startDone = true;
}
if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, end, moveSemantics)) {
node.end = start + insertingCnt;
endDone = true;
}
}
const deltaColumn = insertingCnt - deletingCnt;
if (!startDone) {
node.start = Math.max(0, nodeStart + deltaColumn);
}
if (!endDone) {
node.end = Math.max(0, nodeEnd + deltaColumn);
}
if (node.start > node.end) {
node.end = node.start;
}
}
function searchForEditing(T, start, end) {
let node = T.root;
let delta = 0;
let nodeMaxEnd = 0;
let nodeStart = 0;
let nodeEnd = 0;
const result = [];
let resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
if (node === node.parent.right) {
delta -= node.parent.delta;
}
node = node.parent;
continue;
}
if (!getNodeIsVisited(node.left)) {
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < start) {
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
node = node.left;
continue;
}
}
nodeStart = delta + node.start;
if (nodeStart > end) {
setNodeIsVisited(node, true);
continue;
}
nodeEnd = delta + node.end;
if (nodeEnd >= start) {
node.setCachedOffsets(nodeStart, nodeEnd, 0);
result[resultLen++] = node;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function noOverlapReplace(T, start, end, textLength) {
let node = T.root;
let delta = 0;
let nodeMaxEnd = 0;
let nodeStart = 0;
const editDelta = textLength - (end - start);
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
if (node === node.parent.right) {
delta -= node.parent.delta;
}
recomputeMaxEnd(node);
node = node.parent;
continue;
}
if (!getNodeIsVisited(node.left)) {
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < start) {
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
node = node.left;
continue;
}
}
nodeStart = delta + node.start;
if (nodeStart > end) {
node.start += editDelta;
node.end += editDelta;
node.delta += editDelta;
if (node.delta < -1073741824 || node.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
setNodeIsVisited(node, true);
continue;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
}
function collectNodesFromOwner(T, ownerId2) {
let node = T.root;
const result = [];
let resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
node = node.parent;
continue;
}
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
node = node.left;
continue;
}
if (node.ownerId === ownerId2) {
result[resultLen++] = node;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function collectNodesPostOrder(T) {
let node = T.root;
const result = [];
let resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
node = node.parent;
continue;
}
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
node = node.left;
continue;
}
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
node = node.right;
continue;
}
result[resultLen++] = node;
setNodeIsVisited(node, true);
}
setNodeIsVisited(T.root, false);
return result;
}
function search(T, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {
let node = T.root;
let delta = 0;
let nodeStart = 0;
let nodeEnd = 0;
const result = [];
let resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
if (node === node.parent.right) {
delta -= node.parent.delta;
}
node = node.parent;
continue;
}
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
node = node.left;
continue;
}
nodeStart = delta + node.start;
nodeEnd = delta + node.end;
node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
let include = true;
if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {
include = false;
}
if (filterOutValidation && getNodeIsForValidation(node)) {
include = false;
}
if (onlyMarginDecorations && !getNodeIsInGlyphMargin(node)) {
include = false;
}
if (include) {
result[resultLen++] = node;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function intervalSearch(T, intervalStart, intervalEnd, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {
let node = T.root;
let delta = 0;
let nodeMaxEnd = 0;
let nodeStart = 0;
let nodeEnd = 0;
const result = [];
let resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
if (node === node.parent.right) {
delta -= node.parent.delta;
}
node = node.parent;
continue;
}
if (!getNodeIsVisited(node.left)) {
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < intervalStart) {
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
node = node.left;
continue;
}
}
nodeStart = delta + node.start;
if (nodeStart > intervalEnd) {
setNodeIsVisited(node, true);
continue;
}
nodeEnd = delta + node.end;
if (nodeEnd >= intervalStart) {
node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
let include = true;
if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {
include = false;
}
if (filterOutValidation && getNodeIsForValidation(node)) {
include = false;
}
if (onlyMarginDecorations && !getNodeIsInGlyphMargin(node)) {
include = false;
}
if (include) {
result[resultLen++] = node;
}
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function rbTreeInsert(T, newNode) {
if (T.root === SENTINEL) {
newNode.parent = SENTINEL;
newNode.left = SENTINEL;
newNode.right = SENTINEL;
setNodeColor(
newNode,
0
/* NodeColor.Black */
);
T.root = newNode;
return T.root;
}
treeInsert(T, newNode);
recomputeMaxEndWalkToRoot(newNode.parent);
let x = newNode;
while (x !== T.root && getNodeColor(x.parent) === 1) {
if (x.parent === x.parent.parent.left) {
const y = x.parent.parent.right;
if (getNodeColor(y) === 1) {
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
y,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent.parent,
1
/* NodeColor.Red */
);
x = x.parent.parent;
} else {
if (x === x.parent.right) {
x = x.parent;
leftRotate2(T, x);
}
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent.parent,
1
/* NodeColor.Red */
);
rightRotate(T, x.parent.parent);
}
} else {
const y = x.parent.parent.left;
if (getNodeColor(y) === 1) {
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
y,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent.parent,
1
/* NodeColor.Red */
);
x = x.parent.parent;
} else {
if (x === x.parent.left) {
x = x.parent;
rightRotate(T, x);
}
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent.parent,
1
/* NodeColor.Red */
);
leftRotate2(T, x.parent.parent);
}
}
}
setNodeColor(
T.root,
0
/* NodeColor.Black */
);
return newNode;
}
function treeInsert(T, z) {
let delta = 0;
let x = T.root;
const zAbsoluteStart = z.start;
const zAbsoluteEnd = z.end;
while (true) {
const cmp3 = intervalCompare(zAbsoluteStart, zAbsoluteEnd, x.start + delta, x.end + delta);
if (cmp3 < 0) {
if (x.left === SENTINEL) {
z.start -= delta;
z.end -= delta;
z.maxEnd -= delta;
x.left = z;
break;
} else {
x = x.left;
}
} else {
if (x.right === SENTINEL) {
z.start -= delta + x.delta;
z.end -= delta + x.delta;
z.maxEnd -= delta + x.delta;
x.right = z;
break;
} else {
delta += x.delta;
x = x.right;
}
}
}
z.parent = x;
z.left = SENTINEL;
z.right = SENTINEL;
setNodeColor(
z,
1
/* NodeColor.Red */
);
}
function rbTreeDelete(T, z) {
let x;
let y;
if (z.left === SENTINEL) {
x = z.right;
y = z;
x.delta += z.delta;
if (x.delta < -1073741824 || x.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
x.start += z.delta;
x.end += z.delta;
} else if (z.right === SENTINEL) {
x = z.left;
y = z;
} else {
y = leftest(z.right);
x = y.right;
x.start += y.delta;
x.end += y.delta;
x.delta += y.delta;
if (x.delta < -1073741824 || x.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
y.start += z.delta;
y.end += z.delta;
y.delta = z.delta;
if (y.delta < -1073741824 || y.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
}
if (y === T.root) {
T.root = x;
setNodeColor(
x,
0
/* NodeColor.Black */
);
z.detach();
resetSentinel();
recomputeMaxEnd(x);
T.root.parent = SENTINEL;
return;
}
const yWasRed = getNodeColor(y) === 1;
if (y === y.parent.left) {
y.parent.left = x;
} else {
y.parent.right = x;
}
if (y === z) {
x.parent = y.parent;
} else {
if (y.parent === z) {
x.parent = y;
} else {
x.parent = y.parent;
}
y.left = z.left;
y.right = z.right;
y.parent = z.parent;
setNodeColor(y, getNodeColor(z));
if (z === T.root) {
T.root = y;
} else {
if (z === z.parent.left) {
z.parent.left = y;
} else {
z.parent.right = y;
}
}
if (y.left !== SENTINEL) {
y.left.parent = y;
}
if (y.right !== SENTINEL) {
y.right.parent = y;
}
}
z.detach();
if (yWasRed) {
recomputeMaxEndWalkToRoot(x.parent);
if (y !== z) {
recomputeMaxEndWalkToRoot(y);
recomputeMaxEndWalkToRoot(y.parent);
}
resetSentinel();
return;
}
recomputeMaxEndWalkToRoot(x);
recomputeMaxEndWalkToRoot(x.parent);
if (y !== z) {
recomputeMaxEndWalkToRoot(y);
recomputeMaxEndWalkToRoot(y.parent);
}
let w;
while (x !== T.root && getNodeColor(x) === 0) {
if (x === x.parent.left) {
w = x.parent.right;
if (getNodeColor(w) === 1) {
setNodeColor(
w,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent,
1
/* NodeColor.Red */
);
leftRotate2(T, x.parent);
w = x.parent.right;
}
if (getNodeColor(w.left) === 0 && getNodeColor(w.right) === 0) {
setNodeColor(
w,
1
/* NodeColor.Red */
);
x = x.parent;
} else {
if (getNodeColor(w.right) === 0) {
setNodeColor(
w.left,
0
/* NodeColor.Black */
);
setNodeColor(
w,
1
/* NodeColor.Red */
);
rightRotate(T, w);
w = x.parent.right;
}
setNodeColor(w, getNodeColor(x.parent));
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
w.right,
0
/* NodeColor.Black */
);
leftRotate2(T, x.parent);
x = T.root;
}
} else {
w = x.parent.left;
if (getNodeColor(w) === 1) {
setNodeColor(
w,
0
/* NodeColor.Black */
);
setNodeColor(
x.parent,
1
/* NodeColor.Red */
);
rightRotate(T, x.parent);
w = x.parent.left;
}
if (getNodeColor(w.left) === 0 && getNodeColor(w.right) === 0) {
setNodeColor(
w,
1
/* NodeColor.Red */
);
x = x.parent;
} else {
if (getNodeColor(w.left) === 0) {
setNodeColor(
w.right,
0
/* NodeColor.Black */
);
setNodeColor(
w,
1
/* NodeColor.Red */
);
leftRotate2(T, w);
w = x.parent.left;
}
setNodeColor(w, getNodeColor(x.parent));
setNodeColor(
x.parent,
0
/* NodeColor.Black */
);
setNodeColor(
w.left,
0
/* NodeColor.Black */
);
rightRotate(T, x.parent);
x = T.root;
}
}
}
setNodeColor(
x,
0
/* NodeColor.Black */
);
resetSentinel();
}
function leftest(node) {
while (node.left !== SENTINEL) {
node = node.left;
}
return node;
}
function resetSentinel() {
SENTINEL.parent = SENTINEL;
SENTINEL.delta = 0;
SENTINEL.start = 0;
SENTINEL.end = 0;
}
function leftRotate2(T, x) {
const y = x.right;
y.delta += x.delta;
if (y.delta < -1073741824 || y.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
y.start += x.delta;
y.end += x.delta;
x.right = y.left;
if (y.left !== SENTINEL) {
y.left.parent = x;
}
y.parent = x.parent;
if (x.parent === SENTINEL) {
T.root = y;
} else if (x === x.parent.left) {
x.parent.left = y;
} else {
x.parent.right = y;
}
y.left = x;
x.parent = y;
recomputeMaxEnd(x);
recomputeMaxEnd(y);
}
function rightRotate(T, y) {
const x = y.left;
y.delta -= x.delta;
if (y.delta < -1073741824 || y.delta > 1073741824) {
T.requestNormalizeDelta = true;
}
y.start -= x.delta;
y.end -= x.delta;
y.left = x.right;
if (x.right !== SENTINEL) {
x.right.parent = y;
}
x.parent = y.parent;
if (y.parent === SENTINEL) {
T.root = x;
} else if (y === y.parent.right) {
y.parent.right = x;
} else {
y.parent.left = x;
}
x.right = y;
y.parent = x;
recomputeMaxEnd(y);
recomputeMaxEnd(x);
}
function computeMaxEnd(node) {
let maxEnd = node.end;
if (node.left !== SENTINEL) {
const leftMaxEnd = node.left.maxEnd;
if (leftMaxEnd > maxEnd) {
maxEnd = leftMaxEnd;
}
}
if (node.right !== SENTINEL) {
const rightMaxEnd = node.right.maxEnd + node.delta;
if (rightMaxEnd > maxEnd) {
maxEnd = rightMaxEnd;
}
}
return maxEnd;
}
function recomputeMaxEnd(node) {
node.maxEnd = computeMaxEnd(node);
}
function recomputeMaxEndWalkToRoot(node) {
while (node !== SENTINEL) {
const maxEnd = computeMaxEnd(node);
if (node.maxEnd === maxEnd) {
return;
}
node.maxEnd = maxEnd;
node = node.parent;
}
}
function intervalCompare(aStart, aEnd, bStart, bEnd) {
if (aStart === bStart) {
return aEnd - bEnd;
}
return aStart - bStart;
}
var IntervalNode, SENTINEL, IntervalTree;
var init_intervalTree = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/intervalTree.js"() {
IntervalNode = class {
constructor(id, start, end) {
this.metadata = 0;
this.parent = this;
this.left = this;
this.right = this;
setNodeColor(
this,
1
/* NodeColor.Red */
);
this.start = start;
this.end = end;
this.delta = 0;
this.maxEnd = end;
this.id = id;
this.ownerId = 0;
this.options = null;
setNodeIsForValidation(this, false);
setNodeIsInGlyphMargin(this, false);
_setNodeStickiness(
this,
1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
);
setCollapseOnReplaceEdit(this, false);
this.cachedVersionId = 0;
this.cachedAbsoluteStart = start;
this.cachedAbsoluteEnd = end;
this.range = null;
setNodeIsVisited(this, false);
}
reset(versionId, start, end, range2) {
this.start = start;
this.end = end;
this.maxEnd = end;
this.cachedVersionId = versionId;
this.cachedAbsoluteStart = start;
this.cachedAbsoluteEnd = end;
this.range = range2;
}
setOptions(options2) {
this.options = options2;
const className = this.options.className;
setNodeIsForValidation(this, className === "squiggly-error" || className === "squiggly-warning" || className === "squiggly-info");
setNodeIsInGlyphMargin(this, this.options.glyphMarginClassName !== null);
_setNodeStickiness(this, this.options.stickiness);
setCollapseOnReplaceEdit(this, this.options.collapseOnReplaceEdit);
}
setCachedOffsets(absoluteStart, absoluteEnd, cachedVersionId) {
if (this.cachedVersionId !== cachedVersionId) {
this.range = null;
}
this.cachedVersionId = cachedVersionId;
this.cachedAbsoluteStart = absoluteStart;
this.cachedAbsoluteEnd = absoluteEnd;
}
detach() {
this.parent = null;
this.left = null;
this.right = null;
}
};
SENTINEL = new IntervalNode(null, 0, 0);
SENTINEL.parent = SENTINEL;
SENTINEL.left = SENTINEL;
SENTINEL.right = SENTINEL;
setNodeColor(
SENTINEL,
0
/* NodeColor.Black */
);
IntervalTree = class {
constructor() {
this.root = SENTINEL;
this.requestNormalizeDelta = false;
}
intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {
if (this.root === SENTINEL) {
return [];
}
return intervalSearch(this, start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
}
search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {
if (this.root === SENTINEL) {
return [];
}
return search(this, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
}
/**
* Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!
*/
collectNodesFromOwner(ownerId2) {
return collectNodesFromOwner(this, ownerId2);
}
/**
* Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!
*/
collectNodesPostOrder() {
return collectNodesPostOrder(this);
}
insert(node) {
rbTreeInsert(this, node);
this._normalizeDeltaIfNecessary();
}
delete(node) {
rbTreeDelete(this, node);
this._normalizeDeltaIfNecessary();
}
resolveNode(node, cachedVersionId) {
const initialNode = node;
let delta = 0;
while (node !== this.root) {
if (node === node.parent.right) {
delta += node.parent.delta;
}
node = node.parent;
}
const nodeStart = initialNode.start + delta;
const nodeEnd = initialNode.end + delta;
initialNode.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
}
acceptReplace(offset, length, textLength, forceMoveMarkers) {
const nodesOfInterest = searchForEditing(this, offset, offset + length);
for (let i = 0, len = nodesOfInterest.length; i < len; i++) {
const node = nodesOfInterest[i];
rbTreeDelete(this, node);
}
this._normalizeDeltaIfNecessary();
noOverlapReplace(this, offset, offset + length, textLength);
this._normalizeDeltaIfNecessary();
for (let i = 0, len = nodesOfInterest.length; i < len; i++) {
const node = nodesOfInterest[i];
node.start = node.cachedAbsoluteStart;
node.end = node.cachedAbsoluteEnd;
nodeAcceptEdit(node, offset, offset + length, textLength, forceMoveMarkers);
node.maxEnd = node.end;
rbTreeInsert(this, node);
}
this._normalizeDeltaIfNecessary();
}
_normalizeDeltaIfNecessary() {
if (!this.requestNormalizeDelta) {
return;
}
this.requestNormalizeDelta = false;
normalizeDelta(this);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js
function leftest2(node) {
while (node.left !== SENTINEL2) {
node = node.left;
}
return node;
}
function righttest(node) {
while (node.right !== SENTINEL2) {
node = node.right;
}
return node;
}
function calculateSize(node) {
if (node === SENTINEL2) {
return 0;
}
return node.size_left + node.piece.length + calculateSize(node.right);
}
function calculateLF(node) {
if (node === SENTINEL2) {
return 0;
}
return node.lf_left + node.piece.lineFeedCnt + calculateLF(node.right);
}
function resetSentinel2() {
SENTINEL2.parent = SENTINEL2;
}
function leftRotate3(tree, x) {
const y = x.right;
y.size_left += x.size_left + (x.piece ? x.piece.length : 0);
y.lf_left += x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);
x.right = y.left;
if (y.left !== SENTINEL2) {
y.left.parent = x;
}
y.parent = x.parent;
if (x.parent === SENTINEL2) {
tree.root = y;
} else if (x.parent.left === x) {
x.parent.left = y;
} else {
x.parent.right = y;
}
y.left = x;
x.parent = y;
}
function rightRotate2(tree, y) {
const x = y.left;
y.left = x.right;
if (x.right !== SENTINEL2) {
x.right.parent = y;
}
x.parent = y.parent;
y.size_left -= x.size_left + (x.piece ? x.piece.length : 0);
y.lf_left -= x.lf_left + (x.piece ? x.piece.lineFeedCnt : 0);
if (y.parent === SENTINEL2) {
tree.root = x;
} else if (y === y.parent.right) {
y.parent.right = x;
} else {
y.parent.left = x;
}
x.right = y;
y.parent = x;
}
function rbDelete(tree, z) {
let x;
let y;
if (z.left === SENTINEL2) {
y = z;
x = y.right;
} else if (z.right === SENTINEL2) {
y = z;
x = y.left;
} else {
y = leftest2(z.right);
x = y.right;
}
if (y === tree.root) {
tree.root = x;
x.color = 0;
z.detach();
resetSentinel2();
tree.root.parent = SENTINEL2;
return;
}
const yWasRed = y.color === 1;
if (y === y.parent.left) {
y.parent.left = x;
} else {
y.parent.right = x;
}
if (y === z) {
x.parent = y.parent;
recomputeTreeMetadata(tree, x);
} else {
if (y.parent === z) {
x.parent = y;
} else {
x.parent = y.parent;
}
recomputeTreeMetadata(tree, x);
y.left = z.left;
y.right = z.right;
y.parent = z.parent;
y.color = z.color;
if (z === tree.root) {
tree.root = y;
} else {
if (z === z.parent.left) {
z.parent.left = y;
} else {
z.parent.right = y;
}
}
if (y.left !== SENTINEL2) {
y.left.parent = y;
}
if (y.right !== SENTINEL2) {
y.right.parent = y;
}
y.size_left = z.size_left;
y.lf_left = z.lf_left;
recomputeTreeMetadata(tree, y);
}
z.detach();
if (x.parent.left === x) {
const newSizeLeft = calculateSize(x);
const newLFLeft = calculateLF(x);
if (newSizeLeft !== x.parent.size_left || newLFLeft !== x.parent.lf_left) {
const delta = newSizeLeft - x.parent.size_left;
const lf_delta = newLFLeft - x.parent.lf_left;
x.parent.size_left = newSizeLeft;
x.parent.lf_left = newLFLeft;
updateTreeMetadata(tree, x.parent, delta, lf_delta);
}
}
recomputeTreeMetadata(tree, x.parent);
if (yWasRed) {
resetSentinel2();
return;
}
let w;
while (x !== tree.root && x.color === 0) {
if (x === x.parent.left) {
w = x.parent.right;
if (w.color === 1) {
w.color = 0;
x.parent.color = 1;
leftRotate3(tree, x.parent);
w = x.parent.right;
}
if (w.left.color === 0 && w.right.color === 0) {
w.color = 1;
x = x.parent;
} else {
if (w.right.color === 0) {
w.left.color = 0;
w.color = 1;
rightRotate2(tree, w);
w = x.parent.right;
}
w.color = x.parent.color;
x.parent.color = 0;
w.right.color = 0;
leftRotate3(tree, x.parent);
x = tree.root;
}
} else {
w = x.parent.left;
if (w.color === 1) {
w.color = 0;
x.parent.color = 1;
rightRotate2(tree, x.parent);
w = x.parent.left;
}
if (w.left.color === 0 && w.right.color === 0) {
w.color = 1;
x = x.parent;
} else {
if (w.left.color === 0) {
w.right.color = 0;
w.color = 1;
leftRotate3(tree, w);
w = x.parent.left;
}
w.color = x.parent.color;
x.parent.color = 0;
w.left.color = 0;
rightRotate2(tree, x.parent);
x = tree.root;
}
}
}
x.color = 0;
resetSentinel2();
}
function fixInsert(tree, x) {
recomputeTreeMetadata(tree, x);
while (x !== tree.root && x.parent.color === 1) {
if (x.parent === x.parent.parent.left) {
const y = x.parent.parent.right;
if (y.color === 1) {
x.parent.color = 0;
y.color = 0;
x.parent.parent.color = 1;
x = x.parent.parent;
} else {
if (x === x.parent.right) {
x = x.parent;
leftRotate3(tree, x);
}
x.parent.color = 0;
x.parent.parent.color = 1;
rightRotate2(tree, x.parent.parent);
}
} else {
const y = x.parent.parent.left;
if (y.color === 1) {
x.parent.color = 0;
y.color = 0;
x.parent.parent.color = 1;
x = x.parent.parent;
} else {
if (x === x.parent.left) {
x = x.parent;
rightRotate2(tree, x);
}
x.parent.color = 0;
x.parent.parent.color = 1;
leftRotate3(tree, x.parent.parent);
}
}
}
tree.root.color = 0;
}
function updateTreeMetadata(tree, x, delta, lineFeedCntDelta) {
while (x !== tree.root && x !== SENTINEL2) {
if (x.parent.left === x) {
x.parent.size_left += delta;
x.parent.lf_left += lineFeedCntDelta;
}
x = x.parent;
}
}
function recomputeTreeMetadata(tree, x) {
let delta = 0;
let lf_delta = 0;
if (x === tree.root) {
return;
}
while (x !== tree.root && x === x.parent.right) {
x = x.parent;
}
if (x === tree.root) {
return;
}
x = x.parent;
delta = calculateSize(x.left) - x.size_left;
lf_delta = calculateLF(x.left) - x.lf_left;
x.size_left += delta;
x.lf_left += lf_delta;
while (x !== tree.root && (delta !== 0 || lf_delta !== 0)) {
if (x.parent.left === x) {
x.parent.size_left += delta;
x.parent.lf_left += lf_delta;
}
x = x.parent;
}
}
var TreeNode, SENTINEL2;
var init_rbTreeBase = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js"() {
TreeNode = class {
constructor(piece, color) {
this.piece = piece;
this.color = color;
this.size_left = 0;
this.lf_left = 0;
this.parent = this;
this.left = this;
this.right = this;
}
next() {
if (this.right !== SENTINEL2) {
return leftest2(this.right);
}
let node = this;
while (node.parent !== SENTINEL2) {
if (node.parent.left === node) {
break;
}
node = node.parent;
}
if (node.parent === SENTINEL2) {
return SENTINEL2;
} else {
return node.parent;
}
}
prev() {
if (this.left !== SENTINEL2) {
return righttest(this.left);
}
let node = this;
while (node.parent !== SENTINEL2) {
if (node.parent.right === node) {
break;
}
node = node.parent;
}
if (node.parent === SENTINEL2) {
return SENTINEL2;
} else {
return node.parent;
}
}
detach() {
this.parent = null;
this.left = null;
this.right = null;
}
};
SENTINEL2 = new TreeNode(
null,
0
/* NodeColor.Black */
);
SENTINEL2.parent = SENTINEL2;
SENTINEL2.left = SENTINEL2;
SENTINEL2.right = SENTINEL2;
SENTINEL2.color = 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js
function createUintArray(arr) {
let r;
if (arr[arr.length - 1] < 65536) {
r = new Uint16Array(arr.length);
} else {
r = new Uint32Array(arr.length);
}
r.set(arr, 0);
return r;
}
function createLineStartsFast(str, readonly = true) {
const r = [0];
let rLength = 1;
for (let i = 0, len = str.length; i < len; i++) {
const chr = str.charCodeAt(i);
if (chr === 13) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10) {
r[rLength++] = i + 2;
i++;
} else {
r[rLength++] = i + 1;
}
} else if (chr === 10) {
r[rLength++] = i + 1;
}
}
if (readonly) {
return createUintArray(r);
} else {
return r;
}
}
function createLineStarts(r, str) {
r.length = 0;
r[0] = 0;
let rLength = 1;
let cr = 0, lf = 0, crlf = 0;
let isBasicASCII2 = true;
for (let i = 0, len = str.length; i < len; i++) {
const chr = str.charCodeAt(i);
if (chr === 13) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10) {
crlf++;
r[rLength++] = i + 2;
i++;
} else {
cr++;
r[rLength++] = i + 1;
}
} else if (chr === 10) {
lf++;
r[rLength++] = i + 1;
} else {
if (isBasicASCII2) {
if (chr !== 9 && (chr < 32 || chr > 126)) {
isBasicASCII2 = false;
}
}
}
}
const result = new LineStarts(createUintArray(r), cr, lf, crlf, isBasicASCII2);
r.length = 0;
return result;
}
var AverageBufferSize, LineStarts, Piece, StringBuffer, PieceTreeSnapshot, PieceTreeSearchCache, PieceTreeBase;
var init_pieceTreeBase = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js"() {
init_position();
init_range();
init_model2();
init_rbTreeBase();
init_textModelSearch();
AverageBufferSize = 65535;
LineStarts = class {
constructor(lineStarts, cr, lf, crlf, isBasicASCII2) {
this.lineStarts = lineStarts;
this.cr = cr;
this.lf = lf;
this.crlf = crlf;
this.isBasicASCII = isBasicASCII2;
}
};
Piece = class {
constructor(bufferIndex, start, end, lineFeedCnt, length) {
this.bufferIndex = bufferIndex;
this.start = start;
this.end = end;
this.lineFeedCnt = lineFeedCnt;
this.length = length;
}
};
StringBuffer = class {
constructor(buffer, lineStarts) {
this.buffer = buffer;
this.lineStarts = lineStarts;
}
};
PieceTreeSnapshot = class {
constructor(tree, BOM) {
this._pieces = [];
this._tree = tree;
this._BOM = BOM;
this._index = 0;
if (tree.root !== SENTINEL2) {
tree.iterate(tree.root, (node) => {
if (node !== SENTINEL2) {
this._pieces.push(node.piece);
}
return true;
});
}
}
read() {
if (this._pieces.length === 0) {
if (this._index === 0) {
this._index++;
return this._BOM;
} else {
return null;
}
}
if (this._index > this._pieces.length - 1) {
return null;
}
if (this._index === 0) {
return this._BOM + this._tree.getPieceContent(this._pieces[this._index++]);
}
return this._tree.getPieceContent(this._pieces[this._index++]);
}
};
PieceTreeSearchCache = class {
constructor(limit) {
this._limit = limit;
this._cache = [];
}
get(offset) {
for (let i = this._cache.length - 1; i >= 0; i--) {
const nodePos = this._cache[i];
if (nodePos.nodeStartOffset <= offset && nodePos.nodeStartOffset + nodePos.node.piece.length >= offset) {
return nodePos;
}
}
return null;
}
get2(lineNumber) {
for (let i = this._cache.length - 1; i >= 0; i--) {
const nodePos = this._cache[i];
if (nodePos.nodeStartLineNumber && nodePos.nodeStartLineNumber < lineNumber && nodePos.nodeStartLineNumber + nodePos.node.piece.lineFeedCnt >= lineNumber) {
return nodePos;
}
}
return null;
}
set(nodePosition) {
if (this._cache.length >= this._limit) {
this._cache.shift();
}
this._cache.push(nodePosition);
}
validate(offset) {
let hasInvalidVal = false;
const tmp = this._cache;
for (let i = 0; i < tmp.length; i++) {
const nodePos = tmp[i];
if (nodePos.node.parent === null || nodePos.nodeStartOffset >= offset) {
tmp[i] = null;
hasInvalidVal = true;
continue;
}
}
if (hasInvalidVal) {
const newArr = [];
for (const entry of tmp) {
if (entry !== null) {
newArr.push(entry);
}
}
this._cache = newArr;
}
}
};
PieceTreeBase = class {
constructor(chunks, eol, eolNormalized) {
this.create(chunks, eol, eolNormalized);
}
create(chunks, eol, eolNormalized) {
this._buffers = [
new StringBuffer("", [0])
];
this._lastChangeBufferPos = { line: 0, column: 0 };
this.root = SENTINEL2;
this._lineCnt = 1;
this._length = 0;
this._EOL = eol;
this._EOLLength = eol.length;
this._EOLNormalized = eolNormalized;
let lastNode = null;
for (let i = 0, len = chunks.length; i < len; i++) {
if (chunks[i].buffer.length > 0) {
if (!chunks[i].lineStarts) {
chunks[i].lineStarts = createLineStartsFast(chunks[i].buffer);
}
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);
this._buffers.push(chunks[i]);
lastNode = this.rbInsertRight(lastNode, piece);
}
}
this._searchCache = new PieceTreeSearchCache(1);
this._lastVisitedLine = { lineNumber: 0, value: "" };
this.computeBufferMetadata();
}
normalizeEOL(eol) {
const averageBufferSize = AverageBufferSize;
const min = averageBufferSize - Math.floor(averageBufferSize / 3);
const max = min * 2;
let tempChunk = "";
let tempChunkLen = 0;
const chunks = [];
this.iterate(this.root, (node) => {
const str = this.getNodeContent(node);
const len = str.length;
if (tempChunkLen <= min || tempChunkLen + len < max) {
tempChunk += str;
tempChunkLen += len;
return true;
}
const text2 = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text2, createLineStartsFast(text2)));
tempChunk = str;
tempChunkLen = len;
return true;
});
if (tempChunkLen > 0) {
const text2 = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text2, createLineStartsFast(text2)));
}
this.create(chunks, eol, true);
}
// #region Buffer API
getEOL() {
return this._EOL;
}
setEOL(newEOL) {
this._EOL = newEOL;
this._EOLLength = this._EOL.length;
this.normalizeEOL(newEOL);
}
createSnapshot(BOM) {
return new PieceTreeSnapshot(this, BOM);
}
getOffsetAt(lineNumber, column) {
let leftLen = 0;
let x = this.root;
while (x !== SENTINEL2) {
if (x.left !== SENTINEL2 && x.lf_left + 1 >= lineNumber) {
x = x.left;
} else if (x.lf_left + x.piece.lineFeedCnt + 1 >= lineNumber) {
leftLen += x.size_left;
const accumualtedValInCurrentIndex = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
return leftLen += accumualtedValInCurrentIndex + column - 1;
} else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
leftLen += x.size_left + x.piece.length;
x = x.right;
}
}
return leftLen;
}
getPositionAt(offset) {
offset = Math.floor(offset);
offset = Math.max(0, offset);
let x = this.root;
let lfCnt = 0;
const originalOffset = offset;
while (x !== SENTINEL2) {
if (x.size_left !== 0 && x.size_left >= offset) {
x = x.left;
} else if (x.size_left + x.piece.length >= offset) {
const out = this.getIndexOf(x, offset - x.size_left);
lfCnt += x.lf_left + out.index;
if (out.index === 0) {
const lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
const column = originalOffset - lineStartOffset;
return new Position(lfCnt + 1, column + 1);
}
return new Position(lfCnt + 1, out.remainder + 1);
} else {
offset -= x.size_left + x.piece.length;
lfCnt += x.lf_left + x.piece.lineFeedCnt;
if (x.right === SENTINEL2) {
const lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
const column = originalOffset - offset - lineStartOffset;
return new Position(lfCnt + 1, column + 1);
} else {
x = x.right;
}
}
}
return new Position(1, 1);
}
getValueInRange(range2, eol) {
if (range2.startLineNumber === range2.endLineNumber && range2.startColumn === range2.endColumn) {
return "";
}
const startPosition = this.nodeAt2(range2.startLineNumber, range2.startColumn);
const endPosition = this.nodeAt2(range2.endLineNumber, range2.endColumn);
const value = this.getValueInRange2(startPosition, endPosition);
if (eol) {
if (eol !== this._EOL || !this._EOLNormalized) {
return value.replace(/\r\n|\r|\n/g, eol);
}
if (eol === this.getEOL() && this._EOLNormalized) {
if (eol === "\r\n") {
}
return value;
}
return value.replace(/\r\n|\r|\n/g, eol);
}
return value;
}
getValueInRange2(startPosition, endPosition) {
if (startPosition.node === endPosition.node) {
const node = startPosition.node;
const buffer2 = this._buffers[node.piece.bufferIndex].buffer;
const startOffset2 = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
return buffer2.substring(startOffset2 + startPosition.remainder, startOffset2 + endPosition.remainder);
}
let x = startPosition.node;
const buffer = this._buffers[x.piece.bufferIndex].buffer;
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
let ret = buffer.substring(startOffset + startPosition.remainder, startOffset + x.piece.length);
x = x.next();
while (x !== SENTINEL2) {
const buffer2 = this._buffers[x.piece.bufferIndex].buffer;
const startOffset2 = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (x === endPosition.node) {
ret += buffer2.substring(startOffset2, startOffset2 + endPosition.remainder);
break;
} else {
ret += buffer2.substr(startOffset2, x.piece.length);
}
x = x.next();
}
return ret;
}
getLinesContent() {
const lines = [];
let linesLength = 0;
let currentLine = "";
let danglingCR = false;
this.iterate(this.root, (node) => {
if (node === SENTINEL2) {
return true;
}
const piece = node.piece;
let pieceLength = piece.length;
if (pieceLength === 0) {
return true;
}
const buffer = this._buffers[piece.bufferIndex].buffer;
const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
const pieceStartLine = piece.start.line;
const pieceEndLine = piece.end.line;
let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;
if (danglingCR) {
if (buffer.charCodeAt(pieceStartOffset) === 10) {
pieceStartOffset++;
pieceLength--;
}
lines[linesLength++] = currentLine;
currentLine = "";
danglingCR = false;
if (pieceLength === 0) {
return true;
}
}
if (pieceStartLine === pieceEndLine) {
if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === 13) {
danglingCR = true;
currentLine += buffer.substr(pieceStartOffset, pieceLength - 1);
} else {
currentLine += buffer.substr(pieceStartOffset, pieceLength);
}
return true;
}
currentLine += this._EOLNormalized ? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength)) : buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\r\n|\r|\n)$/, "");
lines[linesLength++] = currentLine;
for (let line = pieceStartLine + 1; line < pieceEndLine; line++) {
currentLine = this._EOLNormalized ? buffer.substring(lineStarts[line], lineStarts[line + 1] - this._EOLLength) : buffer.substring(lineStarts[line], lineStarts[line + 1]).replace(/(\r\n|\r|\n)$/, "");
lines[linesLength++] = currentLine;
}
if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === 13) {
danglingCR = true;
if (piece.end.column === 0) {
linesLength--;
} else {
currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column - 1);
}
} else {
currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column);
}
return true;
});
if (danglingCR) {
lines[linesLength++] = currentLine;
currentLine = "";
}
lines[linesLength++] = currentLine;
return lines;
}
getLength() {
return this._length;
}
getLineCount() {
return this._lineCnt;
}
getLineContent(lineNumber) {
if (this._lastVisitedLine.lineNumber === lineNumber) {
return this._lastVisitedLine.value;
}
this._lastVisitedLine.lineNumber = lineNumber;
if (lineNumber === this._lineCnt) {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber);
} else if (this._EOLNormalized) {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber, this._EOLLength);
} else {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber).replace(/(\r\n|\r|\n)$/, "");
}
return this._lastVisitedLine.value;
}
_getCharCode(nodePos) {
if (nodePos.remainder === nodePos.node.piece.length) {
const matchingNode = nodePos.node.next();
if (!matchingNode) {
return 0;
}
const buffer = this._buffers[matchingNode.piece.bufferIndex];
const startOffset = this.offsetInBuffer(matchingNode.piece.bufferIndex, matchingNode.piece.start);
return buffer.buffer.charCodeAt(startOffset);
} else {
const buffer = this._buffers[nodePos.node.piece.bufferIndex];
const startOffset = this.offsetInBuffer(nodePos.node.piece.bufferIndex, nodePos.node.piece.start);
const targetOffset = startOffset + nodePos.remainder;
return buffer.buffer.charCodeAt(targetOffset);
}
}
getLineCharCode(lineNumber, index) {
const nodePos = this.nodeAt2(lineNumber, index + 1);
return this._getCharCode(nodePos);
}
getLineLength(lineNumber) {
if (lineNumber === this.getLineCount()) {
const startOffset = this.getOffsetAt(lineNumber, 1);
return this.getLength() - startOffset;
}
return this.getOffsetAt(lineNumber + 1, 1) - this.getOffsetAt(lineNumber, 1) - this._EOLLength;
}
findMatchesInNode(node, searcher, startLineNumber, startColumn, startCursor, endCursor, searchData, captureMatches, limitResultCount, resultLen, result) {
const buffer = this._buffers[node.piece.bufferIndex];
const startOffsetInBuffer = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
const start = this.offsetInBuffer(node.piece.bufferIndex, startCursor);
const end = this.offsetInBuffer(node.piece.bufferIndex, endCursor);
let m;
const ret = { line: 0, column: 0 };
let searchText;
let offsetInBuffer;
if (searcher._wordSeparators) {
searchText = buffer.buffer.substring(start, end);
offsetInBuffer = (offset) => offset + start;
searcher.reset(0);
} else {
searchText = buffer.buffer;
offsetInBuffer = (offset) => offset;
searcher.reset(start);
}
do {
m = searcher.next(searchText);
if (m) {
if (offsetInBuffer(m.index) >= end) {
return resultLen;
}
this.positionInBuffer(node, offsetInBuffer(m.index) - startOffsetInBuffer, ret);
const lineFeedCnt = this.getLineFeedCnt(node.piece.bufferIndex, startCursor, ret);
const retStartColumn = ret.line === startCursor.line ? ret.column - startCursor.column + startColumn : ret.column + 1;
const retEndColumn = retStartColumn + m[0].length;
result[resultLen++] = createFindMatch(new Range(startLineNumber + lineFeedCnt, retStartColumn, startLineNumber + lineFeedCnt, retEndColumn), m, captureMatches);
if (offsetInBuffer(m.index) + m[0].length >= end) {
return resultLen;
}
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
}
findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {
const result = [];
let resultLen = 0;
const searcher = new Searcher(searchData.wordSeparators, searchData.regex);
let startPosition = this.nodeAt2(searchRange.startLineNumber, searchRange.startColumn);
if (startPosition === null) {
return [];
}
const endPosition = this.nodeAt2(searchRange.endLineNumber, searchRange.endColumn);
if (endPosition === null) {
return [];
}
let start = this.positionInBuffer(startPosition.node, startPosition.remainder);
const end = this.positionInBuffer(endPosition.node, endPosition.remainder);
if (startPosition.node === endPosition.node) {
this.findMatchesInNode(startPosition.node, searcher, searchRange.startLineNumber, searchRange.startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);
return result;
}
let startLineNumber = searchRange.startLineNumber;
let currentNode = startPosition.node;
while (currentNode !== endPosition.node) {
const lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);
if (lineBreakCnt >= 1) {
const lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;
const startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);
const nextLineStartOffset = lineStarts[start.line + lineBreakCnt];
const startColumn3 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn3, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);
if (resultLen >= limitResultCount) {
return result;
}
startLineNumber += lineBreakCnt;
}
const startColumn2 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
if (startLineNumber === searchRange.endLineNumber) {
const text2 = this.getLineContent(startLineNumber).substring(startColumn2, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text2, searchRange.endLineNumber, startColumn2, resultLen, result, captureMatches, limitResultCount);
return result;
}
resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn2), startLineNumber, startColumn2, resultLen, result, captureMatches, limitResultCount);
if (resultLen >= limitResultCount) {
return result;
}
startLineNumber++;
startPosition = this.nodeAt2(startLineNumber, 1);
currentNode = startPosition.node;
start = this.positionInBuffer(startPosition.node, startPosition.remainder);
}
if (startLineNumber === searchRange.endLineNumber) {
const startColumn2 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
const text2 = this.getLineContent(startLineNumber).substring(startColumn2, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text2, searchRange.endLineNumber, startColumn2, resultLen, result, captureMatches, limitResultCount);
return result;
}
const startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(endPosition.node, searcher, startLineNumber, startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);
return result;
}
_findMatchesInLine(searchData, searcher, text2, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {
const wordSeparators2 = searchData.wordSeparators;
if (!captureMatches && searchData.simpleSearch) {
const searchString = searchData.simpleSearch;
const searchStringLen = searchString.length;
const textLength = text2.length;
let lastMatchIndex = -searchStringLen;
while ((lastMatchIndex = text2.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {
if (!wordSeparators2 || isValidMatch(wordSeparators2, text2, textLength, lastMatchIndex, searchStringLen)) {
result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
}
return resultLen;
}
let m;
searcher.reset(0);
do {
m = searcher.next(text2);
if (m) {
result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
}
// #endregion
// #region Piece Table
insert(offset, value, eolNormalized = false) {
this._EOLNormalized = this._EOLNormalized && eolNormalized;
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = "";
if (this.root !== SENTINEL2) {
const { node, remainder, nodeStartOffset } = this.nodeAt(offset);
const piece = node.piece;
const bufferIndex = piece.bufferIndex;
const insertPosInBuffer = this.positionInBuffer(node, remainder);
if (node.piece.bufferIndex === 0 && piece.end.line === this._lastChangeBufferPos.line && piece.end.column === this._lastChangeBufferPos.column && nodeStartOffset + piece.length === offset && value.length < AverageBufferSize) {
this.appendToNode(node, value);
this.computeBufferMetadata();
return;
}
if (nodeStartOffset === offset) {
this.insertContentToNodeLeft(value, node);
this._searchCache.validate(offset);
} else if (nodeStartOffset + node.piece.length > offset) {
const nodesToDel = [];
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));
if (this.shouldCheckCRLF() && this.endWithCR(value)) {
const headOfRight = this.nodeCharCodeAt(node, remainder);
if (headOfRight === 10) {
const newStart = { line: newRightPiece.start.line + 1, column: 0 };
newRightPiece = new Piece(newRightPiece.bufferIndex, newStart, newRightPiece.end, this.getLineFeedCnt(newRightPiece.bufferIndex, newStart, newRightPiece.end), newRightPiece.length - 1);
value += "\n";
}
}
if (this.shouldCheckCRLF() && this.startWithLF(value)) {
const tailOfLeft = this.nodeCharCodeAt(node, remainder - 1);
if (tailOfLeft === 13) {
const previousPos = this.positionInBuffer(node, remainder - 1);
this.deleteNodeTail(node, previousPos);
value = "\r" + value;
if (node.piece.length === 0) {
nodesToDel.push(node);
}
} else {
this.deleteNodeTail(node, insertPosInBuffer);
}
} else {
this.deleteNodeTail(node, insertPosInBuffer);
}
const newPieces = this.createNewPieces(value);
if (newRightPiece.length > 0) {
this.rbInsertRight(node, newRightPiece);
}
let tmpNode = node;
for (let k = 0; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.deleteNodes(nodesToDel);
} else {
this.insertContentToNodeRight(value, node);
}
} else {
const pieces = this.createNewPieces(value);
let node = this.rbInsertLeft(null, pieces[0]);
for (let k = 1; k < pieces.length; k++) {
node = this.rbInsertRight(node, pieces[k]);
}
}
this.computeBufferMetadata();
}
delete(offset, cnt) {
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = "";
if (cnt <= 0 || this.root === SENTINEL2) {
return;
}
const startPosition = this.nodeAt(offset);
const endPosition = this.nodeAt(offset + cnt);
const startNode = startPosition.node;
const endNode = endPosition.node;
if (startNode === endNode) {
const startSplitPosInBuffer2 = this.positionInBuffer(startNode, startPosition.remainder);
const endSplitPosInBuffer2 = this.positionInBuffer(startNode, endPosition.remainder);
if (startPosition.nodeStartOffset === offset) {
if (cnt === startNode.piece.length) {
const next = startNode.next();
rbDelete(this, startNode);
this.validateCRLFWithPrevNode(next);
this.computeBufferMetadata();
return;
}
this.deleteNodeHead(startNode, endSplitPosInBuffer2);
this._searchCache.validate(offset);
this.validateCRLFWithPrevNode(startNode);
this.computeBufferMetadata();
return;
}
if (startPosition.nodeStartOffset + startNode.piece.length === offset + cnt) {
this.deleteNodeTail(startNode, startSplitPosInBuffer2);
this.validateCRLFWithNextNode(startNode);
this.computeBufferMetadata();
return;
}
this.shrinkNode(startNode, startSplitPosInBuffer2, endSplitPosInBuffer2);
this.computeBufferMetadata();
return;
}
const nodesToDel = [];
const startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);
this.deleteNodeTail(startNode, startSplitPosInBuffer);
this._searchCache.validate(offset);
if (startNode.piece.length === 0) {
nodesToDel.push(startNode);
}
const endSplitPosInBuffer = this.positionInBuffer(endNode, endPosition.remainder);
this.deleteNodeHead(endNode, endSplitPosInBuffer);
if (endNode.piece.length === 0) {
nodesToDel.push(endNode);
}
const secondNode = startNode.next();
for (let node = secondNode; node !== SENTINEL2 && node !== endNode; node = node.next()) {
nodesToDel.push(node);
}
const prev = startNode.piece.length === 0 ? startNode.prev() : startNode;
this.deleteNodes(nodesToDel);
this.validateCRLFWithNextNode(prev);
this.computeBufferMetadata();
}
insertContentToNodeLeft(value, node) {
const nodesToDel = [];
if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) {
const piece = node.piece;
const newStart = { line: piece.start.line + 1, column: 0 };
const nPiece = new Piece(piece.bufferIndex, newStart, piece.end, this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end), piece.length - 1);
node.piece = nPiece;
value += "\n";
updateTreeMetadata(this, node, -1, -1);
if (node.piece.length === 0) {
nodesToDel.push(node);
}
}
const newPieces = this.createNewPieces(value);
let newNode = this.rbInsertLeft(node, newPieces[newPieces.length - 1]);
for (let k = newPieces.length - 2; k >= 0; k--) {
newNode = this.rbInsertLeft(newNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
this.deleteNodes(nodesToDel);
}
insertContentToNodeRight(value, node) {
if (this.adjustCarriageReturnFromNext(value, node)) {
value += "\n";
}
const newPieces = this.createNewPieces(value);
const newNode = this.rbInsertRight(node, newPieces[0]);
let tmpNode = newNode;
for (let k = 1; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
}
positionInBuffer(node, remainder, ret) {
const piece = node.piece;
const bufferIndex = node.piece.bufferIndex;
const lineStarts = this._buffers[bufferIndex].lineStarts;
const startOffset = lineStarts[piece.start.line] + piece.start.column;
const offset = startOffset + remainder;
let low = piece.start.line;
let high = piece.end.line;
let mid = 0;
let midStop = 0;
let midStart = 0;
while (low <= high) {
mid = low + (high - low) / 2 | 0;
midStart = lineStarts[mid];
if (mid === high) {
break;
}
midStop = lineStarts[mid + 1];
if (offset < midStart) {
high = mid - 1;
} else if (offset >= midStop) {
low = mid + 1;
} else {
break;
}
}
if (ret) {
ret.line = mid;
ret.column = offset - midStart;
return null;
}
return {
line: mid,
column: offset - midStart
};
}
getLineFeedCnt(bufferIndex, start, end) {
if (end.column === 0) {
return end.line - start.line;
}
const lineStarts = this._buffers[bufferIndex].lineStarts;
if (end.line === lineStarts.length - 1) {
return end.line - start.line;
}
const nextLineStartOffset = lineStarts[end.line + 1];
const endOffset = lineStarts[end.line] + end.column;
if (nextLineStartOffset > endOffset + 1) {
return end.line - start.line;
}
const previousCharOffset = endOffset - 1;
const buffer = this._buffers[bufferIndex].buffer;
if (buffer.charCodeAt(previousCharOffset) === 13) {
return end.line - start.line + 1;
} else {
return end.line - start.line;
}
}
offsetInBuffer(bufferIndex, cursor) {
const lineStarts = this._buffers[bufferIndex].lineStarts;
return lineStarts[cursor.line] + cursor.column;
}
deleteNodes(nodes) {
for (let i = 0; i < nodes.length; i++) {
rbDelete(this, nodes[i]);
}
}
createNewPieces(text2) {
if (text2.length > AverageBufferSize) {
const newPieces = [];
while (text2.length > AverageBufferSize) {
const lastChar = text2.charCodeAt(AverageBufferSize - 1);
let splitText;
if (lastChar === 13 || lastChar >= 55296 && lastChar <= 56319) {
splitText = text2.substring(0, AverageBufferSize - 1);
text2 = text2.substring(AverageBufferSize - 1);
} else {
splitText = text2.substring(0, AverageBufferSize);
text2 = text2.substring(AverageBufferSize);
}
const lineStarts3 = createLineStartsFast(splitText);
newPieces.push(new Piece(
this._buffers.length,
/* buffer index */
{ line: 0, column: 0 },
{ line: lineStarts3.length - 1, column: splitText.length - lineStarts3[lineStarts3.length - 1] },
lineStarts3.length - 1,
splitText.length
));
this._buffers.push(new StringBuffer(splitText, lineStarts3));
}
const lineStarts2 = createLineStartsFast(text2);
newPieces.push(new Piece(
this._buffers.length,
/* buffer index */
{ line: 0, column: 0 },
{ line: lineStarts2.length - 1, column: text2.length - lineStarts2[lineStarts2.length - 1] },
lineStarts2.length - 1,
text2.length
));
this._buffers.push(new StringBuffer(text2, lineStarts2));
return newPieces;
}
let startOffset = this._buffers[0].buffer.length;
const lineStarts = createLineStartsFast(text2, false);
let start = this._lastChangeBufferPos;
if (this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 1] === startOffset && startOffset !== 0 && this.startWithLF(text2) && this.endWithCR(this._buffers[0].buffer)) {
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line, column: this._lastChangeBufferPos.column + 1 };
start = this._lastChangeBufferPos;
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset + 1;
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
this._buffers[0].buffer += "_" + text2;
startOffset += 1;
} else {
if (startOffset !== 0) {
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset;
}
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
this._buffers[0].buffer += text2;
}
const endOffset = this._buffers[0].buffer.length;
const endIndex = this._buffers[0].lineStarts.length - 1;
const endColumn = endOffset - this._buffers[0].lineStarts[endIndex];
const endPos = { line: endIndex, column: endColumn };
const newPiece = new Piece(
0,
/** todo@peng */
start,
endPos,
this.getLineFeedCnt(0, start, endPos),
endOffset - startOffset
);
this._lastChangeBufferPos = endPos;
return [newPiece];
}
getLineRawContent(lineNumber, endOffset = 0) {
let x = this.root;
let ret = "";
const cache = this._searchCache.get2(lineNumber);
if (cache) {
x = cache.node;
const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);
const buffer = this._buffers[x.piece.bufferIndex].buffer;
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
} else {
const accumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
}
} else {
let nodeStartOffset = 0;
const originalLineNumber = lineNumber;
while (x !== SENTINEL2) {
if (x.left !== SENTINEL2 && x.lf_left >= lineNumber - 1) {
x = x.left;
} else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
const accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
const buffer = this._buffers[x.piece.bufferIndex].buffer;
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
nodeStartOffset += x.size_left;
this._searchCache.set({
node: x,
nodeStartOffset,
nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)
});
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
} else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
const prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
const buffer = this._buffers[x.piece.bufferIndex].buffer;
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
break;
} else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
}
x = x.next();
while (x !== SENTINEL2) {
const buffer = this._buffers[x.piece.bufferIndex].buffer;
if (x.piece.lineFeedCnt > 0) {
const accumulatedValue = this.getAccumulatedValue(x, 0);
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substring(startOffset, startOffset + accumulatedValue - endOffset);
return ret;
} else {
const startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substr(startOffset, x.piece.length);
}
x = x.next();
}
return ret;
}
computeBufferMetadata() {
let x = this.root;
let lfCnt = 1;
let len = 0;
while (x !== SENTINEL2) {
lfCnt += x.lf_left + x.piece.lineFeedCnt;
len += x.size_left + x.piece.length;
x = x.right;
}
this._lineCnt = lfCnt;
this._length = len;
this._searchCache.validate(this._length);
}
// #region node operations
getIndexOf(node, accumulatedValue) {
const piece = node.piece;
const pos = this.positionInBuffer(node, accumulatedValue);
const lineCnt = pos.line - piece.start.line;
if (this.offsetInBuffer(piece.bufferIndex, piece.end) - this.offsetInBuffer(piece.bufferIndex, piece.start) === accumulatedValue) {
const realLineCnt = this.getLineFeedCnt(node.piece.bufferIndex, piece.start, pos);
if (realLineCnt !== lineCnt) {
return { index: realLineCnt, remainder: 0 };
}
}
return { index: lineCnt, remainder: pos.column };
}
getAccumulatedValue(node, index) {
if (index < 0) {
return 0;
}
const piece = node.piece;
const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
const expectedLineStartIndex = piece.start.line + index + 1;
if (expectedLineStartIndex > piece.end.line) {
return lineStarts[piece.end.line] + piece.end.column - lineStarts[piece.start.line] - piece.start.column;
} else {
return lineStarts[expectedLineStartIndex] - lineStarts[piece.start.line] - piece.start.column;
}
}
deleteNodeTail(node, pos) {
const piece = node.piece;
const originalLFCnt = piece.lineFeedCnt;
const originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
const newEnd = pos;
const newEndOffset = this.offsetInBuffer(piece.bufferIndex, newEnd);
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
const lf_delta = newLineFeedCnt - originalLFCnt;
const size_delta = newEndOffset - originalEndOffset;
const newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
}
deleteNodeHead(node, pos) {
const piece = node.piece;
const originalLFCnt = piece.lineFeedCnt;
const originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
const newStart = pos;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);
const newStartOffset = this.offsetInBuffer(piece.bufferIndex, newStart);
const lf_delta = newLineFeedCnt - originalLFCnt;
const size_delta = originalStartOffset - newStartOffset;
const newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
}
shrinkNode(node, start, end) {
const piece = node.piece;
const originalStartPos = piece.start;
const originalEndPos = piece.end;
const oldLength = piece.length;
const oldLFCnt = piece.lineFeedCnt;
const newEnd = start;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
const newLength = this.offsetInBuffer(piece.bufferIndex, start) - this.offsetInBuffer(piece.bufferIndex, originalStartPos);
node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, newLength - oldLength, newLineFeedCnt - oldLFCnt);
const newPiece = new Piece(piece.bufferIndex, end, originalEndPos, this.getLineFeedCnt(piece.bufferIndex, end, originalEndPos), this.offsetInBuffer(piece.bufferIndex, originalEndPos) - this.offsetInBuffer(piece.bufferIndex, end));
const newNode = this.rbInsertRight(node, newPiece);
this.validateCRLFWithPrevNode(newNode);
}
appendToNode(node, value) {
if (this.adjustCarriageReturnFromNext(value, node)) {
value += "\n";
}
const hitCRLF = this.shouldCheckCRLF() && this.startWithLF(value) && this.endWithCR(node);
const startOffset = this._buffers[0].buffer.length;
this._buffers[0].buffer += value;
const lineStarts = createLineStartsFast(value, false);
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset;
}
if (hitCRLF) {
const prevStartOffset = this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 2];
this._buffers[0].lineStarts.pop();
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line - 1, column: startOffset - prevStartOffset };
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
const endIndex = this._buffers[0].lineStarts.length - 1;
const endColumn = this._buffers[0].buffer.length - this._buffers[0].lineStarts[endIndex];
const newEnd = { line: endIndex, column: endColumn };
const newLength = node.piece.length + value.length;
const oldLineFeedCnt = node.piece.lineFeedCnt;
const newLineFeedCnt = this.getLineFeedCnt(0, node.piece.start, newEnd);
const lf_delta = newLineFeedCnt - oldLineFeedCnt;
node.piece = new Piece(node.piece.bufferIndex, node.piece.start, newEnd, newLineFeedCnt, newLength);
this._lastChangeBufferPos = newEnd;
updateTreeMetadata(this, node, value.length, lf_delta);
}
nodeAt(offset) {
let x = this.root;
const cache = this._searchCache.get(offset);
if (cache) {
return {
node: cache.node,
nodeStartOffset: cache.nodeStartOffset,
remainder: offset - cache.nodeStartOffset
};
}
let nodeStartOffset = 0;
while (x !== SENTINEL2) {
if (x.size_left > offset) {
x = x.left;
} else if (x.size_left + x.piece.length >= offset) {
nodeStartOffset += x.size_left;
const ret = {
node: x,
remainder: offset - x.size_left,
nodeStartOffset
};
this._searchCache.set(ret);
return ret;
} else {
offset -= x.size_left + x.piece.length;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
return null;
}
nodeAt2(lineNumber, column) {
let x = this.root;
let nodeStartOffset = 0;
while (x !== SENTINEL2) {
if (x.left !== SENTINEL2 && x.lf_left >= lineNumber - 1) {
x = x.left;
} else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
const prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
const accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
nodeStartOffset += x.size_left;
return {
node: x,
remainder: Math.min(prevAccumualtedValue + column - 1, accumulatedValue),
nodeStartOffset
};
} else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
const prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
if (prevAccumualtedValue + column - 1 <= x.piece.length) {
return {
node: x,
remainder: prevAccumualtedValue + column - 1,
nodeStartOffset
};
} else {
column -= x.piece.length - prevAccumualtedValue;
break;
}
} else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
x = x.next();
while (x !== SENTINEL2) {
if (x.piece.lineFeedCnt > 0) {
const accumulatedValue = this.getAccumulatedValue(x, 0);
const nodeStartOffset2 = this.offsetOfNode(x);
return {
node: x,
remainder: Math.min(column - 1, accumulatedValue),
nodeStartOffset: nodeStartOffset2
};
} else {
if (x.piece.length >= column - 1) {
const nodeStartOffset2 = this.offsetOfNode(x);
return {
node: x,
remainder: column - 1,
nodeStartOffset: nodeStartOffset2
};
} else {
column -= x.piece.length;
}
}
x = x.next();
}
return null;
}
nodeCharCodeAt(node, offset) {
if (node.piece.lineFeedCnt < 1) {
return -1;
}
const buffer = this._buffers[node.piece.bufferIndex];
const newOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start) + offset;
return buffer.buffer.charCodeAt(newOffset);
}
offsetOfNode(node) {
if (!node) {
return 0;
}
let pos = node.size_left;
while (node !== this.root) {
if (node.parent.right === node) {
pos += node.parent.size_left + node.parent.piece.length;
}
node = node.parent;
}
return pos;
}
// #endregion
// #region CRLF
shouldCheckCRLF() {
return !(this._EOLNormalized && this._EOL === "\n");
}
startWithLF(val) {
if (typeof val === "string") {
return val.charCodeAt(0) === 10;
}
if (val === SENTINEL2 || val.piece.lineFeedCnt === 0) {
return false;
}
const piece = val.piece;
const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
const line = piece.start.line;
const startOffset = lineStarts[line] + piece.start.column;
if (line === lineStarts.length - 1) {
return false;
}
const nextLineOffset = lineStarts[line + 1];
if (nextLineOffset > startOffset + 1) {
return false;
}
return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10;
}
endWithCR(val) {
if (typeof val === "string") {
return val.charCodeAt(val.length - 1) === 13;
}
if (val === SENTINEL2 || val.piece.lineFeedCnt === 0) {
return false;
}
return this.nodeCharCodeAt(val, val.piece.length - 1) === 13;
}
validateCRLFWithPrevNode(nextNode) {
if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) {
const node = nextNode.prev();
if (this.endWithCR(node)) {
this.fixCRLF(node, nextNode);
}
}
}
validateCRLFWithNextNode(node) {
if (this.shouldCheckCRLF() && this.endWithCR(node)) {
const nextNode = node.next();
if (this.startWithLF(nextNode)) {
this.fixCRLF(node, nextNode);
}
}
}
fixCRLF(prev, next) {
const nodesToDel = [];
const lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;
let newEnd;
if (prev.piece.end.column === 0) {
newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };
} else {
newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };
}
const prevNewLength = prev.piece.length - 1;
const prevNewLFCnt = prev.piece.lineFeedCnt - 1;
prev.piece = new Piece(prev.piece.bufferIndex, prev.piece.start, newEnd, prevNewLFCnt, prevNewLength);
updateTreeMetadata(this, prev, -1, -1);
if (prev.piece.length === 0) {
nodesToDel.push(prev);
}
const newStart = { line: next.piece.start.line + 1, column: 0 };
const newLength = next.piece.length - 1;
const newLineFeedCnt = this.getLineFeedCnt(next.piece.bufferIndex, newStart, next.piece.end);
next.piece = new Piece(next.piece.bufferIndex, newStart, next.piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, next, -1, -1);
if (next.piece.length === 0) {
nodesToDel.push(next);
}
const pieces = this.createNewPieces("\r\n");
this.rbInsertRight(prev, pieces[0]);
for (let i = 0; i < nodesToDel.length; i++) {
rbDelete(this, nodesToDel[i]);
}
}
adjustCarriageReturnFromNext(value, node) {
if (this.shouldCheckCRLF() && this.endWithCR(value)) {
const nextNode = node.next();
if (this.startWithLF(nextNode)) {
value += "\n";
if (nextNode.piece.length === 1) {
rbDelete(this, nextNode);
} else {
const piece = nextNode.piece;
const newStart = { line: piece.start.line + 1, column: 0 };
const newLength = piece.length - 1;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);
nextNode.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, nextNode, -1, -1);
}
return true;
}
}
return false;
}
// #endregion
// #endregion
// #region Tree operations
iterate(node, callback) {
if (node === SENTINEL2) {
return callback(SENTINEL2);
}
const leftRet = this.iterate(node.left, callback);
if (!leftRet) {
return leftRet;
}
return callback(node) && this.iterate(node.right, callback);
}
getNodeContent(node) {
if (node === SENTINEL2) {
return "";
}
const buffer = this._buffers[node.piece.bufferIndex];
const piece = node.piece;
const startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
const endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
const currentContent = buffer.buffer.substring(startOffset, endOffset);
return currentContent;
}
getPieceContent(piece) {
const buffer = this._buffers[piece.bufferIndex];
const startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
const endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
const currentContent = buffer.buffer.substring(startOffset, endOffset);
return currentContent;
}
/**
* node node
* / \ / \
* a b <---- a b
* /
* z
*/
rbInsertRight(node, p) {
const z = new TreeNode(
p,
1
/* NodeColor.Red */
);
z.left = SENTINEL2;
z.right = SENTINEL2;
z.parent = SENTINEL2;
z.size_left = 0;
z.lf_left = 0;
const x = this.root;
if (x === SENTINEL2) {
this.root = z;
z.color = 0;
} else if (node.right === SENTINEL2) {
node.right = z;
z.parent = node;
} else {
const nextNode = leftest2(node.right);
nextNode.left = z;
z.parent = nextNode;
}
fixInsert(this, z);
return z;
}
/**
* node node
* / \ / \
* a b ----> a b
* \
* z
*/
rbInsertLeft(node, p) {
const z = new TreeNode(
p,
1
/* NodeColor.Red */
);
z.left = SENTINEL2;
z.right = SENTINEL2;
z.parent = SENTINEL2;
z.size_left = 0;
z.lf_left = 0;
if (this.root === SENTINEL2) {
this.root = z;
z.color = 0;
} else if (node.left === SENTINEL2) {
node.left = z;
z.parent = node;
} else {
const prevNode = righttest(node.left);
prevNode.right = z;
z.parent = prevNode;
}
fixInsert(this, z);
return z;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js
var PieceTreeTextBuffer;
var init_pieceTreeTextBuffer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js"() {
init_event();
init_strings();
init_range();
init_model2();
init_pieceTreeBase();
init_eolCounter();
init_textChange();
init_lifecycle();
PieceTreeTextBuffer = class _PieceTreeTextBuffer extends Disposable {
constructor(chunks, BOM, eol, containsRTL2, containsUnusualLineTerminators2, isBasicASCII2, eolNormalized) {
super();
this._onDidChangeContent = this._register(new Emitter());
this._BOM = BOM;
this._mightContainNonBasicASCII = !isBasicASCII2;
this._mightContainRTL = containsRTL2;
this._mightContainUnusualLineTerminators = containsUnusualLineTerminators2;
this._pieceTree = new PieceTreeBase(chunks, eol, eolNormalized);
}
mightContainRTL() {
return this._mightContainRTL;
}
mightContainUnusualLineTerminators() {
return this._mightContainUnusualLineTerminators;
}
resetMightContainUnusualLineTerminators() {
this._mightContainUnusualLineTerminators = false;
}
mightContainNonBasicASCII() {
return this._mightContainNonBasicASCII;
}
getBOM() {
return this._BOM;
}
getEOL() {
return this._pieceTree.getEOL();
}
createSnapshot(preserveBOM) {
return this._pieceTree.createSnapshot(preserveBOM ? this._BOM : "");
}
getOffsetAt(lineNumber, column) {
return this._pieceTree.getOffsetAt(lineNumber, column);
}
getPositionAt(offset) {
return this._pieceTree.getPositionAt(offset);
}
getRangeAt(start, length) {
const end = start + length;
const startPosition = this.getPositionAt(start);
const endPosition = this.getPositionAt(end);
return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
}
getValueInRange(range2, eol = 0) {
if (range2.isEmpty()) {
return "";
}
const lineEnding = this._getEndOfLine(eol);
return this._pieceTree.getValueInRange(range2, lineEnding);
}
getValueLengthInRange(range2, eol = 0) {
if (range2.isEmpty()) {
return 0;
}
if (range2.startLineNumber === range2.endLineNumber) {
return range2.endColumn - range2.startColumn;
}
const startOffset = this.getOffsetAt(range2.startLineNumber, range2.startColumn);
const endOffset = this.getOffsetAt(range2.endLineNumber, range2.endColumn);
let eolOffsetCompensation = 0;
const desiredEOL = this._getEndOfLine(eol);
const actualEOL = this.getEOL();
if (desiredEOL.length !== actualEOL.length) {
const delta = desiredEOL.length - actualEOL.length;
const eolCount = range2.endLineNumber - range2.startLineNumber;
eolOffsetCompensation = delta * eolCount;
}
return endOffset - startOffset + eolOffsetCompensation;
}
getCharacterCountInRange(range2, eol = 0) {
if (this._mightContainNonBasicASCII) {
let result = 0;
const fromLineNumber = range2.startLineNumber;
const toLineNumber = range2.endLineNumber;
for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
const lineContent = this.getLineContent(lineNumber);
const fromOffset = lineNumber === fromLineNumber ? range2.startColumn - 1 : 0;
const toOffset = lineNumber === toLineNumber ? range2.endColumn - 1 : lineContent.length;
for (let offset = fromOffset; offset < toOffset; offset++) {
if (isHighSurrogate(lineContent.charCodeAt(offset))) {
result = result + 1;
offset = offset + 1;
} else {
result = result + 1;
}
}
}
result += this._getEndOfLine(eol).length * (toLineNumber - fromLineNumber);
return result;
}
return this.getValueLengthInRange(range2, eol);
}
getLength() {
return this._pieceTree.getLength();
}
getLineCount() {
return this._pieceTree.getLineCount();
}
getLinesContent() {
return this._pieceTree.getLinesContent();
}
getLineContent(lineNumber) {
return this._pieceTree.getLineContent(lineNumber);
}
getLineCharCode(lineNumber, index) {
return this._pieceTree.getLineCharCode(lineNumber, index);
}
getLineLength(lineNumber) {
return this._pieceTree.getLineLength(lineNumber);
}
getLineFirstNonWhitespaceColumn(lineNumber) {
const result = firstNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
}
getLineLastNonWhitespaceColumn(lineNumber) {
const result = lastNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
}
_getEndOfLine(eol) {
switch (eol) {
case 1:
return "\n";
case 2:
return "\r\n";
case 0:
return this.getEOL();
default:
throw new Error("Unknown EOL preference");
}
}
setEOL(newEOL) {
this._pieceTree.setEOL(newEOL);
}
applyEdits(rawOperations, recordTrimAutoWhitespace, computeUndoEdits) {
let mightContainRTL = this._mightContainRTL;
let mightContainUnusualLineTerminators = this._mightContainUnusualLineTerminators;
let mightContainNonBasicASCII = this._mightContainNonBasicASCII;
let canReduceOperations = true;
let operations = [];
for (let i = 0; i < rawOperations.length; i++) {
const op = rawOperations[i];
if (canReduceOperations && op._isTracked) {
canReduceOperations = false;
}
const validatedRange = op.range;
if (op.text) {
let textMightContainNonBasicASCII = true;
if (!mightContainNonBasicASCII) {
textMightContainNonBasicASCII = !isBasicASCII(op.text);
mightContainNonBasicASCII = textMightContainNonBasicASCII;
}
if (!mightContainRTL && textMightContainNonBasicASCII) {
mightContainRTL = containsRTL(op.text);
}
if (!mightContainUnusualLineTerminators && textMightContainNonBasicASCII) {
mightContainUnusualLineTerminators = containsUnusualLineTerminators(op.text);
}
}
let validText = "";
let eolCount = 0;
let firstLineLength = 0;
let lastLineLength = 0;
if (op.text) {
let strEOL;
[eolCount, firstLineLength, lastLineLength, strEOL] = countEOL(op.text);
const bufferEOL = this.getEOL();
const expectedStrEOL = bufferEOL === "\r\n" ? 2 : 1;
if (strEOL === 0 || strEOL === expectedStrEOL) {
validText = op.text;
} else {
validText = op.text.replace(/\r\n|\r|\n/g, bufferEOL);
}
}
operations[i] = {
sortIndex: i,
identifier: op.identifier || null,
range: validatedRange,
rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),
rangeLength: this.getValueLengthInRange(validatedRange),
text: validText,
eolCount,
firstLineLength,
lastLineLength,
forceMoveMarkers: Boolean(op.forceMoveMarkers),
isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false
};
}
operations.sort(_PieceTreeTextBuffer._sortOpsAscending);
let hasTouchingRanges = false;
for (let i = 0, count = operations.length - 1; i < count; i++) {
const rangeEnd = operations[i].range.getEndPosition();
const nextRangeStart = operations[i + 1].range.getStartPosition();
if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {
if (nextRangeStart.isBefore(rangeEnd)) {
throw new Error("Overlapping ranges are not allowed!");
}
hasTouchingRanges = true;
}
}
if (canReduceOperations) {
operations = this._reduceOperations(operations);
}
const reverseRanges = computeUndoEdits || recordTrimAutoWhitespace ? _PieceTreeTextBuffer._getInverseEditRanges(operations) : [];
const newTrimAutoWhitespaceCandidates = [];
if (recordTrimAutoWhitespace) {
for (let i = 0; i < operations.length; i++) {
const op = operations[i];
const reverseRange = reverseRanges[i];
if (op.isAutoWhitespaceEdit && op.range.isEmpty()) {
for (let lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {
let currentLineContent = "";
if (lineNumber === reverseRange.startLineNumber) {
currentLineContent = this.getLineContent(op.range.startLineNumber);
if (firstNonWhitespaceIndex(currentLineContent) !== -1) {
continue;
}
}
newTrimAutoWhitespaceCandidates.push({ lineNumber, oldContent: currentLineContent });
}
}
}
}
let reverseOperations = null;
if (computeUndoEdits) {
let reverseRangeDeltaOffset = 0;
reverseOperations = [];
for (let i = 0; i < operations.length; i++) {
const op = operations[i];
const reverseRange = reverseRanges[i];
const bufferText = this.getValueInRange(op.range);
const reverseRangeOffset = op.rangeOffset + reverseRangeDeltaOffset;
reverseRangeDeltaOffset += op.text.length - bufferText.length;
reverseOperations[i] = {
sortIndex: op.sortIndex,
identifier: op.identifier,
range: reverseRange,
text: bufferText,
textChange: new TextChange(op.rangeOffset, bufferText, reverseRangeOffset, op.text)
};
}
if (!hasTouchingRanges) {
reverseOperations.sort((a3, b) => a3.sortIndex - b.sortIndex);
}
}
this._mightContainRTL = mightContainRTL;
this._mightContainUnusualLineTerminators = mightContainUnusualLineTerminators;
this._mightContainNonBasicASCII = mightContainNonBasicASCII;
const contentChanges = this._doApplyEdits(operations);
let trimAutoWhitespaceLineNumbers = null;
if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {
newTrimAutoWhitespaceCandidates.sort((a3, b) => b.lineNumber - a3.lineNumber);
trimAutoWhitespaceLineNumbers = [];
for (let i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {
const lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;
if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {
continue;
}
const prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;
const lineContent = this.getLineContent(lineNumber);
if (lineContent.length === 0 || lineContent === prevContent || firstNonWhitespaceIndex(lineContent) !== -1) {
continue;
}
trimAutoWhitespaceLineNumbers.push(lineNumber);
}
}
this._onDidChangeContent.fire();
return new ApplyEditsResult(reverseOperations, contentChanges, trimAutoWhitespaceLineNumbers);
}
/**
* Transform operations such that they represent the same logic edit,
* but that they also do not cause OOM crashes.
*/
_reduceOperations(operations) {
if (operations.length < 1e3) {
return operations;
}
return [this._toSingleEditOperation(operations)];
}
_toSingleEditOperation(operations) {
let forceMoveMarkers = false;
const firstEditRange = operations[0].range;
const lastEditRange = operations[operations.length - 1].range;
const entireEditRange = new Range(firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn);
let lastEndLineNumber = firstEditRange.startLineNumber;
let lastEndColumn = firstEditRange.startColumn;
const result = [];
for (let i = 0, len = operations.length; i < len; i++) {
const operation = operations[i];
const range2 = operation.range;
forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;
result.push(this.getValueInRange(new Range(lastEndLineNumber, lastEndColumn, range2.startLineNumber, range2.startColumn)));
if (operation.text.length > 0) {
result.push(operation.text);
}
lastEndLineNumber = range2.endLineNumber;
lastEndColumn = range2.endColumn;
}
const text2 = result.join("");
const [eolCount, firstLineLength, lastLineLength] = countEOL(text2);
return {
sortIndex: 0,
identifier: operations[0].identifier,
range: entireEditRange,
rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),
rangeLength: this.getValueLengthInRange(
entireEditRange,
0
/* EndOfLinePreference.TextDefined */
),
text: text2,
eolCount,
firstLineLength,
lastLineLength,
forceMoveMarkers,
isAutoWhitespaceEdit: false
};
}
_doApplyEdits(operations) {
operations.sort(_PieceTreeTextBuffer._sortOpsDescending);
const contentChanges = [];
for (let i = 0; i < operations.length; i++) {
const op = operations[i];
const startLineNumber = op.range.startLineNumber;
const startColumn = op.range.startColumn;
const endLineNumber = op.range.endLineNumber;
const endColumn = op.range.endColumn;
if (startLineNumber === endLineNumber && startColumn === endColumn && op.text.length === 0) {
continue;
}
if (op.text) {
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
this._pieceTree.insert(op.rangeOffset, op.text, true);
} else {
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
}
const contentChangeRange = new Range(startLineNumber, startColumn, endLineNumber, endColumn);
contentChanges.push({
range: contentChangeRange,
rangeLength: op.rangeLength,
text: op.text,
rangeOffset: op.rangeOffset,
forceMoveMarkers: op.forceMoveMarkers
});
}
return contentChanges;
}
findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {
return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
}
/**
* Assumes `operations` are validated and sorted ascending
*/
static _getInverseEditRanges(operations) {
const result = [];
let prevOpEndLineNumber = 0;
let prevOpEndColumn = 0;
let prevOp = null;
for (let i = 0, len = operations.length; i < len; i++) {
const op = operations[i];
let startLineNumber;
let startColumn;
if (prevOp) {
if (prevOp.range.endLineNumber === op.range.startLineNumber) {
startLineNumber = prevOpEndLineNumber;
startColumn = prevOpEndColumn + (op.range.startColumn - prevOp.range.endColumn);
} else {
startLineNumber = prevOpEndLineNumber + (op.range.startLineNumber - prevOp.range.endLineNumber);
startColumn = op.range.startColumn;
}
} else {
startLineNumber = op.range.startLineNumber;
startColumn = op.range.startColumn;
}
let resultRange;
if (op.text.length > 0) {
const lineCount = op.eolCount + 1;
if (lineCount === 1) {
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn + op.firstLineLength);
} else {
resultRange = new Range(startLineNumber, startColumn, startLineNumber + lineCount - 1, op.lastLineLength + 1);
}
} else {
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn);
}
prevOpEndLineNumber = resultRange.endLineNumber;
prevOpEndColumn = resultRange.endColumn;
result.push(resultRange);
prevOp = op;
}
return result;
}
static _sortOpsAscending(a3, b) {
const r = Range.compareRangesUsingEnds(a3.range, b.range);
if (r === 0) {
return a3.sortIndex - b.sortIndex;
}
return r;
}
static _sortOpsDescending(a3, b) {
const r = Range.compareRangesUsingEnds(a3.range, b.range);
if (r === 0) {
return b.sortIndex - a3.sortIndex;
}
return -r;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js
var PieceTreeTextBufferFactory, PieceTreeTextBufferBuilder;
var init_pieceTreeTextBufferBuilder = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js"() {
init_strings();
init_pieceTreeBase();
init_pieceTreeTextBuffer();
PieceTreeTextBufferFactory = class {
constructor(_chunks, _bom, _cr, _lf, _crlf, _containsRTL, _containsUnusualLineTerminators, _isBasicASCII, _normalizeEOL) {
this._chunks = _chunks;
this._bom = _bom;
this._cr = _cr;
this._lf = _lf;
this._crlf = _crlf;
this._containsRTL = _containsRTL;
this._containsUnusualLineTerminators = _containsUnusualLineTerminators;
this._isBasicASCII = _isBasicASCII;
this._normalizeEOL = _normalizeEOL;
}
_getEOL(defaultEOL) {
const totalEOLCount = this._cr + this._lf + this._crlf;
const totalCRCount = this._cr + this._crlf;
if (totalEOLCount === 0) {
return defaultEOL === 1 ? "\n" : "\r\n";
}
if (totalCRCount > totalEOLCount / 2) {
return "\r\n";
}
return "\n";
}
create(defaultEOL) {
const eol = this._getEOL(defaultEOL);
const chunks = this._chunks;
if (this._normalizeEOL && (eol === "\r\n" && (this._cr > 0 || this._lf > 0) || eol === "\n" && (this._cr > 0 || this._crlf > 0))) {
for (let i = 0, len = chunks.length; i < len; i++) {
const str = chunks[i].buffer.replace(/\r\n|\r|\n/g, eol);
const newLineStart = createLineStartsFast(str);
chunks[i] = new StringBuffer(str, newLineStart);
}
}
const textBuffer = new PieceTreeTextBuffer(chunks, this._bom, eol, this._containsRTL, this._containsUnusualLineTerminators, this._isBasicASCII, this._normalizeEOL);
return { textBuffer, disposable: textBuffer };
}
};
PieceTreeTextBufferBuilder = class {
constructor() {
this.chunks = [];
this.BOM = "";
this._hasPreviousChar = false;
this._previousChar = 0;
this._tmpLineStarts = [];
this.cr = 0;
this.lf = 0;
this.crlf = 0;
this.containsRTL = false;
this.containsUnusualLineTerminators = false;
this.isBasicASCII = true;
}
acceptChunk(chunk) {
if (chunk.length === 0) {
return;
}
if (this.chunks.length === 0) {
if (startsWithUTF8BOM(chunk)) {
this.BOM = UTF8_BOM_CHARACTER;
chunk = chunk.substr(1);
}
}
const lastChar = chunk.charCodeAt(chunk.length - 1);
if (lastChar === 13 || lastChar >= 55296 && lastChar <= 56319) {
this._acceptChunk1(chunk.substr(0, chunk.length - 1), false);
this._hasPreviousChar = true;
this._previousChar = lastChar;
} else {
this._acceptChunk1(chunk, false);
this._hasPreviousChar = false;
this._previousChar = lastChar;
}
}
_acceptChunk1(chunk, allowEmptyStrings) {
if (!allowEmptyStrings && chunk.length === 0) {
return;
}
if (this._hasPreviousChar) {
this._acceptChunk2(String.fromCharCode(this._previousChar) + chunk);
} else {
this._acceptChunk2(chunk);
}
}
_acceptChunk2(chunk) {
const lineStarts = createLineStarts(this._tmpLineStarts, chunk);
this.chunks.push(new StringBuffer(chunk, lineStarts.lineStarts));
this.cr += lineStarts.cr;
this.lf += lineStarts.lf;
this.crlf += lineStarts.crlf;
if (!lineStarts.isBasicASCII) {
this.isBasicASCII = false;
if (!this.containsRTL) {
this.containsRTL = containsRTL(chunk);
}
if (!this.containsUnusualLineTerminators) {
this.containsUnusualLineTerminators = containsUnusualLineTerminators(chunk);
}
}
}
finish(normalizeEOL = true) {
this._finish();
return new PieceTreeTextBufferFactory(this.chunks, this.BOM, this.cr, this.lf, this.crlf, this.containsRTL, this.containsUnusualLineTerminators, this.isBasicASCII, normalizeEOL);
}
_finish() {
if (this.chunks.length === 0) {
this._acceptChunk1("", true);
}
if (this._hasPreviousChar) {
this._hasPreviousChar = false;
const lastChunk = this.chunks[this.chunks.length - 1];
lastChunk.buffer += String.fromCharCode(this._previousChar);
const newLineStarts = createLineStartsFast(lastChunk.buffer);
lastChunk.lineStarts = newLineStarts;
if (this._previousChar === 13) {
this.cr++;
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/fixedArray.js
function arrayFill(length, value) {
const arr = [];
for (let i = 0; i < length; i++) {
arr[i] = value;
}
return arr;
}
var FixedArray;
var init_fixedArray = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/fixedArray.js"() {
init_arrays();
FixedArray = class {
constructor(_default) {
this._default = _default;
this._store = [];
}
get(index) {
if (index < this._store.length) {
return this._store[index];
}
return this._default;
}
set(index, value) {
while (index >= this._store.length) {
this._store[this._store.length] = this._default;
}
this._store[index] = value;
}
replace(index, oldLength, newLength) {
if (index >= this._store.length) {
return;
}
if (oldLength === 0) {
this.insert(index, newLength);
return;
} else if (newLength === 0) {
this.delete(index, oldLength);
return;
}
const before = this._store.slice(0, index);
const after2 = this._store.slice(index + oldLength);
const insertArr = arrayFill(newLength, this._default);
this._store = before.concat(insertArr, after2);
}
delete(deleteIndex, deleteCount) {
if (deleteCount === 0 || deleteIndex >= this._store.length) {
return;
}
this._store.splice(deleteIndex, deleteCount);
}
insert(insertIndex, insertCount) {
if (insertCount === 0 || insertIndex >= this._store.length) {
return;
}
const arr = [];
for (let i = 0; i < insertCount; i++) {
arr[i] = this._default;
}
this._store = arrayInsert(this._store, insertIndex, arr);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokens.js
var ContiguousMultilineTokens;
var init_contiguousMultilineTokens = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokens.js"() {
ContiguousMultilineTokens = class {
/**
* (Inclusive) start line number for these tokens.
*/
get startLineNumber() {
return this._startLineNumber;
}
/**
* (Inclusive) end line number for these tokens.
*/
get endLineNumber() {
return this._startLineNumber + this._tokens.length - 1;
}
constructor(startLineNumber, tokens) {
this._startLineNumber = startLineNumber;
this._tokens = tokens;
}
/**
* @see {@link _tokens}
*/
getLineTokens(lineNumber) {
return this._tokens[lineNumber - this._startLineNumber];
}
appendLineTokens(lineTokens) {
this._tokens.push(lineTokens);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokensBuilder.js
var ContiguousMultilineTokensBuilder;
var init_contiguousMultilineTokensBuilder = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousMultilineTokensBuilder.js"() {
init_contiguousMultilineTokens();
ContiguousMultilineTokensBuilder = class {
constructor() {
this._tokens = [];
}
add(lineNumber, lineTokens) {
if (this._tokens.length > 0) {
const last = this._tokens[this._tokens.length - 1];
if (last.endLineNumber + 1 === lineNumber) {
last.appendLineTokens(lineTokens);
return;
}
}
this._tokens.push(new ContiguousMultilineTokens(lineNumber, [lineTokens]));
}
finalize() {
return this._tokens;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/textModelTokens.js
function safeTokenize(languageIdCodec, languageId, tokenizationSupport, text2, hasEOL, state) {
let r = null;
if (tokenizationSupport) {
try {
r = tokenizationSupport.tokenizeEncoded(text2, hasEOL, state.clone());
} catch (e) {
onUnexpectedError(e);
}
}
if (!r) {
r = nullTokenizeEncoded(languageIdCodec.encodeLanguageId(languageId), state);
}
LineTokens.convertToEndOffset(r.tokens, text2.length);
return r;
}
var TokenizerWithStateStore, TokenizerWithStateStoreAndTextModel, TrackingTokenizationStateStore, TokenizationStateStore, RangePriorityQueueImpl, DefaultBackgroundTokenizer;
var init_textModelTokens = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/textModelTokens.js"() {
init_async();
init_errors();
init_platform();
init_stopwatch();
init_eolCounter();
init_lineRange();
init_offsetRange();
init_nullTokenize();
init_fixedArray();
init_contiguousMultilineTokensBuilder();
init_lineTokens();
TokenizerWithStateStore = class {
constructor(lineCount, tokenizationSupport) {
this.tokenizationSupport = tokenizationSupport;
this.initialState = this.tokenizationSupport.getInitialState();
this.store = new TrackingTokenizationStateStore(lineCount);
}
getStartState(lineNumber) {
return this.store.getStartState(lineNumber, this.initialState);
}
getFirstInvalidLine() {
return this.store.getFirstInvalidLine(this.initialState);
}
};
TokenizerWithStateStoreAndTextModel = class extends TokenizerWithStateStore {
constructor(lineCount, tokenizationSupport, _textModel, _languageIdCodec) {
super(lineCount, tokenizationSupport);
this._textModel = _textModel;
this._languageIdCodec = _languageIdCodec;
}
updateTokensUntilLine(builder, lineNumber) {
const languageId = this._textModel.getLanguageId();
while (true) {
const lineToTokenize = this.getFirstInvalidLine();
if (!lineToTokenize || lineToTokenize.lineNumber > lineNumber) {
break;
}
const text2 = this._textModel.getLineContent(lineToTokenize.lineNumber);
const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text2, true, lineToTokenize.startState);
builder.add(lineToTokenize.lineNumber, r.tokens);
this.store.setEndState(lineToTokenize.lineNumber, r.endState);
}
}
/** assumes state is up to date */
getTokenTypeIfInsertingCharacter(position, character) {
const lineStartState = this.getStartState(position.lineNumber);
if (!lineStartState) {
return 0;
}
const languageId = this._textModel.getLanguageId();
const lineContent = this._textModel.getLineContent(position.lineNumber);
const text2 = lineContent.substring(0, position.column - 1) + character + lineContent.substring(position.column - 1);
const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text2, true, lineStartState);
const lineTokens = new LineTokens(r.tokens, text2, this._languageIdCodec);
if (lineTokens.getCount() === 0) {
return 0;
}
const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
return lineTokens.getStandardTokenType(tokenIndex);
}
/** assumes state is up to date */
tokenizeLineWithEdit(position, length, newText) {
const lineNumber = position.lineNumber;
const column = position.column;
const lineStartState = this.getStartState(lineNumber);
if (!lineStartState) {
return null;
}
const curLineContent = this._textModel.getLineContent(lineNumber);
const newLineContent = curLineContent.substring(0, column - 1) + newText + curLineContent.substring(column - 1 + length);
const languageId = this._textModel.getLanguageIdAtPosition(lineNumber, 0);
const result = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, newLineContent, true, lineStartState);
const lineTokens = new LineTokens(result.tokens, newLineContent, this._languageIdCodec);
return lineTokens;
}
hasAccurateTokensForLine(lineNumber) {
const firstInvalidLineNumber = this.store.getFirstInvalidEndStateLineNumberOrMax();
return lineNumber < firstInvalidLineNumber;
}
isCheapToTokenize(lineNumber) {
const firstInvalidLineNumber = this.store.getFirstInvalidEndStateLineNumberOrMax();
if (lineNumber < firstInvalidLineNumber) {
return true;
}
if (lineNumber === firstInvalidLineNumber && this._textModel.getLineLength(lineNumber) < 2048) {
return true;
}
return false;
}
/**
* The result is not cached.
*/
tokenizeHeuristically(builder, startLineNumber, endLineNumber) {
if (endLineNumber <= this.store.getFirstInvalidEndStateLineNumberOrMax()) {
return { heuristicTokens: false };
}
if (startLineNumber <= this.store.getFirstInvalidEndStateLineNumberOrMax()) {
this.updateTokensUntilLine(builder, endLineNumber);
return { heuristicTokens: false };
}
let state = this.guessStartState(startLineNumber);
const languageId = this._textModel.getLanguageId();
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const text2 = this._textModel.getLineContent(lineNumber);
const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, text2, true, state);
builder.add(lineNumber, r.tokens);
state = r.endState;
}
return { heuristicTokens: true };
}
guessStartState(lineNumber) {
let nonWhitespaceColumn = this._textModel.getLineFirstNonWhitespaceColumn(lineNumber);
const likelyRelevantLines = [];
let initialState = null;
for (let i = lineNumber - 1; nonWhitespaceColumn > 1 && i >= 1; i--) {
const newNonWhitespaceIndex = this._textModel.getLineFirstNonWhitespaceColumn(i);
if (newNonWhitespaceIndex === 0) {
continue;
}
if (newNonWhitespaceIndex < nonWhitespaceColumn) {
likelyRelevantLines.push(this._textModel.getLineContent(i));
nonWhitespaceColumn = newNonWhitespaceIndex;
initialState = this.getStartState(i);
if (initialState) {
break;
}
}
}
if (!initialState) {
initialState = this.tokenizationSupport.getInitialState();
}
likelyRelevantLines.reverse();
const languageId = this._textModel.getLanguageId();
let state = initialState;
for (const line of likelyRelevantLines) {
const r = safeTokenize(this._languageIdCodec, languageId, this.tokenizationSupport, line, false, state);
state = r.endState;
}
return state;
}
};
TrackingTokenizationStateStore = class {
constructor(lineCount) {
this.lineCount = lineCount;
this._tokenizationStateStore = new TokenizationStateStore();
this._invalidEndStatesLineNumbers = new RangePriorityQueueImpl();
this._invalidEndStatesLineNumbers.addRange(new OffsetRange(1, lineCount + 1));
}
getEndState(lineNumber) {
return this._tokenizationStateStore.getEndState(lineNumber);
}
/**
* @returns if the end state has changed.
*/
setEndState(lineNumber, state) {
if (!state) {
throw new BugIndicatingError("Cannot set null/undefined state");
}
this._invalidEndStatesLineNumbers.delete(lineNumber);
const r = this._tokenizationStateStore.setEndState(lineNumber, state);
if (r && lineNumber < this.lineCount) {
this._invalidEndStatesLineNumbers.addRange(new OffsetRange(lineNumber + 1, lineNumber + 2));
}
return r;
}
acceptChange(range2, newLineCount) {
this.lineCount += newLineCount - range2.length;
this._tokenizationStateStore.acceptChange(range2, newLineCount);
this._invalidEndStatesLineNumbers.addRangeAndResize(new OffsetRange(range2.startLineNumber, range2.endLineNumberExclusive), newLineCount);
}
acceptChanges(changes) {
for (const c of changes) {
const [eolCount] = countEOL(c.text);
this.acceptChange(new LineRange(c.range.startLineNumber, c.range.endLineNumber + 1), eolCount + 1);
}
}
invalidateEndStateRange(range2) {
this._invalidEndStatesLineNumbers.addRange(new OffsetRange(range2.startLineNumber, range2.endLineNumberExclusive));
}
getFirstInvalidEndStateLineNumber() {
return this._invalidEndStatesLineNumbers.min;
}
getFirstInvalidEndStateLineNumberOrMax() {
return this.getFirstInvalidEndStateLineNumber() || Number.MAX_SAFE_INTEGER;
}
allStatesValid() {
return this._invalidEndStatesLineNumbers.min === null;
}
getStartState(lineNumber, initialState) {
if (lineNumber === 1) {
return initialState;
}
return this.getEndState(lineNumber - 1);
}
getFirstInvalidLine(initialState) {
const lineNumber = this.getFirstInvalidEndStateLineNumber();
if (lineNumber === null) {
return null;
}
const startState = this.getStartState(lineNumber, initialState);
if (!startState) {
throw new BugIndicatingError("Start state must be defined");
}
return { lineNumber, startState };
}
};
TokenizationStateStore = class {
constructor() {
this._lineEndStates = new FixedArray(null);
}
getEndState(lineNumber) {
return this._lineEndStates.get(lineNumber);
}
setEndState(lineNumber, state) {
const oldState = this._lineEndStates.get(lineNumber);
if (oldState && oldState.equals(state)) {
return false;
}
this._lineEndStates.set(lineNumber, state);
return true;
}
acceptChange(range2, newLineCount) {
let length = range2.length;
if (newLineCount > 0 && length > 0) {
length--;
newLineCount--;
}
this._lineEndStates.replace(range2.startLineNumber, length, newLineCount);
}
};
RangePriorityQueueImpl = class {
constructor() {
this._ranges = [];
}
get min() {
if (this._ranges.length === 0) {
return null;
}
return this._ranges[0].start;
}
delete(value) {
const idx = this._ranges.findIndex((r) => r.contains(value));
if (idx !== -1) {
const range2 = this._ranges[idx];
if (range2.start === value) {
if (range2.endExclusive === value + 1) {
this._ranges.splice(idx, 1);
} else {
this._ranges[idx] = new OffsetRange(value + 1, range2.endExclusive);
}
} else {
if (range2.endExclusive === value + 1) {
this._ranges[idx] = new OffsetRange(range2.start, value);
} else {
this._ranges.splice(idx, 1, new OffsetRange(range2.start, value), new OffsetRange(value + 1, range2.endExclusive));
}
}
}
}
addRange(range2) {
OffsetRange.addRange(range2, this._ranges);
}
addRangeAndResize(range2, newLength) {
let idxFirstMightBeIntersecting = 0;
while (!(idxFirstMightBeIntersecting >= this._ranges.length || range2.start <= this._ranges[idxFirstMightBeIntersecting].endExclusive)) {
idxFirstMightBeIntersecting++;
}
let idxFirstIsAfter = idxFirstMightBeIntersecting;
while (!(idxFirstIsAfter >= this._ranges.length || range2.endExclusive < this._ranges[idxFirstIsAfter].start)) {
idxFirstIsAfter++;
}
const delta = newLength - range2.length;
for (let i = idxFirstIsAfter; i < this._ranges.length; i++) {
this._ranges[i] = this._ranges[i].delta(delta);
}
if (idxFirstMightBeIntersecting === idxFirstIsAfter) {
const newRange = new OffsetRange(range2.start, range2.start + newLength);
if (!newRange.isEmpty) {
this._ranges.splice(idxFirstMightBeIntersecting, 0, newRange);
}
} else {
const start = Math.min(range2.start, this._ranges[idxFirstMightBeIntersecting].start);
const endEx = Math.max(range2.endExclusive, this._ranges[idxFirstIsAfter - 1].endExclusive);
const newRange = new OffsetRange(start, endEx + delta);
if (!newRange.isEmpty) {
this._ranges.splice(idxFirstMightBeIntersecting, idxFirstIsAfter - idxFirstMightBeIntersecting, newRange);
} else {
this._ranges.splice(idxFirstMightBeIntersecting, idxFirstIsAfter - idxFirstMightBeIntersecting);
}
}
}
toString() {
return this._ranges.map((r) => r.toString()).join(" + ");
}
};
DefaultBackgroundTokenizer = class {
constructor(_tokenizerWithStateStore, _backgroundTokenStore) {
this._tokenizerWithStateStore = _tokenizerWithStateStore;
this._backgroundTokenStore = _backgroundTokenStore;
this._isDisposed = false;
this._isScheduled = false;
}
dispose() {
this._isDisposed = true;
}
handleChanges() {
this._beginBackgroundTokenization();
}
_beginBackgroundTokenization() {
if (this._isScheduled || !this._tokenizerWithStateStore._textModel.isAttachedToEditor() || !this._hasLinesToTokenize()) {
return;
}
this._isScheduled = true;
runWhenGlobalIdle((deadline) => {
this._isScheduled = false;
this._backgroundTokenizeWithDeadline(deadline);
});
}
/**
* Tokenize until the deadline occurs, but try to yield every 1-2ms.
*/
_backgroundTokenizeWithDeadline(deadline) {
const endTime = Date.now() + deadline.timeRemaining();
const execute = () => {
if (this._isDisposed || !this._tokenizerWithStateStore._textModel.isAttachedToEditor() || !this._hasLinesToTokenize()) {
return;
}
this._backgroundTokenizeForAtLeast1ms();
if (Date.now() < endTime) {
setTimeout0(execute);
} else {
this._beginBackgroundTokenization();
}
};
execute();
}
/**
* Tokenize for at least 1ms.
*/
_backgroundTokenizeForAtLeast1ms() {
const lineCount = this._tokenizerWithStateStore._textModel.getLineCount();
const builder = new ContiguousMultilineTokensBuilder();
const sw = StopWatch.create(false);
do {
if (sw.elapsed() > 1) {
break;
}
const tokenizedLineNumber = this._tokenizeOneInvalidLine(builder);
if (tokenizedLineNumber >= lineCount) {
break;
}
} while (this._hasLinesToTokenize());
this._backgroundTokenStore.setTokens(builder.finalize());
this.checkFinished();
}
_hasLinesToTokenize() {
if (!this._tokenizerWithStateStore) {
return false;
}
return !this._tokenizerWithStateStore.store.allStatesValid();
}
_tokenizeOneInvalidLine(builder) {
var _a10;
const firstInvalidLine = (_a10 = this._tokenizerWithStateStore) === null || _a10 === void 0 ? void 0 : _a10.getFirstInvalidLine();
if (!firstInvalidLine) {
return this._tokenizerWithStateStore._textModel.getLineCount() + 1;
}
this._tokenizerWithStateStore.updateTokensUntilLine(builder, firstInvalidLine.lineNumber);
return firstInvalidLine.lineNumber;
}
checkFinished() {
if (this._isDisposed) {
return;
}
if (this._tokenizerWithStateStore.store.allStatesValid()) {
this._backgroundTokenStore.backgroundTokenizationFinished();
}
}
requestTokens(startLineNumber, endLineNumberExclusive) {
this._tokenizerWithStateStore.store.invalidateEndStateRange(new LineRange(startLineNumber, endLineNumberExclusive));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensEditing.js
function toUint32Array(arr) {
if (arr instanceof Uint32Array) {
return arr;
} else {
return new Uint32Array(arr);
}
}
var EMPTY_LINE_TOKENS, ContiguousTokensEditing;
var init_contiguousTokensEditing = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensEditing.js"() {
init_lineTokens();
EMPTY_LINE_TOKENS = new Uint32Array(0).buffer;
ContiguousTokensEditing = class _ContiguousTokensEditing {
static deleteBeginning(lineTokens, toChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
return _ContiguousTokensEditing.delete(lineTokens, 0, toChIndex);
}
static deleteEnding(lineTokens, fromChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
const tokens = toUint32Array(lineTokens);
const lineTextLength = tokens[tokens.length - 2];
return _ContiguousTokensEditing.delete(lineTokens, fromChIndex, lineTextLength);
}
static delete(lineTokens, fromChIndex, toChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS || fromChIndex === toChIndex) {
return lineTokens;
}
const tokens = toUint32Array(lineTokens);
const tokensCount = tokens.length >>> 1;
if (fromChIndex === 0 && tokens[tokens.length - 2] === toChIndex) {
return EMPTY_LINE_TOKENS;
}
const fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, fromChIndex);
const fromTokenStartOffset = fromTokenIndex > 0 ? tokens[fromTokenIndex - 1 << 1] : 0;
const fromTokenEndOffset = tokens[fromTokenIndex << 1];
if (toChIndex < fromTokenEndOffset) {
const delta2 = toChIndex - fromChIndex;
for (let i = fromTokenIndex; i < tokensCount; i++) {
tokens[i << 1] -= delta2;
}
return lineTokens;
}
let dest;
let lastEnd;
if (fromTokenStartOffset !== fromChIndex) {
tokens[fromTokenIndex << 1] = fromChIndex;
dest = fromTokenIndex + 1 << 1;
lastEnd = fromChIndex;
} else {
dest = fromTokenIndex << 1;
lastEnd = fromTokenStartOffset;
}
const delta = toChIndex - fromChIndex;
for (let tokenIndex = fromTokenIndex + 1; tokenIndex < tokensCount; tokenIndex++) {
const tokenEndOffset = tokens[tokenIndex << 1] - delta;
if (tokenEndOffset > lastEnd) {
tokens[dest++] = tokenEndOffset;
tokens[dest++] = tokens[(tokenIndex << 1) + 1];
lastEnd = tokenEndOffset;
}
}
if (dest === tokens.length) {
return lineTokens;
}
const tmp = new Uint32Array(dest);
tmp.set(tokens.subarray(0, dest), 0);
return tmp.buffer;
}
static append(lineTokens, _otherTokens) {
if (_otherTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
if (lineTokens === EMPTY_LINE_TOKENS) {
return _otherTokens;
}
if (lineTokens === null) {
return lineTokens;
}
if (_otherTokens === null) {
return null;
}
const myTokens = toUint32Array(lineTokens);
const otherTokens = toUint32Array(_otherTokens);
const otherTokensCount = otherTokens.length >>> 1;
const result = new Uint32Array(myTokens.length + otherTokens.length);
result.set(myTokens, 0);
let dest = myTokens.length;
const delta = myTokens[myTokens.length - 2];
for (let i = 0; i < otherTokensCount; i++) {
result[dest++] = otherTokens[i << 1] + delta;
result[dest++] = otherTokens[(i << 1) + 1];
}
return result.buffer;
}
static insert(lineTokens, chIndex, textLength) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
const tokens = toUint32Array(lineTokens);
const tokensCount = tokens.length >>> 1;
let fromTokenIndex = LineTokens.findIndexInTokensArray(tokens, chIndex);
if (fromTokenIndex > 0) {
const fromTokenStartOffset = tokens[fromTokenIndex - 1 << 1];
if (fromTokenStartOffset === chIndex) {
fromTokenIndex--;
}
}
for (let tokenIndex = fromTokenIndex; tokenIndex < tokensCount; tokenIndex++) {
tokens[tokenIndex << 1] += textLength;
}
return lineTokens;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensStore.js
function getDefaultMetadata(topLevelLanguageId) {
return (topLevelLanguageId << 0 | 0 << 8 | 0 << 11 | 1 << 15 | 2 << 24 | 1024) >>> 0;
}
var ContiguousTokensStore;
var init_contiguousTokensStore = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/contiguousTokensStore.js"() {
init_arrays();
init_position();
init_contiguousTokensEditing();
init_lineTokens();
init_encodedTokenAttributes();
ContiguousTokensStore = class _ContiguousTokensStore {
constructor(languageIdCodec) {
this._lineTokens = [];
this._len = 0;
this._languageIdCodec = languageIdCodec;
}
flush() {
this._lineTokens = [];
this._len = 0;
}
get hasTokens() {
return this._lineTokens.length > 0;
}
getTokens(topLevelLanguageId, lineIndex, lineText) {
let rawLineTokens = null;
if (lineIndex < this._len) {
rawLineTokens = this._lineTokens[lineIndex];
}
if (rawLineTokens !== null && rawLineTokens !== EMPTY_LINE_TOKENS) {
return new LineTokens(toUint32Array(rawLineTokens), lineText, this._languageIdCodec);
}
const lineTokens = new Uint32Array(2);
lineTokens[0] = lineText.length;
lineTokens[1] = getDefaultMetadata(this._languageIdCodec.encodeLanguageId(topLevelLanguageId));
return new LineTokens(lineTokens, lineText, this._languageIdCodec);
}
static _massageTokens(topLevelLanguageId, lineTextLength, _tokens) {
const tokens = _tokens ? toUint32Array(_tokens) : null;
if (lineTextLength === 0) {
let hasDifferentLanguageId = false;
if (tokens && tokens.length > 1) {
hasDifferentLanguageId = TokenMetadata.getLanguageId(tokens[1]) !== topLevelLanguageId;
}
if (!hasDifferentLanguageId) {
return EMPTY_LINE_TOKENS;
}
}
if (!tokens || tokens.length === 0) {
const tokens2 = new Uint32Array(2);
tokens2[0] = lineTextLength;
tokens2[1] = getDefaultMetadata(topLevelLanguageId);
return tokens2.buffer;
}
tokens[tokens.length - 2] = lineTextLength;
if (tokens.byteOffset === 0 && tokens.byteLength === tokens.buffer.byteLength) {
return tokens.buffer;
}
return tokens;
}
_ensureLine(lineIndex) {
while (lineIndex >= this._len) {
this._lineTokens[this._len] = null;
this._len++;
}
}
_deleteLines(start, deleteCount) {
if (deleteCount === 0) {
return;
}
if (start + deleteCount > this._len) {
deleteCount = this._len - start;
}
this._lineTokens.splice(start, deleteCount);
this._len -= deleteCount;
}
_insertLines(insertIndex, insertCount) {
if (insertCount === 0) {
return;
}
const lineTokens = [];
for (let i = 0; i < insertCount; i++) {
lineTokens[i] = null;
}
this._lineTokens = arrayInsert(this._lineTokens, insertIndex, lineTokens);
this._len += insertCount;
}
setTokens(topLevelLanguageId, lineIndex, lineTextLength, _tokens, checkEquality) {
const tokens = _ContiguousTokensStore._massageTokens(this._languageIdCodec.encodeLanguageId(topLevelLanguageId), lineTextLength, _tokens);
this._ensureLine(lineIndex);
const oldTokens = this._lineTokens[lineIndex];
this._lineTokens[lineIndex] = tokens;
if (checkEquality) {
return !_ContiguousTokensStore._equals(oldTokens, tokens);
}
return false;
}
static _equals(_a10, _b4) {
if (!_a10 || !_b4) {
return !_a10 && !_b4;
}
const a3 = toUint32Array(_a10);
const b = toUint32Array(_b4);
if (a3.length !== b.length) {
return false;
}
for (let i = 0, len = a3.length; i < len; i++) {
if (a3[i] !== b[i]) {
return false;
}
}
return true;
}
//#region Editing
acceptEdit(range2, eolCount, firstLineLength) {
this._acceptDeleteRange(range2);
this._acceptInsertText(new Position(range2.startLineNumber, range2.startColumn), eolCount, firstLineLength);
}
_acceptDeleteRange(range2) {
const firstLineIndex = range2.startLineNumber - 1;
if (firstLineIndex >= this._len) {
return;
}
if (range2.startLineNumber === range2.endLineNumber) {
if (range2.startColumn === range2.endColumn) {
return;
}
this._lineTokens[firstLineIndex] = ContiguousTokensEditing.delete(this._lineTokens[firstLineIndex], range2.startColumn - 1, range2.endColumn - 1);
return;
}
this._lineTokens[firstLineIndex] = ContiguousTokensEditing.deleteEnding(this._lineTokens[firstLineIndex], range2.startColumn - 1);
const lastLineIndex = range2.endLineNumber - 1;
let lastLineTokens = null;
if (lastLineIndex < this._len) {
lastLineTokens = ContiguousTokensEditing.deleteBeginning(this._lineTokens[lastLineIndex], range2.endColumn - 1);
}
this._lineTokens[firstLineIndex] = ContiguousTokensEditing.append(this._lineTokens[firstLineIndex], lastLineTokens);
this._deleteLines(range2.startLineNumber, range2.endLineNumber - range2.startLineNumber);
}
_acceptInsertText(position, eolCount, firstLineLength) {
if (eolCount === 0 && firstLineLength === 0) {
return;
}
const lineIndex = position.lineNumber - 1;
if (lineIndex >= this._len) {
return;
}
if (eolCount === 0) {
this._lineTokens[lineIndex] = ContiguousTokensEditing.insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);
return;
}
this._lineTokens[lineIndex] = ContiguousTokensEditing.deleteEnding(this._lineTokens[lineIndex], position.column - 1);
this._lineTokens[lineIndex] = ContiguousTokensEditing.insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);
this._insertLines(position.lineNumber, eolCount);
}
//#endregion
setMultilineTokens(tokens, textModel) {
if (tokens.length === 0) {
return { changes: [] };
}
const ranges = [];
for (let i = 0, len = tokens.length; i < len; i++) {
const element = tokens[i];
let minChangedLineNumber = 0;
let maxChangedLineNumber = 0;
let hasChange = false;
for (let lineNumber = element.startLineNumber; lineNumber <= element.endLineNumber; lineNumber++) {
if (hasChange) {
this.setTokens(textModel.getLanguageId(), lineNumber - 1, textModel.getLineLength(lineNumber), element.getLineTokens(lineNumber), false);
maxChangedLineNumber = lineNumber;
} else {
const lineHasChange = this.setTokens(textModel.getLanguageId(), lineNumber - 1, textModel.getLineLength(lineNumber), element.getLineTokens(lineNumber), true);
if (lineHasChange) {
hasChange = true;
minChangedLineNumber = lineNumber;
maxChangedLineNumber = lineNumber;
}
}
}
if (hasChange) {
ranges.push({ fromLineNumber: minChangedLineNumber, toLineNumber: maxChangedLineNumber });
}
}
return { changes: ranges };
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseTokensStore.js
var SparseTokensStore;
var init_sparseTokensStore = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseTokensStore.js"() {
init_arrays();
init_lineTokens();
SparseTokensStore = class _SparseTokensStore {
constructor(languageIdCodec) {
this._pieces = [];
this._isComplete = false;
this._languageIdCodec = languageIdCodec;
}
flush() {
this._pieces = [];
this._isComplete = false;
}
isEmpty() {
return this._pieces.length === 0;
}
set(pieces, isComplete) {
this._pieces = pieces || [];
this._isComplete = isComplete;
}
setPartial(_range, pieces) {
let range2 = _range;
if (pieces.length > 0) {
const _firstRange = pieces[0].getRange();
const _lastRange = pieces[pieces.length - 1].getRange();
if (!_firstRange || !_lastRange) {
return _range;
}
range2 = _range.plusRange(_firstRange).plusRange(_lastRange);
}
let insertPosition = null;
for (let i = 0, len = this._pieces.length; i < len; i++) {
const piece = this._pieces[i];
if (piece.endLineNumber < range2.startLineNumber) {
continue;
}
if (piece.startLineNumber > range2.endLineNumber) {
insertPosition = insertPosition || { index: i };
break;
}
piece.removeTokens(range2);
if (piece.isEmpty()) {
this._pieces.splice(i, 1);
i--;
len--;
continue;
}
if (piece.endLineNumber < range2.startLineNumber) {
continue;
}
if (piece.startLineNumber > range2.endLineNumber) {
insertPosition = insertPosition || { index: i };
continue;
}
const [a3, b] = piece.split(range2);
if (a3.isEmpty()) {
insertPosition = insertPosition || { index: i };
continue;
}
if (b.isEmpty()) {
continue;
}
this._pieces.splice(i, 1, a3, b);
i++;
len++;
insertPosition = insertPosition || { index: i };
}
insertPosition = insertPosition || { index: this._pieces.length };
if (pieces.length > 0) {
this._pieces = arrayInsert(this._pieces, insertPosition.index, pieces);
}
return range2;
}
isComplete() {
return this._isComplete;
}
addSparseTokens(lineNumber, aTokens) {
if (aTokens.getLineContent().length === 0) {
return aTokens;
}
const pieces = this._pieces;
if (pieces.length === 0) {
return aTokens;
}
const pieceIndex = _SparseTokensStore._findFirstPieceWithLine(pieces, lineNumber);
const bTokens = pieces[pieceIndex].getLineTokens(lineNumber);
if (!bTokens) {
return aTokens;
}
const aLen = aTokens.getCount();
const bLen = bTokens.getCount();
let aIndex = 0;
const result = [];
let resultLen = 0;
let lastEndOffset = 0;
const emitToken = (endOffset, metadata) => {
if (endOffset === lastEndOffset) {
return;
}
lastEndOffset = endOffset;
result[resultLen++] = endOffset;
result[resultLen++] = metadata;
};
for (let bIndex = 0; bIndex < bLen; bIndex++) {
const bStartCharacter = bTokens.getStartCharacter(bIndex);
const bEndCharacter = bTokens.getEndCharacter(bIndex);
const bMetadata = bTokens.getMetadata(bIndex);
const bMask = ((bMetadata & 1 ? 2048 : 0) | (bMetadata & 2 ? 4096 : 0) | (bMetadata & 4 ? 8192 : 0) | (bMetadata & 8 ? 16384 : 0) | (bMetadata & 16 ? 16744448 : 0) | (bMetadata & 32 ? 4278190080 : 0)) >>> 0;
const aMask = ~bMask >>> 0;
while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) {
emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));
aIndex++;
}
if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) {
emitToken(bStartCharacter, aTokens.getMetadata(aIndex));
}
while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) {
emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex) & aMask | bMetadata & bMask);
aIndex++;
}
if (aIndex < aLen) {
emitToken(bEndCharacter, aTokens.getMetadata(aIndex) & aMask | bMetadata & bMask);
if (aTokens.getEndOffset(aIndex) === bEndCharacter) {
aIndex++;
}
} else {
const aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1);
emitToken(bEndCharacter, aTokens.getMetadata(aMergeIndex) & aMask | bMetadata & bMask);
}
}
while (aIndex < aLen) {
emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));
aIndex++;
}
return new LineTokens(new Uint32Array(result), aTokens.getLineContent(), this._languageIdCodec);
}
static _findFirstPieceWithLine(pieces, lineNumber) {
let low = 0;
let high = pieces.length - 1;
while (low < high) {
let mid = low + Math.floor((high - low) / 2);
if (pieces[mid].endLineNumber < lineNumber) {
low = mid + 1;
} else if (pieces[mid].startLineNumber > lineNumber) {
high = mid - 1;
} else {
while (mid > low && pieces[mid - 1].startLineNumber <= lineNumber && lineNumber <= pieces[mid - 1].endLineNumber) {
mid--;
}
return mid;
}
}
return low;
}
acceptEdit(range2, eolCount, firstLineLength, lastLineLength, firstCharCode) {
for (const piece of this._pieces) {
piece.acceptEdit(range2, eolCount, firstLineLength, lastLineLength, firstCharCode);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/tokenizationTextModelPart.js
var TokenizationTextModelPart, GrammarTokens, AttachedViewHandler;
var init_tokenizationTextModelPart = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/tokenizationTextModelPart.js"() {
init_arrays();
init_async();
init_errors();
init_event();
init_lifecycle();
init_eolCounter();
init_lineRange();
init_position();
init_wordHelper();
init_languages();
init_textModelPart();
init_textModelTokens();
init_contiguousMultilineTokensBuilder();
init_contiguousTokensStore();
init_sparseTokensStore();
TokenizationTextModelPart = class _TokenizationTextModelPart extends TextModelPart {
constructor(_languageService, _languageConfigurationService, _textModel, _bracketPairsTextModelPart, _languageId, _attachedViews) {
super();
this._languageService = _languageService;
this._languageConfigurationService = _languageConfigurationService;
this._textModel = _textModel;
this._bracketPairsTextModelPart = _bracketPairsTextModelPart;
this._languageId = _languageId;
this._attachedViews = _attachedViews;
this._semanticTokens = new SparseTokensStore(this._languageService.languageIdCodec);
this._onDidChangeLanguage = this._register(new Emitter());
this.onDidChangeLanguage = this._onDidChangeLanguage.event;
this._onDidChangeLanguageConfiguration = this._register(new Emitter());
this.onDidChangeLanguageConfiguration = this._onDidChangeLanguageConfiguration.event;
this._onDidChangeTokens = this._register(new Emitter());
this.onDidChangeTokens = this._onDidChangeTokens.event;
this.grammarTokens = this._register(new GrammarTokens(this._languageService.languageIdCodec, this._textModel, () => this._languageId, this._attachedViews));
this._register(this._languageConfigurationService.onDidChange((e) => {
if (e.affects(this._languageId)) {
this._onDidChangeLanguageConfiguration.fire({});
}
}));
this._register(this.grammarTokens.onDidChangeTokens((e) => {
this._emitModelTokensChangedEvent(e);
}));
this._register(this.grammarTokens.onDidChangeBackgroundTokenizationState((e) => {
this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState();
}));
}
handleDidChangeContent(e) {
if (e.isFlush) {
this._semanticTokens.flush();
} else if (!e.isEolChange) {
for (const c of e.changes) {
const [eolCount, firstLineLength, lastLineLength] = countEOL(c.text);
this._semanticTokens.acceptEdit(
c.range,
eolCount,
firstLineLength,
lastLineLength,
c.text.length > 0 ? c.text.charCodeAt(0) : 0
/* CharCode.Null */
);
}
}
this.grammarTokens.handleDidChangeContent(e);
}
handleDidChangeAttached() {
this.grammarTokens.handleDidChangeAttached();
}
/**
* Includes grammar and semantic tokens.
*/
getLineTokens(lineNumber) {
this.validateLineNumber(lineNumber);
const syntacticTokens = this.grammarTokens.getLineTokens(lineNumber);
return this._semanticTokens.addSparseTokens(lineNumber, syntacticTokens);
}
_emitModelTokensChangedEvent(e) {
if (!this._textModel._isDisposing()) {
this._bracketPairsTextModelPart.handleDidChangeTokens(e);
this._onDidChangeTokens.fire(e);
}
}
// #region Grammar Tokens
validateLineNumber(lineNumber) {
if (lineNumber < 1 || lineNumber > this._textModel.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
}
get hasTokens() {
return this.grammarTokens.hasTokens;
}
resetTokenization() {
this.grammarTokens.resetTokenization();
}
get backgroundTokenizationState() {
return this.grammarTokens.backgroundTokenizationState;
}
forceTokenization(lineNumber) {
this.validateLineNumber(lineNumber);
this.grammarTokens.forceTokenization(lineNumber);
}
hasAccurateTokensForLine(lineNumber) {
this.validateLineNumber(lineNumber);
return this.grammarTokens.hasAccurateTokensForLine(lineNumber);
}
isCheapToTokenize(lineNumber) {
this.validateLineNumber(lineNumber);
return this.grammarTokens.isCheapToTokenize(lineNumber);
}
tokenizeIfCheap(lineNumber) {
this.validateLineNumber(lineNumber);
this.grammarTokens.tokenizeIfCheap(lineNumber);
}
getTokenTypeIfInsertingCharacter(lineNumber, column, character) {
return this.grammarTokens.getTokenTypeIfInsertingCharacter(lineNumber, column, character);
}
tokenizeLineWithEdit(position, length, newText) {
return this.grammarTokens.tokenizeLineWithEdit(position, length, newText);
}
// #endregion
// #region Semantic Tokens
setSemanticTokens(tokens, isComplete) {
this._semanticTokens.set(tokens, isComplete);
this._emitModelTokensChangedEvent({
semanticTokensApplied: tokens !== null,
ranges: [{ fromLineNumber: 1, toLineNumber: this._textModel.getLineCount() }]
});
}
hasCompleteSemanticTokens() {
return this._semanticTokens.isComplete();
}
hasSomeSemanticTokens() {
return !this._semanticTokens.isEmpty();
}
setPartialSemanticTokens(range2, tokens) {
if (this.hasCompleteSemanticTokens()) {
return;
}
const changedRange = this._textModel.validateRange(this._semanticTokens.setPartial(range2, tokens));
this._emitModelTokensChangedEvent({
semanticTokensApplied: true,
ranges: [
{
fromLineNumber: changedRange.startLineNumber,
toLineNumber: changedRange.endLineNumber
}
]
});
}
// #endregion
// #region Utility Methods
getWordAtPosition(_position) {
this.assertNotDisposed();
const position = this._textModel.validatePosition(_position);
const lineContent = this._textModel.getLineContent(position.lineNumber);
const lineTokens = this.getLineTokens(position.lineNumber);
const tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
const [rbStartOffset, rbEndOffset] = _TokenizationTextModelPart._findLanguageBoundaries(lineTokens, tokenIndex);
const rightBiasedWord = getWordAtText(position.column, this.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex)).getWordDefinition(), lineContent.substring(rbStartOffset, rbEndOffset), rbStartOffset);
if (rightBiasedWord && rightBiasedWord.startColumn <= _position.column && _position.column <= rightBiasedWord.endColumn) {
return rightBiasedWord;
}
if (tokenIndex > 0 && rbStartOffset === position.column - 1) {
const [lbStartOffset, lbEndOffset] = _TokenizationTextModelPart._findLanguageBoundaries(lineTokens, tokenIndex - 1);
const leftBiasedWord = getWordAtText(position.column, this.getLanguageConfiguration(lineTokens.getLanguageId(tokenIndex - 1)).getWordDefinition(), lineContent.substring(lbStartOffset, lbEndOffset), lbStartOffset);
if (leftBiasedWord && leftBiasedWord.startColumn <= _position.column && _position.column <= leftBiasedWord.endColumn) {
return leftBiasedWord;
}
}
return null;
}
getLanguageConfiguration(languageId) {
return this._languageConfigurationService.getLanguageConfiguration(languageId);
}
static _findLanguageBoundaries(lineTokens, tokenIndex) {
const languageId = lineTokens.getLanguageId(tokenIndex);
let startOffset = 0;
for (let i = tokenIndex; i >= 0 && lineTokens.getLanguageId(i) === languageId; i--) {
startOffset = lineTokens.getStartOffset(i);
}
let endOffset = lineTokens.getLineContent().length;
for (let i = tokenIndex, tokenCount = lineTokens.getCount(); i < tokenCount && lineTokens.getLanguageId(i) === languageId; i++) {
endOffset = lineTokens.getEndOffset(i);
}
return [startOffset, endOffset];
}
getWordUntilPosition(position) {
const wordAtPosition = this.getWordAtPosition(position);
if (!wordAtPosition) {
return { word: "", startColumn: position.column, endColumn: position.column };
}
return {
word: wordAtPosition.word.substr(0, position.column - wordAtPosition.startColumn),
startColumn: wordAtPosition.startColumn,
endColumn: position.column
};
}
// #endregion
// #region Language Id handling
getLanguageId() {
return this._languageId;
}
getLanguageIdAtPosition(lineNumber, column) {
const position = this._textModel.validatePosition(new Position(lineNumber, column));
const lineTokens = this.getLineTokens(position.lineNumber);
return lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));
}
setLanguageId(languageId, source = "api") {
if (this._languageId === languageId) {
return;
}
const e = {
oldLanguage: this._languageId,
newLanguage: languageId,
source
};
this._languageId = languageId;
this._bracketPairsTextModelPart.handleDidChangeLanguage(e);
this.grammarTokens.resetTokenization();
this._onDidChangeLanguage.fire(e);
this._onDidChangeLanguageConfiguration.fire({});
}
};
GrammarTokens = class extends Disposable {
get backgroundTokenizationState() {
return this._backgroundTokenizationState;
}
constructor(_languageIdCodec, _textModel, getLanguageId, attachedViews) {
super();
this._languageIdCodec = _languageIdCodec;
this._textModel = _textModel;
this.getLanguageId = getLanguageId;
this._tokenizer = null;
this._defaultBackgroundTokenizer = null;
this._backgroundTokenizer = this._register(new MutableDisposable());
this._tokens = new ContiguousTokensStore(this._languageIdCodec);
this._debugBackgroundTokenizer = this._register(new MutableDisposable());
this._backgroundTokenizationState = 1;
this._onDidChangeBackgroundTokenizationState = this._register(new Emitter());
this.onDidChangeBackgroundTokenizationState = this._onDidChangeBackgroundTokenizationState.event;
this._onDidChangeTokens = this._register(new Emitter());
this.onDidChangeTokens = this._onDidChangeTokens.event;
this._attachedViewStates = this._register(new DisposableMap());
this._register(TokenizationRegistry2.onDidChange((e) => {
const languageId = this.getLanguageId();
if (e.changedLanguages.indexOf(languageId) === -1) {
return;
}
this.resetTokenization();
}));
this.resetTokenization();
this._register(attachedViews.onDidChangeVisibleRanges(({ view, state }) => {
if (state) {
let existing = this._attachedViewStates.get(view);
if (!existing) {
existing = new AttachedViewHandler(() => this.refreshRanges(existing.lineRanges));
this._attachedViewStates.set(view, existing);
}
existing.handleStateChange(state);
} else {
this._attachedViewStates.deleteAndDispose(view);
}
}));
}
resetTokenization(fireTokenChangeEvent = true) {
var _a10;
this._tokens.flush();
(_a10 = this._debugBackgroundTokens) === null || _a10 === void 0 ? void 0 : _a10.flush();
if (this._debugBackgroundStates) {
this._debugBackgroundStates = new TrackingTokenizationStateStore(this._textModel.getLineCount());
}
if (fireTokenChangeEvent) {
this._onDidChangeTokens.fire({
semanticTokensApplied: false,
ranges: [
{
fromLineNumber: 1,
toLineNumber: this._textModel.getLineCount()
}
]
});
}
const initializeTokenization = () => {
if (this._textModel.isTooLargeForTokenization()) {
return [null, null];
}
const tokenizationSupport2 = TokenizationRegistry2.get(this.getLanguageId());
if (!tokenizationSupport2) {
return [null, null];
}
let initialState2;
try {
initialState2 = tokenizationSupport2.getInitialState();
} catch (e) {
onUnexpectedError(e);
return [null, null];
}
return [tokenizationSupport2, initialState2];
};
const [tokenizationSupport, initialState] = initializeTokenization();
if (tokenizationSupport && initialState) {
this._tokenizer = new TokenizerWithStateStoreAndTextModel(this._textModel.getLineCount(), tokenizationSupport, this._textModel, this._languageIdCodec);
} else {
this._tokenizer = null;
}
this._backgroundTokenizer.clear();
this._defaultBackgroundTokenizer = null;
if (this._tokenizer) {
const b = {
setTokens: (tokens) => {
this.setTokens(tokens);
},
backgroundTokenizationFinished: () => {
if (this._backgroundTokenizationState === 2) {
return;
}
const newState = 2;
this._backgroundTokenizationState = newState;
this._onDidChangeBackgroundTokenizationState.fire();
},
setEndState: (lineNumber, state) => {
var _a11;
if (!this._tokenizer) {
return;
}
const firstInvalidEndStateLineNumber = this._tokenizer.store.getFirstInvalidEndStateLineNumber();
if (firstInvalidEndStateLineNumber !== null && lineNumber >= firstInvalidEndStateLineNumber) {
(_a11 = this._tokenizer) === null || _a11 === void 0 ? void 0 : _a11.store.setEndState(lineNumber, state);
}
}
};
if (tokenizationSupport && tokenizationSupport.createBackgroundTokenizer && !tokenizationSupport.backgroundTokenizerShouldOnlyVerifyTokens) {
this._backgroundTokenizer.value = tokenizationSupport.createBackgroundTokenizer(this._textModel, b);
}
if (!this._backgroundTokenizer.value && !this._textModel.isTooLargeForTokenization()) {
this._backgroundTokenizer.value = this._defaultBackgroundTokenizer = new DefaultBackgroundTokenizer(this._tokenizer, b);
this._defaultBackgroundTokenizer.handleChanges();
}
if ((tokenizationSupport === null || tokenizationSupport === void 0 ? void 0 : tokenizationSupport.backgroundTokenizerShouldOnlyVerifyTokens) && tokenizationSupport.createBackgroundTokenizer) {
this._debugBackgroundTokens = new ContiguousTokensStore(this._languageIdCodec);
this._debugBackgroundStates = new TrackingTokenizationStateStore(this._textModel.getLineCount());
this._debugBackgroundTokenizer.clear();
this._debugBackgroundTokenizer.value = tokenizationSupport.createBackgroundTokenizer(this._textModel, {
setTokens: (tokens) => {
var _a11;
(_a11 = this._debugBackgroundTokens) === null || _a11 === void 0 ? void 0 : _a11.setMultilineTokens(tokens, this._textModel);
},
backgroundTokenizationFinished() {
},
setEndState: (lineNumber, state) => {
var _a11;
(_a11 = this._debugBackgroundStates) === null || _a11 === void 0 ? void 0 : _a11.setEndState(lineNumber, state);
}
});
} else {
this._debugBackgroundTokens = void 0;
this._debugBackgroundStates = void 0;
this._debugBackgroundTokenizer.value = void 0;
}
}
this.refreshAllVisibleLineTokens();
}
handleDidChangeAttached() {
var _a10;
(_a10 = this._defaultBackgroundTokenizer) === null || _a10 === void 0 ? void 0 : _a10.handleChanges();
}
handleDidChangeContent(e) {
var _a10, _b4, _c2;
if (e.isFlush) {
this.resetTokenization(false);
} else if (!e.isEolChange) {
for (const c of e.changes) {
const [eolCount, firstLineLength] = countEOL(c.text);
this._tokens.acceptEdit(c.range, eolCount, firstLineLength);
(_a10 = this._debugBackgroundTokens) === null || _a10 === void 0 ? void 0 : _a10.acceptEdit(c.range, eolCount, firstLineLength);
}
(_b4 = this._debugBackgroundStates) === null || _b4 === void 0 ? void 0 : _b4.acceptChanges(e.changes);
if (this._tokenizer) {
this._tokenizer.store.acceptChanges(e.changes);
}
(_c2 = this._defaultBackgroundTokenizer) === null || _c2 === void 0 ? void 0 : _c2.handleChanges();
}
}
setTokens(tokens) {
const { changes } = this._tokens.setMultilineTokens(tokens, this._textModel);
if (changes.length > 0) {
this._onDidChangeTokens.fire({ semanticTokensApplied: false, ranges: changes });
}
return { changes };
}
refreshAllVisibleLineTokens() {
const ranges = LineRange.joinMany([...this._attachedViewStates].map(([_, s]) => s.lineRanges));
this.refreshRanges(ranges);
}
refreshRanges(ranges) {
for (const range2 of ranges) {
this.refreshRange(range2.startLineNumber, range2.endLineNumberExclusive - 1);
}
}
refreshRange(startLineNumber, endLineNumber) {
var _a10, _b4;
if (!this._tokenizer) {
return;
}
startLineNumber = Math.max(1, Math.min(this._textModel.getLineCount(), startLineNumber));
endLineNumber = Math.min(this._textModel.getLineCount(), endLineNumber);
const builder = new ContiguousMultilineTokensBuilder();
const { heuristicTokens } = this._tokenizer.tokenizeHeuristically(builder, startLineNumber, endLineNumber);
const changedTokens = this.setTokens(builder.finalize());
if (heuristicTokens) {
for (const c of changedTokens.changes) {
(_a10 = this._backgroundTokenizer.value) === null || _a10 === void 0 ? void 0 : _a10.requestTokens(c.fromLineNumber, c.toLineNumber + 1);
}
}
(_b4 = this._defaultBackgroundTokenizer) === null || _b4 === void 0 ? void 0 : _b4.checkFinished();
}
forceTokenization(lineNumber) {
var _a10, _b4;
const builder = new ContiguousMultilineTokensBuilder();
(_a10 = this._tokenizer) === null || _a10 === void 0 ? void 0 : _a10.updateTokensUntilLine(builder, lineNumber);
this.setTokens(builder.finalize());
(_b4 = this._defaultBackgroundTokenizer) === null || _b4 === void 0 ? void 0 : _b4.checkFinished();
}
hasAccurateTokensForLine(lineNumber) {
if (!this._tokenizer) {
return true;
}
return this._tokenizer.hasAccurateTokensForLine(lineNumber);
}
isCheapToTokenize(lineNumber) {
if (!this._tokenizer) {
return true;
}
return this._tokenizer.isCheapToTokenize(lineNumber);
}
tokenizeIfCheap(lineNumber) {
if (this.isCheapToTokenize(lineNumber)) {
this.forceTokenization(lineNumber);
}
}
getLineTokens(lineNumber) {
var _a10;
const lineText = this._textModel.getLineContent(lineNumber);
const result = this._tokens.getTokens(this._textModel.getLanguageId(), lineNumber - 1, lineText);
if (this._debugBackgroundTokens && this._debugBackgroundStates && this._tokenizer) {
if (this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax() > lineNumber && this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax() > lineNumber) {
const backgroundResult = this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(), lineNumber - 1, lineText);
if (!result.equals(backgroundResult) && ((_a10 = this._debugBackgroundTokenizer.value) === null || _a10 === void 0 ? void 0 : _a10.reportMismatchingTokens)) {
this._debugBackgroundTokenizer.value.reportMismatchingTokens(lineNumber);
}
}
}
return result;
}
getTokenTypeIfInsertingCharacter(lineNumber, column, character) {
if (!this._tokenizer) {
return 0;
}
const position = this._textModel.validatePosition(new Position(lineNumber, column));
this.forceTokenization(position.lineNumber);
return this._tokenizer.getTokenTypeIfInsertingCharacter(position, character);
}
tokenizeLineWithEdit(position, length, newText) {
if (!this._tokenizer) {
return null;
}
const validatedPosition = this._textModel.validatePosition(position);
this.forceTokenization(validatedPosition.lineNumber);
return this._tokenizer.tokenizeLineWithEdit(validatedPosition, length, newText);
}
get hasTokens() {
return this._tokens.hasTokens;
}
};
AttachedViewHandler = class extends Disposable {
get lineRanges() {
return this._lineRanges;
}
constructor(_refreshTokens) {
super();
this._refreshTokens = _refreshTokens;
this.runner = this._register(new RunOnceScheduler(() => this.update(), 50));
this._computedLineRanges = [];
this._lineRanges = [];
}
update() {
if (equals(this._computedLineRanges, this._lineRanges, (a3, b) => a3.equals(b))) {
return;
}
this._computedLineRanges = this._lineRanges;
this._refreshTokens();
}
handleStateChange(state) {
this._lineRanges = state.visibleLineRanges;
if (state.stabilized) {
this.runner.cancel();
this.update();
} else {
this.runner.schedule();
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedo.js
var IUndoRedoService, ResourceEditStackSnapshot, UndoRedoGroup, UndoRedoSource;
var init_undoRedo = __esm({
"node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedo.js"() {
init_instantiation();
IUndoRedoService = createDecorator("undoRedoService");
ResourceEditStackSnapshot = class {
constructor(resource, elements) {
this.resource = resource;
this.elements = elements;
}
};
UndoRedoGroup = class _UndoRedoGroup {
constructor() {
this.id = _UndoRedoGroup._ID++;
this.order = 1;
}
nextOrder() {
if (this.id === 0) {
return 0;
}
return this.order++;
}
};
UndoRedoGroup._ID = 0;
UndoRedoGroup.None = new UndoRedoGroup();
UndoRedoSource = class _UndoRedoSource {
constructor() {
this.id = _UndoRedoSource._ID++;
this.order = 1;
}
nextOrder() {
if (this.id === 0) {
return 0;
}
return this.order++;
}
};
UndoRedoSource._ID = 0;
UndoRedoSource.None = new UndoRedoSource();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js
function createTextBufferFactory(text2) {
const builder = new PieceTreeTextBufferBuilder();
builder.acceptChunk(text2);
return builder.finish();
}
function createTextBufferFactoryFromSnapshot(snapshot) {
const builder = new PieceTreeTextBufferBuilder();
let chunk;
while (typeof (chunk = snapshot.read()) === "string") {
builder.acceptChunk(chunk);
}
return builder.finish();
}
function createTextBuffer(value, defaultEOL) {
let factory;
if (typeof value === "string") {
factory = createTextBufferFactory(value);
} else if (isITextSnapshot(value)) {
factory = createTextBufferFactoryFromSnapshot(value);
} else {
factory = value;
}
return factory.create(defaultEOL);
}
function indentOfLine(line) {
let indent = 0;
for (const c of line) {
if (c === " " || c === " ") {
indent++;
} else {
break;
}
}
return indent;
}
function isNodeInOverviewRuler(node) {
return node.options.overviewRuler && node.options.overviewRuler.color ? true : false;
}
function isOptionsInjectedText(options2) {
return !!options2.after || !!options2.before;
}
function isNodeInjectedText(node) {
return !!node.options.after || !!node.options.before;
}
function cleanClassName(className) {
return className.replace(/[^a-z0-9\-_]/gi, " ");
}
function _normalizeOptions(options2) {
if (options2 instanceof ModelDecorationOptions) {
return options2;
}
return ModelDecorationOptions.createDynamic(options2);
}
var __decorate12, __param11, TextModel_1, MODEL_ID, LIMIT_FIND_COUNT2, LONG_LINE_BOUNDARY, TextModelSnapshot, invalidFunc2, TextModel, DecorationsTrees, DecorationOptions, ModelDecorationOverviewRulerOptions, ModelDecorationGlyphMarginOptions, ModelDecorationMinimapOptions, ModelDecorationInjectedTextOptions, ModelDecorationOptions, TRACKED_RANGE_OPTIONS, DidChangeDecorationsEmitter, DidChangeContentEmitter, AttachedViews, AttachedViewImpl;
var init_textModel = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js"() {
init_arrays();
init_color();
init_errors();
init_event();
init_lifecycle();
init_strings();
init_uri();
init_eolCounter();
init_indentation();
init_lineRange();
init_position();
init_range();
init_selection();
init_textModelDefaults();
init_language();
init_languageConfigurationRegistry();
init_model2();
init_bracketPairsImpl();
init_colorizedBracketPairsDecorationProvider();
init_editStack();
init_guidesTextModelPart();
init_indentationGuesser();
init_intervalTree();
init_pieceTreeTextBuffer();
init_pieceTreeTextBufferBuilder();
init_textModelSearch();
init_tokenizationTextModelPart();
init_textModelEvents();
init_undoRedo();
__decorate12 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param11 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MODEL_ID = 0;
LIMIT_FIND_COUNT2 = 999;
LONG_LINE_BOUNDARY = 1e4;
TextModelSnapshot = class {
constructor(source) {
this._source = source;
this._eos = false;
}
read() {
if (this._eos) {
return null;
}
const result = [];
let resultCnt = 0;
let resultLength = 0;
do {
const tmp = this._source.read();
if (tmp === null) {
this._eos = true;
if (resultCnt === 0) {
return null;
} else {
return result.join("");
}
}
if (tmp.length > 0) {
result[resultCnt++] = tmp;
resultLength += tmp.length;
}
if (resultLength >= 64 * 1024) {
return result.join("");
}
} while (true);
}
};
invalidFunc2 = () => {
throw new Error(`Invalid change accessor`);
};
TextModel = TextModel_1 = class TextModel2 extends Disposable {
static resolveOptions(textBuffer, options2) {
if (options2.detectIndentation) {
const guessedIndentation = guessIndentation(textBuffer, options2.tabSize, options2.insertSpaces);
return new TextModelResolvedOptions({
tabSize: guessedIndentation.tabSize,
indentSize: "tabSize",
// TODO@Alex: guess indentSize independent of tabSize
insertSpaces: guessedIndentation.insertSpaces,
trimAutoWhitespace: options2.trimAutoWhitespace,
defaultEOL: options2.defaultEOL,
bracketPairColorizationOptions: options2.bracketPairColorizationOptions
});
}
return new TextModelResolvedOptions(options2);
}
get onDidChangeLanguage() {
return this._tokenizationTextModelPart.onDidChangeLanguage;
}
get onDidChangeLanguageConfiguration() {
return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration;
}
get onDidChangeTokens() {
return this._tokenizationTextModelPart.onDidChangeTokens;
}
onDidChangeContent(listener) {
return this._eventEmitter.slowEvent((e) => listener(e.contentChangedEvent));
}
onDidChangeContentOrInjectedText(listener) {
return combinedDisposable(this._eventEmitter.fastEvent((e) => listener(e)), this._onDidChangeInjectedText.event((e) => listener(e)));
}
_isDisposing() {
return this.__isDisposing;
}
get tokenization() {
return this._tokenizationTextModelPart;
}
get bracketPairs() {
return this._bracketPairs;
}
get guides() {
return this._guidesTextModelPart;
}
constructor(source, languageIdOrSelection, creationOptions, associatedResource = null, _undoRedoService, _languageService, _languageConfigurationService) {
super();
this._undoRedoService = _undoRedoService;
this._languageService = _languageService;
this._languageConfigurationService = _languageConfigurationService;
this._onWillDispose = this._register(new Emitter());
this.onWillDispose = this._onWillDispose.event;
this._onDidChangeDecorations = this._register(new DidChangeDecorationsEmitter((affectedInjectedTextLines) => this.handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines)));
this.onDidChangeDecorations = this._onDidChangeDecorations.event;
this._onDidChangeOptions = this._register(new Emitter());
this.onDidChangeOptions = this._onDidChangeOptions.event;
this._onDidChangeAttached = this._register(new Emitter());
this.onDidChangeAttached = this._onDidChangeAttached.event;
this._onDidChangeInjectedText = this._register(new Emitter());
this._eventEmitter = this._register(new DidChangeContentEmitter());
this._languageSelectionListener = this._register(new MutableDisposable());
this._deltaDecorationCallCnt = 0;
this._attachedViews = new AttachedViews();
MODEL_ID++;
this.id = "$model" + MODEL_ID;
this.isForSimpleWidget = creationOptions.isForSimpleWidget;
if (typeof associatedResource === "undefined" || associatedResource === null) {
this._associatedResource = URI.parse("inmemory://model/" + MODEL_ID);
} else {
this._associatedResource = associatedResource;
}
this._attachedEditorCount = 0;
const { textBuffer, disposable } = createTextBuffer(source, creationOptions.defaultEOL);
this._buffer = textBuffer;
this._bufferDisposable = disposable;
this._options = TextModel_1.resolveOptions(this._buffer, creationOptions);
const languageId = typeof languageIdOrSelection === "string" ? languageIdOrSelection : languageIdOrSelection.languageId;
if (typeof languageIdOrSelection !== "string") {
this._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId));
}
this._bracketPairs = this._register(new BracketPairsTextModelPart(this, this._languageConfigurationService));
this._guidesTextModelPart = this._register(new GuidesTextModelPart(this, this._languageConfigurationService));
this._decorationProvider = this._register(new ColorizedBracketPairsDecorationProvider(this));
this._tokenizationTextModelPart = new TokenizationTextModelPart(this._languageService, this._languageConfigurationService, this, this._bracketPairs, languageId, this._attachedViews);
const bufferLineCount = this._buffer.getLineCount();
const bufferTextLength = this._buffer.getValueLengthInRange(
new Range(1, 1, bufferLineCount, this._buffer.getLineLength(bufferLineCount) + 1),
0
/* model.EndOfLinePreference.TextDefined */
);
if (creationOptions.largeFileOptimizations) {
this._isTooLargeForTokenization = bufferTextLength > TextModel_1.LARGE_FILE_SIZE_THRESHOLD || bufferLineCount > TextModel_1.LARGE_FILE_LINE_COUNT_THRESHOLD;
this._isTooLargeForHeapOperation = bufferTextLength > TextModel_1.LARGE_FILE_HEAP_OPERATION_THRESHOLD;
} else {
this._isTooLargeForTokenization = false;
this._isTooLargeForHeapOperation = false;
}
this._isTooLargeForSyncing = bufferTextLength > TextModel_1._MODEL_SYNC_LIMIT;
this._versionId = 1;
this._alternativeVersionId = 1;
this._initialUndoRedoSnapshot = null;
this._isDisposed = false;
this.__isDisposing = false;
this._instanceId = singleLetterHash(MODEL_ID);
this._lastDecorationId = 0;
this._decorations = /* @__PURE__ */ Object.create(null);
this._decorationsTree = new DecorationsTrees();
this._commandManager = new EditStack(this, this._undoRedoService);
this._isUndoing = false;
this._isRedoing = false;
this._trimAutoWhitespaceLines = null;
this._register(this._decorationProvider.onDidChange(() => {
this._onDidChangeDecorations.beginDeferredEmit();
this._onDidChangeDecorations.fire();
this._onDidChangeDecorations.endDeferredEmit();
}));
this._languageService.requestRichLanguageFeatures(languageId);
}
dispose() {
this.__isDisposing = true;
this._onWillDispose.fire();
this._tokenizationTextModelPart.dispose();
this._isDisposed = true;
super.dispose();
this._bufferDisposable.dispose();
this.__isDisposing = false;
const emptyDisposedTextBuffer = new PieceTreeTextBuffer([], "", "\n", false, false, true, true);
emptyDisposedTextBuffer.dispose();
this._buffer = emptyDisposedTextBuffer;
this._bufferDisposable = Disposable.None;
}
_assertNotDisposed() {
if (this._isDisposed) {
throw new Error("Model is disposed!");
}
}
_emitContentChangedEvent(rawChange, change) {
if (this.__isDisposing) {
return;
}
this._tokenizationTextModelPart.handleDidChangeContent(change);
this._bracketPairs.handleDidChangeContent(change);
this._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));
}
setValue(value) {
this._assertNotDisposed();
if (value === null || value === void 0) {
throw illegalArgument();
}
const { textBuffer, disposable } = createTextBuffer(value, this._options.defaultEOL);
this._setValueFromTextBuffer(textBuffer, disposable);
}
_createContentChanged2(range2, rangeOffset, rangeLength, text2, isUndoing, isRedoing, isFlush, isEolChange) {
return {
changes: [{
range: range2,
rangeOffset,
rangeLength,
text: text2
}],
eol: this._buffer.getEOL(),
isEolChange,
versionId: this.getVersionId(),
isUndoing,
isRedoing,
isFlush
};
}
_setValueFromTextBuffer(textBuffer, textBufferDisposable) {
this._assertNotDisposed();
const oldFullModelRange = this.getFullModelRange();
const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);
const endLineNumber = this.getLineCount();
const endColumn = this.getLineMaxColumn(endLineNumber);
this._buffer = textBuffer;
this._bufferDisposable.dispose();
this._bufferDisposable = textBufferDisposable;
this._increaseVersionId();
this._decorations = /* @__PURE__ */ Object.create(null);
this._decorationsTree = new DecorationsTrees();
this._commandManager.clear();
this._trimAutoWhitespaceLines = null;
this._emitContentChangedEvent(new ModelRawContentChangedEvent([
new ModelRawFlush()
], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, true, false));
}
setEOL(eol) {
this._assertNotDisposed();
const newEOL = eol === 1 ? "\r\n" : "\n";
if (this._buffer.getEOL() === newEOL) {
return;
}
const oldFullModelRange = this.getFullModelRange();
const oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);
const endLineNumber = this.getLineCount();
const endColumn = this.getLineMaxColumn(endLineNumber);
this._onBeforeEOLChange();
this._buffer.setEOL(newEOL);
this._increaseVersionId();
this._onAfterEOLChange();
this._emitContentChangedEvent(new ModelRawContentChangedEvent([
new ModelRawEOLChanged()
], this._versionId, false, false), this._createContentChanged2(new Range(1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, false, true));
}
_onBeforeEOLChange() {
this._decorationsTree.ensureAllNodesHaveRanges(this);
}
_onAfterEOLChange() {
const versionId = this.getVersionId();
const allDecorations = this._decorationsTree.collectNodesPostOrder();
for (let i = 0, len = allDecorations.length; i < len; i++) {
const node = allDecorations[i];
const range2 = node.range;
const delta = node.cachedAbsoluteStart - node.start;
const startOffset = this._buffer.getOffsetAt(range2.startLineNumber, range2.startColumn);
const endOffset = this._buffer.getOffsetAt(range2.endLineNumber, range2.endColumn);
node.cachedAbsoluteStart = startOffset;
node.cachedAbsoluteEnd = endOffset;
node.cachedVersionId = versionId;
node.start = startOffset - delta;
node.end = endOffset - delta;
recomputeMaxEnd(node);
}
}
onBeforeAttached() {
this._attachedEditorCount++;
if (this._attachedEditorCount === 1) {
this._tokenizationTextModelPart.handleDidChangeAttached();
this._onDidChangeAttached.fire(void 0);
}
return this._attachedViews.attachView();
}
onBeforeDetached(view) {
this._attachedEditorCount--;
if (this._attachedEditorCount === 0) {
this._tokenizationTextModelPart.handleDidChangeAttached();
this._onDidChangeAttached.fire(void 0);
}
this._attachedViews.detachView(view);
}
isAttachedToEditor() {
return this._attachedEditorCount > 0;
}
getAttachedEditorCount() {
return this._attachedEditorCount;
}
isTooLargeForSyncing() {
return this._isTooLargeForSyncing;
}
isTooLargeForTokenization() {
return this._isTooLargeForTokenization;
}
isTooLargeForHeapOperation() {
return this._isTooLargeForHeapOperation;
}
isDisposed() {
return this._isDisposed;
}
isDominatedByLongLines() {
this._assertNotDisposed();
if (this.isTooLargeForTokenization()) {
return false;
}
let smallLineCharCount = 0;
let longLineCharCount = 0;
const lineCount = this._buffer.getLineCount();
for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {
const lineLength = this._buffer.getLineLength(lineNumber);
if (lineLength >= LONG_LINE_BOUNDARY) {
longLineCharCount += lineLength;
} else {
smallLineCharCount += lineLength;
}
}
return longLineCharCount > smallLineCharCount;
}
get uri() {
return this._associatedResource;
}
//#region Options
getOptions() {
this._assertNotDisposed();
return this._options;
}
getFormattingOptions() {
return {
tabSize: this._options.indentSize,
insertSpaces: this._options.insertSpaces
};
}
updateOptions(_newOpts) {
this._assertNotDisposed();
const tabSize = typeof _newOpts.tabSize !== "undefined" ? _newOpts.tabSize : this._options.tabSize;
const indentSize = typeof _newOpts.indentSize !== "undefined" ? _newOpts.indentSize : this._options.originalIndentSize;
const insertSpaces = typeof _newOpts.insertSpaces !== "undefined" ? _newOpts.insertSpaces : this._options.insertSpaces;
const trimAutoWhitespace = typeof _newOpts.trimAutoWhitespace !== "undefined" ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;
const bracketPairColorizationOptions = typeof _newOpts.bracketColorizationOptions !== "undefined" ? _newOpts.bracketColorizationOptions : this._options.bracketPairColorizationOptions;
const newOpts = new TextModelResolvedOptions({
tabSize,
indentSize,
insertSpaces,
defaultEOL: this._options.defaultEOL,
trimAutoWhitespace,
bracketPairColorizationOptions
});
if (this._options.equals(newOpts)) {
return;
}
const e = this._options.createChangeEvent(newOpts);
this._options = newOpts;
this._bracketPairs.handleDidChangeOptions(e);
this._decorationProvider.handleDidChangeOptions(e);
this._onDidChangeOptions.fire(e);
}
detectIndentation(defaultInsertSpaces, defaultTabSize) {
this._assertNotDisposed();
const guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);
this.updateOptions({
insertSpaces: guessedIndentation.insertSpaces,
tabSize: guessedIndentation.tabSize,
indentSize: guessedIndentation.tabSize
// TODO@Alex: guess indentSize independent of tabSize
});
}
normalizeIndentation(str) {
this._assertNotDisposed();
return normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);
}
//#endregion
//#region Reading
getVersionId() {
this._assertNotDisposed();
return this._versionId;
}
mightContainRTL() {
return this._buffer.mightContainRTL();
}
mightContainUnusualLineTerminators() {
return this._buffer.mightContainUnusualLineTerminators();
}
removeUnusualLineTerminators(selections = null) {
const matches2 = this.findMatches(
UNUSUAL_LINE_TERMINATORS.source,
false,
true,
false,
null,
false,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
);
this._buffer.resetMightContainUnusualLineTerminators();
this.pushEditOperations(selections, matches2.map((m) => ({ range: m.range, text: null })), () => null);
}
mightContainNonBasicASCII() {
return this._buffer.mightContainNonBasicASCII();
}
getAlternativeVersionId() {
this._assertNotDisposed();
return this._alternativeVersionId;
}
getInitialUndoRedoSnapshot() {
this._assertNotDisposed();
return this._initialUndoRedoSnapshot;
}
getOffsetAt(rawPosition) {
this._assertNotDisposed();
const position = this._validatePosition(
rawPosition.lineNumber,
rawPosition.column,
0
/* StringOffsetValidationType.Relaxed */
);
return this._buffer.getOffsetAt(position.lineNumber, position.column);
}
getPositionAt(rawOffset) {
this._assertNotDisposed();
const offset = Math.min(this._buffer.getLength(), Math.max(0, rawOffset));
return this._buffer.getPositionAt(offset);
}
_increaseVersionId() {
this._versionId = this._versionId + 1;
this._alternativeVersionId = this._versionId;
}
_overwriteVersionId(versionId) {
this._versionId = versionId;
}
_overwriteAlternativeVersionId(newAlternativeVersionId) {
this._alternativeVersionId = newAlternativeVersionId;
}
_overwriteInitialUndoRedoSnapshot(newInitialUndoRedoSnapshot) {
this._initialUndoRedoSnapshot = newInitialUndoRedoSnapshot;
}
getValue(eol, preserveBOM = false) {
this._assertNotDisposed();
if (this.isTooLargeForHeapOperation()) {
throw new BugIndicatingError("Operation would exceed heap memory limits");
}
const fullModelRange = this.getFullModelRange();
const fullModelValue = this.getValueInRange(fullModelRange, eol);
if (preserveBOM) {
return this._buffer.getBOM() + fullModelValue;
}
return fullModelValue;
}
createSnapshot(preserveBOM = false) {
return new TextModelSnapshot(this._buffer.createSnapshot(preserveBOM));
}
getValueLength(eol, preserveBOM = false) {
this._assertNotDisposed();
const fullModelRange = this.getFullModelRange();
const fullModelValue = this.getValueLengthInRange(fullModelRange, eol);
if (preserveBOM) {
return this._buffer.getBOM().length + fullModelValue;
}
return fullModelValue;
}
getValueInRange(rawRange, eol = 0) {
this._assertNotDisposed();
return this._buffer.getValueInRange(this.validateRange(rawRange), eol);
}
getValueLengthInRange(rawRange, eol = 0) {
this._assertNotDisposed();
return this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);
}
getCharacterCountInRange(rawRange, eol = 0) {
this._assertNotDisposed();
return this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);
}
getLineCount() {
this._assertNotDisposed();
return this._buffer.getLineCount();
}
getLineContent(lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._buffer.getLineContent(lineNumber);
}
getLineLength(lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._buffer.getLineLength(lineNumber);
}
getLinesContent() {
this._assertNotDisposed();
if (this.isTooLargeForHeapOperation()) {
throw new BugIndicatingError("Operation would exceed heap memory limits");
}
return this._buffer.getLinesContent();
}
getEOL() {
this._assertNotDisposed();
return this._buffer.getEOL();
}
getEndOfLineSequence() {
this._assertNotDisposed();
return this._buffer.getEOL() === "\n" ? 0 : 1;
}
getLineMinColumn(lineNumber) {
this._assertNotDisposed();
return 1;
}
getLineMaxColumn(lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._buffer.getLineLength(lineNumber) + 1;
}
getLineFirstNonWhitespaceColumn(lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);
}
getLineLastNonWhitespaceColumn(lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new BugIndicatingError("Illegal value for lineNumber");
}
return this._buffer.getLineLastNonWhitespaceColumn(lineNumber);
}
/**
* Validates `range` is within buffer bounds, but allows it to sit in between surrogate pairs, etc.
* Will try to not allocate if possible.
*/
_validateRangeRelaxedNoAllocations(range2) {
const linesCount = this._buffer.getLineCount();
const initialStartLineNumber = range2.startLineNumber;
const initialStartColumn = range2.startColumn;
let startLineNumber = Math.floor(typeof initialStartLineNumber === "number" && !isNaN(initialStartLineNumber) ? initialStartLineNumber : 1);
let startColumn = Math.floor(typeof initialStartColumn === "number" && !isNaN(initialStartColumn) ? initialStartColumn : 1);
if (startLineNumber < 1) {
startLineNumber = 1;
startColumn = 1;
} else if (startLineNumber > linesCount) {
startLineNumber = linesCount;
startColumn = this.getLineMaxColumn(startLineNumber);
} else {
if (startColumn <= 1) {
startColumn = 1;
} else {
const maxColumn = this.getLineMaxColumn(startLineNumber);
if (startColumn >= maxColumn) {
startColumn = maxColumn;
}
}
}
const initialEndLineNumber = range2.endLineNumber;
const initialEndColumn = range2.endColumn;
let endLineNumber = Math.floor(typeof initialEndLineNumber === "number" && !isNaN(initialEndLineNumber) ? initialEndLineNumber : 1);
let endColumn = Math.floor(typeof initialEndColumn === "number" && !isNaN(initialEndColumn) ? initialEndColumn : 1);
if (endLineNumber < 1) {
endLineNumber = 1;
endColumn = 1;
} else if (endLineNumber > linesCount) {
endLineNumber = linesCount;
endColumn = this.getLineMaxColumn(endLineNumber);
} else {
if (endColumn <= 1) {
endColumn = 1;
} else {
const maxColumn = this.getLineMaxColumn(endLineNumber);
if (endColumn >= maxColumn) {
endColumn = maxColumn;
}
}
}
if (initialStartLineNumber === startLineNumber && initialStartColumn === startColumn && initialEndLineNumber === endLineNumber && initialEndColumn === endColumn && range2 instanceof Range && !(range2 instanceof Selection)) {
return range2;
}
return new Range(startLineNumber, startColumn, endLineNumber, endColumn);
}
_isValidPosition(lineNumber, column, validationType) {
if (typeof lineNumber !== "number" || typeof column !== "number") {
return false;
}
if (isNaN(lineNumber) || isNaN(column)) {
return false;
}
if (lineNumber < 1 || column < 1) {
return false;
}
if ((lineNumber | 0) !== lineNumber || (column | 0) !== column) {
return false;
}
const lineCount = this._buffer.getLineCount();
if (lineNumber > lineCount) {
return false;
}
if (column === 1) {
return true;
}
const maxColumn = this.getLineMaxColumn(lineNumber);
if (column > maxColumn) {
return false;
}
if (validationType === 1) {
const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);
if (isHighSurrogate(charCodeBefore)) {
return false;
}
}
return true;
}
_validatePosition(_lineNumber, _column, validationType) {
const lineNumber = Math.floor(typeof _lineNumber === "number" && !isNaN(_lineNumber) ? _lineNumber : 1);
const column = Math.floor(typeof _column === "number" && !isNaN(_column) ? _column : 1);
const lineCount = this._buffer.getLineCount();
if (lineNumber < 1) {
return new Position(1, 1);
}
if (lineNumber > lineCount) {
return new Position(lineCount, this.getLineMaxColumn(lineCount));
}
if (column <= 1) {
return new Position(lineNumber, 1);
}
const maxColumn = this.getLineMaxColumn(lineNumber);
if (column >= maxColumn) {
return new Position(lineNumber, maxColumn);
}
if (validationType === 1) {
const charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);
if (isHighSurrogate(charCodeBefore)) {
return new Position(lineNumber, column - 1);
}
}
return new Position(lineNumber, column);
}
validatePosition(position) {
const validationType = 1;
this._assertNotDisposed();
if (position instanceof Position) {
if (this._isValidPosition(position.lineNumber, position.column, validationType)) {
return position;
}
}
return this._validatePosition(position.lineNumber, position.column, validationType);
}
_isValidRange(range2, validationType) {
const startLineNumber = range2.startLineNumber;
const startColumn = range2.startColumn;
const endLineNumber = range2.endLineNumber;
const endColumn = range2.endColumn;
if (!this._isValidPosition(
startLineNumber,
startColumn,
0
/* StringOffsetValidationType.Relaxed */
)) {
return false;
}
if (!this._isValidPosition(
endLineNumber,
endColumn,
0
/* StringOffsetValidationType.Relaxed */
)) {
return false;
}
if (validationType === 1) {
const charCodeBeforeStart = startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0;
const charCodeBeforeEnd = endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0;
const startInsideSurrogatePair = isHighSurrogate(charCodeBeforeStart);
const endInsideSurrogatePair = isHighSurrogate(charCodeBeforeEnd);
if (!startInsideSurrogatePair && !endInsideSurrogatePair) {
return true;
}
return false;
}
return true;
}
validateRange(_range) {
const validationType = 1;
this._assertNotDisposed();
if (_range instanceof Range && !(_range instanceof Selection)) {
if (this._isValidRange(_range, validationType)) {
return _range;
}
}
const start = this._validatePosition(
_range.startLineNumber,
_range.startColumn,
0
/* StringOffsetValidationType.Relaxed */
);
const end = this._validatePosition(
_range.endLineNumber,
_range.endColumn,
0
/* StringOffsetValidationType.Relaxed */
);
const startLineNumber = start.lineNumber;
const startColumn = start.column;
const endLineNumber = end.lineNumber;
const endColumn = end.column;
if (validationType === 1) {
const charCodeBeforeStart = startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0;
const charCodeBeforeEnd = endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0;
const startInsideSurrogatePair = isHighSurrogate(charCodeBeforeStart);
const endInsideSurrogatePair = isHighSurrogate(charCodeBeforeEnd);
if (!startInsideSurrogatePair && !endInsideSurrogatePair) {
return new Range(startLineNumber, startColumn, endLineNumber, endColumn);
}
if (startLineNumber === endLineNumber && startColumn === endColumn) {
return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);
}
if (startInsideSurrogatePair && endInsideSurrogatePair) {
return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);
}
if (startInsideSurrogatePair) {
return new Range(startLineNumber, startColumn - 1, endLineNumber, endColumn);
}
return new Range(startLineNumber, startColumn, endLineNumber, endColumn + 1);
}
return new Range(startLineNumber, startColumn, endLineNumber, endColumn);
}
modifyPosition(rawPosition, offset) {
this._assertNotDisposed();
const candidate = this.getOffsetAt(rawPosition) + offset;
return this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));
}
getFullModelRange() {
this._assertNotDisposed();
const lineCount = this.getLineCount();
return new Range(1, 1, lineCount, this.getLineMaxColumn(lineCount));
}
findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {
return this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
}
findMatches(searchString, rawSearchScope, isRegex, matchCase, wordSeparators2, captureMatches, limitResultCount = LIMIT_FIND_COUNT2) {
this._assertNotDisposed();
let searchRanges = null;
if (rawSearchScope !== null) {
if (!Array.isArray(rawSearchScope)) {
rawSearchScope = [rawSearchScope];
}
if (rawSearchScope.every((searchScope) => Range.isIRange(searchScope))) {
searchRanges = rawSearchScope.map((searchScope) => this.validateRange(searchScope));
}
}
if (searchRanges === null) {
searchRanges = [this.getFullModelRange()];
}
searchRanges = searchRanges.sort((d1, d2) => d1.startLineNumber - d2.startLineNumber || d1.startColumn - d2.startColumn);
const uniqueSearchRanges = [];
uniqueSearchRanges.push(searchRanges.reduce((prev, curr) => {
if (Range.areIntersecting(prev, curr)) {
return prev.plusRange(curr);
}
uniqueSearchRanges.push(prev);
return curr;
}));
let matchMapper;
if (!isRegex && searchString.indexOf("\n") < 0) {
const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators2);
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return [];
}
matchMapper = (searchRange) => this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
} else {
matchMapper = (searchRange) => TextModelSearch.findMatches(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators2), searchRange, captureMatches, limitResultCount);
}
return uniqueSearchRanges.map(matchMapper).reduce((arr, matches2) => arr.concat(matches2), []);
}
findNextMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators2, captureMatches) {
this._assertNotDisposed();
const searchStart = this.validatePosition(rawSearchStart);
if (!isRegex && searchString.indexOf("\n") < 0) {
const searchParams = new SearchParams(searchString, isRegex, matchCase, wordSeparators2);
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
const lineCount = this.getLineCount();
let searchRange = new Range(searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));
let ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);
TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators2), searchStart, captureMatches);
if (ret.length > 0) {
return ret[0];
}
searchRange = new Range(1, 1, searchStart.lineNumber, this.getLineMaxColumn(searchStart.lineNumber));
ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);
if (ret.length > 0) {
return ret[0];
}
return null;
}
return TextModelSearch.findNextMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators2), searchStart, captureMatches);
}
findPreviousMatch(searchString, rawSearchStart, isRegex, matchCase, wordSeparators2, captureMatches) {
this._assertNotDisposed();
const searchStart = this.validatePosition(rawSearchStart);
return TextModelSearch.findPreviousMatch(this, new SearchParams(searchString, isRegex, matchCase, wordSeparators2), searchStart, captureMatches);
}
//#endregion
//#region Editing
pushStackElement() {
this._commandManager.pushStackElement();
}
popStackElement() {
this._commandManager.popStackElement();
}
pushEOL(eol) {
const currentEOL = this.getEOL() === "\n" ? 0 : 1;
if (currentEOL === eol) {
return;
}
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
if (this._initialUndoRedoSnapshot === null) {
this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);
}
this._commandManager.pushEOL(eol);
} finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
}
_validateEditOperation(rawOperation) {
if (rawOperation instanceof ValidAnnotatedEditOperation) {
return rawOperation;
}
return new ValidAnnotatedEditOperation(rawOperation.identifier || null, this.validateRange(rawOperation.range), rawOperation.text, rawOperation.forceMoveMarkers || false, rawOperation.isAutoWhitespaceEdit || false, rawOperation._isTracked || false);
}
_validateEditOperations(rawOperations) {
const result = [];
for (let i = 0, len = rawOperations.length; i < len; i++) {
result[i] = this._validateEditOperation(rawOperations[i]);
}
return result;
}
pushEditOperations(beforeCursorState, editOperations, cursorStateComputer, group) {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
return this._pushEditOperations(beforeCursorState, this._validateEditOperations(editOperations), cursorStateComputer, group);
} finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
}
_pushEditOperations(beforeCursorState, editOperations, cursorStateComputer, group) {
if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {
const incomingEdits = editOperations.map((op) => {
return {
range: this.validateRange(op.range),
text: op.text
};
});
let editsAreNearCursors = true;
if (beforeCursorState) {
for (let i = 0, len = beforeCursorState.length; i < len; i++) {
const sel = beforeCursorState[i];
let foundEditNearSel = false;
for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
const editRange = incomingEdits[j].range;
const selIsAbove = editRange.startLineNumber > sel.endLineNumber;
const selIsBelow = sel.startLineNumber > editRange.endLineNumber;
if (!selIsAbove && !selIsBelow) {
foundEditNearSel = true;
break;
}
}
if (!foundEditNearSel) {
editsAreNearCursors = false;
break;
}
}
}
if (editsAreNearCursors) {
for (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {
const trimLineNumber = this._trimAutoWhitespaceLines[i];
const maxLineColumn = this.getLineMaxColumn(trimLineNumber);
let allowTrimLine = true;
for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
const editRange = incomingEdits[j].range;
const editText = incomingEdits[j].text;
if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {
continue;
}
if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === "\n") {
continue;
}
if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === 1 && editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === "\n") {
continue;
}
allowTrimLine = false;
break;
}
if (allowTrimLine) {
const trimRange = new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn);
editOperations.push(new ValidAnnotatedEditOperation(null, trimRange, null, false, false, false));
}
}
}
this._trimAutoWhitespaceLines = null;
}
if (this._initialUndoRedoSnapshot === null) {
this._initialUndoRedoSnapshot = this._undoRedoService.createSnapshot(this.uri);
}
return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer, group);
}
_applyUndo(changes, eol, resultingAlternativeVersionId, resultingSelection) {
const edits = changes.map((change) => {
const rangeStart = this.getPositionAt(change.newPosition);
const rangeEnd = this.getPositionAt(change.newEnd);
return {
range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),
text: change.oldText
};
});
this._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);
}
_applyRedo(changes, eol, resultingAlternativeVersionId, resultingSelection) {
const edits = changes.map((change) => {
const rangeStart = this.getPositionAt(change.oldPosition);
const rangeEnd = this.getPositionAt(change.oldEnd);
return {
range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),
text: change.newText
};
});
this._applyUndoRedoEdits(edits, eol, false, true, resultingAlternativeVersionId, resultingSelection);
}
_applyUndoRedoEdits(edits, eol, isUndoing, isRedoing, resultingAlternativeVersionId, resultingSelection) {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
this._isUndoing = isUndoing;
this._isRedoing = isRedoing;
this.applyEdits(edits, false);
this.setEOL(eol);
this._overwriteAlternativeVersionId(resultingAlternativeVersionId);
} finally {
this._isUndoing = false;
this._isRedoing = false;
this._eventEmitter.endDeferredEmit(resultingSelection);
this._onDidChangeDecorations.endDeferredEmit();
}
}
applyEdits(rawOperations, computeUndoEdits = false) {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
const operations = this._validateEditOperations(rawOperations);
return this._doApplyEdits(operations, computeUndoEdits);
} finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
}
_doApplyEdits(rawOperations, computeUndoEdits) {
const oldLineCount = this._buffer.getLineCount();
const result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace, computeUndoEdits);
const newLineCount = this._buffer.getLineCount();
const contentChanges = result.changes;
this._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;
if (contentChanges.length !== 0) {
for (let i = 0, len = contentChanges.length; i < len; i++) {
const change = contentChanges[i];
this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);
}
const rawContentChanges = [];
this._increaseVersionId();
let lineCount = oldLineCount;
for (let i = 0, len = contentChanges.length; i < len; i++) {
const change = contentChanges[i];
const [eolCount] = countEOL(change.text);
this._onDidChangeDecorations.fire();
const startLineNumber = change.range.startLineNumber;
const endLineNumber = change.range.endLineNumber;
const deletingLinesCnt = endLineNumber - startLineNumber;
const insertingLinesCnt = eolCount;
const editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);
const changeLineCountDelta = insertingLinesCnt - deletingLinesCnt;
const currentEditStartLineNumber = newLineCount - lineCount - changeLineCountDelta + startLineNumber;
const firstEditLineNumber = currentEditStartLineNumber;
const lastInsertedLineNumber = currentEditStartLineNumber + insertingLinesCnt;
const decorationsWithInjectedTextInEditedRange = this._decorationsTree.getInjectedTextInInterval(this, this.getOffsetAt(new Position(firstEditLineNumber, 1)), this.getOffsetAt(new Position(lastInsertedLineNumber, this.getLineMaxColumn(lastInsertedLineNumber))), 0);
const injectedTextInEditedRange = LineInjectedText.fromDecorations(decorationsWithInjectedTextInEditedRange);
const injectedTextInEditedRangeQueue = new ArrayQueue(injectedTextInEditedRange);
for (let j = editingLinesCnt; j >= 0; j--) {
const editLineNumber = startLineNumber + j;
const currentEditLineNumber = currentEditStartLineNumber + j;
injectedTextInEditedRangeQueue.takeFromEndWhile((r) => r.lineNumber > currentEditLineNumber);
const decorationsInCurrentLine = injectedTextInEditedRangeQueue.takeFromEndWhile((r) => r.lineNumber === currentEditLineNumber);
rawContentChanges.push(new ModelRawLineChanged(editLineNumber, this.getLineContent(currentEditLineNumber), decorationsInCurrentLine));
}
if (editingLinesCnt < deletingLinesCnt) {
const spliceStartLineNumber = startLineNumber + editingLinesCnt;
rawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));
}
if (editingLinesCnt < insertingLinesCnt) {
const injectedTextInEditedRangeQueue2 = new ArrayQueue(injectedTextInEditedRange);
const spliceLineNumber = startLineNumber + editingLinesCnt;
const cnt = insertingLinesCnt - editingLinesCnt;
const fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;
const injectedTexts = [];
const newLines = [];
for (let i2 = 0; i2 < cnt; i2++) {
const lineNumber = fromLineNumber + i2;
newLines[i2] = this.getLineContent(lineNumber);
injectedTextInEditedRangeQueue2.takeWhile((r) => r.lineNumber < lineNumber);
injectedTexts[i2] = injectedTextInEditedRangeQueue2.takeWhile((r) => r.lineNumber === lineNumber);
}
rawContentChanges.push(new ModelRawLinesInserted(spliceLineNumber + 1, startLineNumber + insertingLinesCnt, newLines, injectedTexts));
}
lineCount += changeLineCountDelta;
}
this._emitContentChangedEvent(new ModelRawContentChangedEvent(rawContentChanges, this.getVersionId(), this._isUndoing, this._isRedoing), {
changes: contentChanges,
eol: this._buffer.getEOL(),
isEolChange: false,
versionId: this.getVersionId(),
isUndoing: this._isUndoing,
isRedoing: this._isRedoing,
isFlush: false
});
}
return result.reverseEdits === null ? void 0 : result.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);
}
//#endregion
//#region Decorations
handleBeforeFireDecorationsChangedEvent(affectedInjectedTextLines) {
if (affectedInjectedTextLines === null || affectedInjectedTextLines.size === 0) {
return;
}
const affectedLines = Array.from(affectedInjectedTextLines);
const lineChangeEvents = affectedLines.map((lineNumber) => new ModelRawLineChanged(lineNumber, this.getLineContent(lineNumber), this._getInjectedTextInLine(lineNumber)));
this._onDidChangeInjectedText.fire(new ModelInjectedTextChangedEvent(lineChangeEvents));
}
changeDecorations(callback, ownerId2 = 0) {
this._assertNotDisposed();
try {
this._onDidChangeDecorations.beginDeferredEmit();
return this._changeDecorations(ownerId2, callback);
} finally {
this._onDidChangeDecorations.endDeferredEmit();
}
}
_changeDecorations(ownerId2, callback) {
const changeAccessor = {
addDecoration: (range2, options2) => {
return this._deltaDecorationsImpl(ownerId2, [], [{ range: range2, options: options2 }])[0];
},
changeDecoration: (id, newRange) => {
this._changeDecorationImpl(id, newRange);
},
changeDecorationOptions: (id, options2) => {
this._changeDecorationOptionsImpl(id, _normalizeOptions(options2));
},
removeDecoration: (id) => {
this._deltaDecorationsImpl(ownerId2, [id], []);
},
deltaDecorations: (oldDecorations, newDecorations) => {
if (oldDecorations.length === 0 && newDecorations.length === 0) {
return [];
}
return this._deltaDecorationsImpl(ownerId2, oldDecorations, newDecorations);
}
};
let result = null;
try {
result = callback(changeAccessor);
} catch (e) {
onUnexpectedError(e);
}
changeAccessor.addDecoration = invalidFunc2;
changeAccessor.changeDecoration = invalidFunc2;
changeAccessor.changeDecorationOptions = invalidFunc2;
changeAccessor.removeDecoration = invalidFunc2;
changeAccessor.deltaDecorations = invalidFunc2;
return result;
}
deltaDecorations(oldDecorations, newDecorations, ownerId2 = 0) {
this._assertNotDisposed();
if (!oldDecorations) {
oldDecorations = [];
}
if (oldDecorations.length === 0 && newDecorations.length === 0) {
return [];
}
try {
this._deltaDecorationCallCnt++;
if (this._deltaDecorationCallCnt > 1) {
console.warn(`Invoking deltaDecorations recursively could lead to leaking decorations.`);
onUnexpectedError(new Error(`Invoking deltaDecorations recursively could lead to leaking decorations.`));
}
this._onDidChangeDecorations.beginDeferredEmit();
return this._deltaDecorationsImpl(ownerId2, oldDecorations, newDecorations);
} finally {
this._onDidChangeDecorations.endDeferredEmit();
this._deltaDecorationCallCnt--;
}
}
_getTrackedRange(id) {
return this.getDecorationRange(id);
}
_setTrackedRange(id, newRange, newStickiness) {
const node = id ? this._decorations[id] : null;
if (!node) {
if (!newRange) {
return null;
}
return this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }], true)[0];
}
if (!newRange) {
this._decorationsTree.delete(node);
delete this._decorations[node.id];
return null;
}
const range2 = this._validateRangeRelaxedNoAllocations(newRange);
const startOffset = this._buffer.getOffsetAt(range2.startLineNumber, range2.startColumn);
const endOffset = this._buffer.getOffsetAt(range2.endLineNumber, range2.endColumn);
this._decorationsTree.delete(node);
node.reset(this.getVersionId(), startOffset, endOffset, range2);
node.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);
this._decorationsTree.insert(node);
return node.id;
}
removeAllDecorationsWithOwnerId(ownerId2) {
if (this._isDisposed) {
return;
}
const nodes = this._decorationsTree.collectNodesFromOwner(ownerId2);
for (let i = 0, len = nodes.length; i < len; i++) {
const node = nodes[i];
this._decorationsTree.delete(node);
delete this._decorations[node.id];
}
}
getDecorationOptions(decorationId) {
const node = this._decorations[decorationId];
if (!node) {
return null;
}
return node.options;
}
getDecorationRange(decorationId) {
const node = this._decorations[decorationId];
if (!node) {
return null;
}
return this._decorationsTree.getNodeRange(this, node);
}
getLineDecorations(lineNumber, ownerId2 = 0, filterOutValidation = false) {
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
return [];
}
return this.getLinesDecorations(lineNumber, lineNumber, ownerId2, filterOutValidation);
}
getLinesDecorations(_startLineNumber, _endLineNumber, ownerId2 = 0, filterOutValidation = false, onlyMarginDecorations = false) {
const lineCount = this.getLineCount();
const startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));
const endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));
const endColumn = this.getLineMaxColumn(endLineNumber);
const range2 = new Range(startLineNumber, 1, endLineNumber, endColumn);
const decorations = this._getDecorationsInRange(range2, ownerId2, filterOutValidation, onlyMarginDecorations);
pushMany(decorations, this._decorationProvider.getDecorationsInRange(range2, ownerId2, filterOutValidation));
return decorations;
}
getDecorationsInRange(range2, ownerId2 = 0, filterOutValidation = false, onlyMinimapDecorations = false, onlyMarginDecorations = false) {
const validatedRange = this.validateRange(range2);
const decorations = this._getDecorationsInRange(validatedRange, ownerId2, filterOutValidation, onlyMarginDecorations);
pushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId2, filterOutValidation, onlyMinimapDecorations));
return decorations;
}
getOverviewRulerDecorations(ownerId2 = 0, filterOutValidation = false) {
return this._decorationsTree.getAll(this, ownerId2, filterOutValidation, true, false);
}
getInjectedTextDecorations(ownerId2 = 0) {
return this._decorationsTree.getAllInjectedText(this, ownerId2);
}
_getInjectedTextInLine(lineNumber) {
const startOffset = this._buffer.getOffsetAt(lineNumber, 1);
const endOffset = startOffset + this._buffer.getLineLength(lineNumber);
const result = this._decorationsTree.getInjectedTextInInterval(this, startOffset, endOffset, 0);
return LineInjectedText.fromDecorations(result).filter((t4) => t4.lineNumber === lineNumber);
}
getAllDecorations(ownerId2 = 0, filterOutValidation = false) {
let result = this._decorationsTree.getAll(this, ownerId2, filterOutValidation, false, false);
result = result.concat(this._decorationProvider.getAllDecorations(ownerId2, filterOutValidation));
return result;
}
getAllMarginDecorations(ownerId2 = 0) {
return this._decorationsTree.getAll(this, ownerId2, false, false, true);
}
_getDecorationsInRange(filterRange, filterOwnerId, filterOutValidation, onlyMarginDecorations) {
const startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);
const endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);
return this._decorationsTree.getAllInInterval(this, startOffset, endOffset, filterOwnerId, filterOutValidation, onlyMarginDecorations);
}
getRangeAt(start, end) {
return this._buffer.getRangeAt(start, end - start);
}
_changeDecorationImpl(decorationId, _range) {
const node = this._decorations[decorationId];
if (!node) {
return;
}
if (node.options.after) {
const oldRange = this.getDecorationRange(decorationId);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.endLineNumber);
}
if (node.options.before) {
const oldRange = this.getDecorationRange(decorationId);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(oldRange.startLineNumber);
}
const range2 = this._validateRangeRelaxedNoAllocations(_range);
const startOffset = this._buffer.getOffsetAt(range2.startLineNumber, range2.startColumn);
const endOffset = this._buffer.getOffsetAt(range2.endLineNumber, range2.endColumn);
this._decorationsTree.delete(node);
node.reset(this.getVersionId(), startOffset, endOffset, range2);
this._decorationsTree.insert(node);
this._onDidChangeDecorations.checkAffectedAndFire(node.options);
if (node.options.after) {
this._onDidChangeDecorations.recordLineAffectedByInjectedText(range2.endLineNumber);
}
if (node.options.before) {
this._onDidChangeDecorations.recordLineAffectedByInjectedText(range2.startLineNumber);
}
}
_changeDecorationOptionsImpl(decorationId, options2) {
const node = this._decorations[decorationId];
if (!node) {
return;
}
const nodeWasInOverviewRuler = node.options.overviewRuler && node.options.overviewRuler.color ? true : false;
const nodeIsInOverviewRuler = options2.overviewRuler && options2.overviewRuler.color ? true : false;
this._onDidChangeDecorations.checkAffectedAndFire(node.options);
this._onDidChangeDecorations.checkAffectedAndFire(options2);
if (node.options.after || options2.after) {
const nodeRange = this._decorationsTree.getNodeRange(this, node);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);
}
if (node.options.before || options2.before) {
const nodeRange = this._decorationsTree.getNodeRange(this, node);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);
}
const movedInOverviewRuler = nodeWasInOverviewRuler !== nodeIsInOverviewRuler;
const changedWhetherInjectedText = isOptionsInjectedText(options2) !== isNodeInjectedText(node);
if (movedInOverviewRuler || changedWhetherInjectedText) {
this._decorationsTree.delete(node);
node.setOptions(options2);
this._decorationsTree.insert(node);
} else {
node.setOptions(options2);
}
}
_deltaDecorationsImpl(ownerId2, oldDecorationsIds, newDecorations, suppressEvents = false) {
const versionId = this.getVersionId();
const oldDecorationsLen = oldDecorationsIds.length;
let oldDecorationIndex = 0;
const newDecorationsLen = newDecorations.length;
let newDecorationIndex = 0;
this._onDidChangeDecorations.beginDeferredEmit();
try {
const result = new Array(newDecorationsLen);
while (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {
let node = null;
if (oldDecorationIndex < oldDecorationsLen) {
do {
node = this._decorations[oldDecorationsIds[oldDecorationIndex++]];
} while (!node && oldDecorationIndex < oldDecorationsLen);
if (node) {
if (node.options.after) {
const nodeRange = this._decorationsTree.getNodeRange(this, node);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.endLineNumber);
}
if (node.options.before) {
const nodeRange = this._decorationsTree.getNodeRange(this, node);
this._onDidChangeDecorations.recordLineAffectedByInjectedText(nodeRange.startLineNumber);
}
this._decorationsTree.delete(node);
if (!suppressEvents) {
this._onDidChangeDecorations.checkAffectedAndFire(node.options);
}
}
}
if (newDecorationIndex < newDecorationsLen) {
if (!node) {
const internalDecorationId = ++this._lastDecorationId;
const decorationId = `${this._instanceId};${internalDecorationId}`;
node = new IntervalNode(decorationId, 0, 0);
this._decorations[decorationId] = node;
}
const newDecoration = newDecorations[newDecorationIndex];
const range2 = this._validateRangeRelaxedNoAllocations(newDecoration.range);
const options2 = _normalizeOptions(newDecoration.options);
const startOffset = this._buffer.getOffsetAt(range2.startLineNumber, range2.startColumn);
const endOffset = this._buffer.getOffsetAt(range2.endLineNumber, range2.endColumn);
node.ownerId = ownerId2;
node.reset(versionId, startOffset, endOffset, range2);
node.setOptions(options2);
if (node.options.after) {
this._onDidChangeDecorations.recordLineAffectedByInjectedText(range2.endLineNumber);
}
if (node.options.before) {
this._onDidChangeDecorations.recordLineAffectedByInjectedText(range2.startLineNumber);
}
if (!suppressEvents) {
this._onDidChangeDecorations.checkAffectedAndFire(options2);
}
this._decorationsTree.insert(node);
result[newDecorationIndex] = node.id;
newDecorationIndex++;
} else {
if (node) {
delete this._decorations[node.id];
}
}
}
return result;
} finally {
this._onDidChangeDecorations.endDeferredEmit();
}
}
//#endregion
//#region Tokenization
// TODO move them to the tokenization part.
getLanguageId() {
return this.tokenization.getLanguageId();
}
setLanguage(languageIdOrSelection, source) {
if (typeof languageIdOrSelection === "string") {
this._languageSelectionListener.clear();
this._setLanguage(languageIdOrSelection, source);
} else {
this._languageSelectionListener.value = languageIdOrSelection.onDidChange(() => this._setLanguage(languageIdOrSelection.languageId, source));
this._setLanguage(languageIdOrSelection.languageId, source);
}
}
_setLanguage(languageId, source) {
this.tokenization.setLanguageId(languageId, source);
this._languageService.requestRichLanguageFeatures(languageId);
}
getLanguageIdAtPosition(lineNumber, column) {
return this.tokenization.getLanguageIdAtPosition(lineNumber, column);
}
getWordAtPosition(position) {
return this._tokenizationTextModelPart.getWordAtPosition(position);
}
getWordUntilPosition(position) {
return this._tokenizationTextModelPart.getWordUntilPosition(position);
}
//#endregion
normalizePosition(position, affinity) {
return position;
}
/**
* Gets the column at which indentation stops at a given line.
* @internal
*/
getLineIndentColumn(lineNumber) {
return indentOfLine(this.getLineContent(lineNumber)) + 1;
}
};
TextModel._MODEL_SYNC_LIMIT = 50 * 1024 * 1024;
TextModel.LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024;
TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1e3;
TextModel.LARGE_FILE_HEAP_OPERATION_THRESHOLD = 256 * 1024 * 1024;
TextModel.DEFAULT_CREATION_OPTIONS = {
isForSimpleWidget: false,
tabSize: EDITOR_MODEL_DEFAULTS.tabSize,
indentSize: EDITOR_MODEL_DEFAULTS.indentSize,
insertSpaces: EDITOR_MODEL_DEFAULTS.insertSpaces,
detectIndentation: false,
defaultEOL: 1,
trimAutoWhitespace: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
largeFileOptimizations: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
bracketPairColorizationOptions: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions
};
TextModel = TextModel_1 = __decorate12([
__param11(4, IUndoRedoService),
__param11(5, ILanguageService),
__param11(6, ILanguageConfigurationService)
], TextModel);
DecorationsTrees = class {
constructor() {
this._decorationsTree0 = new IntervalTree();
this._decorationsTree1 = new IntervalTree();
this._injectedTextDecorationsTree = new IntervalTree();
}
ensureAllNodesHaveRanges(host) {
this.getAll(host, 0, false, false, false);
}
_ensureNodesHaveRanges(host, nodes) {
for (const node of nodes) {
if (node.range === null) {
node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);
}
}
return nodes;
}
getAllInInterval(host, start, end, filterOwnerId, filterOutValidation, onlyMarginDecorations) {
const versionId = host.getVersionId();
const result = this._intervalSearch(start, end, filterOwnerId, filterOutValidation, versionId, onlyMarginDecorations);
return this._ensureNodesHaveRanges(host, result);
}
_intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations) {
const r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
const r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
const r2 = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
return r0.concat(r1).concat(r2);
}
getInjectedTextInInterval(host, start, end, filterOwnerId) {
const versionId = host.getVersionId();
const result = this._injectedTextDecorationsTree.intervalSearch(start, end, filterOwnerId, false, versionId, false);
return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());
}
getAllInjectedText(host, filterOwnerId) {
const versionId = host.getVersionId();
const result = this._injectedTextDecorationsTree.search(filterOwnerId, false, versionId, false);
return this._ensureNodesHaveRanges(host, result).filter((i) => i.options.showIfCollapsed || !i.range.isEmpty());
}
getAll(host, filterOwnerId, filterOutValidation, overviewRulerOnly, onlyMarginDecorations) {
const versionId = host.getVersionId();
const result = this._search(filterOwnerId, filterOutValidation, overviewRulerOnly, versionId, onlyMarginDecorations);
return this._ensureNodesHaveRanges(host, result);
}
_search(filterOwnerId, filterOutValidation, overviewRulerOnly, cachedVersionId, onlyMarginDecorations) {
if (overviewRulerOnly) {
return this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
} else {
const r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
const r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
const r2 = this._injectedTextDecorationsTree.search(filterOwnerId, filterOutValidation, cachedVersionId, onlyMarginDecorations);
return r0.concat(r1).concat(r2);
}
}
collectNodesFromOwner(ownerId2) {
const r0 = this._decorationsTree0.collectNodesFromOwner(ownerId2);
const r1 = this._decorationsTree1.collectNodesFromOwner(ownerId2);
const r2 = this._injectedTextDecorationsTree.collectNodesFromOwner(ownerId2);
return r0.concat(r1).concat(r2);
}
collectNodesPostOrder() {
const r0 = this._decorationsTree0.collectNodesPostOrder();
const r1 = this._decorationsTree1.collectNodesPostOrder();
const r2 = this._injectedTextDecorationsTree.collectNodesPostOrder();
return r0.concat(r1).concat(r2);
}
insert(node) {
if (isNodeInjectedText(node)) {
this._injectedTextDecorationsTree.insert(node);
} else if (isNodeInOverviewRuler(node)) {
this._decorationsTree1.insert(node);
} else {
this._decorationsTree0.insert(node);
}
}
delete(node) {
if (isNodeInjectedText(node)) {
this._injectedTextDecorationsTree.delete(node);
} else if (isNodeInOverviewRuler(node)) {
this._decorationsTree1.delete(node);
} else {
this._decorationsTree0.delete(node);
}
}
getNodeRange(host, node) {
const versionId = host.getVersionId();
if (node.cachedVersionId !== versionId) {
this._resolveNode(node, versionId);
}
if (node.range === null) {
node.range = host.getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);
}
return node.range;
}
_resolveNode(node, cachedVersionId) {
if (isNodeInjectedText(node)) {
this._injectedTextDecorationsTree.resolveNode(node, cachedVersionId);
} else if (isNodeInOverviewRuler(node)) {
this._decorationsTree1.resolveNode(node, cachedVersionId);
} else {
this._decorationsTree0.resolveNode(node, cachedVersionId);
}
}
acceptReplace(offset, length, textLength, forceMoveMarkers) {
this._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);
this._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);
this._injectedTextDecorationsTree.acceptReplace(offset, length, textLength, forceMoveMarkers);
}
};
DecorationOptions = class {
constructor(options2) {
this.color = options2.color || "";
this.darkColor = options2.darkColor || "";
}
};
ModelDecorationOverviewRulerOptions = class extends DecorationOptions {
constructor(options2) {
super(options2);
this._resolvedColor = null;
this.position = typeof options2.position === "number" ? options2.position : OverviewRulerLane2.Center;
}
getColor(theme) {
if (!this._resolvedColor) {
if (theme.type !== "light" && this.darkColor) {
this._resolvedColor = this._resolveColor(this.darkColor, theme);
} else {
this._resolvedColor = this._resolveColor(this.color, theme);
}
}
return this._resolvedColor;
}
invalidateCachedColor() {
this._resolvedColor = null;
}
_resolveColor(color, theme) {
if (typeof color === "string") {
return color;
}
const c = color ? theme.getColor(color.id) : null;
if (!c) {
return "";
}
return c.toString();
}
};
ModelDecorationGlyphMarginOptions = class {
constructor(options2) {
var _a10;
this.position = (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.position) !== null && _a10 !== void 0 ? _a10 : GlyphMarginLane2.Center;
this.persistLane = options2 === null || options2 === void 0 ? void 0 : options2.persistLane;
}
};
ModelDecorationMinimapOptions = class extends DecorationOptions {
constructor(options2) {
var _a10, _b4;
super(options2);
this.position = options2.position;
this.sectionHeaderStyle = (_a10 = options2.sectionHeaderStyle) !== null && _a10 !== void 0 ? _a10 : null;
this.sectionHeaderText = (_b4 = options2.sectionHeaderText) !== null && _b4 !== void 0 ? _b4 : null;
}
getColor(theme) {
if (!this._resolvedColor) {
if (theme.type !== "light" && this.darkColor) {
this._resolvedColor = this._resolveColor(this.darkColor, theme);
} else {
this._resolvedColor = this._resolveColor(this.color, theme);
}
}
return this._resolvedColor;
}
invalidateCachedColor() {
this._resolvedColor = void 0;
}
_resolveColor(color, theme) {
if (typeof color === "string") {
return Color.fromHex(color);
}
return theme.getColor(color.id);
}
};
ModelDecorationInjectedTextOptions = class _ModelDecorationInjectedTextOptions {
static from(options2) {
if (options2 instanceof _ModelDecorationInjectedTextOptions) {
return options2;
}
return new _ModelDecorationInjectedTextOptions(options2);
}
constructor(options2) {
this.content = options2.content || "";
this.inlineClassName = options2.inlineClassName || null;
this.inlineClassNameAffectsLetterSpacing = options2.inlineClassNameAffectsLetterSpacing || false;
this.attachedData = options2.attachedData || null;
this.cursorStops = options2.cursorStops || null;
}
};
ModelDecorationOptions = class _ModelDecorationOptions {
static register(options2) {
return new _ModelDecorationOptions(options2);
}
static createDynamic(options2) {
return new _ModelDecorationOptions(options2);
}
constructor(options2) {
var _a10, _b4, _c2, _d2, _e2, _f3;
this.description = options2.description;
this.blockClassName = options2.blockClassName ? cleanClassName(options2.blockClassName) : null;
this.blockDoesNotCollapse = (_a10 = options2.blockDoesNotCollapse) !== null && _a10 !== void 0 ? _a10 : null;
this.blockIsAfterEnd = (_b4 = options2.blockIsAfterEnd) !== null && _b4 !== void 0 ? _b4 : null;
this.blockPadding = (_c2 = options2.blockPadding) !== null && _c2 !== void 0 ? _c2 : null;
this.stickiness = options2.stickiness || 0;
this.zIndex = options2.zIndex || 0;
this.className = options2.className ? cleanClassName(options2.className) : null;
this.shouldFillLineOnLineBreak = (_d2 = options2.shouldFillLineOnLineBreak) !== null && _d2 !== void 0 ? _d2 : null;
this.hoverMessage = options2.hoverMessage || null;
this.glyphMarginHoverMessage = options2.glyphMarginHoverMessage || null;
this.lineNumberHoverMessage = options2.lineNumberHoverMessage || null;
this.isWholeLine = options2.isWholeLine || false;
this.showIfCollapsed = options2.showIfCollapsed || false;
this.collapseOnReplaceEdit = options2.collapseOnReplaceEdit || false;
this.overviewRuler = options2.overviewRuler ? new ModelDecorationOverviewRulerOptions(options2.overviewRuler) : null;
this.minimap = options2.minimap ? new ModelDecorationMinimapOptions(options2.minimap) : null;
this.glyphMargin = options2.glyphMarginClassName ? new ModelDecorationGlyphMarginOptions(options2.glyphMargin) : null;
this.glyphMarginClassName = options2.glyphMarginClassName ? cleanClassName(options2.glyphMarginClassName) : null;
this.linesDecorationsClassName = options2.linesDecorationsClassName ? cleanClassName(options2.linesDecorationsClassName) : null;
this.lineNumberClassName = options2.lineNumberClassName ? cleanClassName(options2.lineNumberClassName) : null;
this.linesDecorationsTooltip = options2.linesDecorationsTooltip ? htmlAttributeEncodeValue(options2.linesDecorationsTooltip) : null;
this.firstLineDecorationClassName = options2.firstLineDecorationClassName ? cleanClassName(options2.firstLineDecorationClassName) : null;
this.marginClassName = options2.marginClassName ? cleanClassName(options2.marginClassName) : null;
this.inlineClassName = options2.inlineClassName ? cleanClassName(options2.inlineClassName) : null;
this.inlineClassNameAffectsLetterSpacing = options2.inlineClassNameAffectsLetterSpacing || false;
this.beforeContentClassName = options2.beforeContentClassName ? cleanClassName(options2.beforeContentClassName) : null;
this.afterContentClassName = options2.afterContentClassName ? cleanClassName(options2.afterContentClassName) : null;
this.after = options2.after ? ModelDecorationInjectedTextOptions.from(options2.after) : null;
this.before = options2.before ? ModelDecorationInjectedTextOptions.from(options2.before) : null;
this.hideInCommentTokens = (_e2 = options2.hideInCommentTokens) !== null && _e2 !== void 0 ? _e2 : false;
this.hideInStringTokens = (_f3 = options2.hideInStringTokens) !== null && _f3 !== void 0 ? _f3 : false;
}
};
ModelDecorationOptions.EMPTY = ModelDecorationOptions.register({ description: "empty" });
TRACKED_RANGE_OPTIONS = [
ModelDecorationOptions.register({
description: "tracked-range-always-grows-when-typing-at-edges",
stickiness: 0
/* model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */
}),
ModelDecorationOptions.register({
description: "tracked-range-never-grows-when-typing-at-edges",
stickiness: 1
/* model.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
}),
ModelDecorationOptions.register({
description: "tracked-range-grows-only-when-typing-before",
stickiness: 2
/* model.TrackedRangeStickiness.GrowsOnlyWhenTypingBefore */
}),
ModelDecorationOptions.register({
description: "tracked-range-grows-only-when-typing-after",
stickiness: 3
/* model.TrackedRangeStickiness.GrowsOnlyWhenTypingAfter */
})
];
DidChangeDecorationsEmitter = class extends Disposable {
constructor(handleBeforeFire) {
super();
this.handleBeforeFire = handleBeforeFire;
this._actual = this._register(new Emitter());
this.event = this._actual.event;
this._affectedInjectedTextLines = null;
this._deferredCnt = 0;
this._shouldFireDeferred = false;
this._affectsMinimap = false;
this._affectsOverviewRuler = false;
this._affectsGlyphMargin = false;
this._affectsLineNumber = false;
}
beginDeferredEmit() {
this._deferredCnt++;
}
endDeferredEmit() {
var _a10;
this._deferredCnt--;
if (this._deferredCnt === 0) {
if (this._shouldFireDeferred) {
this.doFire();
}
(_a10 = this._affectedInjectedTextLines) === null || _a10 === void 0 ? void 0 : _a10.clear();
this._affectedInjectedTextLines = null;
}
}
recordLineAffectedByInjectedText(lineNumber) {
if (!this._affectedInjectedTextLines) {
this._affectedInjectedTextLines = /* @__PURE__ */ new Set();
}
this._affectedInjectedTextLines.add(lineNumber);
}
checkAffectedAndFire(options2) {
var _a10, _b4;
this._affectsMinimap || (this._affectsMinimap = !!((_a10 = options2.minimap) === null || _a10 === void 0 ? void 0 : _a10.position));
this._affectsOverviewRuler || (this._affectsOverviewRuler = !!((_b4 = options2.overviewRuler) === null || _b4 === void 0 ? void 0 : _b4.color));
this._affectsGlyphMargin || (this._affectsGlyphMargin = !!options2.glyphMarginClassName);
this._affectsLineNumber || (this._affectsLineNumber = !!options2.lineNumberClassName);
this.tryFire();
}
fire() {
this._affectsMinimap = true;
this._affectsOverviewRuler = true;
this._affectsGlyphMargin = true;
this.tryFire();
}
tryFire() {
if (this._deferredCnt === 0) {
this.doFire();
} else {
this._shouldFireDeferred = true;
}
}
doFire() {
this.handleBeforeFire(this._affectedInjectedTextLines);
const event = {
affectsMinimap: this._affectsMinimap,
affectsOverviewRuler: this._affectsOverviewRuler,
affectsGlyphMargin: this._affectsGlyphMargin,
affectsLineNumber: this._affectsLineNumber
};
this._shouldFireDeferred = false;
this._affectsMinimap = false;
this._affectsOverviewRuler = false;
this._affectsGlyphMargin = false;
this._actual.fire(event);
}
};
DidChangeContentEmitter = class extends Disposable {
constructor() {
super();
this._fastEmitter = this._register(new Emitter());
this.fastEvent = this._fastEmitter.event;
this._slowEmitter = this._register(new Emitter());
this.slowEvent = this._slowEmitter.event;
this._deferredCnt = 0;
this._deferredEvent = null;
}
beginDeferredEmit() {
this._deferredCnt++;
}
endDeferredEmit(resultingSelection = null) {
this._deferredCnt--;
if (this._deferredCnt === 0) {
if (this._deferredEvent !== null) {
this._deferredEvent.rawContentChangedEvent.resultingSelection = resultingSelection;
const e = this._deferredEvent;
this._deferredEvent = null;
this._fastEmitter.fire(e);
this._slowEmitter.fire(e);
}
}
}
fire(e) {
if (this._deferredCnt > 0) {
if (this._deferredEvent) {
this._deferredEvent = this._deferredEvent.merge(e);
} else {
this._deferredEvent = e;
}
return;
}
this._fastEmitter.fire(e);
this._slowEmitter.fire(e);
}
};
AttachedViews = class {
constructor() {
this._onDidChangeVisibleRanges = new Emitter();
this.onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;
this._views = /* @__PURE__ */ new Set();
}
attachView() {
const view = new AttachedViewImpl((state) => {
this._onDidChangeVisibleRanges.fire({ view, state });
});
this._views.add(view);
return view;
}
detachView(view) {
this._views.delete(view);
this._onDidChangeVisibleRanges.fire({ view, state: void 0 });
}
};
AttachedViewImpl = class {
constructor(handleStateChange) {
this.handleStateChange = handleStateChange;
}
setVisibleLines(visibleLines, stabilized) {
const visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));
this.handleStateChange({ visibleLineRanges, stabilized });
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js
function createLineBreaksFromPreviousLineBreaks(classifier, previousBreakingData, lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent, wordBreak) {
if (firstLineBreakColumn === -1) {
return null;
}
const len = lineText.length;
if (len <= 1) {
return null;
}
const isKeepAll = wordBreak === "keepAll";
const prevBreakingOffsets = previousBreakingData.breakOffsets;
const prevBreakingOffsetsVisibleColumn = previousBreakingData.breakOffsetsVisibleColumn;
const wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent);
const wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength;
const breakingOffsets = arrPool1;
const breakingOffsetsVisibleColumn = arrPool2;
let breakingOffsetsCount = 0;
let lastBreakingOffset = 0;
let lastBreakingOffsetVisibleColumn = 0;
let breakingColumn = firstLineBreakColumn;
const prevLen = prevBreakingOffsets.length;
let prevIndex = 0;
if (prevIndex >= 0) {
let bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn);
while (prevIndex + 1 < prevLen) {
const distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn);
if (distance >= bestDistance) {
break;
}
bestDistance = distance;
prevIndex++;
}
}
while (prevIndex < prevLen) {
let prevBreakOffset = prevIndex < 0 ? 0 : prevBreakingOffsets[prevIndex];
let prevBreakOffsetVisibleColumn = prevIndex < 0 ? 0 : prevBreakingOffsetsVisibleColumn[prevIndex];
if (lastBreakingOffset > prevBreakOffset) {
prevBreakOffset = lastBreakingOffset;
prevBreakOffsetVisibleColumn = lastBreakingOffsetVisibleColumn;
}
let breakOffset = 0;
let breakOffsetVisibleColumn = 0;
let forcedBreakOffset = 0;
let forcedBreakOffsetVisibleColumn = 0;
if (prevBreakOffsetVisibleColumn <= breakingColumn) {
let visibleColumn = prevBreakOffsetVisibleColumn;
let prevCharCode = prevBreakOffset === 0 ? 0 : lineText.charCodeAt(prevBreakOffset - 1);
let prevCharCodeClass = prevBreakOffset === 0 ? 0 : classifier.get(prevCharCode);
let entireLineFits = true;
for (let i = prevBreakOffset; i < len; i++) {
const charStartOffset = i;
const charCode = lineText.charCodeAt(i);
let charCodeClass;
let charWidth;
if (isHighSurrogate(charCode)) {
i++;
charCodeClass = 0;
charWidth = 2;
} else {
charCodeClass = classifier.get(charCode);
charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar);
}
if (charStartOffset > lastBreakingOffset && canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass, isKeepAll)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
}
visibleColumn += charWidth;
if (visibleColumn > breakingColumn) {
if (charStartOffset > lastBreakingOffset) {
forcedBreakOffset = charStartOffset;
forcedBreakOffsetVisibleColumn = visibleColumn - charWidth;
} else {
forcedBreakOffset = i + 1;
forcedBreakOffsetVisibleColumn = visibleColumn;
}
if (visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) {
breakOffset = 0;
}
entireLineFits = false;
break;
}
prevCharCode = charCode;
prevCharCodeClass = charCodeClass;
}
if (entireLineFits) {
if (breakingOffsetsCount > 0) {
breakingOffsets[breakingOffsetsCount] = prevBreakingOffsets[prevBreakingOffsets.length - 1];
breakingOffsetsVisibleColumn[breakingOffsetsCount] = prevBreakingOffsetsVisibleColumn[prevBreakingOffsets.length - 1];
breakingOffsetsCount++;
}
break;
}
}
if (breakOffset === 0) {
let visibleColumn = prevBreakOffsetVisibleColumn;
let charCode = lineText.charCodeAt(prevBreakOffset);
let charCodeClass = classifier.get(charCode);
let hitATabCharacter = false;
for (let i = prevBreakOffset - 1; i >= lastBreakingOffset; i--) {
const charStartOffset = i + 1;
const prevCharCode = lineText.charCodeAt(i);
if (prevCharCode === 9) {
hitATabCharacter = true;
break;
}
let prevCharCodeClass;
let prevCharWidth;
if (isLowSurrogate(prevCharCode)) {
i--;
prevCharCodeClass = 0;
prevCharWidth = 2;
} else {
prevCharCodeClass = classifier.get(prevCharCode);
prevCharWidth = isFullWidthCharacter(prevCharCode) ? columnsForFullWidthChar : 1;
}
if (visibleColumn <= breakingColumn) {
if (forcedBreakOffset === 0) {
forcedBreakOffset = charStartOffset;
forcedBreakOffsetVisibleColumn = visibleColumn;
}
if (visibleColumn <= breakingColumn - wrappedLineBreakColumn) {
break;
}
if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass, isKeepAll)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
break;
}
}
visibleColumn -= prevCharWidth;
charCode = prevCharCode;
charCodeClass = prevCharCodeClass;
}
if (breakOffset !== 0) {
const remainingWidthOfNextLine = wrappedLineBreakColumn - (forcedBreakOffsetVisibleColumn - breakOffsetVisibleColumn);
if (remainingWidthOfNextLine <= tabSize) {
const charCodeAtForcedBreakOffset = lineText.charCodeAt(forcedBreakOffset);
let charWidth;
if (isHighSurrogate(charCodeAtForcedBreakOffset)) {
charWidth = 2;
} else {
charWidth = computeCharWidth(charCodeAtForcedBreakOffset, forcedBreakOffsetVisibleColumn, tabSize, columnsForFullWidthChar);
}
if (remainingWidthOfNextLine - charWidth < 0) {
breakOffset = 0;
}
}
}
if (hitATabCharacter) {
prevIndex--;
continue;
}
}
if (breakOffset === 0) {
breakOffset = forcedBreakOffset;
breakOffsetVisibleColumn = forcedBreakOffsetVisibleColumn;
}
if (breakOffset <= lastBreakingOffset) {
const charCode = lineText.charCodeAt(lastBreakingOffset);
if (isHighSurrogate(charCode)) {
breakOffset = lastBreakingOffset + 2;
breakOffsetVisibleColumn = lastBreakingOffsetVisibleColumn + 2;
} else {
breakOffset = lastBreakingOffset + 1;
breakOffsetVisibleColumn = lastBreakingOffsetVisibleColumn + computeCharWidth(charCode, lastBreakingOffsetVisibleColumn, tabSize, columnsForFullWidthChar);
}
}
lastBreakingOffset = breakOffset;
breakingOffsets[breakingOffsetsCount] = breakOffset;
lastBreakingOffsetVisibleColumn = breakOffsetVisibleColumn;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn;
breakingOffsetsCount++;
breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn;
while (prevIndex < 0 || prevIndex < prevLen && prevBreakingOffsetsVisibleColumn[prevIndex] < breakOffsetVisibleColumn) {
prevIndex++;
}
let bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn);
while (prevIndex + 1 < prevLen) {
const distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn);
if (distance >= bestDistance) {
break;
}
bestDistance = distance;
prevIndex++;
}
}
if (breakingOffsetsCount === 0) {
return null;
}
breakingOffsets.length = breakingOffsetsCount;
breakingOffsetsVisibleColumn.length = breakingOffsetsCount;
arrPool1 = previousBreakingData.breakOffsets;
arrPool2 = previousBreakingData.breakOffsetsVisibleColumn;
previousBreakingData.breakOffsets = breakingOffsets;
previousBreakingData.breakOffsetsVisibleColumn = breakingOffsetsVisibleColumn;
previousBreakingData.wrappedTextIndentLength = wrappedTextIndentLength;
return previousBreakingData;
}
function createLineBreaks2(classifier, _lineText, injectedTexts, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent, wordBreak) {
const lineText = LineInjectedText.applyInjectedText(_lineText, injectedTexts);
let injectionOptions;
let injectionOffsets;
if (injectedTexts && injectedTexts.length > 0) {
injectionOptions = injectedTexts.map((t4) => t4.options);
injectionOffsets = injectedTexts.map((text2) => text2.column - 1);
} else {
injectionOptions = null;
injectionOffsets = null;
}
if (firstLineBreakColumn === -1) {
if (!injectionOptions) {
return null;
}
return new ModelLineProjectionData(injectionOffsets, injectionOptions, [lineText.length], [], 0);
}
const len = lineText.length;
if (len <= 1) {
if (!injectionOptions) {
return null;
}
return new ModelLineProjectionData(injectionOffsets, injectionOptions, [lineText.length], [], 0);
}
const isKeepAll = wordBreak === "keepAll";
const wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent);
const wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength;
const breakingOffsets = [];
const breakingOffsetsVisibleColumn = [];
let breakingOffsetsCount = 0;
let breakOffset = 0;
let breakOffsetVisibleColumn = 0;
let breakingColumn = firstLineBreakColumn;
let prevCharCode = lineText.charCodeAt(0);
let prevCharCodeClass = classifier.get(prevCharCode);
let visibleColumn = computeCharWidth(prevCharCode, 0, tabSize, columnsForFullWidthChar);
let startOffset = 1;
if (isHighSurrogate(prevCharCode)) {
visibleColumn += 1;
prevCharCode = lineText.charCodeAt(1);
prevCharCodeClass = classifier.get(prevCharCode);
startOffset++;
}
for (let i = startOffset; i < len; i++) {
const charStartOffset = i;
const charCode = lineText.charCodeAt(i);
let charCodeClass;
let charWidth;
if (isHighSurrogate(charCode)) {
i++;
charCodeClass = 0;
charWidth = 2;
} else {
charCodeClass = classifier.get(charCode);
charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar);
}
if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass, isKeepAll)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
}
visibleColumn += charWidth;
if (visibleColumn > breakingColumn) {
if (breakOffset === 0 || visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn - charWidth;
}
breakingOffsets[breakingOffsetsCount] = breakOffset;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn;
breakingOffsetsCount++;
breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn;
breakOffset = 0;
}
prevCharCode = charCode;
prevCharCodeClass = charCodeClass;
}
if (breakingOffsetsCount === 0 && (!injectedTexts || injectedTexts.length === 0)) {
return null;
}
breakingOffsets[breakingOffsetsCount] = len;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = visibleColumn;
return new ModelLineProjectionData(injectionOffsets, injectionOptions, breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
}
function computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar) {
if (charCode === 9) {
return tabSize - visibleColumn % tabSize;
}
if (isFullWidthCharacter(charCode)) {
return columnsForFullWidthChar;
}
if (charCode < 32) {
return columnsForFullWidthChar;
}
return 1;
}
function tabCharacterWidth(visibleColumn, tabSize) {
return tabSize - visibleColumn % tabSize;
}
function canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass, isKeepAll) {
return charCode !== 32 && (prevCharCodeClass === 2 && charCodeClass !== 2 || prevCharCodeClass !== 1 && charCodeClass === 1 || !isKeepAll && prevCharCodeClass === 3 && charCodeClass !== 2 || !isKeepAll && charCodeClass === 3 && prevCharCodeClass !== 1);
}
function computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent) {
let wrappedTextIndentLength = 0;
if (wrappingIndent !== 0) {
const firstNonWhitespaceIndex2 = firstNonWhitespaceIndex(lineText);
if (firstNonWhitespaceIndex2 !== -1) {
for (let i = 0; i < firstNonWhitespaceIndex2; i++) {
const charWidth = lineText.charCodeAt(i) === 9 ? tabCharacterWidth(wrappedTextIndentLength, tabSize) : 1;
wrappedTextIndentLength += charWidth;
}
const numberOfAdditionalTabs = wrappingIndent === 3 ? 2 : wrappingIndent === 2 ? 1 : 0;
for (let i = 0; i < numberOfAdditionalTabs; i++) {
const charWidth = tabCharacterWidth(wrappedTextIndentLength, tabSize);
wrappedTextIndentLength += charWidth;
}
if (wrappedTextIndentLength + columnsForFullWidthChar > firstLineBreakColumn) {
wrappedTextIndentLength = 0;
}
}
}
return wrappedTextIndentLength;
}
var MonospaceLineBreaksComputerFactory, WrappingCharacterClassifier, arrPool1, arrPool2;
var init_monospaceLineBreaksComputer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js"() {
init_strings();
init_characterClassifier();
init_textModelEvents();
init_modelLineProjectionData();
MonospaceLineBreaksComputerFactory = class _MonospaceLineBreaksComputerFactory {
static create(options2) {
return new _MonospaceLineBreaksComputerFactory(options2.get(
134
/* EditorOption.wordWrapBreakBeforeCharacters */
), options2.get(
133
/* EditorOption.wordWrapBreakAfterCharacters */
));
}
constructor(breakBeforeChars, breakAfterChars) {
this.classifier = new WrappingCharacterClassifier(breakBeforeChars, breakAfterChars);
}
createLineBreaksComputer(fontInfo, tabSize, wrappingColumn, wrappingIndent, wordBreak) {
const requests = [];
const injectedTexts = [];
const previousBreakingData = [];
return {
addRequest: (lineText, injectedText, previousLineBreakData) => {
requests.push(lineText);
injectedTexts.push(injectedText);
previousBreakingData.push(previousLineBreakData);
},
finalize: () => {
const columnsForFullWidthChar = fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth;
const result = [];
for (let i = 0, len = requests.length; i < len; i++) {
const injectedText = injectedTexts[i];
const previousLineBreakData = previousBreakingData[i];
if (previousLineBreakData && !previousLineBreakData.injectionOptions && !injectedText) {
result[i] = createLineBreaksFromPreviousLineBreaks(this.classifier, previousLineBreakData, requests[i], tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent, wordBreak);
} else {
result[i] = createLineBreaks2(this.classifier, requests[i], injectedText, tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent, wordBreak);
}
}
arrPool1.length = 0;
arrPool2.length = 0;
return result;
}
};
}
};
WrappingCharacterClassifier = class extends CharacterClassifier {
constructor(BREAK_BEFORE, BREAK_AFTER) {
super(
0
/* CharacterClass.NONE */
);
for (let i = 0; i < BREAK_BEFORE.length; i++) {
this.set(
BREAK_BEFORE.charCodeAt(i),
1
/* CharacterClass.BREAK_BEFORE */
);
}
for (let i = 0; i < BREAK_AFTER.length; i++) {
this.set(
BREAK_AFTER.charCodeAt(i),
2
/* CharacterClass.BREAK_AFTER */
);
}
}
get(charCode) {
if (charCode >= 0 && charCode < 256) {
return this._asciiMap[charCode];
} else {
if (charCode >= 12352 && charCode <= 12543 || charCode >= 13312 && charCode <= 19903 || charCode >= 19968 && charCode <= 40959) {
return 3;
}
return this._map.get(charCode) || this._defaultValue;
}
}
};
arrPool1 = [];
arrPool2 = [];
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/oneCursor.js
var Cursor;
var init_oneCursor = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/oneCursor.js"() {
init_cursorCommon();
init_position();
init_range();
init_selection();
Cursor = class _Cursor {
constructor(context) {
this._selTrackedRange = null;
this._trackSelection = true;
this._setState(context, new SingleCursorState(new Range(1, 1, 1, 1), 0, 0, new Position(1, 1), 0), new SingleCursorState(new Range(1, 1, 1, 1), 0, 0, new Position(1, 1), 0));
}
dispose(context) {
this._removeTrackedRange(context);
}
startTrackingSelection(context) {
this._trackSelection = true;
this._updateTrackedRange(context);
}
stopTrackingSelection(context) {
this._trackSelection = false;
this._removeTrackedRange(context);
}
_updateTrackedRange(context) {
if (!this._trackSelection) {
return;
}
this._selTrackedRange = context.model._setTrackedRange(
this._selTrackedRange,
this.modelState.selection,
0
/* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */
);
}
_removeTrackedRange(context) {
this._selTrackedRange = context.model._setTrackedRange(
this._selTrackedRange,
null,
0
/* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */
);
}
asCursorState() {
return new CursorState(this.modelState, this.viewState);
}
readSelectionFromMarkers(context) {
const range2 = context.model._getTrackedRange(this._selTrackedRange);
if (this.modelState.selection.isEmpty() && !range2.isEmpty()) {
return Selection.fromRange(range2.collapseToEnd(), this.modelState.selection.getDirection());
}
return Selection.fromRange(range2, this.modelState.selection.getDirection());
}
ensureValidState(context) {
this._setState(context, this.modelState, this.viewState);
}
setState(context, modelState, viewState) {
this._setState(context, modelState, viewState);
}
static _validatePositionWithCache(viewModel, position, cacheInput, cacheOutput) {
if (position.equals(cacheInput)) {
return cacheOutput;
}
return viewModel.normalizePosition(
position,
2
/* PositionAffinity.None */
);
}
static _validateViewState(viewModel, viewState) {
const position = viewState.position;
const sStartPosition = viewState.selectionStart.getStartPosition();
const sEndPosition = viewState.selectionStart.getEndPosition();
const validPosition = viewModel.normalizePosition(
position,
2
/* PositionAffinity.None */
);
const validSStartPosition = this._validatePositionWithCache(viewModel, sStartPosition, position, validPosition);
const validSEndPosition = this._validatePositionWithCache(viewModel, sEndPosition, sStartPosition, validSStartPosition);
if (position.equals(validPosition) && sStartPosition.equals(validSStartPosition) && sEndPosition.equals(validSEndPosition)) {
return viewState;
}
return new SingleCursorState(Range.fromPositions(validSStartPosition, validSEndPosition), viewState.selectionStartKind, viewState.selectionStartLeftoverVisibleColumns + sStartPosition.column - validSStartPosition.column, validPosition, viewState.leftoverVisibleColumns + position.column - validPosition.column);
}
_setState(context, modelState, viewState) {
if (viewState) {
viewState = _Cursor._validateViewState(context.viewModel, viewState);
}
if (!modelState) {
if (!viewState) {
return;
}
const selectionStart = context.model.validateRange(context.coordinatesConverter.convertViewRangeToModelRange(viewState.selectionStart));
const position = context.model.validatePosition(context.coordinatesConverter.convertViewPositionToModelPosition(viewState.position));
modelState = new SingleCursorState(selectionStart, viewState.selectionStartKind, viewState.selectionStartLeftoverVisibleColumns, position, viewState.leftoverVisibleColumns);
} else {
const selectionStart = context.model.validateRange(modelState.selectionStart);
const selectionStartLeftoverVisibleColumns = modelState.selectionStart.equalsRange(selectionStart) ? modelState.selectionStartLeftoverVisibleColumns : 0;
const position = context.model.validatePosition(modelState.position);
const leftoverVisibleColumns = modelState.position.equals(position) ? modelState.leftoverVisibleColumns : 0;
modelState = new SingleCursorState(selectionStart, modelState.selectionStartKind, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns);
}
if (!viewState) {
const viewSelectionStart1 = context.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelState.selectionStart.startLineNumber, modelState.selectionStart.startColumn));
const viewSelectionStart2 = context.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelState.selectionStart.endLineNumber, modelState.selectionStart.endColumn));
const viewSelectionStart = new Range(viewSelectionStart1.lineNumber, viewSelectionStart1.column, viewSelectionStart2.lineNumber, viewSelectionStart2.column);
const viewPosition = context.coordinatesConverter.convertModelPositionToViewPosition(modelState.position);
viewState = new SingleCursorState(viewSelectionStart, modelState.selectionStartKind, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
} else {
const viewSelectionStart = context.coordinatesConverter.validateViewRange(viewState.selectionStart, modelState.selectionStart);
const viewPosition = context.coordinatesConverter.validateViewPosition(viewState.position, modelState.position);
viewState = new SingleCursorState(viewSelectionStart, modelState.selectionStartKind, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
}
this.modelState = modelState;
this.viewState = viewState;
this._updateTrackedRange(context);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorCollection.js
var CursorCollection;
var init_cursorCollection = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorCollection.js"() {
init_arrays();
init_arraysFind();
init_cursorCommon();
init_oneCursor();
init_position();
init_range();
init_selection();
CursorCollection = class {
constructor(context) {
this.context = context;
this.cursors = [new Cursor(context)];
this.lastAddedCursorIndex = 0;
}
dispose() {
for (const cursor of this.cursors) {
cursor.dispose(this.context);
}
}
startTrackingSelections() {
for (const cursor of this.cursors) {
cursor.startTrackingSelection(this.context);
}
}
stopTrackingSelections() {
for (const cursor of this.cursors) {
cursor.stopTrackingSelection(this.context);
}
}
updateContext(context) {
this.context = context;
}
ensureValidState() {
for (const cursor of this.cursors) {
cursor.ensureValidState(this.context);
}
}
readSelectionFromMarkers() {
return this.cursors.map((c) => c.readSelectionFromMarkers(this.context));
}
getAll() {
return this.cursors.map((c) => c.asCursorState());
}
getViewPositions() {
return this.cursors.map((c) => c.viewState.position);
}
getTopMostViewPosition() {
return findFirstMin(this.cursors, compareBy((c) => c.viewState.position, Position.compare)).viewState.position;
}
getBottomMostViewPosition() {
return findLastMax(this.cursors, compareBy((c) => c.viewState.position, Position.compare)).viewState.position;
}
getSelections() {
return this.cursors.map((c) => c.modelState.selection);
}
getViewSelections() {
return this.cursors.map((c) => c.viewState.selection);
}
setSelections(selections) {
this.setStates(CursorState.fromModelSelections(selections));
}
getPrimaryCursor() {
return this.cursors[0].asCursorState();
}
setStates(states) {
if (states === null) {
return;
}
this.cursors[0].setState(this.context, states[0].modelState, states[0].viewState);
this._setSecondaryStates(states.slice(1));
}
/**
* Creates or disposes secondary cursors as necessary to match the number of `secondarySelections`.
*/
_setSecondaryStates(secondaryStates) {
const secondaryCursorsLength = this.cursors.length - 1;
const secondaryStatesLength = secondaryStates.length;
if (secondaryCursorsLength < secondaryStatesLength) {
const createCnt = secondaryStatesLength - secondaryCursorsLength;
for (let i = 0; i < createCnt; i++) {
this._addSecondaryCursor();
}
} else if (secondaryCursorsLength > secondaryStatesLength) {
const removeCnt = secondaryCursorsLength - secondaryStatesLength;
for (let i = 0; i < removeCnt; i++) {
this._removeSecondaryCursor(this.cursors.length - 2);
}
}
for (let i = 0; i < secondaryStatesLength; i++) {
this.cursors[i + 1].setState(this.context, secondaryStates[i].modelState, secondaryStates[i].viewState);
}
}
killSecondaryCursors() {
this._setSecondaryStates([]);
}
_addSecondaryCursor() {
this.cursors.push(new Cursor(this.context));
this.lastAddedCursorIndex = this.cursors.length - 1;
}
getLastAddedCursorIndex() {
if (this.cursors.length === 1 || this.lastAddedCursorIndex === 0) {
return 0;
}
return this.lastAddedCursorIndex;
}
_removeSecondaryCursor(removeIndex) {
if (this.lastAddedCursorIndex >= removeIndex + 1) {
this.lastAddedCursorIndex--;
}
this.cursors[removeIndex + 1].dispose(this.context);
this.cursors.splice(removeIndex + 1, 1);
}
normalize() {
if (this.cursors.length === 1) {
return;
}
const cursors = this.cursors.slice(0);
const sortedCursors = [];
for (let i = 0, len = cursors.length; i < len; i++) {
sortedCursors.push({
index: i,
selection: cursors[i].modelState.selection
});
}
sortedCursors.sort(compareBy((s) => s.selection, Range.compareRangesUsingStarts));
for (let sortedCursorIndex = 0; sortedCursorIndex < sortedCursors.length - 1; sortedCursorIndex++) {
const current = sortedCursors[sortedCursorIndex];
const next = sortedCursors[sortedCursorIndex + 1];
const currentSelection = current.selection;
const nextSelection = next.selection;
if (!this.context.cursorConfig.multiCursorMergeOverlapping) {
continue;
}
let shouldMergeCursors;
if (nextSelection.isEmpty() || currentSelection.isEmpty()) {
shouldMergeCursors = nextSelection.getStartPosition().isBeforeOrEqual(currentSelection.getEndPosition());
} else {
shouldMergeCursors = nextSelection.getStartPosition().isBefore(currentSelection.getEndPosition());
}
if (shouldMergeCursors) {
const winnerSortedCursorIndex = current.index < next.index ? sortedCursorIndex : sortedCursorIndex + 1;
const looserSortedCursorIndex = current.index < next.index ? sortedCursorIndex + 1 : sortedCursorIndex;
const looserIndex = sortedCursors[looserSortedCursorIndex].index;
const winnerIndex = sortedCursors[winnerSortedCursorIndex].index;
const looserSelection = sortedCursors[looserSortedCursorIndex].selection;
const winnerSelection = sortedCursors[winnerSortedCursorIndex].selection;
if (!looserSelection.equalsSelection(winnerSelection)) {
const resultingRange = looserSelection.plusRange(winnerSelection);
const looserSelectionIsLTR = looserSelection.selectionStartLineNumber === looserSelection.startLineNumber && looserSelection.selectionStartColumn === looserSelection.startColumn;
const winnerSelectionIsLTR = winnerSelection.selectionStartLineNumber === winnerSelection.startLineNumber && winnerSelection.selectionStartColumn === winnerSelection.startColumn;
let resultingSelectionIsLTR;
if (looserIndex === this.lastAddedCursorIndex) {
resultingSelectionIsLTR = looserSelectionIsLTR;
this.lastAddedCursorIndex = winnerIndex;
} else {
resultingSelectionIsLTR = winnerSelectionIsLTR;
}
let resultingSelection;
if (resultingSelectionIsLTR) {
resultingSelection = new Selection(resultingRange.startLineNumber, resultingRange.startColumn, resultingRange.endLineNumber, resultingRange.endColumn);
} else {
resultingSelection = new Selection(resultingRange.endLineNumber, resultingRange.endColumn, resultingRange.startLineNumber, resultingRange.startColumn);
}
sortedCursors[winnerSortedCursorIndex].selection = resultingSelection;
const resultingState = CursorState.fromModelSelection(resultingSelection);
cursors[winnerIndex].setState(this.context, resultingState.modelState, resultingState.viewState);
}
for (const sortedCursor of sortedCursors) {
if (sortedCursor.index > looserIndex) {
sortedCursor.index--;
}
}
cursors.splice(looserIndex, 1);
sortedCursors.splice(looserSortedCursorIndex, 1);
this._removeSecondaryCursor(looserIndex - 1);
sortedCursorIndex--;
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorContext.js
var CursorContext;
var init_cursorContext = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursorContext.js"() {
CursorContext = class {
constructor(model, viewModel, coordinatesConverter, cursorConfig) {
this._cursorContextBrand = void 0;
this.model = model;
this.viewModel = viewModel;
this.coordinatesConverter = coordinatesConverter;
this.cursorConfig = cursorConfig;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewEvents.js
var ViewCompositionStartEvent, ViewCompositionEndEvent, ViewConfigurationChangedEvent, ViewCursorStateChangedEvent, ViewDecorationsChangedEvent, ViewFlushedEvent, ViewFocusChangedEvent, ViewLanguageConfigurationEvent, ViewLineMappingChangedEvent, ViewLinesChangedEvent, ViewLinesDeletedEvent, ViewLinesInsertedEvent, ViewRevealRangeRequestEvent, ViewScrollChangedEvent, ViewThemeChangedEvent, ViewTokensChangedEvent, ViewTokensColorsChangedEvent, ViewZonesChangedEvent;
var init_viewEvents = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewEvents.js"() {
ViewCompositionStartEvent = class {
constructor() {
this.type = 0;
}
};
ViewCompositionEndEvent = class {
constructor() {
this.type = 1;
}
};
ViewConfigurationChangedEvent = class {
constructor(source) {
this.type = 2;
this._source = source;
}
hasChanged(id) {
return this._source.hasChanged(id);
}
};
ViewCursorStateChangedEvent = class {
constructor(selections, modelSelections, reason) {
this.selections = selections;
this.modelSelections = modelSelections;
this.reason = reason;
this.type = 3;
}
};
ViewDecorationsChangedEvent = class {
constructor(source) {
this.type = 4;
if (source) {
this.affectsMinimap = source.affectsMinimap;
this.affectsOverviewRuler = source.affectsOverviewRuler;
this.affectsGlyphMargin = source.affectsGlyphMargin;
this.affectsLineNumber = source.affectsLineNumber;
} else {
this.affectsMinimap = true;
this.affectsOverviewRuler = true;
this.affectsGlyphMargin = true;
this.affectsLineNumber = true;
}
}
};
ViewFlushedEvent = class {
constructor() {
this.type = 5;
}
};
ViewFocusChangedEvent = class {
constructor(isFocused2) {
this.type = 6;
this.isFocused = isFocused2;
}
};
ViewLanguageConfigurationEvent = class {
constructor() {
this.type = 7;
}
};
ViewLineMappingChangedEvent = class {
constructor() {
this.type = 8;
}
};
ViewLinesChangedEvent = class {
constructor(fromLineNumber, count) {
this.fromLineNumber = fromLineNumber;
this.count = count;
this.type = 9;
}
};
ViewLinesDeletedEvent = class {
constructor(fromLineNumber, toLineNumber) {
this.type = 10;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
};
ViewLinesInsertedEvent = class {
constructor(fromLineNumber, toLineNumber) {
this.type = 11;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
};
ViewRevealRangeRequestEvent = class {
constructor(source, minimalReveal, range2, selections, verticalType, revealHorizontal, scrollType) {
this.source = source;
this.minimalReveal = minimalReveal;
this.range = range2;
this.selections = selections;
this.verticalType = verticalType;
this.revealHorizontal = revealHorizontal;
this.scrollType = scrollType;
this.type = 12;
}
};
ViewScrollChangedEvent = class {
constructor(source) {
this.type = 13;
this.scrollWidth = source.scrollWidth;
this.scrollLeft = source.scrollLeft;
this.scrollHeight = source.scrollHeight;
this.scrollTop = source.scrollTop;
this.scrollWidthChanged = source.scrollWidthChanged;
this.scrollLeftChanged = source.scrollLeftChanged;
this.scrollHeightChanged = source.scrollHeightChanged;
this.scrollTopChanged = source.scrollTopChanged;
}
};
ViewThemeChangedEvent = class {
constructor(theme) {
this.theme = theme;
this.type = 14;
}
};
ViewTokensChangedEvent = class {
constructor(ranges) {
this.type = 15;
this.ranges = ranges;
}
};
ViewTokensColorsChangedEvent = class {
constructor() {
this.type = 16;
}
};
ViewZonesChangedEvent = class {
constructor() {
this.type = 17;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModelEventDispatcher.js
var ViewModelEventDispatcher, ViewModelEventsCollector, ContentSizeChangedEvent, FocusChangedEvent, ScrollChangedEvent, ViewZonesChangedEvent2, HiddenAreasChangedEvent, CursorStateChangedEvent, ReadOnlyEditAttemptEvent, ModelDecorationsChangedEvent, ModelLanguageChangedEvent, ModelLanguageConfigurationChangedEvent, ModelContentChangedEvent, ModelOptionsChangedEvent, ModelTokensChangedEvent;
var init_viewModelEventDispatcher = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModelEventDispatcher.js"() {
init_event();
init_lifecycle();
ViewModelEventDispatcher = class extends Disposable {
constructor() {
super();
this._onEvent = this._register(new Emitter());
this.onEvent = this._onEvent.event;
this._eventHandlers = [];
this._viewEventQueue = null;
this._isConsumingViewEventQueue = false;
this._collector = null;
this._collectorCnt = 0;
this._outgoingEvents = [];
}
emitOutgoingEvent(e) {
this._addOutgoingEvent(e);
this._emitOutgoingEvents();
}
_addOutgoingEvent(e) {
for (let i = 0, len = this._outgoingEvents.length; i < len; i++) {
const mergeResult = this._outgoingEvents[i].kind === e.kind ? this._outgoingEvents[i].attemptToMerge(e) : null;
if (mergeResult) {
this._outgoingEvents[i] = mergeResult;
return;
}
}
this._outgoingEvents.push(e);
}
_emitOutgoingEvents() {
while (this._outgoingEvents.length > 0) {
if (this._collector || this._isConsumingViewEventQueue) {
return;
}
const event = this._outgoingEvents.shift();
if (event.isNoOp()) {
continue;
}
this._onEvent.fire(event);
}
}
addViewEventHandler(eventHandler) {
for (let i = 0, len = this._eventHandlers.length; i < len; i++) {
if (this._eventHandlers[i] === eventHandler) {
console.warn("Detected duplicate listener in ViewEventDispatcher", eventHandler);
}
}
this._eventHandlers.push(eventHandler);
}
removeViewEventHandler(eventHandler) {
for (let i = 0; i < this._eventHandlers.length; i++) {
if (this._eventHandlers[i] === eventHandler) {
this._eventHandlers.splice(i, 1);
break;
}
}
}
beginEmitViewEvents() {
this._collectorCnt++;
if (this._collectorCnt === 1) {
this._collector = new ViewModelEventsCollector();
}
return this._collector;
}
endEmitViewEvents() {
this._collectorCnt--;
if (this._collectorCnt === 0) {
const outgoingEvents = this._collector.outgoingEvents;
const viewEvents = this._collector.viewEvents;
this._collector = null;
for (const outgoingEvent of outgoingEvents) {
this._addOutgoingEvent(outgoingEvent);
}
if (viewEvents.length > 0) {
this._emitMany(viewEvents);
}
}
this._emitOutgoingEvents();
}
emitSingleViewEvent(event) {
try {
const eventsCollector = this.beginEmitViewEvents();
eventsCollector.emitViewEvent(event);
} finally {
this.endEmitViewEvents();
}
}
_emitMany(events) {
if (this._viewEventQueue) {
this._viewEventQueue = this._viewEventQueue.concat(events);
} else {
this._viewEventQueue = events;
}
if (!this._isConsumingViewEventQueue) {
this._consumeViewEventQueue();
}
}
_consumeViewEventQueue() {
try {
this._isConsumingViewEventQueue = true;
this._doConsumeQueue();
} finally {
this._isConsumingViewEventQueue = false;
}
}
_doConsumeQueue() {
while (this._viewEventQueue) {
const events = this._viewEventQueue;
this._viewEventQueue = null;
const eventHandlers = this._eventHandlers.slice(0);
for (const eventHandler of eventHandlers) {
eventHandler.handleEvents(events);
}
}
}
};
ViewModelEventsCollector = class {
constructor() {
this.viewEvents = [];
this.outgoingEvents = [];
}
emitViewEvent(event) {
this.viewEvents.push(event);
}
emitOutgoingEvent(e) {
this.outgoingEvents.push(e);
}
};
ContentSizeChangedEvent = class _ContentSizeChangedEvent {
constructor(oldContentWidth, oldContentHeight, contentWidth, contentHeight) {
this.kind = 0;
this._oldContentWidth = oldContentWidth;
this._oldContentHeight = oldContentHeight;
this.contentWidth = contentWidth;
this.contentHeight = contentHeight;
this.contentWidthChanged = this._oldContentWidth !== this.contentWidth;
this.contentHeightChanged = this._oldContentHeight !== this.contentHeight;
}
isNoOp() {
return !this.contentWidthChanged && !this.contentHeightChanged;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return new _ContentSizeChangedEvent(this._oldContentWidth, this._oldContentHeight, other.contentWidth, other.contentHeight);
}
};
FocusChangedEvent = class _FocusChangedEvent {
constructor(oldHasFocus, hasFocus) {
this.kind = 1;
this.oldHasFocus = oldHasFocus;
this.hasFocus = hasFocus;
}
isNoOp() {
return this.oldHasFocus === this.hasFocus;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return new _FocusChangedEvent(this.oldHasFocus, other.hasFocus);
}
};
ScrollChangedEvent = class _ScrollChangedEvent {
constructor(oldScrollWidth, oldScrollLeft, oldScrollHeight, oldScrollTop, scrollWidth, scrollLeft, scrollHeight, scrollTop) {
this.kind = 2;
this._oldScrollWidth = oldScrollWidth;
this._oldScrollLeft = oldScrollLeft;
this._oldScrollHeight = oldScrollHeight;
this._oldScrollTop = oldScrollTop;
this.scrollWidth = scrollWidth;
this.scrollLeft = scrollLeft;
this.scrollHeight = scrollHeight;
this.scrollTop = scrollTop;
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(other) {
if (other.kind !== this.kind) {
return null;
}
return new _ScrollChangedEvent(this._oldScrollWidth, this._oldScrollLeft, this._oldScrollHeight, this._oldScrollTop, other.scrollWidth, other.scrollLeft, other.scrollHeight, other.scrollTop);
}
};
ViewZonesChangedEvent2 = class {
constructor() {
this.kind = 3;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return this;
}
};
HiddenAreasChangedEvent = class {
constructor() {
this.kind = 4;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return this;
}
};
CursorStateChangedEvent = class _CursorStateChangedEvent {
constructor(oldSelections, selections, oldModelVersionId, modelVersionId, source, reason, reachedMaxCursorCount) {
this.kind = 6;
this.oldSelections = oldSelections;
this.selections = selections;
this.oldModelVersionId = oldModelVersionId;
this.modelVersionId = modelVersionId;
this.source = source;
this.reason = reason;
this.reachedMaxCursorCount = reachedMaxCursorCount;
}
static _selectionsAreEqual(a3, b) {
if (!a3 && !b) {
return true;
}
if (!a3 || !b) {
return false;
}
const aLen = a3.length;
const bLen = b.length;
if (aLen !== bLen) {
return false;
}
for (let i = 0; i < aLen; i++) {
if (!a3[i].equalsSelection(b[i])) {
return false;
}
}
return true;
}
isNoOp() {
return _CursorStateChangedEvent._selectionsAreEqual(this.oldSelections, this.selections) && this.oldModelVersionId === this.modelVersionId;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return new _CursorStateChangedEvent(this.oldSelections, other.selections, this.oldModelVersionId, other.modelVersionId, other.source, other.reason, this.reachedMaxCursorCount || other.reachedMaxCursorCount);
}
};
ReadOnlyEditAttemptEvent = class {
constructor() {
this.kind = 5;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
if (other.kind !== this.kind) {
return null;
}
return this;
}
};
ModelDecorationsChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 7;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
ModelLanguageChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 8;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
ModelLanguageConfigurationChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 9;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
ModelContentChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 10;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
ModelOptionsChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 11;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
ModelTokensChangedEvent = class {
constructor(event) {
this.event = event;
this.kind = 12;
}
isNoOp() {
return false;
}
attemptToMerge(other) {
return null;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/cursor/cursor.js
var CursorsController, CursorModelState, AutoClosedAction, CommandExecutor, CompositionLineState, CompositionState;
var init_cursor = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/cursor/cursor.js"() {
init_errors();
init_strings();
init_cursorCollection();
init_cursorCommon();
init_cursorContext();
init_cursorDeleteOperations();
init_cursorTypeOperations();
init_range();
init_selection();
init_textModelEvents();
init_viewEvents();
init_lifecycle();
init_viewModelEventDispatcher();
CursorsController = class extends Disposable {
constructor(model, viewModel, coordinatesConverter, cursorConfig) {
super();
this._model = model;
this._knownModelVersionId = this._model.getVersionId();
this._viewModel = viewModel;
this._coordinatesConverter = coordinatesConverter;
this.context = new CursorContext(this._model, this._viewModel, this._coordinatesConverter, cursorConfig);
this._cursors = new CursorCollection(this.context);
this._hasFocus = false;
this._isHandling = false;
this._compositionState = null;
this._columnSelectData = null;
this._autoClosedActions = [];
this._prevEditOperationType = 0;
}
dispose() {
this._cursors.dispose();
this._autoClosedActions = dispose(this._autoClosedActions);
super.dispose();
}
updateConfiguration(cursorConfig) {
this.context = new CursorContext(this._model, this._viewModel, this._coordinatesConverter, cursorConfig);
this._cursors.updateContext(this.context);
}
onLineMappingChanged(eventsCollector) {
if (this._knownModelVersionId !== this._model.getVersionId()) {
return;
}
this.setStates(eventsCollector, "viewModel", 0, this.getCursorStates());
}
setHasFocus(hasFocus) {
this._hasFocus = hasFocus;
}
_validateAutoClosedActions() {
if (this._autoClosedActions.length > 0) {
const selections = this._cursors.getSelections();
for (let i = 0; i < this._autoClosedActions.length; i++) {
const autoClosedAction = this._autoClosedActions[i];
if (!autoClosedAction.isValid(selections)) {
autoClosedAction.dispose();
this._autoClosedActions.splice(i, 1);
i--;
}
}
}
}
// ------ some getters/setters
getPrimaryCursorState() {
return this._cursors.getPrimaryCursor();
}
getLastAddedCursorIndex() {
return this._cursors.getLastAddedCursorIndex();
}
getCursorStates() {
return this._cursors.getAll();
}
setStates(eventsCollector, source, reason, states) {
let reachedMaxCursorCount = false;
const multiCursorLimit = this.context.cursorConfig.multiCursorLimit;
if (states !== null && states.length > multiCursorLimit) {
states = states.slice(0, multiCursorLimit);
reachedMaxCursorCount = true;
}
const oldState = CursorModelState.from(this._model, this);
this._cursors.setStates(states);
this._cursors.normalize();
this._columnSelectData = null;
this._validateAutoClosedActions();
return this._emitStateChangedIfNecessary(eventsCollector, source, reason, oldState, reachedMaxCursorCount);
}
setCursorColumnSelectData(columnSelectData) {
this._columnSelectData = columnSelectData;
}
revealAll(eventsCollector, source, minimalReveal, verticalType, revealHorizontal, scrollType) {
const viewPositions = this._cursors.getViewPositions();
let revealViewRange = null;
let revealViewSelections = null;
if (viewPositions.length > 1) {
revealViewSelections = this._cursors.getViewSelections();
} else {
revealViewRange = Range.fromPositions(viewPositions[0], viewPositions[0]);
}
eventsCollector.emitViewEvent(new ViewRevealRangeRequestEvent(source, minimalReveal, revealViewRange, revealViewSelections, verticalType, revealHorizontal, scrollType));
}
revealPrimary(eventsCollector, source, minimalReveal, verticalType, revealHorizontal, scrollType) {
const primaryCursor = this._cursors.getPrimaryCursor();
const revealViewSelections = [primaryCursor.viewState.selection];
eventsCollector.emitViewEvent(new ViewRevealRangeRequestEvent(source, minimalReveal, null, revealViewSelections, verticalType, revealHorizontal, scrollType));
}
saveState() {
const result = [];
const selections = this._cursors.getSelections();
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
result.push({
inSelectionMode: !selection.isEmpty(),
selectionStart: {
lineNumber: selection.selectionStartLineNumber,
column: selection.selectionStartColumn
},
position: {
lineNumber: selection.positionLineNumber,
column: selection.positionColumn
}
});
}
return result;
}
restoreState(eventsCollector, states) {
const desiredSelections = [];
for (let i = 0, len = states.length; i < len; i++) {
const state = states[i];
let positionLineNumber = 1;
let positionColumn = 1;
if (state.position && state.position.lineNumber) {
positionLineNumber = state.position.lineNumber;
}
if (state.position && state.position.column) {
positionColumn = state.position.column;
}
let selectionStartLineNumber = positionLineNumber;
let selectionStartColumn = positionColumn;
if (state.selectionStart && state.selectionStart.lineNumber) {
selectionStartLineNumber = state.selectionStart.lineNumber;
}
if (state.selectionStart && state.selectionStart.column) {
selectionStartColumn = state.selectionStart.column;
}
desiredSelections.push({
selectionStartLineNumber,
selectionStartColumn,
positionLineNumber,
positionColumn
});
}
this.setStates(eventsCollector, "restoreState", 0, CursorState.fromModelSelections(desiredSelections));
this.revealAll(
eventsCollector,
"restoreState",
false,
0,
true,
1
/* editorCommon.ScrollType.Immediate */
);
}
onModelContentChanged(eventsCollector, event) {
if (event instanceof ModelInjectedTextChangedEvent) {
if (this._isHandling) {
return;
}
this._isHandling = true;
try {
this.setStates(eventsCollector, "modelChange", 0, this.getCursorStates());
} finally {
this._isHandling = false;
}
} else {
const e = event.rawContentChangedEvent;
this._knownModelVersionId = e.versionId;
if (this._isHandling) {
return;
}
const hadFlushEvent = e.containsEvent(
1
/* RawContentChangedType.Flush */
);
this._prevEditOperationType = 0;
if (hadFlushEvent) {
this._cursors.dispose();
this._cursors = new CursorCollection(this.context);
this._validateAutoClosedActions();
this._emitStateChangedIfNecessary(eventsCollector, "model", 1, null, false);
} else {
if (this._hasFocus && e.resultingSelection && e.resultingSelection.length > 0) {
const cursorState = CursorState.fromModelSelections(e.resultingSelection);
if (this.setStates(eventsCollector, "modelChange", e.isUndoing ? 5 : e.isRedoing ? 6 : 2, cursorState)) {
this.revealAll(
eventsCollector,
"modelChange",
false,
0,
true,
0
/* editorCommon.ScrollType.Smooth */
);
}
} else {
const selectionsFromMarkers = this._cursors.readSelectionFromMarkers();
this.setStates(eventsCollector, "modelChange", 2, CursorState.fromModelSelections(selectionsFromMarkers));
}
}
}
}
getSelection() {
return this._cursors.getPrimaryCursor().modelState.selection;
}
getTopMostViewPosition() {
return this._cursors.getTopMostViewPosition();
}
getBottomMostViewPosition() {
return this._cursors.getBottomMostViewPosition();
}
getCursorColumnSelectData() {
if (this._columnSelectData) {
return this._columnSelectData;
}
const primaryCursor = this._cursors.getPrimaryCursor();
const viewSelectionStart = primaryCursor.viewState.selectionStart.getStartPosition();
const viewPosition = primaryCursor.viewState.position;
return {
isReal: false,
fromViewLineNumber: viewSelectionStart.lineNumber,
fromViewVisualColumn: this.context.cursorConfig.visibleColumnFromColumn(this._viewModel, viewSelectionStart),
toViewLineNumber: viewPosition.lineNumber,
toViewVisualColumn: this.context.cursorConfig.visibleColumnFromColumn(this._viewModel, viewPosition)
};
}
getSelections() {
return this._cursors.getSelections();
}
setSelections(eventsCollector, source, selections, reason) {
this.setStates(eventsCollector, source, reason, CursorState.fromModelSelections(selections));
}
getPrevEditOperationType() {
return this._prevEditOperationType;
}
setPrevEditOperationType(type) {
this._prevEditOperationType = type;
}
// ------ auxiliary handling logic
_pushAutoClosedAction(autoClosedCharactersRanges, autoClosedEnclosingRanges) {
const autoClosedCharactersDeltaDecorations = [];
const autoClosedEnclosingDeltaDecorations = [];
for (let i = 0, len = autoClosedCharactersRanges.length; i < len; i++) {
autoClosedCharactersDeltaDecorations.push({
range: autoClosedCharactersRanges[i],
options: {
description: "auto-closed-character",
inlineClassName: "auto-closed-character",
stickiness: 1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
}
});
autoClosedEnclosingDeltaDecorations.push({
range: autoClosedEnclosingRanges[i],
options: {
description: "auto-closed-enclosing",
stickiness: 1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
}
});
}
const autoClosedCharactersDecorations = this._model.deltaDecorations([], autoClosedCharactersDeltaDecorations);
const autoClosedEnclosingDecorations = this._model.deltaDecorations([], autoClosedEnclosingDeltaDecorations);
this._autoClosedActions.push(new AutoClosedAction(this._model, autoClosedCharactersDecorations, autoClosedEnclosingDecorations));
}
_executeEditOperation(opResult) {
if (!opResult) {
return;
}
if (opResult.shouldPushStackElementBefore) {
this._model.pushStackElement();
}
const result = CommandExecutor.executeCommands(this._model, this._cursors.getSelections(), opResult.commands);
if (result) {
this._interpretCommandResult(result);
const autoClosedCharactersRanges = [];
const autoClosedEnclosingRanges = [];
for (let i = 0; i < opResult.commands.length; i++) {
const command = opResult.commands[i];
if (command instanceof TypeWithAutoClosingCommand && command.enclosingRange && command.closeCharacterRange) {
autoClosedCharactersRanges.push(command.closeCharacterRange);
autoClosedEnclosingRanges.push(command.enclosingRange);
}
}
if (autoClosedCharactersRanges.length > 0) {
this._pushAutoClosedAction(autoClosedCharactersRanges, autoClosedEnclosingRanges);
}
this._prevEditOperationType = opResult.type;
}
if (opResult.shouldPushStackElementAfter) {
this._model.pushStackElement();
}
}
_interpretCommandResult(cursorState) {
if (!cursorState || cursorState.length === 0) {
cursorState = this._cursors.readSelectionFromMarkers();
}
this._columnSelectData = null;
this._cursors.setSelections(cursorState);
this._cursors.normalize();
}
// -----------------------------------------------------------------------------------------------------------
// ----- emitting events
_emitStateChangedIfNecessary(eventsCollector, source, reason, oldState, reachedMaxCursorCount) {
const newState = CursorModelState.from(this._model, this);
if (newState.equals(oldState)) {
return false;
}
const selections = this._cursors.getSelections();
const viewSelections = this._cursors.getViewSelections();
eventsCollector.emitViewEvent(new ViewCursorStateChangedEvent(viewSelections, selections, reason));
if (!oldState || oldState.cursorState.length !== newState.cursorState.length || newState.cursorState.some((newCursorState, i) => !newCursorState.modelState.equals(oldState.cursorState[i].modelState))) {
const oldSelections = oldState ? oldState.cursorState.map((s) => s.modelState.selection) : null;
const oldModelVersionId = oldState ? oldState.modelVersionId : 0;
eventsCollector.emitOutgoingEvent(new CursorStateChangedEvent(oldSelections, selections, oldModelVersionId, newState.modelVersionId, source || "keyboard", reason, reachedMaxCursorCount));
}
return true;
}
// -----------------------------------------------------------------------------------------------------------
// ----- handlers beyond this point
_findAutoClosingPairs(edits) {
if (!edits.length) {
return null;
}
const indices = [];
for (let i = 0, len = edits.length; i < len; i++) {
const edit = edits[i];
if (!edit.text || edit.text.indexOf("\n") >= 0) {
return null;
}
const m = edit.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);
if (!m) {
return null;
}
const closeChar = m[1];
const autoClosingPairsCandidates = this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(closeChar);
if (!autoClosingPairsCandidates || autoClosingPairsCandidates.length !== 1) {
return null;
}
const openChar = autoClosingPairsCandidates[0].open;
const closeCharIndex = edit.text.length - m[2].length - 1;
const openCharIndex = edit.text.lastIndexOf(openChar, closeCharIndex - 1);
if (openCharIndex === -1) {
return null;
}
indices.push([openCharIndex, closeCharIndex]);
}
return indices;
}
executeEdits(eventsCollector, source, edits, cursorStateComputer) {
let autoClosingIndices = null;
if (source === "snippet") {
autoClosingIndices = this._findAutoClosingPairs(edits);
}
if (autoClosingIndices) {
edits[0]._isTracked = true;
}
const autoClosedCharactersRanges = [];
const autoClosedEnclosingRanges = [];
const selections = this._model.pushEditOperations(this.getSelections(), edits, (undoEdits) => {
if (autoClosingIndices) {
for (let i = 0, len = autoClosingIndices.length; i < len; i++) {
const [openCharInnerIndex, closeCharInnerIndex] = autoClosingIndices[i];
const undoEdit = undoEdits[i];
const lineNumber = undoEdit.range.startLineNumber;
const openCharIndex = undoEdit.range.startColumn - 1 + openCharInnerIndex;
const closeCharIndex = undoEdit.range.startColumn - 1 + closeCharInnerIndex;
autoClosedCharactersRanges.push(new Range(lineNumber, closeCharIndex + 1, lineNumber, closeCharIndex + 2));
autoClosedEnclosingRanges.push(new Range(lineNumber, openCharIndex + 1, lineNumber, closeCharIndex + 2));
}
}
const selections2 = cursorStateComputer(undoEdits);
if (selections2) {
this._isHandling = true;
}
return selections2;
});
if (selections) {
this._isHandling = false;
this.setSelections(
eventsCollector,
source,
selections,
0
/* CursorChangeReason.NotSet */
);
}
if (autoClosedCharactersRanges.length > 0) {
this._pushAutoClosedAction(autoClosedCharactersRanges, autoClosedEnclosingRanges);
}
}
_executeEdit(callback, eventsCollector, source, cursorChangeReason = 0) {
if (this.context.cursorConfig.readOnly) {
return;
}
const oldState = CursorModelState.from(this._model, this);
this._cursors.stopTrackingSelections();
this._isHandling = true;
try {
this._cursors.ensureValidState();
callback();
} catch (err) {
onUnexpectedError(err);
}
this._isHandling = false;
this._cursors.startTrackingSelections();
this._validateAutoClosedActions();
if (this._emitStateChangedIfNecessary(eventsCollector, source, cursorChangeReason, oldState, false)) {
this.revealAll(
eventsCollector,
source,
false,
0,
true,
0
/* editorCommon.ScrollType.Smooth */
);
}
}
getAutoClosedCharacters() {
return AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
}
startComposition(eventsCollector) {
this._compositionState = new CompositionState(this._model, this.getSelections());
}
endComposition(eventsCollector, source) {
const compositionOutcome = this._compositionState ? this._compositionState.deduceOutcome(this._model, this.getSelections()) : null;
this._compositionState = null;
this._executeEdit(() => {
if (source === "keyboard") {
this._executeEditOperation(TypeOperations.compositionEndWithInterceptors(this._prevEditOperationType, this.context.cursorConfig, this._model, compositionOutcome, this.getSelections(), this.getAutoClosedCharacters()));
}
}, eventsCollector, source);
}
type(eventsCollector, text2, source) {
this._executeEdit(() => {
if (source === "keyboard") {
const len = text2.length;
let offset = 0;
while (offset < len) {
const charLength = nextCharLength(text2, offset);
const chr = text2.substr(offset, charLength);
this._executeEditOperation(TypeOperations.typeWithInterceptors(!!this._compositionState, this._prevEditOperationType, this.context.cursorConfig, this._model, this.getSelections(), this.getAutoClosedCharacters(), chr));
offset += charLength;
}
} else {
this._executeEditOperation(TypeOperations.typeWithoutInterceptors(this._prevEditOperationType, this.context.cursorConfig, this._model, this.getSelections(), text2));
}
}, eventsCollector, source);
}
compositionType(eventsCollector, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta, source) {
if (text2.length === 0 && replacePrevCharCnt === 0 && replaceNextCharCnt === 0) {
if (positionDelta !== 0) {
const newSelections = this.getSelections().map((selection) => {
const position = selection.getPosition();
return new Selection(position.lineNumber, position.column + positionDelta, position.lineNumber, position.column + positionDelta);
});
this.setSelections(
eventsCollector,
source,
newSelections,
0
/* CursorChangeReason.NotSet */
);
}
return;
}
this._executeEdit(() => {
this._executeEditOperation(TypeOperations.compositionType(this._prevEditOperationType, this.context.cursorConfig, this._model, this.getSelections(), text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta));
}, eventsCollector, source);
}
paste(eventsCollector, text2, pasteOnNewLine, multicursorText, source) {
this._executeEdit(
() => {
this._executeEditOperation(TypeOperations.paste(this.context.cursorConfig, this._model, this.getSelections(), text2, pasteOnNewLine, multicursorText || []));
},
eventsCollector,
source,
4
/* CursorChangeReason.Paste */
);
}
cut(eventsCollector, source) {
this._executeEdit(() => {
this._executeEditOperation(DeleteOperations.cut(this.context.cursorConfig, this._model, this.getSelections()));
}, eventsCollector, source);
}
executeCommand(eventsCollector, command, source) {
this._executeEdit(() => {
this._cursors.killSecondaryCursors();
this._executeEditOperation(new EditOperationResult(0, [command], {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: false
}));
}, eventsCollector, source);
}
executeCommands(eventsCollector, commands, source) {
this._executeEdit(() => {
this._executeEditOperation(new EditOperationResult(0, commands, {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: false
}));
}, eventsCollector, source);
}
};
CursorModelState = class _CursorModelState {
static from(model, cursor) {
return new _CursorModelState(model.getVersionId(), cursor.getCursorStates());
}
constructor(modelVersionId, cursorState) {
this.modelVersionId = modelVersionId;
this.cursorState = cursorState;
}
equals(other) {
if (!other) {
return false;
}
if (this.modelVersionId !== other.modelVersionId) {
return false;
}
if (this.cursorState.length !== other.cursorState.length) {
return false;
}
for (let i = 0, len = this.cursorState.length; i < len; i++) {
if (!this.cursorState[i].equals(other.cursorState[i])) {
return false;
}
}
return true;
}
};
AutoClosedAction = class {
static getAllAutoClosedCharacters(autoClosedActions) {
let autoClosedCharacters = [];
for (const autoClosedAction of autoClosedActions) {
autoClosedCharacters = autoClosedCharacters.concat(autoClosedAction.getAutoClosedCharactersRanges());
}
return autoClosedCharacters;
}
constructor(model, autoClosedCharactersDecorations, autoClosedEnclosingDecorations) {
this._model = model;
this._autoClosedCharactersDecorations = autoClosedCharactersDecorations;
this._autoClosedEnclosingDecorations = autoClosedEnclosingDecorations;
}
dispose() {
this._autoClosedCharactersDecorations = this._model.deltaDecorations(this._autoClosedCharactersDecorations, []);
this._autoClosedEnclosingDecorations = this._model.deltaDecorations(this._autoClosedEnclosingDecorations, []);
}
getAutoClosedCharactersRanges() {
const result = [];
for (let i = 0; i < this._autoClosedCharactersDecorations.length; i++) {
const decorationRange = this._model.getDecorationRange(this._autoClosedCharactersDecorations[i]);
if (decorationRange) {
result.push(decorationRange);
}
}
return result;
}
isValid(selections) {
const enclosingRanges = [];
for (let i = 0; i < this._autoClosedEnclosingDecorations.length; i++) {
const decorationRange = this._model.getDecorationRange(this._autoClosedEnclosingDecorations[i]);
if (decorationRange) {
enclosingRanges.push(decorationRange);
if (decorationRange.startLineNumber !== decorationRange.endLineNumber) {
return false;
}
}
}
enclosingRanges.sort(Range.compareRangesUsingStarts);
selections.sort(Range.compareRangesUsingStarts);
for (let i = 0; i < selections.length; i++) {
if (i >= enclosingRanges.length) {
return false;
}
if (!enclosingRanges[i].strictContainsRange(selections[i])) {
return false;
}
}
return true;
}
};
CommandExecutor = class {
static executeCommands(model, selectionsBefore, commands) {
const ctx = {
model,
selectionsBefore,
trackedRanges: [],
trackedRangesDirection: []
};
const result = this._innerExecuteCommands(ctx, commands);
for (let i = 0, len = ctx.trackedRanges.length; i < len; i++) {
ctx.model._setTrackedRange(
ctx.trackedRanges[i],
null,
0
/* TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges */
);
}
return result;
}
static _innerExecuteCommands(ctx, commands) {
if (this._arrayIsEmpty(commands)) {
return null;
}
const commandsData = this._getEditOperations(ctx, commands);
if (commandsData.operations.length === 0) {
return null;
}
const rawOperations = commandsData.operations;
const loserCursorsMap = this._getLoserCursorMap(rawOperations);
if (loserCursorsMap.hasOwnProperty("0")) {
console.warn("Ignoring commands");
return null;
}
const filteredOperations = [];
for (let i = 0, len = rawOperations.length; i < len; i++) {
if (!loserCursorsMap.hasOwnProperty(rawOperations[i].identifier.major.toString())) {
filteredOperations.push(rawOperations[i]);
}
}
if (commandsData.hadTrackedEditOperation && filteredOperations.length > 0) {
filteredOperations[0]._isTracked = true;
}
let selectionsAfter = ctx.model.pushEditOperations(ctx.selectionsBefore, filteredOperations, (inverseEditOperations) => {
const groupedInverseEditOperations = [];
for (let i = 0; i < ctx.selectionsBefore.length; i++) {
groupedInverseEditOperations[i] = [];
}
for (const op of inverseEditOperations) {
if (!op.identifier) {
continue;
}
groupedInverseEditOperations[op.identifier.major].push(op);
}
const minorBasedSorter = (a3, b) => {
return a3.identifier.minor - b.identifier.minor;
};
const cursorSelections = [];
for (let i = 0; i < ctx.selectionsBefore.length; i++) {
if (groupedInverseEditOperations[i].length > 0) {
groupedInverseEditOperations[i].sort(minorBasedSorter);
cursorSelections[i] = commands[i].computeCursorState(ctx.model, {
getInverseEditOperations: () => {
return groupedInverseEditOperations[i];
},
getTrackedSelection: (id) => {
const idx = parseInt(id, 10);
const range2 = ctx.model._getTrackedRange(ctx.trackedRanges[idx]);
if (ctx.trackedRangesDirection[idx] === 0) {
return new Selection(range2.startLineNumber, range2.startColumn, range2.endLineNumber, range2.endColumn);
}
return new Selection(range2.endLineNumber, range2.endColumn, range2.startLineNumber, range2.startColumn);
}
});
} else {
cursorSelections[i] = ctx.selectionsBefore[i];
}
}
return cursorSelections;
});
if (!selectionsAfter) {
selectionsAfter = ctx.selectionsBefore;
}
const losingCursors = [];
for (const losingCursorIndex in loserCursorsMap) {
if (loserCursorsMap.hasOwnProperty(losingCursorIndex)) {
losingCursors.push(parseInt(losingCursorIndex, 10));
}
}
losingCursors.sort((a3, b) => {
return b - a3;
});
for (const losingCursor of losingCursors) {
selectionsAfter.splice(losingCursor, 1);
}
return selectionsAfter;
}
static _arrayIsEmpty(commands) {
for (let i = 0, len = commands.length; i < len; i++) {
if (commands[i]) {
return false;
}
}
return true;
}
static _getEditOperations(ctx, commands) {
let operations = [];
let hadTrackedEditOperation = false;
for (let i = 0, len = commands.length; i < len; i++) {
const command = commands[i];
if (command) {
const r = this._getEditOperationsFromCommand(ctx, i, command);
operations = operations.concat(r.operations);
hadTrackedEditOperation = hadTrackedEditOperation || r.hadTrackedEditOperation;
}
}
return {
operations,
hadTrackedEditOperation
};
}
static _getEditOperationsFromCommand(ctx, majorIdentifier, command) {
const operations = [];
let operationMinor = 0;
const addEditOperation = (range2, text2, forceMoveMarkers = false) => {
if (Range.isEmpty(range2) && text2 === "") {
return;
}
operations.push({
identifier: {
major: majorIdentifier,
minor: operationMinor++
},
range: range2,
text: text2,
forceMoveMarkers,
isAutoWhitespaceEdit: command.insertsAutoWhitespace
});
};
let hadTrackedEditOperation = false;
const addTrackedEditOperation = (selection, text2, forceMoveMarkers) => {
hadTrackedEditOperation = true;
addEditOperation(selection, text2, forceMoveMarkers);
};
const trackSelection = (_selection, trackPreviousOnEmpty) => {
const selection = Selection.liftSelection(_selection);
let stickiness;
if (selection.isEmpty()) {
if (typeof trackPreviousOnEmpty === "boolean") {
if (trackPreviousOnEmpty) {
stickiness = 2;
} else {
stickiness = 3;
}
} else {
const maxLineColumn = ctx.model.getLineMaxColumn(selection.startLineNumber);
if (selection.startColumn === maxLineColumn) {
stickiness = 2;
} else {
stickiness = 3;
}
}
} else {
stickiness = 1;
}
const l = ctx.trackedRanges.length;
const id = ctx.model._setTrackedRange(null, selection, stickiness);
ctx.trackedRanges[l] = id;
ctx.trackedRangesDirection[l] = selection.getDirection();
return l.toString();
};
const editOperationBuilder = {
addEditOperation,
addTrackedEditOperation,
trackSelection
};
try {
command.getEditOperations(ctx.model, editOperationBuilder);
} catch (e) {
onUnexpectedError(e);
return {
operations: [],
hadTrackedEditOperation: false
};
}
return {
operations,
hadTrackedEditOperation
};
}
static _getLoserCursorMap(operations) {
operations = operations.slice(0);
operations.sort((a3, b) => {
return -Range.compareRangesUsingEnds(a3.range, b.range);
});
const loserCursorsMap = {};
for (let i = 1; i < operations.length; i++) {
const previousOp = operations[i - 1];
const currentOp = operations[i];
if (Range.getStartPosition(previousOp.range).isBefore(Range.getEndPosition(currentOp.range))) {
let loserMajor;
if (previousOp.identifier.major > currentOp.identifier.major) {
loserMajor = previousOp.identifier.major;
} else {
loserMajor = currentOp.identifier.major;
}
loserCursorsMap[loserMajor.toString()] = true;
for (let j = 0; j < operations.length; j++) {
if (operations[j].identifier.major === loserMajor) {
operations.splice(j, 1);
if (j < i) {
i--;
}
j--;
}
}
if (i > 0) {
i--;
}
}
}
return loserCursorsMap;
}
};
CompositionLineState = class {
constructor(text2, startSelection, endSelection) {
this.text = text2;
this.startSelection = startSelection;
this.endSelection = endSelection;
}
};
CompositionState = class _CompositionState {
static _capture(textModel, selections) {
const result = [];
for (const selection of selections) {
if (selection.startLineNumber !== selection.endLineNumber) {
return null;
}
result.push(new CompositionLineState(textModel.getLineContent(selection.startLineNumber), selection.startColumn - 1, selection.endColumn - 1));
}
return result;
}
constructor(textModel, selections) {
this._original = _CompositionState._capture(textModel, selections);
}
/**
* Returns the inserted text during this composition.
* If the composition resulted in existing text being changed (i.e. not a pure insertion) it returns null.
*/
deduceOutcome(textModel, selections) {
if (!this._original) {
return null;
}
const current = _CompositionState._capture(textModel, selections);
if (!current) {
return null;
}
if (this._original.length !== current.length) {
return null;
}
const result = [];
for (let i = 0, len = this._original.length; i < len; i++) {
result.push(_CompositionState._deduceOutcome(this._original[i], current[i]));
}
return result;
}
static _deduceOutcome(original, current) {
const commonPrefix = Math.min(original.startSelection, current.startSelection, commonPrefixLength(original.text, current.text));
const commonSuffix = Math.min(original.text.length - original.endSelection, current.text.length - current.endSelection, commonSuffixLength(original.text, current.text));
const deletedText = original.text.substring(commonPrefix, original.text.length - commonSuffix);
const insertedText = current.text.substring(commonPrefix, current.text.length - commonSuffix);
return new CompositionOutcome(deletedText, original.startSelection - commonPrefix, original.endSelection - commonPrefix, insertedText, current.startSelection - commonPrefix, current.endSelection - commonPrefix);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js
function tokenizeToString(languageService, text2, languageId) {
return __async(this, null, function* () {
if (!languageId) {
return _tokenizeToString(text2, languageService.languageIdCodec, fallback);
}
const tokenizationSupport = yield TokenizationRegistry2.getOrCreate(languageId);
return _tokenizeToString(text2, languageService.languageIdCodec, tokenizationSupport || fallback);
});
}
function tokenizeLineToHTML(text2, viewLineTokens, colorMap, startOffset, endOffset, tabSize, useNbsp) {
let result = ``;
let charIndex = startOffset;
let tabsCharDelta = 0;
let prevIsSpace = true;
for (let tokenIndex = 0, tokenCount = viewLineTokens.getCount(); tokenIndex < tokenCount; tokenIndex++) {
const tokenEndIndex = viewLineTokens.getEndOffset(tokenIndex);
if (tokenEndIndex <= startOffset) {
continue;
}
let partContent = "";
for (; charIndex < tokenEndIndex && charIndex < endOffset; charIndex++) {
const charCode = text2.charCodeAt(charIndex);
switch (charCode) {
case 9: {
let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
tabsCharDelta += insertSpacesCount - 1;
while (insertSpacesCount > 0) {
if (useNbsp && prevIsSpace) {
partContent += " ";
prevIsSpace = false;
} else {
partContent += " ";
prevIsSpace = true;
}
insertSpacesCount--;
}
break;
}
case 60:
partContent += "<";
prevIsSpace = false;
break;
case 62:
partContent += ">";
prevIsSpace = false;
break;
case 38:
partContent += "&";
prevIsSpace = false;
break;
case 0:
partContent += "";
prevIsSpace = false;
break;
case 65279:
case 8232:
case 8233:
case 133:
partContent += "\uFFFD";
prevIsSpace = false;
break;
case 13:
partContent += "";
prevIsSpace = false;
break;
case 32:
if (useNbsp && prevIsSpace) {
partContent += " ";
prevIsSpace = false;
} else {
partContent += " ";
prevIsSpace = true;
}
break;
default:
partContent += String.fromCharCode(charCode);
prevIsSpace = false;
}
}
result += `${partContent}`;
if (tokenEndIndex > endOffset || charIndex >= endOffset) {
break;
}
}
result += `
`;
return result;
}
function _tokenizeToString(text2, languageIdCodec, tokenizationSupport) {
let result = ``;
const lines = splitLines(text2);
let currentState = tokenizationSupport.getInitialState();
for (let i = 0, len = lines.length; i < len; i++) {
const line = lines[i];
if (i > 0) {
result += `
`;
}
const tokenizationResult = tokenizationSupport.tokenizeEncoded(line, true, currentState);
LineTokens.convertToEndOffset(tokenizationResult.tokens, line.length);
const lineTokens = new LineTokens(tokenizationResult.tokens, line, languageIdCodec);
const viewLineTokens = lineTokens.inflate();
let startOffset = 0;
for (let j = 0, lenJ = viewLineTokens.getCount(); j < lenJ; j++) {
const type = viewLineTokens.getClassName(j);
const endIndex = viewLineTokens.getEndOffset(j);
result += `${escape(line.substring(startOffset, endIndex))}`;
startOffset = endIndex;
}
currentState = tokenizationResult.endState;
}
result += `
`;
return result;
}
var fallback;
var init_textToHtmlTokenizer = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/textToHtmlTokenizer.js"() {
init_strings();
init_lineTokens();
init_languages();
init_nullTokenize();
fallback = {
getInitialState: () => NullState,
tokenizeEncoded: (buffer, hasEOL, state) => nullTokenizeEncoded(0, state)
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linesLayout.js
var PendingChanges, EditorWhitespace, LinesLayout;
var init_linesLayout = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linesLayout.js"() {
init_strings();
PendingChanges = class {
constructor() {
this._hasPending = false;
this._inserts = [];
this._changes = [];
this._removes = [];
}
insert(x) {
this._hasPending = true;
this._inserts.push(x);
}
change(x) {
this._hasPending = true;
this._changes.push(x);
}
remove(x) {
this._hasPending = true;
this._removes.push(x);
}
mustCommit() {
return this._hasPending;
}
commit(linesLayout) {
if (!this._hasPending) {
return;
}
const inserts = this._inserts;
const changes = this._changes;
const removes = this._removes;
this._hasPending = false;
this._inserts = [];
this._changes = [];
this._removes = [];
linesLayout._commitPendingChanges(inserts, changes, removes);
}
};
EditorWhitespace = class {
constructor(id, afterLineNumber, ordinal, height, minWidth) {
this.id = id;
this.afterLineNumber = afterLineNumber;
this.ordinal = ordinal;
this.height = height;
this.minWidth = minWidth;
this.prefixSum = 0;
}
};
LinesLayout = class _LinesLayout {
constructor(lineCount, lineHeight, paddingTop, paddingBottom) {
this._instanceId = singleLetterHash(++_LinesLayout.INSTANCE_COUNT);
this._pendingChanges = new PendingChanges();
this._lastWhitespaceId = 0;
this._arr = [];
this._prefixSumValidIndex = -1;
this._minWidth = -1;
this._lineCount = lineCount;
this._lineHeight = lineHeight;
this._paddingTop = paddingTop;
this._paddingBottom = paddingBottom;
}
/**
* Find the insertion index for a new value inside a sorted array of values.
* If the value is already present in the sorted array, the insertion index will be after the already existing value.
*/
static findInsertionIndex(arr, afterLineNumber, ordinal) {
let low = 0;
let high = arr.length;
while (low < high) {
const mid = low + high >>> 1;
if (afterLineNumber === arr[mid].afterLineNumber) {
if (ordinal < arr[mid].ordinal) {
high = mid;
} else {
low = mid + 1;
}
} else if (afterLineNumber < arr[mid].afterLineNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return low;
}
/**
* Change the height of a line in pixels.
*/
setLineHeight(lineHeight) {
this._checkPendingChanges();
this._lineHeight = lineHeight;
}
/**
* Changes the padding used to calculate vertical offsets.
*/
setPadding(paddingTop, paddingBottom) {
this._paddingTop = paddingTop;
this._paddingBottom = paddingBottom;
}
/**
* Set the number of lines.
*
* @param lineCount New number of lines.
*/
onFlushed(lineCount) {
this._checkPendingChanges();
this._lineCount = lineCount;
}
changeWhitespace(callback) {
let hadAChange = false;
try {
const accessor = {
insertWhitespace: (afterLineNumber, ordinal, heightInPx, minWidth) => {
hadAChange = true;
afterLineNumber = afterLineNumber | 0;
ordinal = ordinal | 0;
heightInPx = heightInPx | 0;
minWidth = minWidth | 0;
const id = this._instanceId + ++this._lastWhitespaceId;
this._pendingChanges.insert(new EditorWhitespace(id, afterLineNumber, ordinal, heightInPx, minWidth));
return id;
},
changeOneWhitespace: (id, newAfterLineNumber, newHeight) => {
hadAChange = true;
newAfterLineNumber = newAfterLineNumber | 0;
newHeight = newHeight | 0;
this._pendingChanges.change({ id, newAfterLineNumber, newHeight });
},
removeWhitespace: (id) => {
hadAChange = true;
this._pendingChanges.remove({ id });
}
};
callback(accessor);
} finally {
this._pendingChanges.commit(this);
}
return hadAChange;
}
_commitPendingChanges(inserts, changes, removes) {
if (inserts.length > 0 || removes.length > 0) {
this._minWidth = -1;
}
if (inserts.length + changes.length + removes.length <= 1) {
for (const insert of inserts) {
this._insertWhitespace(insert);
}
for (const change of changes) {
this._changeOneWhitespace(change.id, change.newAfterLineNumber, change.newHeight);
}
for (const remove of removes) {
const index = this._findWhitespaceIndex(remove.id);
if (index === -1) {
continue;
}
this._removeWhitespace(index);
}
return;
}
const toRemove = /* @__PURE__ */ new Set();
for (const remove of removes) {
toRemove.add(remove.id);
}
const toChange = /* @__PURE__ */ new Map();
for (const change of changes) {
toChange.set(change.id, change);
}
const applyRemoveAndChange = (whitespaces) => {
const result2 = [];
for (const whitespace of whitespaces) {
if (toRemove.has(whitespace.id)) {
continue;
}
if (toChange.has(whitespace.id)) {
const change = toChange.get(whitespace.id);
whitespace.afterLineNumber = change.newAfterLineNumber;
whitespace.height = change.newHeight;
}
result2.push(whitespace);
}
return result2;
};
const result = applyRemoveAndChange(this._arr).concat(applyRemoveAndChange(inserts));
result.sort((a3, b) => {
if (a3.afterLineNumber === b.afterLineNumber) {
return a3.ordinal - b.ordinal;
}
return a3.afterLineNumber - b.afterLineNumber;
});
this._arr = result;
this._prefixSumValidIndex = -1;
}
_checkPendingChanges() {
if (this._pendingChanges.mustCommit()) {
this._pendingChanges.commit(this);
}
}
_insertWhitespace(whitespace) {
const insertIndex = _LinesLayout.findInsertionIndex(this._arr, whitespace.afterLineNumber, whitespace.ordinal);
this._arr.splice(insertIndex, 0, whitespace);
this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, insertIndex - 1);
}
_findWhitespaceIndex(id) {
const arr = this._arr;
for (let i = 0, len = arr.length; i < len; i++) {
if (arr[i].id === id) {
return i;
}
}
return -1;
}
_changeOneWhitespace(id, newAfterLineNumber, newHeight) {
const index = this._findWhitespaceIndex(id);
if (index === -1) {
return;
}
if (this._arr[index].height !== newHeight) {
this._arr[index].height = newHeight;
this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, index - 1);
}
if (this._arr[index].afterLineNumber !== newAfterLineNumber) {
const whitespace = this._arr[index];
this._removeWhitespace(index);
whitespace.afterLineNumber = newAfterLineNumber;
this._insertWhitespace(whitespace);
}
}
_removeWhitespace(removeIndex) {
this._arr.splice(removeIndex, 1);
this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, removeIndex - 1);
}
/**
* Notify the layouter that lines have been deleted (a continuous zone of lines).
*
* @param fromLineNumber The line number at which the deletion started, inclusive
* @param toLineNumber The line number at which the deletion ended, inclusive
*/
onLinesDeleted(fromLineNumber, toLineNumber) {
this._checkPendingChanges();
fromLineNumber = fromLineNumber | 0;
toLineNumber = toLineNumber | 0;
this._lineCount -= toLineNumber - fromLineNumber + 1;
for (let i = 0, len = this._arr.length; i < len; i++) {
const afterLineNumber = this._arr[i].afterLineNumber;
if (fromLineNumber <= afterLineNumber && afterLineNumber <= toLineNumber) {
this._arr[i].afterLineNumber = fromLineNumber - 1;
} else if (afterLineNumber > toLineNumber) {
this._arr[i].afterLineNumber -= toLineNumber - fromLineNumber + 1;
}
}
}
/**
* Notify the layouter that lines have been inserted (a continuous zone of lines).
*
* @param fromLineNumber The line number at which the insertion started, inclusive
* @param toLineNumber The line number at which the insertion ended, inclusive.
*/
onLinesInserted(fromLineNumber, toLineNumber) {
this._checkPendingChanges();
fromLineNumber = fromLineNumber | 0;
toLineNumber = toLineNumber | 0;
this._lineCount += toLineNumber - fromLineNumber + 1;
for (let i = 0, len = this._arr.length; i < len; i++) {
const afterLineNumber = this._arr[i].afterLineNumber;
if (fromLineNumber <= afterLineNumber) {
this._arr[i].afterLineNumber += toLineNumber - fromLineNumber + 1;
}
}
}
/**
* Get the sum of all the whitespaces.
*/
getWhitespacesTotalHeight() {
this._checkPendingChanges();
if (this._arr.length === 0) {
return 0;
}
return this.getWhitespacesAccumulatedHeight(this._arr.length - 1);
}
/**
* Return the sum of the heights of the whitespaces at [0..index].
* This includes the whitespace at `index`.
*
* @param index The index of the whitespace.
* @return The sum of the heights of all whitespaces before the one at `index`, including the one at `index`.
*/
getWhitespacesAccumulatedHeight(index) {
this._checkPendingChanges();
index = index | 0;
let startIndex = Math.max(0, this._prefixSumValidIndex + 1);
if (startIndex === 0) {
this._arr[0].prefixSum = this._arr[0].height;
startIndex++;
}
for (let i = startIndex; i <= index; i++) {
this._arr[i].prefixSum = this._arr[i - 1].prefixSum + this._arr[i].height;
}
this._prefixSumValidIndex = Math.max(this._prefixSumValidIndex, index);
return this._arr[index].prefixSum;
}
/**
* Get the sum of heights for all objects.
*
* @return The sum of heights for all objects.
*/
getLinesTotalHeight() {
this._checkPendingChanges();
const linesHeight = this._lineHeight * this._lineCount;
const whitespacesHeight = this.getWhitespacesTotalHeight();
return linesHeight + whitespacesHeight + this._paddingTop + this._paddingBottom;
}
/**
* Returns the accumulated height of whitespaces before the given line number.
*
* @param lineNumber The line number
*/
getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
const lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber);
if (lastWhitespaceBeforeLineNumber === -1) {
return 0;
}
return this.getWhitespacesAccumulatedHeight(lastWhitespaceBeforeLineNumber);
}
_findLastWhitespaceBeforeLineNumber(lineNumber) {
lineNumber = lineNumber | 0;
const arr = this._arr;
let low = 0;
let high = arr.length - 1;
while (low <= high) {
const delta = high - low | 0;
const halfDelta = delta / 2 | 0;
const mid = low + halfDelta | 0;
if (arr[mid].afterLineNumber < lineNumber) {
if (mid + 1 >= arr.length || arr[mid + 1].afterLineNumber >= lineNumber) {
return mid;
} else {
low = mid + 1 | 0;
}
} else {
high = mid - 1 | 0;
}
}
return -1;
}
_findFirstWhitespaceAfterLineNumber(lineNumber) {
lineNumber = lineNumber | 0;
const lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber);
const firstWhitespaceAfterLineNumber = lastWhitespaceBeforeLineNumber + 1;
if (firstWhitespaceAfterLineNumber < this._arr.length) {
return firstWhitespaceAfterLineNumber;
}
return -1;
}
/**
* Find the index of the first whitespace which has `afterLineNumber` >= `lineNumber`.
* @return The index of the first whitespace with `afterLineNumber` >= `lineNumber` or -1 if no whitespace is found.
*/
getFirstWhitespaceIndexAfterLineNumber(lineNumber) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
return this._findFirstWhitespaceAfterLineNumber(lineNumber);
}
/**
* Get the vertical offset (the sum of heights for all objects above) a certain line number.
*
* @param lineNumber The line number
* @return The sum of heights for all objects above `lineNumber`.
*/
getVerticalOffsetForLineNumber(lineNumber, includeViewZones = false) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
let previousLinesHeight;
if (lineNumber > 1) {
previousLinesHeight = this._lineHeight * (lineNumber - 1);
} else {
previousLinesHeight = 0;
}
const previousWhitespacesHeight = this.getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber - (includeViewZones ? 1 : 0));
return previousLinesHeight + previousWhitespacesHeight + this._paddingTop;
}
/**
* Get the vertical offset (the sum of heights for all objects above) a certain line number.
*
* @param lineNumber The line number
* @return The sum of heights for all objects above `lineNumber`.
*/
getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones = false) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
const previousLinesHeight = this._lineHeight * lineNumber;
const previousWhitespacesHeight = this.getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber + (includeViewZones ? 1 : 0));
return previousLinesHeight + previousWhitespacesHeight + this._paddingTop;
}
/**
* The maximum min width for all whitespaces.
*/
getWhitespaceMinWidth() {
this._checkPendingChanges();
if (this._minWidth === -1) {
let minWidth = 0;
for (let i = 0, len = this._arr.length; i < len; i++) {
minWidth = Math.max(minWidth, this._arr[i].minWidth);
}
this._minWidth = minWidth;
}
return this._minWidth;
}
/**
* Check if `verticalOffset` is below all lines.
*/
isAfterLines(verticalOffset) {
this._checkPendingChanges();
const totalHeight = this.getLinesTotalHeight();
return verticalOffset > totalHeight;
}
isInTopPadding(verticalOffset) {
if (this._paddingTop === 0) {
return false;
}
this._checkPendingChanges();
return verticalOffset < this._paddingTop;
}
isInBottomPadding(verticalOffset) {
if (this._paddingBottom === 0) {
return false;
}
this._checkPendingChanges();
const totalHeight = this.getLinesTotalHeight();
return verticalOffset >= totalHeight - this._paddingBottom;
}
/**
* Find the first line number that is at or after vertical offset `verticalOffset`.
* i.e. if getVerticalOffsetForLine(line) is x and getVerticalOffsetForLine(line + 1) is y, then
* getLineNumberAtOrAfterVerticalOffset(i) = line, x <= i < y.
*
* @param verticalOffset The vertical offset to search at.
* @return The line number at or after vertical offset `verticalOffset`.
*/
getLineNumberAtOrAfterVerticalOffset(verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
if (verticalOffset < 0) {
return 1;
}
const linesCount = this._lineCount | 0;
const lineHeight = this._lineHeight;
let minLineNumber = 1;
let maxLineNumber = linesCount;
while (minLineNumber < maxLineNumber) {
const midLineNumber = (minLineNumber + maxLineNumber) / 2 | 0;
const midLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(midLineNumber) | 0;
if (verticalOffset >= midLineNumberVerticalOffset + lineHeight) {
minLineNumber = midLineNumber + 1;
} else if (verticalOffset >= midLineNumberVerticalOffset) {
return midLineNumber;
} else {
maxLineNumber = midLineNumber;
}
}
if (minLineNumber > linesCount) {
return linesCount;
}
return minLineNumber;
}
/**
* Get all the lines and their relative vertical offsets that are positioned between `verticalOffset1` and `verticalOffset2`.
*
* @param verticalOffset1 The beginning of the viewport.
* @param verticalOffset2 The end of the viewport.
* @return A structure describing the lines positioned between `verticalOffset1` and `verticalOffset2`.
*/
getLinesViewportData(verticalOffset1, verticalOffset2) {
this._checkPendingChanges();
verticalOffset1 = verticalOffset1 | 0;
verticalOffset2 = verticalOffset2 | 0;
const lineHeight = this._lineHeight;
const startLineNumber = this.getLineNumberAtOrAfterVerticalOffset(verticalOffset1) | 0;
const startLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(startLineNumber) | 0;
let endLineNumber = this._lineCount | 0;
let whitespaceIndex = this.getFirstWhitespaceIndexAfterLineNumber(startLineNumber) | 0;
const whitespaceCount = this.getWhitespacesCount() | 0;
let currentWhitespaceHeight;
let currentWhitespaceAfterLineNumber;
if (whitespaceIndex === -1) {
whitespaceIndex = whitespaceCount;
currentWhitespaceAfterLineNumber = endLineNumber + 1;
currentWhitespaceHeight = 0;
} else {
currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0;
currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0;
}
let currentVerticalOffset = startLineNumberVerticalOffset;
let currentLineRelativeOffset = currentVerticalOffset;
const STEP_SIZE = 5e5;
let bigNumbersDelta = 0;
if (startLineNumberVerticalOffset >= STEP_SIZE) {
bigNumbersDelta = Math.floor(startLineNumberVerticalOffset / STEP_SIZE) * STEP_SIZE;
bigNumbersDelta = Math.floor(bigNumbersDelta / lineHeight) * lineHeight;
currentLineRelativeOffset -= bigNumbersDelta;
}
const linesOffsets = [];
const verticalCenter = verticalOffset1 + (verticalOffset2 - verticalOffset1) / 2;
let centeredLineNumber = -1;
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
if (centeredLineNumber === -1) {
const currentLineTop = currentVerticalOffset;
const currentLineBottom = currentVerticalOffset + lineHeight;
if (currentLineTop <= verticalCenter && verticalCenter < currentLineBottom || currentLineTop > verticalCenter) {
centeredLineNumber = lineNumber;
}
}
currentVerticalOffset += lineHeight;
linesOffsets[lineNumber - startLineNumber] = currentLineRelativeOffset;
currentLineRelativeOffset += lineHeight;
while (currentWhitespaceAfterLineNumber === lineNumber) {
currentLineRelativeOffset += currentWhitespaceHeight;
currentVerticalOffset += currentWhitespaceHeight;
whitespaceIndex++;
if (whitespaceIndex >= whitespaceCount) {
currentWhitespaceAfterLineNumber = endLineNumber + 1;
} else {
currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0;
currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0;
}
}
if (currentVerticalOffset >= verticalOffset2) {
endLineNumber = lineNumber;
break;
}
}
if (centeredLineNumber === -1) {
centeredLineNumber = endLineNumber;
}
const endLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(endLineNumber) | 0;
let completelyVisibleStartLineNumber = startLineNumber;
let completelyVisibleEndLineNumber = endLineNumber;
if (completelyVisibleStartLineNumber < completelyVisibleEndLineNumber) {
if (startLineNumberVerticalOffset < verticalOffset1) {
completelyVisibleStartLineNumber++;
}
}
if (completelyVisibleStartLineNumber < completelyVisibleEndLineNumber) {
if (endLineNumberVerticalOffset + lineHeight > verticalOffset2) {
completelyVisibleEndLineNumber--;
}
}
return {
bigNumbersDelta,
startLineNumber,
endLineNumber,
relativeVerticalOffset: linesOffsets,
centeredLineNumber,
completelyVisibleStartLineNumber,
completelyVisibleEndLineNumber,
lineHeight: this._lineHeight
};
}
getVerticalOffsetForWhitespaceIndex(whitespaceIndex) {
this._checkPendingChanges();
whitespaceIndex = whitespaceIndex | 0;
const afterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex);
let previousLinesHeight;
if (afterLineNumber >= 1) {
previousLinesHeight = this._lineHeight * afterLineNumber;
} else {
previousLinesHeight = 0;
}
let previousWhitespacesHeight;
if (whitespaceIndex > 0) {
previousWhitespacesHeight = this.getWhitespacesAccumulatedHeight(whitespaceIndex - 1);
} else {
previousWhitespacesHeight = 0;
}
return previousLinesHeight + previousWhitespacesHeight + this._paddingTop;
}
getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
let minWhitespaceIndex = 0;
let maxWhitespaceIndex = this.getWhitespacesCount() - 1;
if (maxWhitespaceIndex < 0) {
return -1;
}
const maxWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(maxWhitespaceIndex);
const maxWhitespaceHeight = this.getHeightForWhitespaceIndex(maxWhitespaceIndex);
if (verticalOffset >= maxWhitespaceVerticalOffset + maxWhitespaceHeight) {
return -1;
}
while (minWhitespaceIndex < maxWhitespaceIndex) {
const midWhitespaceIndex = Math.floor((minWhitespaceIndex + maxWhitespaceIndex) / 2);
const midWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(midWhitespaceIndex);
const midWhitespaceHeight = this.getHeightForWhitespaceIndex(midWhitespaceIndex);
if (verticalOffset >= midWhitespaceVerticalOffset + midWhitespaceHeight) {
minWhitespaceIndex = midWhitespaceIndex + 1;
} else if (verticalOffset >= midWhitespaceVerticalOffset) {
return midWhitespaceIndex;
} else {
maxWhitespaceIndex = midWhitespaceIndex;
}
}
return minWhitespaceIndex;
}
/**
* Get exactly the whitespace that is layouted at `verticalOffset`.
*
* @param verticalOffset The vertical offset.
* @return Precisely the whitespace that is layouted at `verticaloffset` or null.
*/
getWhitespaceAtVerticalOffset(verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
const candidateIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset);
if (candidateIndex < 0) {
return null;
}
if (candidateIndex >= this.getWhitespacesCount()) {
return null;
}
const candidateTop = this.getVerticalOffsetForWhitespaceIndex(candidateIndex);
if (candidateTop > verticalOffset) {
return null;
}
const candidateHeight = this.getHeightForWhitespaceIndex(candidateIndex);
const candidateId = this.getIdForWhitespaceIndex(candidateIndex);
const candidateAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(candidateIndex);
return {
id: candidateId,
afterLineNumber: candidateAfterLineNumber,
verticalOffset: candidateTop,
height: candidateHeight
};
}
/**
* Get a list of whitespaces that are positioned between `verticalOffset1` and `verticalOffset2`.
*
* @param verticalOffset1 The beginning of the viewport.
* @param verticalOffset2 The end of the viewport.
* @return An array with all the whitespaces in the viewport. If no whitespace is in viewport, the array is empty.
*/
getWhitespaceViewportData(verticalOffset1, verticalOffset2) {
this._checkPendingChanges();
verticalOffset1 = verticalOffset1 | 0;
verticalOffset2 = verticalOffset2 | 0;
const startIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset1);
const endIndex = this.getWhitespacesCount() - 1;
if (startIndex < 0) {
return [];
}
const result = [];
for (let i = startIndex; i <= endIndex; i++) {
const top = this.getVerticalOffsetForWhitespaceIndex(i);
const height = this.getHeightForWhitespaceIndex(i);
if (top >= verticalOffset2) {
break;
}
result.push({
id: this.getIdForWhitespaceIndex(i),
afterLineNumber: this.getAfterLineNumberForWhitespaceIndex(i),
verticalOffset: top,
height
});
}
return result;
}
/**
* Get all whitespaces.
*/
getWhitespaces() {
this._checkPendingChanges();
return this._arr.slice(0);
}
/**
* The number of whitespaces.
*/
getWhitespacesCount() {
this._checkPendingChanges();
return this._arr.length;
}
/**
* Get the `id` for whitespace at index `index`.
*
* @param index The index of the whitespace.
* @return `id` of whitespace at `index`.
*/
getIdForWhitespaceIndex(index) {
this._checkPendingChanges();
index = index | 0;
return this._arr[index].id;
}
/**
* Get the `afterLineNumber` for whitespace at index `index`.
*
* @param index The index of the whitespace.
* @return `afterLineNumber` of whitespace at `index`.
*/
getAfterLineNumberForWhitespaceIndex(index) {
this._checkPendingChanges();
index = index | 0;
return this._arr[index].afterLineNumber;
}
/**
* Get the `height` for whitespace at index `index`.
*
* @param index The index of the whitespace.
* @return `height` of whitespace at `index`.
*/
getHeightForWhitespaceIndex(index) {
this._checkPendingChanges();
index = index | 0;
return this._arr[index].height;
}
};
LinesLayout.INSTANCE_COUNT = 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLayout.js
var SMOOTH_SCROLLING_TIME, EditorScrollDimensions, EditorScrollable, ViewLayout;
var init_viewLayout = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLayout.js"() {
init_event();
init_lifecycle();
init_scrollable();
init_linesLayout();
init_viewModel();
init_viewModelEventDispatcher();
SMOOTH_SCROLLING_TIME = 125;
EditorScrollDimensions = class {
constructor(width2, contentWidth, height, contentHeight) {
width2 = width2 | 0;
contentWidth = contentWidth | 0;
height = height | 0;
contentHeight = contentHeight | 0;
if (width2 < 0) {
width2 = 0;
}
if (contentWidth < 0) {
contentWidth = 0;
}
if (height < 0) {
height = 0;
}
if (contentHeight < 0) {
contentHeight = 0;
}
this.width = width2;
this.contentWidth = contentWidth;
this.scrollWidth = Math.max(width2, contentWidth);
this.height = height;
this.contentHeight = contentHeight;
this.scrollHeight = Math.max(height, contentHeight);
}
equals(other) {
return this.width === other.width && this.contentWidth === other.contentWidth && this.height === other.height && this.contentHeight === other.contentHeight;
}
};
EditorScrollable = class extends Disposable {
constructor(smoothScrollDuration, scheduleAtNextAnimationFrame2) {
super();
this._onDidContentSizeChange = this._register(new Emitter());
this.onDidContentSizeChange = this._onDidContentSizeChange.event;
this._dimensions = new EditorScrollDimensions(0, 0, 0, 0);
this._scrollable = this._register(new Scrollable({
forceIntegerValues: true,
smoothScrollDuration,
scheduleAtNextAnimationFrame: scheduleAtNextAnimationFrame2
}));
this.onDidScroll = this._scrollable.onScroll;
}
getScrollable() {
return this._scrollable;
}
setSmoothScrollDuration(smoothScrollDuration) {
this._scrollable.setSmoothScrollDuration(smoothScrollDuration);
}
validateScrollPosition(scrollPosition) {
return this._scrollable.validateScrollPosition(scrollPosition);
}
getScrollDimensions() {
return this._dimensions;
}
setScrollDimensions(dimensions) {
if (this._dimensions.equals(dimensions)) {
return;
}
const oldDimensions = this._dimensions;
this._dimensions = dimensions;
this._scrollable.setScrollDimensions({
width: dimensions.width,
scrollWidth: dimensions.scrollWidth,
height: dimensions.height,
scrollHeight: dimensions.scrollHeight
}, true);
const contentWidthChanged = oldDimensions.contentWidth !== dimensions.contentWidth;
const contentHeightChanged = oldDimensions.contentHeight !== dimensions.contentHeight;
if (contentWidthChanged || contentHeightChanged) {
this._onDidContentSizeChange.fire(new ContentSizeChangedEvent(oldDimensions.contentWidth, oldDimensions.contentHeight, dimensions.contentWidth, dimensions.contentHeight));
}
}
getFutureScrollPosition() {
return this._scrollable.getFutureScrollPosition();
}
getCurrentScrollPosition() {
return this._scrollable.getCurrentScrollPosition();
}
setScrollPositionNow(update) {
this._scrollable.setScrollPositionNow(update);
}
setScrollPositionSmooth(update) {
this._scrollable.setScrollPositionSmooth(update);
}
hasPendingScrollAnimation() {
return this._scrollable.hasPendingScrollAnimation();
}
};
ViewLayout = class extends Disposable {
constructor(configuration, lineCount, scheduleAtNextAnimationFrame2) {
super();
this._configuration = configuration;
const options2 = this._configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const padding = options2.get(
84
/* EditorOption.padding */
);
this._linesLayout = new LinesLayout(lineCount, options2.get(
67
/* EditorOption.lineHeight */
), padding.top, padding.bottom);
this._maxLineWidth = 0;
this._overlayWidgetsMinWidth = 0;
this._scrollable = this._register(new EditorScrollable(0, scheduleAtNextAnimationFrame2));
this._configureSmoothScrollDuration();
this._scrollable.setScrollDimensions(new EditorScrollDimensions(layoutInfo.contentWidth, 0, layoutInfo.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
/* EditorOption.smoothScrolling */
) ? SMOOTH_SCROLLING_TIME : 0);
}
// ---- begin view event handlers
onConfigurationChanged(e) {
const options2 = this._configuration.options;
if (e.hasChanged(
67
/* EditorOption.lineHeight */
)) {
this._linesLayout.setLineHeight(options2.get(
67
/* EditorOption.lineHeight */
));
}
if (e.hasChanged(
84
/* EditorOption.padding */
)) {
const padding = options2.get(
84
/* EditorOption.padding */
);
this._linesLayout.setPadding(padding.top, padding.bottom);
}
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const width2 = layoutInfo.contentWidth;
const height = layoutInfo.height;
const scrollDimensions = this._scrollable.getScrollDimensions();
const contentWidth = scrollDimensions.contentWidth;
this._scrollable.setScrollDimensions(new EditorScrollDimensions(width2, scrollDimensions.contentWidth, height, this._getContentHeight(width2, height, contentWidth)));
} else {
this._updateHeight();
}
if (e.hasChanged(
114
/* EditorOption.smoothScrolling */
)) {
this._configureSmoothScrollDuration();
}
}
onFlushed(lineCount) {
this._linesLayout.onFlushed(lineCount);
}
onLinesDeleted(fromLineNumber, toLineNumber) {
this._linesLayout.onLinesDeleted(fromLineNumber, toLineNumber);
}
onLinesInserted(fromLineNumber, toLineNumber) {
this._linesLayout.onLinesInserted(fromLineNumber, toLineNumber);
}
// ---- end view event handlers
_getHorizontalScrollbarHeight(width2, scrollWidth) {
const options2 = this._configuration.options;
const scrollbar = options2.get(
103
/* EditorOption.scrollbar */
);
if (scrollbar.horizontal === 2) {
return 0;
}
if (width2 >= scrollWidth) {
return 0;
}
return scrollbar.horizontalScrollbarSize;
}
_getContentHeight(width2, height, contentWidth) {
const options2 = this._configuration.options;
let result = this._linesLayout.getLinesTotalHeight();
if (options2.get(
105
/* EditorOption.scrollBeyondLastLine */
)) {
result += Math.max(0, height - options2.get(
67
/* EditorOption.lineHeight */
) - options2.get(
84
/* EditorOption.padding */
).bottom);
} else if (!options2.get(
103
/* EditorOption.scrollbar */
).ignoreHorizontalScrollbarInContentHeight) {
result += this._getHorizontalScrollbarHeight(width2, contentWidth);
}
return result;
}
_updateHeight() {
const scrollDimensions = this._scrollable.getScrollDimensions();
const width2 = scrollDimensions.width;
const height = scrollDimensions.height;
const contentWidth = scrollDimensions.contentWidth;
this._scrollable.setScrollDimensions(new EditorScrollDimensions(width2, scrollDimensions.contentWidth, height, this._getContentHeight(width2, height, contentWidth)));
}
// ---- Layouting logic
getCurrentViewport() {
const scrollDimensions = this._scrollable.getScrollDimensions();
const currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return new Viewport(currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, scrollDimensions.width, scrollDimensions.height);
}
getFutureViewport() {
const scrollDimensions = this._scrollable.getScrollDimensions();
const currentScrollPosition = this._scrollable.getFutureScrollPosition();
return new Viewport(currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, scrollDimensions.width, scrollDimensions.height);
}
_computeContentWidth() {
const options2 = this._configuration.options;
const maxLineWidth = this._maxLineWidth;
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
if (wrappingInfo.isViewportWrapping) {
const minimap = options2.get(
73
/* EditorOption.minimap */
);
if (maxLineWidth > layoutInfo.contentWidth + fontInfo.typicalHalfwidthCharacterWidth) {
if (minimap.enabled && minimap.side === "right") {
return maxLineWidth + layoutInfo.verticalScrollbarWidth;
}
}
return maxLineWidth;
} else {
const extraHorizontalSpace = options2.get(
104
/* EditorOption.scrollBeyondLastColumn */
) * fontInfo.typicalHalfwidthCharacterWidth;
const whitespaceMinWidth = this._linesLayout.getWhitespaceMinWidth();
return Math.max(maxLineWidth + extraHorizontalSpace + layoutInfo.verticalScrollbarWidth, whitespaceMinWidth, this._overlayWidgetsMinWidth);
}
}
setMaxLineWidth(maxLineWidth) {
this._maxLineWidth = maxLineWidth;
this._updateContentWidth();
}
setOverlayWidgetsMinWidth(maxMinWidth) {
this._overlayWidgetsMinWidth = maxMinWidth;
this._updateContentWidth();
}
_updateContentWidth() {
const scrollDimensions = this._scrollable.getScrollDimensions();
this._scrollable.setScrollDimensions(new EditorScrollDimensions(scrollDimensions.width, this._computeContentWidth(), scrollDimensions.height, scrollDimensions.contentHeight));
this._updateHeight();
}
// ---- view state
saveState() {
const currentScrollPosition = this._scrollable.getFutureScrollPosition();
const scrollTop = currentScrollPosition.scrollTop;
const firstLineNumberInViewport = this._linesLayout.getLineNumberAtOrAfterVerticalOffset(scrollTop);
const whitespaceAboveFirstLine = this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(firstLineNumberInViewport);
return {
scrollTop,
scrollTopWithoutViewZones: scrollTop - whitespaceAboveFirstLine,
scrollLeft: currentScrollPosition.scrollLeft
};
}
// ----
changeWhitespace(callback) {
const hadAChange = this._linesLayout.changeWhitespace(callback);
if (hadAChange) {
this.onHeightMaybeChanged();
}
return hadAChange;
}
getVerticalOffsetForLineNumber(lineNumber, includeViewZones = false) {
return this._linesLayout.getVerticalOffsetForLineNumber(lineNumber, includeViewZones);
}
getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones = false) {
return this._linesLayout.getVerticalOffsetAfterLineNumber(lineNumber, includeViewZones);
}
isAfterLines(verticalOffset) {
return this._linesLayout.isAfterLines(verticalOffset);
}
isInTopPadding(verticalOffset) {
return this._linesLayout.isInTopPadding(verticalOffset);
}
isInBottomPadding(verticalOffset) {
return this._linesLayout.isInBottomPadding(verticalOffset);
}
getLineNumberAtVerticalOffset(verticalOffset) {
return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(verticalOffset);
}
getWhitespaceAtVerticalOffset(verticalOffset) {
return this._linesLayout.getWhitespaceAtVerticalOffset(verticalOffset);
}
getLinesViewportData() {
const visibleBox = this.getCurrentViewport();
return this._linesLayout.getLinesViewportData(visibleBox.top, visibleBox.top + visibleBox.height);
}
getLinesViewportDataAtScrollTop(scrollTop) {
const scrollDimensions = this._scrollable.getScrollDimensions();
if (scrollTop + scrollDimensions.height > scrollDimensions.scrollHeight) {
scrollTop = scrollDimensions.scrollHeight - scrollDimensions.height;
}
if (scrollTop < 0) {
scrollTop = 0;
}
return this._linesLayout.getLinesViewportData(scrollTop, scrollTop + scrollDimensions.height);
}
getWhitespaceViewportData() {
const visibleBox = this.getCurrentViewport();
return this._linesLayout.getWhitespaceViewportData(visibleBox.top, visibleBox.top + visibleBox.height);
}
getWhitespaces() {
return this._linesLayout.getWhitespaces();
}
// ----
getContentWidth() {
const scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.contentWidth;
}
getScrollWidth() {
const scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.scrollWidth;
}
getContentHeight() {
const scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.contentHeight;
}
getScrollHeight() {
const scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.scrollHeight;
}
getCurrentScrollLeft() {
const currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return currentScrollPosition.scrollLeft;
}
getCurrentScrollTop() {
const currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return currentScrollPosition.scrollTop;
}
validateScrollPosition(scrollPosition) {
return this._scrollable.validateScrollPosition(scrollPosition);
}
setScrollPosition(position, type) {
if (type === 1) {
this._scrollable.setScrollPositionNow(position);
} else {
this._scrollable.setScrollPositionSmooth(position);
}
}
hasPendingScrollAnimation() {
return this._scrollable.hasPendingScrollAnimation();
}
deltaScrollNow(deltaScrollLeft, deltaScrollTop) {
const currentScrollPosition = this._scrollable.getCurrentScrollPosition();
this._scrollable.setScrollPositionNow({
scrollLeft: currentScrollPosition.scrollLeft + deltaScrollLeft,
scrollTop: currentScrollPosition.scrollTop + deltaScrollTop
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelDecorations.js
function isModelDecorationVisible(model, decoration3) {
if (decoration3.options.hideInCommentTokens && isModelDecorationInComment(model, decoration3)) {
return false;
}
if (decoration3.options.hideInStringTokens && isModelDecorationInString(model, decoration3)) {
return false;
}
return true;
}
function isModelDecorationInComment(model, decoration3) {
return testTokensInRange(
model,
decoration3.range,
(tokenType) => tokenType === 1
/* StandardTokenType.Comment */
);
}
function isModelDecorationInString(model, decoration3) {
return testTokensInRange(
model,
decoration3.range,
(tokenType) => tokenType === 2
/* StandardTokenType.String */
);
}
function testTokensInRange(model, range2, callback) {
for (let lineNumber = range2.startLineNumber; lineNumber <= range2.endLineNumber; lineNumber++) {
const lineTokens = model.tokenization.getLineTokens(lineNumber);
const isFirstLine = lineNumber === range2.startLineNumber;
const isEndLine = lineNumber === range2.endLineNumber;
let tokenIdx = isFirstLine ? lineTokens.findTokenIndexAtOffset(range2.startColumn - 1) : 0;
while (tokenIdx < lineTokens.getCount()) {
if (isEndLine) {
const startOffset = lineTokens.getStartOffset(tokenIdx);
if (startOffset > range2.endColumn - 1) {
break;
}
}
const callbackResult = callback(lineTokens.getStandardTokenType(tokenIdx));
if (!callbackResult) {
return false;
}
tokenIdx++;
}
}
return true;
}
var ViewModelDecorations;
var init_viewModelDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelDecorations.js"() {
init_position();
init_range();
init_viewModel();
init_editorOptions();
ViewModelDecorations = class {
constructor(editorId, model, configuration, linesCollection, coordinatesConverter) {
this.editorId = editorId;
this.model = model;
this.configuration = configuration;
this._linesCollection = linesCollection;
this._coordinatesConverter = coordinatesConverter;
this._decorationsCache = /* @__PURE__ */ Object.create(null);
this._cachedModelDecorationsResolver = null;
this._cachedModelDecorationsResolverViewRange = null;
}
_clearCachedModelDecorationsResolver() {
this._cachedModelDecorationsResolver = null;
this._cachedModelDecorationsResolverViewRange = null;
}
dispose() {
this._decorationsCache = /* @__PURE__ */ Object.create(null);
this._clearCachedModelDecorationsResolver();
}
reset() {
this._decorationsCache = /* @__PURE__ */ Object.create(null);
this._clearCachedModelDecorationsResolver();
}
onModelDecorationsChanged() {
this._decorationsCache = /* @__PURE__ */ Object.create(null);
this._clearCachedModelDecorationsResolver();
}
onLineMappingChanged() {
this._decorationsCache = /* @__PURE__ */ Object.create(null);
this._clearCachedModelDecorationsResolver();
}
_getOrCreateViewModelDecoration(modelDecoration) {
const id = modelDecoration.id;
let r = this._decorationsCache[id];
if (!r) {
const modelRange = modelDecoration.range;
const options2 = modelDecoration.options;
let viewRange;
if (options2.isWholeLine) {
const start = this._coordinatesConverter.convertModelPositionToViewPosition(new Position(modelRange.startLineNumber, 1), 0, false, true);
const end = this._coordinatesConverter.convertModelPositionToViewPosition(
new Position(modelRange.endLineNumber, this.model.getLineMaxColumn(modelRange.endLineNumber)),
1
/* PositionAffinity.Right */
);
viewRange = new Range(start.lineNumber, start.column, end.lineNumber, end.column);
} else {
viewRange = this._coordinatesConverter.convertModelRangeToViewRange(
modelRange,
1
/* PositionAffinity.Right */
);
}
r = new ViewModelDecoration(viewRange, options2);
this._decorationsCache[id] = r;
}
return r;
}
getMinimapDecorationsInRange(range2) {
return this._getDecorationsInRange(range2, true, false).decorations;
}
getDecorationsViewportData(viewRange) {
let cacheIsValid = this._cachedModelDecorationsResolver !== null;
cacheIsValid = cacheIsValid && viewRange.equalsRange(this._cachedModelDecorationsResolverViewRange);
if (!cacheIsValid) {
this._cachedModelDecorationsResolver = this._getDecorationsInRange(viewRange, false, false);
this._cachedModelDecorationsResolverViewRange = viewRange;
}
return this._cachedModelDecorationsResolver;
}
getInlineDecorationsOnLine(lineNumber, onlyMinimapDecorations = false, onlyMarginDecorations = false) {
const range2 = new Range(lineNumber, this._linesCollection.getViewLineMinColumn(lineNumber), lineNumber, this._linesCollection.getViewLineMaxColumn(lineNumber));
return this._getDecorationsInRange(range2, onlyMinimapDecorations, onlyMarginDecorations).inlineDecorations[0];
}
_getDecorationsInRange(viewRange, onlyMinimapDecorations, onlyMarginDecorations) {
const modelDecorations = this._linesCollection.getDecorationsInRange(viewRange, this.editorId, filterValidationDecorations(this.configuration.options), onlyMinimapDecorations, onlyMarginDecorations);
const startLineNumber = viewRange.startLineNumber;
const endLineNumber = viewRange.endLineNumber;
const decorationsInViewport = [];
let decorationsInViewportLen = 0;
const inlineDecorations = [];
for (let j = startLineNumber; j <= endLineNumber; j++) {
inlineDecorations[j - startLineNumber] = [];
}
for (let i = 0, len = modelDecorations.length; i < len; i++) {
const modelDecoration = modelDecorations[i];
const decorationOptions = modelDecoration.options;
if (!isModelDecorationVisible(this.model, modelDecoration)) {
continue;
}
const viewModelDecoration = this._getOrCreateViewModelDecoration(modelDecoration);
const viewRange2 = viewModelDecoration.range;
decorationsInViewport[decorationsInViewportLen++] = viewModelDecoration;
if (decorationOptions.inlineClassName) {
const inlineDecoration = new InlineDecoration(
viewRange2,
decorationOptions.inlineClassName,
decorationOptions.inlineClassNameAffectsLetterSpacing ? 3 : 0
/* InlineDecorationType.Regular */
);
const intersectedStartLineNumber = Math.max(startLineNumber, viewRange2.startLineNumber);
const intersectedEndLineNumber = Math.min(endLineNumber, viewRange2.endLineNumber);
for (let j = intersectedStartLineNumber; j <= intersectedEndLineNumber; j++) {
inlineDecorations[j - startLineNumber].push(inlineDecoration);
}
}
if (decorationOptions.beforeContentClassName) {
if (startLineNumber <= viewRange2.startLineNumber && viewRange2.startLineNumber <= endLineNumber) {
const inlineDecoration = new InlineDecoration(
new Range(viewRange2.startLineNumber, viewRange2.startColumn, viewRange2.startLineNumber, viewRange2.startColumn),
decorationOptions.beforeContentClassName,
1
/* InlineDecorationType.Before */
);
inlineDecorations[viewRange2.startLineNumber - startLineNumber].push(inlineDecoration);
}
}
if (decorationOptions.afterContentClassName) {
if (startLineNumber <= viewRange2.endLineNumber && viewRange2.endLineNumber <= endLineNumber) {
const inlineDecoration = new InlineDecoration(
new Range(viewRange2.endLineNumber, viewRange2.endColumn, viewRange2.endLineNumber, viewRange2.endColumn),
decorationOptions.afterContentClassName,
2
/* InlineDecorationType.After */
);
inlineDecorations[viewRange2.endLineNumber - startLineNumber].push(inlineDecoration);
}
}
}
return {
decorations: decorationsInViewport,
inlineDecorations
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/modelLineProjection.js
function createModelLineProjection(lineBreakData, isVisible) {
if (lineBreakData === null) {
if (isVisible) {
return IdentityModelLineProjection.INSTANCE;
}
return HiddenModelLineProjection.INSTANCE;
} else {
return new ModelLineProjection(lineBreakData, isVisible);
}
}
function spaces(count) {
if (count >= _spaces.length) {
for (let i = 1; i <= count; i++) {
_spaces[i] = _makeSpaces(i);
}
}
return _spaces[count];
}
function _makeSpaces(count) {
return new Array(count + 1).join(" ");
}
var ModelLineProjection, IdentityModelLineProjection, HiddenModelLineProjection, _spaces;
var init_modelLineProjection = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/modelLineProjection.js"() {
init_lineTokens();
init_position();
init_textModelEvents();
init_viewModel();
ModelLineProjection = class {
constructor(lineBreakData, isVisible) {
this._projectionData = lineBreakData;
this._isVisible = isVisible;
}
isVisible() {
return this._isVisible;
}
setVisible(isVisible) {
this._isVisible = isVisible;
return this;
}
getProjectionData() {
return this._projectionData;
}
getViewLineCount() {
if (!this._isVisible) {
return 0;
}
return this._projectionData.getOutputLineCount();
}
getViewLineContent(model, modelLineNumber, outputLineIndex) {
this._assertVisible();
const startOffsetInInputWithInjections = outputLineIndex > 0 ? this._projectionData.breakOffsets[outputLineIndex - 1] : 0;
const endOffsetInInputWithInjections = this._projectionData.breakOffsets[outputLineIndex];
let r;
if (this._projectionData.injectionOffsets !== null) {
const injectedTexts = this._projectionData.injectionOffsets.map((offset, idx) => new LineInjectedText(0, 0, offset + 1, this._projectionData.injectionOptions[idx], 0));
const lineWithInjections = LineInjectedText.applyInjectedText(model.getLineContent(modelLineNumber), injectedTexts);
r = lineWithInjections.substring(startOffsetInInputWithInjections, endOffsetInInputWithInjections);
} else {
r = model.getValueInRange({
startLineNumber: modelLineNumber,
startColumn: startOffsetInInputWithInjections + 1,
endLineNumber: modelLineNumber,
endColumn: endOffsetInInputWithInjections + 1
});
}
if (outputLineIndex > 0) {
r = spaces(this._projectionData.wrappedTextIndentLength) + r;
}
return r;
}
getViewLineLength(model, modelLineNumber, outputLineIndex) {
this._assertVisible();
return this._projectionData.getLineLength(outputLineIndex);
}
getViewLineMinColumn(_model, _modelLineNumber, outputLineIndex) {
this._assertVisible();
return this._projectionData.getMinOutputOffset(outputLineIndex) + 1;
}
getViewLineMaxColumn(model, modelLineNumber, outputLineIndex) {
this._assertVisible();
return this._projectionData.getMaxOutputOffset(outputLineIndex) + 1;
}
/**
* Try using {@link getViewLinesData} instead.
*/
getViewLineData(model, modelLineNumber, outputLineIndex) {
const arr = new Array();
this.getViewLinesData(model, modelLineNumber, outputLineIndex, 1, 0, [true], arr);
return arr[0];
}
getViewLinesData(model, modelLineNumber, outputLineIdx, lineCount, globalStartIndex, needed, result) {
this._assertVisible();
const lineBreakData = this._projectionData;
const injectionOffsets = lineBreakData.injectionOffsets;
const injectionOptions = lineBreakData.injectionOptions;
let inlineDecorationsPerOutputLine = null;
if (injectionOffsets) {
inlineDecorationsPerOutputLine = [];
let totalInjectedTextLengthBefore = 0;
let currentInjectedOffset = 0;
for (let outputLineIndex = 0; outputLineIndex < lineBreakData.getOutputLineCount(); outputLineIndex++) {
const inlineDecorations = new Array();
inlineDecorationsPerOutputLine[outputLineIndex] = inlineDecorations;
const lineStartOffsetInInputWithInjections = outputLineIndex > 0 ? lineBreakData.breakOffsets[outputLineIndex - 1] : 0;
const lineEndOffsetInInputWithInjections = lineBreakData.breakOffsets[outputLineIndex];
while (currentInjectedOffset < injectionOffsets.length) {
const length = injectionOptions[currentInjectedOffset].content.length;
const injectedTextStartOffsetInInputWithInjections = injectionOffsets[currentInjectedOffset] + totalInjectedTextLengthBefore;
const injectedTextEndOffsetInInputWithInjections = injectedTextStartOffsetInInputWithInjections + length;
if (injectedTextStartOffsetInInputWithInjections > lineEndOffsetInInputWithInjections) {
break;
}
if (lineStartOffsetInInputWithInjections < injectedTextEndOffsetInInputWithInjections) {
const options2 = injectionOptions[currentInjectedOffset];
if (options2.inlineClassName) {
const offset = outputLineIndex > 0 ? lineBreakData.wrappedTextIndentLength : 0;
const start = offset + Math.max(injectedTextStartOffsetInInputWithInjections - lineStartOffsetInInputWithInjections, 0);
const end = offset + Math.min(injectedTextEndOffsetInInputWithInjections - lineStartOffsetInInputWithInjections, lineEndOffsetInInputWithInjections - lineStartOffsetInInputWithInjections);
if (start !== end) {
inlineDecorations.push(new SingleLineInlineDecoration(start, end, options2.inlineClassName, options2.inlineClassNameAffectsLetterSpacing));
}
}
}
if (injectedTextEndOffsetInInputWithInjections <= lineEndOffsetInInputWithInjections) {
totalInjectedTextLengthBefore += length;
currentInjectedOffset++;
} else {
break;
}
}
}
}
let lineWithInjections;
if (injectionOffsets) {
lineWithInjections = model.tokenization.getLineTokens(modelLineNumber).withInserted(injectionOffsets.map((offset, idx) => ({
offset,
text: injectionOptions[idx].content,
tokenMetadata: LineTokens.defaultTokenMetadata
})));
} else {
lineWithInjections = model.tokenization.getLineTokens(modelLineNumber);
}
for (let outputLineIndex = outputLineIdx; outputLineIndex < outputLineIdx + lineCount; outputLineIndex++) {
const globalIndex = globalStartIndex + outputLineIndex - outputLineIdx;
if (!needed[globalIndex]) {
result[globalIndex] = null;
continue;
}
result[globalIndex] = this._getViewLineData(lineWithInjections, inlineDecorationsPerOutputLine ? inlineDecorationsPerOutputLine[outputLineIndex] : null, outputLineIndex);
}
}
_getViewLineData(lineWithInjections, inlineDecorations, outputLineIndex) {
this._assertVisible();
const lineBreakData = this._projectionData;
const deltaStartIndex = outputLineIndex > 0 ? lineBreakData.wrappedTextIndentLength : 0;
const lineStartOffsetInInputWithInjections = outputLineIndex > 0 ? lineBreakData.breakOffsets[outputLineIndex - 1] : 0;
const lineEndOffsetInInputWithInjections = lineBreakData.breakOffsets[outputLineIndex];
const tokens = lineWithInjections.sliceAndInflate(lineStartOffsetInInputWithInjections, lineEndOffsetInInputWithInjections, deltaStartIndex);
let lineContent = tokens.getLineContent();
if (outputLineIndex > 0) {
lineContent = spaces(lineBreakData.wrappedTextIndentLength) + lineContent;
}
const minColumn = this._projectionData.getMinOutputOffset(outputLineIndex) + 1;
const maxColumn = lineContent.length + 1;
const continuesWithWrappedLine = outputLineIndex + 1 < this.getViewLineCount();
const startVisibleColumn = outputLineIndex === 0 ? 0 : lineBreakData.breakOffsetsVisibleColumn[outputLineIndex - 1];
return new ViewLineData(lineContent, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens, inlineDecorations);
}
getModelColumnOfViewPosition(outputLineIndex, outputColumn) {
this._assertVisible();
return this._projectionData.translateToInputOffset(outputLineIndex, outputColumn - 1) + 1;
}
getViewPositionOfModelPosition(deltaLineNumber, inputColumn, affinity = 2) {
this._assertVisible();
const r = this._projectionData.translateToOutputPosition(inputColumn - 1, affinity);
return r.toPosition(deltaLineNumber);
}
getViewLineNumberOfModelPosition(deltaLineNumber, inputColumn) {
this._assertVisible();
const r = this._projectionData.translateToOutputPosition(inputColumn - 1);
return deltaLineNumber + r.outputLineIndex;
}
normalizePosition(outputLineIndex, outputPosition, affinity) {
const baseViewLineNumber = outputPosition.lineNumber - outputLineIndex;
const normalizedOutputPosition = this._projectionData.normalizeOutputPosition(outputLineIndex, outputPosition.column - 1, affinity);
const result = normalizedOutputPosition.toPosition(baseViewLineNumber);
return result;
}
getInjectedTextAt(outputLineIndex, outputColumn) {
return this._projectionData.getInjectedText(outputLineIndex, outputColumn - 1);
}
_assertVisible() {
if (!this._isVisible) {
throw new Error("Not supported");
}
}
};
IdentityModelLineProjection = class {
constructor() {
}
isVisible() {
return true;
}
setVisible(isVisible) {
if (isVisible) {
return this;
}
return HiddenModelLineProjection.INSTANCE;
}
getProjectionData() {
return null;
}
getViewLineCount() {
return 1;
}
getViewLineContent(model, modelLineNumber, _outputLineIndex) {
return model.getLineContent(modelLineNumber);
}
getViewLineLength(model, modelLineNumber, _outputLineIndex) {
return model.getLineLength(modelLineNumber);
}
getViewLineMinColumn(model, modelLineNumber, _outputLineIndex) {
return model.getLineMinColumn(modelLineNumber);
}
getViewLineMaxColumn(model, modelLineNumber, _outputLineIndex) {
return model.getLineMaxColumn(modelLineNumber);
}
getViewLineData(model, modelLineNumber, _outputLineIndex) {
const lineTokens = model.tokenization.getLineTokens(modelLineNumber);
const lineContent = lineTokens.getLineContent();
return new ViewLineData(lineContent, false, 1, lineContent.length + 1, 0, lineTokens.inflate(), null);
}
getViewLinesData(model, modelLineNumber, _fromOuputLineIndex, _toOutputLineIndex, globalStartIndex, needed, result) {
if (!needed[globalStartIndex]) {
result[globalStartIndex] = null;
return;
}
result[globalStartIndex] = this.getViewLineData(model, modelLineNumber, 0);
}
getModelColumnOfViewPosition(_outputLineIndex, outputColumn) {
return outputColumn;
}
getViewPositionOfModelPosition(deltaLineNumber, inputColumn) {
return new Position(deltaLineNumber, inputColumn);
}
getViewLineNumberOfModelPosition(deltaLineNumber, _inputColumn) {
return deltaLineNumber;
}
normalizePosition(outputLineIndex, outputPosition, affinity) {
return outputPosition;
}
getInjectedTextAt(_outputLineIndex, _outputColumn) {
return null;
}
};
IdentityModelLineProjection.INSTANCE = new IdentityModelLineProjection();
HiddenModelLineProjection = class {
constructor() {
}
isVisible() {
return false;
}
setVisible(isVisible) {
if (!isVisible) {
return this;
}
return IdentityModelLineProjection.INSTANCE;
}
getProjectionData() {
return null;
}
getViewLineCount() {
return 0;
}
getViewLineContent(_model, _modelLineNumber, _outputLineIndex) {
throw new Error("Not supported");
}
getViewLineLength(_model, _modelLineNumber, _outputLineIndex) {
throw new Error("Not supported");
}
getViewLineMinColumn(_model, _modelLineNumber, _outputLineIndex) {
throw new Error("Not supported");
}
getViewLineMaxColumn(_model, _modelLineNumber, _outputLineIndex) {
throw new Error("Not supported");
}
getViewLineData(_model, _modelLineNumber, _outputLineIndex) {
throw new Error("Not supported");
}
getViewLinesData(_model, _modelLineNumber, _fromOuputLineIndex, _toOutputLineIndex, _globalStartIndex, _needed, _result) {
throw new Error("Not supported");
}
getModelColumnOfViewPosition(_outputLineIndex, _outputColumn) {
throw new Error("Not supported");
}
getViewPositionOfModelPosition(_deltaLineNumber, _inputColumn) {
throw new Error("Not supported");
}
getViewLineNumberOfModelPosition(_deltaLineNumber, _inputColumn) {
throw new Error("Not supported");
}
normalizePosition(outputLineIndex, outputPosition, affinity) {
throw new Error("Not supported");
}
getInjectedTextAt(_outputLineIndex, _outputColumn) {
throw new Error("Not supported");
}
};
HiddenModelLineProjection.INSTANCE = new HiddenModelLineProjection();
_spaces = [""];
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelLines.js
function normalizeLineRanges(ranges) {
if (ranges.length === 0) {
return [];
}
const sortedRanges = ranges.slice();
sortedRanges.sort(Range.compareRangesUsingStarts);
const result = [];
let currentRangeStart = sortedRanges[0].startLineNumber;
let currentRangeEnd = sortedRanges[0].endLineNumber;
for (let i = 1, len = sortedRanges.length; i < len; i++) {
const range2 = sortedRanges[i];
if (range2.startLineNumber > currentRangeEnd + 1) {
result.push(new Range(currentRangeStart, 1, currentRangeEnd, 1));
currentRangeStart = range2.startLineNumber;
currentRangeEnd = range2.endLineNumber;
} else if (range2.endLineNumber > currentRangeEnd) {
currentRangeEnd = range2.endLineNumber;
}
}
result.push(new Range(currentRangeStart, 1, currentRangeEnd, 1));
return result;
}
var ViewModelLinesFromProjectedModel, ViewLineInfo, ViewLineInfoGroupedByModelRange, CoordinatesConverter, ViewModelLinesFromModelAsIs, IdentityCoordinatesConverter;
var init_viewModelLines = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelLines.js"() {
init_arrays();
init_position();
init_range();
init_textModelGuides();
init_textModel();
init_textModelEvents();
init_viewEvents();
init_modelLineProjection();
init_prefixSumComputer();
init_viewModel();
ViewModelLinesFromProjectedModel = class {
constructor(editorId, model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, fontInfo, tabSize, wrappingStrategy, wrappingColumn, wrappingIndent, wordBreak) {
this._editorId = editorId;
this.model = model;
this._validModelVersionId = -1;
this._domLineBreaksComputerFactory = domLineBreaksComputerFactory;
this._monospaceLineBreaksComputerFactory = monospaceLineBreaksComputerFactory;
this.fontInfo = fontInfo;
this.tabSize = tabSize;
this.wrappingStrategy = wrappingStrategy;
this.wrappingColumn = wrappingColumn;
this.wrappingIndent = wrappingIndent;
this.wordBreak = wordBreak;
this._constructLines(
/*resetHiddenAreas*/
true,
null
);
}
dispose() {
this.hiddenAreasDecorationIds = this.model.deltaDecorations(this.hiddenAreasDecorationIds, []);
}
createCoordinatesConverter() {
return new CoordinatesConverter(this);
}
_constructLines(resetHiddenAreas, previousLineBreaks) {
this.modelLineProjections = [];
if (resetHiddenAreas) {
this.hiddenAreasDecorationIds = this.model.deltaDecorations(this.hiddenAreasDecorationIds, []);
}
const linesContent = this.model.getLinesContent();
const injectedTextDecorations = this.model.getInjectedTextDecorations(this._editorId);
const lineCount = linesContent.length;
const lineBreaksComputer = this.createLineBreaksComputer();
const injectedTextQueue = new ArrayQueue(LineInjectedText.fromDecorations(injectedTextDecorations));
for (let i = 0; i < lineCount; i++) {
const lineInjectedText = injectedTextQueue.takeWhile((t4) => t4.lineNumber === i + 1);
lineBreaksComputer.addRequest(linesContent[i], lineInjectedText, previousLineBreaks ? previousLineBreaks[i] : null);
}
const linesBreaks = lineBreaksComputer.finalize();
const values2 = [];
const hiddenAreas = this.hiddenAreasDecorationIds.map((areaId) => this.model.getDecorationRange(areaId)).sort(Range.compareRangesUsingStarts);
let hiddenAreaStart = 1, hiddenAreaEnd = 0;
let hiddenAreaIdx = -1;
let nextLineNumberToUpdateHiddenArea = hiddenAreaIdx + 1 < hiddenAreas.length ? hiddenAreaEnd + 1 : lineCount + 2;
for (let i = 0; i < lineCount; i++) {
const lineNumber = i + 1;
if (lineNumber === nextLineNumberToUpdateHiddenArea) {
hiddenAreaIdx++;
hiddenAreaStart = hiddenAreas[hiddenAreaIdx].startLineNumber;
hiddenAreaEnd = hiddenAreas[hiddenAreaIdx].endLineNumber;
nextLineNumberToUpdateHiddenArea = hiddenAreaIdx + 1 < hiddenAreas.length ? hiddenAreaEnd + 1 : lineCount + 2;
}
const isInHiddenArea = lineNumber >= hiddenAreaStart && lineNumber <= hiddenAreaEnd;
const line = createModelLineProjection(linesBreaks[i], !isInHiddenArea);
values2[i] = line.getViewLineCount();
this.modelLineProjections[i] = line;
}
this._validModelVersionId = this.model.getVersionId();
this.projectedModelLineLineCounts = new ConstantTimePrefixSumComputer(values2);
}
getHiddenAreas() {
return this.hiddenAreasDecorationIds.map((decId) => this.model.getDecorationRange(decId));
}
setHiddenAreas(_ranges) {
const validatedRanges = _ranges.map((r) => this.model.validateRange(r));
const newRanges = normalizeLineRanges(validatedRanges);
const oldRanges = this.hiddenAreasDecorationIds.map((areaId) => this.model.getDecorationRange(areaId)).sort(Range.compareRangesUsingStarts);
if (newRanges.length === oldRanges.length) {
let hasDifference = false;
for (let i = 0; i < newRanges.length; i++) {
if (!newRanges[i].equalsRange(oldRanges[i])) {
hasDifference = true;
break;
}
}
if (!hasDifference) {
return false;
}
}
const newDecorations = newRanges.map((r) => ({
range: r,
options: ModelDecorationOptions.EMPTY
}));
this.hiddenAreasDecorationIds = this.model.deltaDecorations(this.hiddenAreasDecorationIds, newDecorations);
const hiddenAreas = newRanges;
let hiddenAreaStart = 1, hiddenAreaEnd = 0;
let hiddenAreaIdx = -1;
let nextLineNumberToUpdateHiddenArea = hiddenAreaIdx + 1 < hiddenAreas.length ? hiddenAreaEnd + 1 : this.modelLineProjections.length + 2;
let hasVisibleLine = false;
for (let i = 0; i < this.modelLineProjections.length; i++) {
const lineNumber = i + 1;
if (lineNumber === nextLineNumberToUpdateHiddenArea) {
hiddenAreaIdx++;
hiddenAreaStart = hiddenAreas[hiddenAreaIdx].startLineNumber;
hiddenAreaEnd = hiddenAreas[hiddenAreaIdx].endLineNumber;
nextLineNumberToUpdateHiddenArea = hiddenAreaIdx + 1 < hiddenAreas.length ? hiddenAreaEnd + 1 : this.modelLineProjections.length + 2;
}
let lineChanged = false;
if (lineNumber >= hiddenAreaStart && lineNumber <= hiddenAreaEnd) {
if (this.modelLineProjections[i].isVisible()) {
this.modelLineProjections[i] = this.modelLineProjections[i].setVisible(false);
lineChanged = true;
}
} else {
hasVisibleLine = true;
if (!this.modelLineProjections[i].isVisible()) {
this.modelLineProjections[i] = this.modelLineProjections[i].setVisible(true);
lineChanged = true;
}
}
if (lineChanged) {
const newOutputLineCount = this.modelLineProjections[i].getViewLineCount();
this.projectedModelLineLineCounts.setValue(i, newOutputLineCount);
}
}
if (!hasVisibleLine) {
this.setHiddenAreas([]);
}
return true;
}
modelPositionIsVisible(modelLineNumber, _modelColumn) {
if (modelLineNumber < 1 || modelLineNumber > this.modelLineProjections.length) {
return false;
}
return this.modelLineProjections[modelLineNumber - 1].isVisible();
}
getModelLineViewLineCount(modelLineNumber) {
if (modelLineNumber < 1 || modelLineNumber > this.modelLineProjections.length) {
return 1;
}
return this.modelLineProjections[modelLineNumber - 1].getViewLineCount();
}
setTabSize(newTabSize) {
if (this.tabSize === newTabSize) {
return false;
}
this.tabSize = newTabSize;
this._constructLines(
/*resetHiddenAreas*/
false,
null
);
return true;
}
setWrappingSettings(fontInfo, wrappingStrategy, wrappingColumn, wrappingIndent, wordBreak) {
const equalFontInfo = this.fontInfo.equals(fontInfo);
const equalWrappingStrategy = this.wrappingStrategy === wrappingStrategy;
const equalWrappingColumn = this.wrappingColumn === wrappingColumn;
const equalWrappingIndent = this.wrappingIndent === wrappingIndent;
const equalWordBreak = this.wordBreak === wordBreak;
if (equalFontInfo && equalWrappingStrategy && equalWrappingColumn && equalWrappingIndent && equalWordBreak) {
return false;
}
const onlyWrappingColumnChanged = equalFontInfo && equalWrappingStrategy && !equalWrappingColumn && equalWrappingIndent && equalWordBreak;
this.fontInfo = fontInfo;
this.wrappingStrategy = wrappingStrategy;
this.wrappingColumn = wrappingColumn;
this.wrappingIndent = wrappingIndent;
this.wordBreak = wordBreak;
let previousLineBreaks = null;
if (onlyWrappingColumnChanged) {
previousLineBreaks = [];
for (let i = 0, len = this.modelLineProjections.length; i < len; i++) {
previousLineBreaks[i] = this.modelLineProjections[i].getProjectionData();
}
}
this._constructLines(
/*resetHiddenAreas*/
false,
previousLineBreaks
);
return true;
}
createLineBreaksComputer() {
const lineBreaksComputerFactory = this.wrappingStrategy === "advanced" ? this._domLineBreaksComputerFactory : this._monospaceLineBreaksComputerFactory;
return lineBreaksComputerFactory.createLineBreaksComputer(this.fontInfo, this.tabSize, this.wrappingColumn, this.wrappingIndent, this.wordBreak);
}
onModelFlushed() {
this._constructLines(
/*resetHiddenAreas*/
true,
null
);
}
onModelLinesDeleted(versionId, fromLineNumber, toLineNumber) {
if (!versionId || versionId <= this._validModelVersionId) {
return null;
}
const outputFromLineNumber = fromLineNumber === 1 ? 1 : this.projectedModelLineLineCounts.getPrefixSum(fromLineNumber - 1) + 1;
const outputToLineNumber = this.projectedModelLineLineCounts.getPrefixSum(toLineNumber);
this.modelLineProjections.splice(fromLineNumber - 1, toLineNumber - fromLineNumber + 1);
this.projectedModelLineLineCounts.removeValues(fromLineNumber - 1, toLineNumber - fromLineNumber + 1);
return new ViewLinesDeletedEvent(outputFromLineNumber, outputToLineNumber);
}
onModelLinesInserted(versionId, fromLineNumber, _toLineNumber, lineBreaks) {
if (!versionId || versionId <= this._validModelVersionId) {
return null;
}
const isInHiddenArea = fromLineNumber > 2 && !this.modelLineProjections[fromLineNumber - 2].isVisible();
const outputFromLineNumber = fromLineNumber === 1 ? 1 : this.projectedModelLineLineCounts.getPrefixSum(fromLineNumber - 1) + 1;
let totalOutputLineCount = 0;
const insertLines = [];
const insertPrefixSumValues = [];
for (let i = 0, len = lineBreaks.length; i < len; i++) {
const line = createModelLineProjection(lineBreaks[i], !isInHiddenArea);
insertLines.push(line);
const outputLineCount = line.getViewLineCount();
totalOutputLineCount += outputLineCount;
insertPrefixSumValues[i] = outputLineCount;
}
this.modelLineProjections = this.modelLineProjections.slice(0, fromLineNumber - 1).concat(insertLines).concat(this.modelLineProjections.slice(fromLineNumber - 1));
this.projectedModelLineLineCounts.insertValues(fromLineNumber - 1, insertPrefixSumValues);
return new ViewLinesInsertedEvent(outputFromLineNumber, outputFromLineNumber + totalOutputLineCount - 1);
}
onModelLineChanged(versionId, lineNumber, lineBreakData) {
if (versionId !== null && versionId <= this._validModelVersionId) {
return [false, null, null, null];
}
const lineIndex = lineNumber - 1;
const oldOutputLineCount = this.modelLineProjections[lineIndex].getViewLineCount();
const isVisible = this.modelLineProjections[lineIndex].isVisible();
const line = createModelLineProjection(lineBreakData, isVisible);
this.modelLineProjections[lineIndex] = line;
const newOutputLineCount = this.modelLineProjections[lineIndex].getViewLineCount();
let lineMappingChanged = false;
let changeFrom = 0;
let changeTo = -1;
let insertFrom = 0;
let insertTo = -1;
let deleteFrom = 0;
let deleteTo = -1;
if (oldOutputLineCount > newOutputLineCount) {
changeFrom = this.projectedModelLineLineCounts.getPrefixSum(lineNumber - 1) + 1;
changeTo = changeFrom + newOutputLineCount - 1;
deleteFrom = changeTo + 1;
deleteTo = deleteFrom + (oldOutputLineCount - newOutputLineCount) - 1;
lineMappingChanged = true;
} else if (oldOutputLineCount < newOutputLineCount) {
changeFrom = this.projectedModelLineLineCounts.getPrefixSum(lineNumber - 1) + 1;
changeTo = changeFrom + oldOutputLineCount - 1;
insertFrom = changeTo + 1;
insertTo = insertFrom + (newOutputLineCount - oldOutputLineCount) - 1;
lineMappingChanged = true;
} else {
changeFrom = this.projectedModelLineLineCounts.getPrefixSum(lineNumber - 1) + 1;
changeTo = changeFrom + newOutputLineCount - 1;
}
this.projectedModelLineLineCounts.setValue(lineIndex, newOutputLineCount);
const viewLinesChangedEvent = changeFrom <= changeTo ? new ViewLinesChangedEvent(changeFrom, changeTo - changeFrom + 1) : null;
const viewLinesInsertedEvent = insertFrom <= insertTo ? new ViewLinesInsertedEvent(insertFrom, insertTo) : null;
const viewLinesDeletedEvent = deleteFrom <= deleteTo ? new ViewLinesDeletedEvent(deleteFrom, deleteTo) : null;
return [lineMappingChanged, viewLinesChangedEvent, viewLinesInsertedEvent, viewLinesDeletedEvent];
}
acceptVersionId(versionId) {
this._validModelVersionId = versionId;
if (this.modelLineProjections.length === 1 && !this.modelLineProjections[0].isVisible()) {
this.setHiddenAreas([]);
}
}
getViewLineCount() {
return this.projectedModelLineLineCounts.getTotalSum();
}
_toValidViewLineNumber(viewLineNumber) {
if (viewLineNumber < 1) {
return 1;
}
const viewLineCount = this.getViewLineCount();
if (viewLineNumber > viewLineCount) {
return viewLineCount;
}
return viewLineNumber | 0;
}
getActiveIndentGuide(viewLineNumber, minLineNumber, maxLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
minLineNumber = this._toValidViewLineNumber(minLineNumber);
maxLineNumber = this._toValidViewLineNumber(maxLineNumber);
const modelPosition = this.convertViewPositionToModelPosition(viewLineNumber, this.getViewLineMinColumn(viewLineNumber));
const modelMinPosition = this.convertViewPositionToModelPosition(minLineNumber, this.getViewLineMinColumn(minLineNumber));
const modelMaxPosition = this.convertViewPositionToModelPosition(maxLineNumber, this.getViewLineMinColumn(maxLineNumber));
const result = this.model.guides.getActiveIndentGuide(modelPosition.lineNumber, modelMinPosition.lineNumber, modelMaxPosition.lineNumber);
const viewStartPosition = this.convertModelPositionToViewPosition(result.startLineNumber, 1);
const viewEndPosition = this.convertModelPositionToViewPosition(result.endLineNumber, this.model.getLineMaxColumn(result.endLineNumber));
return {
startLineNumber: viewStartPosition.lineNumber,
endLineNumber: viewEndPosition.lineNumber,
indent: result.indent
};
}
// #region ViewLineInfo
getViewLineInfo(viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
const r = this.projectedModelLineLineCounts.getIndexOf(viewLineNumber - 1);
const lineIndex = r.index;
const remainder = r.remainder;
return new ViewLineInfo(lineIndex + 1, remainder);
}
getMinColumnOfViewLine(viewLineInfo) {
return this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewLineMinColumn(this.model, viewLineInfo.modelLineNumber, viewLineInfo.modelLineWrappedLineIdx);
}
getMaxColumnOfViewLine(viewLineInfo) {
return this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewLineMaxColumn(this.model, viewLineInfo.modelLineNumber, viewLineInfo.modelLineWrappedLineIdx);
}
getModelStartPositionOfViewLine(viewLineInfo) {
const line = this.modelLineProjections[viewLineInfo.modelLineNumber - 1];
const minViewColumn = line.getViewLineMinColumn(this.model, viewLineInfo.modelLineNumber, viewLineInfo.modelLineWrappedLineIdx);
const column = line.getModelColumnOfViewPosition(viewLineInfo.modelLineWrappedLineIdx, minViewColumn);
return new Position(viewLineInfo.modelLineNumber, column);
}
getModelEndPositionOfViewLine(viewLineInfo) {
const line = this.modelLineProjections[viewLineInfo.modelLineNumber - 1];
const maxViewColumn = line.getViewLineMaxColumn(this.model, viewLineInfo.modelLineNumber, viewLineInfo.modelLineWrappedLineIdx);
const column = line.getModelColumnOfViewPosition(viewLineInfo.modelLineWrappedLineIdx, maxViewColumn);
return new Position(viewLineInfo.modelLineNumber, column);
}
getViewLineInfosGroupedByModelRanges(viewStartLineNumber, viewEndLineNumber) {
const startViewLine = this.getViewLineInfo(viewStartLineNumber);
const endViewLine = this.getViewLineInfo(viewEndLineNumber);
const result = new Array();
let lastVisibleModelPos = this.getModelStartPositionOfViewLine(startViewLine);
let viewLines = new Array();
for (let curModelLine = startViewLine.modelLineNumber; curModelLine <= endViewLine.modelLineNumber; curModelLine++) {
const line = this.modelLineProjections[curModelLine - 1];
if (line.isVisible()) {
const startOffset = curModelLine === startViewLine.modelLineNumber ? startViewLine.modelLineWrappedLineIdx : 0;
const endOffset = curModelLine === endViewLine.modelLineNumber ? endViewLine.modelLineWrappedLineIdx + 1 : line.getViewLineCount();
for (let i = startOffset; i < endOffset; i++) {
viewLines.push(new ViewLineInfo(curModelLine, i));
}
}
if (!line.isVisible() && lastVisibleModelPos) {
const lastVisibleModelPos2 = new Position(curModelLine - 1, this.model.getLineMaxColumn(curModelLine - 1) + 1);
const modelRange = Range.fromPositions(lastVisibleModelPos, lastVisibleModelPos2);
result.push(new ViewLineInfoGroupedByModelRange(modelRange, viewLines));
viewLines = [];
lastVisibleModelPos = null;
} else if (line.isVisible() && !lastVisibleModelPos) {
lastVisibleModelPos = new Position(curModelLine, 1);
}
}
if (lastVisibleModelPos) {
const modelRange = Range.fromPositions(lastVisibleModelPos, this.getModelEndPositionOfViewLine(endViewLine));
result.push(new ViewLineInfoGroupedByModelRange(modelRange, viewLines));
}
return result;
}
// #endregion
getViewLinesBracketGuides(viewStartLineNumber, viewEndLineNumber, activeViewPosition, options2) {
const modelActivePosition = activeViewPosition ? this.convertViewPositionToModelPosition(activeViewPosition.lineNumber, activeViewPosition.column) : null;
const resultPerViewLine = [];
for (const group of this.getViewLineInfosGroupedByModelRanges(viewStartLineNumber, viewEndLineNumber)) {
const modelRangeStartLineNumber = group.modelRange.startLineNumber;
const bracketGuidesPerModelLine = this.model.guides.getLinesBracketGuides(modelRangeStartLineNumber, group.modelRange.endLineNumber, modelActivePosition, options2);
for (const viewLineInfo of group.viewLines) {
const bracketGuides = bracketGuidesPerModelLine[viewLineInfo.modelLineNumber - modelRangeStartLineNumber];
const result = bracketGuides.map((g) => {
if (g.forWrappedLinesAfterColumn !== -1) {
const p2 = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.forWrappedLinesAfterColumn);
if (p2.lineNumber >= viewLineInfo.modelLineWrappedLineIdx) {
return void 0;
}
}
if (g.forWrappedLinesBeforeOrAtColumn !== -1) {
const p2 = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.forWrappedLinesBeforeOrAtColumn);
if (p2.lineNumber < viewLineInfo.modelLineWrappedLineIdx) {
return void 0;
}
}
if (!g.horizontalLine) {
return g;
}
let column = -1;
if (g.column !== -1) {
const p2 = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.column);
if (p2.lineNumber === viewLineInfo.modelLineWrappedLineIdx) {
column = p2.column;
} else if (p2.lineNumber < viewLineInfo.modelLineWrappedLineIdx) {
column = this.getMinColumnOfViewLine(viewLineInfo);
} else if (p2.lineNumber > viewLineInfo.modelLineWrappedLineIdx) {
return void 0;
}
}
const viewPosition = this.convertModelPositionToViewPosition(viewLineInfo.modelLineNumber, g.horizontalLine.endColumn);
const p = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.horizontalLine.endColumn);
if (p.lineNumber === viewLineInfo.modelLineWrappedLineIdx) {
return new IndentGuide(g.visibleColumn, column, g.className, new IndentGuideHorizontalLine(g.horizontalLine.top, viewPosition.column), -1, -1);
} else if (p.lineNumber < viewLineInfo.modelLineWrappedLineIdx) {
return void 0;
} else {
if (g.visibleColumn !== -1) {
return void 0;
}
return new IndentGuide(g.visibleColumn, column, g.className, new IndentGuideHorizontalLine(g.horizontalLine.top, this.getMaxColumnOfViewLine(viewLineInfo)), -1, -1);
}
});
resultPerViewLine.push(result.filter((r) => !!r));
}
}
return resultPerViewLine;
}
getViewLinesIndentGuides(viewStartLineNumber, viewEndLineNumber) {
viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber);
viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber);
const modelStart = this.convertViewPositionToModelPosition(viewStartLineNumber, this.getViewLineMinColumn(viewStartLineNumber));
const modelEnd = this.convertViewPositionToModelPosition(viewEndLineNumber, this.getViewLineMaxColumn(viewEndLineNumber));
let result = [];
const resultRepeatCount = [];
const resultRepeatOption = [];
const modelStartLineIndex = modelStart.lineNumber - 1;
const modelEndLineIndex = modelEnd.lineNumber - 1;
let reqStart = null;
for (let modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) {
const line = this.modelLineProjections[modelLineIndex];
if (line.isVisible()) {
const viewLineStartIndex = line.getViewLineNumberOfModelPosition(0, modelLineIndex === modelStartLineIndex ? modelStart.column : 1);
const viewLineEndIndex = line.getViewLineNumberOfModelPosition(0, this.model.getLineMaxColumn(modelLineIndex + 1));
const count = viewLineEndIndex - viewLineStartIndex + 1;
let option = 0;
if (count > 1 && line.getViewLineMinColumn(this.model, modelLineIndex + 1, viewLineEndIndex) === 1) {
option = viewLineStartIndex === 0 ? 1 : 2;
}
resultRepeatCount.push(count);
resultRepeatOption.push(option);
if (reqStart === null) {
reqStart = new Position(modelLineIndex + 1, 0);
}
} else {
if (reqStart !== null) {
result = result.concat(this.model.guides.getLinesIndentGuides(reqStart.lineNumber, modelLineIndex));
reqStart = null;
}
}
}
if (reqStart !== null) {
result = result.concat(this.model.guides.getLinesIndentGuides(reqStart.lineNumber, modelEnd.lineNumber));
reqStart = null;
}
const viewLineCount = viewEndLineNumber - viewStartLineNumber + 1;
const viewIndents = new Array(viewLineCount);
let currIndex = 0;
for (let i = 0, len = result.length; i < len; i++) {
let value = result[i];
const count = Math.min(viewLineCount - currIndex, resultRepeatCount[i]);
const option = resultRepeatOption[i];
let blockAtIndex;
if (option === 2) {
blockAtIndex = 0;
} else if (option === 1) {
blockAtIndex = 1;
} else {
blockAtIndex = count;
}
for (let j = 0; j < count; j++) {
if (j === blockAtIndex) {
value = 0;
}
viewIndents[currIndex++] = value;
}
}
return viewIndents;
}
getViewLineContent(viewLineNumber) {
const info = this.getViewLineInfo(viewLineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getViewLineContent(this.model, info.modelLineNumber, info.modelLineWrappedLineIdx);
}
getViewLineLength(viewLineNumber) {
const info = this.getViewLineInfo(viewLineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getViewLineLength(this.model, info.modelLineNumber, info.modelLineWrappedLineIdx);
}
getViewLineMinColumn(viewLineNumber) {
const info = this.getViewLineInfo(viewLineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getViewLineMinColumn(this.model, info.modelLineNumber, info.modelLineWrappedLineIdx);
}
getViewLineMaxColumn(viewLineNumber) {
const info = this.getViewLineInfo(viewLineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getViewLineMaxColumn(this.model, info.modelLineNumber, info.modelLineWrappedLineIdx);
}
getViewLineData(viewLineNumber) {
const info = this.getViewLineInfo(viewLineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getViewLineData(this.model, info.modelLineNumber, info.modelLineWrappedLineIdx);
}
getViewLinesData(viewStartLineNumber, viewEndLineNumber, needed) {
viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber);
viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber);
const start = this.projectedModelLineLineCounts.getIndexOf(viewStartLineNumber - 1);
let viewLineNumber = viewStartLineNumber;
const startModelLineIndex = start.index;
const startRemainder = start.remainder;
const result = [];
for (let modelLineIndex = startModelLineIndex, len = this.model.getLineCount(); modelLineIndex < len; modelLineIndex++) {
const line = this.modelLineProjections[modelLineIndex];
if (!line.isVisible()) {
continue;
}
const fromViewLineIndex = modelLineIndex === startModelLineIndex ? startRemainder : 0;
let remainingViewLineCount = line.getViewLineCount() - fromViewLineIndex;
let lastLine = false;
if (viewLineNumber + remainingViewLineCount > viewEndLineNumber) {
lastLine = true;
remainingViewLineCount = viewEndLineNumber - viewLineNumber + 1;
}
line.getViewLinesData(this.model, modelLineIndex + 1, fromViewLineIndex, remainingViewLineCount, viewLineNumber - viewStartLineNumber, needed, result);
viewLineNumber += remainingViewLineCount;
if (lastLine) {
break;
}
}
return result;
}
validateViewPosition(viewLineNumber, viewColumn, expectedModelPosition) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
const r = this.projectedModelLineLineCounts.getIndexOf(viewLineNumber - 1);
const lineIndex = r.index;
const remainder = r.remainder;
const line = this.modelLineProjections[lineIndex];
const minColumn = line.getViewLineMinColumn(this.model, lineIndex + 1, remainder);
const maxColumn = line.getViewLineMaxColumn(this.model, lineIndex + 1, remainder);
if (viewColumn < minColumn) {
viewColumn = minColumn;
}
if (viewColumn > maxColumn) {
viewColumn = maxColumn;
}
const computedModelColumn = line.getModelColumnOfViewPosition(remainder, viewColumn);
const computedModelPosition = this.model.validatePosition(new Position(lineIndex + 1, computedModelColumn));
if (computedModelPosition.equals(expectedModelPosition)) {
return new Position(viewLineNumber, viewColumn);
}
return this.convertModelPositionToViewPosition(expectedModelPosition.lineNumber, expectedModelPosition.column);
}
validateViewRange(viewRange, expectedModelRange) {
const validViewStart = this.validateViewPosition(viewRange.startLineNumber, viewRange.startColumn, expectedModelRange.getStartPosition());
const validViewEnd = this.validateViewPosition(viewRange.endLineNumber, viewRange.endColumn, expectedModelRange.getEndPosition());
return new Range(validViewStart.lineNumber, validViewStart.column, validViewEnd.lineNumber, validViewEnd.column);
}
convertViewPositionToModelPosition(viewLineNumber, viewColumn) {
const info = this.getViewLineInfo(viewLineNumber);
const inputColumn = this.modelLineProjections[info.modelLineNumber - 1].getModelColumnOfViewPosition(info.modelLineWrappedLineIdx, viewColumn);
return this.model.validatePosition(new Position(info.modelLineNumber, inputColumn));
}
convertViewRangeToModelRange(viewRange) {
const start = this.convertViewPositionToModelPosition(viewRange.startLineNumber, viewRange.startColumn);
const end = this.convertViewPositionToModelPosition(viewRange.endLineNumber, viewRange.endColumn);
return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
}
convertModelPositionToViewPosition(_modelLineNumber, _modelColumn, affinity = 2, allowZeroLineNumber = false, belowHiddenRanges = false) {
const validPosition = this.model.validatePosition(new Position(_modelLineNumber, _modelColumn));
const inputLineNumber = validPosition.lineNumber;
const inputColumn = validPosition.column;
let lineIndex = inputLineNumber - 1, lineIndexChanged = false;
if (belowHiddenRanges) {
while (lineIndex < this.modelLineProjections.length && !this.modelLineProjections[lineIndex].isVisible()) {
lineIndex++;
lineIndexChanged = true;
}
} else {
while (lineIndex > 0 && !this.modelLineProjections[lineIndex].isVisible()) {
lineIndex--;
lineIndexChanged = true;
}
}
if (lineIndex === 0 && !this.modelLineProjections[lineIndex].isVisible()) {
return new Position(allowZeroLineNumber ? 0 : 1, 1);
}
const deltaLineNumber = 1 + this.projectedModelLineLineCounts.getPrefixSum(lineIndex);
let r;
if (lineIndexChanged) {
if (belowHiddenRanges) {
r = this.modelLineProjections[lineIndex].getViewPositionOfModelPosition(deltaLineNumber, 1, affinity);
} else {
r = this.modelLineProjections[lineIndex].getViewPositionOfModelPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1), affinity);
}
} else {
r = this.modelLineProjections[inputLineNumber - 1].getViewPositionOfModelPosition(deltaLineNumber, inputColumn, affinity);
}
return r;
}
/**
* @param affinity The affinity in case of an empty range. Has no effect for non-empty ranges.
*/
convertModelRangeToViewRange(modelRange, affinity = 0) {
if (modelRange.isEmpty()) {
const start = this.convertModelPositionToViewPosition(modelRange.startLineNumber, modelRange.startColumn, affinity);
return Range.fromPositions(start);
} else {
const start = this.convertModelPositionToViewPosition(
modelRange.startLineNumber,
modelRange.startColumn,
1
/* PositionAffinity.Right */
);
const end = this.convertModelPositionToViewPosition(
modelRange.endLineNumber,
modelRange.endColumn,
0
/* PositionAffinity.Left */
);
return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
}
}
getViewLineNumberOfModelPosition(modelLineNumber, modelColumn) {
let lineIndex = modelLineNumber - 1;
if (this.modelLineProjections[lineIndex].isVisible()) {
const deltaLineNumber2 = 1 + this.projectedModelLineLineCounts.getPrefixSum(lineIndex);
return this.modelLineProjections[lineIndex].getViewLineNumberOfModelPosition(deltaLineNumber2, modelColumn);
}
while (lineIndex > 0 && !this.modelLineProjections[lineIndex].isVisible()) {
lineIndex--;
}
if (lineIndex === 0 && !this.modelLineProjections[lineIndex].isVisible()) {
return 1;
}
const deltaLineNumber = 1 + this.projectedModelLineLineCounts.getPrefixSum(lineIndex);
return this.modelLineProjections[lineIndex].getViewLineNumberOfModelPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1));
}
getDecorationsInRange(range2, ownerId2, filterOutValidation, onlyMinimapDecorations, onlyMarginDecorations) {
const modelStart = this.convertViewPositionToModelPosition(range2.startLineNumber, range2.startColumn);
const modelEnd = this.convertViewPositionToModelPosition(range2.endLineNumber, range2.endColumn);
if (modelEnd.lineNumber - modelStart.lineNumber <= range2.endLineNumber - range2.startLineNumber) {
return this.model.getDecorationsInRange(new Range(modelStart.lineNumber, 1, modelEnd.lineNumber, modelEnd.column), ownerId2, filterOutValidation, onlyMinimapDecorations, onlyMarginDecorations);
}
let result = [];
const modelStartLineIndex = modelStart.lineNumber - 1;
const modelEndLineIndex = modelEnd.lineNumber - 1;
let reqStart = null;
for (let modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) {
const line = this.modelLineProjections[modelLineIndex];
if (line.isVisible()) {
if (reqStart === null) {
reqStart = new Position(modelLineIndex + 1, modelLineIndex === modelStartLineIndex ? modelStart.column : 1);
}
} else {
if (reqStart !== null) {
const maxLineColumn = this.model.getLineMaxColumn(modelLineIndex);
result = result.concat(this.model.getDecorationsInRange(new Range(reqStart.lineNumber, reqStart.column, modelLineIndex, maxLineColumn), ownerId2, filterOutValidation, onlyMinimapDecorations));
reqStart = null;
}
}
}
if (reqStart !== null) {
result = result.concat(this.model.getDecorationsInRange(new Range(reqStart.lineNumber, reqStart.column, modelEnd.lineNumber, modelEnd.column), ownerId2, filterOutValidation, onlyMinimapDecorations));
reqStart = null;
}
result.sort((a3, b) => {
const res = Range.compareRangesUsingStarts(a3.range, b.range);
if (res === 0) {
if (a3.id < b.id) {
return -1;
}
if (a3.id > b.id) {
return 1;
}
return 0;
}
return res;
});
const finalResult = [];
let finalResultLen = 0;
let prevDecId = null;
for (const dec of result) {
const decId = dec.id;
if (prevDecId === decId) {
continue;
}
prevDecId = decId;
finalResult[finalResultLen++] = dec;
}
return finalResult;
}
getInjectedTextAt(position) {
const info = this.getViewLineInfo(position.lineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].getInjectedTextAt(info.modelLineWrappedLineIdx, position.column);
}
normalizePosition(position, affinity) {
const info = this.getViewLineInfo(position.lineNumber);
return this.modelLineProjections[info.modelLineNumber - 1].normalizePosition(info.modelLineWrappedLineIdx, position, affinity);
}
getLineIndentColumn(lineNumber) {
const info = this.getViewLineInfo(lineNumber);
if (info.modelLineWrappedLineIdx === 0) {
return this.model.getLineIndentColumn(info.modelLineNumber);
}
return 0;
}
};
ViewLineInfo = class {
constructor(modelLineNumber, modelLineWrappedLineIdx) {
this.modelLineNumber = modelLineNumber;
this.modelLineWrappedLineIdx = modelLineWrappedLineIdx;
}
};
ViewLineInfoGroupedByModelRange = class {
constructor(modelRange, viewLines) {
this.modelRange = modelRange;
this.viewLines = viewLines;
}
};
CoordinatesConverter = class {
constructor(lines) {
this._lines = lines;
}
// View -> Model conversion and related methods
convertViewPositionToModelPosition(viewPosition) {
return this._lines.convertViewPositionToModelPosition(viewPosition.lineNumber, viewPosition.column);
}
convertViewRangeToModelRange(viewRange) {
return this._lines.convertViewRangeToModelRange(viewRange);
}
validateViewPosition(viewPosition, expectedModelPosition) {
return this._lines.validateViewPosition(viewPosition.lineNumber, viewPosition.column, expectedModelPosition);
}
validateViewRange(viewRange, expectedModelRange) {
return this._lines.validateViewRange(viewRange, expectedModelRange);
}
// Model -> View conversion and related methods
convertModelPositionToViewPosition(modelPosition, affinity, allowZero, belowHiddenRanges) {
return this._lines.convertModelPositionToViewPosition(modelPosition.lineNumber, modelPosition.column, affinity, allowZero, belowHiddenRanges);
}
convertModelRangeToViewRange(modelRange, affinity) {
return this._lines.convertModelRangeToViewRange(modelRange, affinity);
}
modelPositionIsVisible(modelPosition) {
return this._lines.modelPositionIsVisible(modelPosition.lineNumber, modelPosition.column);
}
getModelLineViewLineCount(modelLineNumber) {
return this._lines.getModelLineViewLineCount(modelLineNumber);
}
getViewLineNumberOfModelPosition(modelLineNumber, modelColumn) {
return this._lines.getViewLineNumberOfModelPosition(modelLineNumber, modelColumn);
}
};
ViewModelLinesFromModelAsIs = class {
constructor(model) {
this.model = model;
}
dispose() {
}
createCoordinatesConverter() {
return new IdentityCoordinatesConverter(this);
}
getHiddenAreas() {
return [];
}
setHiddenAreas(_ranges) {
return false;
}
setTabSize(_newTabSize) {
return false;
}
setWrappingSettings(_fontInfo, _wrappingStrategy, _wrappingColumn, _wrappingIndent) {
return false;
}
createLineBreaksComputer() {
const result = [];
return {
addRequest: (lineText, injectedText, previousLineBreakData) => {
result.push(null);
},
finalize: () => {
return result;
}
};
}
onModelFlushed() {
}
onModelLinesDeleted(_versionId, fromLineNumber, toLineNumber) {
return new ViewLinesDeletedEvent(fromLineNumber, toLineNumber);
}
onModelLinesInserted(_versionId, fromLineNumber, toLineNumber, lineBreaks) {
return new ViewLinesInsertedEvent(fromLineNumber, toLineNumber);
}
onModelLineChanged(_versionId, lineNumber, lineBreakData) {
return [false, new ViewLinesChangedEvent(lineNumber, 1), null, null];
}
acceptVersionId(_versionId) {
}
getViewLineCount() {
return this.model.getLineCount();
}
getActiveIndentGuide(viewLineNumber, _minLineNumber, _maxLineNumber) {
return {
startLineNumber: viewLineNumber,
endLineNumber: viewLineNumber,
indent: 0
};
}
getViewLinesBracketGuides(startLineNumber, endLineNumber, activePosition) {
return new Array(endLineNumber - startLineNumber + 1).fill([]);
}
getViewLinesIndentGuides(viewStartLineNumber, viewEndLineNumber) {
const viewLineCount = viewEndLineNumber - viewStartLineNumber + 1;
const result = new Array(viewLineCount);
for (let i = 0; i < viewLineCount; i++) {
result[i] = 0;
}
return result;
}
getViewLineContent(viewLineNumber) {
return this.model.getLineContent(viewLineNumber);
}
getViewLineLength(viewLineNumber) {
return this.model.getLineLength(viewLineNumber);
}
getViewLineMinColumn(viewLineNumber) {
return this.model.getLineMinColumn(viewLineNumber);
}
getViewLineMaxColumn(viewLineNumber) {
return this.model.getLineMaxColumn(viewLineNumber);
}
getViewLineData(viewLineNumber) {
const lineTokens = this.model.tokenization.getLineTokens(viewLineNumber);
const lineContent = lineTokens.getLineContent();
return new ViewLineData(lineContent, false, 1, lineContent.length + 1, 0, lineTokens.inflate(), null);
}
getViewLinesData(viewStartLineNumber, viewEndLineNumber, needed) {
const lineCount = this.model.getLineCount();
viewStartLineNumber = Math.min(Math.max(1, viewStartLineNumber), lineCount);
viewEndLineNumber = Math.min(Math.max(1, viewEndLineNumber), lineCount);
const result = [];
for (let lineNumber = viewStartLineNumber; lineNumber <= viewEndLineNumber; lineNumber++) {
const idx = lineNumber - viewStartLineNumber;
result[idx] = needed[idx] ? this.getViewLineData(lineNumber) : null;
}
return result;
}
getDecorationsInRange(range2, ownerId2, filterOutValidation, onlyMinimapDecorations, onlyMarginDecorations) {
return this.model.getDecorationsInRange(range2, ownerId2, filterOutValidation, onlyMinimapDecorations, onlyMarginDecorations);
}
normalizePosition(position, affinity) {
return this.model.normalizePosition(position, affinity);
}
getLineIndentColumn(lineNumber) {
return this.model.getLineIndentColumn(lineNumber);
}
getInjectedTextAt(position) {
return null;
}
};
IdentityCoordinatesConverter = class {
constructor(lines) {
this._lines = lines;
}
_validPosition(pos) {
return this._lines.model.validatePosition(pos);
}
_validRange(range2) {
return this._lines.model.validateRange(range2);
}
// View -> Model conversion and related methods
convertViewPositionToModelPosition(viewPosition) {
return this._validPosition(viewPosition);
}
convertViewRangeToModelRange(viewRange) {
return this._validRange(viewRange);
}
validateViewPosition(_viewPosition, expectedModelPosition) {
return this._validPosition(expectedModelPosition);
}
validateViewRange(_viewRange, expectedModelRange) {
return this._validRange(expectedModelRange);
}
// Model -> View conversion and related methods
convertModelPositionToViewPosition(modelPosition) {
return this._validPosition(modelPosition);
}
convertModelRangeToViewRange(modelRange) {
return this._validRange(modelRange);
}
modelPositionIsVisible(modelPosition) {
const lineCount = this._lines.model.getLineCount();
if (modelPosition.lineNumber < 1 || modelPosition.lineNumber > lineCount) {
return false;
}
return true;
}
getModelLineViewLineCount(modelLineNumber) {
return 1;
}
getViewLineNumberOfModelPosition(modelLineNumber, modelColumn) {
return modelLineNumber;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/glyphLanesModel.js
var MAX_LANE, GlyphMarginLanesModel;
var init_glyphLanesModel = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/glyphLanesModel.js"() {
init_model2();
MAX_LANE = GlyphMarginLane2.Right;
GlyphMarginLanesModel = class {
constructor(maxLine) {
this.persist = 0;
this._requiredLanes = 1;
this.lanes = new Uint8Array(Math.ceil((maxLine + 1) * MAX_LANE / 8));
}
reset(maxLine) {
const bytes = Math.ceil((maxLine + 1) * MAX_LANE / 8);
if (this.lanes.length < bytes) {
this.lanes = new Uint8Array(bytes);
} else {
this.lanes.fill(0);
}
this._requiredLanes = 1;
}
get requiredLanes() {
return this._requiredLanes;
}
push(lane, range2, persist) {
if (persist) {
this.persist |= 1 << lane - 1;
}
for (let i = range2.startLineNumber; i <= range2.endLineNumber; i++) {
const bit = MAX_LANE * i + (lane - 1);
this.lanes[bit >>> 3] |= 1 << bit % 8;
this._requiredLanes = Math.max(this._requiredLanes, this.countAtLine(i));
}
}
getLanesAtLine(lineNumber) {
const lanes = [];
let bit = MAX_LANE * lineNumber;
for (let i = 0; i < MAX_LANE; i++) {
if (this.persist & 1 << i || this.lanes[bit >>> 3] & 1 << bit % 8) {
lanes.push(i + 1);
}
bit++;
}
return lanes.length ? lanes : [GlyphMarginLane2.Center];
}
countAtLine(lineNumber) {
let bit = MAX_LANE * lineNumber;
let count = 0;
for (let i = 0; i < MAX_LANE; i++) {
if (this.persist & 1 << i || this.lanes[bit >>> 3] & 1 << bit % 8) {
count++;
}
bit++;
}
return count;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js
function mergeLineRangeArray(arr1, arr2) {
const result = [];
let i = 0;
let j = 0;
while (i < arr1.length && j < arr2.length) {
const item1 = arr1[i];
const item2 = arr2[j];
if (item1.endLineNumber < item2.startLineNumber - 1) {
result.push(arr1[i++]);
} else if (item2.endLineNumber < item1.startLineNumber - 1) {
result.push(arr2[j++]);
} else {
const startLineNumber = Math.min(item1.startLineNumber, item2.startLineNumber);
const endLineNumber = Math.max(item1.endLineNumber, item2.endLineNumber);
result.push(new Range(startLineNumber, 1, endLineNumber, 1));
i++;
j++;
}
}
while (i < arr1.length) {
result.push(arr1[i++]);
}
while (j < arr2.length) {
result.push(arr2[j++]);
}
return result;
}
function rangeArraysEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
for (let i = 0; i < arr1.length; i++) {
if (!arr1[i].equalsRange(arr2[i])) {
return false;
}
}
return true;
}
var USE_IDENTITY_LINES_COLLECTION, ViewModel, ViewportStart, OverviewRulerDecorations, HiddenAreasModel, StableViewport;
var init_viewModelImpl = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js"() {
init_arrays();
init_async();
init_color();
init_lifecycle();
init_platform();
init_strings();
init_editorOptions();
init_cursor();
init_cursorCommon();
init_position();
init_range();
init_textModelEvents();
init_languages();
init_modesRegistry();
init_textToHtmlTokenizer();
init_viewEvents();
init_viewLayout();
init_minimapTokensColorTracker();
init_viewModel();
init_viewModelDecorations();
init_viewModelEventDispatcher();
init_viewModelLines();
init_glyphLanesModel();
USE_IDENTITY_LINES_COLLECTION = true;
ViewModel = class extends Disposable {
constructor(editorId, configuration, model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, scheduleAtNextAnimationFrame2, languageConfigurationService, _themeService, _attachedView) {
super();
this.languageConfigurationService = languageConfigurationService;
this._themeService = _themeService;
this._attachedView = _attachedView;
this.hiddenAreasModel = new HiddenAreasModel();
this.previousHiddenAreas = [];
this._editorId = editorId;
this._configuration = configuration;
this.model = model;
this._eventDispatcher = new ViewModelEventDispatcher();
this.onEvent = this._eventDispatcher.onEvent;
this.cursorConfig = new CursorConfiguration(this.model.getLanguageId(), this.model.getOptions(), this._configuration, this.languageConfigurationService);
this._updateConfigurationViewLineCount = this._register(new RunOnceScheduler(() => this._updateConfigurationViewLineCountNow(), 0));
this._hasFocus = false;
this._viewportStart = ViewportStart.create(this.model);
this.glyphLanes = new GlyphMarginLanesModel(0);
if (USE_IDENTITY_LINES_COLLECTION && this.model.isTooLargeForTokenization()) {
this._lines = new ViewModelLinesFromModelAsIs(this.model);
} else {
const options2 = this._configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const wrappingStrategy = options2.get(
139
/* EditorOption.wrappingStrategy */
);
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
const wrappingIndent = options2.get(
138
/* EditorOption.wrappingIndent */
);
const wordBreak = options2.get(
129
/* EditorOption.wordBreak */
);
this._lines = new ViewModelLinesFromProjectedModel(this._editorId, this.model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, fontInfo, this.model.getOptions().tabSize, wrappingStrategy, wrappingInfo.wrappingColumn, wrappingIndent, wordBreak);
}
this.coordinatesConverter = this._lines.createCoordinatesConverter();
this._cursor = this._register(new CursorsController(model, this, this.coordinatesConverter, this.cursorConfig));
this.viewLayout = this._register(new ViewLayout(this._configuration, this.getLineCount(), scheduleAtNextAnimationFrame2));
this._register(this.viewLayout.onDidScroll((e) => {
if (e.scrollTopChanged) {
this._handleVisibleLinesChanged();
}
if (e.scrollTopChanged) {
this._viewportStart.invalidate();
}
this._eventDispatcher.emitSingleViewEvent(new ViewScrollChangedEvent(e));
this._eventDispatcher.emitOutgoingEvent(new ScrollChangedEvent(e.oldScrollWidth, e.oldScrollLeft, e.oldScrollHeight, e.oldScrollTop, e.scrollWidth, e.scrollLeft, e.scrollHeight, e.scrollTop));
}));
this._register(this.viewLayout.onDidContentSizeChange((e) => {
this._eventDispatcher.emitOutgoingEvent(e);
}));
this._decorations = new ViewModelDecorations(this._editorId, this.model, this._configuration, this._lines, this.coordinatesConverter);
this._registerModelEvents();
this._register(this._configuration.onDidChangeFast((e) => {
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
this._onConfigurationChanged(eventsCollector, e);
} finally {
this._eventDispatcher.endEmitViewEvents();
}
}));
this._register(MinimapTokensColorTracker.getInstance().onDidChange(() => {
this._eventDispatcher.emitSingleViewEvent(new ViewTokensColorsChangedEvent());
}));
this._register(this._themeService.onDidColorThemeChange((theme) => {
this._invalidateDecorationsColorCache();
this._eventDispatcher.emitSingleViewEvent(new ViewThemeChangedEvent(theme));
}));
this._updateConfigurationViewLineCountNow();
}
dispose() {
super.dispose();
this._decorations.dispose();
this._lines.dispose();
this._viewportStart.dispose();
this._eventDispatcher.dispose();
}
createLineBreaksComputer() {
return this._lines.createLineBreaksComputer();
}
addViewEventHandler(eventHandler) {
this._eventDispatcher.addViewEventHandler(eventHandler);
}
removeViewEventHandler(eventHandler) {
this._eventDispatcher.removeViewEventHandler(eventHandler);
}
_updateConfigurationViewLineCountNow() {
this._configuration.setViewLineCount(this._lines.getViewLineCount());
}
getModelVisibleRanges() {
const linesViewportData = this.viewLayout.getLinesViewportData();
const viewVisibleRange = new Range(linesViewportData.startLineNumber, this.getLineMinColumn(linesViewportData.startLineNumber), linesViewportData.endLineNumber, this.getLineMaxColumn(linesViewportData.endLineNumber));
const modelVisibleRanges = this._toModelVisibleRanges(viewVisibleRange);
return modelVisibleRanges;
}
visibleLinesStabilized() {
const modelVisibleRanges = this.getModelVisibleRanges();
this._attachedView.setVisibleLines(modelVisibleRanges, true);
}
_handleVisibleLinesChanged() {
const modelVisibleRanges = this.getModelVisibleRanges();
this._attachedView.setVisibleLines(modelVisibleRanges, false);
}
setHasFocus(hasFocus) {
this._hasFocus = hasFocus;
this._cursor.setHasFocus(hasFocus);
this._eventDispatcher.emitSingleViewEvent(new ViewFocusChangedEvent(hasFocus));
this._eventDispatcher.emitOutgoingEvent(new FocusChangedEvent(!hasFocus, hasFocus));
}
onCompositionStart() {
this._eventDispatcher.emitSingleViewEvent(new ViewCompositionStartEvent());
}
onCompositionEnd() {
this._eventDispatcher.emitSingleViewEvent(new ViewCompositionEndEvent());
}
_captureStableViewport() {
if (this._viewportStart.isValid && this.viewLayout.getCurrentScrollTop() > 0) {
const previousViewportStartViewPosition = new Position(this._viewportStart.viewLineNumber, this.getLineMinColumn(this._viewportStart.viewLineNumber));
const previousViewportStartModelPosition = this.coordinatesConverter.convertViewPositionToModelPosition(previousViewportStartViewPosition);
return new StableViewport(previousViewportStartModelPosition, this._viewportStart.startLineDelta);
}
return new StableViewport(null, 0);
}
_onConfigurationChanged(eventsCollector, e) {
const stableViewport = this._captureStableViewport();
const options2 = this._configuration.options;
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const wrappingStrategy = options2.get(
139
/* EditorOption.wrappingStrategy */
);
const wrappingInfo = options2.get(
146
/* EditorOption.wrappingInfo */
);
const wrappingIndent = options2.get(
138
/* EditorOption.wrappingIndent */
);
const wordBreak = options2.get(
129
/* EditorOption.wordBreak */
);
if (this._lines.setWrappingSettings(fontInfo, wrappingStrategy, wrappingInfo.wrappingColumn, wrappingIndent, wordBreak)) {
eventsCollector.emitViewEvent(new ViewFlushedEvent());
eventsCollector.emitViewEvent(new ViewLineMappingChangedEvent());
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
this._cursor.onLineMappingChanged(eventsCollector);
this._decorations.onLineMappingChanged();
this.viewLayout.onFlushed(this.getLineCount());
this._updateConfigurationViewLineCount.schedule();
}
if (e.hasChanged(
91
/* EditorOption.readOnly */
)) {
this._decorations.reset();
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
}
if (e.hasChanged(
98
/* EditorOption.renderValidationDecorations */
)) {
this._decorations.reset();
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
}
eventsCollector.emitViewEvent(new ViewConfigurationChangedEvent(e));
this.viewLayout.onConfigurationChanged(e);
stableViewport.recoverViewportStart(this.coordinatesConverter, this.viewLayout);
if (CursorConfiguration.shouldRecreate(e)) {
this.cursorConfig = new CursorConfiguration(this.model.getLanguageId(), this.model.getOptions(), this._configuration, this.languageConfigurationService);
this._cursor.updateConfiguration(this.cursorConfig);
}
}
_registerModelEvents() {
this._register(this.model.onDidChangeContentOrInjectedText((e) => {
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
let hadOtherModelChange = false;
let hadModelLineChangeThatChangedLineMapping = false;
const changes = e instanceof InternalModelContentChangeEvent ? e.rawContentChangedEvent.changes : e.changes;
const versionId = e instanceof InternalModelContentChangeEvent ? e.rawContentChangedEvent.versionId : null;
const lineBreaksComputer = this._lines.createLineBreaksComputer();
for (const change of changes) {
switch (change.changeType) {
case 4: {
for (let lineIdx = 0; lineIdx < change.detail.length; lineIdx++) {
const line = change.detail[lineIdx];
let injectedText = change.injectedTexts[lineIdx];
if (injectedText) {
injectedText = injectedText.filter((element) => !element.ownerId || element.ownerId === this._editorId);
}
lineBreaksComputer.addRequest(line, injectedText, null);
}
break;
}
case 2: {
let injectedText = null;
if (change.injectedText) {
injectedText = change.injectedText.filter((element) => !element.ownerId || element.ownerId === this._editorId);
}
lineBreaksComputer.addRequest(change.detail, injectedText, null);
break;
}
}
}
const lineBreaks = lineBreaksComputer.finalize();
const lineBreakQueue = new ArrayQueue(lineBreaks);
for (const change of changes) {
switch (change.changeType) {
case 1: {
this._lines.onModelFlushed();
eventsCollector.emitViewEvent(new ViewFlushedEvent());
this._decorations.reset();
this.viewLayout.onFlushed(this.getLineCount());
hadOtherModelChange = true;
break;
}
case 3: {
const linesDeletedEvent = this._lines.onModelLinesDeleted(versionId, change.fromLineNumber, change.toLineNumber);
if (linesDeletedEvent !== null) {
eventsCollector.emitViewEvent(linesDeletedEvent);
this.viewLayout.onLinesDeleted(linesDeletedEvent.fromLineNumber, linesDeletedEvent.toLineNumber);
}
hadOtherModelChange = true;
break;
}
case 4: {
const insertedLineBreaks = lineBreakQueue.takeCount(change.detail.length);
const linesInsertedEvent = this._lines.onModelLinesInserted(versionId, change.fromLineNumber, change.toLineNumber, insertedLineBreaks);
if (linesInsertedEvent !== null) {
eventsCollector.emitViewEvent(linesInsertedEvent);
this.viewLayout.onLinesInserted(linesInsertedEvent.fromLineNumber, linesInsertedEvent.toLineNumber);
}
hadOtherModelChange = true;
break;
}
case 2: {
const changedLineBreakData = lineBreakQueue.dequeue();
const [lineMappingChanged, linesChangedEvent, linesInsertedEvent, linesDeletedEvent] = this._lines.onModelLineChanged(versionId, change.lineNumber, changedLineBreakData);
hadModelLineChangeThatChangedLineMapping = lineMappingChanged;
if (linesChangedEvent) {
eventsCollector.emitViewEvent(linesChangedEvent);
}
if (linesInsertedEvent) {
eventsCollector.emitViewEvent(linesInsertedEvent);
this.viewLayout.onLinesInserted(linesInsertedEvent.fromLineNumber, linesInsertedEvent.toLineNumber);
}
if (linesDeletedEvent) {
eventsCollector.emitViewEvent(linesDeletedEvent);
this.viewLayout.onLinesDeleted(linesDeletedEvent.fromLineNumber, linesDeletedEvent.toLineNumber);
}
break;
}
case 5: {
break;
}
}
}
if (versionId !== null) {
this._lines.acceptVersionId(versionId);
}
this.viewLayout.onHeightMaybeChanged();
if (!hadOtherModelChange && hadModelLineChangeThatChangedLineMapping) {
eventsCollector.emitViewEvent(new ViewLineMappingChangedEvent());
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
this._cursor.onLineMappingChanged(eventsCollector);
this._decorations.onLineMappingChanged();
}
} finally {
this._eventDispatcher.endEmitViewEvents();
}
const viewportStartWasValid = this._viewportStart.isValid;
this._viewportStart.invalidate();
this._configuration.setModelLineCount(this.model.getLineCount());
this._updateConfigurationViewLineCountNow();
if (!this._hasFocus && this.model.getAttachedEditorCount() >= 2 && viewportStartWasValid) {
const modelRange = this.model._getTrackedRange(this._viewportStart.modelTrackedRange);
if (modelRange) {
const viewPosition = this.coordinatesConverter.convertModelPositionToViewPosition(modelRange.getStartPosition());
const viewPositionTop = this.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
this.viewLayout.setScrollPosition(
{ scrollTop: viewPositionTop + this._viewportStart.startLineDelta },
1
/* ScrollType.Immediate */
);
}
}
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
if (e instanceof InternalModelContentChangeEvent) {
eventsCollector.emitOutgoingEvent(new ModelContentChangedEvent(e.contentChangedEvent));
}
this._cursor.onModelContentChanged(eventsCollector, e);
} finally {
this._eventDispatcher.endEmitViewEvents();
}
this._handleVisibleLinesChanged();
}));
this._register(this.model.onDidChangeTokens((e) => {
const viewRanges = [];
for (let j = 0, lenJ = e.ranges.length; j < lenJ; j++) {
const modelRange = e.ranges[j];
const viewStartLineNumber = this.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelRange.fromLineNumber, 1)).lineNumber;
const viewEndLineNumber = this.coordinatesConverter.convertModelPositionToViewPosition(new Position(modelRange.toLineNumber, this.model.getLineMaxColumn(modelRange.toLineNumber))).lineNumber;
viewRanges[j] = {
fromLineNumber: viewStartLineNumber,
toLineNumber: viewEndLineNumber
};
}
this._eventDispatcher.emitSingleViewEvent(new ViewTokensChangedEvent(viewRanges));
this._eventDispatcher.emitOutgoingEvent(new ModelTokensChangedEvent(e));
}));
this._register(this.model.onDidChangeLanguageConfiguration((e) => {
this._eventDispatcher.emitSingleViewEvent(new ViewLanguageConfigurationEvent());
this.cursorConfig = new CursorConfiguration(this.model.getLanguageId(), this.model.getOptions(), this._configuration, this.languageConfigurationService);
this._cursor.updateConfiguration(this.cursorConfig);
this._eventDispatcher.emitOutgoingEvent(new ModelLanguageConfigurationChangedEvent(e));
}));
this._register(this.model.onDidChangeLanguage((e) => {
this.cursorConfig = new CursorConfiguration(this.model.getLanguageId(), this.model.getOptions(), this._configuration, this.languageConfigurationService);
this._cursor.updateConfiguration(this.cursorConfig);
this._eventDispatcher.emitOutgoingEvent(new ModelLanguageChangedEvent(e));
}));
this._register(this.model.onDidChangeOptions((e) => {
if (this._lines.setTabSize(this.model.getOptions().tabSize)) {
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
eventsCollector.emitViewEvent(new ViewFlushedEvent());
eventsCollector.emitViewEvent(new ViewLineMappingChangedEvent());
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
this._cursor.onLineMappingChanged(eventsCollector);
this._decorations.onLineMappingChanged();
this.viewLayout.onFlushed(this.getLineCount());
} finally {
this._eventDispatcher.endEmitViewEvents();
}
this._updateConfigurationViewLineCount.schedule();
}
this.cursorConfig = new CursorConfiguration(this.model.getLanguageId(), this.model.getOptions(), this._configuration, this.languageConfigurationService);
this._cursor.updateConfiguration(this.cursorConfig);
this._eventDispatcher.emitOutgoingEvent(new ModelOptionsChangedEvent(e));
}));
this._register(this.model.onDidChangeDecorations((e) => {
this._decorations.onModelDecorationsChanged();
this._eventDispatcher.emitSingleViewEvent(new ViewDecorationsChangedEvent(e));
this._eventDispatcher.emitOutgoingEvent(new ModelDecorationsChangedEvent(e));
}));
}
setHiddenAreas(ranges, source) {
var _a10;
this.hiddenAreasModel.setHiddenAreas(source, ranges);
const mergedRanges = this.hiddenAreasModel.getMergedRanges();
if (mergedRanges === this.previousHiddenAreas) {
return;
}
this.previousHiddenAreas = mergedRanges;
const stableViewport = this._captureStableViewport();
let lineMappingChanged = false;
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
lineMappingChanged = this._lines.setHiddenAreas(mergedRanges);
if (lineMappingChanged) {
eventsCollector.emitViewEvent(new ViewFlushedEvent());
eventsCollector.emitViewEvent(new ViewLineMappingChangedEvent());
eventsCollector.emitViewEvent(new ViewDecorationsChangedEvent(null));
this._cursor.onLineMappingChanged(eventsCollector);
this._decorations.onLineMappingChanged();
this.viewLayout.onFlushed(this.getLineCount());
this.viewLayout.onHeightMaybeChanged();
}
const firstModelLineInViewPort = (_a10 = stableViewport.viewportStartModelPosition) === null || _a10 === void 0 ? void 0 : _a10.lineNumber;
const firstModelLineIsHidden = firstModelLineInViewPort && mergedRanges.some((range2) => range2.startLineNumber <= firstModelLineInViewPort && firstModelLineInViewPort <= range2.endLineNumber);
if (!firstModelLineIsHidden) {
stableViewport.recoverViewportStart(this.coordinatesConverter, this.viewLayout);
}
} finally {
this._eventDispatcher.endEmitViewEvents();
}
this._updateConfigurationViewLineCount.schedule();
if (lineMappingChanged) {
this._eventDispatcher.emitOutgoingEvent(new HiddenAreasChangedEvent());
}
}
getVisibleRangesPlusViewportAboveBelow() {
const layoutInfo = this._configuration.options.get(
145
/* EditorOption.layoutInfo */
);
const lineHeight = this._configuration.options.get(
67
/* EditorOption.lineHeight */
);
const linesAround = Math.max(20, Math.round(layoutInfo.height / lineHeight));
const partialData = this.viewLayout.getLinesViewportData();
const startViewLineNumber = Math.max(1, partialData.completelyVisibleStartLineNumber - linesAround);
const endViewLineNumber = Math.min(this.getLineCount(), partialData.completelyVisibleEndLineNumber + linesAround);
return this._toModelVisibleRanges(new Range(startViewLineNumber, this.getLineMinColumn(startViewLineNumber), endViewLineNumber, this.getLineMaxColumn(endViewLineNumber)));
}
getVisibleRanges() {
const visibleViewRange = this.getCompletelyVisibleViewRange();
return this._toModelVisibleRanges(visibleViewRange);
}
getHiddenAreas() {
return this._lines.getHiddenAreas();
}
_toModelVisibleRanges(visibleViewRange) {
const visibleRange = this.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);
const hiddenAreas = this._lines.getHiddenAreas();
if (hiddenAreas.length === 0) {
return [visibleRange];
}
const result = [];
let resultLen = 0;
let startLineNumber = visibleRange.startLineNumber;
let startColumn = visibleRange.startColumn;
const endLineNumber = visibleRange.endLineNumber;
const endColumn = visibleRange.endColumn;
for (let i = 0, len = hiddenAreas.length; i < len; i++) {
const hiddenStartLineNumber = hiddenAreas[i].startLineNumber;
const hiddenEndLineNumber = hiddenAreas[i].endLineNumber;
if (hiddenEndLineNumber < startLineNumber) {
continue;
}
if (hiddenStartLineNumber > endLineNumber) {
continue;
}
if (startLineNumber < hiddenStartLineNumber) {
result[resultLen++] = new Range(startLineNumber, startColumn, hiddenStartLineNumber - 1, this.model.getLineMaxColumn(hiddenStartLineNumber - 1));
}
startLineNumber = hiddenEndLineNumber + 1;
startColumn = 1;
}
if (startLineNumber < endLineNumber || startLineNumber === endLineNumber && startColumn < endColumn) {
result[resultLen++] = new Range(startLineNumber, startColumn, endLineNumber, endColumn);
}
return result;
}
getCompletelyVisibleViewRange() {
const partialData = this.viewLayout.getLinesViewportData();
const startViewLineNumber = partialData.completelyVisibleStartLineNumber;
const endViewLineNumber = partialData.completelyVisibleEndLineNumber;
return new Range(startViewLineNumber, this.getLineMinColumn(startViewLineNumber), endViewLineNumber, this.getLineMaxColumn(endViewLineNumber));
}
getCompletelyVisibleViewRangeAtScrollTop(scrollTop) {
const partialData = this.viewLayout.getLinesViewportDataAtScrollTop(scrollTop);
const startViewLineNumber = partialData.completelyVisibleStartLineNumber;
const endViewLineNumber = partialData.completelyVisibleEndLineNumber;
return new Range(startViewLineNumber, this.getLineMinColumn(startViewLineNumber), endViewLineNumber, this.getLineMaxColumn(endViewLineNumber));
}
saveState() {
const compatViewState = this.viewLayout.saveState();
const scrollTop = compatViewState.scrollTop;
const firstViewLineNumber = this.viewLayout.getLineNumberAtVerticalOffset(scrollTop);
const firstPosition = this.coordinatesConverter.convertViewPositionToModelPosition(new Position(firstViewLineNumber, this.getLineMinColumn(firstViewLineNumber)));
const firstPositionDeltaTop = this.viewLayout.getVerticalOffsetForLineNumber(firstViewLineNumber) - scrollTop;
return {
scrollLeft: compatViewState.scrollLeft,
firstPosition,
firstPositionDeltaTop
};
}
reduceRestoreState(state) {
if (typeof state.firstPosition === "undefined") {
return this._reduceRestoreStateCompatibility(state);
}
const modelPosition = this.model.validatePosition(state.firstPosition);
const viewPosition = this.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
const scrollTop = this.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber) - state.firstPositionDeltaTop;
return {
scrollLeft: state.scrollLeft,
scrollTop
};
}
_reduceRestoreStateCompatibility(state) {
return {
scrollLeft: state.scrollLeft,
scrollTop: state.scrollTopWithoutViewZones
};
}
getTabSize() {
return this.model.getOptions().tabSize;
}
getLineCount() {
return this._lines.getViewLineCount();
}
/**
* Gives a hint that a lot of requests are about to come in for these line numbers.
*/
setViewport(startLineNumber, endLineNumber, centeredLineNumber) {
this._viewportStart.update(this, startLineNumber);
}
getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber) {
return this._lines.getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber);
}
getLinesIndentGuides(startLineNumber, endLineNumber) {
return this._lines.getViewLinesIndentGuides(startLineNumber, endLineNumber);
}
getBracketGuidesInRangeByLine(startLineNumber, endLineNumber, activePosition, options2) {
return this._lines.getViewLinesBracketGuides(startLineNumber, endLineNumber, activePosition, options2);
}
getLineContent(lineNumber) {
return this._lines.getViewLineContent(lineNumber);
}
getLineLength(lineNumber) {
return this._lines.getViewLineLength(lineNumber);
}
getLineMinColumn(lineNumber) {
return this._lines.getViewLineMinColumn(lineNumber);
}
getLineMaxColumn(lineNumber) {
return this._lines.getViewLineMaxColumn(lineNumber);
}
getLineFirstNonWhitespaceColumn(lineNumber) {
const result = firstNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
}
getLineLastNonWhitespaceColumn(lineNumber) {
const result = lastNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
}
getMinimapDecorationsInRange(range2) {
return this._decorations.getMinimapDecorationsInRange(range2);
}
getDecorationsInViewport(visibleRange) {
return this._decorations.getDecorationsViewportData(visibleRange).decorations;
}
getInjectedTextAt(viewPosition) {
return this._lines.getInjectedTextAt(viewPosition);
}
getViewportViewLineRenderingData(visibleRange, lineNumber) {
const allInlineDecorations = this._decorations.getDecorationsViewportData(visibleRange).inlineDecorations;
const inlineDecorations = allInlineDecorations[lineNumber - visibleRange.startLineNumber];
return this._getViewLineRenderingData(lineNumber, inlineDecorations);
}
getViewLineRenderingData(lineNumber) {
const inlineDecorations = this._decorations.getInlineDecorationsOnLine(lineNumber);
return this._getViewLineRenderingData(lineNumber, inlineDecorations);
}
_getViewLineRenderingData(lineNumber, inlineDecorations) {
const mightContainRTL = this.model.mightContainRTL();
const mightContainNonBasicASCII = this.model.mightContainNonBasicASCII();
const tabSize = this.getTabSize();
const lineData = this._lines.getViewLineData(lineNumber);
if (lineData.inlineDecorations) {
inlineDecorations = [
...inlineDecorations,
...lineData.inlineDecorations.map((d) => d.toInlineDecoration(lineNumber))
];
}
return new ViewLineRenderingData(lineData.minColumn, lineData.maxColumn, lineData.content, lineData.continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, lineData.tokens, inlineDecorations, tabSize, lineData.startVisibleColumn);
}
getViewLineData(lineNumber) {
return this._lines.getViewLineData(lineNumber);
}
getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed) {
const result = this._lines.getViewLinesData(startLineNumber, endLineNumber, needed);
return new MinimapLinesRenderingData(this.getTabSize(), result);
}
getAllOverviewRulerDecorations(theme) {
const decorations = this.model.getOverviewRulerDecorations(this._editorId, filterValidationDecorations(this._configuration.options));
const result = new OverviewRulerDecorations();
for (const decoration3 of decorations) {
const decorationOptions = decoration3.options;
const opts = decorationOptions.overviewRuler;
if (!opts) {
continue;
}
const lane = opts.position;
if (lane === 0) {
continue;
}
const color = opts.getColor(theme.value);
const viewStartLineNumber = this.coordinatesConverter.getViewLineNumberOfModelPosition(decoration3.range.startLineNumber, decoration3.range.startColumn);
const viewEndLineNumber = this.coordinatesConverter.getViewLineNumberOfModelPosition(decoration3.range.endLineNumber, decoration3.range.endColumn);
result.accept(color, decorationOptions.zIndex, viewStartLineNumber, viewEndLineNumber, lane);
}
return result.asArray;
}
_invalidateDecorationsColorCache() {
const decorations = this.model.getOverviewRulerDecorations();
for (const decoration3 of decorations) {
const opts1 = decoration3.options.overviewRuler;
opts1 === null || opts1 === void 0 ? void 0 : opts1.invalidateCachedColor();
const opts2 = decoration3.options.minimap;
opts2 === null || opts2 === void 0 ? void 0 : opts2.invalidateCachedColor();
}
}
getValueInRange(range2, eol) {
const modelRange = this.coordinatesConverter.convertViewRangeToModelRange(range2);
return this.model.getValueInRange(modelRange, eol);
}
getValueLengthInRange(range2, eol) {
const modelRange = this.coordinatesConverter.convertViewRangeToModelRange(range2);
return this.model.getValueLengthInRange(modelRange, eol);
}
modifyPosition(position, offset) {
const modelPosition = this.coordinatesConverter.convertViewPositionToModelPosition(position);
const resultModelPosition = this.model.modifyPosition(modelPosition, offset);
return this.coordinatesConverter.convertModelPositionToViewPosition(resultModelPosition);
}
deduceModelPositionRelativeToViewPosition(viewAnchorPosition, deltaOffset, lineFeedCnt) {
const modelAnchor = this.coordinatesConverter.convertViewPositionToModelPosition(viewAnchorPosition);
if (this.model.getEOL().length === 2) {
if (deltaOffset < 0) {
deltaOffset -= lineFeedCnt;
} else {
deltaOffset += lineFeedCnt;
}
}
const modelAnchorOffset = this.model.getOffsetAt(modelAnchor);
const resultOffset = modelAnchorOffset + deltaOffset;
return this.model.getPositionAt(resultOffset);
}
getPlainTextToCopy(modelRanges, emptySelectionClipboard, forceCRLF) {
const newLineCharacter = forceCRLF ? "\r\n" : this.model.getEOL();
modelRanges = modelRanges.slice(0);
modelRanges.sort(Range.compareRangesUsingStarts);
let hasEmptyRange = false;
let hasNonEmptyRange = false;
for (const range2 of modelRanges) {
if (range2.isEmpty()) {
hasEmptyRange = true;
} else {
hasNonEmptyRange = true;
}
}
if (!hasNonEmptyRange) {
if (!emptySelectionClipboard) {
return "";
}
const modelLineNumbers = modelRanges.map((r) => r.startLineNumber);
let result2 = "";
for (let i = 0; i < modelLineNumbers.length; i++) {
if (i > 0 && modelLineNumbers[i - 1] === modelLineNumbers[i]) {
continue;
}
result2 += this.model.getLineContent(modelLineNumbers[i]) + newLineCharacter;
}
return result2;
}
if (hasEmptyRange && emptySelectionClipboard) {
const result2 = [];
let prevModelLineNumber = 0;
for (const modelRange of modelRanges) {
const modelLineNumber = modelRange.startLineNumber;
if (modelRange.isEmpty()) {
if (modelLineNumber !== prevModelLineNumber) {
result2.push(this.model.getLineContent(modelLineNumber));
}
} else {
result2.push(this.model.getValueInRange(
modelRange,
forceCRLF ? 2 : 0
/* EndOfLinePreference.TextDefined */
));
}
prevModelLineNumber = modelLineNumber;
}
return result2.length === 1 ? result2[0] : result2;
}
const result = [];
for (const modelRange of modelRanges) {
if (!modelRange.isEmpty()) {
result.push(this.model.getValueInRange(
modelRange,
forceCRLF ? 2 : 0
/* EndOfLinePreference.TextDefined */
));
}
}
return result.length === 1 ? result[0] : result;
}
getRichTextToCopy(modelRanges, emptySelectionClipboard) {
const languageId = this.model.getLanguageId();
if (languageId === PLAINTEXT_LANGUAGE_ID) {
return null;
}
if (modelRanges.length !== 1) {
return null;
}
let range2 = modelRanges[0];
if (range2.isEmpty()) {
if (!emptySelectionClipboard) {
return null;
}
const lineNumber = range2.startLineNumber;
range2 = new Range(lineNumber, this.model.getLineMinColumn(lineNumber), lineNumber, this.model.getLineMaxColumn(lineNumber));
}
const fontInfo = this._configuration.options.get(
50
/* EditorOption.fontInfo */
);
const colorMap = this._getColorMap();
const hasBadChars = /[:;\\\/<>]/.test(fontInfo.fontFamily);
const useDefaultFontFamily = hasBadChars || fontInfo.fontFamily === EDITOR_FONT_DEFAULTS.fontFamily;
let fontFamily;
if (useDefaultFontFamily) {
fontFamily = EDITOR_FONT_DEFAULTS.fontFamily;
} else {
fontFamily = fontInfo.fontFamily;
fontFamily = fontFamily.replace(/"/g, "'");
const hasQuotesOrIsList = /[,']/.test(fontFamily);
if (!hasQuotesOrIsList) {
const needsQuotes = /[+ ]/.test(fontFamily);
if (needsQuotes) {
fontFamily = `'${fontFamily}'`;
}
}
fontFamily = `${fontFamily}, ${EDITOR_FONT_DEFAULTS.fontFamily}`;
}
return {
mode: languageId,
html: `` + this._getHTMLToCopy(range2, colorMap) + "
"
};
}
_getHTMLToCopy(modelRange, colorMap) {
const startLineNumber = modelRange.startLineNumber;
const startColumn = modelRange.startColumn;
const endLineNumber = modelRange.endLineNumber;
const endColumn = modelRange.endColumn;
const tabSize = this.getTabSize();
let result = "";
for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
const lineTokens = this.model.tokenization.getLineTokens(lineNumber);
const lineContent = lineTokens.getLineContent();
const startOffset = lineNumber === startLineNumber ? startColumn - 1 : 0;
const endOffset = lineNumber === endLineNumber ? endColumn - 1 : lineContent.length;
if (lineContent === "") {
result += "
";
} else {
result += tokenizeLineToHTML(lineContent, lineTokens.inflate(), colorMap, startOffset, endOffset, tabSize, isWindows);
}
}
return result;
}
_getColorMap() {
const colorMap = TokenizationRegistry2.getColorMap();
const result = ["#000000"];
if (colorMap) {
for (let i = 1, len = colorMap.length; i < len; i++) {
result[i] = Color.Format.CSS.formatHex(colorMap[i]);
}
}
return result;
}
//#region cursor operations
getPrimaryCursorState() {
return this._cursor.getPrimaryCursorState();
}
getLastAddedCursorIndex() {
return this._cursor.getLastAddedCursorIndex();
}
getCursorStates() {
return this._cursor.getCursorStates();
}
setCursorStates(source, reason, states) {
return this._withViewEventsCollector((eventsCollector) => this._cursor.setStates(eventsCollector, source, reason, states));
}
getCursorColumnSelectData() {
return this._cursor.getCursorColumnSelectData();
}
getCursorAutoClosedCharacters() {
return this._cursor.getAutoClosedCharacters();
}
setCursorColumnSelectData(columnSelectData) {
this._cursor.setCursorColumnSelectData(columnSelectData);
}
getPrevEditOperationType() {
return this._cursor.getPrevEditOperationType();
}
setPrevEditOperationType(type) {
this._cursor.setPrevEditOperationType(type);
}
getSelection() {
return this._cursor.getSelection();
}
getSelections() {
return this._cursor.getSelections();
}
getPosition() {
return this._cursor.getPrimaryCursorState().modelState.position;
}
setSelections(source, selections, reason = 0) {
this._withViewEventsCollector((eventsCollector) => this._cursor.setSelections(eventsCollector, source, selections, reason));
}
saveCursorState() {
return this._cursor.saveState();
}
restoreCursorState(states) {
this._withViewEventsCollector((eventsCollector) => this._cursor.restoreState(eventsCollector, states));
}
_executeCursorEdit(callback) {
if (this._cursor.context.cursorConfig.readOnly) {
this._eventDispatcher.emitOutgoingEvent(new ReadOnlyEditAttemptEvent());
return;
}
this._withViewEventsCollector(callback);
}
executeEdits(source, edits, cursorStateComputer) {
this._executeCursorEdit((eventsCollector) => this._cursor.executeEdits(eventsCollector, source, edits, cursorStateComputer));
}
startComposition() {
this._executeCursorEdit((eventsCollector) => this._cursor.startComposition(eventsCollector));
}
endComposition(source) {
this._executeCursorEdit((eventsCollector) => this._cursor.endComposition(eventsCollector, source));
}
type(text2, source) {
this._executeCursorEdit((eventsCollector) => this._cursor.type(eventsCollector, text2, source));
}
compositionType(text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta, source) {
this._executeCursorEdit((eventsCollector) => this._cursor.compositionType(eventsCollector, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta, source));
}
paste(text2, pasteOnNewLine, multicursorText, source) {
this._executeCursorEdit((eventsCollector) => this._cursor.paste(eventsCollector, text2, pasteOnNewLine, multicursorText, source));
}
cut(source) {
this._executeCursorEdit((eventsCollector) => this._cursor.cut(eventsCollector, source));
}
executeCommand(command, source) {
this._executeCursorEdit((eventsCollector) => this._cursor.executeCommand(eventsCollector, command, source));
}
executeCommands(commands, source) {
this._executeCursorEdit((eventsCollector) => this._cursor.executeCommands(eventsCollector, commands, source));
}
revealAllCursors(source, revealHorizontal, minimalReveal = false) {
this._withViewEventsCollector((eventsCollector) => this._cursor.revealAll(
eventsCollector,
source,
minimalReveal,
0,
revealHorizontal,
0
/* ScrollType.Smooth */
));
}
revealPrimaryCursor(source, revealHorizontal, minimalReveal = false) {
this._withViewEventsCollector((eventsCollector) => this._cursor.revealPrimary(
eventsCollector,
source,
minimalReveal,
0,
revealHorizontal,
0
/* ScrollType.Smooth */
));
}
revealTopMostCursor(source) {
const viewPosition = this._cursor.getTopMostViewPosition();
const viewRange = new Range(viewPosition.lineNumber, viewPosition.column, viewPosition.lineNumber, viewPosition.column);
this._withViewEventsCollector((eventsCollector) => eventsCollector.emitViewEvent(new ViewRevealRangeRequestEvent(
source,
false,
viewRange,
null,
0,
true,
0
/* ScrollType.Smooth */
)));
}
revealBottomMostCursor(source) {
const viewPosition = this._cursor.getBottomMostViewPosition();
const viewRange = new Range(viewPosition.lineNumber, viewPosition.column, viewPosition.lineNumber, viewPosition.column);
this._withViewEventsCollector((eventsCollector) => eventsCollector.emitViewEvent(new ViewRevealRangeRequestEvent(
source,
false,
viewRange,
null,
0,
true,
0
/* ScrollType.Smooth */
)));
}
revealRange(source, revealHorizontal, viewRange, verticalType, scrollType) {
this._withViewEventsCollector((eventsCollector) => eventsCollector.emitViewEvent(new ViewRevealRangeRequestEvent(source, false, viewRange, null, verticalType, revealHorizontal, scrollType)));
}
//#endregion
//#region viewLayout
changeWhitespace(callback) {
const hadAChange = this.viewLayout.changeWhitespace(callback);
if (hadAChange) {
this._eventDispatcher.emitSingleViewEvent(new ViewZonesChangedEvent());
this._eventDispatcher.emitOutgoingEvent(new ViewZonesChangedEvent2());
}
}
//#endregion
_withViewEventsCollector(callback) {
try {
const eventsCollector = this._eventDispatcher.beginEmitViewEvents();
return callback(eventsCollector);
} finally {
this._eventDispatcher.endEmitViewEvents();
}
}
batchEvents(callback) {
this._withViewEventsCollector(() => {
callback();
});
}
normalizePosition(position, affinity) {
return this._lines.normalizePosition(position, affinity);
}
/**
* Gets the column at which indentation stops at a given line.
* @internal
*/
getLineIndentColumn(lineNumber) {
return this._lines.getLineIndentColumn(lineNumber);
}
};
ViewportStart = class _ViewportStart {
static create(model) {
const viewportStartLineTrackedRange = model._setTrackedRange(
null,
new Range(1, 1, 1, 1),
1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
);
return new _ViewportStart(model, 1, false, viewportStartLineTrackedRange, 0);
}
get viewLineNumber() {
return this._viewLineNumber;
}
get isValid() {
return this._isValid;
}
get modelTrackedRange() {
return this._modelTrackedRange;
}
get startLineDelta() {
return this._startLineDelta;
}
constructor(_model, _viewLineNumber, _isValid, _modelTrackedRange, _startLineDelta) {
this._model = _model;
this._viewLineNumber = _viewLineNumber;
this._isValid = _isValid;
this._modelTrackedRange = _modelTrackedRange;
this._startLineDelta = _startLineDelta;
}
dispose() {
this._model._setTrackedRange(
this._modelTrackedRange,
null,
1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
);
}
update(viewModel, startLineNumber) {
const position = viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(startLineNumber, viewModel.getLineMinColumn(startLineNumber)));
const viewportStartLineTrackedRange = viewModel.model._setTrackedRange(
this._modelTrackedRange,
new Range(position.lineNumber, position.column, position.lineNumber, position.column),
1
/* TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges */
);
const viewportStartLineTop = viewModel.viewLayout.getVerticalOffsetForLineNumber(startLineNumber);
const scrollTop = viewModel.viewLayout.getCurrentScrollTop();
this._viewLineNumber = startLineNumber;
this._isValid = true;
this._modelTrackedRange = viewportStartLineTrackedRange;
this._startLineDelta = scrollTop - viewportStartLineTop;
}
invalidate() {
this._isValid = false;
}
};
OverviewRulerDecorations = class {
constructor() {
this._asMap = /* @__PURE__ */ Object.create(null);
this.asArray = [];
}
accept(color, zIndex, startLineNumber, endLineNumber, lane) {
const prevGroup = this._asMap[color];
if (prevGroup) {
const prevData = prevGroup.data;
const prevLane = prevData[prevData.length - 3];
const prevEndLineNumber = prevData[prevData.length - 1];
if (prevLane === lane && prevEndLineNumber + 1 >= startLineNumber) {
if (endLineNumber > prevEndLineNumber) {
prevData[prevData.length - 1] = endLineNumber;
}
return;
}
prevData.push(lane, startLineNumber, endLineNumber);
} else {
const group = new OverviewRulerDecorationsGroup(color, zIndex, [lane, startLineNumber, endLineNumber]);
this._asMap[color] = group;
this.asArray.push(group);
}
}
};
HiddenAreasModel = class {
constructor() {
this.hiddenAreas = /* @__PURE__ */ new Map();
this.shouldRecompute = false;
this.ranges = [];
}
setHiddenAreas(source, ranges) {
const existing = this.hiddenAreas.get(source);
if (existing && rangeArraysEqual(existing, ranges)) {
return;
}
this.hiddenAreas.set(source, ranges);
this.shouldRecompute = true;
}
/**
* The returned array is immutable.
*/
getMergedRanges() {
if (!this.shouldRecompute) {
return this.ranges;
}
this.shouldRecompute = false;
const newRanges = Array.from(this.hiddenAreas.values()).reduce((r, hiddenAreas) => mergeLineRangeArray(r, hiddenAreas), []);
if (rangeArraysEqual(this.ranges, newRanges)) {
return this.ranges;
}
this.ranges = newRanges;
return this.ranges;
}
};
StableViewport = class {
constructor(viewportStartModelPosition, startLineDelta) {
this.viewportStartModelPosition = viewportStartModelPosition;
this.startLineDelta = startLineDelta;
}
recoverViewportStart(coordinatesConverter, viewLayout) {
if (!this.viewportStartModelPosition) {
return;
}
const viewPosition = coordinatesConverter.convertModelPositionToViewPosition(this.viewportStartModelPosition);
const viewPositionTop = viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
viewLayout.setScrollPosition(
{ scrollTop: viewPositionTop + this.startLineDelta },
1
/* ScrollType.Immediate */
);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js
var ServiceCollection;
var init_serviceCollection = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js"() {
ServiceCollection = class {
constructor(...entries2) {
this._entries = /* @__PURE__ */ new Map();
for (const [id, service] of entries2) {
this.set(id, service);
}
}
set(id, instanceOrDescriptor) {
const result = this._entries.get(id);
this._entries.set(id, instanceOrDescriptor);
return result;
}
get(id) {
return this._entries.get(id);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/severity.js
var Severity, severity_default;
var init_severity = __esm({
"node_modules/monaco-editor/esm/vs/base/common/severity.js"() {
init_strings();
(function(Severity3) {
Severity3[Severity3["Ignore"] = 0] = "Ignore";
Severity3[Severity3["Info"] = 1] = "Info";
Severity3[Severity3["Warning"] = 2] = "Warning";
Severity3[Severity3["Error"] = 3] = "Error";
})(Severity || (Severity = {}));
(function(Severity3) {
const _error = "error";
const _warning = "warning";
const _warn = "warn";
const _info = "info";
const _ignore = "ignore";
function fromValue(value) {
if (!value) {
return Severity3.Ignore;
}
if (equalsIgnoreCase(_error, value)) {
return Severity3.Error;
}
if (equalsIgnoreCase(_warning, value) || equalsIgnoreCase(_warn, value)) {
return Severity3.Warning;
}
if (equalsIgnoreCase(_info, value)) {
return Severity3.Info;
}
return Severity3.Ignore;
}
Severity3.fromValue = fromValue;
function toString(severity) {
switch (severity) {
case Severity3.Error:
return _error;
case Severity3.Warning:
return _warning;
case Severity3.Info:
return _info;
default:
return _ignore;
}
}
Severity3.toString = toString;
})(Severity || (Severity = {}));
severity_default = Severity;
}
});
// node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js
var Severity2, INotificationService, NoOpNotification;
var init_notification = __esm({
"node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js"() {
init_severity();
init_instantiation();
Severity2 = severity_default;
INotificationService = createDecorator("notificationService");
NoOpNotification = class {
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js
function getSquigglySVGData(color) {
return squigglyStart + encodeURIComponent(color.toString()) + squigglyEnd;
}
function getDotDotDotSVGData(color) {
return dotdotdotStart + encodeURIComponent(color.toString()) + dotdotdotEnd;
}
var __decorate13, __param12, CodeEditorWidget_1, CodeEditorWidget, EDITOR_ID, ModelData, BooleanEventEmitter, InteractionEmitter, EditorContextKeysManager, EditorModeContext, CodeEditorWidgetFocusTracker, EditorDecorationsCollection, squigglyStart, squigglyEnd, dotdotdotStart, dotdotdotEnd;
var init_codeEditorWidget = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js"() {
init_markerDecorations2();
init_dom();
init_errors();
init_event();
init_lifecycle();
init_network();
init_editor();
init_domFontInfo();
init_editorConfiguration();
init_tabFocus();
init_editorExtensions();
init_codeEditorService();
init_view();
init_domLineBreaksComputer();
init_viewUserInputEvents();
init_codeEditorContributions();
init_editorOptions();
init_cursorColumns();
init_editorColorRegistry();
init_position();
init_range();
init_selection();
init_cursorWordOperations();
init_editorAction();
init_editorCommon();
init_editorContextKeys();
init_languageConfigurationRegistry();
init_textModel();
init_languageFeatures();
init_monospaceLineBreaksComputer();
init_viewModelImpl();
init_nls();
init_accessibility();
init_commands();
init_contextkey();
init_instantiation();
init_serviceCollection();
init_notification();
init_colorRegistry();
init_themeService();
init_actions2();
__decorate13 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param12 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
CodeEditorWidget = CodeEditorWidget_1 = class CodeEditorWidget2 extends Disposable {
//#endregion
get isSimpleWidget() {
return this._configuration.isSimpleWidget;
}
get contextMenuId() {
return this._configuration.contextMenuId;
}
constructor(domElement, _options, codeEditorWidgetOptions, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService) {
var _a10, _b4;
super();
this.languageConfigurationService = languageConfigurationService;
this._deliveryQueue = createEventDeliveryQueue();
this._contributions = this._register(new CodeEditorContributions());
this._onDidDispose = this._register(new Emitter());
this.onDidDispose = this._onDidDispose.event;
this._onDidChangeModelContent = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelContent = this._onDidChangeModelContent.event;
this._onDidChangeModelLanguage = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelLanguage = this._onDidChangeModelLanguage.event;
this._onDidChangeModelLanguageConfiguration = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelLanguageConfiguration = this._onDidChangeModelLanguageConfiguration.event;
this._onDidChangeModelOptions = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelOptions = this._onDidChangeModelOptions.event;
this._onDidChangeModelDecorations = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelDecorations = this._onDidChangeModelDecorations.event;
this._onDidChangeModelTokens = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModelTokens = this._onDidChangeModelTokens.event;
this._onDidChangeConfiguration = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
this._onWillChangeModel = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onWillChangeModel = this._onWillChangeModel.event;
this._onDidChangeModel = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeModel = this._onDidChangeModel.event;
this._onDidChangeCursorPosition = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeCursorPosition = this._onDidChangeCursorPosition.event;
this._onDidChangeCursorSelection = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeCursorSelection = this._onDidChangeCursorSelection.event;
this._onDidAttemptReadOnlyEdit = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDidAttemptReadOnlyEdit = this._onDidAttemptReadOnlyEdit.event;
this._onDidLayoutChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidLayoutChange = this._onDidLayoutChange.event;
this._editorTextFocus = this._register(new BooleanEventEmitter({ deliveryQueue: this._deliveryQueue }));
this.onDidFocusEditorText = this._editorTextFocus.onDidChangeToTrue;
this.onDidBlurEditorText = this._editorTextFocus.onDidChangeToFalse;
this._editorWidgetFocus = this._register(new BooleanEventEmitter({ deliveryQueue: this._deliveryQueue }));
this.onDidFocusEditorWidget = this._editorWidgetFocus.onDidChangeToTrue;
this.onDidBlurEditorWidget = this._editorWidgetFocus.onDidChangeToFalse;
this._onWillType = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onWillType = this._onWillType.event;
this._onDidType = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDidType = this._onDidType.event;
this._onDidCompositionStart = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDidCompositionStart = this._onDidCompositionStart.event;
this._onDidCompositionEnd = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDidCompositionEnd = this._onDidCompositionEnd.event;
this._onDidPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDidPaste = this._onDidPaste.event;
this._onMouseUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseUp = this._onMouseUp.event;
this._onMouseDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseDown = this._onMouseDown.event;
this._onMouseDrag = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseDrag = this._onMouseDrag.event;
this._onMouseDrop = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseDrop = this._onMouseDrop.event;
this._onMouseDropCanceled = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseDropCanceled = this._onMouseDropCanceled.event;
this._onDropIntoEditor = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onDropIntoEditor = this._onDropIntoEditor.event;
this._onContextMenu = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onContextMenu = this._onContextMenu.event;
this._onMouseMove = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseMove = this._onMouseMove.event;
this._onMouseLeave = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseLeave = this._onMouseLeave.event;
this._onMouseWheel = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onMouseWheel = this._onMouseWheel.event;
this._onKeyUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onKeyUp = this._onKeyUp.event;
this._onKeyDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
this.onKeyDown = this._onKeyDown.event;
this._onDidContentSizeChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidContentSizeChange = this._onDidContentSizeChange.event;
this._onDidScrollChange = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidScrollChange = this._onDidScrollChange.event;
this._onDidChangeViewZones = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeViewZones = this._onDidChangeViewZones.event;
this._onDidChangeHiddenAreas = this._register(new Emitter({ deliveryQueue: this._deliveryQueue }));
this.onDidChangeHiddenAreas = this._onDidChangeHiddenAreas.event;
this._updateCounter = 0;
this._onBeginUpdate = this._register(new Emitter());
this.onBeginUpdate = this._onBeginUpdate.event;
this._onEndUpdate = this._register(new Emitter());
this.onEndUpdate = this._onEndUpdate.event;
this._actions = /* @__PURE__ */ new Map();
this._bannerDomNode = null;
this._dropIntoEditorDecorations = this.createDecorationsCollection();
codeEditorService.willCreateCodeEditor();
const options2 = __spreadValues({}, _options);
this._domElement = domElement;
this._overflowWidgetsDomNode = options2.overflowWidgetsDomNode;
delete options2.overflowWidgetsDomNode;
this._id = ++EDITOR_ID;
this._decorationTypeKeysToIds = {};
this._decorationTypeSubtypes = {};
this._telemetryData = codeEditorWidgetOptions.telemetryData;
this._configuration = this._register(this._createConfiguration(codeEditorWidgetOptions.isSimpleWidget || false, (_a10 = codeEditorWidgetOptions.contextMenuId) !== null && _a10 !== void 0 ? _a10 : codeEditorWidgetOptions.isSimpleWidget ? MenuId.SimpleEditorContext : MenuId.EditorContext, options2, accessibilityService));
this._register(this._configuration.onDidChange((e) => {
this._onDidChangeConfiguration.fire(e);
const options3 = this._configuration.options;
if (e.hasChanged(
145
/* EditorOption.layoutInfo */
)) {
const layoutInfo = options3.get(
145
/* EditorOption.layoutInfo */
);
this._onDidLayoutChange.fire(layoutInfo);
}
}));
this._contextKeyService = this._register(contextKeyService.createScoped(this._domElement));
this._notificationService = notificationService;
this._codeEditorService = codeEditorService;
this._commandService = commandService;
this._themeService = themeService;
this._register(new EditorContextKeysManager(this, this._contextKeyService));
this._register(new EditorModeContext(this, this._contextKeyService, languageFeaturesService));
this._instantiationService = this._register(instantiationService.createChild(new ServiceCollection([IContextKeyService, this._contextKeyService])));
this._modelData = null;
this._focusTracker = new CodeEditorWidgetFocusTracker(domElement, this._overflowWidgetsDomNode);
this._register(this._focusTracker.onChange(() => {
this._editorWidgetFocus.setValue(this._focusTracker.hasFocus());
}));
this._contentWidgets = {};
this._overlayWidgets = {};
this._glyphMarginWidgets = {};
let contributions;
if (Array.isArray(codeEditorWidgetOptions.contributions)) {
contributions = codeEditorWidgetOptions.contributions;
} else {
contributions = EditorExtensionsRegistry.getEditorContributions();
}
this._contributions.initialize(this, contributions, this._instantiationService);
for (const action of EditorExtensionsRegistry.getEditorActions()) {
if (this._actions.has(action.id)) {
onUnexpectedError(new Error(`Cannot have two actions with the same id ${action.id}`));
continue;
}
const internalAction = new InternalEditorAction(action.id, action.label, action.alias, action.metadata, (_b4 = action.precondition) !== null && _b4 !== void 0 ? _b4 : void 0, (args) => {
return this._instantiationService.invokeFunction((accessor) => {
return Promise.resolve(action.runEditorCommand(accessor, this, args));
});
}, this._contextKeyService);
this._actions.set(internalAction.id, internalAction);
}
const isDropIntoEnabled = () => {
return !this._configuration.options.get(
91
/* EditorOption.readOnly */
) && this._configuration.options.get(
36
/* EditorOption.dropIntoEditor */
).enabled;
};
this._register(new DragAndDropObserver(this._domElement, {
onDragOver: (e) => {
if (!isDropIntoEnabled()) {
return;
}
const target = this.getTargetAtClientPoint(e.clientX, e.clientY);
if (target === null || target === void 0 ? void 0 : target.position) {
this.showDropIndicatorAt(target.position);
}
},
onDrop: (e) => __async(this, null, function* () {
if (!isDropIntoEnabled()) {
return;
}
this.removeDropIndicator();
if (!e.dataTransfer) {
return;
}
const target = this.getTargetAtClientPoint(e.clientX, e.clientY);
if (target === null || target === void 0 ? void 0 : target.position) {
this._onDropIntoEditor.fire({ position: target.position, event: e });
}
}),
onDragLeave: () => {
this.removeDropIndicator();
},
onDragEnd: () => {
this.removeDropIndicator();
}
}));
this._codeEditorService.addCodeEditor(this);
}
writeScreenReaderContent(reason) {
var _a10;
(_a10 = this._modelData) === null || _a10 === void 0 ? void 0 : _a10.view.writeScreenReaderContent(reason);
}
_createConfiguration(isSimpleWidget, contextMenuId, options2, accessibilityService) {
return new EditorConfiguration(isSimpleWidget, contextMenuId, options2, this._domElement, accessibilityService);
}
getId() {
return this.getEditorType() + ":" + this._id;
}
getEditorType() {
return EditorType.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(fn) {
return this._instantiationService.invokeFunction(fn);
}
updateOptions(newOptions) {
this._configuration.updateOptions(newOptions || {});
}
getOptions() {
return this._configuration.options;
}
getOption(id) {
return this._configuration.options.get(id);
}
getRawOptions() {
return this._configuration.getRawOptions();
}
getOverflowWidgetsDomNode() {
return this._overflowWidgetsDomNode;
}
getConfiguredWordAtPosition(position) {
if (!this._modelData) {
return null;
}
return WordOperations.getWordAtPosition(this._modelData.model, this._configuration.options.get(
131
/* EditorOption.wordSeparators */
), this._configuration.options.get(
130
/* EditorOption.wordSegmenterLocales */
), position);
}
getValue(options2 = null) {
if (!this._modelData) {
return "";
}
const preserveBOM = options2 && options2.preserveBOM ? true : false;
let eolPreference = 0;
if (options2 && options2.lineEnding && options2.lineEnding === "\n") {
eolPreference = 1;
} else if (options2 && options2.lineEnding && options2.lineEnding === "\r\n") {
eolPreference = 2;
}
return this._modelData.model.getValue(eolPreference, preserveBOM);
}
setValue(newValue) {
try {
this._beginUpdate();
if (!this._modelData) {
return;
}
this._modelData.model.setValue(newValue);
} finally {
this._endUpdate();
}
}
getModel() {
if (!this._modelData) {
return null;
}
return this._modelData.model;
}
setModel(_model = null) {
var _a10;
try {
this._beginUpdate();
const model = _model;
if (this._modelData === null && model === null) {
return;
}
if (this._modelData && this._modelData.model === model) {
return;
}
const e = {
oldModelUrl: ((_a10 = this._modelData) === null || _a10 === void 0 ? void 0 : _a10.model.uri) || null,
newModelUrl: (model === null || model === void 0 ? void 0 : model.uri) || null
};
this._onWillChangeModel.fire(e);
const hasTextFocus = this.hasTextFocus();
const detachedModel = this._detachModel();
this._attachModel(model);
if (hasTextFocus && this.hasModel()) {
this.focus();
}
this._removeDecorationTypes();
this._onDidChangeModel.fire(e);
this._postDetachModelCleanup(detachedModel);
this._contributionsDisposable = this._contributions.onAfterModelAttached();
} finally {
this._endUpdate();
}
}
_removeDecorationTypes() {
this._decorationTypeKeysToIds = {};
if (this._decorationTypeSubtypes) {
for (const decorationType in this._decorationTypeSubtypes) {
const subTypes = this._decorationTypeSubtypes[decorationType];
for (const subType in subTypes) {
this._removeDecorationType(decorationType + "-" + subType);
}
}
this._decorationTypeSubtypes = {};
}
}
getVisibleRanges() {
if (!this._modelData) {
return [];
}
return this._modelData.viewModel.getVisibleRanges();
}
getVisibleRangesPlusViewportAboveBelow() {
if (!this._modelData) {
return [];
}
return this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow();
}
getWhitespaces() {
if (!this._modelData) {
return [];
}
return this._modelData.viewModel.viewLayout.getWhitespaces();
}
static _getVerticalOffsetAfterPosition(modelData, modelLineNumber, modelColumn, includeViewZones) {
const modelPosition = modelData.model.validatePosition({
lineNumber: modelLineNumber,
column: modelColumn
});
const viewPosition = modelData.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
return modelData.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(viewPosition.lineNumber, includeViewZones);
}
getTopForLineNumber(lineNumber, includeViewZones = false) {
if (!this._modelData) {
return -1;
}
return CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, lineNumber, 1, includeViewZones);
}
getTopForPosition(lineNumber, column) {
if (!this._modelData) {
return -1;
}
return CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, lineNumber, column, false);
}
static _getVerticalOffsetForPosition(modelData, modelLineNumber, modelColumn, includeViewZones = false) {
const modelPosition = modelData.model.validatePosition({
lineNumber: modelLineNumber,
column: modelColumn
});
const viewPosition = modelData.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
return modelData.viewModel.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber, includeViewZones);
}
getBottomForLineNumber(lineNumber, includeViewZones = false) {
if (!this._modelData) {
return -1;
}
return CodeEditorWidget_1._getVerticalOffsetAfterPosition(this._modelData, lineNumber, 1, includeViewZones);
}
setHiddenAreas(ranges, source) {
var _a10;
(_a10 = this._modelData) === null || _a10 === void 0 ? void 0 : _a10.viewModel.setHiddenAreas(ranges.map((r) => Range.lift(r)), source);
}
getVisibleColumnFromPosition(rawPosition) {
if (!this._modelData) {
return rawPosition.column;
}
const position = this._modelData.model.validatePosition(rawPosition);
const tabSize = this._modelData.model.getOptions().tabSize;
return CursorColumns.visibleColumnFromColumn(this._modelData.model.getLineContent(position.lineNumber), position.column, tabSize) + 1;
}
getPosition() {
if (!this._modelData) {
return null;
}
return this._modelData.viewModel.getPosition();
}
setPosition(position, source = "api") {
if (!this._modelData) {
return;
}
if (!Position.isIPosition(position)) {
throw new Error("Invalid arguments");
}
this._modelData.viewModel.setSelections(source, [{
selectionStartLineNumber: position.lineNumber,
selectionStartColumn: position.column,
positionLineNumber: position.lineNumber,
positionColumn: position.column
}]);
}
_sendRevealRange(modelRange, verticalType, revealHorizontal, scrollType) {
if (!this._modelData) {
return;
}
if (!Range.isIRange(modelRange)) {
throw new Error("Invalid arguments");
}
const validatedModelRange = this._modelData.model.validateRange(modelRange);
const viewRange = this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(validatedModelRange);
this._modelData.viewModel.revealRange("api", revealHorizontal, viewRange, verticalType, scrollType);
}
revealLine(lineNumber, scrollType = 0) {
this._revealLine(lineNumber, 0, scrollType);
}
revealLineInCenter(lineNumber, scrollType = 0) {
this._revealLine(lineNumber, 1, scrollType);
}
revealLineInCenterIfOutsideViewport(lineNumber, scrollType = 0) {
this._revealLine(lineNumber, 2, scrollType);
}
revealLineNearTop(lineNumber, scrollType = 0) {
this._revealLine(lineNumber, 5, scrollType);
}
_revealLine(lineNumber, revealType, scrollType) {
if (typeof lineNumber !== "number") {
throw new Error("Invalid arguments");
}
this._sendRevealRange(new Range(lineNumber, 1, lineNumber, 1), revealType, false, scrollType);
}
revealPosition(position, scrollType = 0) {
this._revealPosition(position, 0, true, scrollType);
}
revealPositionInCenter(position, scrollType = 0) {
this._revealPosition(position, 1, true, scrollType);
}
revealPositionInCenterIfOutsideViewport(position, scrollType = 0) {
this._revealPosition(position, 2, true, scrollType);
}
revealPositionNearTop(position, scrollType = 0) {
this._revealPosition(position, 5, true, scrollType);
}
_revealPosition(position, verticalType, revealHorizontal, scrollType) {
if (!Position.isIPosition(position)) {
throw new Error("Invalid arguments");
}
this._sendRevealRange(new Range(position.lineNumber, position.column, position.lineNumber, position.column), verticalType, revealHorizontal, scrollType);
}
getSelection() {
if (!this._modelData) {
return null;
}
return this._modelData.viewModel.getSelection();
}
getSelections() {
if (!this._modelData) {
return null;
}
return this._modelData.viewModel.getSelections();
}
setSelection(something, source = "api") {
const isSelection = Selection.isISelection(something);
const isRange = Range.isIRange(something);
if (!isSelection && !isRange) {
throw new Error("Invalid arguments");
}
if (isSelection) {
this._setSelectionImpl(something, source);
} else if (isRange) {
const selection = {
selectionStartLineNumber: something.startLineNumber,
selectionStartColumn: something.startColumn,
positionLineNumber: something.endLineNumber,
positionColumn: something.endColumn
};
this._setSelectionImpl(selection, source);
}
}
_setSelectionImpl(sel, source) {
if (!this._modelData) {
return;
}
const selection = new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);
this._modelData.viewModel.setSelections(source, [selection]);
}
revealLines(startLineNumber, endLineNumber, scrollType = 0) {
this._revealLines(startLineNumber, endLineNumber, 0, scrollType);
}
revealLinesInCenter(startLineNumber, endLineNumber, scrollType = 0) {
this._revealLines(startLineNumber, endLineNumber, 1, scrollType);
}
revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType = 0) {
this._revealLines(startLineNumber, endLineNumber, 2, scrollType);
}
revealLinesNearTop(startLineNumber, endLineNumber, scrollType = 0) {
this._revealLines(startLineNumber, endLineNumber, 5, scrollType);
}
_revealLines(startLineNumber, endLineNumber, verticalType, scrollType) {
if (typeof startLineNumber !== "number" || typeof endLineNumber !== "number") {
throw new Error("Invalid arguments");
}
this._sendRevealRange(new Range(startLineNumber, 1, endLineNumber, 1), verticalType, false, scrollType);
}
revealRange(range2, scrollType = 0, revealVerticalInCenter = false, revealHorizontal = true) {
this._revealRange(range2, revealVerticalInCenter ? 1 : 0, revealHorizontal, scrollType);
}
revealRangeInCenter(range2, scrollType = 0) {
this._revealRange(range2, 1, true, scrollType);
}
revealRangeInCenterIfOutsideViewport(range2, scrollType = 0) {
this._revealRange(range2, 2, true, scrollType);
}
revealRangeNearTop(range2, scrollType = 0) {
this._revealRange(range2, 5, true, scrollType);
}
revealRangeNearTopIfOutsideViewport(range2, scrollType = 0) {
this._revealRange(range2, 6, true, scrollType);
}
revealRangeAtTop(range2, scrollType = 0) {
this._revealRange(range2, 3, true, scrollType);
}
_revealRange(range2, verticalType, revealHorizontal, scrollType) {
if (!Range.isIRange(range2)) {
throw new Error("Invalid arguments");
}
this._sendRevealRange(Range.lift(range2), verticalType, revealHorizontal, scrollType);
}
setSelections(ranges, source = "api", reason = 0) {
if (!this._modelData) {
return;
}
if (!ranges || ranges.length === 0) {
throw new Error("Invalid arguments");
}
for (let i = 0, len = ranges.length; i < len; i++) {
if (!Selection.isISelection(ranges[i])) {
throw new Error("Invalid arguments");
}
}
this._modelData.viewModel.setSelections(source, ranges, reason);
}
getContentWidth() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getContentWidth();
}
getScrollWidth() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getScrollWidth();
}
getScrollLeft() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getCurrentScrollLeft();
}
getContentHeight() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getContentHeight();
}
getScrollHeight() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getScrollHeight();
}
getScrollTop() {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getCurrentScrollTop();
}
setScrollLeft(newScrollLeft, scrollType = 1) {
if (!this._modelData) {
return;
}
if (typeof newScrollLeft !== "number") {
throw new Error("Invalid arguments");
}
this._modelData.viewModel.viewLayout.setScrollPosition({
scrollLeft: newScrollLeft
}, scrollType);
}
setScrollTop(newScrollTop, scrollType = 1) {
if (!this._modelData) {
return;
}
if (typeof newScrollTop !== "number") {
throw new Error("Invalid arguments");
}
this._modelData.viewModel.viewLayout.setScrollPosition({
scrollTop: newScrollTop
}, scrollType);
}
setScrollPosition(position, scrollType = 1) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.viewLayout.setScrollPosition(position, scrollType);
}
hasPendingScrollAnimation() {
if (!this._modelData) {
return false;
}
return this._modelData.viewModel.viewLayout.hasPendingScrollAnimation();
}
saveViewState() {
if (!this._modelData) {
return null;
}
const contributionsState = this._contributions.saveViewState();
const cursorState = this._modelData.viewModel.saveCursorState();
const viewState = this._modelData.viewModel.saveState();
return {
cursorState,
viewState,
contributionsState
};
}
restoreViewState(s) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
const codeEditorState = s;
if (codeEditorState && codeEditorState.cursorState && codeEditorState.viewState) {
const cursorState = codeEditorState.cursorState;
if (Array.isArray(cursorState)) {
if (cursorState.length > 0) {
this._modelData.viewModel.restoreCursorState(cursorState);
}
} else {
this._modelData.viewModel.restoreCursorState([cursorState]);
}
this._contributions.restoreViewState(codeEditorState.contributionsState || {});
const reducedState = this._modelData.viewModel.reduceRestoreState(codeEditorState.viewState);
this._modelData.view.restoreState(reducedState);
}
}
handleInitialized() {
var _a10;
(_a10 = this._getViewModel()) === null || _a10 === void 0 ? void 0 : _a10.visibleLinesStabilized();
}
getContribution(id) {
return this._contributions.get(id);
}
getActions() {
return Array.from(this._actions.values());
}
getSupportedActions() {
let result = this.getActions();
result = result.filter((action) => action.isSupported());
return result;
}
getAction(id) {
return this._actions.get(id) || null;
}
trigger(source, handlerId, payload) {
payload = payload || {};
try {
this._beginUpdate();
switch (handlerId) {
case "compositionStart":
this._startComposition();
return;
case "compositionEnd":
this._endComposition(source);
return;
case "type": {
const args = payload;
this._type(source, args.text || "");
return;
}
case "replacePreviousChar": {
const args = payload;
this._compositionType(source, args.text || "", args.replaceCharCnt || 0, 0, 0);
return;
}
case "compositionType": {
const args = payload;
this._compositionType(source, args.text || "", args.replacePrevCharCnt || 0, args.replaceNextCharCnt || 0, args.positionDelta || 0);
return;
}
case "paste": {
const args = payload;
this._paste(source, args.text || "", args.pasteOnNewLine || false, args.multicursorText || null, args.mode || null, args.clipboardEvent);
return;
}
case "cut":
this._cut(source);
return;
}
const action = this.getAction(handlerId);
if (action) {
Promise.resolve(action.run(payload)).then(void 0, onUnexpectedError);
return;
}
if (!this._modelData) {
return;
}
if (this._triggerEditorCommand(source, handlerId, payload)) {
return;
}
this._triggerCommand(handlerId, payload);
} finally {
this._endUpdate();
}
}
_triggerCommand(handlerId, payload) {
this._commandService.executeCommand(handlerId, payload);
}
_startComposition() {
if (!this._modelData) {
return;
}
this._modelData.viewModel.startComposition();
this._onDidCompositionStart.fire();
}
_endComposition(source) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.endComposition(source);
this._onDidCompositionEnd.fire();
}
_type(source, text2) {
if (!this._modelData || text2.length === 0) {
return;
}
if (source === "keyboard") {
this._onWillType.fire(text2);
}
this._modelData.viewModel.type(text2, source);
if (source === "keyboard") {
this._onDidType.fire(text2);
}
}
_compositionType(source, text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.compositionType(text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta, source);
}
_paste(source, text2, pasteOnNewLine, multicursorText, mode, clipboardEvent) {
if (!this._modelData) {
return;
}
const viewModel = this._modelData.viewModel;
const startPosition = viewModel.getSelection().getStartPosition();
viewModel.paste(text2, pasteOnNewLine, multicursorText, source);
const endPosition = viewModel.getSelection().getStartPosition();
if (source === "keyboard") {
this._onDidPaste.fire({
clipboardEvent,
range: new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column),
languageId: mode
});
}
}
_cut(source) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.cut(source);
}
_triggerEditorCommand(source, handlerId, payload) {
const command = EditorExtensionsRegistry.getEditorCommand(handlerId);
if (command) {
payload = payload || {};
payload.source = source;
this._instantiationService.invokeFunction((accessor) => {
Promise.resolve(command.runEditorCommand(accessor, this, payload)).then(void 0, onUnexpectedError);
});
return true;
}
return false;
}
_getViewModel() {
if (!this._modelData) {
return null;
}
return this._modelData.viewModel;
}
pushUndoStop() {
if (!this._modelData) {
return false;
}
if (this._configuration.options.get(
91
/* EditorOption.readOnly */
)) {
return false;
}
this._modelData.model.pushStackElement();
return true;
}
popUndoStop() {
if (!this._modelData) {
return false;
}
if (this._configuration.options.get(
91
/* EditorOption.readOnly */
)) {
return false;
}
this._modelData.model.popStackElement();
return true;
}
executeEdits(source, edits, endCursorState) {
if (!this._modelData) {
return false;
}
if (this._configuration.options.get(
91
/* EditorOption.readOnly */
)) {
return false;
}
let cursorStateComputer;
if (!endCursorState) {
cursorStateComputer = () => null;
} else if (Array.isArray(endCursorState)) {
cursorStateComputer = () => endCursorState;
} else {
cursorStateComputer = endCursorState;
}
this._modelData.viewModel.executeEdits(source, edits, cursorStateComputer);
return true;
}
executeCommand(source, command) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.executeCommand(command, source);
}
executeCommands(source, commands) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.executeCommands(commands, source);
}
createDecorationsCollection(decorations) {
return new EditorDecorationsCollection(this, decorations);
}
changeDecorations(callback) {
if (!this._modelData) {
return null;
}
return this._modelData.model.changeDecorations(callback, this._id);
}
getLineDecorations(lineNumber) {
if (!this._modelData) {
return null;
}
return this._modelData.model.getLineDecorations(lineNumber, this._id, filterValidationDecorations(this._configuration.options));
}
getDecorationsInRange(range2) {
if (!this._modelData) {
return null;
}
return this._modelData.model.getDecorationsInRange(range2, this._id, filterValidationDecorations(this._configuration.options));
}
/**
* @deprecated
*/
deltaDecorations(oldDecorations, newDecorations) {
if (!this._modelData) {
return [];
}
if (oldDecorations.length === 0 && newDecorations.length === 0) {
return oldDecorations;
}
return this._modelData.model.deltaDecorations(oldDecorations, newDecorations, this._id);
}
removeDecorations(decorationIds) {
if (!this._modelData || decorationIds.length === 0) {
return;
}
this._modelData.model.changeDecorations((changeAccessor) => {
changeAccessor.deltaDecorations(decorationIds, []);
});
}
removeDecorationsByType(decorationTypeKey) {
const oldDecorationsIds = this._decorationTypeKeysToIds[decorationTypeKey];
if (oldDecorationsIds) {
this.changeDecorations((accessor) => accessor.deltaDecorations(oldDecorationsIds, []));
}
if (this._decorationTypeKeysToIds.hasOwnProperty(decorationTypeKey)) {
delete this._decorationTypeKeysToIds[decorationTypeKey];
}
if (this._decorationTypeSubtypes.hasOwnProperty(decorationTypeKey)) {
delete this._decorationTypeSubtypes[decorationTypeKey];
}
}
getLayoutInfo() {
const options2 = this._configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
return layoutInfo;
}
createOverviewRuler(cssClassName) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.createOverviewRuler(cssClassName);
}
getContainerDomNode() {
return this._domElement;
}
getDomNode() {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.domNode.domNode;
}
delegateVerticalScrollbarPointerDown(browserEvent) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.delegateVerticalScrollbarPointerDown(browserEvent);
}
delegateScrollFromMouseWheelEvent(browserEvent) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.delegateScrollFromMouseWheelEvent(browserEvent);
}
layout(dimension, postponeRendering = false) {
this._configuration.observeContainer(dimension);
if (!postponeRendering) {
this.render();
}
}
focus() {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.focus();
}
hasTextFocus() {
if (!this._modelData || !this._modelData.hasRealView) {
return false;
}
return this._modelData.view.isFocused();
}
hasWidgetFocus() {
return this._focusTracker && this._focusTracker.hasFocus();
}
addContentWidget(widget) {
const widgetData = {
widget,
position: widget.getPosition()
};
if (this._contentWidgets.hasOwnProperty(widget.getId())) {
console.warn("Overwriting a content widget with the same id:" + widget.getId());
}
this._contentWidgets[widget.getId()] = widgetData;
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.addContentWidget(widgetData);
}
}
layoutContentWidget(widget) {
const widgetId = widget.getId();
if (this._contentWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._contentWidgets[widgetId];
widgetData.position = widget.getPosition();
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.layoutContentWidget(widgetData);
}
}
}
removeContentWidget(widget) {
const widgetId = widget.getId();
if (this._contentWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._contentWidgets[widgetId];
delete this._contentWidgets[widgetId];
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.removeContentWidget(widgetData);
}
}
}
addOverlayWidget(widget) {
const widgetData = {
widget,
position: widget.getPosition()
};
if (this._overlayWidgets.hasOwnProperty(widget.getId())) {
console.warn("Overwriting an overlay widget with the same id.");
}
this._overlayWidgets[widget.getId()] = widgetData;
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.addOverlayWidget(widgetData);
}
}
layoutOverlayWidget(widget) {
const widgetId = widget.getId();
if (this._overlayWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._overlayWidgets[widgetId];
widgetData.position = widget.getPosition();
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.layoutOverlayWidget(widgetData);
}
}
}
removeOverlayWidget(widget) {
const widgetId = widget.getId();
if (this._overlayWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._overlayWidgets[widgetId];
delete this._overlayWidgets[widgetId];
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.removeOverlayWidget(widgetData);
}
}
}
addGlyphMarginWidget(widget) {
const widgetData = {
widget,
position: widget.getPosition()
};
if (this._glyphMarginWidgets.hasOwnProperty(widget.getId())) {
console.warn("Overwriting a glyph margin widget with the same id.");
}
this._glyphMarginWidgets[widget.getId()] = widgetData;
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.addGlyphMarginWidget(widgetData);
}
}
layoutGlyphMarginWidget(widget) {
const widgetId = widget.getId();
if (this._glyphMarginWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._glyphMarginWidgets[widgetId];
widgetData.position = widget.getPosition();
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.layoutGlyphMarginWidget(widgetData);
}
}
}
removeGlyphMarginWidget(widget) {
const widgetId = widget.getId();
if (this._glyphMarginWidgets.hasOwnProperty(widgetId)) {
const widgetData = this._glyphMarginWidgets[widgetId];
delete this._glyphMarginWidgets[widgetId];
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.removeGlyphMarginWidget(widgetData);
}
}
}
changeViewZones(callback) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.change(callback);
}
getTargetAtClientPoint(clientX, clientY) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.getTargetAtClientPoint(clientX, clientY);
}
getScrolledVisiblePosition(rawPosition) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
const position = this._modelData.model.validatePosition(rawPosition);
const options2 = this._configuration.options;
const layoutInfo = options2.get(
145
/* EditorOption.layoutInfo */
);
const top = CodeEditorWidget_1._getVerticalOffsetForPosition(this._modelData, position.lineNumber, position.column) - this.getScrollTop();
const left = this._modelData.view.getOffsetForColumn(position.lineNumber, position.column) + layoutInfo.glyphMarginWidth + layoutInfo.lineNumbersWidth + layoutInfo.decorationsWidth - this.getScrollLeft();
return {
top,
left,
height: options2.get(
67
/* EditorOption.lineHeight */
)
};
}
getOffsetForColumn(lineNumber, column) {
if (!this._modelData || !this._modelData.hasRealView) {
return -1;
}
return this._modelData.view.getOffsetForColumn(lineNumber, column);
}
render(forceRedraw = false) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.viewModel.batchEvents(() => {
this._modelData.view.render(true, forceRedraw);
});
}
setAriaOptions(options2) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.setAriaOptions(options2);
}
applyFontInfo(target) {
applyFontInfo(target, this._configuration.options.get(
50
/* EditorOption.fontInfo */
));
}
setBanner(domNode, domNodeHeight) {
if (this._bannerDomNode && this._domElement.contains(this._bannerDomNode)) {
this._domElement.removeChild(this._bannerDomNode);
}
this._bannerDomNode = domNode;
this._configuration.setReservedHeight(domNode ? domNodeHeight : 0);
if (this._bannerDomNode) {
this._domElement.prepend(this._bannerDomNode);
}
}
_attachModel(model) {
if (!model) {
this._modelData = null;
return;
}
const listenersToRemove = [];
this._domElement.setAttribute("data-mode-id", model.getLanguageId());
this._configuration.setIsDominatedByLongLines(model.isDominatedByLongLines());
this._configuration.setModelLineCount(model.getLineCount());
const attachedView = model.onBeforeAttached();
const viewModel = new ViewModel(this._id, this._configuration, model, DOMLineBreaksComputerFactory.create(getWindow(this._domElement)), MonospaceLineBreaksComputerFactory.create(this._configuration.options), (callback) => scheduleAtNextAnimationFrame(getWindow(this._domElement), callback), this.languageConfigurationService, this._themeService, attachedView);
listenersToRemove.push(model.onWillDispose(() => this.setModel(null)));
listenersToRemove.push(viewModel.onEvent((e) => {
switch (e.kind) {
case 0:
this._onDidContentSizeChange.fire(e);
break;
case 1:
this._editorTextFocus.setValue(e.hasFocus);
break;
case 2:
this._onDidScrollChange.fire(e);
break;
case 3:
this._onDidChangeViewZones.fire();
break;
case 4:
this._onDidChangeHiddenAreas.fire();
break;
case 5:
this._onDidAttemptReadOnlyEdit.fire();
break;
case 6: {
if (e.reachedMaxCursorCount) {
const multiCursorLimit = this.getOption(
80
/* EditorOption.multiCursorLimit */
);
const message = 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);
this._notificationService.prompt(Severity2.Warning, message, [
{
label: "Find and Replace",
run: () => {
this._commandService.executeCommand("editor.action.startFindReplaceAction");
}
},
{
label: localize("goToSetting", "Increase Multi Cursor Limit"),
run: () => {
this._commandService.executeCommand("workbench.action.openSettings2", {
query: "editor.multiCursorLimit"
});
}
}
]);
}
const positions = [];
for (let i = 0, len = e.selections.length; i < len; i++) {
positions[i] = e.selections[i].getPosition();
}
const e1 = {
position: positions[0],
secondaryPositions: positions.slice(1),
reason: e.reason,
source: e.source
};
this._onDidChangeCursorPosition.fire(e1);
const e2 = {
selection: e.selections[0],
secondarySelections: e.selections.slice(1),
modelVersionId: e.modelVersionId,
oldSelections: e.oldSelections,
oldModelVersionId: e.oldModelVersionId,
source: e.source,
reason: e.reason
};
this._onDidChangeCursorSelection.fire(e2);
break;
}
case 7:
this._onDidChangeModelDecorations.fire(e.event);
break;
case 8:
this._domElement.setAttribute("data-mode-id", model.getLanguageId());
this._onDidChangeModelLanguage.fire(e.event);
break;
case 9:
this._onDidChangeModelLanguageConfiguration.fire(e.event);
break;
case 10:
this._onDidChangeModelContent.fire(e.event);
break;
case 11:
this._onDidChangeModelOptions.fire(e.event);
break;
case 12:
this._onDidChangeModelTokens.fire(e.event);
break;
}
}));
const [view, hasRealView] = this._createView(viewModel);
if (hasRealView) {
this._domElement.appendChild(view.domNode.domNode);
let keys = Object.keys(this._contentWidgets);
for (let i = 0, len = keys.length; i < len; i++) {
const widgetId = keys[i];
view.addContentWidget(this._contentWidgets[widgetId]);
}
keys = Object.keys(this._overlayWidgets);
for (let i = 0, len = keys.length; i < len; i++) {
const widgetId = keys[i];
view.addOverlayWidget(this._overlayWidgets[widgetId]);
}
keys = Object.keys(this._glyphMarginWidgets);
for (let i = 0, len = keys.length; i < len; i++) {
const widgetId = keys[i];
view.addGlyphMarginWidget(this._glyphMarginWidgets[widgetId]);
}
view.render(false, true);
view.domNode.domNode.setAttribute("data-uri", model.uri.toString());
}
this._modelData = new ModelData(model, viewModel, view, hasRealView, listenersToRemove, attachedView);
}
_createView(viewModel) {
let commandDelegate;
if (this.isSimpleWidget) {
commandDelegate = {
paste: (text2, pasteOnNewLine, multicursorText, mode) => {
this._paste("keyboard", text2, pasteOnNewLine, multicursorText, mode);
},
type: (text2) => {
this._type("keyboard", text2);
},
compositionType: (text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) => {
this._compositionType("keyboard", text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta);
},
startComposition: () => {
this._startComposition();
},
endComposition: () => {
this._endComposition("keyboard");
},
cut: () => {
this._cut("keyboard");
}
};
} else {
commandDelegate = {
paste: (text2, pasteOnNewLine, multicursorText, mode) => {
const payload = { text: text2, pasteOnNewLine, multicursorText, mode };
this._commandService.executeCommand("paste", payload);
},
type: (text2) => {
const payload = { text: text2 };
this._commandService.executeCommand("type", payload);
},
compositionType: (text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta) => {
if (replaceNextCharCnt || positionDelta) {
const payload = { text: text2, replacePrevCharCnt, replaceNextCharCnt, positionDelta };
this._commandService.executeCommand("compositionType", payload);
} else {
const payload = { text: text2, replaceCharCnt: replacePrevCharCnt };
this._commandService.executeCommand("replacePreviousChar", payload);
}
},
startComposition: () => {
this._commandService.executeCommand("compositionStart", {});
},
endComposition: () => {
this._commandService.executeCommand("compositionEnd", {});
},
cut: () => {
this._commandService.executeCommand("cut", {});
}
};
}
const viewUserInputEvents = new ViewUserInputEvents(viewModel.coordinatesConverter);
viewUserInputEvents.onKeyDown = (e) => this._onKeyDown.fire(e);
viewUserInputEvents.onKeyUp = (e) => this._onKeyUp.fire(e);
viewUserInputEvents.onContextMenu = (e) => this._onContextMenu.fire(e);
viewUserInputEvents.onMouseMove = (e) => this._onMouseMove.fire(e);
viewUserInputEvents.onMouseLeave = (e) => this._onMouseLeave.fire(e);
viewUserInputEvents.onMouseDown = (e) => this._onMouseDown.fire(e);
viewUserInputEvents.onMouseUp = (e) => this._onMouseUp.fire(e);
viewUserInputEvents.onMouseDrag = (e) => this._onMouseDrag.fire(e);
viewUserInputEvents.onMouseDrop = (e) => this._onMouseDrop.fire(e);
viewUserInputEvents.onMouseDropCanceled = (e) => this._onMouseDropCanceled.fire(e);
viewUserInputEvents.onMouseWheel = (e) => this._onMouseWheel.fire(e);
const view = new View(commandDelegate, this._configuration, this._themeService.getColorTheme(), viewModel, viewUserInputEvents, this._overflowWidgetsDomNode, this._instantiationService);
return [view, true];
}
_postDetachModelCleanup(detachedModel) {
detachedModel === null || detachedModel === void 0 ? void 0 : detachedModel.removeAllDecorationsWithOwnerId(this._id);
}
_detachModel() {
var _a10;
(_a10 = this._contributionsDisposable) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this._contributionsDisposable = void 0;
if (!this._modelData) {
return null;
}
const model = this._modelData.model;
const removeDomNode = this._modelData.hasRealView ? this._modelData.view.domNode.domNode : null;
this._modelData.dispose();
this._modelData = null;
this._domElement.removeAttribute("data-mode-id");
if (removeDomNode && this._domElement.contains(removeDomNode)) {
this._domElement.removeChild(removeDomNode);
}
if (this._bannerDomNode && this._domElement.contains(this._bannerDomNode)) {
this._domElement.removeChild(this._bannerDomNode);
}
return model;
}
_removeDecorationType(key) {
this._codeEditorService.removeDecorationType(key);
}
hasModel() {
return this._modelData !== null;
}
showDropIndicatorAt(position) {
const newDecorations = [{
range: new Range(position.lineNumber, position.column, position.lineNumber, position.column),
options: CodeEditorWidget_1.dropIntoEditorDecorationOptions
}];
this._dropIntoEditorDecorations.set(newDecorations);
this.revealPosition(
position,
1
/* editorCommon.ScrollType.Immediate */
);
}
removeDropIndicator() {
this._dropIntoEditorDecorations.clear();
}
setContextValue(key, value) {
this._contextKeyService.createKey(key, value);
}
_beginUpdate() {
this._updateCounter++;
if (this._updateCounter === 1) {
this._onBeginUpdate.fire();
}
}
_endUpdate() {
this._updateCounter--;
if (this._updateCounter === 0) {
this._onEndUpdate.fire();
}
}
};
CodeEditorWidget.dropIntoEditorDecorationOptions = ModelDecorationOptions.register({
description: "workbench-dnd-target",
className: "dnd-target"
});
CodeEditorWidget = CodeEditorWidget_1 = __decorate13([
__param12(3, IInstantiationService),
__param12(4, ICodeEditorService),
__param12(5, ICommandService),
__param12(6, IContextKeyService),
__param12(7, IThemeService),
__param12(8, INotificationService),
__param12(9, IAccessibilityService),
__param12(10, ILanguageConfigurationService),
__param12(11, ILanguageFeaturesService)
], CodeEditorWidget);
EDITOR_ID = 0;
ModelData = class {
constructor(model, viewModel, view, hasRealView, listenersToRemove, attachedView) {
this.model = model;
this.viewModel = viewModel;
this.view = view;
this.hasRealView = hasRealView;
this.listenersToRemove = listenersToRemove;
this.attachedView = attachedView;
}
dispose() {
dispose(this.listenersToRemove);
this.model.onBeforeDetached(this.attachedView);
if (this.hasRealView) {
this.view.dispose();
}
this.viewModel.dispose();
}
};
BooleanEventEmitter = class extends Disposable {
constructor(_emitterOptions) {
super();
this._emitterOptions = _emitterOptions;
this._onDidChangeToTrue = this._register(new Emitter(this._emitterOptions));
this.onDidChangeToTrue = this._onDidChangeToTrue.event;
this._onDidChangeToFalse = this._register(new Emitter(this._emitterOptions));
this.onDidChangeToFalse = this._onDidChangeToFalse.event;
this._value = 0;
}
setValue(_value) {
const value = _value ? 2 : 1;
if (this._value === value) {
return;
}
this._value = value;
if (this._value === 2) {
this._onDidChangeToTrue.fire();
} else if (this._value === 1) {
this._onDidChangeToFalse.fire();
}
}
};
InteractionEmitter = class extends Emitter {
constructor(_contributions, deliveryQueue) {
super({ deliveryQueue });
this._contributions = _contributions;
}
fire(event) {
this._contributions.onBeforeInteractionEvent();
super.fire(event);
}
};
EditorContextKeysManager = class extends Disposable {
constructor(editor2, contextKeyService) {
super();
this._editor = editor2;
contextKeyService.createKey("editorId", editor2.getId());
this._editorSimpleInput = EditorContextKeys.editorSimpleInput.bindTo(contextKeyService);
this._editorFocus = EditorContextKeys.focus.bindTo(contextKeyService);
this._textInputFocus = EditorContextKeys.textInputFocus.bindTo(contextKeyService);
this._editorTextFocus = EditorContextKeys.editorTextFocus.bindTo(contextKeyService);
this._tabMovesFocus = EditorContextKeys.tabMovesFocus.bindTo(contextKeyService);
this._editorReadonly = EditorContextKeys.readOnly.bindTo(contextKeyService);
this._inDiffEditor = EditorContextKeys.inDiffEditor.bindTo(contextKeyService);
this._editorColumnSelection = EditorContextKeys.columnSelection.bindTo(contextKeyService);
this._hasMultipleSelections = EditorContextKeys.hasMultipleSelections.bindTo(contextKeyService);
this._hasNonEmptySelection = EditorContextKeys.hasNonEmptySelection.bindTo(contextKeyService);
this._canUndo = EditorContextKeys.canUndo.bindTo(contextKeyService);
this._canRedo = EditorContextKeys.canRedo.bindTo(contextKeyService);
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(TabFocus.onDidChangeTabFocus((tabFocusMode) => this._tabMovesFocus.set(tabFocusMode)));
this._updateFromConfig();
this._updateFromSelection();
this._updateFromFocus();
this._updateFromModel();
this._editorSimpleInput.set(this._editor.isSimpleWidget);
}
_updateFromConfig() {
const options2 = this._editor.getOptions();
this._tabMovesFocus.set(TabFocus.getTabFocusMode());
this._editorReadonly.set(options2.get(
91
/* EditorOption.readOnly */
));
this._inDiffEditor.set(options2.get(
61
/* EditorOption.inDiffEditor */
));
this._editorColumnSelection.set(options2.get(
22
/* EditorOption.columnSelection */
));
}
_updateFromSelection() {
const selections = this._editor.getSelections();
if (!selections) {
this._hasMultipleSelections.reset();
this._hasNonEmptySelection.reset();
} else {
this._hasMultipleSelections.set(selections.length > 1);
this._hasNonEmptySelection.set(selections.some((s) => !s.isEmpty()));
}
}
_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() {
const model = this._editor.getModel();
this._canUndo.set(Boolean(model && model.canUndo()));
this._canRedo.set(Boolean(model && model.canRedo()));
}
};
EditorModeContext = class extends Disposable {
constructor(_editor, _contextKeyService, _languageFeaturesService) {
super();
this._editor = _editor;
this._contextKeyService = _contextKeyService;
this._languageFeaturesService = _languageFeaturesService;
this._langId = EditorContextKeys.languageId.bindTo(_contextKeyService);
this._hasCompletionItemProvider = EditorContextKeys.hasCompletionItemProvider.bindTo(_contextKeyService);
this._hasCodeActionsProvider = EditorContextKeys.hasCodeActionsProvider.bindTo(_contextKeyService);
this._hasCodeLensProvider = EditorContextKeys.hasCodeLensProvider.bindTo(_contextKeyService);
this._hasDefinitionProvider = EditorContextKeys.hasDefinitionProvider.bindTo(_contextKeyService);
this._hasDeclarationProvider = EditorContextKeys.hasDeclarationProvider.bindTo(_contextKeyService);
this._hasImplementationProvider = EditorContextKeys.hasImplementationProvider.bindTo(_contextKeyService);
this._hasTypeDefinitionProvider = EditorContextKeys.hasTypeDefinitionProvider.bindTo(_contextKeyService);
this._hasHoverProvider = EditorContextKeys.hasHoverProvider.bindTo(_contextKeyService);
this._hasDocumentHighlightProvider = EditorContextKeys.hasDocumentHighlightProvider.bindTo(_contextKeyService);
this._hasDocumentSymbolProvider = EditorContextKeys.hasDocumentSymbolProvider.bindTo(_contextKeyService);
this._hasReferenceProvider = EditorContextKeys.hasReferenceProvider.bindTo(_contextKeyService);
this._hasRenameProvider = EditorContextKeys.hasRenameProvider.bindTo(_contextKeyService);
this._hasSignatureHelpProvider = EditorContextKeys.hasSignatureHelpProvider.bindTo(_contextKeyService);
this._hasInlayHintsProvider = EditorContextKeys.hasInlayHintsProvider.bindTo(_contextKeyService);
this._hasDocumentFormattingProvider = EditorContextKeys.hasDocumentFormattingProvider.bindTo(_contextKeyService);
this._hasDocumentSelectionFormattingProvider = EditorContextKeys.hasDocumentSelectionFormattingProvider.bindTo(_contextKeyService);
this._hasMultipleDocumentFormattingProvider = EditorContextKeys.hasMultipleDocumentFormattingProvider.bindTo(_contextKeyService);
this._hasMultipleDocumentSelectionFormattingProvider = EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider.bindTo(_contextKeyService);
this._isInEmbeddedEditor = EditorContextKeys.isInEmbeddedEditor.bindTo(_contextKeyService);
const update = () => this._update();
this._register(_editor.onDidChangeModel(update));
this._register(_editor.onDidChangeModelLanguage(update));
this._register(_languageFeaturesService.completionProvider.onDidChange(update));
this._register(_languageFeaturesService.codeActionProvider.onDidChange(update));
this._register(_languageFeaturesService.codeLensProvider.onDidChange(update));
this._register(_languageFeaturesService.definitionProvider.onDidChange(update));
this._register(_languageFeaturesService.declarationProvider.onDidChange(update));
this._register(_languageFeaturesService.implementationProvider.onDidChange(update));
this._register(_languageFeaturesService.typeDefinitionProvider.onDidChange(update));
this._register(_languageFeaturesService.hoverProvider.onDidChange(update));
this._register(_languageFeaturesService.documentHighlightProvider.onDidChange(update));
this._register(_languageFeaturesService.documentSymbolProvider.onDidChange(update));
this._register(_languageFeaturesService.referenceProvider.onDidChange(update));
this._register(_languageFeaturesService.renameProvider.onDidChange(update));
this._register(_languageFeaturesService.documentFormattingEditProvider.onDidChange(update));
this._register(_languageFeaturesService.documentRangeFormattingEditProvider.onDidChange(update));
this._register(_languageFeaturesService.signatureHelpProvider.onDidChange(update));
this._register(_languageFeaturesService.inlayHintsProvider.onDidChange(update));
update();
}
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() {
const model = this._editor.getModel();
if (!model) {
this.reset();
return;
}
this._contextKeyService.bufferChangeEvents(() => {
this._langId.set(model.getLanguageId());
this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(model));
this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(model));
this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(model));
this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(model));
this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(model));
this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(model));
this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(model));
this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(model));
this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(model));
this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(model));
this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(model));
this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(model));
this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(model));
this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(model));
this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(model) || this._languageFeaturesService.documentRangeFormattingEditProvider.has(model));
this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(model));
this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(model).length + this._languageFeaturesService.documentRangeFormattingEditProvider.all(model).length > 1);
this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(model).length > 1);
this._isInEmbeddedEditor.set(model.uri.scheme === Schemas.walkThroughSnippet || model.uri.scheme === Schemas.vscodeChatCodeBlock);
});
}
};
CodeEditorWidgetFocusTracker = class extends Disposable {
constructor(domElement, overflowWidgetsDomNode) {
super();
this._onChange = this._register(new Emitter());
this.onChange = this._onChange.event;
this._hadFocus = void 0;
this._hasDomElementFocus = false;
this._domFocusTracker = this._register(trackFocus(domElement));
this._overflowWidgetsDomNodeHasFocus = false;
this._register(this._domFocusTracker.onDidFocus(() => {
this._hasDomElementFocus = true;
this._update();
}));
this._register(this._domFocusTracker.onDidBlur(() => {
this._hasDomElementFocus = false;
this._update();
}));
if (overflowWidgetsDomNode) {
this._overflowWidgetsDomNode = this._register(trackFocus(overflowWidgetsDomNode));
this._register(this._overflowWidgetsDomNode.onDidFocus(() => {
this._overflowWidgetsDomNodeHasFocus = true;
this._update();
}));
this._register(this._overflowWidgetsDomNode.onDidBlur(() => {
this._overflowWidgetsDomNodeHasFocus = false;
this._update();
}));
}
}
_update() {
const focused = this._hasDomElementFocus || this._overflowWidgetsDomNodeHasFocus;
if (this._hadFocus !== focused) {
this._hadFocus = focused;
this._onChange.fire(void 0);
}
}
hasFocus() {
var _a10;
return (_a10 = this._hadFocus) !== null && _a10 !== void 0 ? _a10 : false;
}
};
EditorDecorationsCollection = class {
get length() {
return this._decorationIds.length;
}
constructor(_editor, decorations) {
this._editor = _editor;
this._decorationIds = [];
this._isChangingDecorations = false;
if (Array.isArray(decorations) && decorations.length > 0) {
this.set(decorations);
}
}
onDidChange(listener, thisArgs, disposables) {
return this._editor.onDidChangeModelDecorations((e) => {
if (this._isChangingDecorations) {
return;
}
listener.call(thisArgs, e);
}, disposables);
}
getRange(index) {
if (!this._editor.hasModel()) {
return null;
}
if (index >= this._decorationIds.length) {
return null;
}
return this._editor.getModel().getDecorationRange(this._decorationIds[index]);
}
getRanges() {
if (!this._editor.hasModel()) {
return [];
}
const model = this._editor.getModel();
const result = [];
for (const decorationId of this._decorationIds) {
const range2 = model.getDecorationRange(decorationId);
if (range2) {
result.push(range2);
}
}
return result;
}
has(decoration3) {
return this._decorationIds.includes(decoration3.id);
}
clear() {
if (this._decorationIds.length === 0) {
return;
}
this.set([]);
}
set(newDecorations) {
try {
this._isChangingDecorations = true;
this._editor.changeDecorations((accessor) => {
this._decorationIds = accessor.deltaDecorations(this._decorationIds, newDecorations);
});
} finally {
this._isChangingDecorations = false;
}
return this._decorationIds;
}
append(newDecorations) {
let newDecorationIds = [];
try {
this._isChangingDecorations = true;
this._editor.changeDecorations((accessor) => {
newDecorationIds = accessor.deltaDecorations([], newDecorations);
this._decorationIds = this._decorationIds.concat(newDecorationIds);
});
} finally {
this._isChangingDecorations = false;
}
return newDecorationIds;
}
};
squigglyStart = encodeURIComponent(``);
dotdotdotStart = encodeURIComponent(``);
registerThemingParticipant((theme, collector) => {
const errorForeground2 = theme.getColor(editorErrorForeground);
if (errorForeground2) {
collector.addRule(`.monaco-editor .${"squiggly-error"} { background: url("data:image/svg+xml,${getSquigglySVGData(errorForeground2)}") repeat-x bottom left; }`);
}
const warningForeground = theme.getColor(editorWarningForeground);
if (warningForeground) {
collector.addRule(`.monaco-editor .${"squiggly-warning"} { background: url("data:image/svg+xml,${getSquigglySVGData(warningForeground)}") repeat-x bottom left; }`);
}
const infoForeground = theme.getColor(editorInfoForeground);
if (infoForeground) {
collector.addRule(`.monaco-editor .${"squiggly-info"} { background: url("data:image/svg+xml,${getSquigglySVGData(infoForeground)}") repeat-x bottom left; }`);
}
const hintForeground = theme.getColor(editorHintForeground);
if (hintForeground) {
collector.addRule(`.monaco-editor .${"squiggly-hint"} { background: url("data:image/svg+xml,${getDotDotDotSVGData(hintForeground)}") no-repeat bottom left; }`);
}
const unnecessaryForeground = theme.getColor(editorUnnecessaryCodeOpacity);
if (unnecessaryForeground) {
collector.addRule(`.monaco-editor.showUnused .${"squiggly-inline-unnecessary"} { opacity: ${unnecessaryForeground.rgba.a}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/abstractCodeEditorService.js
var __decorate14, __param13, AbstractCodeEditorService;
var init_abstractCodeEditorService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/abstractCodeEditorService.js"() {
init_event();
init_lifecycle();
init_linkedList();
init_themeService();
__decorate14 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param13 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
AbstractCodeEditorService = class AbstractCodeEditorService2 extends Disposable {
constructor(_themeService) {
super();
this._themeService = _themeService;
this._onWillCreateCodeEditor = this._register(new Emitter());
this._onCodeEditorAdd = this._register(new Emitter());
this.onCodeEditorAdd = this._onCodeEditorAdd.event;
this._onCodeEditorRemove = this._register(new Emitter());
this.onCodeEditorRemove = this._onCodeEditorRemove.event;
this._onWillCreateDiffEditor = this._register(new Emitter());
this._onDiffEditorAdd = this._register(new Emitter());
this.onDiffEditorAdd = this._onDiffEditorAdd.event;
this._onDiffEditorRemove = this._register(new Emitter());
this.onDiffEditorRemove = this._onDiffEditorRemove.event;
this._decorationOptionProviders = /* @__PURE__ */ new Map();
this._codeEditorOpenHandlers = new LinkedList();
this._modelProperties = /* @__PURE__ */ new Map();
this._codeEditors = /* @__PURE__ */ Object.create(null);
this._diffEditors = /* @__PURE__ */ Object.create(null);
this._globalStyleSheet = null;
}
willCreateCodeEditor() {
this._onWillCreateCodeEditor.fire();
}
addCodeEditor(editor2) {
this._codeEditors[editor2.getId()] = editor2;
this._onCodeEditorAdd.fire(editor2);
}
removeCodeEditor(editor2) {
if (delete this._codeEditors[editor2.getId()]) {
this._onCodeEditorRemove.fire(editor2);
}
}
listCodeEditors() {
return Object.keys(this._codeEditors).map((id) => this._codeEditors[id]);
}
willCreateDiffEditor() {
this._onWillCreateDiffEditor.fire();
}
addDiffEditor(editor2) {
this._diffEditors[editor2.getId()] = editor2;
this._onDiffEditorAdd.fire(editor2);
}
listDiffEditors() {
return Object.keys(this._diffEditors).map((id) => this._diffEditors[id]);
}
getFocusedCodeEditor() {
let editorWithWidgetFocus = null;
const editors = this.listCodeEditors();
for (const editor2 of editors) {
if (editor2.hasTextFocus()) {
return editor2;
}
if (editor2.hasWidgetFocus()) {
editorWithWidgetFocus = editor2;
}
}
return editorWithWidgetFocus;
}
removeDecorationType(key) {
const provider = this._decorationOptionProviders.get(key);
if (provider) {
provider.refCount--;
if (provider.refCount <= 0) {
this._decorationOptionProviders.delete(key);
provider.dispose();
this.listCodeEditors().forEach((ed) => ed.removeDecorationsByType(key));
}
}
}
setModelProperty(resource, key, value) {
const key1 = resource.toString();
let dest;
if (this._modelProperties.has(key1)) {
dest = this._modelProperties.get(key1);
} else {
dest = /* @__PURE__ */ new Map();
this._modelProperties.set(key1, dest);
}
dest.set(key, value);
}
getModelProperty(resource, key) {
const key1 = resource.toString();
if (this._modelProperties.has(key1)) {
const innerMap = this._modelProperties.get(key1);
return innerMap.get(key);
}
return void 0;
}
openCodeEditor(input, source, sideBySide) {
return __async(this, null, function* () {
for (const handler of this._codeEditorOpenHandlers) {
const candidate = yield handler(input, source, sideBySide);
if (candidate !== null) {
return candidate;
}
}
return null;
});
}
registerCodeEditorOpenHandler(handler) {
const rm = this._codeEditorOpenHandlers.unshift(handler);
return toDisposable(rm);
}
};
AbstractCodeEditorService = __decorate14([
__param13(0, IThemeService)
], AbstractCodeEditorService);
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditorService.js
var __decorate15, __param14, StandaloneCodeEditorService;
var init_standaloneCodeEditorService = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditorService.js"() {
init_dom();
init_network();
init_abstractCodeEditorService();
init_codeEditorService();
init_contextkey();
init_extensions();
init_themeService();
__decorate15 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param14 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
StandaloneCodeEditorService = class StandaloneCodeEditorService2 extends AbstractCodeEditorService {
constructor(contextKeyService, themeService) {
super(themeService);
this._register(this.onCodeEditorAdd(() => this._checkContextKey()));
this._register(this.onCodeEditorRemove(() => this._checkContextKey()));
this._editorIsOpen = contextKeyService.createKey("editorIsOpen", false);
this._activeCodeEditor = null;
this._register(this.registerCodeEditorOpenHandler((input, source, sideBySide) => __async(this, null, function* () {
if (!source) {
return null;
}
return this.doOpenEditor(source, input);
})));
}
_checkContextKey() {
let hasCodeEditor = false;
for (const editor2 of this.listCodeEditors()) {
if (!editor2.isSimpleWidget) {
hasCodeEditor = true;
break;
}
}
this._editorIsOpen.set(hasCodeEditor);
}
setActiveCodeEditor(activeCodeEditor) {
this._activeCodeEditor = activeCodeEditor;
}
getActiveCodeEditor() {
return this._activeCodeEditor;
}
doOpenEditor(editor2, input) {
const model = this.findModel(editor2, input.resource);
if (!model) {
if (input.resource) {
const schema = input.resource.scheme;
if (schema === Schemas.http || schema === Schemas.https) {
windowOpenNoOpener(input.resource.toString());
return editor2;
}
}
return null;
}
const selection = input.options ? input.options.selection : null;
if (selection) {
if (typeof selection.endLineNumber === "number" && typeof selection.endColumn === "number") {
editor2.setSelection(selection);
editor2.revealRangeInCenter(
selection,
1
/* ScrollType.Immediate */
);
} else {
const pos = {
lineNumber: selection.startLineNumber,
column: selection.startColumn
};
editor2.setPosition(pos);
editor2.revealPositionInCenter(
pos,
1
/* ScrollType.Immediate */
);
}
}
return editor2;
}
findModel(editor2, resource) {
const model = editor2.getModel();
if (model && model.uri.toString() !== resource.toString()) {
return null;
}
return model;
}
};
StandaloneCodeEditorService = __decorate15([
__param14(0, IContextKeyService),
__param14(1, IThemeService)
], StandaloneCodeEditorService);
registerSingleton(
ICodeEditorService,
StandaloneCodeEditorService,
0
/* InstantiationType.Eager */
);
}
});
// node_modules/monaco-editor/esm/vs/platform/layout/browser/layoutService.js
var ILayoutService;
var init_layoutService = __esm({
"node_modules/monaco-editor/esm/vs/platform/layout/browser/layoutService.js"() {
init_instantiation();
ILayoutService = createDecorator("layoutService");
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLayoutService.js
var __decorate16, __param15, StandaloneLayoutService, EditorScopedLayoutService;
var init_standaloneLayoutService = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLayoutService.js"() {
init_dom();
init_window();
init_arrays();
init_event();
init_codeEditorService();
init_extensions();
init_layoutService();
__decorate16 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param15 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
StandaloneLayoutService = class StandaloneLayoutService2 {
get mainContainer() {
var _a10, _b4;
return (_b4 = (_a10 = firstOrDefault(this._codeEditorService.listCodeEditors())) === null || _a10 === void 0 ? void 0 : _a10.getContainerDomNode()) !== null && _b4 !== void 0 ? _b4 : mainWindow.document.body;
}
get activeContainer() {
var _a10, _b4;
const activeCodeEditor = (_a10 = this._codeEditorService.getFocusedCodeEditor()) !== null && _a10 !== void 0 ? _a10 : this._codeEditorService.getActiveCodeEditor();
return (_b4 = activeCodeEditor === null || activeCodeEditor === void 0 ? void 0 : activeCodeEditor.getContainerDomNode()) !== null && _b4 !== void 0 ? _b4 : this.mainContainer;
}
get mainContainerDimension() {
return getClientArea(this.mainContainer);
}
get activeContainerDimension() {
return getClientArea(this.activeContainer);
}
get containers() {
return coalesce(this._codeEditorService.listCodeEditors().map((codeEditor) => codeEditor.getContainerDomNode()));
}
getContainer() {
return this.activeContainer;
}
whenContainerStylesLoaded() {
return void 0;
}
focus() {
var _a10;
(_a10 = this._codeEditorService.getFocusedCodeEditor()) === null || _a10 === void 0 ? void 0 : _a10.focus();
}
constructor(_codeEditorService) {
this._codeEditorService = _codeEditorService;
this.onDidLayoutMainContainer = Event.None;
this.onDidLayoutActiveContainer = Event.None;
this.onDidLayoutContainer = Event.None;
this.onDidChangeActiveContainer = Event.None;
this.onDidAddContainer = Event.None;
this.mainContainerOffset = { top: 0, quickPickTop: 0 };
this.activeContainerOffset = { top: 0, quickPickTop: 0 };
}
};
StandaloneLayoutService = __decorate16([
__param15(0, ICodeEditorService)
], StandaloneLayoutService);
EditorScopedLayoutService = class EditorScopedLayoutService2 extends StandaloneLayoutService {
get mainContainer() {
return this._container;
}
constructor(_container, codeEditorService) {
super(codeEditorService);
this._container = _container;
}
};
EditorScopedLayoutService = __decorate16([
__param15(1, ICodeEditorService)
], EditorScopedLayoutService);
registerSingleton(
ILayoutService,
StandaloneLayoutService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/platform/dialogs/common/dialogs.js
var IDialogService;
var init_dialogs = __esm({
"node_modules/monaco-editor/esm/vs/platform/dialogs/common/dialogs.js"() {
init_instantiation();
IDialogService = createDecorator("dialogService");
}
});
// node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedoService.js
function getResourceLabel(resource) {
return resource.scheme === Schemas.file ? resource.fsPath : resource.path;
}
var __decorate17, __param16, DEBUG, stackElementCounter, ResourceStackElement, ResourceReasonPair, RemovedResources, WorkspaceStackElement, ResourceEditStack, EditStackSnapshot, missingEditStack, UndoRedoService, WorkspaceVerificationError;
var init_undoRedoService = __esm({
"node_modules/monaco-editor/esm/vs/platform/undoRedo/common/undoRedoService.js"() {
init_errors();
init_lifecycle();
init_network();
init_severity();
init_nls();
init_dialogs();
init_extensions();
init_notification();
init_undoRedo();
__decorate17 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param16 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DEBUG = false;
stackElementCounter = 0;
ResourceStackElement = class {
constructor(actual, resourceLabel, strResource, groupId, groupOrder, sourceId, sourceOrder) {
this.id = ++stackElementCounter;
this.type = 0;
this.actual = actual;
this.label = actual.label;
this.confirmBeforeUndo = actual.confirmBeforeUndo || false;
this.resourceLabel = resourceLabel;
this.strResource = strResource;
this.resourceLabels = [this.resourceLabel];
this.strResources = [this.strResource];
this.groupId = groupId;
this.groupOrder = groupOrder;
this.sourceId = sourceId;
this.sourceOrder = sourceOrder;
this.isValid = true;
}
setValid(isValid2) {
this.isValid = isValid2;
}
toString() {
return `[id:${this.id}] [group:${this.groupId}] [${this.isValid ? " VALID" : "INVALID"}] ${this.actual.constructor.name} - ${this.actual}`;
}
};
ResourceReasonPair = class {
constructor(resourceLabel, reason) {
this.resourceLabel = resourceLabel;
this.reason = reason;
}
};
RemovedResources = class {
constructor() {
this.elements = /* @__PURE__ */ new Map();
}
createMessage() {
const externalRemoval = [];
const noParallelUniverses = [];
for (const [, element] of this.elements) {
const dest = element.reason === 0 ? externalRemoval : noParallelUniverses;
dest.push(element.resourceLabel);
}
const messages = [];
if (externalRemoval.length > 0) {
messages.push(localize({ key: "externalRemoval", comment: ["{0} is a list of filenames"] }, "The following files have been closed and modified on disk: {0}.", externalRemoval.join(", ")));
}
if (noParallelUniverses.length > 0) {
messages.push(localize({ key: "noParallelUniverses", comment: ["{0} is a list of filenames"] }, "The following files have been modified in an incompatible way: {0}.", noParallelUniverses.join(", ")));
}
return messages.join("\n");
}
get size() {
return this.elements.size;
}
has(strResource) {
return this.elements.has(strResource);
}
set(strResource, value) {
this.elements.set(strResource, value);
}
delete(strResource) {
return this.elements.delete(strResource);
}
};
WorkspaceStackElement = class {
constructor(actual, resourceLabels, strResources, groupId, groupOrder, sourceId, sourceOrder) {
this.id = ++stackElementCounter;
this.type = 1;
this.actual = actual;
this.label = actual.label;
this.confirmBeforeUndo = actual.confirmBeforeUndo || false;
this.resourceLabels = resourceLabels;
this.strResources = strResources;
this.groupId = groupId;
this.groupOrder = groupOrder;
this.sourceId = sourceId;
this.sourceOrder = sourceOrder;
this.removedResources = null;
this.invalidatedResources = null;
}
canSplit() {
return typeof this.actual.split === "function";
}
removeResource(resourceLabel, strResource, reason) {
if (!this.removedResources) {
this.removedResources = new RemovedResources();
}
if (!this.removedResources.has(strResource)) {
this.removedResources.set(strResource, new ResourceReasonPair(resourceLabel, reason));
}
}
setValid(resourceLabel, strResource, isValid2) {
if (isValid2) {
if (this.invalidatedResources) {
this.invalidatedResources.delete(strResource);
if (this.invalidatedResources.size === 0) {
this.invalidatedResources = null;
}
}
} else {
if (!this.invalidatedResources) {
this.invalidatedResources = new RemovedResources();
}
if (!this.invalidatedResources.has(strResource)) {
this.invalidatedResources.set(strResource, new ResourceReasonPair(
resourceLabel,
0
/* RemovedResourceReason.ExternalRemoval */
));
}
}
}
toString() {
return `[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources ? "INVALID" : " VALID"}] ${this.actual.constructor.name} - ${this.actual}`;
}
};
ResourceEditStack = class {
constructor(resourceLabel, strResource) {
this.resourceLabel = resourceLabel;
this.strResource = strResource;
this._past = [];
this._future = [];
this.locked = false;
this.versionId = 1;
}
dispose() {
for (const element of this._past) {
if (element.type === 1) {
element.removeResource(
this.resourceLabel,
this.strResource,
0
/* RemovedResourceReason.ExternalRemoval */
);
}
}
for (const element of this._future) {
if (element.type === 1) {
element.removeResource(
this.resourceLabel,
this.strResource,
0
/* RemovedResourceReason.ExternalRemoval */
);
}
}
this.versionId++;
}
toString() {
const result = [];
result.push(`* ${this.strResource}:`);
for (let i = 0; i < this._past.length; i++) {
result.push(` * [UNDO] ${this._past[i]}`);
}
for (let i = this._future.length - 1; i >= 0; i--) {
result.push(` * [REDO] ${this._future[i]}`);
}
return result.join("\n");
}
flushAllElements() {
this._past = [];
this._future = [];
this.versionId++;
}
_setElementValidFlag(element, isValid2) {
if (element.type === 1) {
element.setValid(this.resourceLabel, this.strResource, isValid2);
} else {
element.setValid(isValid2);
}
}
setElementsValidFlag(isValid2, filter) {
for (const element of this._past) {
if (filter(element.actual)) {
this._setElementValidFlag(element, isValid2);
}
}
for (const element of this._future) {
if (filter(element.actual)) {
this._setElementValidFlag(element, isValid2);
}
}
}
pushElement(element) {
for (const futureElement of this._future) {
if (futureElement.type === 1) {
futureElement.removeResource(
this.resourceLabel,
this.strResource,
1
/* RemovedResourceReason.NoParallelUniverses */
);
}
}
this._future = [];
this._past.push(element);
this.versionId++;
}
createSnapshot(resource) {
const elements = [];
for (let i = 0, len = this._past.length; i < len; i++) {
elements.push(this._past[i].id);
}
for (let i = this._future.length - 1; i >= 0; i--) {
elements.push(this._future[i].id);
}
return new ResourceEditStackSnapshot(resource, elements);
}
restoreSnapshot(snapshot) {
const snapshotLength = snapshot.elements.length;
let isOK = true;
let snapshotIndex = 0;
let removePastAfter = -1;
for (let i = 0, len = this._past.length; i < len; i++, snapshotIndex++) {
const element = this._past[i];
if (isOK && (snapshotIndex >= snapshotLength || element.id !== snapshot.elements[snapshotIndex])) {
isOK = false;
removePastAfter = 0;
}
if (!isOK && element.type === 1) {
element.removeResource(
this.resourceLabel,
this.strResource,
0
/* RemovedResourceReason.ExternalRemoval */
);
}
}
let removeFutureBefore = -1;
for (let i = this._future.length - 1; i >= 0; i--, snapshotIndex++) {
const element = this._future[i];
if (isOK && (snapshotIndex >= snapshotLength || element.id !== snapshot.elements[snapshotIndex])) {
isOK = false;
removeFutureBefore = i;
}
if (!isOK && element.type === 1) {
element.removeResource(
this.resourceLabel,
this.strResource,
0
/* RemovedResourceReason.ExternalRemoval */
);
}
}
if (removePastAfter !== -1) {
this._past = this._past.slice(0, removePastAfter);
}
if (removeFutureBefore !== -1) {
this._future = this._future.slice(removeFutureBefore + 1);
}
this.versionId++;
}
getElements() {
const past = [];
const future = [];
for (const element of this._past) {
past.push(element.actual);
}
for (const element of this._future) {
future.push(element.actual);
}
return { past, future };
}
getClosestPastElement() {
if (this._past.length === 0) {
return null;
}
return this._past[this._past.length - 1];
}
getSecondClosestPastElement() {
if (this._past.length < 2) {
return null;
}
return this._past[this._past.length - 2];
}
getClosestFutureElement() {
if (this._future.length === 0) {
return null;
}
return this._future[this._future.length - 1];
}
hasPastElements() {
return this._past.length > 0;
}
hasFutureElements() {
return this._future.length > 0;
}
splitPastWorkspaceElement(toRemove, individualMap) {
for (let j = this._past.length - 1; j >= 0; j--) {
if (this._past[j] === toRemove) {
if (individualMap.has(this.strResource)) {
this._past[j] = individualMap.get(this.strResource);
} else {
this._past.splice(j, 1);
}
break;
}
}
this.versionId++;
}
splitFutureWorkspaceElement(toRemove, individualMap) {
for (let j = this._future.length - 1; j >= 0; j--) {
if (this._future[j] === toRemove) {
if (individualMap.has(this.strResource)) {
this._future[j] = individualMap.get(this.strResource);
} else {
this._future.splice(j, 1);
}
break;
}
}
this.versionId++;
}
moveBackward(element) {
this._past.pop();
this._future.push(element);
this.versionId++;
}
moveForward(element) {
this._future.pop();
this._past.push(element);
this.versionId++;
}
};
EditStackSnapshot = class {
constructor(editStacks) {
this.editStacks = editStacks;
this._versionIds = [];
for (let i = 0, len = this.editStacks.length; i < len; i++) {
this._versionIds[i] = this.editStacks[i].versionId;
}
}
isValid() {
for (let i = 0, len = this.editStacks.length; i < len; i++) {
if (this._versionIds[i] !== this.editStacks[i].versionId) {
return false;
}
}
return true;
}
};
missingEditStack = new ResourceEditStack("", "");
missingEditStack.locked = true;
UndoRedoService = class UndoRedoService2 {
constructor(_dialogService, _notificationService) {
this._dialogService = _dialogService;
this._notificationService = _notificationService;
this._editStacks = /* @__PURE__ */ new Map();
this._uriComparisonKeyComputers = [];
}
getUriComparisonKey(resource) {
for (const uriComparisonKeyComputer of this._uriComparisonKeyComputers) {
if (uriComparisonKeyComputer[0] === resource.scheme) {
return uriComparisonKeyComputer[1].getComparisonKey(resource);
}
}
return resource.toString();
}
_print(label) {
console.log(`------------------------------------`);
console.log(`AFTER ${label}: `);
const str = [];
for (const element of this._editStacks) {
str.push(element[1].toString());
}
console.log(str.join("\n"));
}
pushElement(element, group = UndoRedoGroup.None, source = UndoRedoSource.None) {
if (element.type === 0) {
const resourceLabel = getResourceLabel(element.resource);
const strResource = this.getUriComparisonKey(element.resource);
this._pushElement(new ResourceStackElement(element, resourceLabel, strResource, group.id, group.nextOrder(), source.id, source.nextOrder()));
} else {
const seen = /* @__PURE__ */ new Set();
const resourceLabels = [];
const strResources = [];
for (const resource of element.resources) {
const resourceLabel = getResourceLabel(resource);
const strResource = this.getUriComparisonKey(resource);
if (seen.has(strResource)) {
continue;
}
seen.add(strResource);
resourceLabels.push(resourceLabel);
strResources.push(strResource);
}
if (resourceLabels.length === 1) {
this._pushElement(new ResourceStackElement(element, resourceLabels[0], strResources[0], group.id, group.nextOrder(), source.id, source.nextOrder()));
} else {
this._pushElement(new WorkspaceStackElement(element, resourceLabels, strResources, group.id, group.nextOrder(), source.id, source.nextOrder()));
}
}
if (DEBUG) {
this._print("pushElement");
}
}
_pushElement(element) {
for (let i = 0, len = element.strResources.length; i < len; i++) {
const resourceLabel = element.resourceLabels[i];
const strResource = element.strResources[i];
let editStack;
if (this._editStacks.has(strResource)) {
editStack = this._editStacks.get(strResource);
} else {
editStack = new ResourceEditStack(resourceLabel, strResource);
this._editStacks.set(strResource, editStack);
}
editStack.pushElement(element);
}
}
getLastElement(resource) {
const strResource = this.getUriComparisonKey(resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
if (editStack.hasFutureElements()) {
return null;
}
const closestPastElement = editStack.getClosestPastElement();
return closestPastElement ? closestPastElement.actual : null;
}
return null;
}
_splitPastWorkspaceElement(toRemove, ignoreResources) {
const individualArr = toRemove.actual.split();
const individualMap = /* @__PURE__ */ new Map();
for (const _element of individualArr) {
const resourceLabel = getResourceLabel(_element.resource);
const strResource = this.getUriComparisonKey(_element.resource);
const element = new ResourceStackElement(_element, resourceLabel, strResource, 0, 0, 0, 0);
individualMap.set(element.strResource, element);
}
for (const strResource of toRemove.strResources) {
if (ignoreResources && ignoreResources.has(strResource)) {
continue;
}
const editStack = this._editStacks.get(strResource);
editStack.splitPastWorkspaceElement(toRemove, individualMap);
}
}
_splitFutureWorkspaceElement(toRemove, ignoreResources) {
const individualArr = toRemove.actual.split();
const individualMap = /* @__PURE__ */ new Map();
for (const _element of individualArr) {
const resourceLabel = getResourceLabel(_element.resource);
const strResource = this.getUriComparisonKey(_element.resource);
const element = new ResourceStackElement(_element, resourceLabel, strResource, 0, 0, 0, 0);
individualMap.set(element.strResource, element);
}
for (const strResource of toRemove.strResources) {
if (ignoreResources && ignoreResources.has(strResource)) {
continue;
}
const editStack = this._editStacks.get(strResource);
editStack.splitFutureWorkspaceElement(toRemove, individualMap);
}
}
removeElements(resource) {
const strResource = typeof resource === "string" ? resource : this.getUriComparisonKey(resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
editStack.dispose();
this._editStacks.delete(strResource);
}
if (DEBUG) {
this._print("removeElements");
}
}
setElementsValidFlag(resource, isValid2, filter) {
const strResource = this.getUriComparisonKey(resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
editStack.setElementsValidFlag(isValid2, filter);
}
if (DEBUG) {
this._print("setElementsValidFlag");
}
}
createSnapshot(resource) {
const strResource = this.getUriComparisonKey(resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
return editStack.createSnapshot(resource);
}
return new ResourceEditStackSnapshot(resource, []);
}
restoreSnapshot(snapshot) {
const strResource = this.getUriComparisonKey(snapshot.resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
editStack.restoreSnapshot(snapshot);
if (!editStack.hasPastElements() && !editStack.hasFutureElements()) {
editStack.dispose();
this._editStacks.delete(strResource);
}
}
if (DEBUG) {
this._print("restoreSnapshot");
}
}
getElements(resource) {
const strResource = this.getUriComparisonKey(resource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
return editStack.getElements();
}
return { past: [], future: [] };
}
_findClosestUndoElementWithSource(sourceId) {
if (!sourceId) {
return [null, null];
}
let matchedElement = null;
let matchedStrResource = null;
for (const [strResource, editStack] of this._editStacks) {
const candidate = editStack.getClosestPastElement();
if (!candidate) {
continue;
}
if (candidate.sourceId === sourceId) {
if (!matchedElement || candidate.sourceOrder > matchedElement.sourceOrder) {
matchedElement = candidate;
matchedStrResource = strResource;
}
}
}
return [matchedElement, matchedStrResource];
}
canUndo(resourceOrSource) {
if (resourceOrSource instanceof UndoRedoSource) {
const [, matchedStrResource] = this._findClosestUndoElementWithSource(resourceOrSource.id);
return matchedStrResource ? true : false;
}
const strResource = this.getUriComparisonKey(resourceOrSource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
return editStack.hasPastElements();
}
return false;
}
_onError(err, element) {
onUnexpectedError(err);
for (const strResource of element.strResources) {
this.removeElements(strResource);
}
this._notificationService.error(err);
}
_acquireLocks(editStackSnapshot) {
for (const editStack of editStackSnapshot.editStacks) {
if (editStack.locked) {
throw new Error("Cannot acquire edit stack lock");
}
}
for (const editStack of editStackSnapshot.editStacks) {
editStack.locked = true;
}
return () => {
for (const editStack of editStackSnapshot.editStacks) {
editStack.locked = false;
}
};
}
_safeInvokeWithLocks(element, invoke, editStackSnapshot, cleanup, continuation) {
const releaseLocks = this._acquireLocks(editStackSnapshot);
let result;
try {
result = invoke();
} catch (err) {
releaseLocks();
cleanup.dispose();
return this._onError(err, element);
}
if (result) {
return result.then(() => {
releaseLocks();
cleanup.dispose();
return continuation();
}, (err) => {
releaseLocks();
cleanup.dispose();
return this._onError(err, element);
});
} else {
releaseLocks();
cleanup.dispose();
return continuation();
}
}
_invokeWorkspacePrepare(element) {
return __async(this, null, function* () {
if (typeof element.actual.prepareUndoRedo === "undefined") {
return Disposable.None;
}
const result = element.actual.prepareUndoRedo();
if (typeof result === "undefined") {
return Disposable.None;
}
return result;
});
}
_invokeResourcePrepare(element, callback) {
if (element.actual.type !== 1 || typeof element.actual.prepareUndoRedo === "undefined") {
return callback(Disposable.None);
}
const r = element.actual.prepareUndoRedo();
if (!r) {
return callback(Disposable.None);
}
if (isDisposable(r)) {
return callback(r);
}
return r.then((disposable) => {
return callback(disposable);
});
}
_getAffectedEditStacks(element) {
const affectedEditStacks = [];
for (const strResource of element.strResources) {
affectedEditStacks.push(this._editStacks.get(strResource) || missingEditStack);
}
return new EditStackSnapshot(affectedEditStacks);
}
_tryToSplitAndUndo(strResource, element, ignoreResources, message) {
if (element.canSplit()) {
this._splitPastWorkspaceElement(element, ignoreResources);
this._notificationService.warn(message);
return new WorkspaceVerificationError(this._undo(strResource, 0, true));
} else {
for (const strResource2 of element.strResources) {
this.removeElements(strResource2);
}
this._notificationService.warn(message);
return new WorkspaceVerificationError();
}
}
_checkWorkspaceUndo(strResource, element, editStackSnapshot, checkInvalidatedResources) {
if (element.removedResources) {
return this._tryToSplitAndUndo(strResource, element, element.removedResources, localize({ key: "cannotWorkspaceUndo", comment: ["{0} is a label for an operation. {1} is another message."] }, "Could not undo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()));
}
if (checkInvalidatedResources && element.invalidatedResources) {
return this._tryToSplitAndUndo(strResource, element, element.invalidatedResources, localize({ key: "cannotWorkspaceUndo", comment: ["{0} is a label for an operation. {1} is another message."] }, "Could not undo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()));
}
const cannotUndoDueToResources = [];
for (const editStack of editStackSnapshot.editStacks) {
if (editStack.getClosestPastElement() !== element) {
cannotUndoDueToResources.push(editStack.resourceLabel);
}
}
if (cannotUndoDueToResources.length > 0) {
return this._tryToSplitAndUndo(strResource, element, null, localize({ 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}", element.label, cannotUndoDueToResources.join(", ")));
}
const cannotLockDueToResources = [];
for (const editStack of editStackSnapshot.editStacks) {
if (editStack.locked) {
cannotLockDueToResources.push(editStack.resourceLabel);
}
}
if (cannotLockDueToResources.length > 0) {
return this._tryToSplitAndUndo(strResource, element, null, localize({ 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}", element.label, cannotLockDueToResources.join(", ")));
}
if (!editStackSnapshot.isValid()) {
return this._tryToSplitAndUndo(strResource, element, null, localize({ 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", element.label));
}
return null;
}
_workspaceUndo(strResource, element, undoConfirmed) {
const affectedEditStacks = this._getAffectedEditStacks(element);
const verificationError = this._checkWorkspaceUndo(
strResource,
element,
affectedEditStacks,
/*invalidated resources will be checked after the prepare call*/
false
);
if (verificationError) {
return verificationError.returnValue;
}
return this._confirmAndExecuteWorkspaceUndo(strResource, element, affectedEditStacks, undoConfirmed);
}
_isPartOfUndoGroup(element) {
if (!element.groupId) {
return false;
}
for (const [, editStack] of this._editStacks) {
const pastElement = editStack.getClosestPastElement();
if (!pastElement) {
continue;
}
if (pastElement === element) {
const secondPastElement = editStack.getSecondClosestPastElement();
if (secondPastElement && secondPastElement.groupId === element.groupId) {
return true;
}
}
if (pastElement.groupId === element.groupId) {
return true;
}
}
return false;
}
_confirmAndExecuteWorkspaceUndo(strResource, element, editStackSnapshot, undoConfirmed) {
return __async(this, null, function* () {
if (element.canSplit() && !this._isPartOfUndoGroup(element)) {
let UndoChoice;
(function(UndoChoice2) {
UndoChoice2[UndoChoice2["All"] = 0] = "All";
UndoChoice2[UndoChoice2["This"] = 1] = "This";
UndoChoice2[UndoChoice2["Cancel"] = 2] = "Cancel";
})(UndoChoice || (UndoChoice = {}));
const { result } = yield this._dialogService.prompt({
type: severity_default.Info,
message: localize("confirmWorkspace", "Would you like to undo '{0}' across all files?", element.label),
buttons: [
{
label: localize({ key: "ok", comment: ["{0} denotes a number that is > 1, && denotes a mnemonic"] }, "&&Undo in {0} Files", editStackSnapshot.editStacks.length),
run: () => UndoChoice.All
},
{
label: localize({ key: "nok", comment: ["&& denotes a mnemonic"] }, "Undo this &&File"),
run: () => UndoChoice.This
}
],
cancelButton: {
run: () => UndoChoice.Cancel
}
});
if (result === UndoChoice.Cancel) {
return;
}
if (result === UndoChoice.This) {
this._splitPastWorkspaceElement(element, null);
return this._undo(strResource, 0, true);
}
const verificationError1 = this._checkWorkspaceUndo(
strResource,
element,
editStackSnapshot,
/*invalidated resources will be checked after the prepare call*/
false
);
if (verificationError1) {
return verificationError1.returnValue;
}
undoConfirmed = true;
}
let cleanup;
try {
cleanup = yield this._invokeWorkspacePrepare(element);
} catch (err) {
return this._onError(err, element);
}
const verificationError2 = this._checkWorkspaceUndo(
strResource,
element,
editStackSnapshot,
/*now also check that there are no more invalidated resources*/
true
);
if (verificationError2) {
cleanup.dispose();
return verificationError2.returnValue;
}
for (const editStack of editStackSnapshot.editStacks) {
editStack.moveBackward(element);
}
return this._safeInvokeWithLocks(element, () => element.actual.undo(), editStackSnapshot, cleanup, () => this._continueUndoInGroup(element.groupId, undoConfirmed));
});
}
_resourceUndo(editStack, element, undoConfirmed) {
if (!element.isValid) {
editStack.flushAllElements();
return;
}
if (editStack.locked) {
const message = localize({ key: "cannotResourceUndoDueToInProgressUndoRedo", comment: ["{0} is a label for an operation."] }, "Could not undo '{0}' because there is already an undo or redo operation running.", element.label);
this._notificationService.warn(message);
return;
}
return this._invokeResourcePrepare(element, (cleanup) => {
editStack.moveBackward(element);
return this._safeInvokeWithLocks(element, () => element.actual.undo(), new EditStackSnapshot([editStack]), cleanup, () => this._continueUndoInGroup(element.groupId, undoConfirmed));
});
}
_findClosestUndoElementInGroup(groupId) {
if (!groupId) {
return [null, null];
}
let matchedElement = null;
let matchedStrResource = null;
for (const [strResource, editStack] of this._editStacks) {
const candidate = editStack.getClosestPastElement();
if (!candidate) {
continue;
}
if (candidate.groupId === groupId) {
if (!matchedElement || candidate.groupOrder > matchedElement.groupOrder) {
matchedElement = candidate;
matchedStrResource = strResource;
}
}
}
return [matchedElement, matchedStrResource];
}
_continueUndoInGroup(groupId, undoConfirmed) {
if (!groupId) {
return;
}
const [, matchedStrResource] = this._findClosestUndoElementInGroup(groupId);
if (matchedStrResource) {
return this._undo(matchedStrResource, 0, undoConfirmed);
}
}
undo(resourceOrSource) {
if (resourceOrSource instanceof UndoRedoSource) {
const [, matchedStrResource] = this._findClosestUndoElementWithSource(resourceOrSource.id);
return matchedStrResource ? this._undo(matchedStrResource, resourceOrSource.id, false) : void 0;
}
if (typeof resourceOrSource === "string") {
return this._undo(resourceOrSource, 0, false);
}
return this._undo(this.getUriComparisonKey(resourceOrSource), 0, false);
}
_undo(strResource, sourceId = 0, undoConfirmed) {
if (!this._editStacks.has(strResource)) {
return;
}
const editStack = this._editStacks.get(strResource);
const element = editStack.getClosestPastElement();
if (!element) {
return;
}
if (element.groupId) {
const [matchedElement, matchedStrResource] = this._findClosestUndoElementInGroup(element.groupId);
if (element !== matchedElement && matchedStrResource) {
return this._undo(matchedStrResource, sourceId, undoConfirmed);
}
}
const shouldPromptForConfirmation = element.sourceId !== sourceId || element.confirmBeforeUndo;
if (shouldPromptForConfirmation && !undoConfirmed) {
return this._confirmAndContinueUndo(strResource, sourceId, element);
}
try {
if (element.type === 1) {
return this._workspaceUndo(strResource, element, undoConfirmed);
} else {
return this._resourceUndo(editStack, element, undoConfirmed);
}
} finally {
if (DEBUG) {
this._print("undo");
}
}
}
_confirmAndContinueUndo(strResource, sourceId, element) {
return __async(this, null, function* () {
const result = yield this._dialogService.confirm({
message: localize("confirmDifferentSource", "Would you like to undo '{0}'?", element.label),
primaryButton: localize({ key: "confirmDifferentSource.yes", comment: ["&& denotes a mnemonic"] }, "&&Yes"),
cancelButton: localize("confirmDifferentSource.no", "No")
});
if (!result.confirmed) {
return;
}
return this._undo(strResource, sourceId, true);
});
}
_findClosestRedoElementWithSource(sourceId) {
if (!sourceId) {
return [null, null];
}
let matchedElement = null;
let matchedStrResource = null;
for (const [strResource, editStack] of this._editStacks) {
const candidate = editStack.getClosestFutureElement();
if (!candidate) {
continue;
}
if (candidate.sourceId === sourceId) {
if (!matchedElement || candidate.sourceOrder < matchedElement.sourceOrder) {
matchedElement = candidate;
matchedStrResource = strResource;
}
}
}
return [matchedElement, matchedStrResource];
}
canRedo(resourceOrSource) {
if (resourceOrSource instanceof UndoRedoSource) {
const [, matchedStrResource] = this._findClosestRedoElementWithSource(resourceOrSource.id);
return matchedStrResource ? true : false;
}
const strResource = this.getUriComparisonKey(resourceOrSource);
if (this._editStacks.has(strResource)) {
const editStack = this._editStacks.get(strResource);
return editStack.hasFutureElements();
}
return false;
}
_tryToSplitAndRedo(strResource, element, ignoreResources, message) {
if (element.canSplit()) {
this._splitFutureWorkspaceElement(element, ignoreResources);
this._notificationService.warn(message);
return new WorkspaceVerificationError(this._redo(strResource));
} else {
for (const strResource2 of element.strResources) {
this.removeElements(strResource2);
}
this._notificationService.warn(message);
return new WorkspaceVerificationError();
}
}
_checkWorkspaceRedo(strResource, element, editStackSnapshot, checkInvalidatedResources) {
if (element.removedResources) {
return this._tryToSplitAndRedo(strResource, element, element.removedResources, localize({ key: "cannotWorkspaceRedo", comment: ["{0} is a label for an operation. {1} is another message."] }, "Could not redo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()));
}
if (checkInvalidatedResources && element.invalidatedResources) {
return this._tryToSplitAndRedo(strResource, element, element.invalidatedResources, localize({ key: "cannotWorkspaceRedo", comment: ["{0} is a label for an operation. {1} is another message."] }, "Could not redo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()));
}
const cannotRedoDueToResources = [];
for (const editStack of editStackSnapshot.editStacks) {
if (editStack.getClosestFutureElement() !== element) {
cannotRedoDueToResources.push(editStack.resourceLabel);
}
}
if (cannotRedoDueToResources.length > 0) {
return this._tryToSplitAndRedo(strResource, element, null, localize({ 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}", element.label, cannotRedoDueToResources.join(", ")));
}
const cannotLockDueToResources = [];
for (const editStack of editStackSnapshot.editStacks) {
if (editStack.locked) {
cannotLockDueToResources.push(editStack.resourceLabel);
}
}
if (cannotLockDueToResources.length > 0) {
return this._tryToSplitAndRedo(strResource, element, null, localize({ 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}", element.label, cannotLockDueToResources.join(", ")));
}
if (!editStackSnapshot.isValid()) {
return this._tryToSplitAndRedo(strResource, element, null, localize({ 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", element.label));
}
return null;
}
_workspaceRedo(strResource, element) {
const affectedEditStacks = this._getAffectedEditStacks(element);
const verificationError = this._checkWorkspaceRedo(
strResource,
element,
affectedEditStacks,
/*invalidated resources will be checked after the prepare call*/
false
);
if (verificationError) {
return verificationError.returnValue;
}
return this._executeWorkspaceRedo(strResource, element, affectedEditStacks);
}
_executeWorkspaceRedo(strResource, element, editStackSnapshot) {
return __async(this, null, function* () {
let cleanup;
try {
cleanup = yield this._invokeWorkspacePrepare(element);
} catch (err) {
return this._onError(err, element);
}
const verificationError = this._checkWorkspaceRedo(
strResource,
element,
editStackSnapshot,
/*now also check that there are no more invalidated resources*/
true
);
if (verificationError) {
cleanup.dispose();
return verificationError.returnValue;
}
for (const editStack of editStackSnapshot.editStacks) {
editStack.moveForward(element);
}
return this._safeInvokeWithLocks(element, () => element.actual.redo(), editStackSnapshot, cleanup, () => this._continueRedoInGroup(element.groupId));
});
}
_resourceRedo(editStack, element) {
if (!element.isValid) {
editStack.flushAllElements();
return;
}
if (editStack.locked) {
const message = localize({ key: "cannotResourceRedoDueToInProgressUndoRedo", comment: ["{0} is a label for an operation."] }, "Could not redo '{0}' because there is already an undo or redo operation running.", element.label);
this._notificationService.warn(message);
return;
}
return this._invokeResourcePrepare(element, (cleanup) => {
editStack.moveForward(element);
return this._safeInvokeWithLocks(element, () => element.actual.redo(), new EditStackSnapshot([editStack]), cleanup, () => this._continueRedoInGroup(element.groupId));
});
}
_findClosestRedoElementInGroup(groupId) {
if (!groupId) {
return [null, null];
}
let matchedElement = null;
let matchedStrResource = null;
for (const [strResource, editStack] of this._editStacks) {
const candidate = editStack.getClosestFutureElement();
if (!candidate) {
continue;
}
if (candidate.groupId === groupId) {
if (!matchedElement || candidate.groupOrder < matchedElement.groupOrder) {
matchedElement = candidate;
matchedStrResource = strResource;
}
}
}
return [matchedElement, matchedStrResource];
}
_continueRedoInGroup(groupId) {
if (!groupId) {
return;
}
const [, matchedStrResource] = this._findClosestRedoElementInGroup(groupId);
if (matchedStrResource) {
return this._redo(matchedStrResource);
}
}
redo(resourceOrSource) {
if (resourceOrSource instanceof UndoRedoSource) {
const [, matchedStrResource] = this._findClosestRedoElementWithSource(resourceOrSource.id);
return matchedStrResource ? this._redo(matchedStrResource) : void 0;
}
if (typeof resourceOrSource === "string") {
return this._redo(resourceOrSource);
}
return this._redo(this.getUriComparisonKey(resourceOrSource));
}
_redo(strResource) {
if (!this._editStacks.has(strResource)) {
return;
}
const editStack = this._editStacks.get(strResource);
const element = editStack.getClosestFutureElement();
if (!element) {
return;
}
if (element.groupId) {
const [matchedElement, matchedStrResource] = this._findClosestRedoElementInGroup(element.groupId);
if (element !== matchedElement && matchedStrResource) {
return this._redo(matchedStrResource);
}
}
try {
if (element.type === 1) {
return this._workspaceRedo(strResource, element);
} else {
return this._resourceRedo(editStack, element);
}
} finally {
if (DEBUG) {
this._print("redo");
}
}
}
};
UndoRedoService = __decorate17([
__param16(0, IDialogService),
__param16(1, INotificationService)
], UndoRedoService);
WorkspaceVerificationError = class {
constructor(returnValue) {
this.returnValue = returnValue;
}
};
registerSingleton(
IUndoRedoService,
UndoRedoService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/base/common/numbers.js
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
var MovingAverage, SlidingWindowAverage;
var init_numbers = __esm({
"node_modules/monaco-editor/esm/vs/base/common/numbers.js"() {
MovingAverage = class {
constructor() {
this._n = 1;
this._val = 0;
}
update(value) {
this._val = this._val + (value - this._val) / this._n;
this._n += 1;
return this._val;
}
get value() {
return this._val;
}
};
SlidingWindowAverage = class {
constructor(size2) {
this._n = 0;
this._val = 0;
this._values = [];
this._index = 0;
this._sum = 0;
this._values = new Array(size2);
this._values.fill(0, 0, size2);
}
update(value) {
const oldValue = this._values[this._index];
this._values[this._index] = value;
this._index = (this._index + 1) % this._values.length;
this._sum -= oldValue;
this._sum += value;
if (this._n < this._values.length) {
this._n += 1;
}
this._val = this._sum / this._n;
return this._val;
}
get value() {
return this._val;
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/environment/common/environment.js
var IEnvironmentService;
var init_environment = __esm({
"node_modules/monaco-editor/esm/vs/platform/environment/common/environment.js"() {
init_instantiation();
IEnvironmentService = createDecorator("environmentService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatureDebounce.js
var __decorate18, __param17, ILanguageFeatureDebounceService, IdentityHash, NullDebounceInformation, FeatureDebounceInformation, LanguageFeatureDebounceService;
var init_languageFeatureDebounce = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languageFeatureDebounce.js"() {
init_hash();
init_map();
init_numbers();
init_environment();
init_extensions();
init_instantiation();
init_log();
init_network();
__decorate18 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param17 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
ILanguageFeatureDebounceService = createDecorator("ILanguageFeatureDebounceService");
(function(IdentityHash2) {
const _hashes = /* @__PURE__ */ new WeakMap();
let pool = 0;
function of(obj) {
let value = _hashes.get(obj);
if (value === void 0) {
value = ++pool;
_hashes.set(obj, value);
}
return value;
}
IdentityHash2.of = of;
})(IdentityHash || (IdentityHash = {}));
NullDebounceInformation = class {
constructor(_default) {
this._default = _default;
}
get(_model) {
return this._default;
}
update(_model, _value) {
return this._default;
}
default() {
return this._default;
}
};
FeatureDebounceInformation = class {
constructor(_logService, _name, _registry2, _default, _min, _max) {
this._logService = _logService;
this._name = _name;
this._registry = _registry2;
this._default = _default;
this._min = _min;
this._max = _max;
this._cache = new LRUCache(50, 0.7);
}
_key(model) {
return model.id + this._registry.all(model).reduce((hashVal, obj) => doHash(IdentityHash.of(obj), hashVal), 0);
}
get(model) {
const key = this._key(model);
const avg = this._cache.get(key);
return avg ? clamp(avg.value, this._min, this._max) : this.default();
}
update(model, value) {
const key = this._key(model);
let avg = this._cache.get(key);
if (!avg) {
avg = new SlidingWindowAverage(6);
this._cache.set(key, avg);
}
const newValue = clamp(avg.update(value), this._min, this._max);
if (!matchesScheme(model.uri, "output")) {
this._logService.trace(`[DEBOUNCE: ${this._name}] for ${model.uri.toString()} is ${newValue}ms`);
}
return newValue;
}
_overall() {
const result = new MovingAverage();
for (const [, avg] of this._cache) {
result.update(avg.value);
}
return result.value;
}
default() {
const value = this._overall() | 0 || this._default;
return clamp(value, this._min, this._max);
}
};
LanguageFeatureDebounceService = class LanguageFeatureDebounceService2 {
constructor(_logService, envService) {
this._logService = _logService;
this._data = /* @__PURE__ */ new Map();
this._isDev = envService.isExtensionDevelopment || !envService.isBuilt;
}
for(feature, name, config) {
var _a10, _b4, _c2;
const min = (_a10 = config === null || config === void 0 ? void 0 : config.min) !== null && _a10 !== void 0 ? _a10 : 50;
const max = (_b4 = config === null || config === void 0 ? void 0 : config.max) !== null && _b4 !== void 0 ? _b4 : __pow(min, 2);
const extra = (_c2 = config === null || config === void 0 ? void 0 : config.key) !== null && _c2 !== void 0 ? _c2 : void 0;
const key = `${IdentityHash.of(feature)},${min}${extra ? "," + extra : ""}`;
let info = this._data.get(key);
if (!info) {
if (this._isDev) {
this._logService.debug(`[DEBOUNCE: ${name}] is disabled in developed mode`);
info = new NullDebounceInformation(min * 1.5);
} else {
info = new FeatureDebounceInformation(
this._logService,
name,
feature,
this._overallAverage() | 0 || min * 1.5,
// default is overall default or derived from min-value
min,
max
);
}
this._data.set(key, info);
}
return info;
}
_overallAverage() {
const result = new MovingAverage();
for (const info of this._data.values()) {
result.update(info.default());
}
return result.value;
}
};
LanguageFeatureDebounceService = __decorate18([
__param17(0, ILogService),
__param17(1, IEnvironmentService)
], LanguageFeatureDebounceService);
registerSingleton(
ILanguageFeatureDebounceService,
LanguageFeatureDebounceService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseMultilineTokens.js
var SparseMultilineTokens, SparseMultilineTokensStorage, SparseLineTokens;
var init_sparseMultilineTokens = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/tokens/sparseMultilineTokens.js"() {
init_position();
init_range();
init_eolCounter();
SparseMultilineTokens = class _SparseMultilineTokens {
static create(startLineNumber, tokens) {
return new _SparseMultilineTokens(startLineNumber, new SparseMultilineTokensStorage(tokens));
}
/**
* (Inclusive) start line number for these tokens.
*/
get startLineNumber() {
return this._startLineNumber;
}
/**
* (Inclusive) end line number for these tokens.
*/
get endLineNumber() {
return this._endLineNumber;
}
constructor(startLineNumber, tokens) {
this._startLineNumber = startLineNumber;
this._tokens = tokens;
this._endLineNumber = this._startLineNumber + this._tokens.getMaxDeltaLine();
}
toString() {
return this._tokens.toString(this._startLineNumber);
}
_updateEndLineNumber() {
this._endLineNumber = this._startLineNumber + this._tokens.getMaxDeltaLine();
}
isEmpty() {
return this._tokens.isEmpty();
}
getLineTokens(lineNumber) {
if (this._startLineNumber <= lineNumber && lineNumber <= this._endLineNumber) {
return this._tokens.getLineTokens(lineNumber - this._startLineNumber);
}
return null;
}
getRange() {
const deltaRange = this._tokens.getRange();
if (!deltaRange) {
return deltaRange;
}
return new Range(this._startLineNumber + deltaRange.startLineNumber, deltaRange.startColumn, this._startLineNumber + deltaRange.endLineNumber, deltaRange.endColumn);
}
removeTokens(range2) {
const startLineIndex = range2.startLineNumber - this._startLineNumber;
const endLineIndex = range2.endLineNumber - this._startLineNumber;
this._startLineNumber += this._tokens.removeTokens(startLineIndex, range2.startColumn - 1, endLineIndex, range2.endColumn - 1);
this._updateEndLineNumber();
}
split(range2) {
const startLineIndex = range2.startLineNumber - this._startLineNumber;
const endLineIndex = range2.endLineNumber - this._startLineNumber;
const [a3, b, bDeltaLine] = this._tokens.split(startLineIndex, range2.startColumn - 1, endLineIndex, range2.endColumn - 1);
return [new _SparseMultilineTokens(this._startLineNumber, a3), new _SparseMultilineTokens(this._startLineNumber + bDeltaLine, b)];
}
applyEdit(range2, text2) {
const [eolCount, firstLineLength, lastLineLength] = countEOL(text2);
this.acceptEdit(
range2,
eolCount,
firstLineLength,
lastLineLength,
text2.length > 0 ? text2.charCodeAt(0) : 0
/* CharCode.Null */
);
}
acceptEdit(range2, eolCount, firstLineLength, lastLineLength, firstCharCode) {
this._acceptDeleteRange(range2);
this._acceptInsertText(new Position(range2.startLineNumber, range2.startColumn), eolCount, firstLineLength, lastLineLength, firstCharCode);
this._updateEndLineNumber();
}
_acceptDeleteRange(range2) {
if (range2.startLineNumber === range2.endLineNumber && range2.startColumn === range2.endColumn) {
return;
}
const firstLineIndex = range2.startLineNumber - this._startLineNumber;
const lastLineIndex = range2.endLineNumber - this._startLineNumber;
if (lastLineIndex < 0) {
const deletedLinesCount = lastLineIndex - firstLineIndex;
this._startLineNumber -= deletedLinesCount;
return;
}
const tokenMaxDeltaLine = this._tokens.getMaxDeltaLine();
if (firstLineIndex >= tokenMaxDeltaLine + 1) {
return;
}
if (firstLineIndex < 0 && lastLineIndex >= tokenMaxDeltaLine + 1) {
this._startLineNumber = 0;
this._tokens.clear();
return;
}
if (firstLineIndex < 0) {
const deletedBefore = -firstLineIndex;
this._startLineNumber -= deletedBefore;
this._tokens.acceptDeleteRange(range2.startColumn - 1, 0, 0, lastLineIndex, range2.endColumn - 1);
} else {
this._tokens.acceptDeleteRange(0, firstLineIndex, range2.startColumn - 1, lastLineIndex, range2.endColumn - 1);
}
}
_acceptInsertText(position, eolCount, firstLineLength, lastLineLength, firstCharCode) {
if (eolCount === 0 && firstLineLength === 0) {
return;
}
const lineIndex = position.lineNumber - this._startLineNumber;
if (lineIndex < 0) {
this._startLineNumber += eolCount;
return;
}
const tokenMaxDeltaLine = this._tokens.getMaxDeltaLine();
if (lineIndex >= tokenMaxDeltaLine + 1) {
return;
}
this._tokens.acceptInsertText(lineIndex, position.column - 1, eolCount, firstLineLength, lastLineLength, firstCharCode);
}
};
SparseMultilineTokensStorage = class _SparseMultilineTokensStorage {
constructor(tokens) {
this._tokens = tokens;
this._tokenCount = tokens.length / 4;
}
toString(startLineNumber) {
const pieces = [];
for (let i = 0; i < this._tokenCount; i++) {
pieces.push(`(${this._getDeltaLine(i) + startLineNumber},${this._getStartCharacter(i)}-${this._getEndCharacter(i)})`);
}
return `[${pieces.join(",")}]`;
}
getMaxDeltaLine() {
const tokenCount = this._getTokenCount();
if (tokenCount === 0) {
return -1;
}
return this._getDeltaLine(tokenCount - 1);
}
getRange() {
const tokenCount = this._getTokenCount();
if (tokenCount === 0) {
return null;
}
const startChar = this._getStartCharacter(0);
const maxDeltaLine = this._getDeltaLine(tokenCount - 1);
const endChar = this._getEndCharacter(tokenCount - 1);
return new Range(0, startChar + 1, maxDeltaLine, endChar + 1);
}
_getTokenCount() {
return this._tokenCount;
}
_getDeltaLine(tokenIndex) {
return this._tokens[4 * tokenIndex];
}
_getStartCharacter(tokenIndex) {
return this._tokens[4 * tokenIndex + 1];
}
_getEndCharacter(tokenIndex) {
return this._tokens[4 * tokenIndex + 2];
}
isEmpty() {
return this._getTokenCount() === 0;
}
getLineTokens(deltaLine) {
let low = 0;
let high = this._getTokenCount() - 1;
while (low < high) {
const mid = low + Math.floor((high - low) / 2);
const midDeltaLine = this._getDeltaLine(mid);
if (midDeltaLine < deltaLine) {
low = mid + 1;
} else if (midDeltaLine > deltaLine) {
high = mid - 1;
} else {
let min = mid;
while (min > low && this._getDeltaLine(min - 1) === deltaLine) {
min--;
}
let max = mid;
while (max < high && this._getDeltaLine(max + 1) === deltaLine) {
max++;
}
return new SparseLineTokens(this._tokens.subarray(4 * min, 4 * max + 4));
}
}
if (this._getDeltaLine(low) === deltaLine) {
return new SparseLineTokens(this._tokens.subarray(4 * low, 4 * low + 4));
}
return null;
}
clear() {
this._tokenCount = 0;
}
removeTokens(startDeltaLine, startChar, endDeltaLine, endChar) {
const tokens = this._tokens;
const tokenCount = this._tokenCount;
let newTokenCount = 0;
let hasDeletedTokens = false;
let firstDeltaLine = 0;
for (let i = 0; i < tokenCount; i++) {
const srcOffset = 4 * i;
const tokenDeltaLine = tokens[srcOffset];
const tokenStartCharacter = tokens[srcOffset + 1];
const tokenEndCharacter = tokens[srcOffset + 2];
const tokenMetadata = tokens[srcOffset + 3];
if ((tokenDeltaLine > startDeltaLine || tokenDeltaLine === startDeltaLine && tokenEndCharacter >= startChar) && (tokenDeltaLine < endDeltaLine || tokenDeltaLine === endDeltaLine && tokenStartCharacter <= endChar)) {
hasDeletedTokens = true;
} else {
if (newTokenCount === 0) {
firstDeltaLine = tokenDeltaLine;
}
if (hasDeletedTokens) {
const destOffset = 4 * newTokenCount;
tokens[destOffset] = tokenDeltaLine - firstDeltaLine;
tokens[destOffset + 1] = tokenStartCharacter;
tokens[destOffset + 2] = tokenEndCharacter;
tokens[destOffset + 3] = tokenMetadata;
}
newTokenCount++;
}
}
this._tokenCount = newTokenCount;
return firstDeltaLine;
}
split(startDeltaLine, startChar, endDeltaLine, endChar) {
const tokens = this._tokens;
const tokenCount = this._tokenCount;
const aTokens = [];
const bTokens = [];
let destTokens = aTokens;
let destOffset = 0;
let destFirstDeltaLine = 0;
for (let i = 0; i < tokenCount; i++) {
const srcOffset = 4 * i;
const tokenDeltaLine = tokens[srcOffset];
const tokenStartCharacter = tokens[srcOffset + 1];
const tokenEndCharacter = tokens[srcOffset + 2];
const tokenMetadata = tokens[srcOffset + 3];
if (tokenDeltaLine > startDeltaLine || tokenDeltaLine === startDeltaLine && tokenEndCharacter >= startChar) {
if (tokenDeltaLine < endDeltaLine || tokenDeltaLine === endDeltaLine && tokenStartCharacter <= endChar) {
continue;
} else {
if (destTokens !== bTokens) {
destTokens = bTokens;
destOffset = 0;
destFirstDeltaLine = tokenDeltaLine;
}
}
}
destTokens[destOffset++] = tokenDeltaLine - destFirstDeltaLine;
destTokens[destOffset++] = tokenStartCharacter;
destTokens[destOffset++] = tokenEndCharacter;
destTokens[destOffset++] = tokenMetadata;
}
return [new _SparseMultilineTokensStorage(new Uint32Array(aTokens)), new _SparseMultilineTokensStorage(new Uint32Array(bTokens)), destFirstDeltaLine];
}
acceptDeleteRange(horizontalShiftForFirstLineTokens, startDeltaLine, startCharacter, endDeltaLine, endCharacter) {
const tokens = this._tokens;
const tokenCount = this._tokenCount;
const deletedLineCount = endDeltaLine - startDeltaLine;
let newTokenCount = 0;
let hasDeletedTokens = false;
for (let i = 0; i < tokenCount; i++) {
const srcOffset = 4 * i;
let tokenDeltaLine = tokens[srcOffset];
let tokenStartCharacter = tokens[srcOffset + 1];
let tokenEndCharacter = tokens[srcOffset + 2];
const tokenMetadata = tokens[srcOffset + 3];
if (tokenDeltaLine < startDeltaLine || tokenDeltaLine === startDeltaLine && tokenEndCharacter <= startCharacter) {
newTokenCount++;
continue;
} else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter < startCharacter) {
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
tokenEndCharacter -= endCharacter - startCharacter;
} else {
tokenEndCharacter = startCharacter;
}
} else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter === startCharacter) {
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
tokenEndCharacter -= endCharacter - startCharacter;
} else {
hasDeletedTokens = true;
continue;
}
} else if (tokenDeltaLine < endDeltaLine || tokenDeltaLine === endDeltaLine && tokenStartCharacter < endCharacter) {
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
tokenDeltaLine = startDeltaLine;
tokenStartCharacter = startCharacter;
tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter);
} else {
hasDeletedTokens = true;
continue;
}
} else if (tokenDeltaLine > endDeltaLine) {
if (deletedLineCount === 0 && !hasDeletedTokens) {
newTokenCount = tokenCount;
break;
}
tokenDeltaLine -= deletedLineCount;
} else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) {
if (horizontalShiftForFirstLineTokens && tokenDeltaLine === 0) {
tokenStartCharacter += horizontalShiftForFirstLineTokens;
tokenEndCharacter += horizontalShiftForFirstLineTokens;
}
tokenDeltaLine -= deletedLineCount;
tokenStartCharacter -= endCharacter - startCharacter;
tokenEndCharacter -= endCharacter - startCharacter;
} else {
throw new Error(`Not possible!`);
}
const destOffset = 4 * newTokenCount;
tokens[destOffset] = tokenDeltaLine;
tokens[destOffset + 1] = tokenStartCharacter;
tokens[destOffset + 2] = tokenEndCharacter;
tokens[destOffset + 3] = tokenMetadata;
newTokenCount++;
}
this._tokenCount = newTokenCount;
}
acceptInsertText(deltaLine, character, eolCount, firstLineLength, lastLineLength, firstCharCode) {
const isInsertingPreciselyOneWordCharacter = eolCount === 0 && firstLineLength === 1 && (firstCharCode >= 48 && firstCharCode <= 57 || firstCharCode >= 65 && firstCharCode <= 90 || firstCharCode >= 97 && firstCharCode <= 122);
const tokens = this._tokens;
const tokenCount = this._tokenCount;
for (let i = 0; i < tokenCount; i++) {
const offset = 4 * i;
let tokenDeltaLine = tokens[offset];
let tokenStartCharacter = tokens[offset + 1];
let tokenEndCharacter = tokens[offset + 2];
if (tokenDeltaLine < deltaLine || tokenDeltaLine === deltaLine && tokenEndCharacter < character) {
continue;
} else if (tokenDeltaLine === deltaLine && tokenEndCharacter === character) {
if (isInsertingPreciselyOneWordCharacter) {
tokenEndCharacter += 1;
} else {
continue;
}
} else if (tokenDeltaLine === deltaLine && tokenStartCharacter < character && character < tokenEndCharacter) {
if (eolCount === 0) {
tokenEndCharacter += firstLineLength;
} else {
tokenEndCharacter = character;
}
} else {
if (tokenDeltaLine === deltaLine && tokenStartCharacter === character) {
if (isInsertingPreciselyOneWordCharacter) {
continue;
}
}
if (tokenDeltaLine === deltaLine) {
tokenDeltaLine += eolCount;
if (eolCount === 0) {
tokenStartCharacter += firstLineLength;
tokenEndCharacter += firstLineLength;
} else {
const tokenLength = tokenEndCharacter - tokenStartCharacter;
tokenStartCharacter = lastLineLength + (tokenStartCharacter - character);
tokenEndCharacter = tokenStartCharacter + tokenLength;
}
} else {
tokenDeltaLine += eolCount;
}
}
tokens[offset] = tokenDeltaLine;
tokens[offset + 1] = tokenStartCharacter;
tokens[offset + 2] = tokenEndCharacter;
}
}
};
SparseLineTokens = class {
constructor(tokens) {
this._tokens = tokens;
}
getCount() {
return this._tokens.length / 4;
}
getStartCharacter(tokenIndex) {
return this._tokens[4 * tokenIndex + 1];
}
getEndCharacter(tokenIndex) {
return this._tokens[4 * tokenIndex + 2];
}
getMetadata(tokenIndex) {
return this._tokens[4 * tokenIndex + 3];
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensProviderStyling.js
function toMultilineTokens2(tokens, styling, languageId) {
const srcData = tokens.data;
const tokenCount = tokens.data.length / 5 | 0;
const tokensPerArea = Math.max(
Math.ceil(
tokenCount / 1024
/* SemanticColoringConstants.DesiredMaxAreas */
),
400
/* SemanticColoringConstants.DesiredTokensPerArea */
);
const result = [];
let tokenIndex = 0;
let lastLineNumber = 1;
let lastStartCharacter = 0;
while (tokenIndex < tokenCount) {
const tokenStartIndex = tokenIndex;
let tokenEndIndex = Math.min(tokenStartIndex + tokensPerArea, tokenCount);
if (tokenEndIndex < tokenCount) {
let smallTokenEndIndex = tokenEndIndex;
while (smallTokenEndIndex - 1 > tokenStartIndex && srcData[5 * smallTokenEndIndex] === 0) {
smallTokenEndIndex--;
}
if (smallTokenEndIndex - 1 === tokenStartIndex) {
let bigTokenEndIndex = tokenEndIndex;
while (bigTokenEndIndex + 1 < tokenCount && srcData[5 * bigTokenEndIndex] === 0) {
bigTokenEndIndex++;
}
tokenEndIndex = bigTokenEndIndex;
} else {
tokenEndIndex = smallTokenEndIndex;
}
}
let destData = new Uint32Array((tokenEndIndex - tokenStartIndex) * 4);
let destOffset = 0;
let areaLine = 0;
let prevLineNumber = 0;
let prevEndCharacter = 0;
while (tokenIndex < tokenEndIndex) {
const srcOffset = 5 * tokenIndex;
const deltaLine = srcData[srcOffset];
const deltaCharacter = srcData[srcOffset + 1];
const lineNumber = lastLineNumber + deltaLine | 0;
const startCharacter = deltaLine === 0 ? lastStartCharacter + deltaCharacter | 0 : deltaCharacter;
const length = srcData[srcOffset + 2];
const endCharacter = startCharacter + length | 0;
const tokenTypeIndex = srcData[srcOffset + 3];
const tokenModifierSet = srcData[srcOffset + 4];
if (endCharacter <= startCharacter) {
styling.warnInvalidLengthSemanticTokens(lineNumber, startCharacter + 1);
} else if (prevLineNumber === lineNumber && prevEndCharacter > startCharacter) {
styling.warnOverlappingSemanticTokens(lineNumber, startCharacter + 1);
} else {
const metadata = styling.getMetadata(tokenTypeIndex, tokenModifierSet, languageId);
if (metadata !== 2147483647) {
if (areaLine === 0) {
areaLine = lineNumber;
}
destData[destOffset] = lineNumber - areaLine;
destData[destOffset + 1] = startCharacter;
destData[destOffset + 2] = endCharacter;
destData[destOffset + 3] = metadata;
destOffset += 4;
prevLineNumber = lineNumber;
prevEndCharacter = endCharacter;
}
}
lastLineNumber = lineNumber;
lastStartCharacter = startCharacter;
tokenIndex++;
}
if (destOffset !== destData.length) {
destData = destData.subarray(0, destOffset);
}
const tokens2 = SparseMultilineTokens.create(areaLine, destData);
result.push(tokens2);
}
return result;
}
var __decorate19, __param18, SemanticTokensProviderStyling, HashTableEntry, HashTable;
var init_semanticTokensProviderStyling = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensProviderStyling.js"() {
init_encodedTokenAttributes();
init_themeService();
init_log();
init_sparseMultilineTokens();
init_language();
__decorate19 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param18 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
SemanticTokensProviderStyling = class SemanticTokensProviderStyling2 {
constructor(_legend, _themeService, _languageService, _logService) {
this._legend = _legend;
this._themeService = _themeService;
this._languageService = _languageService;
this._logService = _logService;
this._hasWarnedOverlappingTokens = false;
this._hasWarnedInvalidLengthTokens = false;
this._hasWarnedInvalidEditStart = false;
this._hashTable = new HashTable();
}
getMetadata(tokenTypeIndex, tokenModifierSet, languageId) {
const encodedLanguageId = this._languageService.languageIdCodec.encodeLanguageId(languageId);
const entry = this._hashTable.get(tokenTypeIndex, tokenModifierSet, encodedLanguageId);
let metadata;
if (entry) {
metadata = entry.metadata;
if (this._logService.getLevel() === LogLevel.Trace) {
this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${tokenTypeIndex} / ${tokenModifierSet}: foreground ${TokenMetadata.getForeground(metadata)}, fontStyle ${TokenMetadata.getFontStyle(metadata).toString(2)}`);
}
} else {
let tokenType = this._legend.tokenTypes[tokenTypeIndex];
const tokenModifiers = [];
if (tokenType) {
let modifierSet = tokenModifierSet;
for (let modifierIndex = 0; modifierSet > 0 && modifierIndex < this._legend.tokenModifiers.length; modifierIndex++) {
if (modifierSet & 1) {
tokenModifiers.push(this._legend.tokenModifiers[modifierIndex]);
}
modifierSet = modifierSet >> 1;
}
if (modifierSet > 0 && this._logService.getLevel() === LogLevel.Trace) {
this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${tokenModifierSet.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`);
tokenModifiers.push("not-in-legend");
}
const tokenStyle = this._themeService.getColorTheme().getTokenStyleMetadata(tokenType, tokenModifiers, languageId);
if (typeof tokenStyle === "undefined") {
metadata = 2147483647;
} else {
metadata = 0;
if (typeof tokenStyle.italic !== "undefined") {
const italicBit = (tokenStyle.italic ? 1 : 0) << 11;
metadata |= italicBit | 1;
}
if (typeof tokenStyle.bold !== "undefined") {
const boldBit = (tokenStyle.bold ? 2 : 0) << 11;
metadata |= boldBit | 2;
}
if (typeof tokenStyle.underline !== "undefined") {
const underlineBit = (tokenStyle.underline ? 4 : 0) << 11;
metadata |= underlineBit | 4;
}
if (typeof tokenStyle.strikethrough !== "undefined") {
const strikethroughBit = (tokenStyle.strikethrough ? 8 : 0) << 11;
metadata |= strikethroughBit | 8;
}
if (tokenStyle.foreground) {
const foregroundBits = tokenStyle.foreground << 15;
metadata |= foregroundBits | 16;
}
if (metadata === 0) {
metadata = 2147483647;
}
}
} else {
if (this._logService.getLevel() === LogLevel.Trace) {
this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${tokenTypeIndex} for legend: ${JSON.stringify(this._legend.tokenTypes)}`);
}
metadata = 2147483647;
tokenType = "not-in-legend";
}
this._hashTable.add(tokenTypeIndex, tokenModifierSet, encodedLanguageId, metadata);
if (this._logService.getLevel() === LogLevel.Trace) {
this._logService.trace(`SemanticTokensProviderStyling ${tokenTypeIndex} (${tokenType}) / ${tokenModifierSet} (${tokenModifiers.join(" ")}): foreground ${TokenMetadata.getForeground(metadata)}, fontStyle ${TokenMetadata.getFontStyle(metadata).toString(2)}`);
}
}
return metadata;
}
warnOverlappingSemanticTokens(lineNumber, startColumn) {
if (!this._hasWarnedOverlappingTokens) {
this._hasWarnedOverlappingTokens = true;
this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${lineNumber}, column ${startColumn}`);
}
}
warnInvalidLengthSemanticTokens(lineNumber, startColumn) {
if (!this._hasWarnedInvalidLengthTokens) {
this._hasWarnedInvalidLengthTokens = true;
this._logService.warn(`Semantic token with invalid length detected at lineNumber ${lineNumber}, column ${startColumn}`);
}
}
warnInvalidEditStart(previousResultId, resultId, editIndex, editStart, maxExpectedStart) {
if (!this._hasWarnedInvalidEditStart) {
this._hasWarnedInvalidEditStart = true;
this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${previousResultId}, resultId: ${resultId}) at edit #${editIndex}: The provided start offset ${editStart} is outside the previous data (length ${maxExpectedStart}).`);
}
}
};
SemanticTokensProviderStyling = __decorate19([
__param18(1, IThemeService),
__param18(2, ILanguageService),
__param18(3, ILogService)
], SemanticTokensProviderStyling);
HashTableEntry = class {
constructor(tokenTypeIndex, tokenModifierSet, languageId, metadata) {
this.tokenTypeIndex = tokenTypeIndex;
this.tokenModifierSet = tokenModifierSet;
this.languageId = languageId;
this.metadata = metadata;
this.next = null;
}
};
HashTable = class _HashTable {
constructor() {
this._elementsCount = 0;
this._currentLengthIndex = 0;
this._currentLength = _HashTable._SIZES[this._currentLengthIndex];
this._growCount = Math.round(this._currentLengthIndex + 1 < _HashTable._SIZES.length ? 2 / 3 * this._currentLength : 0);
this._elements = [];
_HashTable._nullOutEntries(this._elements, this._currentLength);
}
static _nullOutEntries(entries2, length) {
for (let i = 0; i < length; i++) {
entries2[i] = null;
}
}
_hash2(n1, n2) {
return (n1 << 5) - n1 + n2 | 0;
}
_hashFunc(tokenTypeIndex, tokenModifierSet, languageId) {
return this._hash2(this._hash2(tokenTypeIndex, tokenModifierSet), languageId) % this._currentLength;
}
get(tokenTypeIndex, tokenModifierSet, languageId) {
const hash2 = this._hashFunc(tokenTypeIndex, tokenModifierSet, languageId);
let p = this._elements[hash2];
while (p) {
if (p.tokenTypeIndex === tokenTypeIndex && p.tokenModifierSet === tokenModifierSet && p.languageId === languageId) {
return p;
}
p = p.next;
}
return null;
}
add(tokenTypeIndex, tokenModifierSet, languageId, metadata) {
this._elementsCount++;
if (this._growCount !== 0 && this._elementsCount >= this._growCount) {
const oldElements = this._elements;
this._currentLengthIndex++;
this._currentLength = _HashTable._SIZES[this._currentLengthIndex];
this._growCount = Math.round(this._currentLengthIndex + 1 < _HashTable._SIZES.length ? 2 / 3 * this._currentLength : 0);
this._elements = [];
_HashTable._nullOutEntries(this._elements, this._currentLength);
for (const first2 of oldElements) {
let p = first2;
while (p) {
const oldNext = p.next;
p.next = null;
this._add(p);
p = oldNext;
}
}
}
this._add(new HashTableEntry(tokenTypeIndex, tokenModifierSet, languageId, metadata));
}
_add(element) {
const hash2 = this._hashFunc(element.tokenTypeIndex, element.tokenModifierSet, element.languageId);
element.next = this._elements[hash2];
this._elements[hash2] = element;
}
};
HashTable._SIZES = [3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143];
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStyling.js
var ISemanticTokensStylingService;
var init_semanticTokensStyling = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStyling.js"() {
init_instantiation();
ISemanticTokensStylingService = createDecorator("semanticTokensStylingService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStylingService.js
var __decorate20, __param19, SemanticTokensStylingService;
var init_semanticTokensStylingService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/semanticTokensStylingService.js"() {
init_lifecycle();
init_language();
init_themeService();
init_log();
init_semanticTokensProviderStyling();
init_semanticTokensStyling();
init_extensions();
__decorate20 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param19 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
SemanticTokensStylingService = class SemanticTokensStylingService2 extends Disposable {
constructor(_themeService, _logService, _languageService) {
super();
this._themeService = _themeService;
this._logService = _logService;
this._languageService = _languageService;
this._caches = /* @__PURE__ */ new WeakMap();
this._register(this._themeService.onDidColorThemeChange(() => {
this._caches = /* @__PURE__ */ new WeakMap();
}));
}
getStyling(provider) {
if (!this._caches.has(provider)) {
this._caches.set(provider, new SemanticTokensProviderStyling(provider.getLegend(), this._themeService, this._languageService, this._logService));
}
return this._caches.get(provider);
}
};
SemanticTokensStylingService = __decorate20([
__param19(0, IThemeService),
__param19(1, ILogService),
__param19(2, ILanguageService)
], SemanticTokensStylingService);
registerSingleton(
ISemanticTokensStylingService,
SemanticTokensStylingService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/base/common/glob.js
function starsToRegExp(starCount, isLastPattern) {
switch (starCount) {
case 0:
return "";
case 1:
return `${NO_PATH_REGEX}*?`;
// 1 star matches any number of characters except path separator (/ and \) - non greedy (?)
default:
return `(?:${PATH_REGEX}|${NO_PATH_REGEX}+${PATH_REGEX}${isLastPattern ? `|${PATH_REGEX}${NO_PATH_REGEX}+` : ""})*?`;
}
}
function splitGlobAware(pattern, splitChar) {
if (!pattern) {
return [];
}
const segments = [];
let inBraces = false;
let inBrackets = false;
let curVal = "";
for (const char of pattern) {
switch (char) {
case splitChar:
if (!inBraces && !inBrackets) {
segments.push(curVal);
curVal = "";
continue;
}
break;
case "{":
inBraces = true;
break;
case "}":
inBraces = false;
break;
case "[":
inBrackets = true;
break;
case "]":
inBrackets = false;
break;
}
curVal += char;
}
if (curVal) {
segments.push(curVal);
}
return segments;
}
function parseRegExp(pattern) {
if (!pattern) {
return "";
}
let regEx = "";
const segments = splitGlobAware(pattern, GLOB_SPLIT);
if (segments.every((segment) => segment === GLOBSTAR)) {
regEx = ".*";
} else {
let previousSegmentWasGlobStar = false;
segments.forEach((segment, index) => {
if (segment === GLOBSTAR) {
if (previousSegmentWasGlobStar) {
return;
}
regEx += starsToRegExp(2, index === segments.length - 1);
} else {
let inBraces = false;
let braceVal = "";
let inBrackets = false;
let bracketVal = "";
for (const char of segment) {
if (char !== "}" && inBraces) {
braceVal += char;
continue;
}
if (inBrackets && (char !== "]" || !bracketVal)) {
let res;
if (char === "-") {
res = char;
} else if ((char === "^" || char === "!") && !bracketVal) {
res = "^";
} else if (char === GLOB_SPLIT) {
res = "";
} else {
res = escapeRegExpCharacters(char);
}
bracketVal += res;
continue;
}
switch (char) {
case "{":
inBraces = true;
continue;
case "[":
inBrackets = true;
continue;
case "}": {
const choices = splitGlobAware(braceVal, ",");
const braceRegExp = `(?:${choices.map((choice) => parseRegExp(choice)).join("|")})`;
regEx += braceRegExp;
inBraces = false;
braceVal = "";
break;
}
case "]": {
regEx += "[" + bracketVal + "]";
inBrackets = false;
bracketVal = "";
break;
}
case "?":
regEx += NO_PATH_REGEX;
continue;
case "*":
regEx += starsToRegExp(1);
continue;
default:
regEx += escapeRegExpCharacters(char);
}
}
if (index < segments.length - 1 && // more segments to come after this
(segments[index + 1] !== GLOBSTAR || // next segment is not **, or...
index + 2 < segments.length)) {
regEx += PATH_REGEX;
}
}
previousSegmentWasGlobStar = segment === GLOBSTAR;
});
}
return regEx;
}
function parsePattern(arg1, options2) {
if (!arg1) {
return NULL;
}
let pattern;
if (typeof arg1 !== "string") {
pattern = arg1.pattern;
} else {
pattern = arg1;
}
pattern = pattern.trim();
const patternKey = `${pattern}_${!!options2.trimForExclusions}`;
let parsedPattern = CACHE.get(patternKey);
if (parsedPattern) {
return wrapRelativePattern(parsedPattern, arg1);
}
let match2;
if (T1.test(pattern)) {
parsedPattern = trivia1(pattern.substr(4), pattern);
} else if (match2 = T2.exec(trimForExclusions(pattern, options2))) {
parsedPattern = trivia2(match2[1], pattern);
} else if ((options2.trimForExclusions ? T3_2 : T3).test(pattern)) {
parsedPattern = trivia3(pattern, options2);
} else if (match2 = T4.exec(trimForExclusions(pattern, options2))) {
parsedPattern = trivia4and5(match2[1].substr(1), pattern, true);
} else if (match2 = T5.exec(trimForExclusions(pattern, options2))) {
parsedPattern = trivia4and5(match2[1], pattern, false);
} else {
parsedPattern = toRegExp(pattern);
}
CACHE.set(patternKey, parsedPattern);
return wrapRelativePattern(parsedPattern, arg1);
}
function wrapRelativePattern(parsedPattern, arg2) {
if (typeof arg2 === "string") {
return parsedPattern;
}
const wrappedPattern = function(path, basename3) {
if (!isEqualOrParent(path, arg2.base, !isLinux)) {
return null;
}
return parsedPattern(ltrim(path.substr(arg2.base.length), sep), basename3);
};
wrappedPattern.allBasenames = parsedPattern.allBasenames;
wrappedPattern.allPaths = parsedPattern.allPaths;
wrappedPattern.basenames = parsedPattern.basenames;
wrappedPattern.patterns = parsedPattern.patterns;
return wrappedPattern;
}
function trimForExclusions(pattern, options2) {
return options2.trimForExclusions && pattern.endsWith("/**") ? pattern.substr(0, pattern.length - 2) : pattern;
}
function trivia1(base, pattern) {
return function(path, basename3) {
return typeof path === "string" && path.endsWith(base) ? pattern : null;
};
}
function trivia2(base, pattern) {
const slashBase = `/${base}`;
const backslashBase = `\\${base}`;
const parsedPattern = function(path, basename3) {
if (typeof path !== "string") {
return null;
}
if (basename3) {
return basename3 === base ? pattern : null;
}
return path === base || path.endsWith(slashBase) || path.endsWith(backslashBase) ? pattern : null;
};
const basenames = [base];
parsedPattern.basenames = basenames;
parsedPattern.patterns = [pattern];
parsedPattern.allBasenames = basenames;
return parsedPattern;
}
function trivia3(pattern, options2) {
const parsedPatterns = aggregateBasenameMatches(pattern.slice(1, -1).split(",").map((pattern2) => parsePattern(pattern2, options2)).filter((pattern2) => pattern2 !== NULL), pattern);
const patternsLength = parsedPatterns.length;
if (!patternsLength) {
return NULL;
}
if (patternsLength === 1) {
return parsedPatterns[0];
}
const parsedPattern = function(path, basename3) {
for (let i = 0, n = parsedPatterns.length; i < n; i++) {
if (parsedPatterns[i](path, basename3)) {
return pattern;
}
}
return null;
};
const withBasenames = parsedPatterns.find((pattern2) => !!pattern2.allBasenames);
if (withBasenames) {
parsedPattern.allBasenames = withBasenames.allBasenames;
}
const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
if (allPaths.length) {
parsedPattern.allPaths = allPaths;
}
return parsedPattern;
}
function trivia4and5(targetPath, pattern, matchPathEnds) {
const usingPosixSep = sep === posix.sep;
const nativePath = usingPosixSep ? targetPath : targetPath.replace(ALL_FORWARD_SLASHES, sep);
const nativePathEnd = sep + nativePath;
const targetPathEnd = posix.sep + targetPath;
let parsedPattern;
if (matchPathEnds) {
parsedPattern = function(path, basename3) {
return typeof path === "string" && (path === nativePath || path.endsWith(nativePathEnd) || !usingPosixSep && (path === targetPath || path.endsWith(targetPathEnd))) ? pattern : null;
};
} else {
parsedPattern = function(path, basename3) {
return typeof path === "string" && (path === nativePath || !usingPosixSep && path === targetPath) ? pattern : null;
};
}
parsedPattern.allPaths = [(matchPathEnds ? "*/" : "./") + targetPath];
return parsedPattern;
}
function toRegExp(pattern) {
try {
const regExp = new RegExp(`^${parseRegExp(pattern)}$`);
return function(path) {
regExp.lastIndex = 0;
return typeof path === "string" && regExp.test(path) ? pattern : null;
};
} catch (error) {
return NULL;
}
}
function match(arg1, path, hasSibling) {
if (!arg1 || typeof path !== "string") {
return false;
}
return parse(arg1)(path, void 0, hasSibling);
}
function parse(arg1, options2 = {}) {
if (!arg1) {
return FALSE;
}
if (typeof arg1 === "string" || isRelativePattern(arg1)) {
const parsedPattern = parsePattern(arg1, options2);
if (parsedPattern === NULL) {
return FALSE;
}
const resultPattern = function(path, basename3) {
return !!parsedPattern(path, basename3);
};
if (parsedPattern.allBasenames) {
resultPattern.allBasenames = parsedPattern.allBasenames;
}
if (parsedPattern.allPaths) {
resultPattern.allPaths = parsedPattern.allPaths;
}
return resultPattern;
}
return parsedExpression(arg1, options2);
}
function isRelativePattern(obj) {
const rp = obj;
if (!rp) {
return false;
}
return typeof rp.base === "string" && typeof rp.pattern === "string";
}
function parsedExpression(expression, options2) {
const parsedPatterns = aggregateBasenameMatches(Object.getOwnPropertyNames(expression).map((pattern) => parseExpressionPattern(pattern, expression[pattern], options2)).filter((pattern) => pattern !== NULL));
const patternsLength = parsedPatterns.length;
if (!patternsLength) {
return NULL;
}
if (!parsedPatterns.some((parsedPattern) => !!parsedPattern.requiresSiblings)) {
if (patternsLength === 1) {
return parsedPatterns[0];
}
const resultExpression2 = function(path, basename3) {
let resultPromises = void 0;
for (let i = 0, n = parsedPatterns.length; i < n; i++) {
const result = parsedPatterns[i](path, basename3);
if (typeof result === "string") {
return result;
}
if (isThenable(result)) {
if (!resultPromises) {
resultPromises = [];
}
resultPromises.push(result);
}
}
if (resultPromises) {
return (() => __async(this, null, function* () {
for (const resultPromise of resultPromises) {
const result = yield resultPromise;
if (typeof result === "string") {
return result;
}
}
return null;
}))();
}
return null;
};
const withBasenames2 = parsedPatterns.find((pattern) => !!pattern.allBasenames);
if (withBasenames2) {
resultExpression2.allBasenames = withBasenames2.allBasenames;
}
const allPaths2 = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
if (allPaths2.length) {
resultExpression2.allPaths = allPaths2;
}
return resultExpression2;
}
const resultExpression = function(path, base, hasSibling) {
let name = void 0;
let resultPromises = void 0;
for (let i = 0, n = parsedPatterns.length; i < n; i++) {
const parsedPattern = parsedPatterns[i];
if (parsedPattern.requiresSiblings && hasSibling) {
if (!base) {
base = basename(path);
}
if (!name) {
name = base.substr(0, base.length - extname(path).length);
}
}
const result = parsedPattern(path, base, name, hasSibling);
if (typeof result === "string") {
return result;
}
if (isThenable(result)) {
if (!resultPromises) {
resultPromises = [];
}
resultPromises.push(result);
}
}
if (resultPromises) {
return (() => __async(this, null, function* () {
for (const resultPromise of resultPromises) {
const result = yield resultPromise;
if (typeof result === "string") {
return result;
}
}
return null;
}))();
}
return null;
};
const withBasenames = parsedPatterns.find((pattern) => !!pattern.allBasenames);
if (withBasenames) {
resultExpression.allBasenames = withBasenames.allBasenames;
}
const allPaths = parsedPatterns.reduce((all, current) => current.allPaths ? all.concat(current.allPaths) : all, []);
if (allPaths.length) {
resultExpression.allPaths = allPaths;
}
return resultExpression;
}
function parseExpressionPattern(pattern, value, options2) {
if (value === false) {
return NULL;
}
const parsedPattern = parsePattern(pattern, options2);
if (parsedPattern === NULL) {
return NULL;
}
if (typeof value === "boolean") {
return parsedPattern;
}
if (value) {
const when = value.when;
if (typeof when === "string") {
const result = (path, basename3, name, hasSibling) => {
if (!hasSibling || !parsedPattern(path, basename3)) {
return null;
}
const clausePattern = when.replace("$(basename)", () => name);
const matched = hasSibling(clausePattern);
return isThenable(matched) ? matched.then((match2) => match2 ? pattern : null) : matched ? pattern : null;
};
result.requiresSiblings = true;
return result;
}
}
return parsedPattern;
}
function aggregateBasenameMatches(parsedPatterns, result) {
const basenamePatterns = parsedPatterns.filter((parsedPattern) => !!parsedPattern.basenames);
if (basenamePatterns.length < 2) {
return parsedPatterns;
}
const basenames = basenamePatterns.reduce((all, current) => {
const basenames2 = current.basenames;
return basenames2 ? all.concat(basenames2) : all;
}, []);
let patterns;
if (result) {
patterns = [];
for (let i = 0, n = basenames.length; i < n; i++) {
patterns.push(result);
}
} else {
patterns = basenamePatterns.reduce((all, current) => {
const patterns2 = current.patterns;
return patterns2 ? all.concat(patterns2) : all;
}, []);
}
const aggregate = function(path, basename3) {
if (typeof path !== "string") {
return null;
}
if (!basename3) {
let i;
for (i = path.length; i > 0; i--) {
const ch = path.charCodeAt(i - 1);
if (ch === 47 || ch === 92) {
break;
}
}
basename3 = path.substr(i);
}
const index = basenames.indexOf(basename3);
return index !== -1 ? patterns[index] : null;
};
aggregate.basenames = basenames;
aggregate.patterns = patterns;
aggregate.allBasenames = basenames;
const aggregatedPatterns = parsedPatterns.filter((parsedPattern) => !parsedPattern.basenames);
aggregatedPatterns.push(aggregate);
return aggregatedPatterns;
}
var GLOBSTAR, GLOB_SPLIT, PATH_REGEX, NO_PATH_REGEX, ALL_FORWARD_SLASHES, T1, T2, T3, T3_2, T4, T5, CACHE, FALSE, NULL;
var init_glob = __esm({
"node_modules/monaco-editor/esm/vs/base/common/glob.js"() {
init_async();
init_extpath();
init_map();
init_path();
init_platform();
init_strings();
GLOBSTAR = "**";
GLOB_SPLIT = "/";
PATH_REGEX = "[/\\\\]";
NO_PATH_REGEX = "[^/\\\\]";
ALL_FORWARD_SLASHES = /\//g;
T1 = /^\*\*\/\*\.[\w\.-]+$/;
T2 = /^\*\*\/([\w\.-]+)\/?$/;
T3 = /^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/;
T3_2 = /^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/;
T4 = /^\*\*((\/[\w\.-]+)+)\/?$/;
T5 = /^([\w\.-]+(\/[\w\.-]+)*)\/?$/;
CACHE = new LRUCache(1e4);
FALSE = function() {
return false;
};
NULL = function() {
return null;
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languageSelector.js
function score2(selector, candidateUri, candidateLanguage, candidateIsSynchronized, candidateNotebookUri, candidateNotebookType) {
if (Array.isArray(selector)) {
let ret = 0;
for (const filter of selector) {
const value = score2(filter, candidateUri, candidateLanguage, candidateIsSynchronized, candidateNotebookUri, candidateNotebookType);
if (value === 10) {
return value;
}
if (value > ret) {
ret = value;
}
}
return ret;
} else if (typeof selector === "string") {
if (!candidateIsSynchronized) {
return 0;
}
if (selector === "*") {
return 5;
} else if (selector === candidateLanguage) {
return 10;
} else {
return 0;
}
} else if (selector) {
const { language: language82, pattern, scheme, hasAccessToAllModels, notebookType } = selector;
if (!candidateIsSynchronized && !hasAccessToAllModels) {
return 0;
}
if (notebookType && candidateNotebookUri) {
candidateUri = candidateNotebookUri;
}
let ret = 0;
if (scheme) {
if (scheme === candidateUri.scheme) {
ret = 10;
} else if (scheme === "*") {
ret = 5;
} else {
return 0;
}
}
if (language82) {
if (language82 === candidateLanguage) {
ret = 10;
} else if (language82 === "*") {
ret = Math.max(ret, 5);
} else {
return 0;
}
}
if (notebookType) {
if (notebookType === candidateNotebookType) {
ret = 10;
} else if (notebookType === "*" && candidateNotebookType !== void 0) {
ret = Math.max(ret, 5);
} else {
return 0;
}
}
if (pattern) {
let normalizedPattern;
if (typeof pattern === "string") {
normalizedPattern = pattern;
} else {
normalizedPattern = __spreadProps(__spreadValues({}, pattern), { base: normalize(pattern.base) });
}
if (normalizedPattern === candidateUri.fsPath || match(normalizedPattern, candidateUri.fsPath)) {
ret = 10;
} else {
return 0;
}
}
return ret;
} else {
return 0;
}
}
var init_languageSelector = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languageSelector.js"() {
init_glob();
init_path();
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languageFeatureRegistry.js
function isExclusive(selector) {
if (typeof selector === "string") {
return false;
} else if (Array.isArray(selector)) {
return selector.every(isExclusive);
} else {
return !!selector.exclusive;
}
}
function isBuiltinSelector(selector) {
if (typeof selector === "string") {
return false;
}
if (Array.isArray(selector)) {
return selector.some(isBuiltinSelector);
}
return Boolean(selector.isBuiltin);
}
var MatchCandidate, LanguageFeatureRegistry;
var init_languageFeatureRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languageFeatureRegistry.js"() {
init_event();
init_lifecycle();
init_model2();
init_languageSelector();
MatchCandidate = class {
constructor(uri, languageId, notebookUri, notebookType) {
this.uri = uri;
this.languageId = languageId;
this.notebookUri = notebookUri;
this.notebookType = notebookType;
}
equals(other) {
var _a10, _b4;
return this.notebookType === other.notebookType && this.languageId === other.languageId && this.uri.toString() === other.uri.toString() && ((_a10 = this.notebookUri) === null || _a10 === void 0 ? void 0 : _a10.toString()) === ((_b4 = other.notebookUri) === null || _b4 === void 0 ? void 0 : _b4.toString());
}
};
LanguageFeatureRegistry = class _LanguageFeatureRegistry {
constructor(_notebookInfoResolver) {
this._notebookInfoResolver = _notebookInfoResolver;
this._clock = 0;
this._entries = [];
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
}
register(selector, provider) {
let entry = {
selector,
provider,
_score: -1,
_time: this._clock++
};
this._entries.push(entry);
this._lastCandidate = void 0;
this._onDidChange.fire(this._entries.length);
return toDisposable(() => {
if (entry) {
const idx = this._entries.indexOf(entry);
if (idx >= 0) {
this._entries.splice(idx, 1);
this._lastCandidate = void 0;
this._onDidChange.fire(this._entries.length);
entry = void 0;
}
}
});
}
has(model) {
return this.all(model).length > 0;
}
all(model) {
if (!model) {
return [];
}
this._updateScores(model);
const result = [];
for (const entry of this._entries) {
if (entry._score > 0) {
result.push(entry.provider);
}
}
return result;
}
ordered(model) {
const result = [];
this._orderedForEach(model, (entry) => result.push(entry.provider));
return result;
}
orderedGroups(model) {
const result = [];
let lastBucket;
let lastBucketScore;
this._orderedForEach(model, (entry) => {
if (lastBucket && lastBucketScore === entry._score) {
lastBucket.push(entry.provider);
} else {
lastBucketScore = entry._score;
lastBucket = [entry.provider];
result.push(lastBucket);
}
});
return result;
}
_orderedForEach(model, callback) {
this._updateScores(model);
for (const entry of this._entries) {
if (entry._score > 0) {
callback(entry);
}
}
}
_updateScores(model) {
var _a10, _b4;
const notebookInfo = (_a10 = this._notebookInfoResolver) === null || _a10 === void 0 ? void 0 : _a10.call(this, model.uri);
const candidate = notebookInfo ? new MatchCandidate(model.uri, model.getLanguageId(), notebookInfo.uri, notebookInfo.type) : new MatchCandidate(model.uri, model.getLanguageId(), void 0, void 0);
if ((_b4 = this._lastCandidate) === null || _b4 === void 0 ? void 0 : _b4.equals(candidate)) {
return;
}
this._lastCandidate = candidate;
for (const entry of this._entries) {
entry._score = score2(entry.selector, candidate.uri, candidate.languageId, shouldSynchronizeModel(model), candidate.notebookUri, candidate.notebookType);
if (isExclusive(entry.selector) && entry._score > 0) {
for (const entry2 of this._entries) {
entry2._score = 0;
}
entry._score = 1e3;
break;
}
}
this._entries.sort(_LanguageFeatureRegistry._compareByScoreAndTime);
}
static _compareByScoreAndTime(a3, b) {
if (a3._score < b._score) {
return 1;
} else if (a3._score > b._score) {
return -1;
}
if (isBuiltinSelector(a3.selector) && !isBuiltinSelector(b.selector)) {
return 1;
} else if (!isBuiltinSelector(a3.selector) && isBuiltinSelector(b.selector)) {
return -1;
}
if (a3._time < b._time) {
return 1;
} else if (a3._time > b._time) {
return -1;
} else {
return 0;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languageFeaturesService.js
var LanguageFeaturesService;
var init_languageFeaturesService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languageFeaturesService.js"() {
init_languageFeatureRegistry();
init_languageFeatures();
init_extensions();
LanguageFeaturesService = class {
constructor() {
this.referenceProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.renameProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.newSymbolNamesProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.codeActionProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.definitionProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.typeDefinitionProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.declarationProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.implementationProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentSymbolProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.inlayHintsProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.colorProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.codeLensProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentFormattingEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentRangeFormattingEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.onTypeFormattingEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.signatureHelpProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.hoverProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentHighlightProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.multiDocumentHighlightProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.selectionRangeProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.foldingRangeProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.linkProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.inlineCompletionsProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.inlineEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.completionProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.linkedEditingRangeProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentRangeSemanticTokensProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentSemanticTokensProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentDropEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
this.documentPasteEditProvider = new LanguageFeatureRegistry(this._score.bind(this));
}
_score(uri) {
var _a10;
return (_a10 = this._notebookTypeResolver) === null || _a10 === void 0 ? void 0 : _a10.call(this, uri);
}
};
registerSingleton(
ILanguageFeaturesService,
LanguageFeaturesService,
1
/* InstantiationType.Delayed */
);
}
});
// node_modules/monaco-editor/esm/vs/platform/hover/browser/hover.js
var __decorate21, __param20, IHoverService, WorkbenchHoverDelegate;
var init_hover = __esm({
"node_modules/monaco-editor/esm/vs/platform/hover/browser/hover.js"() {
init_instantiation();
init_lifecycle();
init_configuration();
init_dom();
__decorate21 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param20 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
IHoverService = createDecorator("hoverService");
WorkbenchHoverDelegate = class WorkbenchHoverDelegate2 extends Disposable {
get delay() {
if (this.isInstantlyHovering()) {
return 0;
}
return this._delay;
}
constructor(placement, instantHover, overrideOptions = {}, configurationService, hoverService) {
super();
this.placement = placement;
this.instantHover = instantHover;
this.overrideOptions = overrideOptions;
this.configurationService = configurationService;
this.hoverService = hoverService;
this.lastHoverHideTime = 0;
this.timeLimit = 200;
this.hoverDisposables = this._register(new DisposableStore());
this._delay = this.configurationService.getValue("workbench.hover.delay");
this._register(this.configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration("workbench.hover.delay")) {
this._delay = this.configurationService.getValue("workbench.hover.delay");
}
}));
}
showHover(options2, focus) {
const overrideOptions = typeof this.overrideOptions === "function" ? this.overrideOptions(options2, focus) : this.overrideOptions;
this.hoverDisposables.clear();
const targets = isHTMLElement(options2.target) ? [options2.target] : options2.target.targetElements;
for (const target of targets) {
this.hoverDisposables.add(addStandardDisposableListener(target, "keydown", (e) => {
if (e.equals(
9
/* KeyCode.Escape */
)) {
this.hoverService.hideHover();
}
}));
}
const id = isHTMLElement(options2.content) ? void 0 : options2.content.toString();
return this.hoverService.showHover(__spreadProps(__spreadValues(__spreadValues({}, options2), overrideOptions), {
persistence: __spreadValues({
hideOnKeyDown: true
}, overrideOptions.persistence),
id,
appearance: __spreadValues(__spreadProps(__spreadValues({}, options2.appearance), {
compact: true,
skipFadeInAnimation: this.isInstantlyHovering()
}), overrideOptions.appearance)
}), focus);
}
isInstantlyHovering() {
return this.instantHover && Date.now() - this.lastHoverHideTime < this.timeLimit;
}
onDidHideHover() {
this.hoverDisposables.clear();
if (this.instantHover) {
this.lastHoverHideTime = Date.now();
}
}
};
WorkbenchHoverDelegate = __decorate21([
__param20(3, IConfigurationService),
__param20(4, IHoverService)
], WorkbenchHoverDelegate);
}
});
// node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextView.js
var IContextViewService, IContextMenuService;
var init_contextView = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextView.js"() {
init_instantiation();
IContextViewService = createDecorator("contextViewService");
IContextMenuService = createDecorator("contextMenuService");
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hover.css
var init_hover2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hover.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.css
var init_hoverWidget = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js
function getHoverAccessibleViewHint(shouldHaveHint, keybinding) {
return shouldHaveHint && keybinding ? localize("acessibleViewHint", "Inspect this in the accessible view with {0}.", keybinding) : shouldHaveHint ? localize("acessibleViewHintNoKbOpen", "Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding.") : "";
}
var $2, HoverWidget, HoverAction, ClickAction, KeyDownAction;
var init_hoverWidget2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverWidget.js"() {
init_dom();
init_keyboardEvent();
init_scrollableElement();
init_lifecycle();
init_hoverWidget();
init_nls();
$2 = $;
HoverWidget = class extends Disposable {
constructor() {
super();
this.containerDomNode = document.createElement("div");
this.containerDomNode.className = "monaco-hover";
this.containerDomNode.tabIndex = 0;
this.containerDomNode.setAttribute("role", "tooltip");
this.contentsDomNode = document.createElement("div");
this.contentsDomNode.className = "monaco-hover-content";
this.scrollbar = this._register(new DomScrollableElement(this.contentsDomNode, {
consumeMouseWheelIfScrollbarIsNeeded: true
}));
this.containerDomNode.appendChild(this.scrollbar.getDomNode());
}
onContentsChanged() {
this.scrollbar.scanDomNode();
}
};
HoverAction = class _HoverAction extends Disposable {
static render(parent, actionOptions, keybindingLabel) {
return new _HoverAction(parent, actionOptions, keybindingLabel);
}
constructor(parent, actionOptions, keybindingLabel) {
super();
this.actionContainer = append(parent, $2("div.action-container"));
this.actionContainer.setAttribute("tabindex", "0");
this.action = append(this.actionContainer, $2("a.action"));
this.action.setAttribute("role", "button");
if (actionOptions.iconClass) {
append(this.action, $2(`span.icon.${actionOptions.iconClass}`));
}
const label = append(this.action, $2("span"));
label.textContent = keybindingLabel ? `${actionOptions.label} (${keybindingLabel})` : actionOptions.label;
this._store.add(new ClickAction(this.actionContainer, actionOptions.run));
this._store.add(new KeyDownAction(this.actionContainer, actionOptions.run, [
3,
10
/* KeyCode.Space */
]));
this.setEnabled(true);
}
setEnabled(enabled) {
if (enabled) {
this.actionContainer.classList.remove("disabled");
this.actionContainer.removeAttribute("aria-disabled");
} else {
this.actionContainer.classList.add("disabled");
this.actionContainer.setAttribute("aria-disabled", "true");
}
}
};
ClickAction = class extends Disposable {
constructor(container, run) {
super();
this._register(addDisposableListener(container, EventType.CLICK, (e) => {
e.stopPropagation();
e.preventDefault();
run(container);
}));
}
};
KeyDownAction = class extends Disposable {
constructor(container, run, keyCodes) {
super();
this._register(addDisposableListener(container, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (keyCodes.some((keyCode) => event.equals(keyCode))) {
e.stopPropagation();
e.preventDefault();
run(container);
}
}));
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/opener/common/opener.js
function extractSelection(uri) {
let selection = void 0;
const match2 = /^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(uri.fragment);
if (match2) {
selection = {
startLineNumber: parseInt(match2[1]),
startColumn: match2[2] ? parseInt(match2[2]) : 1,
endLineNumber: match2[4] ? parseInt(match2[4]) : void 0,
endColumn: match2[4] ? match2[5] ? parseInt(match2[5]) : 1 : void 0
};
uri = uri.with({ fragment: "" });
}
return { selection, uri };
}
var IOpenerService;
var init_opener = __esm({
"node_modules/monaco-editor/esm/vs/platform/opener/common/opener.js"() {
init_instantiation();
IOpenerService = createDecorator("openerService");
}
});
// node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js
function renderText(text2, options2 = {}) {
const element = createElement(options2);
element.textContent = text2;
return element;
}
function renderFormattedText(formattedText, options2 = {}) {
const element = createElement(options2);
_renderFormattedText(element, parseFormattedText(formattedText, !!options2.renderCodeSegments), options2.actionHandler, options2.renderCodeSegments);
return element;
}
function createElement(options2) {
const tagName = options2.inline ? "span" : "div";
const element = document.createElement(tagName);
if (options2.className) {
element.className = options2.className;
}
return element;
}
function _renderFormattedText(element, treeNode, actionHandler, renderCodeSegments) {
let child;
if (treeNode.type === 2) {
child = document.createTextNode(treeNode.content || "");
} else if (treeNode.type === 3) {
child = document.createElement("b");
} else if (treeNode.type === 4) {
child = document.createElement("i");
} else if (treeNode.type === 7 && renderCodeSegments) {
child = document.createElement("code");
} else if (treeNode.type === 5 && actionHandler) {
const a3 = document.createElement("a");
actionHandler.disposables.add(addStandardDisposableListener(a3, "click", (event) => {
actionHandler.callback(String(treeNode.index), event);
}));
child = a3;
} else if (treeNode.type === 8) {
child = document.createElement("br");
} else if (treeNode.type === 1) {
child = element;
}
if (child && element !== child) {
element.appendChild(child);
}
if (child && Array.isArray(treeNode.children)) {
treeNode.children.forEach((nodeChild) => {
_renderFormattedText(child, nodeChild, actionHandler, renderCodeSegments);
});
}
}
function parseFormattedText(content, parseCodeSegments) {
const root = {
type: 1,
children: []
};
let actionViewItemIndex = 0;
let current = root;
const stack = [];
const stream = new StringStream(content);
while (!stream.eos()) {
let next = stream.next();
const isEscapedFormatType = next === "\\" && formatTagType(stream.peek(), parseCodeSegments) !== 0;
if (isEscapedFormatType) {
next = stream.next();
}
if (!isEscapedFormatType && isFormatTag(next, parseCodeSegments) && next === stream.peek()) {
stream.advance();
if (current.type === 2) {
current = stack.pop();
}
const type = formatTagType(next, parseCodeSegments);
if (current.type === type || current.type === 5 && type === 6) {
current = stack.pop();
} else {
const newCurrent = {
type,
children: []
};
if (type === 5) {
newCurrent.index = actionViewItemIndex;
actionViewItemIndex++;
}
current.children.push(newCurrent);
stack.push(current);
current = newCurrent;
}
} else if (next === "\n") {
if (current.type === 2) {
current = stack.pop();
}
current.children.push({
type: 8
/* FormatType.NewLine */
});
} else {
if (current.type !== 2) {
const textCurrent = {
type: 2,
content: next
};
current.children.push(textCurrent);
stack.push(current);
current = textCurrent;
} else {
current.content += next;
}
}
}
if (current.type === 2) {
current = stack.pop();
}
if (stack.length) {
}
return root;
}
function isFormatTag(char, supportCodeSegments) {
return formatTagType(char, supportCodeSegments) !== 0;
}
function formatTagType(char, supportCodeSegments) {
switch (char) {
case "*":
return 3;
case "_":
return 4;
case "[":
return 5;
case "]":
return 6;
case "`":
return supportCodeSegments ? 7 : 0;
default:
return 0;
}
}
var StringStream;
var init_formattedTextRenderer = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/formattedTextRenderer.js"() {
init_dom();
StringStream = class {
constructor(source) {
this.source = source;
this.index = 0;
}
eos() {
return this.index >= this.source.length;
}
next() {
const next = this.peek();
this.advance();
return next;
}
peek() {
return this.source[this.index];
}
advance() {
this.index++;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js
function renderLabelWithIcons(text2) {
const elements = new Array();
let match2;
let textStart = 0, textStop = 0;
while ((match2 = labelWithIconsRegex.exec(text2)) !== null) {
textStop = match2.index || 0;
if (textStart < textStop) {
elements.push(text2.substring(textStart, textStop));
}
textStart = (match2.index || 0) + match2[0].length;
const [, escaped, codicon] = match2;
elements.push(escaped ? `$(${codicon})` : renderIcon({ id: codicon }));
}
if (textStart < text2.length) {
elements.push(text2.substring(textStart));
}
return elements;
}
function renderIcon(icon) {
const node = $(`span`);
node.classList.add(...ThemeIcon.asClassNameArray(icon));
return node;
}
var labelWithIconsRegex;
var init_iconLabels = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js"() {
init_dom();
init_themables();
labelWithIconsRegex = new RegExp(`(\\\\)?\\$\\((${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?)\\)`, "g");
}
});
// node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js
function getKoreanAltChars(code) {
const result = disassembleKorean(code);
if (result && result.length > 0) {
return new Uint32Array(result);
}
return void 0;
}
function disassembleKorean(code) {
codeBufferLength = 0;
getCodesFromArray(
code,
modernConsonants,
4352
/* HangulRangeStartCode.InitialConsonant */
);
if (codeBufferLength > 0) {
return codeBuffer.subarray(0, codeBufferLength);
}
getCodesFromArray(
code,
modernVowels,
4449
/* HangulRangeStartCode.Vowel */
);
if (codeBufferLength > 0) {
return codeBuffer.subarray(0, codeBufferLength);
}
getCodesFromArray(
code,
modernFinalConsonants,
4520
/* HangulRangeStartCode.FinalConsonant */
);
if (codeBufferLength > 0) {
return codeBuffer.subarray(0, codeBufferLength);
}
getCodesFromArray(
code,
compatibilityJamo,
12593
/* HangulRangeStartCode.CompatibilityJamo */
);
if (codeBufferLength) {
return codeBuffer.subarray(0, codeBufferLength);
}
if (code >= 44032 && code <= 55203) {
const hangulIndex = code - 44032;
const vowelAndFinalConsonantProduct = hangulIndex % 588;
const initialConsonantIndex = Math.floor(hangulIndex / 588);
const vowelIndex = Math.floor(vowelAndFinalConsonantProduct / 28);
const finalConsonantIndex = vowelAndFinalConsonantProduct % 28 - 1;
if (initialConsonantIndex < modernConsonants.length) {
getCodesFromArray(initialConsonantIndex, modernConsonants, 0);
} else if (4352 + initialConsonantIndex - 12593 < compatibilityJamo.length) {
getCodesFromArray(
4352 + initialConsonantIndex,
compatibilityJamo,
12593
/* HangulRangeStartCode.CompatibilityJamo */
);
}
if (vowelIndex < modernVowels.length) {
getCodesFromArray(vowelIndex, modernVowels, 0);
} else if (4449 + vowelIndex - 12593 < compatibilityJamo.length) {
getCodesFromArray(
4449 + vowelIndex - 12593,
compatibilityJamo,
12593
/* HangulRangeStartCode.CompatibilityJamo */
);
}
if (finalConsonantIndex >= 0) {
if (finalConsonantIndex < modernFinalConsonants.length) {
getCodesFromArray(finalConsonantIndex, modernFinalConsonants, 0);
} else if (4520 + finalConsonantIndex - 12593 < compatibilityJamo.length) {
getCodesFromArray(
4520 + finalConsonantIndex - 12593,
compatibilityJamo,
12593
/* HangulRangeStartCode.CompatibilityJamo */
);
}
}
if (codeBufferLength > 0) {
return codeBuffer.subarray(0, codeBufferLength);
}
}
return void 0;
}
function getCodesFromArray(code, array2, arrayStartIndex) {
if (code >= arrayStartIndex && code < arrayStartIndex + array2.length) {
addCodesToBuffer(array2[code - arrayStartIndex]);
}
}
function addCodesToBuffer(codes) {
if (codes === 0) {
return;
}
codeBuffer[codeBufferLength++] = codes & 255;
if (codes >> 8) {
codeBuffer[codeBufferLength++] = codes >> 8 & 255;
}
if (codes >> 16) {
codeBuffer[codeBufferLength++] = codes >> 16 & 255;
}
}
var codeBufferLength, codeBuffer, modernConsonants, modernVowels, modernFinalConsonants, compatibilityJamo;
var init_korean = __esm({
"node_modules/monaco-editor/esm/vs/base/common/naturalLanguage/korean.js"() {
codeBufferLength = 0;
codeBuffer = new Uint32Array(10);
modernConsonants = new Uint8Array([
114,
// ㄱ
82,
// ㄲ
115,
// ㄴ
101,
// ㄷ
69,
// ㄸ
102,
// ㄹ
97,
// ㅁ
113,
// ㅂ
81,
// ㅃ
116,
// ㅅ
84,
// ㅆ
100,
// ㅇ
119,
// ㅈ
87,
// ㅉ
99,
// ㅊ
122,
// ㅋ
120,
// ㅌ
118,
// ㅍ
103
// ㅎ
]);
modernVowels = new Uint16Array([
107,
// -> ㅏ
111,
// -> ㅐ
105,
// -> ㅑ
79,
// -> ㅒ
106,
// -> ㅓ
112,
// -> ㅔ
117,
// -> ㅕ
80,
// -> ㅖ
104,
// -> ㅗ
27496,
// -> ㅘ
28520,
// -> ㅙ
27752,
// -> ㅚ
121,
// -> ㅛ
110,
// -> ㅜ
27246,
// -> ㅝ
28782,
// -> ㅞ
27758,
// -> ㅟ
98,
// -> ㅠ
109,
// -> ㅡ
27757,
// -> ㅢ
108
// -> ㅣ
]);
modernFinalConsonants = 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
// ㅎ
]);
compatibilityJamo = 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
// ㅣ
// HF: Hangul Filler (everything after this is archaic)
// ㅥ
// ㅦ
// ㅧ
// ㅨ
// ㅩ
// ㅪ
// ㅫ
// ㅬ
// ㅮ
// ㅯ
// ㅰ
// ㅱ
// ㅲ
// ㅳ
// ㅴ
// ㅵ
// ㅶ
// ㅷ
// ㅸ
// ㅹ
// ㅺ
// ㅻ
// ㅼ
// ㅽ
// ㅾ
// ㅿ
// ㆀ
// ㆁ
// ㆂ
// ㆃ
// ㆄ
// ㆅ
// ㆆ
// ㆇ
// ㆈ
// ㆉ
// ㆊ
// ㆋ
// ㆌ
// ㆍ
// ㆎ
]);
}
});
// node_modules/monaco-editor/esm/vs/base/common/filters.js
function or(...filter) {
return function(word, wordToMatchAgainst) {
for (let i = 0, len = filter.length; i < len; i++) {
const match2 = filter[i](word, wordToMatchAgainst);
if (match2) {
return match2;
}
}
return null;
};
}
function _matchesPrefix(ignoreCase, word, wordToMatchAgainst) {
if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {
return null;
}
let matches2;
if (ignoreCase) {
matches2 = startsWithIgnoreCase(wordToMatchAgainst, word);
} else {
matches2 = wordToMatchAgainst.indexOf(word) === 0;
}
if (!matches2) {
return null;
}
return word.length > 0 ? [{ start: 0, end: word.length }] : [];
}
function matchesContiguousSubString(word, wordToMatchAgainst) {
const index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
if (index === -1) {
return null;
}
return [{ start: index, end: index + word.length }];
}
function matchesSubString(word, wordToMatchAgainst) {
return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0);
}
function _matchesSubString(word, wordToMatchAgainst, i, j) {
if (i === word.length) {
return [];
} else if (j === wordToMatchAgainst.length) {
return null;
} else {
if (word[i] === wordToMatchAgainst[j]) {
let result = null;
if (result = _matchesSubString(word, wordToMatchAgainst, i + 1, j + 1)) {
return join({ start: j, end: j + 1 }, result);
}
return null;
}
return _matchesSubString(word, wordToMatchAgainst, i, j + 1);
}
}
function isLower(code) {
return 97 <= code && code <= 122;
}
function isUpper(code) {
return 65 <= code && code <= 90;
}
function isNumber2(code) {
return 48 <= code && code <= 57;
}
function isWhitespace(code) {
return code === 32 || code === 9 || code === 10 || code === 13;
}
function isWordSeparator(code) {
return isWhitespace(code) || wordSeparators.has(code);
}
function charactersMatch(codeA, codeB) {
return codeA === codeB || isWordSeparator(codeA) && isWordSeparator(codeB);
}
function getAlternateCodes(code) {
if (alternateCharsCache.has(code)) {
return alternateCharsCache.get(code);
}
let result;
const codes = getKoreanAltChars(code);
if (codes) {
result = codes;
}
alternateCharsCache.set(code, result);
return result;
}
function isAlphanumeric(code) {
return isLower(code) || isUpper(code) || isNumber2(code);
}
function join(head, tail3) {
if (tail3.length === 0) {
tail3 = [head];
} else if (head.end === tail3[0].start) {
tail3[0].start = head.start;
} else {
tail3.unshift(head);
}
return tail3;
}
function nextAnchor(camelCaseWord, start) {
for (let i = start; i < camelCaseWord.length; i++) {
const c = camelCaseWord.charCodeAt(i);
if (isUpper(c) || isNumber2(c) || i > 0 && !isAlphanumeric(camelCaseWord.charCodeAt(i - 1))) {
return i;
}
}
return camelCaseWord.length;
}
function _matchesCamelCase(word, camelCaseWord, i, j) {
if (i === word.length) {
return [];
} else if (j === camelCaseWord.length) {
return null;
} else if (word[i] !== camelCaseWord[j].toLowerCase()) {
return null;
} else {
let result = null;
let nextUpperIndex = j + 1;
result = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1);
while (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) {
result = _matchesCamelCase(word, camelCaseWord, i + 1, nextUpperIndex);
nextUpperIndex++;
}
return result === null ? null : join({ start: j, end: j + 1 }, result);
}
}
function analyzeCamelCaseWord(word) {
let upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;
for (let i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) {
upper++;
}
if (isLower(code)) {
lower++;
}
if (isAlphanumeric(code)) {
alpha++;
}
if (isNumber2(code)) {
numeric++;
}
}
const upperPercent = upper / word.length;
const lowerPercent = lower / word.length;
const alphaPercent = alpha / word.length;
const numericPercent = numeric / word.length;
return { upperPercent, lowerPercent, alphaPercent, numericPercent };
}
function isUpperCaseWord(analysis) {
const { upperPercent, lowerPercent } = analysis;
return lowerPercent === 0 && upperPercent > 0.6;
}
function isCamelCaseWord(analysis) {
const { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis;
return lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2;
}
function isCamelCasePattern(word) {
let upper = 0, lower = 0, code = 0, whitespace = 0;
for (let i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) {
upper++;
}
if (isLower(code)) {
lower++;
}
if (isWhitespace(code)) {
whitespace++;
}
}
if ((upper === 0 || lower === 0) && whitespace === 0) {
return word.length <= 30;
} else {
return upper <= 5;
}
}
function matchesCamelCase(word, camelCaseWord) {
if (!camelCaseWord) {
return null;
}
camelCaseWord = camelCaseWord.trim();
if (camelCaseWord.length === 0) {
return null;
}
if (!isCamelCasePattern(word)) {
return null;
}
if (camelCaseWord.length > 60) {
camelCaseWord = camelCaseWord.substring(0, 60);
}
const analysis = analyzeCamelCaseWord(camelCaseWord);
if (!isCamelCaseWord(analysis)) {
if (!isUpperCaseWord(analysis)) {
return null;
}
camelCaseWord = camelCaseWord.toLowerCase();
}
let result = null;
let i = 0;
word = word.toLowerCase();
while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) {
i = nextAnchor(camelCaseWord, i + 1);
}
return result;
}
function matchesWords(word, target, contiguous = false) {
if (!target || target.length === 0) {
return null;
}
let result = null;
let targetIndex = 0;
word = word.toLowerCase();
target = target.toLowerCase();
while (targetIndex < target.length) {
result = _matchesWords(word, target, 0, targetIndex, contiguous);
if (result !== null) {
break;
}
targetIndex = nextWord(target, targetIndex + 1);
}
return result;
}
function _matchesWords(word, target, wordIndex, targetIndex, contiguous) {
let targetIndexOffset = 0;
if (wordIndex === word.length) {
return [];
} else if (targetIndex === target.length) {
return null;
} else if (!charactersMatch(word.charCodeAt(wordIndex), target.charCodeAt(targetIndex))) {
const altChars = getAlternateCodes(word.charCodeAt(wordIndex));
if (!altChars) {
return null;
}
for (let k = 0; k < altChars.length; k++) {
if (!charactersMatch(altChars[k], target.charCodeAt(targetIndex + k))) {
return null;
}
}
targetIndexOffset += altChars.length - 1;
}
let result = null;
let nextWordIndex = targetIndex + targetIndexOffset + 1;
result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);
if (!contiguous) {
while (!result && (nextWordIndex = nextWord(target, nextWordIndex)) < target.length) {
result = _matchesWords(word, target, wordIndex + 1, nextWordIndex, contiguous);
nextWordIndex++;
}
}
if (!result) {
return null;
}
if (word.charCodeAt(wordIndex) !== target.charCodeAt(targetIndex)) {
const altChars = getAlternateCodes(word.charCodeAt(wordIndex));
if (!altChars) {
return result;
}
for (let k = 0; k < altChars.length; k++) {
if (altChars[k] !== target.charCodeAt(targetIndex + k)) {
return result;
}
}
}
return join({ start: targetIndex, end: targetIndex + targetIndexOffset + 1 }, result);
}
function nextWord(word, start) {
for (let i = start; i < word.length; i++) {
if (isWordSeparator(word.charCodeAt(i)) || i > 0 && isWordSeparator(word.charCodeAt(i - 1))) {
return i;
}
}
return word.length;
}
function matchesFuzzy(word, wordToMatchAgainst, enableSeparateSubstringMatching = false) {
if (typeof word !== "string" || typeof wordToMatchAgainst !== "string") {
return null;
}
let regexp = fuzzyRegExpCache.get(word);
if (!regexp) {
regexp = new RegExp(convertSimple2RegExpPattern(word), "i");
fuzzyRegExpCache.set(word, regexp);
}
const match2 = regexp.exec(wordToMatchAgainst);
if (match2) {
return [{ start: match2.index, end: match2.index + match2[0].length }];
}
return enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst);
}
function matchesFuzzy2(pattern, word) {
const score3 = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
return score3 ? createMatches(score3) : null;
}
function anyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos) {
const max = Math.min(13, pattern.length);
for (; patternPos < max; patternPos++) {
const result = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, { firstMatchCanBeWeak: true, boostFullMatch: true });
if (result) {
return result;
}
}
return [0, wordPos];
}
function createMatches(score3) {
if (typeof score3 === "undefined") {
return [];
}
const res = [];
const wordPos = score3[1];
for (let i = score3.length - 1; i > 1; i--) {
const pos = score3[i] + wordPos;
const last = res[res.length - 1];
if (last && last.end === pos) {
last.end = pos + 1;
} else {
res.push({ start: pos, end: pos + 1 });
}
}
return res;
}
function initTable() {
const table = [];
const row = [];
for (let i = 0; i <= _maxLen; i++) {
row[i] = 0;
}
for (let i = 0; i <= _maxLen; i++) {
table.push(row.slice(0));
}
return table;
}
function initArr(maxLen) {
const row = [];
for (let i = 0; i <= maxLen; i++) {
row[i] = 0;
}
return row;
}
function printTable(table, pattern, patternLen, word, wordLen) {
function pad(s, n, pad2 = " ") {
while (s.length < n) {
s = pad2 + s;
}
return s;
}
let ret = ` | |${word.split("").map((c) => pad(c, 3)).join("|")}
`;
for (let i = 0; i <= patternLen; i++) {
if (i === 0) {
ret += " |";
} else {
ret += `${pattern[i - 1]}|`;
}
ret += table[i].slice(0, wordLen + 1).map((n) => pad(n.toString(), 3)).join("|") + "\n";
}
return ret;
}
function printTables(pattern, patternStart, word, wordStart) {
pattern = pattern.substr(patternStart);
word = word.substr(wordStart);
console.log(printTable(_table, pattern, pattern.length, word, word.length));
console.log(printTable(_arrows, pattern, pattern.length, word, word.length));
console.log(printTable(_diag, pattern, pattern.length, word, word.length));
}
function isSeparatorAtPos(value, index) {
if (index < 0 || index >= value.length) {
return false;
}
const code = value.codePointAt(index);
switch (code) {
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 true;
case void 0:
return false;
default:
if (isEmojiImprecise(code)) {
return true;
}
return false;
}
}
function isWhitespaceAtPos(value, index) {
if (index < 0 || index >= value.length) {
return false;
}
const code = value.charCodeAt(index);
switch (code) {
case 32:
case 9:
return true;
default:
return false;
}
}
function isUpperCaseAtPos(pos, word, wordLow) {
return word[pos] !== wordLow[pos];
}
function isPatternInWord(patternLow, patternPos, patternLen, wordLow, wordPos, wordLen, fillMinWordPosArr = false) {
while (patternPos < patternLen && wordPos < wordLen) {
if (patternLow[patternPos] === wordLow[wordPos]) {
if (fillMinWordPosArr) {
_minWordMatchPos[patternPos] = wordPos;
}
patternPos += 1;
}
wordPos += 1;
}
return patternPos === patternLen;
}
function fuzzyScore(pattern, patternLow, patternStart, word, wordLow, wordStart, options2 = FuzzyScoreOptions.default) {
const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length;
const wordLen = word.length > _maxLen ? _maxLen : word.length;
if (patternStart >= patternLen || wordStart >= wordLen || patternLen - patternStart > wordLen - wordStart) {
return void 0;
}
if (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen, true)) {
return void 0;
}
_fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow);
let row = 1;
let column = 1;
let patternPos = patternStart;
let wordPos = wordStart;
const hasStrongFirstMatch = [false];
for (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) {
const minWordMatchPos = _minWordMatchPos[patternPos];
const maxWordMatchPos = _maxWordMatchPos[patternPos];
const nextMaxWordMatchPos = patternPos + 1 < patternLen ? _maxWordMatchPos[patternPos + 1] : wordLen;
for (column = minWordMatchPos - wordStart + 1, wordPos = minWordMatchPos; wordPos < nextMaxWordMatchPos; column++, wordPos++) {
let score3 = Number.MIN_SAFE_INTEGER;
let canComeDiag = false;
if (wordPos <= maxWordMatchPos) {
score3 = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, _diag[row - 1][column - 1] === 0, hasStrongFirstMatch);
}
let diagScore = 0;
if (score3 !== Number.MAX_SAFE_INTEGER) {
canComeDiag = true;
diagScore = score3 + _table[row - 1][column - 1];
}
const canComeLeft = wordPos > minWordMatchPos;
const leftScore = canComeLeft ? _table[row][column - 1] + (_diag[row][column - 1] > 0 ? -5 : 0) : 0;
const canComeLeftLeft = wordPos > minWordMatchPos + 1 && _diag[row][column - 1] > 0;
const leftLeftScore = canComeLeftLeft ? _table[row][column - 2] + (_diag[row][column - 2] > 0 ? -5 : 0) : 0;
if (canComeLeftLeft && (!canComeLeft || leftLeftScore >= leftScore) && (!canComeDiag || leftLeftScore >= diagScore)) {
_table[row][column] = leftLeftScore;
_arrows[row][column] = 3;
_diag[row][column] = 0;
} else if (canComeLeft && (!canComeDiag || leftScore >= diagScore)) {
_table[row][column] = leftScore;
_arrows[row][column] = 2;
_diag[row][column] = 0;
} else if (canComeDiag) {
_table[row][column] = diagScore;
_arrows[row][column] = 1;
_diag[row][column] = _diag[row - 1][column - 1] + 1;
} else {
throw new Error(`not possible`);
}
}
}
if (_debug) {
printTables(pattern, patternStart, word, wordStart);
}
if (!hasStrongFirstMatch[0] && !options2.firstMatchCanBeWeak) {
return void 0;
}
row--;
column--;
const result = [_table[row][column], wordStart];
let backwardsDiagLength = 0;
let maxMatchColumn = 0;
while (row >= 1) {
let diagColumn = column;
do {
const arrow = _arrows[row][diagColumn];
if (arrow === 3) {
diagColumn = diagColumn - 2;
} else if (arrow === 2) {
diagColumn = diagColumn - 1;
} else {
break;
}
} while (diagColumn >= 1);
if (backwardsDiagLength > 1 && patternLow[patternStart + row - 1] === wordLow[wordStart + column - 1] && !isUpperCaseAtPos(diagColumn + wordStart - 1, word, wordLow) && backwardsDiagLength + 1 > _diag[row][diagColumn]) {
diagColumn = column;
}
if (diagColumn === column) {
backwardsDiagLength++;
} else {
backwardsDiagLength = 1;
}
if (!maxMatchColumn) {
maxMatchColumn = diagColumn;
}
row--;
column = diagColumn - 1;
result.push(column);
}
if (wordLen - wordStart === patternLen && options2.boostFullMatch) {
result[0] += 2;
}
const skippedCharsCount = maxMatchColumn - patternLen;
result[0] -= skippedCharsCount;
return result;
}
function _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow) {
let patternPos = patternLen - 1;
let wordPos = wordLen - 1;
while (patternPos >= patternStart && wordPos >= wordStart) {
if (patternLow[patternPos] === wordLow[wordPos]) {
_maxWordMatchPos[patternPos] = wordPos;
patternPos--;
}
wordPos--;
}
}
function _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos, wordLen, wordStart, newMatchStart, outFirstMatchStrong) {
if (patternLow[patternPos] !== wordLow[wordPos]) {
return Number.MIN_SAFE_INTEGER;
}
let score3 = 1;
let isGapLocation = false;
if (wordPos === patternPos - patternStart) {
score3 = pattern[patternPos] === word[wordPos] ? 7 : 5;
} else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) {
score3 = pattern[patternPos] === word[wordPos] ? 7 : 5;
isGapLocation = true;
} else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) {
score3 = 5;
} else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) {
score3 = 5;
isGapLocation = true;
}
if (score3 > 1 && patternPos === patternStart) {
outFirstMatchStrong[0] = true;
}
if (!isGapLocation) {
isGapLocation = isUpperCaseAtPos(wordPos, word, wordLow) || isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1);
}
if (patternPos === patternStart) {
if (wordPos > wordStart) {
score3 -= isGapLocation ? 3 : 5;
}
} else {
if (newMatchStart) {
score3 += isGapLocation ? 2 : 0;
} else {
score3 += isGapLocation ? 0 : 1;
}
}
if (wordPos + 1 === wordLen) {
score3 -= isGapLocation ? 3 : 5;
}
return score3;
}
function fuzzyScoreGracefulAggressive(pattern, lowPattern, patternPos, word, lowWord, wordPos, options2) {
return fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, true, options2);
}
function fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, aggressive, options2) {
let top = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, options2);
if (top && !aggressive) {
return top;
}
if (pattern.length >= 3) {
const tries = Math.min(7, pattern.length - 1);
for (let movingPatternPos = patternPos + 1; movingPatternPos < tries; movingPatternPos++) {
const newPattern = nextTypoPermutation(pattern, movingPatternPos);
if (newPattern) {
const candidate = fuzzyScore(newPattern, newPattern.toLowerCase(), patternPos, word, lowWord, wordPos, options2);
if (candidate) {
candidate[0] -= 3;
if (!top || candidate[0] > top[0]) {
top = candidate;
}
}
}
}
}
return top;
}
function nextTypoPermutation(pattern, patternPos) {
if (patternPos + 1 >= pattern.length) {
return void 0;
}
const swap1 = pattern[patternPos];
const swap2 = pattern[patternPos + 1];
if (swap1 === swap2) {
return void 0;
}
return pattern.slice(0, patternPos) + swap2 + swap1 + pattern.slice(patternPos + 2);
}
var matchesStrictPrefix, matchesPrefix, wordSeparators, alternateCharsCache, fuzzyContiguousFilter, fuzzySeparateFilter, fuzzyRegExpCache, _maxLen, _minWordMatchPos, _maxWordMatchPos, _diag, _table, _arrows, _debug, FuzzyScore, FuzzyScoreOptions;
var init_filters = __esm({
"node_modules/monaco-editor/esm/vs/base/common/filters.js"() {
init_map();
init_korean();
init_strings();
matchesStrictPrefix = _matchesPrefix.bind(void 0, false);
matchesPrefix = _matchesPrefix.bind(void 0, true);
wordSeparators = /* @__PURE__ */ new Set();
"()[]{}<>`'\"-/;:,.?!".split("").forEach((s) => wordSeparators.add(s.charCodeAt(0)));
alternateCharsCache = /* @__PURE__ */ new Map();
fuzzyContiguousFilter = or(matchesPrefix, matchesCamelCase, matchesContiguousSubString);
fuzzySeparateFilter = or(matchesPrefix, matchesCamelCase, matchesSubString);
fuzzyRegExpCache = new LRUCache(1e4);
_maxLen = 128;
_minWordMatchPos = initArr(2 * _maxLen);
_maxWordMatchPos = initArr(2 * _maxLen);
_diag = initTable();
_table = initTable();
_arrows = initTable();
_debug = false;
(function(FuzzyScore2) {
FuzzyScore2.Default = [-100, 0];
function isDefault(score3) {
return !score3 || score3.length === 2 && score3[0] === -100 && score3[1] === 0;
}
FuzzyScore2.isDefault = isDefault;
})(FuzzyScore || (FuzzyScore = {}));
FuzzyScoreOptions = class {
constructor(firstMatchCanBeWeak, boostFullMatch) {
this.firstMatchCanBeWeak = firstMatchCanBeWeak;
this.boostFullMatch = boostFullMatch;
}
};
FuzzyScoreOptions.default = { boostFullMatch: true, firstMatchCanBeWeak: false };
}
});
// node_modules/monaco-editor/esm/vs/base/common/iconLabels.js
function escapeIcons(text2) {
return text2.replace(escapeIconsRegex, (match2, escaped) => escaped ? match2 : `\\${match2}`);
}
function markdownEscapeEscapedIcons(text2) {
return text2.replace(markdownEscapedIconsRegex, (match2) => `\\${match2}`);
}
function stripIcons(text2) {
if (text2.indexOf(iconStartMarker) === -1) {
return text2;
}
return text2.replace(stripIconsRegex, (match2, preWhitespace, escaped, postWhitespace) => escaped ? match2 : preWhitespace || postWhitespace || "");
}
function getCodiconAriaLabel(text2) {
if (!text2) {
return "";
}
return text2.replace(/\$\((.*?)\)/g, (_match, codiconName) => ` ${codiconName} `).trim();
}
function parseLabelWithIcons(input) {
_parseIconsRegex.lastIndex = 0;
let text2 = "";
const iconOffsets = [];
let iconsOffset = 0;
while (true) {
const pos = _parseIconsRegex.lastIndex;
const match2 = _parseIconsRegex.exec(input);
const chars = input.substring(pos, match2 === null || match2 === void 0 ? void 0 : match2.index);
if (chars.length > 0) {
text2 += chars;
for (let i = 0; i < chars.length; i++) {
iconOffsets.push(iconsOffset);
}
}
if (!match2) {
break;
}
iconsOffset += match2[0].length;
}
return { text: text2, iconOffsets };
}
function matchesFuzzyIconAware(query, target, enableSeparateSubstringMatching = false) {
const { text: text2, iconOffsets } = target;
if (!iconOffsets || iconOffsets.length === 0) {
return matchesFuzzy(query, text2, enableSeparateSubstringMatching);
}
const wordToMatchAgainstWithoutIconsTrimmed = ltrim(text2, " ");
const leadingWhitespaceOffset = text2.length - wordToMatchAgainstWithoutIconsTrimmed.length;
const matches2 = matchesFuzzy(query, wordToMatchAgainstWithoutIconsTrimmed, enableSeparateSubstringMatching);
if (matches2) {
for (const match2 of matches2) {
const iconOffset = iconOffsets[match2.start + leadingWhitespaceOffset] + leadingWhitespaceOffset;
match2.start += iconOffset;
match2.end += iconOffset;
}
}
return matches2;
}
var iconStartMarker, iconsRegex, escapeIconsRegex, markdownEscapedIconsRegex, stripIconsRegex, _parseIconsRegex;
var init_iconLabels2 = __esm({
"node_modules/monaco-editor/esm/vs/base/common/iconLabels.js"() {
init_filters();
init_strings();
init_themables();
iconStartMarker = "$(";
iconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameExpression}(?:${ThemeIcon.iconModifierExpression})?\\)`, "g");
escapeIconsRegex = new RegExp(`(\\\\)?${iconsRegex.source}`, "g");
markdownEscapedIconsRegex = new RegExp(`\\\\${iconsRegex.source}`, "g");
stripIconsRegex = new RegExp(`(\\s)?(\\\\)?${iconsRegex.source}(\\s)?`, "g");
_parseIconsRegex = new RegExp(`\\$\\(${ThemeIcon.iconNameCharacter}+\\)`, "g");
}
});
// node_modules/monaco-editor/esm/vs/base/common/htmlContent.js
function isEmptyMarkdownString(oneOrMany) {
if (isMarkdownString(oneOrMany)) {
return !oneOrMany.value;
} else if (Array.isArray(oneOrMany)) {
return oneOrMany.every(isEmptyMarkdownString);
} else {
return true;
}
}
function isMarkdownString(thing) {
if (thing instanceof MarkdownString) {
return true;
} else if (thing && typeof thing === "object") {
return typeof thing.value === "string" && (typeof thing.isTrusted === "boolean" || typeof thing.isTrusted === "object" || thing.isTrusted === void 0) && (typeof thing.supportThemeIcons === "boolean" || thing.supportThemeIcons === void 0);
}
return false;
}
function markdownStringEqual(a3, b) {
if (a3 === b) {
return true;
} else if (!a3 || !b) {
return false;
} else {
return a3.value === b.value && a3.isTrusted === b.isTrusted && a3.supportThemeIcons === b.supportThemeIcons && a3.supportHtml === b.supportHtml && (a3.baseUri === b.baseUri || !!a3.baseUri && !!b.baseUri && isEqual(URI.from(a3.baseUri), URI.from(b.baseUri)));
}
}
function escapeMarkdownSyntaxTokens(text2) {
return text2.replace(/[\\`*_{}[\]()#+\-!~]/g, "\\$&");
}
function appendEscapedMarkdownCodeBlockFence(code, langId) {
var _a10, _b4;
const longestFenceLength = (_b4 = (_a10 = code.match(/^`+/gm)) === null || _a10 === void 0 ? void 0 : _a10.reduce((a3, b) => a3.length > b.length ? a3 : b).length) !== null && _b4 !== void 0 ? _b4 : 0;
const desiredFenceLength = longestFenceLength >= 3 ? longestFenceLength + 1 : 3;
return [
`${"`".repeat(desiredFenceLength)}${langId}`,
code,
`${"`".repeat(desiredFenceLength)}`
].join("\n");
}
function escapeDoubleQuotes(input) {
return input.replace(/"/g, """);
}
function removeMarkdownEscapes(text2) {
if (!text2) {
return text2;
}
return text2.replace(/\\([\\`*_{}[\]()#+\-.!~])/g, "$1");
}
function parseHrefAndDimensions(href) {
const dimensions = [];
const splitted = href.split("|").map((s) => s.trim());
href = splitted[0];
const parameters = splitted[1];
if (parameters) {
const heightFromParams = /height=(\d+)/.exec(parameters);
const widthFromParams = /width=(\d+)/.exec(parameters);
const height = heightFromParams ? heightFromParams[1] : "";
const width2 = widthFromParams ? widthFromParams[1] : "";
const widthIsFinite = isFinite(parseInt(width2));
const heightIsFinite = isFinite(parseInt(height));
if (widthIsFinite) {
dimensions.push(`width="${width2}"`);
}
if (heightIsFinite) {
dimensions.push(`height="${height}"`);
}
}
return { href, dimensions };
}
var MarkdownString;
var init_htmlContent = __esm({
"node_modules/monaco-editor/esm/vs/base/common/htmlContent.js"() {
init_errors();
init_iconLabels2();
init_resources();
init_strings();
init_uri();
MarkdownString = class {
constructor(value = "", isTrustedOrOptions = false) {
var _a10, _b4, _c2;
this.value = value;
if (typeof this.value !== "string") {
throw illegalArgument("value");
}
if (typeof isTrustedOrOptions === "boolean") {
this.isTrusted = isTrustedOrOptions;
this.supportThemeIcons = false;
this.supportHtml = false;
} else {
this.isTrusted = (_a10 = isTrustedOrOptions.isTrusted) !== null && _a10 !== void 0 ? _a10 : void 0;
this.supportThemeIcons = (_b4 = isTrustedOrOptions.supportThemeIcons) !== null && _b4 !== void 0 ? _b4 : false;
this.supportHtml = (_c2 = isTrustedOrOptions.supportHtml) !== null && _c2 !== void 0 ? _c2 : false;
}
}
appendText(value, newlineStyle = 0) {
this.value += escapeMarkdownSyntaxTokens(this.supportThemeIcons ? escapeIcons(value) : value).replace(/([ \t]+)/g, (_match, g1) => " ".repeat(g1.length)).replace(/\>/gm, "\\>").replace(/\n/g, newlineStyle === 1 ? "\\\n" : "\n\n");
return this;
}
appendMarkdown(value) {
this.value += value;
return this;
}
appendCodeblock(langId, code) {
this.value += `
${appendEscapedMarkdownCodeBlockFence(code, langId)}
`;
return this;
}
appendLink(target, label, title) {
this.value += "[";
this.value += this._escape(label, "]");
this.value += "](";
this.value += this._escape(String(target), ")");
if (title) {
this.value += ` "${this._escape(this._escape(title, '"'), ")")}"`;
}
this.value += ")";
return this;
}
_escape(value, ch) {
const r = new RegExp(escapeRegExpCharacters(ch), "g");
return value.replace(r, (match2, offset) => {
if (value.charAt(offset - 1) !== "\\") {
return `\\${match2}`;
} else {
return match2;
}
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/idGenerator.js
var IdGenerator, defaultGenerator;
var init_idGenerator = __esm({
"node_modules/monaco-editor/esm/vs/base/common/idGenerator.js"() {
IdGenerator = class {
constructor(prefix) {
this._prefix = prefix;
this._lastId = 0;
}
nextId() {
return this._prefix + ++this._lastId;
}
};
defaultGenerator = new IdGenerator("id#");
}
});
// node_modules/monaco-editor/esm/vs/base/common/marked/marked.js
var __marked_exports, Lexer, Parser3, Renderer, Slugger, TextRenderer, Tokenizer, getDefaults, lexer, marked, options, parse2, parseInline, parser, setOptions, use, walkTokens;
var init_marked = __esm({
"node_modules/monaco-editor/esm/vs/base/common/marked/marked.js"() {
__marked_exports = {};
(function() {
function define2(deps, factory) {
factory(__marked_exports);
}
define2.amd = true;
(function(global2, factory) {
typeof define2 === "function" && define2.amd ? define2(["exports"], factory) : typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.marked = {}));
})(this, function(exports2) {
"use strict";
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function getDefaults2() {
return {
async: false,
baseUrl: null,
breaks: false,
extensions: null,
gfm: true,
headerIds: true,
headerPrefix: "",
highlight: null,
langPrefix: "language-",
mangle: true,
pedantic: false,
renderer: null,
sanitize: false,
sanitizer: null,
silent: false,
smartLists: false,
smartypants: false,
tokenizer: null,
walkTokens: null,
xhtml: false
};
}
exports2.defaults = getDefaults2();
function changeDefaults(newDefaults) {
exports2.defaults = newDefaults;
}
var escapeTest = /[&<>"']/;
var escapeReplace = /[&<>"']/g;
var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
var escapeReplacements = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
var getEscapeReplacement = function getEscapeReplacement2(ch) {
return escapeReplacements[ch];
};
function escape2(html2, encode) {
if (encode) {
if (escapeTest.test(html2)) {
return html2.replace(escapeReplace, getEscapeReplacement);
}
} else {
if (escapeTestNoEncode.test(html2)) {
return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
}
}
return html2;
}
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function unescape3(html2) {
return html2.replace(unescapeTest, function(_, n) {
n = n.toLowerCase();
if (n === "colon") return ":";
if (n.charAt(0) === "#") {
return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
}
return "";
});
}
var caret = /(^|[^\[])\^/g;
function edit(regex, opt) {
regex = typeof regex === "string" ? regex : regex.source;
opt = opt || "";
var obj = {
replace: function replace(name, val) {
val = val.source || val;
val = val.replace(caret, "$1");
regex = regex.replace(name, val);
return obj;
},
getRegex: function getRegex() {
return new RegExp(regex, opt);
}
};
return obj;
}
var nonWordAndColonTest = /[^\w:]/g;
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
function cleanUrl(sanitize3, base, href) {
if (sanitize3) {
var prot;
try {
prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
} catch (e) {
return null;
}
if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
return null;
}
}
if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href);
}
try {
href = encodeURI(href).replace(/%25/g, "%");
} catch (e) {
return null;
}
return href;
}
var baseUrls = {};
var justDomain = /^[^:]+:\/*[^/]*$/;
var protocol = /^([^:]+:)[\s\S]*$/;
var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
function resolveUrl(base, href) {
if (!baseUrls[" " + base]) {
if (justDomain.test(base)) {
baseUrls[" " + base] = base + "/";
} else {
baseUrls[" " + base] = rtrim2(base, "/", true);
}
}
base = baseUrls[" " + base];
var relativeBase = base.indexOf(":") === -1;
if (href.substring(0, 2) === "//") {
if (relativeBase) {
return href;
}
return base.replace(protocol, "$1") + href;
} else if (href.charAt(0) === "/") {
if (relativeBase) {
return href;
}
return base.replace(domain, "$1") + href;
} else {
return base + href;
}
}
var noopTest = {
exec: function noopTest2() {
}
};
function merge(obj) {
var i = 1, target, key;
for (; i < arguments.length; i++) {
target = arguments[i];
for (key in target) {
if (Object.prototype.hasOwnProperty.call(target, key)) {
obj[key] = target[key];
}
}
}
return obj;
}
function splitCells(tableRow, count) {
var row = tableRow.replace(/\|/g, function(match2, offset, str) {
var escaped = false, curr = offset;
while (--curr >= 0 && str[curr] === "\\") {
escaped = !escaped;
}
if (escaped) {
return "|";
} else {
return " |";
}
}), cells = row.split(/ \|/);
var i = 0;
if (!cells[0].trim()) {
cells.shift();
}
if (cells.length > 0 && !cells[cells.length - 1].trim()) {
cells.pop();
}
if (cells.length > count) {
cells.splice(count);
} else {
while (cells.length < count) {
cells.push("");
}
}
for (; i < cells.length; i++) {
cells[i] = cells[i].trim().replace(/\\\|/g, "|");
}
return cells;
}
function rtrim2(str, c, invert) {
var l = str.length;
if (l === 0) {
return "";
}
var suffLen = 0;
while (suffLen < l) {
var currChar = str.charAt(l - suffLen - 1);
if (currChar === c && !invert) {
suffLen++;
} else if (currChar !== c && invert) {
suffLen++;
} else {
break;
}
}
return str.slice(0, l - suffLen);
}
function findClosingBracket(str, b) {
if (str.indexOf(b[1]) === -1) {
return -1;
}
var l = str.length;
var level = 0, i = 0;
for (; i < l; i++) {
if (str[i] === "\\") {
i++;
} else if (str[i] === b[0]) {
level++;
} else if (str[i] === b[1]) {
level--;
if (level < 0) {
return i;
}
}
}
return -1;
}
function checkSanitizeDeprecation(opt) {
if (opt && opt.sanitize && !opt.silent) {
console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
}
}
function repeatString(pattern, count) {
if (count < 1) {
return "";
}
var result = "";
while (count > 1) {
if (count & 1) {
result += pattern;
}
count >>= 1;
pattern += pattern;
}
return result + pattern;
}
function outputLink(cap, link, raw, lexer3) {
var href = link.href;
var title = link.title ? escape2(link.title) : null;
var text2 = cap[1].replace(/\\([\[\]])/g, "$1");
if (cap[0].charAt(0) !== "!") {
lexer3.state.inLink = true;
var token = {
type: "link",
raw,
href,
title,
text: text2,
tokens: lexer3.inlineTokens(text2)
};
lexer3.state.inLink = false;
return token;
}
return {
type: "image",
raw,
href,
title,
text: escape2(text2)
};
}
function indentCodeCompensation(raw, text2) {
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
if (matchIndentToCode === null) {
return text2;
}
var indentToCode = matchIndentToCode[1];
return text2.split("\n").map(function(node) {
var matchIndentInNode = node.match(/^\s+/);
if (matchIndentInNode === null) {
return node;
}
var indentInNode = matchIndentInNode[0];
if (indentInNode.length >= indentToCode.length) {
return node.slice(indentToCode.length);
}
return node;
}).join("\n");
}
var Tokenizer2 = /* @__PURE__ */ function() {
function Tokenizer3(options3) {
this.options = options3 || exports2.defaults;
}
var _proto = Tokenizer3.prototype;
_proto.space = function space(src) {
var cap = this.rules.block.newline.exec(src);
if (cap && cap[0].length > 0) {
return {
type: "space",
raw: cap[0]
};
}
};
_proto.code = function code(src) {
var cap = this.rules.block.code.exec(src);
if (cap) {
var text2 = cap[0].replace(/^ {1,4}/gm, "");
return {
type: "code",
raw: cap[0],
codeBlockStyle: "indented",
text: !this.options.pedantic ? rtrim2(text2, "\n") : text2
};
}
};
_proto.fences = function fences(src) {
var cap = this.rules.block.fences.exec(src);
if (cap) {
var raw = cap[0];
var text2 = indentCodeCompensation(raw, cap[3] || "");
return {
type: "code",
raw,
lang: cap[2] ? cap[2].trim() : cap[2],
text: text2
};
}
};
_proto.heading = function heading(src) {
var cap = this.rules.block.heading.exec(src);
if (cap) {
var text2 = cap[2].trim();
if (/#$/.test(text2)) {
var trimmed = rtrim2(text2, "#");
if (this.options.pedantic) {
text2 = trimmed.trim();
} else if (!trimmed || / $/.test(trimmed)) {
text2 = trimmed.trim();
}
}
return {
type: "heading",
raw: cap[0],
depth: cap[1].length,
text: text2,
tokens: this.lexer.inline(text2)
};
}
};
_proto.hr = function hr(src) {
var cap = this.rules.block.hr.exec(src);
if (cap) {
return {
type: "hr",
raw: cap[0]
};
}
};
_proto.blockquote = function blockquote(src) {
var cap = this.rules.block.blockquote.exec(src);
if (cap) {
var text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
return {
type: "blockquote",
raw: cap[0],
tokens: this.lexer.blockTokens(text2, []),
text: text2
};
}
};
_proto.list = function list(src) {
var cap = this.rules.block.list.exec(src);
if (cap) {
var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
var bull = cap[1].trim();
var isordered = bull.length > 1;
var list2 = {
type: "list",
raw: "",
ordered: isordered,
start: isordered ? +bull.slice(0, -1) : "",
loose: false,
items: []
};
bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
if (this.options.pedantic) {
bull = isordered ? bull : "[*+-]";
}
var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[ ][^\\n]*)?(?:\\n|$))");
while (src) {
endEarly = false;
if (!(cap = itemRegex.exec(src))) {
break;
}
if (this.rules.block.hr.test(src)) {
break;
}
raw = cap[0];
src = src.substring(raw.length);
line = cap[2].split("\n", 1)[0];
nextLine = src.split("\n", 1)[0];
if (this.options.pedantic) {
indent = 2;
itemContents = line.trimLeft();
} else {
indent = cap[2].search(/[^ ]/);
indent = indent > 4 ? 1 : indent;
itemContents = line.slice(indent);
indent += cap[1].length;
}
blankLine = false;
if (!line && /^ *$/.test(nextLine)) {
raw += nextLine + "\n";
src = src.substring(nextLine.length + 1);
endEarly = true;
}
if (!endEarly) {
var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))");
var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#");
while (src) {
rawLine = src.split("\n", 1)[0];
line = rawLine;
if (this.options.pedantic) {
line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
}
if (fencesBeginRegex.test(line)) {
break;
}
if (headingBeginRegex.test(line)) {
break;
}
if (nextBulletRegex.test(line)) {
break;
}
if (hrRegex.test(src)) {
break;
}
if (line.search(/[^ ]/) >= indent || !line.trim()) {
itemContents += "\n" + line.slice(indent);
} else if (!blankLine) {
itemContents += "\n" + line;
} else {
break;
}
if (!blankLine && !line.trim()) {
blankLine = true;
}
raw += rawLine + "\n";
src = src.substring(rawLine.length + 1);
}
}
if (!list2.loose) {
if (endsWithBlankLine) {
list2.loose = true;
} else if (/\n *\n *$/.test(raw)) {
endsWithBlankLine = true;
}
}
if (this.options.gfm) {
istask = /^\[[ xX]\] /.exec(itemContents);
if (istask) {
ischecked = istask[0] !== "[ ] ";
itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
}
}
list2.items.push({
type: "list_item",
raw,
task: !!istask,
checked: ischecked,
loose: false,
text: itemContents
});
list2.raw += raw;
}
list2.items[list2.items.length - 1].raw = raw.trimRight();
list2.items[list2.items.length - 1].text = itemContents.trimRight();
list2.raw = list2.raw.trimRight();
var l = list2.items.length;
for (i = 0; i < l; i++) {
this.lexer.state.top = false;
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
var spacers = list2.items[i].tokens.filter(function(t4) {
return t4.type === "space";
});
var hasMultipleLineBreaks = spacers.every(function(t4) {
var chars = t4.raw.split("");
var lineBreaks = 0;
for (var _iterator = _createForOfIteratorHelperLoose(chars), _step; !(_step = _iterator()).done; ) {
var _char = _step.value;
if (_char === "\n") {
lineBreaks += 1;
}
if (lineBreaks > 1) {
return true;
}
}
return false;
});
if (!list2.loose && spacers.length && hasMultipleLineBreaks) {
list2.loose = true;
list2.items[i].loose = true;
}
}
return list2;
}
};
_proto.html = function html2(src) {
var cap = this.rules.block.html.exec(src);
if (cap) {
var token = {
type: "html",
raw: cap[0],
pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
text: cap[0]
};
if (this.options.sanitize) {
var text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape2(cap[0]);
token.type = "paragraph";
token.text = text2;
token.tokens = this.lexer.inline(text2);
}
return token;
}
};
_proto.def = function def(src) {
var cap = this.rules.block.def.exec(src);
if (cap) {
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
var tag = cap[1].toLowerCase().replace(/\s+/g, " ");
return {
type: "def",
tag,
raw: cap[0],
href: cap[2],
title: cap[3]
};
}
};
_proto.table = function table(src) {
var cap = this.rules.block.table.exec(src);
if (cap) {
var item = {
type: "table",
header: splitCells(cap[1]).map(function(c) {
return {
text: c
};
}),
align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
};
if (item.header.length === item.align.length) {
item.raw = cap[0];
var l = item.align.length;
var i, j, k, row;
for (i = 0; i < l; i++) {
if (/^ *-+: *$/.test(item.align[i])) {
item.align[i] = "right";
} else if (/^ *:-+: *$/.test(item.align[i])) {
item.align[i] = "center";
} else if (/^ *:-+ *$/.test(item.align[i])) {
item.align[i] = "left";
} else {
item.align[i] = null;
}
}
l = item.rows.length;
for (i = 0; i < l; i++) {
item.rows[i] = splitCells(item.rows[i], item.header.length).map(function(c) {
return {
text: c
};
});
}
l = item.header.length;
for (j = 0; j < l; j++) {
item.header[j].tokens = this.lexer.inline(item.header[j].text);
}
l = item.rows.length;
for (j = 0; j < l; j++) {
row = item.rows[j];
for (k = 0; k < row.length; k++) {
row[k].tokens = this.lexer.inline(row[k].text);
}
}
return item;
}
}
};
_proto.lheading = function lheading(src) {
var cap = this.rules.block.lheading.exec(src);
if (cap) {
return {
type: "heading",
raw: cap[0],
depth: cap[2].charAt(0) === "=" ? 1 : 2,
text: cap[1],
tokens: this.lexer.inline(cap[1])
};
}
};
_proto.paragraph = function paragraph(src) {
var cap = this.rules.block.paragraph.exec(src);
if (cap) {
var text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
return {
type: "paragraph",
raw: cap[0],
text: text2,
tokens: this.lexer.inline(text2)
};
}
};
_proto.text = function text2(src) {
var cap = this.rules.block.text.exec(src);
if (cap) {
return {
type: "text",
raw: cap[0],
text: cap[0],
tokens: this.lexer.inline(cap[0])
};
}
};
_proto.escape = function escape$1(src) {
var cap = this.rules.inline.escape.exec(src);
if (cap) {
return {
type: "escape",
raw: cap[0],
text: escape2(cap[1])
};
}
};
_proto.tag = function tag(src) {
var cap = this.rules.inline.tag.exec(src);
if (cap) {
if (!this.lexer.state.inLink && /^/i.test(cap[0])) {
this.lexer.state.inLink = false;
}
if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
this.lexer.state.inRawBlock = true;
} else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
this.lexer.state.inRawBlock = false;
}
return {
type: this.options.sanitize ? "text" : "html",
raw: cap[0],
inLink: this.lexer.state.inLink,
inRawBlock: this.lexer.state.inRawBlock,
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape2(cap[0]) : cap[0]
};
}
};
_proto.link = function link(src) {
var cap = this.rules.inline.link.exec(src);
if (cap) {
var trimmedUrl = cap[2].trim();
if (!this.options.pedantic && /^$/.test(trimmedUrl)) {
return;
}
var rtrimSlash = rtrim2(trimmedUrl.slice(0, -1), "\\");
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
return;
}
} else {
var lastParenIndex = findClosingBracket(cap[2], "()");
if (lastParenIndex > -1) {
var start = cap[0].indexOf("!") === 0 ? 5 : 4;
var linkLen = start + cap[1].length + lastParenIndex;
cap[2] = cap[2].substring(0, lastParenIndex);
cap[0] = cap[0].substring(0, linkLen).trim();
cap[3] = "";
}
}
var href = cap[2];
var title = "";
if (this.options.pedantic) {
var link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
if (link2) {
href = link2[1];
title = link2[3];
}
} else {
title = cap[3] ? cap[3].slice(1, -1) : "";
}
href = href.trim();
if (/^$/.test(trimmedUrl)) {
href = href.slice(1);
} else {
href = href.slice(1, -1);
}
}
return outputLink(cap, {
href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
title: title ? title.replace(this.rules.inline._escapes, "$1") : title
}, cap[0], this.lexer);
}
};
_proto.reflink = function reflink(src, links) {
var cap;
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
var link = (cap[2] || cap[1]).replace(/\s+/g, " ");
link = links[link.toLowerCase()];
if (!link || !link.href) {
var text2 = cap[0].charAt(0);
return {
type: "text",
raw: text2,
text: text2
};
}
return outputLink(cap, link, cap[0], this.lexer);
}
};
_proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
if (prevChar === void 0) {
prevChar = "";
}
var match2 = this.rules.inline.emStrong.lDelim.exec(src);
if (!match2) return;
if (match2[3] && prevChar.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])/)) return;
var nextChar = match2[1] || match2[2] || "";
if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
var lLength = match2[0].length - 1;
var rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
var endReg = match2[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
endReg.lastIndex = 0;
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
while ((match2 = endReg.exec(maskedSrc)) != null) {
rDelim = match2[1] || match2[2] || match2[3] || match2[4] || match2[5] || match2[6];
if (!rDelim) continue;
rLength = rDelim.length;
if (match2[3] || match2[4]) {
delimTotal += rLength;
continue;
} else if (match2[5] || match2[6]) {
if (lLength % 3 && !((lLength + rLength) % 3)) {
midDelimTotal += rLength;
continue;
}
}
delimTotal -= rLength;
if (delimTotal > 0) continue;
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
if (Math.min(lLength, rLength) % 2) {
var _text = src.slice(1, lLength + match2.index + rLength);
return {
type: "em",
raw: src.slice(0, lLength + match2.index + rLength + 1),
text: _text,
tokens: this.lexer.inlineTokens(_text)
};
}
var text2 = src.slice(2, lLength + match2.index + rLength - 1);
return {
type: "strong",
raw: src.slice(0, lLength + match2.index + rLength + 1),
text: text2,
tokens: this.lexer.inlineTokens(text2)
};
}
}
};
_proto.codespan = function codespan(src) {
var cap = this.rules.inline.code.exec(src);
if (cap) {
var text2 = cap[2].replace(/\n/g, " ");
var hasNonSpaceChars = /[^ ]/.test(text2);
var hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
text2 = text2.substring(1, text2.length - 1);
}
text2 = escape2(text2, true);
return {
type: "codespan",
raw: cap[0],
text: text2
};
}
};
_proto.br = function br(src) {
var cap = this.rules.inline.br.exec(src);
if (cap) {
return {
type: "br",
raw: cap[0]
};
}
};
_proto.del = function del(src) {
var cap = this.rules.inline.del.exec(src);
if (cap) {
return {
type: "del",
raw: cap[0],
text: cap[2],
tokens: this.lexer.inlineTokens(cap[2])
};
}
};
_proto.autolink = function autolink(src, mangle2) {
var cap = this.rules.inline.autolink.exec(src);
if (cap) {
var text2, href;
if (cap[2] === "@") {
text2 = escape2(this.options.mangle ? mangle2(cap[1]) : cap[1]);
href = "mailto:" + text2;
} else {
text2 = escape2(cap[1]);
href = text2;
}
return {
type: "link",
raw: cap[0],
text: text2,
href,
tokens: [{
type: "text",
raw: text2,
text: text2
}]
};
}
};
_proto.url = function url(src, mangle2) {
var cap;
if (cap = this.rules.inline.url.exec(src)) {
var text2, href;
if (cap[2] === "@") {
text2 = escape2(this.options.mangle ? mangle2(cap[0]) : cap[0]);
href = "mailto:" + text2;
} else {
var prevCapZero;
do {
prevCapZero = cap[0];
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
} while (prevCapZero !== cap[0]);
text2 = escape2(cap[0]);
if (cap[1] === "www.") {
href = "http://" + text2;
} else {
href = text2;
}
}
return {
type: "link",
raw: cap[0],
text: text2,
href,
tokens: [{
type: "text",
raw: text2,
text: text2
}]
};
}
};
_proto.inlineText = function inlineText(src, smartypants2) {
var cap = this.rules.inline.text.exec(src);
if (cap) {
var text2;
if (this.lexer.state.inRawBlock) {
text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape2(cap[0]) : cap[0];
} else {
text2 = escape2(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
}
return {
type: "text",
raw: cap[0],
text: text2
};
}
};
return Tokenizer3;
}();
var block = {
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]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
table: noopTest,
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
// regex template, placeholders will be replaced according to different paragraph
// interruption rules of commonmark and the original markdown spec:
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
text: /^[^\n]+/
};
block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex();
block._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";
block._comment = /|$)/;
block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
block.paragraph = edit(block._paragraph).replace("hr", block.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", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
block.normal = merge({}, block);
block.gfm = merge({}, block.normal, {
table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
// Cells
});
block.gfm.table = edit(block.gfm.table).replace("hr", block.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", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
block.pedantic = merge({}, block.normal, {
html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", block._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: /^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
heading: /^(#{1,6})(.*)(?:\n+|$)/,
fences: noopTest,
// fences not supported
paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
});
var inline = {
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noopTest,
tag: "^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",
// CDATA section
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
reflink: /^!?\[(label)\]\[(ref)\]/,
nolink: /^!?\[(ref)\](?:\[\])?/,
reflinkSearch: "reflink|nolink(?!\\()",
emStrong: {
lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
// () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
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*])/
// ^- Not allowed for _
},
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noopTest,
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";
inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
inline.escapedEmSt = /\\\*|\\_/g;
inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
inline._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])?)+(?![-_])/;
inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
inline.normal = merge({}, inline);
inline.pedantic = merge({}, inline.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: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
});
inline.gfm = merge({}, inline.normal, {
escape: edit(inline.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]*?(?:(?=[\\ 0.5) {
ch = "x" + ch.toString(16);
}
out += "" + ch + ";";
}
return out;
}
var Lexer2 = /* @__PURE__ */ function() {
function Lexer3(options3) {
this.tokens = [];
this.tokens.links = /* @__PURE__ */ Object.create(null);
this.options = options3 || exports2.defaults;
this.options.tokenizer = this.options.tokenizer || new Tokenizer2();
this.tokenizer = this.options.tokenizer;
this.tokenizer.options = this.options;
this.tokenizer.lexer = this;
this.inlineQueue = [];
this.state = {
inLink: false,
inRawBlock: false,
top: true
};
var rules = {
block: block.normal,
inline: inline.normal
};
if (this.options.pedantic) {
rules.block = block.pedantic;
rules.inline = inline.pedantic;
} else if (this.options.gfm) {
rules.block = block.gfm;
if (this.options.breaks) {
rules.inline = inline.breaks;
} else {
rules.inline = inline.gfm;
}
}
this.tokenizer.rules = rules;
}
Lexer3.lex = function lex(src, options3) {
var lexer3 = new Lexer3(options3);
return lexer3.lex(src);
};
Lexer3.lexInline = function lexInline(src, options3) {
var lexer3 = new Lexer3(options3);
return lexer3.inlineTokens(src);
};
var _proto = Lexer3.prototype;
_proto.lex = function lex(src) {
src = src.replace(/\r\n|\r/g, "\n");
this.blockTokens(src, this.tokens);
var next;
while (next = this.inlineQueue.shift()) {
this.inlineTokens(next.src, next.tokens);
}
return this.tokens;
};
_proto.blockTokens = function blockTokens(src, tokens) {
var _this = this;
if (tokens === void 0) {
tokens = [];
}
if (this.options.pedantic) {
src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
} else {
src = src.replace(/^( *)(\t+)/gm, function(_, leading, tabs) {
return leading + " ".repeat(tabs.length);
});
}
var token, lastToken, cutSrc, lastParagraphClipped;
while (src) {
if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function(extTokenizer) {
if (token = extTokenizer.call({
lexer: _this
}, src, tokens)) {
src = src.substring(token.raw.length);
tokens.push(token);
return true;
}
return false;
})) {
continue;
}
if (token = this.tokenizer.space(src)) {
src = src.substring(token.raw.length);
if (token.raw.length === 1 && tokens.length > 0) {
tokens[tokens.length - 1].raw += "\n";
} else {
tokens.push(token);
}
continue;
}
if (token = this.tokenizer.code(src)) {
src = src.substring(token.raw.length);
lastToken = tokens[tokens.length - 1];
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
lastToken.raw += "\n" + token.raw;
lastToken.text += "\n" + token.text;
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
} else {
tokens.push(token);
}
continue;
}
if (token = this.tokenizer.fences(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.heading(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.hr(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.blockquote(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.list(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.html(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.def(src)) {
src = src.substring(token.raw.length);
lastToken = tokens[tokens.length - 1];
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
lastToken.raw += "\n" + token.raw;
lastToken.text += "\n" + token.raw;
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
} else if (!this.tokens.links[token.tag]) {
this.tokens.links[token.tag] = {
href: token.href,
title: token.title
};
}
continue;
}
if (token = this.tokenizer.table(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.lheading(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
cutSrc = src;
if (this.options.extensions && this.options.extensions.startBlock) {
(function() {
var startIndex = Infinity;
var tempSrc = src.slice(1);
var tempStart = void 0;
_this.options.extensions.startBlock.forEach(function(getStartIndex) {
tempStart = getStartIndex.call({
lexer: this
}, tempSrc);
if (typeof tempStart === "number" && tempStart >= 0) {
startIndex = Math.min(startIndex, tempStart);
}
});
if (startIndex < Infinity && startIndex >= 0) {
cutSrc = src.substring(0, startIndex + 1);
}
})();
}
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
lastToken = tokens[tokens.length - 1];
if (lastParagraphClipped && lastToken.type === "paragraph") {
lastToken.raw += "\n" + token.raw;
lastToken.text += "\n" + token.text;
this.inlineQueue.pop();
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
} else {
tokens.push(token);
}
lastParagraphClipped = cutSrc.length !== src.length;
src = src.substring(token.raw.length);
continue;
}
if (token = this.tokenizer.text(src)) {
src = src.substring(token.raw.length);
lastToken = tokens[tokens.length - 1];
if (lastToken && lastToken.type === "text") {
lastToken.raw += "\n" + token.raw;
lastToken.text += "\n" + token.text;
this.inlineQueue.pop();
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
} else {
tokens.push(token);
}
continue;
}
if (src) {
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
if (this.options.silent) {
console.error(errMsg);
break;
} else {
throw new Error(errMsg);
}
}
}
this.state.top = true;
return tokens;
};
_proto.inline = function inline2(src, tokens) {
if (tokens === void 0) {
tokens = [];
}
this.inlineQueue.push({
src,
tokens
});
return tokens;
};
_proto.inlineTokens = function inlineTokens(src, tokens) {
var _this2 = this;
if (tokens === void 0) {
tokens = [];
}
var token, lastToken, cutSrc;
var maskedSrc = src;
var match2;
var keepPrevChar, prevChar;
if (this.tokens.links) {
var links = Object.keys(this.tokens.links);
if (links.length > 0) {
while ((match2 = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
if (links.includes(match2[0].slice(match2[0].lastIndexOf("[") + 1, -1))) {
maskedSrc = maskedSrc.slice(0, match2.index) + "[" + repeatString("a", match2[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
}
}
}
}
while ((match2 = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
maskedSrc = maskedSrc.slice(0, match2.index) + "[" + repeatString("a", match2[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
}
while ((match2 = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
maskedSrc = maskedSrc.slice(0, match2.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
}
while (src) {
if (!keepPrevChar) {
prevChar = "";
}
keepPrevChar = false;
if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function(extTokenizer) {
if (token = extTokenizer.call({
lexer: _this2
}, src, tokens)) {
src = src.substring(token.raw.length);
tokens.push(token);
return true;
}
return false;
})) {
continue;
}
if (token = this.tokenizer.escape(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.tag(src)) {
src = src.substring(token.raw.length);
lastToken = tokens[tokens.length - 1];
if (lastToken && token.type === "text" && lastToken.type === "text") {
lastToken.raw += token.raw;
lastToken.text += token.text;
} else {
tokens.push(token);
}
continue;
}
if (token = this.tokenizer.link(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
src = src.substring(token.raw.length);
lastToken = tokens[tokens.length - 1];
if (lastToken && token.type === "text" && lastToken.type === "text") {
lastToken.raw += token.raw;
lastToken.text += token.text;
} else {
tokens.push(token);
}
continue;
}
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.codespan(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.br(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.del(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (token = this.tokenizer.autolink(src, mangle)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
}
cutSrc = src;
if (this.options.extensions && this.options.extensions.startInline) {
(function() {
var startIndex = Infinity;
var tempSrc = src.slice(1);
var tempStart = void 0;
_this2.options.extensions.startInline.forEach(function(getStartIndex) {
tempStart = getStartIndex.call({
lexer: this
}, tempSrc);
if (typeof tempStart === "number" && tempStart >= 0) {
startIndex = Math.min(startIndex, tempStart);
}
});
if (startIndex < Infinity && startIndex >= 0) {
cutSrc = src.substring(0, startIndex + 1);
}
})();
}
if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
src = src.substring(token.raw.length);
if (token.raw.slice(-1) !== "_") {
prevChar = token.raw.slice(-1);
}
keepPrevChar = true;
lastToken = tokens[tokens.length - 1];
if (lastToken && lastToken.type === "text") {
lastToken.raw += token.raw;
lastToken.text += token.text;
} else {
tokens.push(token);
}
continue;
}
if (src) {
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
if (this.options.silent) {
console.error(errMsg);
break;
} else {
throw new Error(errMsg);
}
}
}
return tokens;
};
_createClass(Lexer3, null, [{
key: "rules",
get: function get() {
return {
block,
inline
};
}
}]);
return Lexer3;
}();
var Renderer2 = /* @__PURE__ */ function() {
function Renderer3(options3) {
this.options = options3 || exports2.defaults;
}
var _proto = Renderer3.prototype;
_proto.code = function code(_code, infostring, escaped) {
var lang = (infostring || "").match(/\S*/)[0];
if (this.options.highlight) {
var out = this.options.highlight(_code, lang);
if (out != null && out !== _code) {
escaped = true;
_code = out;
}
}
_code = _code.replace(/\n$/, "") + "\n";
if (!lang) {
return "" + (escaped ? _code : escape2(_code, true)) + "
\n";
}
return '' + (escaped ? _code : escape2(_code, true)) + "
\n";
};
_proto.blockquote = function blockquote(quote) {
return "\n" + quote + "
\n";
};
_proto.html = function html2(_html) {
return _html;
};
_proto.heading = function heading(text2, level, raw, slugger) {
if (this.options.headerIds) {
var id = this.options.headerPrefix + slugger.slug(raw);
return "' + text2 + "\n";
}
return "" + text2 + "\n";
};
_proto.hr = function hr() {
return this.options.xhtml ? "
\n" : "
\n";
};
_proto.list = function list(body, ordered, start) {
var type = ordered ? "ol" : "ul", startatt = ordered && start !== 1 ? ' start="' + start + '"' : "";
return "<" + type + startatt + ">\n" + body + "" + type + ">\n";
};
_proto.listitem = function listitem(text2) {
return "" + text2 + "\n";
};
_proto.checkbox = function checkbox(checked) {
return " ";
};
_proto.paragraph = function paragraph(text2) {
return "" + text2 + "
\n";
};
_proto.table = function table(header, body) {
if (body) body = "" + body + "";
return "\n\n" + header + "\n" + body + "
\n";
};
_proto.tablerow = function tablerow(content) {
return "\n" + content + "
\n";
};
_proto.tablecell = function tablecell(content, flags) {
var type = flags.header ? "th" : "td";
var tag = flags.align ? "<" + type + ' align="' + flags.align + '">' : "<" + type + ">";
return tag + content + ("" + type + ">\n");
};
_proto.strong = function strong(text2) {
return "" + text2 + "";
};
_proto.em = function em(text2) {
return "" + text2 + "";
};
_proto.codespan = function codespan(text2) {
return "" + text2 + "";
};
_proto.br = function br() {
return this.options.xhtml ? "
" : "
";
};
_proto.del = function del(text2) {
return "" + text2 + "";
};
_proto.link = function link(href, title, text2) {
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
if (href === null) {
return text2;
}
var out = '" + text2 + "";
return out;
};
_proto.image = function image(href, title, text2) {
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
if (href === null) {
return text2;
}
var out = '
" : ">";
return out;
};
_proto.text = function text2(_text) {
return _text;
};
return Renderer3;
}();
var TextRenderer2 = /* @__PURE__ */ function() {
function TextRenderer3() {
}
var _proto = TextRenderer3.prototype;
_proto.strong = function strong(text2) {
return text2;
};
_proto.em = function em(text2) {
return text2;
};
_proto.codespan = function codespan(text2) {
return text2;
};
_proto.del = function del(text2) {
return text2;
};
_proto.html = function html2(text2) {
return text2;
};
_proto.text = function text2(_text) {
return _text;
};
_proto.link = function link(href, title, text2) {
return "" + text2;
};
_proto.image = function image(href, title, text2) {
return "" + text2;
};
_proto.br = function br() {
return "";
};
return TextRenderer3;
}();
var Slugger2 = /* @__PURE__ */ function() {
function Slugger3() {
this.seen = {};
}
var _proto = Slugger3.prototype;
_proto.serialize = function serialize(value) {
return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
};
_proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
var slug = originalSlug;
var occurenceAccumulator = 0;
if (this.seen.hasOwnProperty(slug)) {
occurenceAccumulator = this.seen[originalSlug];
do {
occurenceAccumulator++;
slug = originalSlug + "-" + occurenceAccumulator;
} while (this.seen.hasOwnProperty(slug));
}
if (!isDryRun) {
this.seen[originalSlug] = occurenceAccumulator;
this.seen[slug] = 0;
}
return slug;
};
_proto.slug = function slug(value, options3) {
if (options3 === void 0) {
options3 = {};
}
var slug2 = this.serialize(value);
return this.getNextSafeSlug(slug2, options3.dryrun);
};
return Slugger3;
}();
var Parser5 = /* @__PURE__ */ function() {
function Parser6(options3) {
this.options = options3 || exports2.defaults;
this.options.renderer = this.options.renderer || new Renderer2();
this.renderer = this.options.renderer;
this.renderer.options = this.options;
this.textRenderer = new TextRenderer2();
this.slugger = new Slugger2();
}
Parser6.parse = function parse6(tokens, options3) {
var parser3 = new Parser6(options3);
return parser3.parse(tokens);
};
Parser6.parseInline = function parseInline3(tokens, options3) {
var parser3 = new Parser6(options3);
return parser3.parseInline(tokens);
};
var _proto = Parser6.prototype;
_proto.parse = function parse6(tokens, top) {
if (top === void 0) {
top = true;
}
var out = "", i, j, k, l2, l3, row, cell, header, body, token, ordered, start, loose, itemBody, item, checked, task, checkbox, ret;
var l = tokens.length;
for (i = 0; i < l; i++) {
token = tokens[i];
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
ret = this.options.extensions.renderers[token.type].call({
parser: this
}, token);
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
out += ret || "";
continue;
}
}
switch (token.type) {
case "space": {
continue;
}
case "hr": {
out += this.renderer.hr();
continue;
}
case "heading": {
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
continue;
}
case "code": {
out += this.renderer.code(token.text, token.lang, token.escaped);
continue;
}
case "table": {
header = "";
cell = "";
l2 = token.header.length;
for (j = 0; j < l2; j++) {
cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
header: true,
align: token.align[j]
});
}
header += this.renderer.tablerow(cell);
body = "";
l2 = token.rows.length;
for (j = 0; j < l2; j++) {
row = token.rows[j];
cell = "";
l3 = row.length;
for (k = 0; k < l3; k++) {
cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
header: false,
align: token.align[k]
});
}
body += this.renderer.tablerow(cell);
}
out += this.renderer.table(header, body);
continue;
}
case "blockquote": {
body = this.parse(token.tokens);
out += this.renderer.blockquote(body);
continue;
}
case "list": {
ordered = token.ordered;
start = token.start;
loose = token.loose;
l2 = token.items.length;
body = "";
for (j = 0; j < l2; j++) {
item = token.items[j];
checked = item.checked;
task = item.task;
itemBody = "";
if (item.task) {
checkbox = this.renderer.checkbox(checked);
if (loose) {
if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
}
} else {
item.tokens.unshift({
type: "text",
text: checkbox
});
}
} else {
itemBody += checkbox;
}
}
itemBody += this.parse(item.tokens, loose);
body += this.renderer.listitem(itemBody, task, checked);
}
out += this.renderer.list(body, ordered, start);
continue;
}
case "html": {
out += this.renderer.html(token.text);
continue;
}
case "paragraph": {
out += this.renderer.paragraph(this.parseInline(token.tokens));
continue;
}
case "text": {
body = token.tokens ? this.parseInline(token.tokens) : token.text;
while (i + 1 < l && tokens[i + 1].type === "text") {
token = tokens[++i];
body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
}
out += top ? this.renderer.paragraph(body) : body;
continue;
}
default: {
var errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
}
}
}
return out;
};
_proto.parseInline = function parseInline3(tokens, renderer) {
renderer = renderer || this.renderer;
var out = "", i, token, ret;
var l = tokens.length;
for (i = 0; i < l; i++) {
token = tokens[i];
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
ret = this.options.extensions.renderers[token.type].call({
parser: this
}, token);
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
out += ret || "";
continue;
}
}
switch (token.type) {
case "escape": {
out += renderer.text(token.text);
break;
}
case "html": {
out += renderer.html(token.text);
break;
}
case "link": {
out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
break;
}
case "image": {
out += renderer.image(token.href, token.title, token.text);
break;
}
case "strong": {
out += renderer.strong(this.parseInline(token.tokens, renderer));
break;
}
case "em": {
out += renderer.em(this.parseInline(token.tokens, renderer));
break;
}
case "codespan": {
out += renderer.codespan(token.text);
break;
}
case "br": {
out += renderer.br();
break;
}
case "del": {
out += renderer.del(this.parseInline(token.tokens, renderer));
break;
}
case "text": {
out += renderer.text(token.text);
break;
}
default: {
var errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
}
}
}
return out;
};
return Parser6;
}();
function marked2(src, opt, callback) {
if (typeof src === "undefined" || src === null) {
throw new Error("marked(): input parameter is undefined or null");
}
if (typeof src !== "string") {
throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
}
if (typeof opt === "function") {
callback = opt;
opt = null;
}
opt = merge({}, marked2.defaults, opt || {});
checkSanitizeDeprecation(opt);
if (callback) {
var highlight = opt.highlight;
var tokens;
try {
tokens = Lexer2.lex(src, opt);
} catch (e) {
return callback(e);
}
var done = function done2(err) {
var out;
if (!err) {
try {
if (opt.walkTokens) {
marked2.walkTokens(tokens, opt.walkTokens);
}
out = Parser5.parse(tokens, opt);
} catch (e) {
err = e;
}
}
opt.highlight = highlight;
return err ? callback(err) : callback(null, out);
};
if (!highlight || highlight.length < 3) {
return done();
}
delete opt.highlight;
if (!tokens.length) return done();
var pending = 0;
marked2.walkTokens(tokens, function(token) {
if (token.type === "code") {
pending++;
setTimeout(function() {
highlight(token.text, token.lang, function(err, code) {
if (err) {
return done(err);
}
if (code != null && code !== token.text) {
token.text = code;
token.escaped = true;
}
pending--;
if (pending === 0) {
done();
}
});
}, 0);
}
});
if (pending === 0) {
done();
}
return;
}
function onError(e) {
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
if (opt.silent) {
return "An error occurred:
" + escape2(e.message + "", true) + "
";
}
throw e;
}
try {
var _tokens = Lexer2.lex(src, opt);
if (opt.walkTokens) {
if (opt.async) {
return Promise.all(marked2.walkTokens(_tokens, opt.walkTokens)).then(function() {
return Parser5.parse(_tokens, opt);
})["catch"](onError);
}
marked2.walkTokens(_tokens, opt.walkTokens);
}
return Parser5.parse(_tokens, opt);
} catch (e) {
onError(e);
}
}
marked2.options = marked2.setOptions = function(opt) {
merge(marked2.defaults, opt);
changeDefaults(marked2.defaults);
return marked2;
};
marked2.getDefaults = getDefaults2;
marked2.defaults = exports2.defaults;
marked2.use = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var opts = merge.apply(void 0, [{}].concat(args));
var extensions = marked2.defaults.extensions || {
renderers: {},
childTokens: {}
};
var hasExtensions;
args.forEach(function(pack) {
if (pack.extensions) {
hasExtensions = true;
pack.extensions.forEach(function(ext) {
if (!ext.name) {
throw new Error("extension name required");
}
if (ext.renderer) {
var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
if (prevRenderer) {
extensions.renderers[ext.name] = function() {
for (var _len2 = arguments.length, args2 = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args2[_key2] = arguments[_key2];
}
var ret = ext.renderer.apply(this, args2);
if (ret === false) {
ret = prevRenderer.apply(this, args2);
}
return ret;
};
} else {
extensions.renderers[ext.name] = ext.renderer;
}
}
if (ext.tokenizer) {
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
throw new Error("extension level must be 'block' or 'inline'");
}
if (extensions[ext.level]) {
extensions[ext.level].unshift(ext.tokenizer);
} else {
extensions[ext.level] = [ext.tokenizer];
}
if (ext.start) {
if (ext.level === "block") {
if (extensions.startBlock) {
extensions.startBlock.push(ext.start);
} else {
extensions.startBlock = [ext.start];
}
} else if (ext.level === "inline") {
if (extensions.startInline) {
extensions.startInline.push(ext.start);
} else {
extensions.startInline = [ext.start];
}
}
}
}
if (ext.childTokens) {
extensions.childTokens[ext.name] = ext.childTokens;
}
});
}
if (pack.renderer) {
(function() {
var renderer = marked2.defaults.renderer || new Renderer2();
var _loop = function _loop2(prop2) {
var prevRenderer = renderer[prop2];
renderer[prop2] = function() {
for (var _len3 = arguments.length, args2 = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args2[_key3] = arguments[_key3];
}
var ret = pack.renderer[prop2].apply(renderer, args2);
if (ret === false) {
ret = prevRenderer.apply(renderer, args2);
}
return ret;
};
};
for (var prop in pack.renderer) {
_loop(prop);
}
opts.renderer = renderer;
})();
}
if (pack.tokenizer) {
(function() {
var tokenizer = marked2.defaults.tokenizer || new Tokenizer2();
var _loop2 = function _loop22(prop2) {
var prevTokenizer = tokenizer[prop2];
tokenizer[prop2] = function() {
for (var _len4 = arguments.length, args2 = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args2[_key4] = arguments[_key4];
}
var ret = pack.tokenizer[prop2].apply(tokenizer, args2);
if (ret === false) {
ret = prevTokenizer.apply(tokenizer, args2);
}
return ret;
};
};
for (var prop in pack.tokenizer) {
_loop2(prop);
}
opts.tokenizer = tokenizer;
})();
}
if (pack.walkTokens) {
var _walkTokens = marked2.defaults.walkTokens;
opts.walkTokens = function(token) {
var values2 = [];
values2.push(pack.walkTokens.call(this, token));
if (_walkTokens) {
values2 = values2.concat(_walkTokens.call(this, token));
}
return values2;
};
}
if (hasExtensions) {
opts.extensions = extensions;
}
marked2.setOptions(opts);
});
};
marked2.walkTokens = function(tokens, callback) {
var values2 = [];
var _loop3 = function _loop32() {
var token = _step.value;
values2 = values2.concat(callback.call(marked2, token));
switch (token.type) {
case "table": {
for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done; ) {
var cell = _step2.value;
values2 = values2.concat(marked2.walkTokens(cell.tokens, callback));
}
for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done; ) {
var row = _step3.value;
for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done; ) {
var _cell = _step4.value;
values2 = values2.concat(marked2.walkTokens(_cell.tokens, callback));
}
}
break;
}
case "list": {
values2 = values2.concat(marked2.walkTokens(token.items, callback));
break;
}
default: {
if (marked2.defaults.extensions && marked2.defaults.extensions.childTokens && marked2.defaults.extensions.childTokens[token.type]) {
marked2.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
values2 = values2.concat(marked2.walkTokens(token[childTokens], callback));
});
} else if (token.tokens) {
values2 = values2.concat(marked2.walkTokens(token.tokens, callback));
}
}
}
};
for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done; ) {
_loop3();
}
return values2;
};
marked2.parseInline = function(src, opt) {
if (typeof src === "undefined" || src === null) {
throw new Error("marked.parseInline(): input parameter is undefined or null");
}
if (typeof src !== "string") {
throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
}
opt = merge({}, marked2.defaults, opt || {});
checkSanitizeDeprecation(opt);
try {
var tokens = Lexer2.lexInline(src, opt);
if (opt.walkTokens) {
marked2.walkTokens(tokens, opt.walkTokens);
}
return Parser5.parseInline(tokens, opt);
} catch (e) {
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
if (opt.silent) {
return "An error occurred:
" + escape2(e.message + "", true) + "
";
}
throw e;
}
};
marked2.Parser = Parser5;
marked2.parser = Parser5.parse;
marked2.Renderer = Renderer2;
marked2.TextRenderer = TextRenderer2;
marked2.Lexer = Lexer2;
marked2.lexer = Lexer2.lex;
marked2.Tokenizer = Tokenizer2;
marked2.Slugger = Slugger2;
marked2.parse = marked2;
var options2 = marked2.options;
var setOptions2 = marked2.setOptions;
var use2 = marked2.use;
var walkTokens2 = marked2.walkTokens;
var parseInline2 = marked2.parseInline;
var parse5 = marked2;
var parser2 = Parser5.parse;
var lexer2 = Lexer2.lex;
exports2.Lexer = Lexer2;
exports2.Parser = Parser5;
exports2.Renderer = Renderer2;
exports2.Slugger = Slugger2;
exports2.TextRenderer = TextRenderer2;
exports2.Tokenizer = Tokenizer2;
exports2.getDefaults = getDefaults2;
exports2.lexer = lexer2;
exports2.marked = marked2;
exports2.options = options2;
exports2.parse = parse5;
exports2.parseInline = parseInline2;
exports2.parser = parser2;
exports2.setOptions = setOptions2;
exports2.use = use2;
exports2.walkTokens = walkTokens2;
Object.defineProperty(exports2, "__esModule", { value: true });
});
})();
Lexer = __marked_exports.Lexer || exports.Lexer;
Parser3 = __marked_exports.Parser || exports.Parser;
Renderer = __marked_exports.Renderer || exports.Renderer;
Slugger = __marked_exports.Slugger || exports.Slugger;
TextRenderer = __marked_exports.TextRenderer || exports.TextRenderer;
Tokenizer = __marked_exports.Tokenizer || exports.Tokenizer;
getDefaults = __marked_exports.getDefaults || exports.getDefaults;
lexer = __marked_exports.lexer || exports.lexer;
marked = __marked_exports.marked || exports.marked;
options = __marked_exports.options || exports.options;
parse2 = __marked_exports.parse || exports.parse;
parseInline = __marked_exports.parseInline || exports.parseInline;
parser = __marked_exports.parser || exports.parser;
setOptions = __marked_exports.setOptions || exports.setOptions;
use = __marked_exports.use || exports.use;
walkTokens = __marked_exports.walkTokens || exports.walkTokens;
}
});
// node_modules/monaco-editor/esm/vs/base/common/marshalling.js
function stringify(obj) {
return JSON.stringify(obj, replacer);
}
function parse3(text2) {
let data = JSON.parse(text2);
data = revive(data);
return data;
}
function replacer(key, value) {
if (value instanceof RegExp) {
return {
$mid: 2,
source: value.source,
flags: value.flags
};
}
return value;
}
function revive(obj, depth = 0) {
if (!obj || depth > 200) {
return obj;
}
if (typeof obj === "object") {
switch (obj.$mid) {
case 1:
return URI.revive(obj);
case 2:
return new RegExp(obj.source, obj.flags);
case 17:
return new Date(obj.source);
}
if (obj instanceof VSBuffer || obj instanceof Uint8Array) {
return obj;
}
if (Array.isArray(obj)) {
for (let i = 0; i < obj.length; ++i) {
obj[i] = revive(obj[i], depth + 1);
}
} else {
for (const key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {
obj[key] = revive(obj[key], depth + 1);
}
}
}
}
return obj;
}
var init_marshalling = __esm({
"node_modules/monaco-editor/esm/vs/base/common/marshalling.js"() {
init_buffer();
init_uri();
}
});
// node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js
function renderMarkdown(markdown, options2 = {}, markedOptions = {}) {
var _a10, _b4;
const disposables = new DisposableStore();
let isDisposed = false;
const element = createElement(options2);
const _uriMassage = function(part) {
let data;
try {
data = parse3(decodeURIComponent(part));
} catch (e) {
}
if (!data) {
return part;
}
data = cloneAndChange(data, (value2) => {
if (markdown.uris && markdown.uris[value2]) {
return URI.revive(markdown.uris[value2]);
} else {
return void 0;
}
});
return encodeURIComponent(JSON.stringify(data));
};
const _href = function(href, isDomUri) {
const data = markdown.uris && markdown.uris[href];
let uri = URI.revive(data);
if (isDomUri) {
if (href.startsWith(Schemas.data + ":")) {
return href;
}
if (!uri) {
uri = URI.parse(href);
}
return FileAccess.uriToBrowserUri(uri).toString(true);
}
if (!uri) {
return href;
}
if (URI.parse(href).toString() === uri.toString()) {
return href;
}
if (uri.query) {
uri = uri.with({ query: _uriMassage(uri.query) });
}
return uri.toString();
};
const renderer = new marked.Renderer();
renderer.image = defaultMarkedRenderers.image;
renderer.link = defaultMarkedRenderers.link;
renderer.paragraph = defaultMarkedRenderers.paragraph;
const codeBlocks = [];
const syncCodeBlocks = [];
if (options2.codeBlockRendererSync) {
renderer.code = (code, lang) => {
const id = defaultGenerator.nextId();
const value2 = options2.codeBlockRendererSync(postProcessCodeBlockLanguageId(lang), code);
syncCodeBlocks.push([id, value2]);
return `${escape(code)}
`;
};
} else if (options2.codeBlockRenderer) {
renderer.code = (code, lang) => {
const id = defaultGenerator.nextId();
const value2 = options2.codeBlockRenderer(postProcessCodeBlockLanguageId(lang), code);
codeBlocks.push(value2.then((element2) => [id, element2]));
return `${escape(code)}
`;
};
}
if (options2.actionHandler) {
const _activateLink = function(event) {
let target = event.target;
if (target.tagName !== "A") {
target = target.parentElement;
if (!target || target.tagName !== "A") {
return;
}
}
try {
let href = target.dataset["href"];
if (href) {
if (markdown.baseUri) {
href = resolveWithBaseUri(URI.from(markdown.baseUri), href);
}
options2.actionHandler.callback(href, event);
}
} catch (err) {
onUnexpectedError(err);
} finally {
event.preventDefault();
}
};
const onClick = options2.actionHandler.disposables.add(new DomEmitter(element, "click"));
const onAuxClick = options2.actionHandler.disposables.add(new DomEmitter(element, "auxclick"));
options2.actionHandler.disposables.add(Event.any(onClick.event, onAuxClick.event)((e) => {
const mouseEvent = new StandardMouseEvent(getWindow(element), e);
if (!mouseEvent.leftButton && !mouseEvent.middleButton) {
return;
}
_activateLink(mouseEvent);
}));
options2.actionHandler.disposables.add(addDisposableListener(element, "keydown", (e) => {
const keyboardEvent = new StandardKeyboardEvent(e);
if (!keyboardEvent.equals(
10
/* KeyCode.Space */
) && !keyboardEvent.equals(
3
/* KeyCode.Enter */
)) {
return;
}
_activateLink(keyboardEvent);
}));
}
if (!markdown.supportHtml) {
markedOptions.sanitizer = (html2) => {
var _a11;
if ((_a11 = options2.sanitizerOptions) === null || _a11 === void 0 ? void 0 : _a11.replaceWithPlaintext) {
return escape(html2);
}
const match2 = markdown.isTrusted ? html2.match(/^(]+>)|(<\/\s*span>)$/) : void 0;
return match2 ? html2 : "";
};
markedOptions.sanitize = true;
markedOptions.silent = true;
}
markedOptions.renderer = renderer;
let value = (_a10 = markdown.value) !== null && _a10 !== void 0 ? _a10 : "";
if (value.length > 1e5) {
value = `${value.substr(0, 1e5)}\u2026`;
}
if (markdown.supportThemeIcons) {
value = markdownEscapeEscapedIcons(value);
}
let renderedMarkdown;
if (options2.fillInIncompleteTokens) {
const opts = __spreadValues(__spreadValues({}, marked.defaults), markedOptions);
const tokens = marked.lexer(value, opts);
const newTokens = fillInIncompleteTokens(tokens);
renderedMarkdown = marked.parser(newTokens, opts);
} else {
renderedMarkdown = marked.parse(value, markedOptions);
}
if (markdown.supportThemeIcons) {
const elements = renderLabelWithIcons(renderedMarkdown);
renderedMarkdown = elements.map((e) => typeof e === "string" ? e : e.outerHTML).join("");
}
const htmlParser = new DOMParser();
const markdownHtmlDoc = htmlParser.parseFromString(sanitizeRenderedMarkdown(__spreadValues({ isTrusted: markdown.isTrusted }, options2.sanitizerOptions), renderedMarkdown), "text/html");
markdownHtmlDoc.body.querySelectorAll("img, audio, video, source").forEach((img) => {
const src = img.getAttribute("src");
if (src) {
let href = src;
try {
if (markdown.baseUri) {
href = resolveWithBaseUri(URI.from(markdown.baseUri), href);
}
} catch (err) {
}
img.setAttribute("src", _href(href, true));
if (options2.remoteImageIsAllowed) {
const uri = URI.parse(href);
if (uri.scheme !== Schemas.file && uri.scheme !== Schemas.data && !options2.remoteImageIsAllowed(uri)) {
img.replaceWith($("", void 0, img.outerHTML));
}
}
}
});
markdownHtmlDoc.body.querySelectorAll("a").forEach((a3) => {
const href = a3.getAttribute("href");
a3.setAttribute("href", "");
if (!href || /^data:|javascript:/i.test(href) || /^command:/i.test(href) && !markdown.isTrusted || /^command:(\/\/\/)?_workbench\.downloadResource/i.test(href)) {
a3.replaceWith(...a3.childNodes);
} else {
let resolvedHref = _href(href, false);
if (markdown.baseUri) {
resolvedHref = resolveWithBaseUri(URI.from(markdown.baseUri), href);
}
a3.dataset.href = resolvedHref;
}
});
element.innerHTML = sanitizeRenderedMarkdown(__spreadValues({ isTrusted: markdown.isTrusted }, options2.sanitizerOptions), markdownHtmlDoc.body.innerHTML);
if (codeBlocks.length > 0) {
Promise.all(codeBlocks).then((tuples) => {
var _a11, _b5;
if (isDisposed) {
return;
}
const renderedElements = new Map(tuples);
const placeholderElements = element.querySelectorAll(`div[data-code]`);
for (const placeholderElement of placeholderElements) {
const renderedElement = renderedElements.get((_a11 = placeholderElement.dataset["code"]) !== null && _a11 !== void 0 ? _a11 : "");
if (renderedElement) {
reset(placeholderElement, renderedElement);
}
}
(_b5 = options2.asyncRenderCallback) === null || _b5 === void 0 ? void 0 : _b5.call(options2);
});
} else if (syncCodeBlocks.length > 0) {
const renderedElements = new Map(syncCodeBlocks);
const placeholderElements = element.querySelectorAll(`div[data-code]`);
for (const placeholderElement of placeholderElements) {
const renderedElement = renderedElements.get((_b4 = placeholderElement.dataset["code"]) !== null && _b4 !== void 0 ? _b4 : "");
if (renderedElement) {
reset(placeholderElement, renderedElement);
}
}
}
if (options2.asyncRenderCallback) {
for (const img of element.getElementsByTagName("img")) {
const listener = disposables.add(addDisposableListener(img, "load", () => {
listener.dispose();
options2.asyncRenderCallback();
}));
}
}
return {
element,
dispose: () => {
isDisposed = true;
disposables.dispose();
}
};
}
function postProcessCodeBlockLanguageId(lang) {
if (!lang) {
return "";
}
const parts = lang.split(/[\s+|:|,|\{|\?]/, 1);
if (parts.length) {
return parts[0];
}
return lang;
}
function resolveWithBaseUri(baseUri, href) {
const hasScheme = /^\w[\w\d+.-]*:/.test(href);
if (hasScheme) {
return href;
}
if (baseUri.path.endsWith("/")) {
return resolvePath(baseUri, href).toString();
} else {
return resolvePath(dirname2(baseUri), href).toString();
}
}
function sanitizeRenderedMarkdown(options2, renderedMarkdown) {
const { config, allowedSchemes } = getSanitizerOptions(options2);
const store = new DisposableStore();
store.add(addDompurifyHook("uponSanitizeAttribute", (element, e) => {
var _a10;
if (e.attrName === "style" || e.attrName === "class") {
if (element.tagName === "SPAN") {
if (e.attrName === "style") {
e.keepAttr = /^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?$/.test(e.attrValue);
return;
} else if (e.attrName === "class") {
e.keepAttr = /^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(e.attrValue);
return;
}
}
e.keepAttr = false;
return;
} else if (element.tagName === "INPUT" && ((_a10 = element.attributes.getNamedItem("type")) === null || _a10 === void 0 ? void 0 : _a10.value) === "checkbox") {
if (e.attrName === "type" && e.attrValue === "checkbox" || e.attrName === "disabled" || e.attrName === "checked") {
e.keepAttr = true;
return;
}
e.keepAttr = false;
}
}));
store.add(addDompurifyHook("uponSanitizeElement", (element, e) => {
var _a10, _b4;
if (e.tagName === "input") {
if (((_a10 = element.attributes.getNamedItem("type")) === null || _a10 === void 0 ? void 0 : _a10.value) === "checkbox") {
element.setAttribute("disabled", "");
} else if (!options2.replaceWithPlaintext) {
(_b4 = element.parentElement) === null || _b4 === void 0 ? void 0 : _b4.removeChild(element);
}
}
if (options2.replaceWithPlaintext && !e.allowedTags[e.tagName] && e.tagName !== "body") {
if (element.parentElement) {
let startTagText;
let endTagText;
if (e.tagName === "#comment") {
startTagText = ``;
} else {
const isSelfClosing = selfClosingTags.includes(e.tagName);
const attrString = element.attributes.length ? " " + Array.from(element.attributes).map((attr) => `${attr.name}="${attr.value}"`).join(" ") : "";
startTagText = `<${e.tagName}${attrString}>`;
if (!isSelfClosing) {
endTagText = `${e.tagName}>`;
}
}
const fragment = document.createDocumentFragment();
const textNode = element.parentElement.ownerDocument.createTextNode(startTagText);
fragment.appendChild(textNode);
const endTagTextNode = endTagText ? element.parentElement.ownerDocument.createTextNode(endTagText) : void 0;
while (element.firstChild) {
fragment.appendChild(element.firstChild);
}
if (endTagTextNode) {
fragment.appendChild(endTagTextNode);
}
element.parentElement.replaceChild(fragment, element);
}
}
}));
store.add(hookDomPurifyHrefAndSrcSanitizer(allowedSchemes));
try {
return sanitize(renderedMarkdown, __spreadProps(__spreadValues({}, config), { RETURN_TRUSTED_TYPE: true }));
} finally {
store.dispose();
}
}
function getSanitizerOptions(options2) {
var _a10;
const allowedSchemes = [
Schemas.http,
Schemas.https,
Schemas.mailto,
Schemas.data,
Schemas.file,
Schemas.vscodeFileResource,
Schemas.vscodeRemote,
Schemas.vscodeRemoteResource
];
if (options2.isTrusted) {
allowedSchemes.push(Schemas.command);
}
return {
config: {
// allowedTags should included everything that markdown renders to.
// Since we have our own sanitize function for marked, it's possible we missed some tag so let dompurify make sure.
// HTML tags that can result from markdown are from reading https://spec.commonmark.org/0.29/
// HTML table tags that can result from markdown are from https://github.github.com/gfm/#tables-extension-
ALLOWED_TAGS: (_a10 = options2.allowedTags) !== null && _a10 !== void 0 ? _a10 : [...basicMarkupHtmlTags],
ALLOWED_ATTR: allowedMarkdownAttr,
ALLOW_UNKNOWN_PROTOCOLS: true
},
allowedSchemes
};
}
function renderStringAsPlaintext(string2) {
return typeof string2 === "string" ? string2 : renderMarkdownAsPlaintext(string2);
}
function renderMarkdownAsPlaintext(markdown, withCodeBlocks) {
var _a10;
let value = (_a10 = markdown.value) !== null && _a10 !== void 0 ? _a10 : "";
if (value.length > 1e5) {
value = `${value.substr(0, 1e5)}\u2026`;
}
const html2 = marked.parse(value, { renderer: withCodeBlocks ? plainTextWithCodeBlocksRenderer.value : plainTextRenderer.value }).replace(/&(#\d+|[a-zA-Z]+);/g, (m) => {
var _a11;
return (_a11 = unescapeInfo.get(m)) !== null && _a11 !== void 0 ? _a11 : m;
});
return sanitizeRenderedMarkdown({ isTrusted: false }, html2).toString();
}
function createRenderer() {
const renderer = new marked.Renderer();
renderer.code = (code) => {
return code;
};
renderer.blockquote = (quote) => {
return quote;
};
renderer.html = (_html) => {
return "";
};
renderer.heading = (text2, _level, _raw) => {
return text2 + "\n";
};
renderer.hr = () => {
return "";
};
renderer.list = (body, _ordered) => {
return body;
};
renderer.listitem = (text2) => {
return text2 + "\n";
};
renderer.paragraph = (text2) => {
return text2 + "\n";
};
renderer.table = (header, body) => {
return header + body + "\n";
};
renderer.tablerow = (content) => {
return content;
};
renderer.tablecell = (content, _flags) => {
return content + " ";
};
renderer.strong = (text2) => {
return text2;
};
renderer.em = (text2) => {
return text2;
};
renderer.codespan = (code) => {
return code;
};
renderer.br = () => {
return "\n";
};
renderer.del = (text2) => {
return text2;
};
renderer.image = (_href, _title, _text) => {
return "";
};
renderer.text = (text2) => {
return text2;
};
renderer.link = (_href, _title, text2) => {
return text2;
};
return renderer;
}
function mergeRawTokenText(tokens) {
let mergedTokenText = "";
tokens.forEach((token) => {
mergedTokenText += token.raw;
});
return mergedTokenText;
}
function completeSingleLinePattern(token) {
var _a10, _b4;
if (!token.tokens) {
return void 0;
}
for (let i = token.tokens.length - 1; i >= 0; i--) {
const subtoken = token.tokens[i];
if (subtoken.type === "text") {
const lines = subtoken.raw.split("\n");
const lastLine = lines[lines.length - 1];
if (lastLine.includes("`")) {
return completeCodespan(token);
} else if (lastLine.includes("**")) {
return completeDoublestar(token);
} else if (lastLine.match(/\*\w/)) {
return completeStar(token);
} else if (lastLine.match(/(^|\s)__\w/)) {
return completeDoubleUnderscore(token);
} else if (lastLine.match(/(^|\s)_\w/)) {
return completeUnderscore(token);
} else if (
// Text with start of link target
hasLinkTextAndStartOfLinkTarget(lastLine) || // This token doesn't have the link text, eg if it contains other markdown constructs that are in other subtokens.
// But some preceding token does have an unbalanced [ at least
hasStartOfLinkTargetAndNoLinkText(lastLine) && token.tokens.slice(0, i).some((t4) => t4.type === "text" && t4.raw.match(/\[[^\]]*$/))
) {
const nextTwoSubTokens = token.tokens.slice(i + 1);
if (
// If the link was parsed as a link, then look for a link token and a text token with a quote
((_a10 = nextTwoSubTokens[0]) === null || _a10 === void 0 ? void 0 : _a10.type) === "link" && ((_b4 = nextTwoSubTokens[1]) === null || _b4 === void 0 ? void 0 : _b4.type) === "text" && nextTwoSubTokens[1].raw.match(/^ *"[^"]*$/) || // And if the link was not parsed as a link (eg command link), just look for a single quote in this token
lastLine.match(/^[^"]* +"[^"]*$/)
) {
return completeLinkTargetArg(token);
}
return completeLinkTarget(token);
} else if (lastLine.match(/(^|\s)\[\w*/)) {
return completeLinkText(token);
}
}
}
return void 0;
}
function hasLinkTextAndStartOfLinkTarget(str) {
return !!str.match(/(^|\s)\[.*\]\(\w*/);
}
function hasStartOfLinkTargetAndNoLinkText(str) {
return !!str.match(/^[^\[]*\]\([^\)]*$/);
}
function completeListItemPattern(list) {
var _a10;
const lastListItem = list.items[list.items.length - 1];
const lastListSubToken = lastListItem.tokens ? lastListItem.tokens[lastListItem.tokens.length - 1] : void 0;
let newToken;
if ((lastListSubToken === null || lastListSubToken === void 0 ? void 0 : lastListSubToken.type) === "text" && !("inRawBlock" in lastListItem)) {
newToken = completeSingleLinePattern(lastListSubToken);
}
if (!newToken || newToken.type !== "paragraph") {
return;
}
const previousListItemsText = mergeRawTokenText(list.items.slice(0, -1));
const lastListItemLead = (_a10 = lastListItem.raw.match(/^(\s*(-|\d+\.) +)/)) === null || _a10 === void 0 ? void 0 : _a10[0];
if (!lastListItemLead) {
return;
}
const newListItemText = lastListItemLead + mergeRawTokenText(lastListItem.tokens.slice(0, -1)) + newToken.raw;
const newList = marked.lexer(previousListItemsText + newListItemText)[0];
if (newList.type !== "list") {
return;
}
return newList;
}
function fillInIncompleteTokens(tokens) {
for (let i = 0; i < maxIncompleteTokensFixRounds; i++) {
const newTokens = fillInIncompleteTokensOnce(tokens);
if (newTokens) {
tokens = newTokens;
} else {
break;
}
}
return tokens;
}
function fillInIncompleteTokensOnce(tokens) {
let i;
let newTokens;
for (i = 0; i < tokens.length; i++) {
const token = tokens[i];
let codeblockStart;
if (token.type === "paragraph" && (codeblockStart = token.raw.match(/(\n|^)(````*)/))) {
const codeblockLead = codeblockStart[2];
newTokens = completeCodeBlock(tokens.slice(i), codeblockLead);
break;
}
if (token.type === "paragraph" && token.raw.match(/(\n|^)\|/)) {
newTokens = completeTable(tokens.slice(i));
break;
}
if (i === tokens.length - 1 && token.type === "list") {
const newListToken = completeListItemPattern(token);
if (newListToken) {
newTokens = [newListToken];
break;
}
}
if (i === tokens.length - 1 && token.type === "paragraph") {
const newToken = completeSingleLinePattern(token);
if (newToken) {
newTokens = [newToken];
break;
}
}
}
if (newTokens) {
const newTokensList = [
...tokens.slice(0, i),
...newTokens
];
newTokensList.links = tokens.links;
return newTokensList;
}
return null;
}
function completeCodeBlock(tokens, leader) {
const mergedRawText = mergeRawTokenText(tokens);
return marked.lexer(mergedRawText + `
${leader}`);
}
function completeCodespan(token) {
return completeWithString(token, "`");
}
function completeStar(tokens) {
return completeWithString(tokens, "*");
}
function completeUnderscore(tokens) {
return completeWithString(tokens, "_");
}
function completeLinkTarget(tokens) {
return completeWithString(tokens, ")");
}
function completeLinkTargetArg(tokens) {
return completeWithString(tokens, '")');
}
function completeLinkText(tokens) {
return completeWithString(tokens, "](https://microsoft.com)");
}
function completeDoublestar(tokens) {
return completeWithString(tokens, "**");
}
function completeDoubleUnderscore(tokens) {
return completeWithString(tokens, "__");
}
function completeWithString(tokens, closingString) {
const mergedRawText = mergeRawTokenText(Array.isArray(tokens) ? tokens : [tokens]);
return marked.lexer(mergedRawText + closingString)[0];
}
function completeTable(tokens) {
const mergedRawText = mergeRawTokenText(tokens);
const lines = mergedRawText.split("\n");
let numCols;
let hasSeparatorRow = false;
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
if (typeof numCols === "undefined" && line.match(/^\s*\|/)) {
const line1Matches = line.match(/(\|[^\|]+)(?=\||$)/g);
if (line1Matches) {
numCols = line1Matches.length;
}
} else if (typeof numCols === "number") {
if (line.match(/^\s*\|/)) {
if (i !== lines.length - 1) {
return void 0;
}
hasSeparatorRow = true;
} else {
return void 0;
}
}
}
if (typeof numCols === "number" && numCols > 0) {
const prefixText = hasSeparatorRow ? lines.slice(0, -1).join("\n") : mergedRawText;
const line1EndsInPipe = !!prefixText.match(/\|\s*$/);
const newRawText = prefixText + (line1EndsInPipe ? "" : "|") + `
|${" --- |".repeat(numCols)}`;
return marked.lexer(newRawText);
}
return void 0;
}
function addDompurifyHook(hook, cb) {
addHook(hook, cb);
return toDisposable(() => removeHook(hook));
}
var defaultMarkedRenderers, selfClosingTags, allowedMarkdownAttr, unescapeInfo, plainTextRenderer, plainTextWithCodeBlocksRenderer, maxIncompleteTokensFixRounds;
var init_markdownRenderer = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/markdownRenderer.js"() {
init_dom();
init_dompurify();
init_event2();
init_formattedTextRenderer();
init_keyboardEvent();
init_mouseEvent();
init_iconLabels();
init_errors();
init_event();
init_htmlContent();
init_iconLabels2();
init_idGenerator();
init_lazy();
init_lifecycle();
init_marked();
init_marshalling();
init_network();
init_objects();
init_resources();
init_strings();
init_uri();
defaultMarkedRenderers = Object.freeze({
image: (href, title, text2) => {
let dimensions = [];
let attributes = [];
if (href) {
({ href, dimensions } = parseHrefAndDimensions(href));
attributes.push(`src="${escapeDoubleQuotes(href)}"`);
}
if (text2) {
attributes.push(`alt="${escapeDoubleQuotes(text2)}"`);
}
if (title) {
attributes.push(`title="${escapeDoubleQuotes(title)}"`);
}
if (dimensions.length) {
attributes = attributes.concat(dimensions);
}
return "
";
},
paragraph: (text2) => {
return `${text2}
`;
},
link: (href, title, text2) => {
if (typeof href !== "string") {
return "";
}
if (href === text2) {
text2 = removeMarkdownEscapes(text2);
}
title = typeof title === "string" ? escapeDoubleQuotes(removeMarkdownEscapes(title)) : "";
href = removeMarkdownEscapes(href);
href = href.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'");
return `${text2}`;
}
});
selfClosingTags = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
allowedMarkdownAttr = [
"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"
];
unescapeInfo = /* @__PURE__ */ new Map([
[""", '"'],
[" ", " "],
["&", "&"],
["'", "'"],
["<", "<"],
[">", ">"]
]);
plainTextRenderer = new Lazy((withCodeBlocks) => createRenderer());
plainTextWithCodeBlocksRenderer = new Lazy(() => {
const renderer = createRenderer();
renderer.code = (code) => {
return "\n```" + code + "```\n";
};
return renderer;
});
maxIncompleteTokensFixRounds = 3;
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/markdownRenderer/browser/renderedMarkdown.css
var init_renderedMarkdown = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/markdownRenderer/browser/renderedMarkdown.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer.js
function openLinkFromMarkdown(openerService, link, isTrusted) {
return __async(this, null, function* () {
try {
return yield openerService.open(link, {
fromUserGesture: true,
allowContributedOpeners: true,
allowCommands: toAllowCommandsOption(isTrusted)
});
} catch (e) {
onUnexpectedError(e);
return false;
}
});
}
function toAllowCommandsOption(isTrusted) {
if (isTrusted === true) {
return true;
}
if (isTrusted && Array.isArray(isTrusted.enabledCommands)) {
return isTrusted.enabledCommands;
}
return false;
}
var __decorate22, __param21, MarkdownRenderer_1, MarkdownRenderer;
var init_markdownRenderer2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer.js"() {
init_markdownRenderer();
init_trustedTypes();
init_errors();
init_event();
init_lifecycle();
init_renderedMarkdown();
init_domFontInfo();
init_language();
init_modesRegistry();
init_textToHtmlTokenizer();
init_opener();
__decorate22 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param21 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MarkdownRenderer = MarkdownRenderer_1 = class MarkdownRenderer2 {
constructor(_options, _languageService, _openerService) {
this._options = _options;
this._languageService = _languageService;
this._openerService = _openerService;
this._onDidRenderAsync = new Emitter();
this.onDidRenderAsync = this._onDidRenderAsync.event;
}
dispose() {
this._onDidRenderAsync.dispose();
}
render(markdown, options2, markedOptions) {
if (!markdown) {
const element = document.createElement("span");
return { element, dispose: () => {
} };
}
const disposables = new DisposableStore();
const rendered = disposables.add(renderMarkdown(markdown, __spreadValues(__spreadValues({}, this._getRenderOptions(markdown, disposables)), options2), markedOptions));
rendered.element.classList.add("rendered-markdown");
return {
element: rendered.element,
dispose: () => disposables.dispose()
};
}
_getRenderOptions(markdown, disposables) {
return {
codeBlockRenderer: (languageAlias, value) => __async(this, null, function* () {
var _a10, _b4, _c2;
let languageId;
if (languageAlias) {
languageId = this._languageService.getLanguageIdByLanguageName(languageAlias);
} else if (this._options.editor) {
languageId = (_a10 = this._options.editor.getModel()) === null || _a10 === void 0 ? void 0 : _a10.getLanguageId();
}
if (!languageId) {
languageId = PLAINTEXT_LANGUAGE_ID;
}
const html2 = yield tokenizeToString(this._languageService, value, languageId);
const element = document.createElement("span");
element.innerHTML = (_c2 = (_b4 = MarkdownRenderer_1._ttpTokenizer) === null || _b4 === void 0 ? void 0 : _b4.createHTML(html2)) !== null && _c2 !== void 0 ? _c2 : html2;
if (this._options.editor) {
const fontInfo = this._options.editor.getOption(
50
/* EditorOption.fontInfo */
);
applyFontInfo(element, fontInfo);
} else if (this._options.codeBlockFontFamily) {
element.style.fontFamily = this._options.codeBlockFontFamily;
}
if (this._options.codeBlockFontSize !== void 0) {
element.style.fontSize = this._options.codeBlockFontSize;
}
return element;
}),
asyncRenderCallback: () => this._onDidRenderAsync.fire(),
actionHandler: {
callback: (link) => openLinkFromMarkdown(this._openerService, link, markdown.isTrusted),
disposables
}
};
}
};
MarkdownRenderer._ttpTokenizer = createTrustedTypesPolicy("tokenizeToString", {
createHTML(html2) {
return html2;
}
});
MarkdownRenderer = MarkdownRenderer_1 = __decorate22([
__param21(1, ILanguageService),
__param21(2, IOpenerService)
], MarkdownRenderer);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverWidget.js
var __decorate23, __param22, $3, HoverWidget2, CompositeMouseTracker, ElementHoverTarget;
var init_hoverWidget3 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverWidget.js"() {
init_hover2();
init_lifecycle();
init_event();
init_dom();
init_keybinding();
init_configuration();
init_editorOptions();
init_hoverWidget2();
init_widget();
init_opener();
init_instantiation();
init_markdownRenderer2();
init_htmlContent();
init_nls();
init_platform();
init_accessibility();
init_aria2();
__decorate23 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param22 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
$3 = $;
HoverWidget2 = class HoverWidget3 extends Widget {
get _targetWindow() {
return getWindow(this._target.targetElements[0]);
}
get _targetDocumentElement() {
return getWindow(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;
}
/**
* Whether the hover is "locked" by holding the alt/option key. When locked, the hover will not
* hide and can be hovered regardless of whether the `hideOnHover` hover option is set.
*/
get isLocked() {
return this._isLocked;
}
set isLocked(value) {
if (this._isLocked === value) {
return;
}
this._isLocked = value;
this._hoverContainer.classList.toggle("locked", this._isLocked);
}
constructor(options2, _keybindingService, _configurationService, _openerService, _instantiationService, _accessibilityService) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2;
super();
this._keybindingService = _keybindingService;
this._configurationService = _configurationService;
this._openerService = _openerService;
this._instantiationService = _instantiationService;
this._accessibilityService = _accessibilityService;
this._messageListeners = new DisposableStore();
this._isDisposed = false;
this._forcePosition = false;
this._x = 0;
this._y = 0;
this._isLocked = false;
this._enableFocusTraps = false;
this._addedFocusTrap = false;
this._onDispose = this._register(new Emitter());
this._onRequestLayout = this._register(new Emitter());
this._linkHandler = options2.linkHandler || ((url) => {
return openLinkFromMarkdown(this._openerService, url, isMarkdownString(options2.content) ? options2.content.isTrusted : void 0);
});
this._target = "targetElements" in options2.target ? options2.target : new ElementHoverTarget(options2.target);
this._hoverPointer = ((_a10 = options2.appearance) === null || _a10 === void 0 ? void 0 : _a10.showPointer) ? $3("div.workbench-hover-pointer") : void 0;
this._hover = this._register(new HoverWidget());
this._hover.containerDomNode.classList.add("workbench-hover", "fadeIn");
if ((_b4 = options2.appearance) === null || _b4 === void 0 ? void 0 : _b4.compact) {
this._hover.containerDomNode.classList.add("workbench-hover", "compact");
}
if ((_c2 = options2.appearance) === null || _c2 === void 0 ? void 0 : _c2.skipFadeInAnimation) {
this._hover.containerDomNode.classList.add("skip-fade-in");
}
if (options2.additionalClasses) {
this._hover.containerDomNode.classList.add(...options2.additionalClasses);
}
if ((_d2 = options2.position) === null || _d2 === void 0 ? void 0 : _d2.forcePosition) {
this._forcePosition = true;
}
if (options2.trapFocus) {
this._enableFocusTraps = true;
}
this._hoverPosition = (_f3 = (_e2 = options2.position) === null || _e2 === void 0 ? void 0 : _e2.hoverPosition) !== null && _f3 !== void 0 ? _f3 : 3;
this.onmousedown(this._hover.containerDomNode, (e) => e.stopPropagation());
this.onkeydown(this._hover.containerDomNode, (e) => {
if (e.equals(
9
/* KeyCode.Escape */
)) {
this.dispose();
}
});
this._register(addDisposableListener(this._targetWindow, "blur", () => this.dispose()));
const rowElement = $3("div.hover-row.markdown-hover");
const contentsElement = $3("div.hover-contents");
if (typeof options2.content === "string") {
contentsElement.textContent = options2.content;
contentsElement.style.whiteSpace = "pre-wrap";
} else if (isHTMLElement(options2.content)) {
contentsElement.appendChild(options2.content);
contentsElement.classList.add("html-hover-contents");
} else {
const markdown = options2.content;
const mdRenderer = this._instantiationService.createInstance(MarkdownRenderer, { codeBlockFontFamily: this._configurationService.getValue("editor").fontFamily || EDITOR_FONT_DEFAULTS.fontFamily });
const { element } = mdRenderer.render(markdown, {
actionHandler: {
callback: (content) => this._linkHandler(content),
disposables: this._messageListeners
},
asyncRenderCallback: () => {
contentsElement.classList.add("code-hover-contents");
this.layout();
this._onRequestLayout.fire();
}
});
contentsElement.appendChild(element);
}
rowElement.appendChild(contentsElement);
this._hover.contentsDomNode.appendChild(rowElement);
if (options2.actions && options2.actions.length > 0) {
const statusBarElement = $3("div.hover-row.status-bar");
const actionsElement = $3("div.actions");
options2.actions.forEach((action) => {
const keybinding = this._keybindingService.lookupKeybinding(action.commandId);
const keybindingLabel = keybinding ? keybinding.getLabel() : null;
HoverAction.render(actionsElement, {
label: action.label,
commandId: action.commandId,
run: (e) => {
action.run(e);
this.dispose();
},
iconClass: action.iconClass
}, keybindingLabel);
});
statusBarElement.appendChild(actionsElement);
this._hover.containerDomNode.appendChild(statusBarElement);
}
this._hoverContainer = $3("div.workbench-hover-container");
if (this._hoverPointer) {
this._hoverContainer.appendChild(this._hoverPointer);
}
this._hoverContainer.appendChild(this._hover.containerDomNode);
let hideOnHover;
if (options2.actions && options2.actions.length > 0) {
hideOnHover = false;
} else {
if (((_g2 = options2.persistence) === null || _g2 === void 0 ? void 0 : _g2.hideOnHover) === void 0) {
hideOnHover = typeof options2.content === "string" || isMarkdownString(options2.content) && !options2.content.value.includes("](") && !options2.content.value.includes("");
} else {
hideOnHover = options2.persistence.hideOnHover;
}
}
if (hideOnHover && ((_h2 = options2.appearance) === null || _h2 === void 0 ? void 0 : _h2.showHoverHint)) {
const statusBarElement = $3("div.hover-row.status-bar");
const infoElement = $3("div.info");
infoElement.textContent = localize("hoverhint", "Hold {0} key to mouse over", isMacintosh ? "Option" : "Alt");
statusBarElement.appendChild(infoElement);
this._hover.containerDomNode.appendChild(statusBarElement);
}
const mouseTrackerTargets = [...this._target.targetElements];
if (!hideOnHover) {
mouseTrackerTargets.push(this._hoverContainer);
}
const mouseTracker = this._register(new CompositeMouseTracker(mouseTrackerTargets));
this._register(mouseTracker.onMouseOut(() => {
if (!this._isLocked) {
this.dispose();
}
}));
if (hideOnHover) {
const mouseTracker2Targets = [...this._target.targetElements, this._hoverContainer];
this._lockMouseTracker = this._register(new CompositeMouseTracker(mouseTracker2Targets));
this._register(this._lockMouseTracker.onMouseOut(() => {
if (!this._isLocked) {
this.dispose();
}
}));
} else {
this._lockMouseTracker = mouseTracker;
}
}
addFocusTrap() {
if (!this._enableFocusTraps || this._addedFocusTrap) {
return;
}
this._addedFocusTrap = true;
const firstContainerFocusElement = this._hover.containerDomNode;
const lastContainerFocusElement = this.findLastFocusableChild(this._hover.containerDomNode);
if (lastContainerFocusElement) {
const beforeContainerFocusElement = prepend(this._hoverContainer, $3("div"));
const afterContainerFocusElement = append(this._hoverContainer, $3("div"));
beforeContainerFocusElement.tabIndex = 0;
afterContainerFocusElement.tabIndex = 0;
this._register(addDisposableListener(afterContainerFocusElement, "focus", (e) => {
firstContainerFocusElement.focus();
e.preventDefault();
}));
this._register(addDisposableListener(beforeContainerFocusElement, "focus", (e) => {
lastContainerFocusElement.focus();
e.preventDefault();
}));
}
}
findLastFocusableChild(root) {
if (root.hasChildNodes()) {
for (let i = 0; i < root.childNodes.length; i++) {
const node = root.childNodes.item(root.childNodes.length - i - 1);
if (node.nodeType === node.ELEMENT_NODE) {
const parsedNode = node;
if (typeof parsedNode.tabIndex === "number" && parsedNode.tabIndex >= 0) {
return parsedNode;
}
}
const recursivelyFoundElement = this.findLastFocusableChild(node);
if (recursivelyFoundElement) {
return recursivelyFoundElement;
}
}
}
return void 0;
}
render(container) {
var _a10;
container.appendChild(this._hoverContainer);
const hoverFocused = this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement);
const accessibleViewHint = hoverFocused && getHoverAccessibleViewHint(this._configurationService.getValue("accessibility.verbosity.hover") === true && this._accessibilityService.isScreenReaderOptimized(), (_a10 = this._keybindingService.lookupKeybinding("editor.action.accessibleView")) === null || _a10 === void 0 ? void 0 : _a10.getAriaLabel());
if (accessibleViewHint) {
status(accessibleViewHint);
}
this.layout();
this.addFocusTrap();
}
layout() {
this._hover.containerDomNode.classList.remove("right-aligned");
this._hover.contentsDomNode.style.maxHeight = "";
const getZoomAccountedBoundingClientRect = (e) => {
const zoom = getDomNodeZoomLevel(e);
const boundingRect = e.getBoundingClientRect();
return {
top: boundingRect.top * zoom,
bottom: boundingRect.bottom * zoom,
right: boundingRect.right * zoom,
left: boundingRect.left * zoom
};
};
const targetBounds = this._target.targetElements.map((e) => getZoomAccountedBoundingClientRect(e));
const { top, right, bottom, left } = targetBounds[0];
const width2 = right - left;
const height = bottom - top;
const targetRect = {
top,
right,
bottom,
left,
width: width2,
height,
center: {
x: left + width2 / 2,
y: top + height / 2
}
};
this.adjustHorizontalHoverPosition(targetRect);
this.adjustVerticalHoverPosition(targetRect);
this.adjustHoverMaxHeight(targetRect);
this._hoverContainer.style.padding = "";
this._hoverContainer.style.margin = "";
if (this._hoverPointer) {
switch (this._hoverPosition) {
case 1:
targetRect.left += 3;
targetRect.right += 3;
this._hoverContainer.style.paddingLeft = `${3}px`;
this._hoverContainer.style.marginLeft = `${-3}px`;
break;
case 0:
targetRect.left -= 3;
targetRect.right -= 3;
this._hoverContainer.style.paddingRight = `${3}px`;
this._hoverContainer.style.marginRight = `${-3}px`;
break;
case 2:
targetRect.top += 3;
targetRect.bottom += 3;
this._hoverContainer.style.paddingTop = `${3}px`;
this._hoverContainer.style.marginTop = `${-3}px`;
break;
case 3:
targetRect.top -= 3;
targetRect.bottom -= 3;
this._hoverContainer.style.paddingBottom = `${3}px`;
this._hoverContainer.style.marginBottom = `${-3}px`;
break;
}
targetRect.center.x = targetRect.left + width2 / 2;
targetRect.center.y = targetRect.top + height / 2;
}
this.computeXCordinate(targetRect);
this.computeYCordinate(targetRect);
if (this._hoverPointer) {
this._hoverPointer.classList.remove("top");
this._hoverPointer.classList.remove("left");
this._hoverPointer.classList.remove("right");
this._hoverPointer.classList.remove("bottom");
this.setHoverPointerPosition(targetRect);
}
this._hover.onContentsChanged();
}
computeXCordinate(target) {
const hoverWidth = this._hover.containerDomNode.clientWidth + 2;
if (this._target.x !== void 0) {
this._x = this._target.x;
} else if (this._hoverPosition === 1) {
this._x = target.right;
} else if (this._hoverPosition === 0) {
this._x = target.left - hoverWidth;
} else {
if (this._hoverPointer) {
this._x = target.center.x - this._hover.containerDomNode.clientWidth / 2;
} else {
this._x = target.left;
}
if (this._x + hoverWidth >= this._targetDocumentElement.clientWidth) {
this._hover.containerDomNode.classList.add("right-aligned");
this._x = Math.max(this._targetDocumentElement.clientWidth - hoverWidth - 2, this._targetDocumentElement.clientLeft);
}
}
if (this._x < this._targetDocumentElement.clientLeft) {
this._x = target.left + 2;
}
}
computeYCordinate(target) {
if (this._target.y !== void 0) {
this._y = this._target.y;
} else if (this._hoverPosition === 3) {
this._y = target.top;
} else if (this._hoverPosition === 2) {
this._y = target.bottom - 2;
} else {
if (this._hoverPointer) {
this._y = target.center.y + this._hover.containerDomNode.clientHeight / 2;
} else {
this._y = target.bottom;
}
}
if (this._y > this._targetWindow.innerHeight) {
this._y = target.bottom;
}
}
adjustHorizontalHoverPosition(target) {
if (this._target.x !== void 0) {
return;
}
const hoverPointerOffset = this._hoverPointer ? 3 : 0;
if (this._forcePosition) {
const padding = hoverPointerOffset + 2;
if (this._hoverPosition === 1) {
this._hover.containerDomNode.style.maxWidth = `${this._targetDocumentElement.clientWidth - target.right - padding}px`;
} else if (this._hoverPosition === 0) {
this._hover.containerDomNode.style.maxWidth = `${target.left - padding}px`;
}
return;
}
if (this._hoverPosition === 1) {
const roomOnRight = this._targetDocumentElement.clientWidth - target.right;
if (roomOnRight < this._hover.containerDomNode.clientWidth + hoverPointerOffset) {
const roomOnLeft = target.left;
if (roomOnLeft >= this._hover.containerDomNode.clientWidth + hoverPointerOffset) {
this._hoverPosition = 0;
} else {
this._hoverPosition = 2;
}
}
} else if (this._hoverPosition === 0) {
const roomOnLeft = target.left;
if (roomOnLeft < this._hover.containerDomNode.clientWidth + hoverPointerOffset) {
const roomOnRight = this._targetDocumentElement.clientWidth - target.right;
if (roomOnRight >= this._hover.containerDomNode.clientWidth + hoverPointerOffset) {
this._hoverPosition = 1;
} else {
this._hoverPosition = 2;
}
}
if (target.left - this._hover.containerDomNode.clientWidth - hoverPointerOffset <= this._targetDocumentElement.clientLeft) {
this._hoverPosition = 1;
}
}
}
adjustVerticalHoverPosition(target) {
if (this._target.y !== void 0 || this._forcePosition) {
return;
}
const hoverPointerOffset = this._hoverPointer ? 3 : 0;
if (this._hoverPosition === 3) {
if (target.top - this._hover.containerDomNode.clientHeight - hoverPointerOffset < 0) {
this._hoverPosition = 2;
}
} else if (this._hoverPosition === 2) {
if (target.bottom + this._hover.containerDomNode.clientHeight + hoverPointerOffset > this._targetWindow.innerHeight) {
this._hoverPosition = 3;
}
}
}
adjustHoverMaxHeight(target) {
let maxHeight = this._targetWindow.innerHeight / 2;
if (this._forcePosition) {
const padding = (this._hoverPointer ? 3 : 0) + 2;
if (this._hoverPosition === 3) {
maxHeight = Math.min(maxHeight, target.top - padding);
} else if (this._hoverPosition === 2) {
maxHeight = Math.min(maxHeight, this._targetWindow.innerHeight - target.bottom - padding);
}
}
this._hover.containerDomNode.style.maxHeight = `${maxHeight}px`;
if (this._hover.contentsDomNode.clientHeight < this._hover.contentsDomNode.scrollHeight) {
const extraRightPadding = `${this._hover.scrollbar.options.verticalScrollbarSize}px`;
if (this._hover.contentsDomNode.style.paddingRight !== extraRightPadding) {
this._hover.contentsDomNode.style.paddingRight = extraRightPadding;
}
}
}
setHoverPointerPosition(target) {
if (!this._hoverPointer) {
return;
}
switch (this._hoverPosition) {
case 0:
case 1: {
this._hoverPointer.classList.add(this._hoverPosition === 0 ? "right" : "left");
const hoverHeight = this._hover.containerDomNode.clientHeight;
if (hoverHeight > target.height) {
this._hoverPointer.style.top = `${target.center.y - (this._y - hoverHeight) - 3}px`;
} else {
this._hoverPointer.style.top = `${Math.round(hoverHeight / 2) - 3}px`;
}
break;
}
case 3:
case 2: {
this._hoverPointer.classList.add(this._hoverPosition === 3 ? "bottom" : "top");
const hoverWidth = this._hover.containerDomNode.clientWidth;
let pointerLeftPosition = Math.round(hoverWidth / 2) - 3;
const pointerX = this._x + pointerLeftPosition;
if (pointerX < target.left || pointerX > target.right) {
pointerLeftPosition = target.center.x - this._x - 3;
}
this._hoverPointer.style.left = `${pointerLeftPosition}px`;
break;
}
}
}
focus() {
this._hover.containerDomNode.focus();
}
dispose() {
if (!this._isDisposed) {
this._onDispose.fire();
this._hoverContainer.remove();
this._messageListeners.dispose();
this._target.dispose();
super.dispose();
}
this._isDisposed = true;
}
};
HoverWidget2 = __decorate23([
__param22(1, IKeybindingService),
__param22(2, IConfigurationService),
__param22(3, IOpenerService),
__param22(4, IInstantiationService),
__param22(5, IAccessibilityService)
], HoverWidget2);
CompositeMouseTracker = class extends Widget {
get onMouseOut() {
return this._onMouseOut.event;
}
get isMouseIn() {
return this._isMouseIn;
}
constructor(_elements) {
super();
this._elements = _elements;
this._isMouseIn = true;
this._onMouseOut = this._register(new Emitter());
this._elements.forEach((n) => this.onmouseover(n, () => this._onTargetMouseOver(n)));
this._elements.forEach((n) => this.onmouseleave(n, () => this._onTargetMouseLeave(n)));
}
_onTargetMouseOver(target) {
this._isMouseIn = true;
this._clearEvaluateMouseStateTimeout(target);
}
_onTargetMouseLeave(target) {
this._isMouseIn = false;
this._evaluateMouseState(target);
}
_evaluateMouseState(target) {
this._clearEvaluateMouseStateTimeout(target);
this._mouseTimeout = getWindow(target).setTimeout(() => this._fireIfMouseOutside(), 0);
}
_clearEvaluateMouseStateTimeout(target) {
if (this._mouseTimeout) {
getWindow(target).clearTimeout(this._mouseTimeout);
this._mouseTimeout = void 0;
}
}
_fireIfMouseOutside() {
if (!this._isMouseIn) {
this._onMouseOut.fire();
}
}
};
ElementHoverTarget = class {
constructor(_element) {
this._element = _element;
this.targetElements = [this._element];
}
dispose() {
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/range.js
var Range2;
var init_range2 = __esm({
"node_modules/monaco-editor/esm/vs/base/common/range.js"() {
(function(Range10) {
function intersect(one, other) {
if (one.start >= other.end || other.start >= one.end) {
return { start: 0, end: 0 };
}
const start = Math.max(one.start, other.start);
const end = Math.min(one.end, other.end);
if (end - start <= 0) {
return { start: 0, end: 0 };
}
return { start, end };
}
Range10.intersect = intersect;
function isEmpty(range2) {
return range2.end - range2.start <= 0;
}
Range10.isEmpty = isEmpty;
function intersects2(one, other) {
return !isEmpty(intersect(one, other));
}
Range10.intersects = intersects2;
function relativeComplement2(one, other) {
const result = [];
const first2 = { start: one.start, end: Math.min(other.start, one.end) };
const second = { start: Math.max(other.end, one.start), end: one.end };
if (!isEmpty(first2)) {
result.push(first2);
}
if (!isEmpty(second)) {
result.push(second);
}
return result;
}
Range10.relativeComplement = relativeComplement2;
})(Range2 || (Range2 = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css
var init_contextview = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js
function isAnchor(obj) {
const anchor = obj;
return !!anchor && typeof anchor.x === "number" && typeof anchor.y === "number";
}
function layout(viewportSize, viewSize, anchor) {
const layoutAfterAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset : anchor.offset + anchor.size;
const layoutBeforeAnchorBoundary = anchor.mode === LayoutAnchorMode.ALIGN ? anchor.offset + anchor.size : anchor.offset;
if (anchor.position === 0) {
if (viewSize <= viewportSize - layoutAfterAnchorBoundary) {
return layoutAfterAnchorBoundary;
}
if (viewSize <= layoutBeforeAnchorBoundary) {
return layoutBeforeAnchorBoundary - viewSize;
}
return Math.max(viewportSize - viewSize, 0);
} else {
if (viewSize <= layoutBeforeAnchorBoundary) {
return layoutBeforeAnchorBoundary - viewSize;
}
if (viewSize <= viewportSize - layoutAfterAnchorBoundary) {
return layoutAfterAnchorBoundary;
}
return 0;
}
}
var LayoutAnchorMode, ContextView, SHADOW_ROOT_CSS;
var init_contextview2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js"() {
init_canIUse();
init_dom();
init_lifecycle();
init_platform();
init_range2();
init_contextview();
(function(LayoutAnchorMode2) {
LayoutAnchorMode2[LayoutAnchorMode2["AVOID"] = 0] = "AVOID";
LayoutAnchorMode2[LayoutAnchorMode2["ALIGN"] = 1] = "ALIGN";
})(LayoutAnchorMode || (LayoutAnchorMode = {}));
ContextView = class _ContextView extends Disposable {
constructor(container, domPosition) {
super();
this.container = null;
this.useFixedPosition = false;
this.useShadowDOM = false;
this.delegate = null;
this.toDisposeOnClean = Disposable.None;
this.toDisposeOnSetContainer = Disposable.None;
this.shadowRoot = null;
this.shadowRootHostElement = null;
this.view = $(".context-view");
hide(this.view);
this.setContainer(container, domPosition);
this._register(toDisposable(() => this.setContainer(
null,
1
/* ContextViewDOMPosition.ABSOLUTE */
)));
}
setContainer(container, domPosition) {
var _a10;
this.useFixedPosition = domPosition !== 1;
const usedShadowDOM = this.useShadowDOM;
this.useShadowDOM = domPosition === 3;
if (container === this.container && usedShadowDOM === this.useShadowDOM) {
return;
}
if (this.container) {
this.toDisposeOnSetContainer.dispose();
if (this.shadowRoot) {
this.shadowRoot.removeChild(this.view);
this.shadowRoot = null;
(_a10 = this.shadowRootHostElement) === null || _a10 === void 0 ? void 0 : _a10.remove();
this.shadowRootHostElement = null;
} else {
this.container.removeChild(this.view);
}
this.container = null;
}
if (container) {
this.container = container;
if (this.useShadowDOM) {
this.shadowRootHostElement = $(".shadow-root-host");
this.container.appendChild(this.shadowRootHostElement);
this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: "open" });
const style = document.createElement("style");
style.textContent = SHADOW_ROOT_CSS;
this.shadowRoot.appendChild(style);
this.shadowRoot.appendChild(this.view);
this.shadowRoot.appendChild($("slot"));
} else {
this.container.appendChild(this.view);
}
const toDisposeOnSetContainer = new DisposableStore();
_ContextView.BUBBLE_UP_EVENTS.forEach((event) => {
toDisposeOnSetContainer.add(addStandardDisposableListener(this.container, event, (e) => {
this.onDOMEvent(e, false);
}));
});
_ContextView.BUBBLE_DOWN_EVENTS.forEach((event) => {
toDisposeOnSetContainer.add(addStandardDisposableListener(this.container, event, (e) => {
this.onDOMEvent(e, true);
}, true));
});
this.toDisposeOnSetContainer = toDisposeOnSetContainer;
}
}
show(delegate) {
var _a10, _b4, _c2;
if (this.isVisible()) {
this.hide();
}
clearNode(this.view);
this.view.className = "context-view monaco-component";
this.view.style.top = "0px";
this.view.style.left = "0px";
this.view.style.zIndex = `${2575 + ((_a10 = delegate.layer) !== null && _a10 !== void 0 ? _a10 : 0)}`;
this.view.style.position = this.useFixedPosition ? "fixed" : "absolute";
show(this.view);
this.toDisposeOnClean = delegate.render(this.view) || Disposable.None;
this.delegate = delegate;
this.doLayout();
(_c2 = (_b4 = this.delegate).focus) === null || _c2 === void 0 ? void 0 : _c2.call(_b4);
}
getViewElement() {
return this.view;
}
layout() {
var _a10, _b4;
if (!this.isVisible()) {
return;
}
if (this.delegate.canRelayout === false && !(isIOS && BrowserFeatures.pointerEvents)) {
this.hide();
return;
}
(_b4 = (_a10 = this.delegate) === null || _a10 === void 0 ? void 0 : _a10.layout) === null || _b4 === void 0 ? void 0 : _b4.call(_a10);
this.doLayout();
}
doLayout() {
if (!this.isVisible()) {
return;
}
const anchor = this.delegate.getAnchor();
let around;
if (isHTMLElement(anchor)) {
const elementPosition = getDomNodePagePosition(anchor);
const zoom = getDomNodeZoomLevel(anchor);
around = {
top: elementPosition.top * zoom,
left: elementPosition.left * zoom,
width: elementPosition.width * zoom,
height: elementPosition.height * zoom
};
} else if (isAnchor(anchor)) {
around = {
top: anchor.y,
left: anchor.x,
width: anchor.width || 1,
height: anchor.height || 2
};
} else {
around = {
top: anchor.posy,
left: anchor.posx,
// We are about to position the context view where the mouse
// cursor is. To prevent the view being exactly under the mouse
// when showing and thus potentially triggering an action within,
// we treat the mouse location like a small sized block element.
width: 2,
height: 2
};
}
const viewSizeWidth = getTotalWidth(this.view);
const viewSizeHeight = getTotalHeight(this.view);
const anchorPosition = this.delegate.anchorPosition || 0;
const anchorAlignment = this.delegate.anchorAlignment || 0;
const anchorAxisAlignment = this.delegate.anchorAxisAlignment || 0;
let top;
let left;
const activeWindow = getActiveWindow();
if (anchorAxisAlignment === 0) {
const verticalAnchor = {
offset: around.top - activeWindow.pageYOffset,
size: around.height,
position: anchorPosition === 0 ? 0 : 1
/* LayoutAnchorPosition.After */
};
const horizontalAnchor = { offset: around.left, size: around.width, position: anchorAlignment === 0 ? 0 : 1, mode: LayoutAnchorMode.ALIGN };
top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset;
if (Range2.intersects({ start: top, end: top + viewSizeHeight }, { start: verticalAnchor.offset, end: verticalAnchor.offset + verticalAnchor.size })) {
horizontalAnchor.mode = LayoutAnchorMode.AVOID;
}
left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor);
} else {
const horizontalAnchor = {
offset: around.left,
size: around.width,
position: anchorAlignment === 0 ? 0 : 1
/* LayoutAnchorPosition.After */
};
const verticalAnchor = { offset: around.top, size: around.height, position: anchorPosition === 0 ? 0 : 1, mode: LayoutAnchorMode.ALIGN };
left = layout(activeWindow.innerWidth, viewSizeWidth, horizontalAnchor);
if (Range2.intersects({ start: left, end: left + viewSizeWidth }, { start: horizontalAnchor.offset, end: horizontalAnchor.offset + horizontalAnchor.size })) {
verticalAnchor.mode = LayoutAnchorMode.AVOID;
}
top = layout(activeWindow.innerHeight, viewSizeHeight, verticalAnchor) + activeWindow.pageYOffset;
}
this.view.classList.remove("top", "bottom", "left", "right");
this.view.classList.add(anchorPosition === 0 ? "bottom" : "top");
this.view.classList.add(anchorAlignment === 0 ? "left" : "right");
this.view.classList.toggle("fixed", this.useFixedPosition);
const containerPosition = getDomNodePagePosition(this.container);
this.view.style.top = `${top - (this.useFixedPosition ? getDomNodePagePosition(this.view).top : containerPosition.top)}px`;
this.view.style.left = `${left - (this.useFixedPosition ? getDomNodePagePosition(this.view).left : containerPosition.left)}px`;
this.view.style.width = "initial";
}
hide(data) {
const delegate = this.delegate;
this.delegate = null;
if (delegate === null || delegate === void 0 ? void 0 : delegate.onHide) {
delegate.onHide(data);
}
this.toDisposeOnClean.dispose();
hide(this.view);
}
isVisible() {
return !!this.delegate;
}
onDOMEvent(e, onCapture) {
if (this.delegate) {
if (this.delegate.onDOMEvent) {
this.delegate.onDOMEvent(e, getWindow(e).document.activeElement);
} else if (onCapture && !isAncestor(e.target, this.container)) {
this.hide();
}
}
}
dispose() {
this.hide();
super.dispose();
}
};
ContextView.BUBBLE_UP_EVENTS = ["click", "keydown", "focus", "blur"];
ContextView.BUBBLE_DOWN_EVENTS = ["click"];
SHADOW_ROOT_CSS = /* css */
`
: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; }
`;
}
});
// node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextViewService.js
var __decorate24, __param23, ContextViewHandler, ContextViewService;
var init_contextViewService = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextViewService.js"() {
init_contextview2();
init_lifecycle();
init_layoutService();
init_dom();
__decorate24 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param23 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
ContextViewHandler = class ContextViewHandler2 extends Disposable {
constructor(layoutService) {
super();
this.layoutService = layoutService;
this.contextView = this._register(new ContextView(
this.layoutService.mainContainer,
1
/* ContextViewDOMPosition.ABSOLUTE */
));
this.layout();
this._register(layoutService.onDidLayoutContainer(() => this.layout()));
}
// ContextView
showContextView(delegate, container, shadowRoot) {
let domPosition;
if (container) {
if (container === this.layoutService.getContainer(getWindow(container))) {
domPosition = 1;
} else if (shadowRoot) {
domPosition = 3;
} else {
domPosition = 2;
}
} else {
domPosition = 1;
}
this.contextView.setContainer(container !== null && container !== void 0 ? container : this.layoutService.activeContainer, domPosition);
this.contextView.show(delegate);
const openContextView = {
close: () => {
if (this.openContextView === openContextView) {
this.hideContextView();
}
}
};
this.openContextView = openContextView;
return openContextView;
}
layout() {
this.contextView.layout();
}
hideContextView(data) {
this.contextView.hide(data);
this.openContextView = void 0;
}
};
ContextViewHandler = __decorate24([
__param23(0, ILayoutService)
], ContextViewHandler);
ContextViewService = class extends ContextViewHandler {
getContextViewElement() {
return this.contextView.getViewElement();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/updatableHoverWidget.js
var UpdatableHoverWidget;
var init_updatableHoverWidget = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/updatableHoverWidget.js"() {
init_dom();
init_cancellation();
init_htmlContent();
init_types();
init_nls();
UpdatableHoverWidget = class {
constructor(hoverDelegate, target, fadeInAnimation) {
this.hoverDelegate = hoverDelegate;
this.target = target;
this.fadeInAnimation = fadeInAnimation;
}
update(content, focus, options2) {
return __async(this, null, function* () {
var _a10;
if (this._cancellationTokenSource) {
this._cancellationTokenSource.dispose(true);
this._cancellationTokenSource = void 0;
}
if (this.isDisposed) {
return;
}
let resolvedContent;
if (content === void 0 || isString(content) || isHTMLElement(content)) {
resolvedContent = content;
} else if (!isFunction(content.markdown)) {
resolvedContent = (_a10 = content.markdown) !== null && _a10 !== void 0 ? _a10 : content.markdownNotSupportedFallback;
} else {
if (!this._hoverWidget) {
this.show(localize("iconLabel.loading", "Loading..."), focus, options2);
}
this._cancellationTokenSource = new CancellationTokenSource();
const token = this._cancellationTokenSource.token;
resolvedContent = yield content.markdown(token);
if (resolvedContent === void 0) {
resolvedContent = content.markdownNotSupportedFallback;
}
if (this.isDisposed || token.isCancellationRequested) {
return;
}
}
this.show(resolvedContent, focus, options2);
});
}
show(content, focus, options2) {
const oldHoverWidget = this._hoverWidget;
if (this.hasContent(content)) {
const hoverOptions = __spreadValues({
content,
target: this.target,
appearance: {
showPointer: this.hoverDelegate.placement === "element",
skipFadeInAnimation: !this.fadeInAnimation || !!oldHoverWidget
// do not fade in if the hover is already showing
},
position: {
hoverPosition: 2
}
}, options2);
this._hoverWidget = this.hoverDelegate.showHover(hoverOptions, focus);
}
oldHoverWidget === null || oldHoverWidget === void 0 ? void 0 : oldHoverWidget.dispose();
}
hasContent(content) {
if (!content) {
return false;
}
if (isMarkdownString(content)) {
return !!content.value;
}
return true;
}
get isDisposed() {
var _a10;
return (_a10 = this._hoverWidget) === null || _a10 === void 0 ? void 0 : _a10.isDisposed;
}
dispose() {
var _a10, _b4;
(_a10 = this._hoverWidget) === null || _a10 === void 0 ? void 0 : _a10.dispose();
(_b4 = this._cancellationTokenSource) === null || _b4 === void 0 ? void 0 : _b4.dispose(true);
this._cancellationTokenSource = void 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverService.js
function getHoverOptionsIdentity(options2) {
var _a10;
if (options2 === void 0) {
return void 0;
}
return (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.id) !== null && _a10 !== void 0 ? _a10 : options2;
}
function getHoverTargetElement(element, stopElement) {
stopElement = stopElement !== null && stopElement !== void 0 ? stopElement : getWindow(element).document.body;
while (!element.hasAttribute("custom-hover") && element !== stopElement) {
element = element.parentElement;
}
return element;
}
var __decorate25, __param24, HoverService, HoverContextViewDelegate;
var init_hoverService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/hoverService/hoverService.js"() {
init_extensions();
init_themeService();
init_colorRegistry();
init_hover();
init_contextView();
init_instantiation();
init_hoverWidget3();
init_lifecycle();
init_dom();
init_keybinding();
init_keyboardEvent();
init_accessibility();
init_layoutService();
init_window();
init_contextViewService();
init_updatableHoverWidget();
init_async();
__decorate25 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param24 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
HoverService = class HoverService2 extends Disposable {
constructor(_instantiationService, contextMenuService, _keybindingService, _layoutService, _accessibilityService) {
super();
this._instantiationService = _instantiationService;
this._keybindingService = _keybindingService;
this._layoutService = _layoutService;
this._accessibilityService = _accessibilityService;
this._existingHovers = /* @__PURE__ */ new Map();
contextMenuService.onDidShowContextMenu(() => this.hideHover());
this._contextViewHandler = this._register(new ContextViewHandler(this._layoutService));
}
showHover(options2, focus, skipLastFocusedUpdate) {
var _a10, _b4, _c2, _d2;
if (getHoverOptionsIdentity(this._currentHoverOptions) === getHoverOptionsIdentity(options2)) {
return void 0;
}
if (this._currentHover && ((_b4 = (_a10 = this._currentHoverOptions) === null || _a10 === void 0 ? void 0 : _a10.persistence) === null || _b4 === void 0 ? void 0 : _b4.sticky)) {
return void 0;
}
this._currentHoverOptions = options2;
this._lastHoverOptions = options2;
const trapFocus = options2.trapFocus || this._accessibilityService.isScreenReaderOptimized();
const activeElement = getActiveElement();
if (!skipLastFocusedUpdate) {
if (trapFocus && activeElement) {
if (!activeElement.classList.contains("monaco-hover")) {
this._lastFocusedElementBeforeOpen = activeElement;
}
} else {
this._lastFocusedElementBeforeOpen = void 0;
}
}
const hoverDisposables = new DisposableStore();
const hover = this._instantiationService.createInstance(HoverWidget2, options2);
if ((_c2 = options2.persistence) === null || _c2 === void 0 ? void 0 : _c2.sticky) {
hover.isLocked = true;
}
hover.onDispose(() => {
var _a11, _b5;
const hoverWasFocused = ((_a11 = this._currentHover) === null || _a11 === void 0 ? void 0 : _a11.domNode) && isAncestorOfActiveElement(this._currentHover.domNode);
if (hoverWasFocused) {
(_b5 = this._lastFocusedElementBeforeOpen) === null || _b5 === void 0 ? void 0 : _b5.focus();
}
if (this._currentHoverOptions === options2) {
this._currentHoverOptions = void 0;
}
hoverDisposables.dispose();
}, void 0, hoverDisposables);
if (!options2.container) {
const targetElement = isHTMLElement(options2.target) ? options2.target : options2.target.targetElements[0];
options2.container = this._layoutService.getContainer(getWindow(targetElement));
}
this._contextViewHandler.showContextView(new HoverContextViewDelegate(hover, focus), options2.container);
hover.onRequestLayout(() => this._contextViewHandler.layout(), void 0, hoverDisposables);
if ((_d2 = options2.persistence) === null || _d2 === void 0 ? void 0 : _d2.sticky) {
hoverDisposables.add(addDisposableListener(getWindow(options2.container).document, EventType.MOUSE_DOWN, (e) => {
if (!isAncestor(e.target, hover.domNode)) {
this.doHideHover();
}
}));
} else {
if ("targetElements" in options2.target) {
for (const element of options2.target.targetElements) {
hoverDisposables.add(addDisposableListener(element, EventType.CLICK, () => this.hideHover()));
}
} else {
hoverDisposables.add(addDisposableListener(options2.target, EventType.CLICK, () => this.hideHover()));
}
const focusedElement = getActiveElement();
if (focusedElement) {
const focusedElementDocument = getWindow(focusedElement).document;
hoverDisposables.add(addDisposableListener(focusedElement, EventType.KEY_DOWN, (e) => {
var _a11;
return this._keyDown(e, hover, !!((_a11 = options2.persistence) === null || _a11 === void 0 ? void 0 : _a11.hideOnKeyDown));
}));
hoverDisposables.add(addDisposableListener(focusedElementDocument, EventType.KEY_DOWN, (e) => {
var _a11;
return this._keyDown(e, hover, !!((_a11 = options2.persistence) === null || _a11 === void 0 ? void 0 : _a11.hideOnKeyDown));
}));
hoverDisposables.add(addDisposableListener(focusedElement, EventType.KEY_UP, (e) => this._keyUp(e, hover)));
hoverDisposables.add(addDisposableListener(focusedElementDocument, EventType.KEY_UP, (e) => this._keyUp(e, hover)));
}
}
if ("IntersectionObserver" in mainWindow) {
const observer = new IntersectionObserver((e) => this._intersectionChange(e, hover), { threshold: 0 });
const firstTargetElement = "targetElements" in options2.target ? options2.target.targetElements[0] : options2.target;
observer.observe(firstTargetElement);
hoverDisposables.add(toDisposable(() => observer.disconnect()));
}
this._currentHover = hover;
return hover;
}
hideHover() {
var _a10;
if (((_a10 = this._currentHover) === null || _a10 === void 0 ? void 0 : _a10.isLocked) || !this._currentHoverOptions) {
return;
}
this.doHideHover();
}
doHideHover() {
this._currentHover = void 0;
this._currentHoverOptions = void 0;
this._contextViewHandler.hideContextView();
}
_intersectionChange(entries2, hover) {
const entry = entries2[entries2.length - 1];
if (!entry.isIntersecting) {
hover.dispose();
}
}
showAndFocusLastHover() {
if (!this._lastHoverOptions) {
return;
}
this.showHover(this._lastHoverOptions, true, true);
}
_keyDown(e, hover, hideOnKeyDown) {
var _a10, _b4;
if (e.key === "Alt") {
hover.isLocked = true;
return;
}
const event = new StandardKeyboardEvent(e);
const keybinding = this._keybindingService.resolveKeyboardEvent(event);
if (keybinding.getSingleModifierDispatchChords().some((value) => !!value) || this._keybindingService.softDispatch(event, event.target).kind !== 0) {
return;
}
if (hideOnKeyDown && (!((_a10 = this._currentHoverOptions) === null || _a10 === void 0 ? void 0 : _a10.trapFocus) || e.key !== "Tab")) {
this.hideHover();
(_b4 = this._lastFocusedElementBeforeOpen) === null || _b4 === void 0 ? void 0 : _b4.focus();
}
}
_keyUp(e, hover) {
var _a10;
if (e.key === "Alt") {
hover.isLocked = false;
if (!hover.isMouseIn) {
this.hideHover();
(_a10 = this._lastFocusedElementBeforeOpen) === null || _a10 === void 0 ? void 0 : _a10.focus();
}
}
}
// TODO: Investigate performance of this function. There seems to be a lot of content created
// and thrown away on start up
setupUpdatableHover(hoverDelegate, htmlElement, content, options2) {
htmlElement.setAttribute("custom-hover", "true");
if (htmlElement.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:", htmlElement.title);
htmlElement.title = "";
}
let hoverPreparation;
let hoverWidget;
const hideHover = (disposeWidget, disposePreparation) => {
var _a10;
const hadHover = hoverWidget !== void 0;
if (disposeWidget) {
hoverWidget === null || hoverWidget === void 0 ? void 0 : hoverWidget.dispose();
hoverWidget = void 0;
}
if (disposePreparation) {
hoverPreparation === null || hoverPreparation === void 0 ? void 0 : hoverPreparation.dispose();
hoverPreparation = void 0;
}
if (hadHover) {
(_a10 = hoverDelegate.onDidHideHover) === null || _a10 === void 0 ? void 0 : _a10.call(hoverDelegate);
hoverWidget = void 0;
}
};
const triggerShowHover = (delay, focus, target, trapFocus) => {
return new TimeoutTimer(() => __async(this, null, function* () {
if (!hoverWidget || hoverWidget.isDisposed) {
hoverWidget = new UpdatableHoverWidget(hoverDelegate, target || htmlElement, delay > 0);
yield hoverWidget.update(typeof content === "function" ? content() : content, focus, __spreadProps(__spreadValues({}, options2), { trapFocus }));
}
}), delay);
};
let isMouseDown = false;
const mouseDownEmitter = addDisposableListener(htmlElement, EventType.MOUSE_DOWN, () => {
isMouseDown = true;
hideHover(true, true);
}, true);
const mouseUpEmitter = addDisposableListener(htmlElement, EventType.MOUSE_UP, () => {
isMouseDown = false;
}, true);
const mouseLeaveEmitter = addDisposableListener(htmlElement, EventType.MOUSE_LEAVE, (e) => {
isMouseDown = false;
hideHover(false, e.fromElement === htmlElement);
}, true);
const onMouseOver = (e) => {
if (hoverPreparation) {
return;
}
const toDispose = new DisposableStore();
const target = {
targetElements: [htmlElement],
dispose: () => {
}
};
if (hoverDelegate.placement === void 0 || hoverDelegate.placement === "mouse") {
const onMouseMove = (e2) => {
target.x = e2.x + 10;
if (isHTMLElement(e2.target) && getHoverTargetElement(e2.target, htmlElement) !== htmlElement) {
hideHover(true, true);
}
};
toDispose.add(addDisposableListener(htmlElement, EventType.MOUSE_MOVE, onMouseMove, true));
}
hoverPreparation = toDispose;
if (isHTMLElement(e.target) && getHoverTargetElement(e.target, htmlElement) !== htmlElement) {
return;
}
toDispose.add(triggerShowHover(hoverDelegate.delay, false, target));
};
const mouseOverDomEmitter = addDisposableListener(htmlElement, EventType.MOUSE_OVER, onMouseOver, true);
const onFocus = () => {
if (isMouseDown || hoverPreparation) {
return;
}
const target = {
targetElements: [htmlElement],
dispose: () => {
}
};
const toDispose = new DisposableStore();
const onBlur = () => hideHover(true, true);
toDispose.add(addDisposableListener(htmlElement, EventType.BLUR, onBlur, true));
toDispose.add(triggerShowHover(hoverDelegate.delay, false, target));
hoverPreparation = toDispose;
};
let focusDomEmitter;
const tagName = htmlElement.tagName.toLowerCase();
if (tagName !== "input" && tagName !== "textarea") {
focusDomEmitter = addDisposableListener(htmlElement, EventType.FOCUS, onFocus, true);
}
const hover = {
show: (focus) => {
hideHover(false, true);
triggerShowHover(0, focus, void 0, focus);
},
hide: () => {
hideHover(true, true);
},
update: (newContent, hoverOptions) => __async(this, null, function* () {
content = newContent;
yield hoverWidget === null || hoverWidget === void 0 ? void 0 : hoverWidget.update(content, void 0, hoverOptions);
}),
dispose: () => {
this._existingHovers.delete(htmlElement);
mouseOverDomEmitter.dispose();
mouseLeaveEmitter.dispose();
mouseDownEmitter.dispose();
mouseUpEmitter.dispose();
focusDomEmitter === null || focusDomEmitter === void 0 ? void 0 : focusDomEmitter.dispose();
hideHover(true, true);
}
};
this._existingHovers.set(htmlElement, hover);
return hover;
}
triggerUpdatableHover(target) {
const hover = this._existingHovers.get(target);
if (hover) {
hover.show(true);
}
}
dispose() {
this._existingHovers.forEach((hover) => hover.dispose());
super.dispose();
}
};
HoverService = __decorate25([
__param24(0, IInstantiationService),
__param24(1, IContextMenuService),
__param24(2, IKeybindingService),
__param24(3, ILayoutService),
__param24(4, IAccessibilityService)
], HoverService);
HoverContextViewDelegate = class {
get anchorPosition() {
return this._hover.anchor;
}
constructor(_hover, _focus = false) {
this._hover = _hover;
this._focus = _focus;
this.layer = 1;
}
render(container) {
this._hover.render(container);
if (this._focus) {
this._hover.focus();
}
return this._hover;
}
getAnchor() {
return {
x: this._hover.x,
y: this._hover.y
};
}
layout() {
this._hover.layout();
}
};
registerSingleton(
IHoverService,
HoverService,
1
/* InstantiationType.Delayed */
);
registerThemingParticipant((theme, collector) => {
const hoverBorder = theme.getColor(editorHoverBorder);
if (hoverBorder) {
collector.addRule(`.monaco-workbench .workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${hoverBorder.transparent(0.5)}; }`);
collector.addRule(`.monaco-workbench .workbench-hover hr { border-top: 1px solid ${hoverBorder.transparent(0.5)}; }`);
}
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/bulkEditService.js
var IBulkEditService, ResourceEdit, ResourceTextEdit, ResourceFileEdit;
var init_bulkEditService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/bulkEditService.js"() {
init_instantiation();
init_uri();
init_types();
IBulkEditService = createDecorator("IWorkspaceEditService");
ResourceEdit = class {
constructor(metadata) {
this.metadata = metadata;
}
static convert(edit) {
return edit.edits.map((edit2) => {
if (ResourceTextEdit.is(edit2)) {
return ResourceTextEdit.lift(edit2);
}
if (ResourceFileEdit.is(edit2)) {
return ResourceFileEdit.lift(edit2);
}
throw new Error("Unsupported edit");
});
}
};
ResourceTextEdit = class _ResourceTextEdit extends ResourceEdit {
static is(candidate) {
if (candidate instanceof _ResourceTextEdit) {
return true;
}
return isObject(candidate) && URI.isUri(candidate.resource) && isObject(candidate.textEdit);
}
static lift(edit) {
if (edit instanceof _ResourceTextEdit) {
return edit;
} else {
return new _ResourceTextEdit(edit.resource, edit.textEdit, edit.versionId, edit.metadata);
}
}
constructor(resource, textEdit, versionId = void 0, metadata) {
super(metadata);
this.resource = resource;
this.textEdit = textEdit;
this.versionId = versionId;
}
};
ResourceFileEdit = class _ResourceFileEdit extends ResourceEdit {
static is(candidate) {
if (candidate instanceof _ResourceFileEdit) {
return true;
} else {
return isObject(candidate) && (Boolean(candidate.newResource) || Boolean(candidate.oldResource));
}
}
static lift(edit) {
if (edit instanceof _ResourceFileEdit) {
return edit;
} else {
return new _ResourceFileEdit(edit.oldResource, edit.newResource, edit.options, edit.metadata);
}
}
constructor(oldResource, newResource, options2 = {}, metadata) {
super(metadata);
this.oldResource = oldResource;
this.newResource = newResource;
this.options = options2;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/config/diffEditor.js
var diffEditorDefaultOptions;
var init_diffEditor = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/config/diffEditor.js"() {
diffEditorDefaultOptions = {
enableSplitViewResizing: true,
splitViewDefaultRatio: 0.5,
renderSideBySide: true,
renderMarginRevertIcon: true,
renderGutterMenu: true,
maxComputationTime: 5e3,
maxFileSize: 50,
ignoreTrimWhitespace: true,
renderIndicators: true,
originalEditable: false,
diffCodeLens: false,
renderOverviewRuler: true,
diffWordWrap: "inherit",
diffAlgorithm: "advanced",
accessibilityVerbose: false,
experimental: {
showMoves: false,
showEmptyDecorations: true
},
hideUnchangedRegions: {
enabled: false,
contextLineCount: 3,
minimumLineCount: 3,
revealLineCount: 20
},
isInEmbeddedEditor: false,
onlyShowAccessibleDiffViewer: false,
renderSideBySideInlineBreakpoint: 900,
useInlineViewWhenSpaceIsLimited: true
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/config/editorConfigurationSchema.js
function isConfigurationPropertySchema(x) {
return typeof x.type !== "undefined" || typeof x.anyOf !== "undefined";
}
function getEditorConfigurationKeys() {
if (cachedEditorConfigurationKeys === null) {
cachedEditorConfigurationKeys = /* @__PURE__ */ Object.create(null);
Object.keys(editorConfiguration.properties).forEach((prop) => {
cachedEditorConfigurationKeys[prop] = true;
});
}
return cachedEditorConfigurationKeys;
}
function isEditorConfigurationKey(key) {
const editorConfigurationKeys = getEditorConfigurationKeys();
return editorConfigurationKeys[`editor.${key}`] || false;
}
function isDiffEditorConfigurationKey(key) {
const editorConfigurationKeys = getEditorConfigurationKeys();
return editorConfigurationKeys[`diffEditor.${key}`] || false;
}
var editorConfigurationBaseNode, editorConfiguration, cachedEditorConfigurationKeys, configurationRegistry2;
var init_editorConfigurationSchema = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/config/editorConfigurationSchema.js"() {
init_diffEditor();
init_editorOptions();
init_textModelDefaults();
init_nls();
init_configurationRegistry();
init_platform2();
editorConfigurationBaseNode = Object.freeze({
id: "editor",
order: 5,
type: "object",
title: localize("editorConfigurationTitle", "Editor"),
scope: 5
});
editorConfiguration = __spreadProps(__spreadValues({}, editorConfigurationBaseNode), {
properties: {
"editor.tabSize": {
type: "number",
default: EDITOR_MODEL_DEFAULTS.tabSize,
minimum: 1,
markdownDescription: localize("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: localize("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: EDITOR_MODEL_DEFAULTS.insertSpaces,
markdownDescription: localize("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: EDITOR_MODEL_DEFAULTS.detectIndentation,
markdownDescription: localize("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: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
description: localize("trimAutoWhitespace", "Remove trailing auto inserted whitespace.")
},
"editor.largeFileOptimizations": {
type: "boolean",
default: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
description: localize("largeFileOptimizations", "Special handling for large files to disable certain memory intensive features.")
},
"editor.wordBasedSuggestions": {
enum: ["off", "currentDocument", "matchingDocuments", "allDocuments"],
default: "matchingDocuments",
enumDescriptions: [
localize("wordBasedSuggestions.off", "Turn off Word Based Suggestions."),
localize("wordBasedSuggestions.currentDocument", "Only suggest words from the active document."),
localize("wordBasedSuggestions.matchingDocuments", "Suggest words from all open documents of the same language."),
localize("wordBasedSuggestions.allDocuments", "Suggest words from all open documents.")
],
description: localize("wordBasedSuggestions", "Controls whether completions should be computed based on words in the document and from which documents they are computed.")
},
"editor.semanticHighlighting.enabled": {
enum: [true, false, "configuredByTheme"],
enumDescriptions: [
localize("semanticHighlighting.true", "Semantic highlighting enabled for all color themes."),
localize("semanticHighlighting.false", "Semantic highlighting disabled for all color themes."),
localize("semanticHighlighting.configuredByTheme", "Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")
],
default: "configuredByTheme",
description: localize("semanticHighlighting.enabled", "Controls whether the semanticHighlighting is shown for the languages that support it.")
},
"editor.stablePeek": {
type: "boolean",
default: false,
markdownDescription: localize("stablePeek", "Keep peek editors open even when double-clicking their content or when hitting `Escape`.")
},
"editor.maxTokenizationLineLength": {
type: "integer",
default: 2e4,
description: localize("maxTokenizationLineLength", "Lines above this length will not be tokenized for performance reasons")
},
"editor.experimental.asyncTokenization": {
type: "boolean",
default: false,
description: localize("editor.experimental.asyncTokenization", "Controls whether the tokenization should happen asynchronously on a web worker."),
tags: ["experimental"]
},
"editor.experimental.asyncTokenizationLogging": {
type: "boolean",
default: false,
description: localize("editor.experimental.asyncTokenizationLogging", "Controls whether async tokenization should be logged. For debugging only.")
},
"editor.experimental.asyncTokenizationVerification": {
type: "boolean",
default: false,
description: localize("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,
// We want to distinguish the empty array from not configured.
description: localize("schema.brackets", "Defines the bracket symbols that increase or decrease the indentation."),
items: {
type: "array",
items: [
{
type: "string",
description: localize("schema.openBracket", "The opening bracket character or string sequence.")
},
{
type: "string",
description: localize("schema.closeBracket", "The closing bracket character or string sequence.")
}
]
}
},
"editor.language.colorizedBracketPairs": {
type: ["array", "null"],
default: null,
// We want to distinguish the empty array from not configured.
description: localize("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: localize("schema.openBracket", "The opening bracket character or string sequence.")
},
{
type: "string",
description: localize("schema.closeBracket", "The closing bracket character or string sequence.")
}
]
}
},
"diffEditor.maxComputationTime": {
type: "number",
default: diffEditorDefaultOptions.maxComputationTime,
description: localize("maxComputationTime", "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")
},
"diffEditor.maxFileSize": {
type: "number",
default: diffEditorDefaultOptions.maxFileSize,
description: localize("maxFileSize", "Maximum file size in MB for which to compute diffs. Use 0 for no limit.")
},
"diffEditor.renderSideBySide": {
type: "boolean",
default: diffEditorDefaultOptions.renderSideBySide,
description: localize("sideBySide", "Controls whether the diff editor shows the diff side by side or inline.")
},
"diffEditor.renderSideBySideInlineBreakpoint": {
type: "number",
default: diffEditorDefaultOptions.renderSideBySideInlineBreakpoint,
description: localize("renderSideBySideInlineBreakpoint", "If the diff editor width is smaller than this value, the inline view is used.")
},
"diffEditor.useInlineViewWhenSpaceIsLimited": {
type: "boolean",
default: diffEditorDefaultOptions.useInlineViewWhenSpaceIsLimited,
description: localize("useInlineViewWhenSpaceIsLimited", "If enabled and the editor width is too small, the inline view is used.")
},
"diffEditor.renderMarginRevertIcon": {
type: "boolean",
default: diffEditorDefaultOptions.renderMarginRevertIcon,
description: localize("renderMarginRevertIcon", "When enabled, the diff editor shows arrows in its glyph margin to revert changes.")
},
"diffEditor.renderGutterMenu": {
type: "boolean",
default: diffEditorDefaultOptions.renderGutterMenu,
description: localize("renderGutterMenu", "When enabled, the diff editor shows a special gutter for revert and stage actions.")
},
"diffEditor.ignoreTrimWhitespace": {
type: "boolean",
default: diffEditorDefaultOptions.ignoreTrimWhitespace,
description: localize("ignoreTrimWhitespace", "When enabled, the diff editor ignores changes in leading or trailing whitespace.")
},
"diffEditor.renderIndicators": {
type: "boolean",
default: diffEditorDefaultOptions.renderIndicators,
description: localize("renderIndicators", "Controls whether the diff editor shows +/- indicators for added/removed changes.")
},
"diffEditor.codeLens": {
type: "boolean",
default: diffEditorDefaultOptions.diffCodeLens,
description: localize("codeLens", "Controls whether the editor shows CodeLens.")
},
"diffEditor.wordWrap": {
type: "string",
enum: ["off", "on", "inherit"],
default: diffEditorDefaultOptions.diffWordWrap,
markdownEnumDescriptions: [
localize("wordWrap.off", "Lines will never wrap."),
localize("wordWrap.on", "Lines will wrap at the viewport width."),
localize("wordWrap.inherit", "Lines will wrap according to the {0} setting.", "`#editor.wordWrap#`")
]
},
"diffEditor.diffAlgorithm": {
type: "string",
enum: ["legacy", "advanced"],
default: diffEditorDefaultOptions.diffAlgorithm,
markdownEnumDescriptions: [
localize("diffAlgorithm.legacy", "Uses the legacy diffing algorithm."),
localize("diffAlgorithm.advanced", "Uses the advanced diffing algorithm.")
],
tags: ["experimental"]
},
"diffEditor.hideUnchangedRegions.enabled": {
type: "boolean",
default: diffEditorDefaultOptions.hideUnchangedRegions.enabled,
markdownDescription: localize("hideUnchangedRegions.enabled", "Controls whether the diff editor shows unchanged regions.")
},
"diffEditor.hideUnchangedRegions.revealLineCount": {
type: "integer",
default: diffEditorDefaultOptions.hideUnchangedRegions.revealLineCount,
markdownDescription: localize("hideUnchangedRegions.revealLineCount", "Controls how many lines are used for unchanged regions."),
minimum: 1
},
"diffEditor.hideUnchangedRegions.minimumLineCount": {
type: "integer",
default: diffEditorDefaultOptions.hideUnchangedRegions.minimumLineCount,
markdownDescription: localize("hideUnchangedRegions.minimumLineCount", "Controls how many lines are used as a minimum for unchanged regions."),
minimum: 1
},
"diffEditor.hideUnchangedRegions.contextLineCount": {
type: "integer",
default: diffEditorDefaultOptions.hideUnchangedRegions.contextLineCount,
markdownDescription: localize("hideUnchangedRegions.contextLineCount", "Controls how many lines are used as context when comparing unchanged regions."),
minimum: 1
},
"diffEditor.experimental.showMoves": {
type: "boolean",
default: diffEditorDefaultOptions.experimental.showMoves,
markdownDescription: localize("showMoves", "Controls whether the diff editor should show detected code moves.")
},
"diffEditor.experimental.showEmptyDecorations": {
type: "boolean",
default: diffEditorDefaultOptions.experimental.showEmptyDecorations,
description: localize("showEmptyDecorations", "Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")
}
}
});
for (const editorOption of editorOptionsRegistry) {
const schema = editorOption.schema;
if (typeof schema !== "undefined") {
if (isConfigurationPropertySchema(schema)) {
editorConfiguration.properties[`editor.${editorOption.name}`] = schema;
} else {
for (const key in schema) {
if (Object.hasOwnProperty.call(schema, key)) {
editorConfiguration.properties[key] = schema[key];
}
}
}
}
}
cachedEditorConfigurationKeys = null;
configurationRegistry2 = Registry.as(Extensions4.Configuration);
configurationRegistry2.registerConfiguration(editorConfiguration);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/core/editOperation.js
var EditOperation;
var init_editOperation = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/core/editOperation.js"() {
init_range();
EditOperation = class {
static insert(position, text2) {
return {
range: new Range(position.lineNumber, position.column, position.lineNumber, position.column),
text: text2,
forceMoveMarkers: true
};
}
static delete(range2) {
return {
range: range2,
text: null
};
}
static replace(range2, text2) {
return {
range: range2,
text: text2
};
}
static replaceMove(range2, text2) {
return {
range: range2,
text: text2,
forceMoveMarkers: true
};
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationModels.js
function freeze2(data) {
return Object.isFrozen(data) ? data : deepFreeze(data);
}
var ConfigurationModel, ConfigurationModelParser, ConfigurationInspectValue, Configuration, ConfigurationChangeEvent;
var init_configurationModels = __esm({
"node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationModels.js"() {
init_arrays();
init_map();
init_objects();
init_types();
init_uri();
init_configuration();
init_configurationRegistry();
init_platform2();
ConfigurationModel = class _ConfigurationModel {
static createEmptyModel(logService) {
return new _ConfigurationModel({}, [], [], void 0, logService);
}
constructor(_contents, _keys, _overrides, raw, logService) {
this._contents = _contents;
this._keys = _keys;
this._overrides = _overrides;
this.raw = raw;
this.logService = logService;
this.overrideConfigurations = /* @__PURE__ */ new Map();
}
get rawConfiguration() {
var _a10;
if (!this._rawConfiguration) {
if ((_a10 = this.raw) === null || _a10 === void 0 ? void 0 : _a10.length) {
const rawConfigurationModels = this.raw.map((raw) => {
if (raw instanceof _ConfigurationModel) {
return raw;
}
const parser2 = new ConfigurationModelParser("", this.logService);
parser2.parseRaw(raw);
return parser2.configurationModel;
});
this._rawConfiguration = rawConfigurationModels.reduce((previous, current) => current === previous ? current : previous.merge(current), rawConfigurationModels[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(section) {
return section ? getConfigurationValue(this.contents, section) : this.contents;
}
inspect(section, overrideIdentifier) {
const that = this;
return {
get value() {
return freeze2(that.rawConfiguration.getValue(section));
},
get override() {
return overrideIdentifier ? freeze2(that.rawConfiguration.getOverrideValue(section, overrideIdentifier)) : void 0;
},
get merged() {
return freeze2(overrideIdentifier ? that.rawConfiguration.override(overrideIdentifier).getValue(section) : that.rawConfiguration.getValue(section));
},
get overrides() {
const overrides = [];
for (const { contents, identifiers, keys } of that.rawConfiguration.overrides) {
const value = new _ConfigurationModel(contents, keys, [], void 0, that.logService).getValue(section);
if (value !== void 0) {
overrides.push({ identifiers, value });
}
}
return overrides.length ? freeze2(overrides) : void 0;
}
};
}
getOverrideValue(section, overrideIdentifier) {
const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
return overrideContents ? section ? getConfigurationValue(overrideContents, section) : overrideContents : void 0;
}
override(identifier3) {
let overrideConfigurationModel = this.overrideConfigurations.get(identifier3);
if (!overrideConfigurationModel) {
overrideConfigurationModel = this.createOverrideConfigurationModel(identifier3);
this.overrideConfigurations.set(identifier3, overrideConfigurationModel);
}
return overrideConfigurationModel;
}
merge(...others) {
var _a10, _b4;
const contents = deepClone(this.contents);
const overrides = deepClone(this.overrides);
const keys = [...this.keys];
const raws = ((_a10 = this.raw) === null || _a10 === void 0 ? void 0 : _a10.length) ? [...this.raw] : [this];
for (const other of others) {
raws.push(...((_b4 = other.raw) === null || _b4 === void 0 ? void 0 : _b4.length) ? other.raw : [other]);
if (other.isEmpty()) {
continue;
}
this.mergeContents(contents, other.contents);
for (const otherOverride of other.overrides) {
const [override] = overrides.filter((o) => equals(o.identifiers, otherOverride.identifiers));
if (override) {
this.mergeContents(override.contents, otherOverride.contents);
override.keys.push(...otherOverride.keys);
override.keys = distinct(override.keys);
} else {
overrides.push(deepClone(otherOverride));
}
}
for (const key of other.keys) {
if (keys.indexOf(key) === -1) {
keys.push(key);
}
}
}
return new _ConfigurationModel(contents, keys, overrides, raws.every((raw) => raw instanceof _ConfigurationModel) ? void 0 : raws, this.logService);
}
createOverrideConfigurationModel(identifier3) {
const overrideContents = this.getContentsForOverrideIdentifer(identifier3);
if (!overrideContents || typeof overrideContents !== "object" || !Object.keys(overrideContents).length) {
return this;
}
const contents = {};
for (const key of distinct([...Object.keys(this.contents), ...Object.keys(overrideContents)])) {
let contentsForKey = this.contents[key];
const overrideContentsForKey = overrideContents[key];
if (overrideContentsForKey) {
if (typeof contentsForKey === "object" && typeof overrideContentsForKey === "object") {
contentsForKey = deepClone(contentsForKey);
this.mergeContents(contentsForKey, overrideContentsForKey);
} else {
contentsForKey = overrideContentsForKey;
}
}
contents[key] = contentsForKey;
}
return new _ConfigurationModel(contents, this.keys, this.overrides, void 0, this.logService);
}
mergeContents(source, target) {
for (const key of Object.keys(target)) {
if (key in source) {
if (isObject(source[key]) && isObject(target[key])) {
this.mergeContents(source[key], target[key]);
continue;
}
}
source[key] = deepClone(target[key]);
}
}
getContentsForOverrideIdentifer(identifier3) {
let contentsForIdentifierOnly = null;
let contents = null;
const mergeContents = (contentsToMerge) => {
if (contentsToMerge) {
if (contents) {
this.mergeContents(contents, contentsToMerge);
} else {
contents = deepClone(contentsToMerge);
}
}
};
for (const override of this.overrides) {
if (override.identifiers.length === 1 && override.identifiers[0] === identifier3) {
contentsForIdentifierOnly = override.contents;
} else if (override.identifiers.includes(identifier3)) {
mergeContents(override.contents);
}
}
mergeContents(contentsForIdentifierOnly);
return contents;
}
toJSON() {
return {
contents: this.contents,
overrides: this.overrides,
keys: this.keys
};
}
// Update methods
addValue(key, value) {
this.updateValue(key, value, true);
}
setValue(key, value) {
this.updateValue(key, value, false);
}
removeValue(key) {
const index = this.keys.indexOf(key);
if (index === -1) {
return;
}
this.keys.splice(index, 1);
removeFromValueTree(this.contents, key);
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
this.overrides.splice(this.overrides.findIndex((o) => equals(o.identifiers, overrideIdentifiersFromKey(key))), 1);
}
}
updateValue(key, value, add) {
addToValueTree(this.contents, key, value, (e) => this.logService.error(e));
add = add || this.keys.indexOf(key) === -1;
if (add) {
this.keys.push(key);
}
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
this.overrides.push({
identifiers: overrideIdentifiersFromKey(key),
keys: Object.keys(this.contents[key]),
contents: toValuesTree(this.contents[key], (message) => this.logService.error(message))
});
}
}
};
ConfigurationModelParser = class {
constructor(_name, logService) {
this._name = _name;
this.logService = logService;
this._raw = null;
this._configurationModel = null;
this._restrictedConfigurations = [];
}
get configurationModel() {
return this._configurationModel || ConfigurationModel.createEmptyModel(this.logService);
}
parseRaw(raw, options2) {
this._raw = raw;
const { contents, keys, overrides, restricted, hasExcludedProperties } = this.doParseRaw(raw, options2);
this._configurationModel = new ConfigurationModel(contents, keys, overrides, hasExcludedProperties ? [raw] : void 0, this.logService);
this._restrictedConfigurations = restricted || [];
}
doParseRaw(raw, options2) {
const configurationProperties = Registry.as(Extensions4.Configuration).getConfigurationProperties();
const filtered = this.filter(raw, configurationProperties, true, options2);
raw = filtered.raw;
const contents = toValuesTree(raw, (message) => this.logService.error(`Conflict in settings file ${this._name}: ${message}`));
const keys = Object.keys(raw);
const overrides = this.toOverrides(raw, (message) => this.logService.error(`Conflict in settings file ${this._name}: ${message}`));
return { contents, keys, overrides, restricted: filtered.restricted, hasExcludedProperties: filtered.hasExcludedProperties };
}
filter(properties, configurationProperties, filterOverriddenProperties, options2) {
var _a10, _b4, _c2;
let hasExcludedProperties = false;
if (!(options2 === null || options2 === void 0 ? void 0 : options2.scopes) && !(options2 === null || options2 === void 0 ? void 0 : options2.skipRestricted) && !((_a10 = options2 === null || options2 === void 0 ? void 0 : options2.exclude) === null || _a10 === void 0 ? void 0 : _a10.length)) {
return { raw: properties, restricted: [], hasExcludedProperties };
}
const raw = {};
const restricted = [];
for (const key in properties) {
if (OVERRIDE_PROPERTY_REGEX.test(key) && filterOverriddenProperties) {
const result = this.filter(properties[key], configurationProperties, false, options2);
raw[key] = result.raw;
hasExcludedProperties = hasExcludedProperties || result.hasExcludedProperties;
restricted.push(...result.restricted);
} else {
const propertySchema = configurationProperties[key];
const scope = propertySchema ? typeof propertySchema.scope !== "undefined" ? propertySchema.scope : 3 : void 0;
if (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.restricted) {
restricted.push(key);
}
if (!((_b4 = options2.exclude) === null || _b4 === void 0 ? void 0 : _b4.includes(key)) && (((_c2 = options2.include) === null || _c2 === void 0 ? void 0 : _c2.includes(key)) || (scope === void 0 || options2.scopes === void 0 || options2.scopes.includes(scope)) && !(options2.skipRestricted && (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.restricted)))) {
raw[key] = properties[key];
} else {
hasExcludedProperties = true;
}
}
}
return { raw, restricted, hasExcludedProperties };
}
toOverrides(raw, conflictReporter) {
const overrides = [];
for (const key of Object.keys(raw)) {
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
const overrideRaw = {};
for (const keyInOverrideRaw in raw[key]) {
overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
}
overrides.push({
identifiers: overrideIdentifiersFromKey(key),
keys: Object.keys(overrideRaw),
contents: toValuesTree(overrideRaw, conflictReporter)
});
}
}
return overrides;
}
};
ConfigurationInspectValue = class {
constructor(key, overrides, _value, overrideIdentifiers, defaultConfiguration, policyConfiguration, applicationConfiguration, userConfiguration, localUserConfiguration, remoteUserConfiguration, workspaceConfiguration, folderConfigurationModel, memoryConfigurationModel) {
this.key = key;
this.overrides = overrides;
this._value = _value;
this.overrideIdentifiers = overrideIdentifiers;
this.defaultConfiguration = defaultConfiguration;
this.policyConfiguration = policyConfiguration;
this.applicationConfiguration = applicationConfiguration;
this.userConfiguration = userConfiguration;
this.localUserConfiguration = localUserConfiguration;
this.remoteUserConfiguration = remoteUserConfiguration;
this.workspaceConfiguration = workspaceConfiguration;
this.folderConfigurationModel = folderConfigurationModel;
this.memoryConfigurationModel = memoryConfigurationModel;
}
toInspectValue(inspectValue) {
return (inspectValue === null || inspectValue === void 0 ? void 0 : inspectValue.value) !== void 0 || (inspectValue === null || inspectValue === void 0 ? void 0 : inspectValue.override) !== void 0 || (inspectValue === null || inspectValue === void 0 ? void 0 : inspectValue.overrides) !== void 0 ? inspectValue : void 0;
}
get userInspectValue() {
if (!this._userInspectValue) {
this._userInspectValue = this.userConfiguration.inspect(this.key, this.overrides.overrideIdentifier);
}
return this._userInspectValue;
}
get user() {
return this.toInspectValue(this.userInspectValue);
}
};
Configuration = class _Configuration {
constructor(_defaultConfiguration, _policyConfiguration, _applicationConfiguration, _localUserConfiguration, _remoteUserConfiguration, _workspaceConfiguration, _folderConfigurations, _memoryConfiguration, _memoryConfigurationByResource, logService) {
this._defaultConfiguration = _defaultConfiguration;
this._policyConfiguration = _policyConfiguration;
this._applicationConfiguration = _applicationConfiguration;
this._localUserConfiguration = _localUserConfiguration;
this._remoteUserConfiguration = _remoteUserConfiguration;
this._workspaceConfiguration = _workspaceConfiguration;
this._folderConfigurations = _folderConfigurations;
this._memoryConfiguration = _memoryConfiguration;
this._memoryConfigurationByResource = _memoryConfigurationByResource;
this.logService = logService;
this._workspaceConsolidatedConfiguration = null;
this._foldersConsolidatedConfigurations = new ResourceMap();
this._userConfiguration = null;
}
getValue(section, overrides, workspace) {
const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(section, overrides, workspace);
return consolidateConfigurationModel.getValue(section);
}
updateValue(key, value, overrides = {}) {
let memoryConfiguration;
if (overrides.resource) {
memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
if (!memoryConfiguration) {
memoryConfiguration = ConfigurationModel.createEmptyModel(this.logService);
this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);
}
} else {
memoryConfiguration = this._memoryConfiguration;
}
if (value === void 0) {
memoryConfiguration.removeValue(key);
} else {
memoryConfiguration.setValue(key, value);
}
if (!overrides.resource) {
this._workspaceConsolidatedConfiguration = null;
}
}
inspect(key, overrides, workspace) {
const consolidateConfigurationModel = this.getConsolidatedConfigurationModel(key, overrides, workspace);
const folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);
const memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;
const overrideIdentifiers = /* @__PURE__ */ new Set();
for (const override of consolidateConfigurationModel.overrides) {
for (const overrideIdentifier of override.identifiers) {
if (consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== void 0) {
overrideIdentifiers.add(overrideIdentifier);
}
}
}
return new ConfigurationInspectValue(key, overrides, consolidateConfigurationModel.getValue(key), overrideIdentifiers.size ? [...overrideIdentifiers] : void 0, this._defaultConfiguration, this._policyConfiguration.isEmpty() ? void 0 : this._policyConfiguration, this.applicationConfiguration.isEmpty() ? void 0 : this.applicationConfiguration, this.userConfiguration, this.localUserConfiguration, this.remoteUserConfiguration, workspace ? this._workspaceConfiguration : void 0, folderConfigurationModel ? folderConfigurationModel : void 0, memoryConfigurationModel);
}
get applicationConfiguration() {
return this._applicationConfiguration;
}
get userConfiguration() {
if (!this._userConfiguration) {
this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);
}
return this._userConfiguration;
}
get localUserConfiguration() {
return this._localUserConfiguration;
}
get remoteUserConfiguration() {
return this._remoteUserConfiguration;
}
getConsolidatedConfigurationModel(section, overrides, workspace) {
let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
if (overrides.overrideIdentifier) {
configurationModel = configurationModel.override(overrides.overrideIdentifier);
}
if (!this._policyConfiguration.isEmpty() && this._policyConfiguration.getValue(section) !== void 0) {
configurationModel = configurationModel.merge(this._policyConfiguration);
}
return configurationModel;
}
getConsolidatedConfigurationModelForResource({ resource }, workspace) {
let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
if (workspace && resource) {
const root = workspace.getFolder(resource);
if (root) {
consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
}
const memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);
if (memoryConfigurationForResource) {
consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
}
}
return consolidateConfiguration;
}
getWorkspaceConsolidatedConfiguration() {
if (!this._workspaceConsolidatedConfiguration) {
this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.applicationConfiguration, this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);
}
return this._workspaceConsolidatedConfiguration;
}
getFolderConsolidatedConfiguration(folder) {
let folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);
if (!folderConsolidatedConfiguration) {
const workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
const folderConfiguration = this._folderConfigurations.get(folder);
if (folderConfiguration) {
folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
} else {
folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
}
}
return folderConsolidatedConfiguration;
}
getFolderConfigurationModelForResource(resource, workspace) {
if (workspace && resource) {
const root = workspace.getFolder(resource);
if (root) {
return this._folderConfigurations.get(root.uri);
}
}
return void 0;
}
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((result, folder) => {
const { contents, overrides, keys } = this._folderConfigurations.get(folder);
result.push([folder, { contents, overrides, keys }]);
return result;
}, [])
};
}
static parse(data, logService) {
const defaultConfiguration = this.parseConfigurationModel(data.defaults, logService);
const policyConfiguration = this.parseConfigurationModel(data.policy, logService);
const applicationConfiguration = this.parseConfigurationModel(data.application, logService);
const userConfiguration = this.parseConfigurationModel(data.user, logService);
const workspaceConfiguration = this.parseConfigurationModel(data.workspace, logService);
const folders = data.folders.reduce((result, value) => {
result.set(URI.revive(value[0]), this.parseConfigurationModel(value[1], logService));
return result;
}, new ResourceMap());
return new _Configuration(defaultConfiguration, policyConfiguration, applicationConfiguration, userConfiguration, ConfigurationModel.createEmptyModel(logService), workspaceConfiguration, folders, ConfigurationModel.createEmptyModel(logService), new ResourceMap(), logService);
}
static parseConfigurationModel(model, logService) {
return new ConfigurationModel(model.contents, model.keys, model.overrides, void 0, logService);
}
};
ConfigurationChangeEvent = class {
constructor(change, previous, currentConfiguraiton, currentWorkspace, logService) {
this.change = change;
this.previous = previous;
this.currentConfiguraiton = currentConfiguraiton;
this.currentWorkspace = currentWorkspace;
this.logService = logService;
this._marker = "\n";
this._markerCode1 = this._marker.charCodeAt(0);
this._markerCode2 = ".".charCodeAt(0);
this.affectedKeys = /* @__PURE__ */ new Set();
this._previousConfiguration = void 0;
for (const key of change.keys) {
this.affectedKeys.add(key);
}
for (const [, keys] of change.overrides) {
for (const key of keys) {
this.affectedKeys.add(key);
}
}
this._affectsConfigStr = this._marker;
for (const key of this.affectedKeys) {
this._affectsConfigStr += key + this._marker;
}
}
get previousConfiguration() {
if (!this._previousConfiguration && this.previous) {
this._previousConfiguration = Configuration.parse(this.previous.data, this.logService);
}
return this._previousConfiguration;
}
affectsConfiguration(section, overrides) {
var _a10;
const needle = this._marker + section;
const idx = this._affectsConfigStr.indexOf(needle);
if (idx < 0) {
return false;
}
const pos = idx + needle.length;
if (pos >= this._affectsConfigStr.length) {
return false;
}
const code = this._affectsConfigStr.charCodeAt(pos);
if (code !== this._markerCode1 && code !== this._markerCode2) {
return false;
}
if (overrides) {
const value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, (_a10 = this.previous) === null || _a10 === void 0 ? void 0 : _a10.workspace) : void 0;
const value2 = this.currentConfiguraiton.getValue(section, overrides, this.currentWorkspace);
return !equals2(value1, value2);
}
return true;
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js
function KbFound(commandId, commandArgs, isBubble) {
return { kind: 2, commandId, commandArgs, isBubble };
}
function printWhenExplanation(when) {
if (!when) {
return `no when condition`;
}
return `${when.serialize()}`;
}
function printSourceExplanation(kb) {
return kb.extensionId ? kb.isBuiltinExtension ? `built-in extension ${kb.extensionId}` : `user extension ${kb.extensionId}` : kb.isDefault ? `built-in` : `user`;
}
var NoMatchingKb, MoreChordsNeeded, KeybindingResolver;
var init_keybindingResolver = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js"() {
init_contextkey();
NoMatchingKb = {
kind: 0
/* ResultKind.NoMatchingKb */
};
MoreChordsNeeded = {
kind: 1
/* ResultKind.MoreChordsNeeded */
};
KeybindingResolver = class _KeybindingResolver {
constructor(defaultKeybindings, overrides, log2) {
var _a10;
this._log = log2;
this._defaultKeybindings = defaultKeybindings;
this._defaultBoundCommands = /* @__PURE__ */ new Map();
for (const defaultKeybinding of defaultKeybindings) {
const command = defaultKeybinding.command;
if (command && command.charAt(0) !== "-") {
this._defaultBoundCommands.set(command, true);
}
}
this._map = /* @__PURE__ */ new Map();
this._lookupMap = /* @__PURE__ */ new Map();
this._keybindings = _KeybindingResolver.handleRemovals([].concat(defaultKeybindings).concat(overrides));
for (let i = 0, len = this._keybindings.length; i < len; i++) {
const k = this._keybindings[i];
if (k.chords.length === 0) {
continue;
}
const when = (_a10 = k.when) === null || _a10 === void 0 ? void 0 : _a10.substituteConstants();
if (when && when.type === 0) {
continue;
}
this._addKeyPress(k.chords[0], k);
}
}
static _isTargetedForRemoval(defaultKb, keypress, when) {
if (keypress) {
for (let i = 0; i < keypress.length; i++) {
if (keypress[i] !== defaultKb.chords[i]) {
return false;
}
}
}
if (when && when.type !== 1) {
if (!defaultKb.when) {
return false;
}
if (!expressionsAreEqualWithConstantSubstitution(when, defaultKb.when)) {
return false;
}
}
return true;
}
/**
* Looks for rules containing "-commandId" and removes them.
*/
static handleRemovals(rules) {
const removals = /* @__PURE__ */ new Map();
for (let i = 0, len = rules.length; i < len; i++) {
const rule = rules[i];
if (rule.command && rule.command.charAt(0) === "-") {
const command = rule.command.substring(1);
if (!removals.has(command)) {
removals.set(command, [rule]);
} else {
removals.get(command).push(rule);
}
}
}
if (removals.size === 0) {
return rules;
}
const result = [];
for (let i = 0, len = rules.length; i < len; i++) {
const rule = rules[i];
if (!rule.command || rule.command.length === 0) {
result.push(rule);
continue;
}
if (rule.command.charAt(0) === "-") {
continue;
}
const commandRemovals = removals.get(rule.command);
if (!commandRemovals || !rule.isDefault) {
result.push(rule);
continue;
}
let isRemoved = false;
for (const commandRemoval of commandRemovals) {
const when = commandRemoval.when;
if (this._isTargetedForRemoval(rule, commandRemoval.chords, when)) {
isRemoved = true;
break;
}
}
if (!isRemoved) {
result.push(rule);
continue;
}
}
return result;
}
_addKeyPress(keypress, item) {
const conflicts = this._map.get(keypress);
if (typeof conflicts === "undefined") {
this._map.set(keypress, [item]);
this._addToLookupMap(item);
return;
}
for (let i = conflicts.length - 1; i >= 0; i--) {
const conflict = conflicts[i];
if (conflict.command === item.command) {
continue;
}
let isShorterKbPrefix = true;
for (let i2 = 1; i2 < conflict.chords.length && i2 < item.chords.length; i2++) {
if (conflict.chords[i2] !== item.chords[i2]) {
isShorterKbPrefix = false;
break;
}
}
if (!isShorterKbPrefix) {
continue;
}
if (_KeybindingResolver.whenIsEntirelyIncluded(conflict.when, item.when)) {
this._removeFromLookupMap(conflict);
}
}
conflicts.push(item);
this._addToLookupMap(item);
}
_addToLookupMap(item) {
if (!item.command) {
return;
}
let arr = this._lookupMap.get(item.command);
if (typeof arr === "undefined") {
arr = [item];
this._lookupMap.set(item.command, arr);
} else {
arr.push(item);
}
}
_removeFromLookupMap(item) {
if (!item.command) {
return;
}
const arr = this._lookupMap.get(item.command);
if (typeof arr === "undefined") {
return;
}
for (let i = 0, len = arr.length; i < len; i++) {
if (arr[i] === item) {
arr.splice(i, 1);
return;
}
}
}
/**
* Returns true if it is provable `a` implies `b`.
*/
static whenIsEntirelyIncluded(a3, b) {
if (!b || b.type === 1) {
return true;
}
if (!a3 || a3.type === 1) {
return false;
}
return implies(a3, b);
}
getKeybindings() {
return this._keybindings;
}
lookupPrimaryKeybinding(commandId, context) {
const items = this._lookupMap.get(commandId);
if (typeof items === "undefined" || items.length === 0) {
return null;
}
if (items.length === 1) {
return items[0];
}
for (let i = items.length - 1; i >= 0; i--) {
const item = items[i];
if (context.contextMatchesRules(item.when)) {
return item;
}
}
return items[items.length - 1];
}
/**
* Looks up a keybinding trigged as a result of pressing a sequence of chords - `[...currentChords, keypress]`
*
* Example: resolving 3 chords pressed sequentially - `cmd+k cmd+p cmd+i`:
* `currentChords = [ 'cmd+k' , 'cmd+p' ]` and `keypress = `cmd+i` - last pressed chord
*/
resolve(context, currentChords, keypress) {
const pressedChords = [...currentChords, keypress];
this._log(`| Resolving ${pressedChords}`);
const kbCandidates = this._map.get(pressedChords[0]);
if (kbCandidates === void 0) {
this._log(`\\ No keybinding entries.`);
return NoMatchingKb;
}
let lookupMap = null;
if (pressedChords.length < 2) {
lookupMap = kbCandidates;
} else {
lookupMap = [];
for (let i = 0, len = kbCandidates.length; i < len; i++) {
const candidate = kbCandidates[i];
if (pressedChords.length > candidate.chords.length) {
continue;
}
let prefixMatches = true;
for (let i2 = 1; i2 < pressedChords.length; i2++) {
if (candidate.chords[i2] !== pressedChords[i2]) {
prefixMatches = false;
break;
}
}
if (prefixMatches) {
lookupMap.push(candidate);
}
}
}
const result = this._findCommand(context, lookupMap);
if (!result) {
this._log(`\\ From ${lookupMap.length} keybinding entries, no when clauses matched the context.`);
return NoMatchingKb;
}
if (pressedChords.length < result.chords.length) {
this._log(`\\ From ${lookupMap.length} keybinding entries, awaiting ${result.chords.length - pressedChords.length} more chord(s), when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);
return MoreChordsNeeded;
}
this._log(`\\ From ${lookupMap.length} keybinding entries, matched ${result.command}, when: ${printWhenExplanation(result.when)}, source: ${printSourceExplanation(result)}.`);
return KbFound(result.command, result.commandArgs, result.bubble);
}
_findCommand(context, matches2) {
for (let i = matches2.length - 1; i >= 0; i--) {
const k = matches2[i];
if (!_KeybindingResolver._contextMatchesRules(context, k.when)) {
continue;
}
return k;
}
return null;
}
static _contextMatchesRules(context, rules) {
if (!rules) {
return true;
}
return rules.evaluate(context);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js
var HIGH_FREQ_COMMANDS, AbstractKeybindingService, KeybindingModifierSet;
var init_abstractKeybindingService = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js"() {
init_async();
init_errors();
init_event();
init_ime();
init_lifecycle();
init_nls();
init_keybindingResolver();
HIGH_FREQ_COMMANDS = /^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/;
AbstractKeybindingService = class extends Disposable {
get onDidUpdateKeybindings() {
return this._onDidUpdateKeybindings ? this._onDidUpdateKeybindings.event : Event.None;
}
get inChordMode() {
return this._currentChords.length > 0;
}
constructor(_contextKeyService, _commandService, _telemetryService, _notificationService, _logService) {
super();
this._contextKeyService = _contextKeyService;
this._commandService = _commandService;
this._telemetryService = _telemetryService;
this._notificationService = _notificationService;
this._logService = _logService;
this._onDidUpdateKeybindings = this._register(new Emitter());
this._currentChords = [];
this._currentChordChecker = new IntervalTimer();
this._currentChordStatusMessage = null;
this._ignoreSingleModifiers = KeybindingModifierSet.EMPTY;
this._currentSingleModifier = null;
this._currentSingleModifierClearTimeout = new TimeoutTimer();
this._currentlyDispatchingCommandId = null;
this._logging = false;
}
dispose() {
super.dispose();
}
_log(str) {
if (this._logging) {
this._logService.info(`[KeybindingService]: ${str}`);
}
}
getKeybindings() {
return this._getResolver().getKeybindings();
}
lookupKeybinding(commandId, context) {
const result = this._getResolver().lookupPrimaryKeybinding(commandId, context || this._contextKeyService);
if (!result) {
return void 0;
}
return result.resolvedKeybinding;
}
dispatchEvent(e, target) {
return this._dispatch(e, target);
}
// TODO@ulugbekna: update namings to align with `_doDispatch`
// TODO@ulugbekna: this fn doesn't seem to take into account single-modifier keybindings, eg `shift shift`
softDispatch(e, target) {
this._log(`/ Soft dispatching keyboard event`);
const keybinding = this.resolveKeyboardEvent(e);
if (keybinding.hasMultipleChords()) {
console.warn("keyboard event should not be mapped to multiple chords");
return NoMatchingKb;
}
const [firstChord] = keybinding.getDispatchChords();
if (firstChord === null) {
this._log(`\\ Keyboard event cannot be dispatched`);
return NoMatchingKb;
}
const contextValue = this._contextKeyService.getContext(target);
const currentChords = this._currentChords.map(({ keypress }) => keypress);
return this._getResolver().resolve(contextValue, currentChords, firstChord);
}
_scheduleLeaveChordMode() {
const chordLastInteractedTime = Date.now();
this._currentChordChecker.cancelAndSet(() => {
if (!this._documentHasFocus()) {
this._leaveChordMode();
return;
}
if (Date.now() - chordLastInteractedTime > 5e3) {
this._leaveChordMode();
}
}, 500);
}
_expectAnotherChord(firstChord, keypressLabel) {
this._currentChords.push({ keypress: firstChord, label: keypressLabel });
switch (this._currentChords.length) {
case 0:
throw illegalState("impossible");
case 1:
this._currentChordStatusMessage = this._notificationService.status(localize("first.chord", "({0}) was pressed. Waiting for second key of chord...", keypressLabel));
break;
default: {
const fullKeypressLabel = this._currentChords.map(({ label }) => label).join(", ");
this._currentChordStatusMessage = this._notificationService.status(localize("next.chord", "({0}) was pressed. Waiting for next key of chord...", fullKeypressLabel));
}
}
this._scheduleLeaveChordMode();
if (IME.enabled) {
IME.disable();
}
}
_leaveChordMode() {
if (this._currentChordStatusMessage) {
this._currentChordStatusMessage.dispose();
this._currentChordStatusMessage = null;
}
this._currentChordChecker.cancel();
this._currentChords = [];
IME.enable();
}
_dispatch(e, target) {
return this._doDispatch(
this.resolveKeyboardEvent(e),
target,
/*isSingleModiferChord*/
false
);
}
_singleModifierDispatch(e, target) {
const keybinding = this.resolveKeyboardEvent(e);
const [singleModifier] = keybinding.getSingleModifierDispatchChords();
if (singleModifier) {
if (this._ignoreSingleModifiers.has(singleModifier)) {
this._log(`+ Ignoring single modifier ${singleModifier} due to it being pressed together with other keys.`);
this._ignoreSingleModifiers = KeybindingModifierSet.EMPTY;
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return false;
}
this._ignoreSingleModifiers = KeybindingModifierSet.EMPTY;
if (this._currentSingleModifier === null) {
this._log(`+ Storing single modifier for possible chord ${singleModifier}.`);
this._currentSingleModifier = singleModifier;
this._currentSingleModifierClearTimeout.cancelAndSet(() => {
this._log(`+ Clearing single modifier due to 300ms elapsed.`);
this._currentSingleModifier = null;
}, 300);
return false;
}
if (singleModifier === this._currentSingleModifier) {
this._log(`/ Dispatching single modifier chord ${singleModifier} ${singleModifier}`);
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return this._doDispatch(
keybinding,
target,
/*isSingleModiferChord*/
true
);
}
this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${singleModifier}`);
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return false;
}
const [firstChord] = keybinding.getChords();
this._ignoreSingleModifiers = new KeybindingModifierSet(firstChord);
if (this._currentSingleModifier !== null) {
this._log(`+ Clearing single modifier due to other key up.`);
}
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return false;
}
_doDispatch(userKeypress, target, isSingleModiferChord = false) {
var _a10;
let shouldPreventDefault = false;
if (userKeypress.hasMultipleChords()) {
console.warn("Unexpected keyboard event mapped to multiple chords");
return false;
}
let userPressedChord = null;
let currentChords = null;
if (isSingleModiferChord) {
const [dispatchKeyname] = userKeypress.getSingleModifierDispatchChords();
userPressedChord = dispatchKeyname;
currentChords = dispatchKeyname ? [dispatchKeyname] : [];
} else {
[userPressedChord] = userKeypress.getDispatchChords();
currentChords = this._currentChords.map(({ keypress }) => keypress);
}
if (userPressedChord === null) {
this._log(`\\ Keyboard event cannot be dispatched in keydown phase.`);
return shouldPreventDefault;
}
const contextValue = this._contextKeyService.getContext(target);
const keypressLabel = userKeypress.getLabel();
const resolveResult = this._getResolver().resolve(contextValue, currentChords, userPressedChord);
switch (resolveResult.kind) {
case 0: {
this._logService.trace("KeybindingService#dispatch", keypressLabel, `[ No matching keybinding ]`);
if (this.inChordMode) {
const currentChordsLabel = this._currentChords.map(({ label }) => label).join(", ");
this._log(`+ Leaving multi-chord mode: Nothing bound to "${currentChordsLabel}, ${keypressLabel}".`);
this._notificationService.status(localize("missing.chord", "The key combination ({0}, {1}) is not a command.", currentChordsLabel, keypressLabel), {
hideAfter: 10 * 1e3
/* 10s */
});
this._leaveChordMode();
shouldPreventDefault = true;
}
return shouldPreventDefault;
}
case 1: {
this._logService.trace("KeybindingService#dispatch", keypressLabel, `[ Several keybindings match - more chords needed ]`);
shouldPreventDefault = true;
this._expectAnotherChord(userPressedChord, keypressLabel);
this._log(this._currentChords.length === 1 ? `+ Entering multi-chord mode...` : `+ Continuing multi-chord mode...`);
return shouldPreventDefault;
}
case 2: {
this._logService.trace("KeybindingService#dispatch", keypressLabel, `[ Will dispatch command ${resolveResult.commandId} ]`);
if (resolveResult.commandId === null || resolveResult.commandId === "") {
if (this.inChordMode) {
const currentChordsLabel = this._currentChords.map(({ label }) => label).join(", ");
this._log(`+ Leaving chord mode: Nothing bound to "${currentChordsLabel}, ${keypressLabel}".`);
this._notificationService.status(localize("missing.chord", "The key combination ({0}, {1}) is not a command.", currentChordsLabel, keypressLabel), {
hideAfter: 10 * 1e3
/* 10s */
});
this._leaveChordMode();
shouldPreventDefault = true;
}
} else {
if (this.inChordMode) {
this._leaveChordMode();
}
if (!resolveResult.isBubble) {
shouldPreventDefault = true;
}
this._log(`+ Invoking command ${resolveResult.commandId}.`);
this._currentlyDispatchingCommandId = resolveResult.commandId;
try {
if (typeof resolveResult.commandArgs === "undefined") {
this._commandService.executeCommand(resolveResult.commandId).then(void 0, (err) => this._notificationService.warn(err));
} else {
this._commandService.executeCommand(resolveResult.commandId, resolveResult.commandArgs).then(void 0, (err) => this._notificationService.warn(err));
}
} finally {
this._currentlyDispatchingCommandId = null;
}
if (!HIGH_FREQ_COMMANDS.test(resolveResult.commandId)) {
this._telemetryService.publicLog2("workbenchActionExecuted", { id: resolveResult.commandId, from: "keybinding", detail: (_a10 = userKeypress.getUserSettingsLabel()) !== null && _a10 !== void 0 ? _a10 : void 0 });
}
}
return shouldPreventDefault;
}
}
}
mightProducePrintableCharacter(event) {
if (event.ctrlKey || event.metaKey) {
return false;
}
if (event.keyCode >= 31 && event.keyCode <= 56 || event.keyCode >= 21 && event.keyCode <= 30) {
return true;
}
return false;
}
};
KeybindingModifierSet = class {
constructor(source) {
this._ctrlKey = source ? source.ctrlKey : false;
this._shiftKey = source ? source.shiftKey : false;
this._altKey = source ? source.altKey : false;
this._metaKey = source ? source.metaKey : false;
}
has(modifier) {
switch (modifier) {
case "ctrl":
return this._ctrlKey;
case "shift":
return this._shiftKey;
case "alt":
return this._altKey;
case "meta":
return this._metaKey;
}
}
};
KeybindingModifierSet.EMPTY = new KeybindingModifierSet(null);
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js
function toEmptyArrayIfContainsNull(arr) {
const result = [];
for (let i = 0, len = arr.length; i < len; i++) {
const element = arr[i];
if (!element) {
return [];
}
result.push(element);
}
return result;
}
var ResolvedKeybindingItem;
var init_resolvedKeybindingItem = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js"() {
ResolvedKeybindingItem = class {
constructor(resolvedKeybinding, command, commandArgs, when, isDefault, extensionId, isBuiltinExtension) {
this._resolvedKeybindingItemBrand = void 0;
this.resolvedKeybinding = resolvedKeybinding;
this.chords = resolvedKeybinding ? toEmptyArrayIfContainsNull(resolvedKeybinding.getDispatchChords()) : [];
if (resolvedKeybinding && this.chords.length === 0) {
this.chords = toEmptyArrayIfContainsNull(resolvedKeybinding.getSingleModifierDispatchChords());
}
this.bubble = command ? command.charCodeAt(0) === 94 : false;
this.command = this.bubble ? command.substr(1) : command;
this.commandArgs = commandArgs;
this.when = when;
this.isDefault = isDefault;
this.extensionId = extensionId;
this.isBuiltinExtension = isBuiltinExtension;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js
function _simpleAsString(modifiers, key, labels) {
if (key === null) {
return "";
}
const result = [];
if (modifiers.ctrlKey) {
result.push(labels.ctrlKey);
}
if (modifiers.shiftKey) {
result.push(labels.shiftKey);
}
if (modifiers.altKey) {
result.push(labels.altKey);
}
if (modifiers.metaKey) {
result.push(labels.metaKey);
}
if (key !== "") {
result.push(key);
}
return result.join(labels.separator);
}
var ModifierLabelProvider, UILabelProvider, AriaLabelProvider, ElectronAcceleratorLabelProvider, UserSettingsLabelProvider;
var init_keybindingLabels = __esm({
"node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js"() {
init_nls();
ModifierLabelProvider = class {
constructor(mac, windows, linux = windows) {
this.modifierLabels = [null];
this.modifierLabels[
2
/* OperatingSystem.Macintosh */
] = mac;
this.modifierLabels[
1
/* OperatingSystem.Windows */
] = windows;
this.modifierLabels[
3
/* OperatingSystem.Linux */
] = linux;
}
toLabel(OS2, chords, keyLabelProvider) {
if (chords.length === 0) {
return null;
}
const result = [];
for (let i = 0, len = chords.length; i < len; i++) {
const chord = chords[i];
const keyLabel = keyLabelProvider(chord);
if (keyLabel === null) {
return null;
}
result[i] = _simpleAsString(chord, keyLabel, this.modifierLabels[OS2]);
}
return result.join(" ");
}
};
UILabelProvider = new ModifierLabelProvider({
ctrlKey: "\u2303",
shiftKey: "\u21E7",
altKey: "\u2325",
metaKey: "\u2318",
separator: ""
}, {
ctrlKey: localize({ key: "ctrlKey", comment: ["This is the short form for the Control key on the keyboard"] }, "Ctrl"),
shiftKey: localize({ key: "shiftKey", comment: ["This is the short form for the Shift key on the keyboard"] }, "Shift"),
altKey: localize({ key: "altKey", comment: ["This is the short form for the Alt key on the keyboard"] }, "Alt"),
metaKey: localize({ key: "windowsKey", comment: ["This is the short form for the Windows key on the keyboard"] }, "Windows"),
separator: "+"
}, {
ctrlKey: localize({ key: "ctrlKey", comment: ["This is the short form for the Control key on the keyboard"] }, "Ctrl"),
shiftKey: localize({ key: "shiftKey", comment: ["This is the short form for the Shift key on the keyboard"] }, "Shift"),
altKey: localize({ key: "altKey", comment: ["This is the short form for the Alt key on the keyboard"] }, "Alt"),
metaKey: localize({ key: "superKey", comment: ["This is the short form for the Super key on the keyboard"] }, "Super"),
separator: "+"
});
AriaLabelProvider = new ModifierLabelProvider({
ctrlKey: localize({ key: "ctrlKey.long", comment: ["This is the long form for the Control key on the keyboard"] }, "Control"),
shiftKey: localize({ key: "shiftKey.long", comment: ["This is the long form for the Shift key on the keyboard"] }, "Shift"),
altKey: localize({ key: "optKey.long", comment: ["This is the long form for the Alt/Option key on the keyboard"] }, "Option"),
metaKey: localize({ key: "cmdKey.long", comment: ["This is the long form for the Command key on the keyboard"] }, "Command"),
separator: "+"
}, {
ctrlKey: localize({ key: "ctrlKey.long", comment: ["This is the long form for the Control key on the keyboard"] }, "Control"),
shiftKey: localize({ key: "shiftKey.long", comment: ["This is the long form for the Shift key on the keyboard"] }, "Shift"),
altKey: localize({ key: "altKey.long", comment: ["This is the long form for the Alt key on the keyboard"] }, "Alt"),
metaKey: localize({ key: "windowsKey.long", comment: ["This is the long form for the Windows key on the keyboard"] }, "Windows"),
separator: "+"
}, {
ctrlKey: localize({ key: "ctrlKey.long", comment: ["This is the long form for the Control key on the keyboard"] }, "Control"),
shiftKey: localize({ key: "shiftKey.long", comment: ["This is the long form for the Shift key on the keyboard"] }, "Shift"),
altKey: localize({ key: "altKey.long", comment: ["This is the long form for the Alt key on the keyboard"] }, "Alt"),
metaKey: localize({ key: "superKey.long", comment: ["This is the long form for the Super key on the keyboard"] }, "Super"),
separator: "+"
});
ElectronAcceleratorLabelProvider = new ModifierLabelProvider({
ctrlKey: "Ctrl",
shiftKey: "Shift",
altKey: "Alt",
metaKey: "Cmd",
separator: "+"
}, {
ctrlKey: "Ctrl",
shiftKey: "Shift",
altKey: "Alt",
metaKey: "Super",
separator: "+"
});
UserSettingsLabelProvider = new ModifierLabelProvider({
ctrlKey: "ctrl",
shiftKey: "shift",
altKey: "alt",
metaKey: "cmd",
separator: "+"
}, {
ctrlKey: "ctrl",
shiftKey: "shift",
altKey: "alt",
metaKey: "win",
separator: "+"
}, {
ctrlKey: "ctrl",
shiftKey: "shift",
altKey: "alt",
metaKey: "meta",
separator: "+"
});
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js
var BaseResolvedKeybinding;
var init_baseResolvedKeybinding = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js"() {
init_errors();
init_keybindingLabels();
init_keybindings();
BaseResolvedKeybinding = class extends ResolvedKeybinding {
constructor(os, chords) {
super();
if (chords.length === 0) {
throw illegalArgument(`chords`);
}
this._os = os;
this._chords = chords;
}
getLabel() {
return UILabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getLabel(keybinding));
}
getAriaLabel() {
return AriaLabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getAriaLabel(keybinding));
}
getElectronAccelerator() {
if (this._chords.length > 1) {
return null;
}
if (this._chords[0].isDuplicateModifierCase()) {
return null;
}
return ElectronAcceleratorLabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getElectronAccelerator(keybinding));
}
getUserSettingsLabel() {
return UserSettingsLabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getUserSettingsLabel(keybinding));
}
hasMultipleChords() {
return this._chords.length > 1;
}
getChords() {
return this._chords.map((keybinding) => this._getChord(keybinding));
}
_getChord(keybinding) {
return new ResolvedChord(keybinding.ctrlKey, keybinding.shiftKey, keybinding.altKey, keybinding.metaKey, this._getLabel(keybinding), this._getAriaLabel(keybinding));
}
getDispatchChords() {
return this._chords.map((keybinding) => this._getChordDispatch(keybinding));
}
getSingleModifierDispatchChords() {
return this._chords.map((keybinding) => this._getSingleModifierChordDispatch(keybinding));
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js
var USLayoutResolvedKeybinding;
var init_usLayoutResolvedKeybinding = __esm({
"node_modules/monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js"() {
init_keyCodes();
init_keybindings();
init_baseResolvedKeybinding();
init_resolvedKeybindingItem();
USLayoutResolvedKeybinding = class _USLayoutResolvedKeybinding extends BaseResolvedKeybinding {
constructor(chords, os) {
super(os, chords);
}
_keyCodeToUILabel(keyCode) {
if (this._os === 2) {
switch (keyCode) {
case 15:
return "\u2190";
case 16:
return "\u2191";
case 17:
return "\u2192";
case 18:
return "\u2193";
}
}
return KeyCodeUtils.toString(keyCode);
}
_getLabel(chord) {
if (chord.isDuplicateModifierCase()) {
return "";
}
return this._keyCodeToUILabel(chord.keyCode);
}
_getAriaLabel(chord) {
if (chord.isDuplicateModifierCase()) {
return "";
}
return KeyCodeUtils.toString(chord.keyCode);
}
_getElectronAccelerator(chord) {
return KeyCodeUtils.toElectronAccelerator(chord.keyCode);
}
_getUserSettingsLabel(chord) {
if (chord.isDuplicateModifierCase()) {
return "";
}
const result = KeyCodeUtils.toUserSettingsUS(chord.keyCode);
return result ? result.toLowerCase() : result;
}
_getChordDispatch(chord) {
return _USLayoutResolvedKeybinding.getDispatchStr(chord);
}
static getDispatchStr(chord) {
if (chord.isModifierKey()) {
return null;
}
let result = "";
if (chord.ctrlKey) {
result += "ctrl+";
}
if (chord.shiftKey) {
result += "shift+";
}
if (chord.altKey) {
result += "alt+";
}
if (chord.metaKey) {
result += "meta+";
}
result += KeyCodeUtils.toString(chord.keyCode);
return result;
}
_getSingleModifierChordDispatch(keybinding) {
if (keybinding.keyCode === 5 && !keybinding.shiftKey && !keybinding.altKey && !keybinding.metaKey) {
return "ctrl";
}
if (keybinding.keyCode === 4 && !keybinding.ctrlKey && !keybinding.altKey && !keybinding.metaKey) {
return "shift";
}
if (keybinding.keyCode === 6 && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.metaKey) {
return "alt";
}
if (keybinding.keyCode === 57 && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.altKey) {
return "meta";
}
return null;
}
/**
* *NOTE*: Check return value for `KeyCode.Unknown`.
*/
static _scanCodeToKeyCode(scanCode) {
const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[scanCode];
if (immutableKeyCode !== -1) {
return immutableKeyCode;
}
switch (scanCode) {
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;
// missing
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(chord) {
if (!chord) {
return null;
}
if (chord instanceof KeyCodeChord) {
return chord;
}
const keyCode = this._scanCodeToKeyCode(chord.scanCode);
if (keyCode === 0) {
return null;
}
return new KeyCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, keyCode);
}
static resolveKeybinding(keybinding, os) {
const chords = toEmptyArrayIfContainsNull(keybinding.chords.map((chord) => this._toKeyCodeChord(chord)));
if (chords.length > 0) {
return [new _USLayoutResolvedKeybinding(chords, os)];
}
return [];
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/label/common/label.js
var ILabelService;
var init_label = __esm({
"node_modules/monaco-editor/esm/vs/platform/label/common/label.js"() {
init_instantiation();
ILabelService = createDecorator("labelService");
}
});
// node_modules/monaco-editor/esm/vs/platform/progress/common/progress.js
var IProgressService, emptyProgressRunner, Progress, IEditorProgressService;
var init_progress = __esm({
"node_modules/monaco-editor/esm/vs/platform/progress/common/progress.js"() {
init_instantiation();
IProgressService = createDecorator("progressService");
emptyProgressRunner = Object.freeze({
total() {
},
worked() {
},
done() {
}
});
Progress = class {
constructor(callback) {
this.callback = callback;
}
report(item) {
this._value = item;
this.callback(this._value);
}
};
Progress.None = Object.freeze({ report() {
} });
IEditorProgressService = createDecorator("editorProgressService");
}
});
// node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js
var StringIterator, ConfigKeysIterator, PathIterator, UriIterator, TernarySearchTreeNode, TernarySearchTree;
var init_ternarySearchTree = __esm({
"node_modules/monaco-editor/esm/vs/base/common/ternarySearchTree.js"() {
init_strings();
StringIterator = class {
constructor() {
this._value = "";
this._pos = 0;
}
reset(key) {
this._value = key;
this._pos = 0;
return this;
}
next() {
this._pos += 1;
return this;
}
hasNext() {
return this._pos < this._value.length - 1;
}
cmp(a3) {
const aCode = a3.charCodeAt(0);
const thisCode = this._value.charCodeAt(this._pos);
return aCode - thisCode;
}
value() {
return this._value[this._pos];
}
};
ConfigKeysIterator = class {
constructor(_caseSensitive = true) {
this._caseSensitive = _caseSensitive;
}
reset(key) {
this._value = key;
this._from = 0;
this._to = 0;
return this.next();
}
hasNext() {
return this._to < this._value.length;
}
next() {
this._from = this._to;
let justSeps = true;
for (; this._to < this._value.length; this._to++) {
const ch = this._value.charCodeAt(this._to);
if (ch === 46) {
if (justSeps) {
this._from++;
} else {
break;
}
} else {
justSeps = false;
}
}
return this;
}
cmp(a3) {
return this._caseSensitive ? compareSubstring(a3, this._value, 0, a3.length, this._from, this._to) : compareSubstringIgnoreCase(a3, this._value, 0, a3.length, this._from, this._to);
}
value() {
return this._value.substring(this._from, this._to);
}
};
PathIterator = class {
constructor(_splitOnBackslash = true, _caseSensitive = true) {
this._splitOnBackslash = _splitOnBackslash;
this._caseSensitive = _caseSensitive;
}
reset(key) {
this._from = 0;
this._to = 0;
this._value = key;
this._valueLen = key.length;
for (let pos = key.length - 1; pos >= 0; pos--, this._valueLen--) {
const ch = this._value.charCodeAt(pos);
if (!(ch === 47 || this._splitOnBackslash && ch === 92)) {
break;
}
}
return this.next();
}
hasNext() {
return this._to < this._valueLen;
}
next() {
this._from = this._to;
let justSeps = true;
for (; this._to < this._valueLen; this._to++) {
const ch = this._value.charCodeAt(this._to);
if (ch === 47 || this._splitOnBackslash && ch === 92) {
if (justSeps) {
this._from++;
} else {
break;
}
} else {
justSeps = false;
}
}
return this;
}
cmp(a3) {
return this._caseSensitive ? compareSubstring(a3, this._value, 0, a3.length, this._from, this._to) : compareSubstringIgnoreCase(a3, this._value, 0, a3.length, this._from, this._to);
}
value() {
return this._value.substring(this._from, this._to);
}
};
UriIterator = class {
constructor(_ignorePathCasing, _ignoreQueryAndFragment) {
this._ignorePathCasing = _ignorePathCasing;
this._ignoreQueryAndFragment = _ignoreQueryAndFragment;
this._states = [];
this._stateIdx = 0;
}
reset(key) {
this._value = key;
this._states = [];
if (this._value.scheme) {
this._states.push(
1
/* UriIteratorState.Scheme */
);
}
if (this._value.authority) {
this._states.push(
2
/* UriIteratorState.Authority */
);
}
if (this._value.path) {
this._pathIterator = new PathIterator(false, !this._ignorePathCasing(key));
this._pathIterator.reset(key.path);
if (this._pathIterator.value()) {
this._states.push(
3
/* UriIteratorState.Path */
);
}
}
if (!this._ignoreQueryAndFragment(key)) {
if (this._value.query) {
this._states.push(
4
/* UriIteratorState.Query */
);
}
if (this._value.fragment) {
this._states.push(
5
/* UriIteratorState.Fragment */
);
}
}
this._stateIdx = 0;
return this;
}
next() {
if (this._states[this._stateIdx] === 3 && this._pathIterator.hasNext()) {
this._pathIterator.next();
} else {
this._stateIdx += 1;
}
return this;
}
hasNext() {
return this._states[this._stateIdx] === 3 && this._pathIterator.hasNext() || this._stateIdx < this._states.length - 1;
}
cmp(a3) {
if (this._states[this._stateIdx] === 1) {
return compareIgnoreCase(a3, this._value.scheme);
} else if (this._states[this._stateIdx] === 2) {
return compareIgnoreCase(a3, this._value.authority);
} else if (this._states[this._stateIdx] === 3) {
return this._pathIterator.cmp(a3);
} else if (this._states[this._stateIdx] === 4) {
return compare(a3, this._value.query);
} else if (this._states[this._stateIdx] === 5) {
return compare(a3, this._value.fragment);
}
throw new Error();
}
value() {
if (this._states[this._stateIdx] === 1) {
return this._value.scheme;
} else if (this._states[this._stateIdx] === 2) {
return this._value.authority;
} else if (this._states[this._stateIdx] === 3) {
return this._pathIterator.value();
} else if (this._states[this._stateIdx] === 4) {
return this._value.query;
} else if (this._states[this._stateIdx] === 5) {
return this._value.fragment;
}
throw new Error();
}
};
TernarySearchTreeNode = class {
constructor() {
this.height = 1;
}
rotateLeft() {
const tmp = this.right;
this.right = tmp.left;
tmp.left = this;
this.updateHeight();
tmp.updateHeight();
return tmp;
}
rotateRight() {
const tmp = this.left;
this.left = tmp.right;
tmp.right = this;
this.updateHeight();
tmp.updateHeight();
return tmp;
}
updateHeight() {
this.height = 1 + Math.max(this.heightLeft, this.heightRight);
}
balanceFactor() {
return this.heightRight - this.heightLeft;
}
get heightLeft() {
var _a10, _b4;
return (_b4 = (_a10 = this.left) === null || _a10 === void 0 ? void 0 : _a10.height) !== null && _b4 !== void 0 ? _b4 : 0;
}
get heightRight() {
var _a10, _b4;
return (_b4 = (_a10 = this.right) === null || _a10 === void 0 ? void 0 : _a10.height) !== null && _b4 !== void 0 ? _b4 : 0;
}
};
TernarySearchTree = class _TernarySearchTree {
static forUris(ignorePathCasing = () => false, ignoreQueryAndFragment = () => false) {
return new _TernarySearchTree(new UriIterator(ignorePathCasing, ignoreQueryAndFragment));
}
static forStrings() {
return new _TernarySearchTree(new StringIterator());
}
static forConfigKeys() {
return new _TernarySearchTree(new ConfigKeysIterator());
}
constructor(segments) {
this._iter = segments;
}
clear() {
this._root = void 0;
}
set(key, element) {
const iter = this._iter.reset(key);
let node;
if (!this._root) {
this._root = new TernarySearchTreeNode();
this._root.segment = iter.value();
}
const stack = [];
node = this._root;
while (true) {
const val = iter.cmp(node.segment);
if (val > 0) {
if (!node.left) {
node.left = new TernarySearchTreeNode();
node.left.segment = iter.value();
}
stack.push([-1, node]);
node = node.left;
} else if (val < 0) {
if (!node.right) {
node.right = new TernarySearchTreeNode();
node.right.segment = iter.value();
}
stack.push([1, node]);
node = node.right;
} else if (iter.hasNext()) {
iter.next();
if (!node.mid) {
node.mid = new TernarySearchTreeNode();
node.mid.segment = iter.value();
}
stack.push([0, node]);
node = node.mid;
} else {
break;
}
}
const oldElement = node.value;
node.value = element;
node.key = key;
for (let i = stack.length - 1; i >= 0; i--) {
const node2 = stack[i][1];
node2.updateHeight();
const bf = node2.balanceFactor();
if (bf < -1 || bf > 1) {
const d1 = stack[i][0];
const d2 = stack[i + 1][0];
if (d1 === 1 && d2 === 1) {
stack[i][1] = node2.rotateLeft();
} else if (d1 === -1 && d2 === -1) {
stack[i][1] = node2.rotateRight();
} else if (d1 === 1 && d2 === -1) {
node2.right = stack[i + 1][1] = stack[i + 1][1].rotateRight();
stack[i][1] = node2.rotateLeft();
} else if (d1 === -1 && d2 === 1) {
node2.left = stack[i + 1][1] = stack[i + 1][1].rotateLeft();
stack[i][1] = node2.rotateRight();
} else {
throw new Error();
}
if (i > 0) {
switch (stack[i - 1][0]) {
case -1:
stack[i - 1][1].left = stack[i][1];
break;
case 1:
stack[i - 1][1].right = stack[i][1];
break;
case 0:
stack[i - 1][1].mid = stack[i][1];
break;
}
} else {
this._root = stack[0][1];
}
}
}
return oldElement;
}
get(key) {
var _a10;
return (_a10 = this._getNode(key)) === null || _a10 === void 0 ? void 0 : _a10.value;
}
_getNode(key) {
const iter = this._iter.reset(key);
let node = this._root;
while (node) {
const val = iter.cmp(node.segment);
if (val > 0) {
node = node.left;
} else if (val < 0) {
node = node.right;
} else if (iter.hasNext()) {
iter.next();
node = node.mid;
} else {
break;
}
}
return node;
}
has(key) {
const node = this._getNode(key);
return !((node === null || node === void 0 ? void 0 : node.value) === void 0 && (node === null || node === void 0 ? void 0 : node.mid) === void 0);
}
delete(key) {
return this._delete(key, false);
}
deleteSuperstr(key) {
return this._delete(key, true);
}
_delete(key, superStr) {
var _a10;
const iter = this._iter.reset(key);
const stack = [];
let node = this._root;
while (node) {
const val = iter.cmp(node.segment);
if (val > 0) {
stack.push([-1, node]);
node = node.left;
} else if (val < 0) {
stack.push([1, node]);
node = node.right;
} else if (iter.hasNext()) {
iter.next();
stack.push([0, node]);
node = node.mid;
} else {
break;
}
}
if (!node) {
return;
}
if (superStr) {
node.left = void 0;
node.mid = void 0;
node.right = void 0;
node.height = 1;
} else {
node.key = void 0;
node.value = void 0;
}
if (!node.mid && !node.value) {
if (node.left && node.right) {
const min = this._min(node.right);
if (min.key) {
const { key: key2, value, segment } = min;
this._delete(min.key, false);
node.key = key2;
node.value = value;
node.segment = segment;
}
} else {
const newChild = (_a10 = node.left) !== null && _a10 !== void 0 ? _a10 : node.right;
if (stack.length > 0) {
const [dir, parent] = stack[stack.length - 1];
switch (dir) {
case -1:
parent.left = newChild;
break;
case 0:
parent.mid = newChild;
break;
case 1:
parent.right = newChild;
break;
}
} else {
this._root = newChild;
}
}
}
for (let i = stack.length - 1; i >= 0; i--) {
const node2 = stack[i][1];
node2.updateHeight();
const bf = node2.balanceFactor();
if (bf > 1) {
if (node2.right.balanceFactor() >= 0) {
stack[i][1] = node2.rotateLeft();
} else {
node2.right = node2.right.rotateRight();
stack[i][1] = node2.rotateLeft();
}
} else if (bf < -1) {
if (node2.left.balanceFactor() <= 0) {
stack[i][1] = node2.rotateRight();
} else {
node2.left = node2.left.rotateLeft();
stack[i][1] = node2.rotateRight();
}
}
if (i > 0) {
switch (stack[i - 1][0]) {
case -1:
stack[i - 1][1].left = stack[i][1];
break;
case 1:
stack[i - 1][1].right = stack[i][1];
break;
case 0:
stack[i - 1][1].mid = stack[i][1];
break;
}
} else {
this._root = stack[0][1];
}
}
}
_min(node) {
while (node.left) {
node = node.left;
}
return node;
}
findSubstr(key) {
const iter = this._iter.reset(key);
let node = this._root;
let candidate = void 0;
while (node) {
const val = iter.cmp(node.segment);
if (val > 0) {
node = node.left;
} else if (val < 0) {
node = node.right;
} else if (iter.hasNext()) {
iter.next();
candidate = node.value || candidate;
node = node.mid;
} else {
break;
}
}
return node && node.value || candidate;
}
findSuperstr(key) {
return this._findSuperstrOrElement(key, false);
}
_findSuperstrOrElement(key, allowValue) {
const iter = this._iter.reset(key);
let node = this._root;
while (node) {
const val = iter.cmp(node.segment);
if (val > 0) {
node = node.left;
} else if (val < 0) {
node = node.right;
} else if (iter.hasNext()) {
iter.next();
node = node.mid;
} else {
if (!node.mid) {
if (allowValue) {
return node.value;
} else {
return void 0;
}
} else {
return this._entries(node.mid);
}
}
}
return void 0;
}
forEach(callback) {
for (const [key, value] of this) {
callback(value, key);
}
}
*[Symbol.iterator]() {
yield* __yieldStar(this._entries(this._root));
}
_entries(node) {
const result = [];
this._dfsEntries(node, result);
return result[Symbol.iterator]();
}
_dfsEntries(node, bucket) {
if (!node) {
return;
}
if (node.left) {
this._dfsEntries(node.left, bucket);
}
if (node.value) {
bucket.push([node.key, node.value]);
}
if (node.mid) {
this._dfsEntries(node.mid, bucket);
}
if (node.right) {
this._dfsEntries(node.right, bucket);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/workspace/common/workspace.js
function isSingleFolderWorkspaceIdentifier(obj) {
const singleFolderIdentifier = obj;
return typeof (singleFolderIdentifier === null || singleFolderIdentifier === void 0 ? void 0 : singleFolderIdentifier.id) === "string" && URI.isUri(singleFolderIdentifier.uri);
}
function isEmptyWorkspaceIdentifier(obj) {
const emptyWorkspaceIdentifier = obj;
return typeof (emptyWorkspaceIdentifier === null || emptyWorkspaceIdentifier === void 0 ? void 0 : emptyWorkspaceIdentifier.id) === "string" && !isSingleFolderWorkspaceIdentifier(obj) && !isWorkspaceIdentifier(obj);
}
function toWorkspaceIdentifier(arg0, isExtensionDevelopment) {
if (typeof arg0 === "string" || typeof arg0 === "undefined") {
if (typeof arg0 === "string") {
return {
id: basename(arg0)
};
}
if (isExtensionDevelopment) {
return EXTENSION_DEVELOPMENT_EMPTY_WINDOW_WORKSPACE;
}
return UNKNOWN_EMPTY_WINDOW_WORKSPACE;
}
const workspace = arg0;
if (workspace.configuration) {
return {
id: workspace.id,
configPath: workspace.configuration
};
}
if (workspace.folders.length === 1) {
return {
id: workspace.id,
uri: workspace.folders[0].uri
};
}
return {
id: workspace.id
};
}
function isWorkspaceIdentifier(obj) {
const workspaceIdentifier = obj;
return typeof (workspaceIdentifier === null || workspaceIdentifier === void 0 ? void 0 : workspaceIdentifier.id) === "string" && URI.isUri(workspaceIdentifier.configPath);
}
function isStandaloneEditorWorkspace(workspace) {
return workspace.id === STANDALONE_EDITOR_WORKSPACE_ID;
}
var IWorkspaceContextService, EXTENSION_DEVELOPMENT_EMPTY_WINDOW_WORKSPACE, UNKNOWN_EMPTY_WINDOW_WORKSPACE, WorkspaceFolder, WORKSPACE_EXTENSION, WORKSPACE_FILTER, STANDALONE_EDITOR_WORKSPACE_ID;
var init_workspace = __esm({
"node_modules/monaco-editor/esm/vs/platform/workspace/common/workspace.js"() {
init_nls();
init_path();
init_ternarySearchTree();
init_uri();
init_instantiation();
IWorkspaceContextService = createDecorator("contextService");
EXTENSION_DEVELOPMENT_EMPTY_WINDOW_WORKSPACE = { id: "ext-dev" };
UNKNOWN_EMPTY_WINDOW_WORKSPACE = { id: "empty-window" };
WorkspaceFolder = class {
constructor(data, raw) {
this.raw = raw;
this.uri = data.uri;
this.index = data.index;
this.name = data.name;
}
toJSON() {
return { uri: this.uri, name: this.name, index: this.index };
}
};
WORKSPACE_EXTENSION = "code-workspace";
WORKSPACE_FILTER = [{ name: localize("codeWorkspace", "Code Workspace"), extensions: [WORKSPACE_EXTENSION] }];
STANDALONE_EDITOR_WORKSPACE_ID = "4064f6ec-cb38-4ad0-af64-ee6467e63c82";
}
});
// node_modules/monaco-editor/esm/vs/editor/common/standaloneStrings.js
var InspectTokensNLS, GoToLineNLS, QuickHelpNLS, QuickCommandNLS, QuickOutlineNLS, StandaloneCodeEditorNLS, ToggleHighContrastNLS, StandaloneServicesNLS;
var init_standaloneStrings = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/standaloneStrings.js"() {
init_nls();
(function(InspectTokensNLS2) {
InspectTokensNLS2.inspectTokensAction = localize("inspectTokens", "Developer: Inspect Tokens");
})(InspectTokensNLS || (InspectTokensNLS = {}));
(function(GoToLineNLS2) {
GoToLineNLS2.gotoLineActionLabel = localize("gotoLineActionLabel", "Go to Line/Column...");
})(GoToLineNLS || (GoToLineNLS = {}));
(function(QuickHelpNLS2) {
QuickHelpNLS2.helpQuickAccessActionLabel = localize("helpQuickAccess", "Show all Quick Access Providers");
})(QuickHelpNLS || (QuickHelpNLS = {}));
(function(QuickCommandNLS2) {
QuickCommandNLS2.quickCommandActionLabel = localize("quickCommandActionLabel", "Command Palette");
QuickCommandNLS2.quickCommandHelp = localize("quickCommandActionHelp", "Show And Run Commands");
})(QuickCommandNLS || (QuickCommandNLS = {}));
(function(QuickOutlineNLS2) {
QuickOutlineNLS2.quickOutlineActionLabel = localize("quickOutlineActionLabel", "Go to Symbol...");
QuickOutlineNLS2.quickOutlineByCategoryActionLabel = localize("quickOutlineByCategoryActionLabel", "Go to Symbol by Category...");
})(QuickOutlineNLS || (QuickOutlineNLS = {}));
(function(StandaloneCodeEditorNLS2) {
StandaloneCodeEditorNLS2.editorViewAccessibleLabel = localize("editorViewAccessibleLabel", "Editor content");
StandaloneCodeEditorNLS2.accessibilityHelpMessage = localize("accessibilityHelpMessage", "Press Alt+F1 for Accessibility Options.");
})(StandaloneCodeEditorNLS || (StandaloneCodeEditorNLS = {}));
(function(ToggleHighContrastNLS2) {
ToggleHighContrastNLS2.toggleHighContrast = localize("toggleHighContrast", "Toggle High Contrast Theme");
})(ToggleHighContrastNLS || (ToggleHighContrastNLS = {}));
(function(StandaloneServicesNLS2) {
StandaloneServicesNLS2.bulkEditServiceSummary = localize("bulkEditServiceSummary", "Made {0} edits in {1} files");
})(StandaloneServicesNLS || (StandaloneServicesNLS = {}));
}
});
// node_modules/monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js
var IWorkspaceTrustManagementService;
var init_workspaceTrust = __esm({
"node_modules/monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js"() {
init_instantiation();
IWorkspaceTrustManagementService = createDecorator("workspaceTrustManagementService");
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languagesAssociations.js
function registerPlatformLanguageAssociation(association, warnOnOverwrite = false) {
_registerLanguageAssociation(association, false, warnOnOverwrite);
}
function _registerLanguageAssociation(association, userConfigured, warnOnOverwrite) {
const associationItem = toLanguageAssociationItem(association, userConfigured);
registeredAssociations.push(associationItem);
if (!associationItem.userConfigured) {
nonUserRegisteredAssociations.push(associationItem);
} else {
userRegisteredAssociations.push(associationItem);
}
if (warnOnOverwrite && !associationItem.userConfigured) {
registeredAssociations.forEach((a3) => {
if (a3.mime === associationItem.mime || a3.userConfigured) {
return;
}
if (associationItem.extension && a3.extension === associationItem.extension) {
console.warn(`Overwriting extension <<${associationItem.extension}>> to now point to mime <<${associationItem.mime}>>`);
}
if (associationItem.filename && a3.filename === associationItem.filename) {
console.warn(`Overwriting filename <<${associationItem.filename}>> to now point to mime <<${associationItem.mime}>>`);
}
if (associationItem.filepattern && a3.filepattern === associationItem.filepattern) {
console.warn(`Overwriting filepattern <<${associationItem.filepattern}>> to now point to mime <<${associationItem.mime}>>`);
}
if (associationItem.firstline && a3.firstline === associationItem.firstline) {
console.warn(`Overwriting firstline <<${associationItem.firstline}>> to now point to mime <<${associationItem.mime}>>`);
}
});
}
}
function toLanguageAssociationItem(association, userConfigured) {
return {
id: association.id,
mime: association.mime,
filename: association.filename,
extension: association.extension,
filepattern: association.filepattern,
firstline: association.firstline,
userConfigured,
filenameLowercase: association.filename ? association.filename.toLowerCase() : void 0,
extensionLowercase: association.extension ? association.extension.toLowerCase() : void 0,
filepatternLowercase: association.filepattern ? parse(association.filepattern.toLowerCase()) : void 0,
filepatternOnPath: association.filepattern ? association.filepattern.indexOf(posix.sep) >= 0 : false
};
}
function clearPlatformLanguageAssociations() {
registeredAssociations = registeredAssociations.filter((a3) => a3.userConfigured);
nonUserRegisteredAssociations = [];
}
function getLanguageIds(resource, firstLine) {
return getAssociations(resource, firstLine).map((item) => item.id);
}
function getAssociations(resource, firstLine) {
let path;
if (resource) {
switch (resource.scheme) {
case Schemas.file:
path = resource.fsPath;
break;
case Schemas.data: {
const metadata = DataUri.parseMetaData(resource);
path = metadata.get(DataUri.META_DATA_LABEL);
break;
}
case Schemas.vscodeNotebookCell:
path = void 0;
break;
default:
path = resource.path;
}
}
if (!path) {
return [{ id: "unknown", mime: Mimes.unknown }];
}
path = path.toLowerCase();
const filename = basename(path);
const configuredLanguage = getAssociationByPath(path, filename, userRegisteredAssociations);
if (configuredLanguage) {
return [configuredLanguage, { id: PLAINTEXT_LANGUAGE_ID, mime: Mimes.text }];
}
const registeredLanguage = getAssociationByPath(path, filename, nonUserRegisteredAssociations);
if (registeredLanguage) {
return [registeredLanguage, { id: PLAINTEXT_LANGUAGE_ID, mime: Mimes.text }];
}
if (firstLine) {
const firstlineLanguage = getAssociationByFirstline(firstLine);
if (firstlineLanguage) {
return [firstlineLanguage, { id: PLAINTEXT_LANGUAGE_ID, mime: Mimes.text }];
}
}
return [{ id: "unknown", mime: Mimes.unknown }];
}
function getAssociationByPath(path, filename, associations) {
var _a10;
let filenameMatch = void 0;
let patternMatch = void 0;
let extensionMatch = void 0;
for (let i = associations.length - 1; i >= 0; i--) {
const association = associations[i];
if (filename === association.filenameLowercase) {
filenameMatch = association;
break;
}
if (association.filepattern) {
if (!patternMatch || association.filepattern.length > patternMatch.filepattern.length) {
const target = association.filepatternOnPath ? path : filename;
if ((_a10 = association.filepatternLowercase) === null || _a10 === void 0 ? void 0 : _a10.call(association, target)) {
patternMatch = association;
}
}
}
if (association.extension) {
if (!extensionMatch || association.extension.length > extensionMatch.extension.length) {
if (filename.endsWith(association.extensionLowercase)) {
extensionMatch = association;
}
}
}
}
if (filenameMatch) {
return filenameMatch;
}
if (patternMatch) {
return patternMatch;
}
if (extensionMatch) {
return extensionMatch;
}
return void 0;
}
function getAssociationByFirstline(firstLine) {
if (startsWithUTF8BOM(firstLine)) {
firstLine = firstLine.substr(1);
}
if (firstLine.length > 0) {
for (let i = registeredAssociations.length - 1; i >= 0; i--) {
const association = registeredAssociations[i];
if (!association.firstline) {
continue;
}
const matches2 = firstLine.match(association.firstline);
if (matches2 && matches2.length > 0) {
return association;
}
}
}
return void 0;
}
var registeredAssociations, nonUserRegisteredAssociations, userRegisteredAssociations;
var init_languagesAssociations = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languagesAssociations.js"() {
init_glob();
init_mime();
init_network();
init_path();
init_resources();
init_strings();
init_modesRegistry();
registeredAssociations = [];
nonUserRegisteredAssociations = [];
userRegisteredAssociations = [];
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languagesRegistry.js
var hasOwnProperty2, NULL_LANGUAGE_ID, LanguageIdCodec, LanguagesRegistry;
var init_languagesRegistry = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languagesRegistry.js"() {
init_event();
init_lifecycle();
init_strings();
init_languagesAssociations();
init_modesRegistry();
init_configurationRegistry();
init_platform2();
hasOwnProperty2 = Object.prototype.hasOwnProperty;
NULL_LANGUAGE_ID = "vs.editor.nullLanguage";
LanguageIdCodec = class {
constructor() {
this._languageIdToLanguage = [];
this._languageToLanguageId = /* @__PURE__ */ new Map();
this._register(
NULL_LANGUAGE_ID,
0
/* LanguageId.Null */
);
this._register(
PLAINTEXT_LANGUAGE_ID,
1
/* LanguageId.PlainText */
);
this._nextLanguageId = 2;
}
_register(language82, languageId) {
this._languageIdToLanguage[languageId] = language82;
this._languageToLanguageId.set(language82, languageId);
}
register(language82) {
if (this._languageToLanguageId.has(language82)) {
return;
}
const languageId = this._nextLanguageId++;
this._register(language82, languageId);
}
encodeLanguageId(languageId) {
return this._languageToLanguageId.get(languageId) || 0;
}
decodeLanguageId(languageId) {
return this._languageIdToLanguage[languageId] || NULL_LANGUAGE_ID;
}
};
LanguagesRegistry = class _LanguagesRegistry extends Disposable {
constructor(useModesRegistry = true, warnOnOverwrite = false) {
super();
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
_LanguagesRegistry.instanceCount++;
this._warnOnOverwrite = warnOnOverwrite;
this.languageIdCodec = new LanguageIdCodec();
this._dynamicLanguages = [];
this._languages = {};
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
if (useModesRegistry) {
this._initializeFromRegistry();
this._register(ModesRegistry.onDidChangeLanguages((m) => {
this._initializeFromRegistry();
}));
}
}
dispose() {
_LanguagesRegistry.instanceCount--;
super.dispose();
}
_initializeFromRegistry() {
this._languages = {};
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
clearPlatformLanguageAssociations();
const desc = [].concat(ModesRegistry.getLanguages()).concat(this._dynamicLanguages);
this._registerLanguages(desc);
}
_registerLanguages(desc) {
for (const d of desc) {
this._registerLanguage(d);
}
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
Object.keys(this._languages).forEach((langId) => {
const language82 = this._languages[langId];
if (language82.name) {
this._nameMap[language82.name] = language82.identifier;
}
language82.aliases.forEach((alias) => {
this._lowercaseNameMap[alias.toLowerCase()] = language82.identifier;
});
language82.mimetypes.forEach((mimetype) => {
this._mimeTypesMap[mimetype] = language82.identifier;
});
});
Registry.as(Extensions4.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds());
this._onDidChange.fire();
}
_registerLanguage(lang) {
const langId = lang.id;
let resolvedLanguage;
if (hasOwnProperty2.call(this._languages, langId)) {
resolvedLanguage = this._languages[langId];
} else {
this.languageIdCodec.register(langId);
resolvedLanguage = {
identifier: langId,
name: null,
mimetypes: [],
aliases: [],
extensions: [],
filenames: [],
configurationFiles: [],
icons: []
};
this._languages[langId] = resolvedLanguage;
}
this._mergeLanguage(resolvedLanguage, lang);
}
_mergeLanguage(resolvedLanguage, lang) {
const langId = lang.id;
let primaryMime = null;
if (Array.isArray(lang.mimetypes) && lang.mimetypes.length > 0) {
resolvedLanguage.mimetypes.push(...lang.mimetypes);
primaryMime = lang.mimetypes[0];
}
if (!primaryMime) {
primaryMime = `text/x-${langId}`;
resolvedLanguage.mimetypes.push(primaryMime);
}
if (Array.isArray(lang.extensions)) {
if (lang.configuration) {
resolvedLanguage.extensions = lang.extensions.concat(resolvedLanguage.extensions);
} else {
resolvedLanguage.extensions = resolvedLanguage.extensions.concat(lang.extensions);
}
for (const extension of lang.extensions) {
registerPlatformLanguageAssociation({ id: langId, mime: primaryMime, extension }, this._warnOnOverwrite);
}
}
if (Array.isArray(lang.filenames)) {
for (const filename of lang.filenames) {
registerPlatformLanguageAssociation({ id: langId, mime: primaryMime, filename }, this._warnOnOverwrite);
resolvedLanguage.filenames.push(filename);
}
}
if (Array.isArray(lang.filenamePatterns)) {
for (const filenamePattern of lang.filenamePatterns) {
registerPlatformLanguageAssociation({ id: langId, mime: primaryMime, filepattern: filenamePattern }, this._warnOnOverwrite);
}
}
if (typeof lang.firstLine === "string" && lang.firstLine.length > 0) {
let firstLineRegexStr = lang.firstLine;
if (firstLineRegexStr.charAt(0) !== "^") {
firstLineRegexStr = "^" + firstLineRegexStr;
}
try {
const firstLineRegex = new RegExp(firstLineRegexStr);
if (!regExpLeadsToEndlessLoop(firstLineRegex)) {
registerPlatformLanguageAssociation({ id: langId, mime: primaryMime, firstline: firstLineRegex }, this._warnOnOverwrite);
}
} catch (err) {
console.warn(`[${lang.id}]: Invalid regular expression \`${firstLineRegexStr}\`: `, err);
}
}
resolvedLanguage.aliases.push(langId);
let langAliases = null;
if (typeof lang.aliases !== "undefined" && Array.isArray(lang.aliases)) {
if (lang.aliases.length === 0) {
langAliases = [null];
} else {
langAliases = lang.aliases;
}
}
if (langAliases !== null) {
for (const langAlias of langAliases) {
if (!langAlias || langAlias.length === 0) {
continue;
}
resolvedLanguage.aliases.push(langAlias);
}
}
const containsAliases = langAliases !== null && langAliases.length > 0;
if (containsAliases && langAliases[0] === null) {
} else {
const bestName = (containsAliases ? langAliases[0] : null) || langId;
if (containsAliases || !resolvedLanguage.name) {
resolvedLanguage.name = bestName;
}
}
if (lang.configuration) {
resolvedLanguage.configurationFiles.push(lang.configuration);
}
if (lang.icon) {
resolvedLanguage.icons.push(lang.icon);
}
}
isRegisteredLanguageId(languageId) {
if (!languageId) {
return false;
}
return hasOwnProperty2.call(this._languages, languageId);
}
getRegisteredLanguageIds() {
return Object.keys(this._languages);
}
getLanguageIdByLanguageName(languageName) {
const languageNameLower = languageName.toLowerCase();
if (!hasOwnProperty2.call(this._lowercaseNameMap, languageNameLower)) {
return null;
}
return this._lowercaseNameMap[languageNameLower];
}
getLanguageIdByMimeType(mimeType) {
if (!mimeType) {
return null;
}
if (hasOwnProperty2.call(this._mimeTypesMap, mimeType)) {
return this._mimeTypesMap[mimeType];
}
return null;
}
guessLanguageIdByFilepathOrFirstLine(resource, firstLine) {
if (!resource && !firstLine) {
return [];
}
return getLanguageIds(resource, firstLine);
}
};
LanguagesRegistry.instanceCount = 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/languageService.js
var LanguageService, LanguageSelection;
var init_languageService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/languageService.js"() {
init_event();
init_lifecycle();
init_languagesRegistry();
init_arrays();
init_languages();
init_modesRegistry();
LanguageService = class _LanguageService extends Disposable {
constructor(warnOnOverwrite = false) {
super();
this._onDidRequestBasicLanguageFeatures = this._register(new Emitter());
this.onDidRequestBasicLanguageFeatures = this._onDidRequestBasicLanguageFeatures.event;
this._onDidRequestRichLanguageFeatures = this._register(new Emitter());
this.onDidRequestRichLanguageFeatures = this._onDidRequestRichLanguageFeatures.event;
this._onDidChange = this._register(new Emitter({
leakWarningThreshold: 200
/* https://github.com/microsoft/vscode/issues/119968 */
}));
this.onDidChange = this._onDidChange.event;
this._requestedBasicLanguages = /* @__PURE__ */ new Set();
this._requestedRichLanguages = /* @__PURE__ */ new Set();
_LanguageService.instanceCount++;
this._registry = this._register(new LanguagesRegistry(true, warnOnOverwrite));
this.languageIdCodec = this._registry.languageIdCodec;
this._register(this._registry.onDidChange(() => this._onDidChange.fire()));
}
dispose() {
_LanguageService.instanceCount--;
super.dispose();
}
isRegisteredLanguageId(languageId) {
return this._registry.isRegisteredLanguageId(languageId);
}
getLanguageIdByLanguageName(languageName) {
return this._registry.getLanguageIdByLanguageName(languageName);
}
getLanguageIdByMimeType(mimeType) {
return this._registry.getLanguageIdByMimeType(mimeType);
}
guessLanguageIdByFilepathOrFirstLine(resource, firstLine) {
const languageIds = this._registry.guessLanguageIdByFilepathOrFirstLine(resource, firstLine);
return firstOrDefault(languageIds, null);
}
createById(languageId) {
return new LanguageSelection(this.onDidChange, () => {
return this._createAndGetLanguageIdentifier(languageId);
});
}
createByFilepathOrFirstLine(resource, firstLine) {
return new LanguageSelection(this.onDidChange, () => {
const languageId = this.guessLanguageIdByFilepathOrFirstLine(resource, firstLine);
return this._createAndGetLanguageIdentifier(languageId);
});
}
_createAndGetLanguageIdentifier(languageId) {
if (!languageId || !this.isRegisteredLanguageId(languageId)) {
languageId = PLAINTEXT_LANGUAGE_ID;
}
return languageId;
}
requestBasicLanguageFeatures(languageId) {
if (!this._requestedBasicLanguages.has(languageId)) {
this._requestedBasicLanguages.add(languageId);
this._onDidRequestBasicLanguageFeatures.fire(languageId);
}
}
requestRichLanguageFeatures(languageId) {
if (!this._requestedRichLanguages.has(languageId)) {
this._requestedRichLanguages.add(languageId);
this.requestBasicLanguageFeatures(languageId);
TokenizationRegistry2.getOrCreate(languageId);
this._onDidRequestRichLanguageFeatures.fire(languageId);
}
}
};
LanguageService.instanceCount = 0;
LanguageSelection = class {
constructor(_onDidChangeLanguages, _selector) {
this._onDidChangeLanguages = _onDidChangeLanguages;
this._selector = _selector;
this._listener = null;
this._emitter = null;
this.languageId = this._selector();
}
_dispose() {
if (this._listener) {
this._listener.dispose();
this._listener = null;
}
if (this._emitter) {
this._emitter.dispose();
this._emitter = null;
}
}
get onDidChange() {
if (!this._listener) {
this._listener = this._onDidChangeLanguages(() => this._evaluate());
}
if (!this._emitter) {
this._emitter = new Emitter({
onDidRemoveLastListener: () => {
this._dispose();
}
});
}
return this._emitter.event;
}
_evaluate() {
var _a10;
const languageId = this._selector();
if (languageId === this.languageId) {
return;
}
this.languageId = languageId;
(_a10 = this._emitter) === null || _a10 === void 0 ? void 0 : _a10.fire(this.languageId);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/dnd.js
var DataTransfers;
var init_dnd = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/dnd.js"() {
init_mime();
DataTransfers = {
/**
* Application specific resource transfer type
*/
RESOURCES: "ResourceURLs",
/**
* Browser specific transfer type to download
*/
DOWNLOAD_URL: "DownloadURL",
/**
* Browser specific transfer type for files
*/
FILES: "Files",
/**
* Typically transfer type for copy/paste transfers.
*/
TEXT: Mimes.text,
/**
* Internal type used to pass around text/uri-list data.
*
* This is needed to work around https://bugs.chromium.org/p/chromium/issues/detail?id=239745.
*/
INTERNAL_URI_LIST: "application/vnd.code.uri-list"
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js
function setHoverDelegateFactory(hoverDelegateProvider) {
hoverDelegateFactory = hoverDelegateProvider;
}
function getDefaultHoverDelegate(placement) {
if (placement === "element") {
return defaultHoverDelegateElement.value;
}
return defaultHoverDelegateMouse.value;
}
function createInstantHoverDelegate() {
return hoverDelegateFactory("element", true);
}
var nullHoverDelegateFactory, hoverDelegateFactory, defaultHoverDelegateMouse, defaultHoverDelegateElement;
var init_hoverDelegateFactory = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegateFactory.js"() {
init_lazy();
nullHoverDelegateFactory = () => ({
get delay() {
return -1;
},
dispose: () => {
},
showHover: () => {
return void 0;
}
});
hoverDelegateFactory = nullHoverDelegateFactory;
defaultHoverDelegateMouse = new Lazy(() => hoverDelegateFactory("mouse", false));
defaultHoverDelegateElement = new Lazy(() => hoverDelegateFactory("element", false));
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js
function setBaseLayerHoverDelegate(hoverDelegate) {
baseHoverDelegate = hoverDelegate;
}
function getBaseLayerHoverDelegate() {
return baseHoverDelegate;
}
var baseHoverDelegate;
var init_hoverDelegate2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/hover/hoverDelegate2.js"() {
baseHoverDelegate = {
showHover: () => void 0,
hideHover: () => void 0,
showAndFocusLastHover: () => void 0,
setupUpdatableHover: () => null,
triggerUpdatableHover: () => void 0
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js
var CombinedSpliceable;
var init_splice = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js"() {
CombinedSpliceable = class {
constructor(spliceables) {
this.spliceables = spliceables;
}
splice(start, deleteCount, elements) {
this.spliceables.forEach((s) => s.splice(start, deleteCount, elements));
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css
var init_list = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js
var ListError;
var init_list2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js"() {
ListError = class extends Error {
constructor(user, message) {
super(`ListError [${user}] ${message}`);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js
function groupIntersect(range2, groups) {
const result = [];
for (const r of groups) {
if (range2.start >= r.range.end) {
continue;
}
if (range2.end < r.range.start) {
break;
}
const intersection2 = Range2.intersect(range2, r.range);
if (Range2.isEmpty(intersection2)) {
continue;
}
result.push({
range: intersection2,
size: r.size
});
}
return result;
}
function shift({ start, end }, much) {
return { start: start + much, end: end + much };
}
function consolidate(groups) {
const result = [];
let previousGroup = null;
for (const group of groups) {
const start = group.range.start;
const end = group.range.end;
const size2 = group.size;
if (previousGroup && size2 === previousGroup.size) {
previousGroup.range.end = end;
continue;
}
previousGroup = { range: { start, end }, size: size2 };
result.push(previousGroup);
}
return result;
}
function concat2(...groups) {
return consolidate(groups.reduce((r, g) => r.concat(g), []));
}
var RangeMap;
var init_rangeMap = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js"() {
init_range2();
RangeMap = class {
get paddingTop() {
return this._paddingTop;
}
set paddingTop(paddingTop) {
this._size = this._size + paddingTop - this._paddingTop;
this._paddingTop = paddingTop;
}
constructor(topPadding) {
this.groups = [];
this._size = 0;
this._paddingTop = 0;
this._paddingTop = topPadding !== null && topPadding !== void 0 ? topPadding : 0;
this._size = this._paddingTop;
}
splice(index, deleteCount, items = []) {
const diff = items.length - deleteCount;
const before = groupIntersect({ start: 0, end: index }, this.groups);
const after2 = groupIntersect({ start: index + deleteCount, end: Number.POSITIVE_INFINITY }, this.groups).map((g) => ({ range: shift(g.range, diff), size: g.size }));
const middle = items.map((item, i) => ({
range: { start: index + i, end: index + i + 1 },
size: item.size
}));
this.groups = concat2(before, middle, after2);
this._size = this._paddingTop + this.groups.reduce((t4, g) => t4 + g.size * (g.range.end - g.range.start), 0);
}
/**
* Returns the number of items in the range map.
*/
get count() {
const len = this.groups.length;
if (!len) {
return 0;
}
return this.groups[len - 1].range.end;
}
/**
* Returns the sum of the sizes of all items in the range map.
*/
get size() {
return this._size;
}
/**
* Returns the index of the item at the given position.
*/
indexAt(position) {
if (position < 0) {
return -1;
}
if (position < this._paddingTop) {
return 0;
}
let index = 0;
let size2 = this._paddingTop;
for (const group of this.groups) {
const count = group.range.end - group.range.start;
const newSize = size2 + count * group.size;
if (position < newSize) {
return index + Math.floor((position - size2) / group.size);
}
index += count;
size2 = newSize;
}
return index;
}
/**
* Returns the index of the item right after the item at the
* index of the given position.
*/
indexAfter(position) {
return Math.min(this.indexAt(position) + 1, this.count);
}
/**
* Returns the start position of the item at the given index.
*/
positionAt(index) {
if (index < 0) {
return -1;
}
let position = 0;
let count = 0;
for (const group of this.groups) {
const groupCount = group.range.end - group.range.start;
const newCount = count + groupCount;
if (index < newCount) {
return this._paddingTop + position + (index - count) * group.size;
}
position += groupCount * group.size;
count = newCount;
}
return -1;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js
function removeFromParent(element) {
var _a10;
try {
(_a10 = element.parentElement) === null || _a10 === void 0 ? void 0 : _a10.removeChild(element);
} catch (e) {
}
}
var RowCache;
var init_rowCache = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js"() {
init_dom();
RowCache = class {
constructor(renderers) {
this.renderers = renderers;
this.cache = /* @__PURE__ */ new Map();
this.transactionNodesPendingRemoval = /* @__PURE__ */ new Set();
this.inTransaction = false;
}
/**
* Returns a row either by creating a new one or reusing
* a previously released row which shares the same templateId.
*
* @returns A row and `isReusingConnectedDomNode` if the row's node is already in the dom in a stale position.
*/
alloc(templateId) {
let result = this.getTemplateCache(templateId).pop();
let isStale = false;
if (result) {
isStale = this.transactionNodesPendingRemoval.has(result.domNode);
if (isStale) {
this.transactionNodesPendingRemoval.delete(result.domNode);
}
} else {
const domNode = $(".monaco-list-row");
const renderer = this.getRenderer(templateId);
const templateData = renderer.renderTemplate(domNode);
result = { domNode, templateId, templateData };
}
return { row: result, isReusingConnectedDomNode: isStale };
}
/**
* Releases the row for eventual reuse.
*/
release(row) {
if (!row) {
return;
}
this.releaseRow(row);
}
/**
* Begin a set of changes that use the cache. This lets us skip work when a row is removed and then inserted again.
*/
transact(makeChanges) {
if (this.inTransaction) {
throw new Error("Already in transaction");
}
this.inTransaction = true;
try {
makeChanges();
} finally {
for (const domNode of this.transactionNodesPendingRemoval) {
this.doRemoveNode(domNode);
}
this.transactionNodesPendingRemoval.clear();
this.inTransaction = false;
}
}
releaseRow(row) {
const { domNode, templateId } = row;
if (domNode) {
if (this.inTransaction) {
this.transactionNodesPendingRemoval.add(domNode);
} else {
this.doRemoveNode(domNode);
}
}
const cache = this.getTemplateCache(templateId);
cache.push(row);
}
doRemoveNode(domNode) {
domNode.classList.remove("scrolling");
removeFromParent(domNode);
}
getTemplateCache(templateId) {
let result = this.cache.get(templateId);
if (!result) {
result = [];
this.cache.set(templateId, result);
}
return result;
}
dispose() {
this.cache.forEach((cachedRows, templateId) => {
for (const cachedRow of cachedRows) {
const renderer = this.getRenderer(templateId);
renderer.disposeTemplate(cachedRow.templateData);
cachedRow.templateData = null;
}
});
this.cache.clear();
this.transactionNodesPendingRemoval.clear();
}
getRenderer(templateId) {
const renderer = this.renderers.get(templateId);
if (!renderer) {
throw new Error(`No renderer found for ${templateId}`);
}
return renderer;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js
function equalsDragFeedback(f1, f22) {
if (Array.isArray(f1) && Array.isArray(f22)) {
return equals(f1, f22);
}
return f1 === f22;
}
var __decorate26, StaticDND, DefaultOptions, ElementsDragAndDropData, ExternalElementsDragAndDropData, NativeDragAndDropData, ListViewAccessibilityProvider, ListView;
var init_listView = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js"() {
init_dnd();
init_dom();
init_event2();
init_touch();
init_scrollableElement();
init_arrays();
init_async();
init_decorators();
init_event();
init_lifecycle();
init_range2();
init_scrollable();
init_rangeMap();
init_rowCache();
init_errors();
init_numbers();
__decorate26 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
StaticDND = {
CurrentDragAndDropData: void 0
};
DefaultOptions = {
useShadows: true,
verticalScrollMode: 1,
setRowLineHeight: true,
setRowHeight: true,
supportDynamicHeights: false,
dnd: {
getDragElements(e) {
return [e];
},
getDragURI() {
return null;
},
onDragStart() {
},
onDragOver() {
return false;
},
drop() {
},
dispose() {
}
},
horizontalScrolling: false,
transformOptimization: true,
alwaysConsumeMouseWheel: true
};
ElementsDragAndDropData = class {
constructor(elements) {
this.elements = elements;
}
update() {
}
getData() {
return this.elements;
}
};
ExternalElementsDragAndDropData = class {
constructor(elements) {
this.elements = elements;
}
update() {
}
getData() {
return this.elements;
}
};
NativeDragAndDropData = class {
constructor() {
this.types = [];
this.files = [];
}
update(dataTransfer) {
if (dataTransfer.types) {
this.types.splice(0, this.types.length, ...dataTransfer.types);
}
if (dataTransfer.files) {
this.files.splice(0, this.files.length);
for (let i = 0; i < dataTransfer.files.length; i++) {
const file = dataTransfer.files.item(i);
if (file && (file.size || file.type)) {
this.files.push(file);
}
}
}
}
getData() {
return {
types: this.types,
files: this.files
};
}
};
ListViewAccessibilityProvider = class {
constructor(accessibilityProvider) {
if (accessibilityProvider === null || accessibilityProvider === void 0 ? void 0 : accessibilityProvider.getSetSize) {
this.getSetSize = accessibilityProvider.getSetSize.bind(accessibilityProvider);
} else {
this.getSetSize = (e, i, l) => l;
}
if (accessibilityProvider === null || accessibilityProvider === void 0 ? void 0 : accessibilityProvider.getPosInSet) {
this.getPosInSet = accessibilityProvider.getPosInSet.bind(accessibilityProvider);
} else {
this.getPosInSet = (e, i) => i + 1;
}
if (accessibilityProvider === null || accessibilityProvider === void 0 ? void 0 : accessibilityProvider.getRole) {
this.getRole = accessibilityProvider.getRole.bind(accessibilityProvider);
} else {
this.getRole = (_) => "listitem";
}
if (accessibilityProvider === null || accessibilityProvider === void 0 ? void 0 : accessibilityProvider.isChecked) {
this.isChecked = accessibilityProvider.isChecked.bind(accessibilityProvider);
} else {
this.isChecked = (_) => void 0;
}
}
};
ListView = class _ListView {
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(value) {
if (value === this._horizontalScrolling) {
return;
}
if (value && this.supportDynamicHeights) {
throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");
}
this._horizontalScrolling = value;
this.domNode.classList.toggle("horizontal-scrolling", this._horizontalScrolling);
if (this._horizontalScrolling) {
for (const item of this.items) {
this.measureItemWidth(item);
}
this.updateScrollWidth();
this.scrollableElement.setScrollDimensions({ width: getContentWidth(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(container, virtualDelegate, renderers, options2 = DefaultOptions) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2, _j, _k, _l, _m, _o;
this.virtualDelegate = virtualDelegate;
this.domId = `list_id_${++_ListView.InstanceCount}`;
this.renderers = /* @__PURE__ */ new Map();
this.renderWidth = 0;
this._scrollHeight = 0;
this.scrollableElementUpdateDisposable = null;
this.scrollableElementWidthDelayer = new Delayer(50);
this.splicing = false;
this.dragOverAnimationStopDisposable = Disposable.None;
this.dragOverMouseY = 0;
this.canDrop = false;
this.currentDragFeedbackDisposable = Disposable.None;
this.onDragLeaveTimeout = Disposable.None;
this.disposables = new DisposableStore();
this._onDidChangeContentHeight = new Emitter();
this._onDidChangeContentWidth = new Emitter();
this.onDidChangeContentHeight = Event.latch(this._onDidChangeContentHeight.event, void 0, this.disposables);
this._horizontalScrolling = false;
if (options2.horizontalScrolling && options2.supportDynamicHeights) {
throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");
}
this.items = [];
this.itemId = 0;
this.rangeMap = this.createRangeMap((_a10 = options2.paddingTop) !== null && _a10 !== void 0 ? _a10 : 0);
for (const renderer of renderers) {
this.renderers.set(renderer.templateId, renderer);
}
this.cache = this.disposables.add(new RowCache(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 options2.mouseSupport === "boolean" ? options2.mouseSupport : true);
this._horizontalScrolling = (_b4 = options2.horizontalScrolling) !== null && _b4 !== void 0 ? _b4 : DefaultOptions.horizontalScrolling;
this.domNode.classList.toggle("horizontal-scrolling", this._horizontalScrolling);
this.paddingBottom = typeof options2.paddingBottom === "undefined" ? 0 : options2.paddingBottom;
this.accessibilityProvider = new ListViewAccessibilityProvider(options2.accessibilityProvider);
this.rowsContainer = document.createElement("div");
this.rowsContainer.className = "monaco-list-rows";
const transformOptimization = (_c2 = options2.transformOptimization) !== null && _c2 !== void 0 ? _c2 : DefaultOptions.transformOptimization;
if (transformOptimization) {
this.rowsContainer.style.transform = "translate3d(0px, 0px, 0px)";
this.rowsContainer.style.overflow = "hidden";
this.rowsContainer.style.contain = "strict";
}
this.disposables.add(Gesture.addTarget(this.rowsContainer));
this.scrollable = this.disposables.add(new Scrollable({
forceIntegerValues: true,
smoothScrollDuration: ((_d2 = options2.smoothScrolling) !== null && _d2 !== void 0 ? _d2 : false) ? 125 : 0,
scheduleAtNextAnimationFrame: (cb) => scheduleAtNextAnimationFrame(getWindow(this.domNode), cb)
}));
this.scrollableElement = this.disposables.add(new SmoothScrollableElement(this.rowsContainer, {
alwaysConsumeMouseWheel: (_e2 = options2.alwaysConsumeMouseWheel) !== null && _e2 !== void 0 ? _e2 : DefaultOptions.alwaysConsumeMouseWheel,
horizontal: 1,
vertical: (_f3 = options2.verticalScrollMode) !== null && _f3 !== void 0 ? _f3 : DefaultOptions.verticalScrollMode,
useShadows: (_g2 = options2.useShadows) !== null && _g2 !== void 0 ? _g2 : DefaultOptions.useShadows,
mouseWheelScrollSensitivity: options2.mouseWheelScrollSensitivity,
fastScrollSensitivity: options2.fastScrollSensitivity,
scrollByPage: options2.scrollByPage
}, this.scrollable));
this.domNode.appendChild(this.scrollableElement.getDomNode());
container.appendChild(this.domNode);
this.scrollableElement.onScroll(this.onScroll, this, this.disposables);
this.disposables.add(addDisposableListener(this.rowsContainer, EventType2.Change, (e) => this.onTouchChange(e)));
this.disposables.add(addDisposableListener(this.scrollableElement.getDomNode(), "scroll", (e) => e.target.scrollTop = 0));
this.disposables.add(addDisposableListener(this.domNode, "dragover", (e) => this.onDragOver(this.toDragEvent(e))));
this.disposables.add(addDisposableListener(this.domNode, "drop", (e) => this.onDrop(this.toDragEvent(e))));
this.disposables.add(addDisposableListener(this.domNode, "dragleave", (e) => this.onDragLeave(this.toDragEvent(e))));
this.disposables.add(addDisposableListener(this.domNode, "dragend", (e) => this.onDragEnd(e)));
this.setRowLineHeight = (_h2 = options2.setRowLineHeight) !== null && _h2 !== void 0 ? _h2 : DefaultOptions.setRowLineHeight;
this.setRowHeight = (_j = options2.setRowHeight) !== null && _j !== void 0 ? _j : DefaultOptions.setRowHeight;
this.supportDynamicHeights = (_k = options2.supportDynamicHeights) !== null && _k !== void 0 ? _k : DefaultOptions.supportDynamicHeights;
this.dnd = (_l = options2.dnd) !== null && _l !== void 0 ? _l : this.disposables.add(DefaultOptions.dnd);
this.layout((_m = options2.initialSize) === null || _m === void 0 ? void 0 : _m.height, (_o = options2.initialSize) === null || _o === void 0 ? void 0 : _o.width);
}
updateOptions(options2) {
if (options2.paddingBottom !== void 0) {
this.paddingBottom = options2.paddingBottom;
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
}
if (options2.smoothScrolling !== void 0) {
this.scrollable.setSmoothScrollDuration(options2.smoothScrolling ? 125 : 0);
}
if (options2.horizontalScrolling !== void 0) {
this.horizontalScrolling = options2.horizontalScrolling;
}
let scrollableOptions;
if (options2.scrollByPage !== void 0) {
scrollableOptions = __spreadProps(__spreadValues({}, scrollableOptions !== null && scrollableOptions !== void 0 ? scrollableOptions : {}), { scrollByPage: options2.scrollByPage });
}
if (options2.mouseWheelScrollSensitivity !== void 0) {
scrollableOptions = __spreadProps(__spreadValues({}, scrollableOptions !== null && scrollableOptions !== void 0 ? scrollableOptions : {}), { mouseWheelScrollSensitivity: options2.mouseWheelScrollSensitivity });
}
if (options2.fastScrollSensitivity !== void 0) {
scrollableOptions = __spreadProps(__spreadValues({}, scrollableOptions !== null && scrollableOptions !== void 0 ? scrollableOptions : {}), { fastScrollSensitivity: options2.fastScrollSensitivity });
}
if (scrollableOptions) {
this.scrollableElement.updateOptions(scrollableOptions);
}
if (options2.paddingTop !== void 0 && options2.paddingTop !== this.rangeMap.paddingTop) {
const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
const offset = options2.paddingTop - this.rangeMap.paddingTop;
this.rangeMap.paddingTop = options2.paddingTop;
this.render(lastRenderRange, Math.max(0, this.lastRenderTop + offset), this.lastRenderHeight, void 0, void 0, true);
this.setScrollTop(this.lastRenderTop);
this.eventuallyUpdateScrollDimensions();
if (this.supportDynamicHeights) {
this._rerender(this.lastRenderTop, this.lastRenderHeight);
}
}
}
createRangeMap(paddingTop) {
return new RangeMap(paddingTop);
}
splice(start, deleteCount, elements = []) {
if (this.splicing) {
throw new Error("Can't run recursive splices.");
}
this.splicing = true;
try {
return this._splice(start, deleteCount, elements);
} finally {
this.splicing = false;
this._onDidChangeContentHeight.fire(this.contentHeight);
}
}
_splice(start, deleteCount, elements = []) {
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
const deleteRange = { start, end: start + deleteCount };
const removeRange = Range2.intersect(previousRenderRange, deleteRange);
const rowsToDispose = /* @__PURE__ */ new Map();
for (let i = removeRange.end - 1; i >= removeRange.start; i--) {
const item = this.items[i];
item.dragStartDisposable.dispose();
item.checkedDisposable.dispose();
if (item.row) {
let rows = rowsToDispose.get(item.templateId);
if (!rows) {
rows = [];
rowsToDispose.set(item.templateId, rows);
}
const renderer = this.renderers.get(item.templateId);
if (renderer && renderer.disposeElement) {
renderer.disposeElement(item.element, i, item.row.templateData, item.size);
}
rows.unshift(item.row);
}
item.row = null;
item.stale = true;
}
const previousRestRange = { start: start + deleteCount, end: this.items.length };
const previousRenderedRestRange = Range2.intersect(previousRestRange, previousRenderRange);
const previousUnrenderedRestRanges = Range2.relativeComplement(previousRestRange, previousRenderRange);
const inserted = elements.map((element) => ({
id: String(this.itemId++),
element,
templateId: this.virtualDelegate.getTemplateId(element),
size: this.virtualDelegate.getHeight(element),
width: void 0,
hasDynamicHeight: !!this.virtualDelegate.hasDynamicHeight && this.virtualDelegate.hasDynamicHeight(element),
lastDynamicHeightWidth: void 0,
row: null,
uri: void 0,
dropTarget: false,
dragStartDisposable: Disposable.None,
checkedDisposable: Disposable.None,
stale: false
}));
let deleted;
if (start === 0 && deleteCount >= this.items.length) {
this.rangeMap = this.createRangeMap(this.rangeMap.paddingTop);
this.rangeMap.splice(0, 0, inserted);
deleted = this.items;
this.items = inserted;
} else {
this.rangeMap.splice(start, deleteCount, inserted);
deleted = this.items.splice(start, deleteCount, ...inserted);
}
const delta = elements.length - deleteCount;
const renderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
const renderedRestRange = shift(previousRenderedRestRange, delta);
const updateRange = Range2.intersect(renderRange, renderedRestRange);
for (let i = updateRange.start; i < updateRange.end; i++) {
this.updateItemInDOM(this.items[i], i);
}
const removeRanges = Range2.relativeComplement(renderedRestRange, renderRange);
for (const range2 of removeRanges) {
for (let i = range2.start; i < range2.end; i++) {
this.removeItemFromDOM(i);
}
}
const unrenderedRestRanges = previousUnrenderedRestRanges.map((r) => shift(r, delta));
const elementsRange = { start, end: start + elements.length };
const insertRanges = [elementsRange, ...unrenderedRestRanges].map((r) => Range2.intersect(renderRange, r)).reverse();
for (const range2 of insertRanges) {
for (let i = range2.end - 1; i >= range2.start; i--) {
const item = this.items[i];
const rows = rowsToDispose.get(item.templateId);
const row = rows === null || rows === void 0 ? void 0 : rows.pop();
this.insertItemInDOM(i, row);
}
}
for (const rows of rowsToDispose.values()) {
for (const row of rows) {
this.cache.release(row);
}
}
this.eventuallyUpdateScrollDimensions();
if (this.supportDynamicHeights) {
this._rerender(this.scrollTop, this.renderHeight);
}
return deleted.map((i) => i.element);
}
eventuallyUpdateScrollDimensions() {
this._scrollHeight = this.contentHeight;
this.rowsContainer.style.height = `${this._scrollHeight}px`;
if (!this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable = scheduleAtNextAnimationFrame(getWindow(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 scrollWidth = 0;
for (const item of this.items) {
if (typeof item.width !== "undefined") {
scrollWidth = Math.max(scrollWidth, item.width);
}
}
this.scrollWidth = scrollWidth;
this.scrollableElement.setScrollDimensions({ scrollWidth: scrollWidth === 0 ? 0 : scrollWidth + 10 });
this._onDidChangeContentWidth.fire(this.scrollWidth);
}
rerender() {
if (!this.supportDynamicHeights) {
return;
}
for (const item of this.items) {
item.lastDynamicHeightWidth = void 0;
}
this._rerender(this.lastRenderTop, this.lastRenderHeight);
}
get length() {
return this.items.length;
}
get renderHeight() {
const scrollDimensions = this.scrollableElement.getScrollDimensions();
return scrollDimensions.height;
}
get firstVisibleIndex() {
const range2 = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
return range2.start;
}
element(index) {
return this.items[index].element;
}
indexOf(element) {
return this.items.findIndex((item) => item.element === element);
}
domElement(index) {
const row = this.items[index].row;
return row && row.domNode;
}
elementHeight(index) {
return this.items[index].size;
}
elementTop(index) {
return this.rangeMap.positionAt(index);
}
indexAt(position) {
return this.rangeMap.indexAt(position);
}
indexAfter(position) {
return this.rangeMap.indexAfter(position);
}
layout(height, width2) {
const scrollDimensions = {
height: typeof height === "number" ? height : getContentHeight(this.domNode)
};
if (this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable.dispose();
this.scrollableElementUpdateDisposable = null;
scrollDimensions.scrollHeight = this.scrollHeight;
}
this.scrollableElement.setScrollDimensions(scrollDimensions);
if (typeof width2 !== "undefined") {
this.renderWidth = width2;
if (this.supportDynamicHeights) {
this._rerender(this.scrollTop, this.renderHeight);
}
}
if (this.horizontalScrolling) {
this.scrollableElement.setScrollDimensions({
width: typeof width2 === "number" ? width2 : getContentWidth(this.domNode)
});
}
}
// Render
render(previousRenderRange, renderTop, renderHeight, renderLeft, scrollWidth, updateItemsInDOM = false) {
const renderRange = this.getRenderRange(renderTop, renderHeight);
const rangesToInsert = Range2.relativeComplement(renderRange, previousRenderRange).reverse();
const rangesToRemove = Range2.relativeComplement(previousRenderRange, renderRange);
if (updateItemsInDOM) {
const rangesToUpdate = Range2.intersect(previousRenderRange, renderRange);
for (let i = rangesToUpdate.start; i < rangesToUpdate.end; i++) {
this.updateItemInDOM(this.items[i], i);
}
}
this.cache.transact(() => {
for (const range2 of rangesToRemove) {
for (let i = range2.start; i < range2.end; i++) {
this.removeItemFromDOM(i);
}
}
for (const range2 of rangesToInsert) {
for (let i = range2.end - 1; i >= range2.start; i--) {
this.insertItemInDOM(i);
}
}
});
if (renderLeft !== void 0) {
this.rowsContainer.style.left = `-${renderLeft}px`;
}
this.rowsContainer.style.top = `-${renderTop}px`;
if (this.horizontalScrolling && scrollWidth !== void 0) {
this.rowsContainer.style.width = `${Math.max(scrollWidth, this.renderWidth)}px`;
}
this.lastRenderTop = renderTop;
this.lastRenderHeight = renderHeight;
}
// DOM operations
insertItemInDOM(index, row) {
var _a10, _b4, _c2;
const item = this.items[index];
if (!item.row) {
if (row) {
item.row = row;
item.stale = true;
} else {
const result = this.cache.alloc(item.templateId);
item.row = result.row;
item.stale || (item.stale = result.isReusingConnectedDomNode);
}
}
const role = this.accessibilityProvider.getRole(item.element) || "listitem";
item.row.domNode.setAttribute("role", role);
const checked = this.accessibilityProvider.isChecked(item.element);
if (typeof checked === "boolean") {
item.row.domNode.setAttribute("aria-checked", String(!!checked));
} else if (checked) {
const update = (checked2) => item.row.domNode.setAttribute("aria-checked", String(!!checked2));
update(checked.value);
item.checkedDisposable = checked.onDidChange(() => update(checked.value));
}
if (item.stale || !item.row.domNode.parentElement) {
const referenceNode = (_c2 = (_b4 = (_a10 = this.items.at(index + 1)) === null || _a10 === void 0 ? void 0 : _a10.row) === null || _b4 === void 0 ? void 0 : _b4.domNode) !== null && _c2 !== void 0 ? _c2 : null;
if (item.row.domNode.parentElement !== this.rowsContainer || item.row.domNode.nextElementSibling !== referenceNode) {
this.rowsContainer.insertBefore(item.row.domNode, referenceNode);
}
item.stale = false;
}
this.updateItemInDOM(item, index);
const renderer = this.renderers.get(item.templateId);
if (!renderer) {
throw new Error(`No renderer found for template id ${item.templateId}`);
}
renderer === null || renderer === void 0 ? void 0 : renderer.renderElement(item.element, index, item.row.templateData, item.size);
const uri = this.dnd.getDragURI(item.element);
item.dragStartDisposable.dispose();
item.row.domNode.draggable = !!uri;
if (uri) {
item.dragStartDisposable = addDisposableListener(item.row.domNode, "dragstart", (event) => this.onDragStart(item.element, uri, event));
}
if (this.horizontalScrolling) {
this.measureItemWidth(item);
this.eventuallyUpdateScrollWidth();
}
}
measureItemWidth(item) {
if (!item.row || !item.row.domNode) {
return;
}
item.row.domNode.style.width = "fit-content";
item.width = getContentWidth(item.row.domNode);
const style = getWindow(item.row.domNode).getComputedStyle(item.row.domNode);
if (style.paddingLeft) {
item.width += parseFloat(style.paddingLeft);
}
if (style.paddingRight) {
item.width += parseFloat(style.paddingRight);
}
item.row.domNode.style.width = "";
}
updateItemInDOM(item, index) {
item.row.domNode.style.top = `${this.elementTop(index)}px`;
if (this.setRowHeight) {
item.row.domNode.style.height = `${item.size}px`;
}
if (this.setRowLineHeight) {
item.row.domNode.style.lineHeight = `${item.size}px`;
}
item.row.domNode.setAttribute("data-index", `${index}`);
item.row.domNode.setAttribute("data-last-element", index === this.length - 1 ? "true" : "false");
item.row.domNode.setAttribute("data-parity", index % 2 === 0 ? "even" : "odd");
item.row.domNode.setAttribute("aria-setsize", String(this.accessibilityProvider.getSetSize(item.element, index, this.length)));
item.row.domNode.setAttribute("aria-posinset", String(this.accessibilityProvider.getPosInSet(item.element, index)));
item.row.domNode.setAttribute("id", this.getElementDomId(index));
item.row.domNode.classList.toggle("drop-target", item.dropTarget);
}
removeItemFromDOM(index) {
const item = this.items[index];
item.dragStartDisposable.dispose();
item.checkedDisposable.dispose();
if (item.row) {
const renderer = this.renderers.get(item.templateId);
if (renderer && renderer.disposeElement) {
renderer.disposeElement(item.element, index, item.row.templateData, item.size);
}
this.cache.release(item.row);
item.row = null;
}
if (this.horizontalScrolling) {
this.eventuallyUpdateScrollWidth();
}
}
getScrollTop() {
const scrollPosition = this.scrollableElement.getScrollPosition();
return scrollPosition.scrollTop;
}
setScrollTop(scrollTop, reuseAnimation) {
if (this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable.dispose();
this.scrollableElementUpdateDisposable = null;
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
}
this.scrollableElement.setScrollPosition({ scrollTop, reuseAnimation });
}
get scrollTop() {
return this.getScrollTop();
}
set scrollTop(scrollTop) {
this.setScrollTop(scrollTop);
}
get scrollHeight() {
return this._scrollHeight + (this.horizontalScrolling ? 10 : 0) + this.paddingBottom;
}
// Events
get onMouseClick() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "click")).event, (e) => this.toMouseEvent(e), this.disposables);
}
get onMouseDblClick() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "dblclick")).event, (e) => this.toMouseEvent(e), this.disposables);
}
get onMouseMiddleClick() {
return Event.filter(Event.map(this.disposables.add(new DomEmitter(this.domNode, "auxclick")).event, (e) => this.toMouseEvent(e), this.disposables), (e) => e.browserEvent.button === 1, this.disposables);
}
get onMouseDown() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "mousedown")).event, (e) => this.toMouseEvent(e), this.disposables);
}
get onMouseOver() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "mouseover")).event, (e) => this.toMouseEvent(e), this.disposables);
}
get onMouseOut() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "mouseout")).event, (e) => this.toMouseEvent(e), this.disposables);
}
get onContextMenu() {
return Event.any(Event.map(this.disposables.add(new DomEmitter(this.domNode, "contextmenu")).event, (e) => this.toMouseEvent(e), this.disposables), Event.map(this.disposables.add(new DomEmitter(this.domNode, EventType2.Contextmenu)).event, (e) => this.toGestureEvent(e), this.disposables));
}
get onTouchStart() {
return Event.map(this.disposables.add(new DomEmitter(this.domNode, "touchstart")).event, (e) => this.toTouchEvent(e), this.disposables);
}
get onTap() {
return Event.map(this.disposables.add(new DomEmitter(this.rowsContainer, EventType2.Tap)).event, (e) => this.toGestureEvent(e), this.disposables);
}
toMouseEvent(browserEvent) {
const index = this.getItemIndexFromEventTarget(browserEvent.target || null);
const item = typeof index === "undefined" ? void 0 : this.items[index];
const element = item && item.element;
return { browserEvent, index, element };
}
toTouchEvent(browserEvent) {
const index = this.getItemIndexFromEventTarget(browserEvent.target || null);
const item = typeof index === "undefined" ? void 0 : this.items[index];
const element = item && item.element;
return { browserEvent, index, element };
}
toGestureEvent(browserEvent) {
const index = this.getItemIndexFromEventTarget(browserEvent.initialTarget || null);
const item = typeof index === "undefined" ? void 0 : this.items[index];
const element = item && item.element;
return { browserEvent, index, element };
}
toDragEvent(browserEvent) {
const index = this.getItemIndexFromEventTarget(browserEvent.target || null);
const item = typeof index === "undefined" ? void 0 : this.items[index];
const element = item && item.element;
const sector = this.getTargetSector(browserEvent, index);
return { browserEvent, index, element, sector };
}
onScroll(e) {
try {
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
if (this.supportDynamicHeights) {
this._rerender(e.scrollTop, e.height, e.inSmoothScrolling);
}
} catch (err) {
console.error("Got bad scroll event:", e);
throw err;
}
}
onTouchChange(event) {
event.preventDefault();
event.stopPropagation();
this.scrollTop -= event.translationY;
}
// DND
onDragStart(element, uri, event) {
var _a10, _b4;
if (!event.dataTransfer) {
return;
}
const elements = this.dnd.getDragElements(element);
event.dataTransfer.effectAllowed = "copyMove";
event.dataTransfer.setData(DataTransfers.TEXT, uri);
if (event.dataTransfer.setDragImage) {
let label;
if (this.dnd.getDragLabel) {
label = this.dnd.getDragLabel(elements, event);
}
if (typeof label === "undefined") {
label = String(elements.length);
}
const dragImage = $(".monaco-drag-image");
dragImage.textContent = label;
const getDragImageContainer = (e) => {
while (e && !e.classList.contains("monaco-workbench")) {
e = e.parentElement;
}
return e || this.domNode.ownerDocument;
};
const container = getDragImageContainer(this.domNode);
container.appendChild(dragImage);
event.dataTransfer.setDragImage(dragImage, -10, -10);
setTimeout(() => container.removeChild(dragImage), 0);
}
this.domNode.classList.add("dragging");
this.currentDragData = new ElementsDragAndDropData(elements);
StaticDND.CurrentDragAndDropData = new ExternalElementsDragAndDropData(elements);
(_b4 = (_a10 = this.dnd).onDragStart) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this.currentDragData, event);
}
onDragOver(event) {
var _a10, _b4;
event.browserEvent.preventDefault();
this.onDragLeaveTimeout.dispose();
if (StaticDND.CurrentDragAndDropData && StaticDND.CurrentDragAndDropData.getData() === "vscode-ui") {
return false;
}
this.setupDragAndDropScrollTopAnimation(event.browserEvent);
if (!event.browserEvent.dataTransfer) {
return false;
}
if (!this.currentDragData) {
if (StaticDND.CurrentDragAndDropData) {
this.currentDragData = StaticDND.CurrentDragAndDropData;
} else {
if (!event.browserEvent.dataTransfer.types) {
return false;
}
this.currentDragData = new NativeDragAndDropData();
}
}
const result = this.dnd.onDragOver(this.currentDragData, event.element, event.index, event.sector, event.browserEvent);
this.canDrop = typeof result === "boolean" ? result : result.accept;
if (!this.canDrop) {
this.currentDragFeedback = void 0;
this.currentDragFeedbackDisposable.dispose();
return false;
}
event.browserEvent.dataTransfer.dropEffect = typeof result !== "boolean" && ((_a10 = result.effect) === null || _a10 === void 0 ? void 0 : _a10.type) === 0 ? "copy" : "move";
let feedback;
if (typeof result !== "boolean" && result.feedback) {
feedback = result.feedback;
} else {
if (typeof event.index === "undefined") {
feedback = [-1];
} else {
feedback = [event.index];
}
}
feedback = distinct(feedback).filter((i) => i >= -1 && i < this.length).sort((a3, b) => a3 - b);
feedback = feedback[0] === -1 ? [-1] : feedback;
let dragOverEffectPosition = typeof result !== "boolean" && result.effect && result.effect.position ? result.effect.position : "drop-target";
if (equalsDragFeedback(this.currentDragFeedback, feedback) && this.currentDragFeedbackPosition === dragOverEffectPosition) {
return true;
}
this.currentDragFeedback = feedback;
this.currentDragFeedbackPosition = dragOverEffectPosition;
this.currentDragFeedbackDisposable.dispose();
if (feedback[0] === -1) {
this.domNode.classList.add(dragOverEffectPosition);
this.rowsContainer.classList.add(dragOverEffectPosition);
this.currentDragFeedbackDisposable = toDisposable(() => {
this.domNode.classList.remove(dragOverEffectPosition);
this.rowsContainer.classList.remove(dragOverEffectPosition);
});
} else {
if (feedback.length > 1 && dragOverEffectPosition !== "drop-target") {
throw new Error("Can't use multiple feedbacks with position different than 'over'");
}
if (dragOverEffectPosition === "drop-target-after") {
if (feedback[0] < this.length - 1) {
feedback[0] += 1;
dragOverEffectPosition = "drop-target-before";
}
}
for (const index of feedback) {
const item = this.items[index];
item.dropTarget = true;
(_b4 = item.row) === null || _b4 === void 0 ? void 0 : _b4.domNode.classList.add(dragOverEffectPosition);
}
this.currentDragFeedbackDisposable = toDisposable(() => {
var _a11;
for (const index of feedback) {
const item = this.items[index];
item.dropTarget = false;
(_a11 = item.row) === null || _a11 === void 0 ? void 0 : _a11.domNode.classList.remove(dragOverEffectPosition);
}
});
}
return true;
}
onDragLeave(event) {
var _a10, _b4;
this.onDragLeaveTimeout.dispose();
this.onDragLeaveTimeout = disposableTimeout(() => this.clearDragOverFeedback(), 100, this.disposables);
if (this.currentDragData) {
(_b4 = (_a10 = this.dnd).onDragLeave) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this.currentDragData, event.element, event.index, event.browserEvent);
}
}
onDrop(event) {
if (!this.canDrop) {
return;
}
const dragData = this.currentDragData;
this.teardownDragAndDropScrollTopAnimation();
this.clearDragOverFeedback();
this.domNode.classList.remove("dragging");
this.currentDragData = void 0;
StaticDND.CurrentDragAndDropData = void 0;
if (!dragData || !event.browserEvent.dataTransfer) {
return;
}
event.browserEvent.preventDefault();
dragData.update(event.browserEvent.dataTransfer);
this.dnd.drop(dragData, event.element, event.index, event.sector, event.browserEvent);
}
onDragEnd(event) {
var _a10, _b4;
this.canDrop = false;
this.teardownDragAndDropScrollTopAnimation();
this.clearDragOverFeedback();
this.domNode.classList.remove("dragging");
this.currentDragData = void 0;
StaticDND.CurrentDragAndDropData = void 0;
(_b4 = (_a10 = this.dnd).onDragEnd) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, event);
}
clearDragOverFeedback() {
this.currentDragFeedback = void 0;
this.currentDragFeedbackPosition = void 0;
this.currentDragFeedbackDisposable.dispose();
this.currentDragFeedbackDisposable = Disposable.None;
}
// DND scroll top animation
setupDragAndDropScrollTopAnimation(event) {
if (!this.dragOverAnimationDisposable) {
const viewTop = getTopLeftOffset(this.domNode).top;
this.dragOverAnimationDisposable = animate(getWindow(this.domNode), this.animateDragAndDropScrollTop.bind(this, viewTop));
}
this.dragOverAnimationStopDisposable.dispose();
this.dragOverAnimationStopDisposable = disposableTimeout(() => {
if (this.dragOverAnimationDisposable) {
this.dragOverAnimationDisposable.dispose();
this.dragOverAnimationDisposable = void 0;
}
}, 1e3, this.disposables);
this.dragOverMouseY = event.pageY;
}
animateDragAndDropScrollTop(viewTop) {
if (this.dragOverMouseY === void 0) {
return;
}
const diff = this.dragOverMouseY - viewTop;
const upperLimit = this.renderHeight - 35;
if (diff < 35) {
this.scrollTop += Math.max(-14, Math.floor(0.3 * (diff - 35)));
} else if (diff > upperLimit) {
this.scrollTop += Math.min(14, Math.floor(0.3 * (diff - upperLimit)));
}
}
teardownDragAndDropScrollTopAnimation() {
this.dragOverAnimationStopDisposable.dispose();
if (this.dragOverAnimationDisposable) {
this.dragOverAnimationDisposable.dispose();
this.dragOverAnimationDisposable = void 0;
}
}
// Util
getTargetSector(browserEvent, targetIndex) {
if (targetIndex === void 0) {
return void 0;
}
const relativePosition = browserEvent.offsetY / this.items[targetIndex].size;
const sector = Math.floor(relativePosition / 0.25);
return clamp(sector, 0, 3);
}
getItemIndexFromEventTarget(target) {
const scrollableElement = this.scrollableElement.getDomNode();
let element = target;
while (isHTMLElement(element) && element !== this.rowsContainer && scrollableElement.contains(element)) {
const rawIndex = element.getAttribute("data-index");
if (rawIndex) {
const index = Number(rawIndex);
if (!isNaN(index)) {
return index;
}
}
element = element.parentElement;
}
return void 0;
}
getRenderRange(renderTop, renderHeight) {
return {
start: this.rangeMap.indexAt(renderTop),
end: this.rangeMap.indexAfter(renderTop + renderHeight - 1)
};
}
/**
* Given a stable rendered state, checks every rendered element whether it needs
* to be probed for dynamic height. Adjusts scroll height and top if necessary.
*/
_rerender(renderTop, renderHeight, inSmoothScrolling) {
const previousRenderRange = this.getRenderRange(renderTop, renderHeight);
let anchorElementIndex;
let anchorElementTopDelta;
if (renderTop === this.elementTop(previousRenderRange.start)) {
anchorElementIndex = previousRenderRange.start;
anchorElementTopDelta = 0;
} else if (previousRenderRange.end - previousRenderRange.start > 1) {
anchorElementIndex = previousRenderRange.start + 1;
anchorElementTopDelta = this.elementTop(anchorElementIndex) - renderTop;
}
let heightDiff2 = 0;
while (true) {
const renderRange = this.getRenderRange(renderTop, renderHeight);
let didChange = false;
for (let i = renderRange.start; i < renderRange.end; i++) {
const diff = this.probeDynamicHeight(i);
if (diff !== 0) {
this.rangeMap.splice(i, 1, [this.items[i]]);
}
heightDiff2 += diff;
didChange = didChange || diff !== 0;
}
if (!didChange) {
if (heightDiff2 !== 0) {
this.eventuallyUpdateScrollDimensions();
}
const unrenderRanges = Range2.relativeComplement(previousRenderRange, renderRange);
for (const range2 of unrenderRanges) {
for (let i = range2.start; i < range2.end; i++) {
if (this.items[i].row) {
this.removeItemFromDOM(i);
}
}
}
const renderRanges = Range2.relativeComplement(renderRange, previousRenderRange).reverse();
for (const range2 of renderRanges) {
for (let i = range2.end - 1; i >= range2.start; i--) {
this.insertItemInDOM(i);
}
}
for (let i = renderRange.start; i < renderRange.end; i++) {
if (this.items[i].row) {
this.updateItemInDOM(this.items[i], i);
}
}
if (typeof anchorElementIndex === "number") {
const deltaScrollTop = this.scrollable.getFutureScrollPosition().scrollTop - renderTop;
const newScrollTop = this.elementTop(anchorElementIndex) - anchorElementTopDelta + deltaScrollTop;
this.setScrollTop(newScrollTop, inSmoothScrolling);
}
this._onDidChangeContentHeight.fire(this.contentHeight);
return;
}
}
}
probeDynamicHeight(index) {
var _a10, _b4, _c2;
const item = this.items[index];
if (!!this.virtualDelegate.getDynamicHeight) {
const newSize = this.virtualDelegate.getDynamicHeight(item.element);
if (newSize !== null) {
const size3 = item.size;
item.size = newSize;
item.lastDynamicHeightWidth = this.renderWidth;
return newSize - size3;
}
}
if (!item.hasDynamicHeight || item.lastDynamicHeightWidth === this.renderWidth) {
return 0;
}
if (!!this.virtualDelegate.hasDynamicHeight && !this.virtualDelegate.hasDynamicHeight(item.element)) {
return 0;
}
const size2 = item.size;
if (item.row) {
item.row.domNode.style.height = "";
item.size = item.row.domNode.offsetHeight;
if (item.size === 0 && !isAncestor(item.row.domNode, getWindow(item.row.domNode).document.body)) {
console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!");
}
item.lastDynamicHeightWidth = this.renderWidth;
return item.size - size2;
}
const { row } = this.cache.alloc(item.templateId);
row.domNode.style.height = "";
this.rowsContainer.appendChild(row.domNode);
const renderer = this.renderers.get(item.templateId);
if (!renderer) {
throw new BugIndicatingError("Missing renderer for templateId: " + item.templateId);
}
renderer.renderElement(item.element, index, row.templateData, void 0);
item.size = row.domNode.offsetHeight;
(_a10 = renderer.disposeElement) === null || _a10 === void 0 ? void 0 : _a10.call(renderer, item.element, index, row.templateData, void 0);
(_c2 = (_b4 = this.virtualDelegate).setDynamicHeight) === null || _c2 === void 0 ? void 0 : _c2.call(_b4, item.element, item.size);
item.lastDynamicHeightWidth = this.renderWidth;
this.rowsContainer.removeChild(row.domNode);
this.cache.release(row);
return item.size - size2;
}
getElementDomId(index) {
return `${this.domId}_${index}`;
}
// Dispose
dispose() {
var _a10, _b4;
for (const item of this.items) {
item.dragStartDisposable.dispose();
item.checkedDisposable.dispose();
if (item.row) {
const renderer = this.renderers.get(item.row.templateId);
if (renderer) {
(_a10 = renderer.disposeElement) === null || _a10 === void 0 ? void 0 : _a10.call(renderer, item.element, -1, item.row.templateData, void 0);
renderer.disposeTemplate(item.row.templateData);
}
}
}
this.items = [];
if (this.domNode && this.domNode.parentNode) {
this.domNode.parentNode.removeChild(this.domNode);
}
(_b4 = this.dragOverAnimationDisposable) === null || _b4 === void 0 ? void 0 : _b4.dispose();
this.disposables.dispose();
}
};
ListView.InstanceCount = 0;
__decorate26([
memoize
], ListView.prototype, "onMouseClick", null);
__decorate26([
memoize
], ListView.prototype, "onMouseDblClick", null);
__decorate26([
memoize
], ListView.prototype, "onMouseMiddleClick", null);
__decorate26([
memoize
], ListView.prototype, "onMouseDown", null);
__decorate26([
memoize
], ListView.prototype, "onMouseOver", null);
__decorate26([
memoize
], ListView.prototype, "onMouseOut", null);
__decorate26([
memoize
], ListView.prototype, "onContextMenu", null);
__decorate26([
memoize
], ListView.prototype, "onTouchStart", null);
__decorate26([
memoize
], ListView.prototype, "onTap", null);
}
});
// node_modules/monaco-editor/esm/vs/base/common/equals.js
function itemsEquals(itemEquals2 = strictEquals) {
return (a3, b) => equals(a3, b, itemEquals2);
}
function itemEquals() {
return (a3, b) => a3.equals(b);
}
function equalsIfDefined(v1, v2, equals4) {
if (!v1 || !v2) {
return v1 === v2;
}
return equals4(v1, v2);
}
var strictEquals;
var init_equals = __esm({
"node_modules/monaco-editor/esm/vs/base/common/equals.js"() {
init_arrays();
strictEquals = (a3, b) => a3 === b;
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js
function getDebugName(target, data) {
var _a10;
const cached = cachedDebugName.get(target);
if (cached) {
return cached;
}
const dbgName = computeDebugName(target, data);
if (dbgName) {
let count = (_a10 = countPerName.get(dbgName)) !== null && _a10 !== void 0 ? _a10 : 0;
count++;
countPerName.set(dbgName, count);
const result = count === 1 ? dbgName : `${dbgName}#${count}`;
cachedDebugName.set(target, result);
return result;
}
return void 0;
}
function computeDebugName(self2, data) {
const cached = cachedDebugName.get(self2);
if (cached) {
return cached;
}
const ownerStr = data.owner ? formatOwner(data.owner) + `.` : "";
let result;
const debugNameSource = data.debugNameSource;
if (debugNameSource !== void 0) {
if (typeof debugNameSource === "function") {
result = debugNameSource();
if (result !== void 0) {
return ownerStr + result;
}
} else {
return ownerStr + debugNameSource;
}
}
const referenceFn = data.referenceFn;
if (referenceFn !== void 0) {
result = getFunctionName(referenceFn);
if (result !== void 0) {
return ownerStr + result;
}
}
if (data.owner !== void 0) {
const key = findKey(data.owner, self2);
if (key !== void 0) {
return ownerStr + key;
}
}
return void 0;
}
function findKey(obj, value) {
for (const key in obj) {
if (obj[key] === value) {
return key;
}
}
return void 0;
}
function formatOwner(owner) {
var _a10;
const id = ownerId.get(owner);
if (id) {
return id;
}
const className = getClassName(owner);
let count = (_a10 = countPerClassName.get(className)) !== null && _a10 !== void 0 ? _a10 : 0;
count++;
countPerClassName.set(className, count);
const result = count === 1 ? className : `${className}#${count}`;
ownerId.set(owner, result);
return result;
}
function getClassName(obj) {
const ctor = obj.constructor;
if (ctor) {
return ctor.name;
}
return "Object";
}
function getFunctionName(fn) {
const fnSrc = fn.toString();
const regexp = /\/\*\*\s*@description\s*([^*]*)\*\//;
const match2 = regexp.exec(fnSrc);
const result = match2 ? match2[1] : void 0;
return result === null || result === void 0 ? void 0 : result.trim();
}
var DebugNameData, countPerName, cachedDebugName, countPerClassName, ownerId;
var init_debugName = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/debugName.js"() {
DebugNameData = class {
constructor(owner, debugNameSource, referenceFn) {
this.owner = owner;
this.debugNameSource = debugNameSource;
this.referenceFn = referenceFn;
}
getDebugName(target) {
return getDebugName(target, this);
}
};
countPerName = /* @__PURE__ */ new Map();
cachedDebugName = /* @__PURE__ */ new WeakMap();
countPerClassName = /* @__PURE__ */ new Map();
ownerId = /* @__PURE__ */ new WeakMap();
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js
function setLogger(logger) {
globalObservableLogger = logger;
}
function getLogger() {
return globalObservableLogger;
}
function consoleTextToArgs(text2) {
const styles = new Array();
const data = [];
let firstArg = "";
function process2(t4) {
if ("length" in t4) {
for (const item of t4) {
if (item) {
process2(item);
}
}
} else if ("text" in t4) {
firstArg += `%c${t4.text}`;
styles.push(t4.style);
if (t4.data) {
data.push(...t4.data);
}
} else if ("data" in t4) {
data.push(...t4.data);
}
}
process2(text2);
const result = [firstArg, ...styles];
result.push(...data);
return result;
}
function normalText(text2) {
return styled(text2, { color: "black" });
}
function formatKind(kind) {
return styled(padStr(`${kind}: `, 10), { color: "black", bold: true });
}
function styled(text2, options2 = {
color: "black"
}) {
function objToCss(styleObj) {
return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {
return `${styleString}${propName}:${propValue};`;
}, "");
}
const style = {
color: options2.color
};
if (options2.strikeThrough) {
style["text-decoration"] = "line-through";
}
if (options2.bold) {
style["font-weight"] = "bold";
}
return {
text: text2,
style: objToCss(style)
};
}
function formatValue(value, availableLen) {
switch (typeof value) {
case "number":
return "" + value;
case "string":
if (value.length + 2 <= availableLen) {
return `"${value}"`;
}
return `"${value.substr(0, availableLen - 7)}"+...`;
case "boolean":
return value ? "true" : "false";
case "undefined":
return "undefined";
case "object":
if (value === null) {
return "null";
}
if (Array.isArray(value)) {
return formatArray(value, availableLen);
}
return formatObject(value, availableLen);
case "symbol":
return value.toString();
case "function":
return `[[Function${value.name ? " " + value.name : ""}]]`;
default:
return "" + value;
}
}
function formatArray(value, availableLen) {
let result = "[ ";
let first2 = true;
for (const val of value) {
if (!first2) {
result += ", ";
}
if (result.length - 5 > availableLen) {
result += "...";
break;
}
first2 = false;
result += `${formatValue(val, availableLen - result.length)}`;
}
result += " ]";
return result;
}
function formatObject(value, availableLen) {
let result = "{ ";
let first2 = true;
for (const [key, val] of Object.entries(value)) {
if (!first2) {
result += ", ";
}
if (result.length - 5 > availableLen) {
result += "...";
break;
}
first2 = false;
result += `${key}: ${formatValue(val, availableLen - result.length)}`;
}
result += " }";
return result;
}
function repeat(str, count) {
let result = "";
for (let i = 1; i <= count; i++) {
result += str;
}
return result;
}
function padStr(str, length) {
while (str.length < length) {
str += " ";
}
return str;
}
var globalObservableLogger, ConsoleObservableLogger;
var init_logging = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/logging.js"() {
ConsoleObservableLogger = class {
constructor() {
this.indentation = 0;
this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
}
textToConsoleArgs(text2) {
return consoleTextToArgs([
normalText(repeat("| ", this.indentation)),
text2
]);
}
formatInfo(info) {
if (!info.hadValue) {
return [
normalText(` `),
styled(formatValue(info.newValue, 60), {
color: "green"
}),
normalText(` (initial)`)
];
}
return info.didChange ? [
normalText(` `),
styled(formatValue(info.oldValue, 70), {
color: "red",
strikeThrough: true
}),
normalText(` `),
styled(formatValue(info.newValue, 60), {
color: "green"
})
] : [normalText(` (unchanged)`)];
}
handleObservableChanged(observable, info) {
console.log(...this.textToConsoleArgs([
formatKind("observable value changed"),
styled(observable.debugName, { color: "BlueViolet" }),
...this.formatInfo(info)
]));
}
formatChanges(changes) {
if (changes.size === 0) {
return void 0;
}
return styled(" (changed deps: " + [...changes].map((o) => o.debugName).join(", ") + ")", { color: "gray" });
}
handleDerivedCreated(derived2) {
const existingHandleChange = derived2.handleChange;
this.changedObservablesSets.set(derived2, /* @__PURE__ */ new Set());
derived2.handleChange = (observable, change) => {
this.changedObservablesSets.get(derived2).add(observable);
return existingHandleChange.apply(derived2, [observable, change]);
};
}
handleDerivedRecomputed(derived2, info) {
const changedObservables = this.changedObservablesSets.get(derived2);
console.log(...this.textToConsoleArgs([
formatKind("derived recomputed"),
styled(derived2.debugName, { color: "BlueViolet" }),
...this.formatInfo(info),
this.formatChanges(changedObservables),
{ data: [{ fn: derived2._computeFn }] }
]));
changedObservables.clear();
}
handleFromEventObservableTriggered(observable, info) {
console.log(...this.textToConsoleArgs([
formatKind("observable from event triggered"),
styled(observable.debugName, { color: "BlueViolet" }),
...this.formatInfo(info),
{ data: [{ fn: observable._getValue }] }
]));
}
handleAutorunCreated(autorun2) {
const existingHandleChange = autorun2.handleChange;
this.changedObservablesSets.set(autorun2, /* @__PURE__ */ new Set());
autorun2.handleChange = (observable, change) => {
this.changedObservablesSets.get(autorun2).add(observable);
return existingHandleChange.apply(autorun2, [observable, change]);
};
}
handleAutorunTriggered(autorun2) {
const changedObservables = this.changedObservablesSets.get(autorun2);
console.log(...this.textToConsoleArgs([
formatKind("autorun"),
styled(autorun2.debugName, { color: "BlueViolet" }),
this.formatChanges(changedObservables),
{ data: [{ fn: autorun2._runFn }] }
]));
changedObservables.clear();
this.indentation++;
}
handleAutorunFinished(autorun2) {
this.indentation--;
}
handleBeginTransaction(transaction2) {
let transactionName = transaction2.getDebugName();
if (transactionName === void 0) {
transactionName = "";
}
console.log(...this.textToConsoleArgs([
formatKind("transaction"),
styled(transactionName, { color: "BlueViolet" }),
{ data: [{ fn: transaction2._fn }] }
]));
this.indentation++;
}
handleEndTransaction() {
this.indentation--;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js
function _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange2) {
_recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange2;
}
function _setKeepObserved(keepObserved2) {
_keepObserved = keepObserved2;
}
function _setDerivedOpts(derived2) {
_derived = derived2;
}
function transaction(fn, getDebugName2) {
const tx = new TransactionImpl(fn, getDebugName2);
try {
fn(tx);
} finally {
tx.finish();
}
}
function globalTransaction(fn) {
if (_globalTransaction) {
fn(_globalTransaction);
} else {
const tx = new TransactionImpl(fn, void 0);
_globalTransaction = tx;
try {
fn(tx);
} finally {
tx.finish();
_globalTransaction = void 0;
}
}
}
function asyncTransaction(fn, getDebugName2) {
return __async(this, null, function* () {
const tx = new TransactionImpl(fn, getDebugName2);
try {
yield fn(tx);
} finally {
tx.finish();
}
});
}
function subtransaction(tx, fn, getDebugName2) {
if (!tx) {
transaction(fn, getDebugName2);
} else {
fn(tx);
}
}
function observableValue(nameOrOwner, initialValue) {
let debugNameData;
if (typeof nameOrOwner === "string") {
debugNameData = new DebugNameData(void 0, nameOrOwner, void 0);
} else {
debugNameData = new DebugNameData(nameOrOwner, void 0, void 0);
}
return new ObservableValue(debugNameData, initialValue, strictEquals);
}
function observableValueOpts(options2, initialValue) {
var _a10;
return new ObservableValue(new DebugNameData(options2.owner, options2.debugName, void 0), initialValue, (_a10 = options2.equalsFn) !== null && _a10 !== void 0 ? _a10 : strictEquals);
}
function disposableObservableValue(nameOrOwner, initialValue) {
let debugNameData;
if (typeof nameOrOwner === "string") {
debugNameData = new DebugNameData(void 0, nameOrOwner, void 0);
} else {
debugNameData = new DebugNameData(nameOrOwner, void 0, void 0);
}
return new DisposableObservableValue(debugNameData, initialValue, strictEquals);
}
var _recomputeInitiallyAndOnChange, _keepObserved, _derived, ConvenientObservable, BaseObservable, _globalTransaction, TransactionImpl, ObservableValue, DisposableObservableValue;
var init_base = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/base.js"() {
init_equals();
init_debugName();
init_logging();
ConvenientObservable = class {
get TChange() {
return null;
}
reportChanges() {
this.get();
}
/** @sealed */
read(reader) {
if (reader) {
return reader.readObservable(this);
} else {
return this.get();
}
}
map(fnOrOwner, fnOrUndefined) {
const owner = fnOrUndefined === void 0 ? void 0 : fnOrOwner;
const fn = fnOrUndefined === void 0 ? fnOrOwner : fnOrUndefined;
return _derived({
owner,
debugName: () => {
const name = getFunctionName(fn);
if (name !== void 0) {
return name;
}
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*$/;
const match2 = regexp.exec(fn.toString());
if (match2) {
return `${this.debugName}.${match2[2]}`;
}
if (!owner) {
return `${this.debugName} (mapped)`;
}
return void 0;
},
debugReferenceFn: fn
}, (reader) => fn(this.read(reader), reader));
}
recomputeInitiallyAndOnChange(store, handleValue) {
store.add(_recomputeInitiallyAndOnChange(this, handleValue));
return this;
}
};
BaseObservable = class extends ConvenientObservable {
constructor() {
super(...arguments);
this.observers = /* @__PURE__ */ new Set();
}
addObserver(observer) {
const len = this.observers.size;
this.observers.add(observer);
if (len === 0) {
this.onFirstObserverAdded();
}
}
removeObserver(observer) {
const deleted = this.observers.delete(observer);
if (deleted && this.observers.size === 0) {
this.onLastObserverRemoved();
}
}
onFirstObserverAdded() {
}
onLastObserverRemoved() {
}
};
_globalTransaction = void 0;
TransactionImpl = class {
constructor(_fn, _getDebugName) {
var _a10;
this._fn = _fn;
this._getDebugName = _getDebugName;
this.updatingObservers = [];
(_a10 = getLogger()) === null || _a10 === void 0 ? void 0 : _a10.handleBeginTransaction(this);
}
getDebugName() {
if (this._getDebugName) {
return this._getDebugName();
}
return getFunctionName(this._fn);
}
updateObserver(observer, observable) {
this.updatingObservers.push({ observer, observable });
observer.beginUpdate(observable);
}
finish() {
var _a10;
const updatingObservers = this.updatingObservers;
for (let i = 0; i < updatingObservers.length; i++) {
const { observer, observable } = updatingObservers[i];
observer.endUpdate(observable);
}
this.updatingObservers = null;
(_a10 = getLogger()) === null || _a10 === void 0 ? void 0 : _a10.handleEndTransaction();
}
};
ObservableValue = class extends BaseObservable {
get debugName() {
var _a10;
return (_a10 = this._debugNameData.getDebugName(this)) !== null && _a10 !== void 0 ? _a10 : "ObservableValue";
}
constructor(_debugNameData, initialValue, _equalityComparator) {
super();
this._debugNameData = _debugNameData;
this._equalityComparator = _equalityComparator;
this._value = initialValue;
}
get() {
return this._value;
}
set(value, tx, change) {
var _a10;
if (change === void 0 && this._equalityComparator(this._value, value)) {
return;
}
let _tx;
if (!tx) {
tx = _tx = new TransactionImpl(() => {
}, () => `Setting ${this.debugName}`);
}
try {
const oldValue = this._value;
this._setValue(value);
(_a10 = getLogger()) === null || _a10 === void 0 ? void 0 : _a10.handleObservableChanged(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });
for (const observer of this.observers) {
tx.updateObserver(observer, this);
observer.handleChange(this, change);
}
} finally {
if (_tx) {
_tx.finish();
}
}
}
toString() {
return `${this.debugName}: ${this._value}`;
}
_setValue(newValue) {
this._value = newValue;
}
};
DisposableObservableValue = class extends ObservableValue {
_setValue(newValue) {
if (this._value === newValue) {
return;
}
if (this._value) {
this._value.dispose();
}
this._value = newValue;
}
dispose() {
var _a10;
(_a10 = this._value) === null || _a10 === void 0 ? void 0 : _a10.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js
function derived(computeFnOrOwner, computeFn) {
if (computeFn !== void 0) {
return new Derived(new DebugNameData(computeFnOrOwner, void 0, computeFn), computeFn, void 0, void 0, void 0, strictEquals);
}
return new Derived(new DebugNameData(void 0, void 0, computeFnOrOwner), computeFnOrOwner, void 0, void 0, void 0, strictEquals);
}
function derivedWithSetter(owner, computeFn, setter) {
return new DerivedWithSetter(new DebugNameData(owner, void 0, computeFn), computeFn, void 0, void 0, void 0, strictEquals, setter);
}
function derivedOpts(options2, computeFn) {
var _a10;
return new Derived(new DebugNameData(options2.owner, options2.debugName, options2.debugReferenceFn), computeFn, void 0, void 0, options2.onLastObserverRemoved, (_a10 = options2.equalsFn) !== null && _a10 !== void 0 ? _a10 : strictEquals);
}
function derivedHandleChanges(options2, computeFn) {
var _a10;
return new Derived(new DebugNameData(options2.owner, options2.debugName, void 0), computeFn, options2.createEmptyChangeSummary, options2.handleChange, void 0, (_a10 = options2.equalityComparer) !== null && _a10 !== void 0 ? _a10 : strictEquals);
}
function derivedWithStore(computeFnOrOwner, computeFnOrUndefined) {
let computeFn;
let owner;
if (computeFnOrUndefined === void 0) {
computeFn = computeFnOrOwner;
owner = void 0;
} else {
owner = computeFnOrOwner;
computeFn = computeFnOrUndefined;
}
const store = new DisposableStore();
return new Derived(new DebugNameData(owner, void 0, computeFn), (r) => {
store.clear();
return computeFn(r, store);
}, void 0, void 0, () => store.dispose(), strictEquals);
}
function derivedDisposable(computeFnOrOwner, computeFnOrUndefined) {
let computeFn;
let owner;
if (computeFnOrUndefined === void 0) {
computeFn = computeFnOrOwner;
owner = void 0;
} else {
owner = computeFnOrOwner;
computeFn = computeFnOrUndefined;
}
const store = new DisposableStore();
return new Derived(new DebugNameData(owner, void 0, computeFn), (r) => {
store.clear();
const result = computeFn(r);
if (result) {
store.add(result);
}
return result;
}, void 0, void 0, () => store.dispose(), strictEquals);
}
var Derived, DerivedWithSetter;
var init_derived = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/derived.js"() {
init_assert();
init_equals();
init_lifecycle();
init_base();
init_debugName();
init_logging();
_setDerivedOpts(derivedOpts);
Derived = class extends BaseObservable {
get debugName() {
var _a10;
return (_a10 = this._debugNameData.getDebugName(this)) !== null && _a10 !== void 0 ? _a10 : "(anonymous)";
}
constructor(_debugNameData, _computeFn, createChangeSummary, _handleChange, _handleLastObserverRemoved = void 0, _equalityComparator) {
var _a10, _b4;
super();
this._debugNameData = _debugNameData;
this._computeFn = _computeFn;
this.createChangeSummary = createChangeSummary;
this._handleChange = _handleChange;
this._handleLastObserverRemoved = _handleLastObserverRemoved;
this._equalityComparator = _equalityComparator;
this.state = 0;
this.value = void 0;
this.updateCount = 0;
this.dependencies = /* @__PURE__ */ new Set();
this.dependenciesToBeRemoved = /* @__PURE__ */ new Set();
this.changeSummary = void 0;
this.changeSummary = (_a10 = this.createChangeSummary) === null || _a10 === void 0 ? void 0 : _a10.call(this);
(_b4 = getLogger()) === null || _b4 === void 0 ? void 0 : _b4.handleDerivedCreated(this);
}
onLastObserverRemoved() {
var _a10;
this.state = 0;
this.value = void 0;
for (const d of this.dependencies) {
d.removeObserver(this);
}
this.dependencies.clear();
(_a10 = this._handleLastObserverRemoved) === null || _a10 === void 0 ? void 0 : _a10.call(this);
}
get() {
var _a10;
if (this.observers.size === 0) {
const result = this._computeFn(this, (_a10 = this.createChangeSummary) === null || _a10 === void 0 ? void 0 : _a10.call(this));
this.onLastObserverRemoved();
return result;
} else {
do {
if (this.state === 1) {
for (const d of this.dependencies) {
d.reportChanges();
if (this.state === 2) {
break;
}
}
}
if (this.state === 1) {
this.state = 3;
}
this._recomputeIfNeeded();
} while (this.state !== 3);
return this.value;
}
}
_recomputeIfNeeded() {
var _a10, _b4;
if (this.state === 3) {
return;
}
const emptySet = this.dependenciesToBeRemoved;
this.dependenciesToBeRemoved = this.dependencies;
this.dependencies = emptySet;
const hadValue = this.state !== 0;
const oldValue = this.value;
this.state = 3;
const changeSummary = this.changeSummary;
this.changeSummary = (_a10 = this.createChangeSummary) === null || _a10 === void 0 ? void 0 : _a10.call(this);
try {
this.value = this._computeFn(this, changeSummary);
} finally {
for (const o of this.dependenciesToBeRemoved) {
o.removeObserver(this);
}
this.dependenciesToBeRemoved.clear();
}
const didChange = hadValue && !this._equalityComparator(oldValue, this.value);
(_b4 = getLogger()) === null || _b4 === void 0 ? void 0 : _b4.handleDerivedRecomputed(this, {
oldValue,
newValue: this.value,
change: void 0,
didChange,
hadValue
});
if (didChange) {
for (const r of this.observers) {
r.handleChange(this, void 0);
}
}
}
toString() {
return `LazyDerived<${this.debugName}>`;
}
// IObserver Implementation
beginUpdate(_observable) {
this.updateCount++;
const propagateBeginUpdate = this.updateCount === 1;
if (this.state === 3) {
this.state = 1;
if (!propagateBeginUpdate) {
for (const r of this.observers) {
r.handlePossibleChange(this);
}
}
}
if (propagateBeginUpdate) {
for (const r of this.observers) {
r.beginUpdate(this);
}
}
}
endUpdate(_observable) {
this.updateCount--;
if (this.updateCount === 0) {
const observers = [...this.observers];
for (const r of observers) {
r.endUpdate(this);
}
}
assertFn(() => this.updateCount >= 0);
}
handlePossibleChange(observable) {
if (this.state === 3 && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {
this.state = 1;
for (const r of this.observers) {
r.handlePossibleChange(this);
}
}
}
handleChange(observable, change) {
if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {
const shouldReact = this._handleChange ? this._handleChange({
changedObservable: observable,
change,
didChange: (o) => o === observable
}, this.changeSummary) : true;
const wasUpToDate = this.state === 3;
if (shouldReact && (this.state === 1 || wasUpToDate)) {
this.state = 2;
if (wasUpToDate) {
for (const r of this.observers) {
r.handlePossibleChange(this);
}
}
}
}
}
// IReader Implementation
readObservable(observable) {
observable.addObserver(this);
const value = observable.get();
this.dependencies.add(observable);
this.dependenciesToBeRemoved.delete(observable);
return value;
}
addObserver(observer) {
const shouldCallBeginUpdate = !this.observers.has(observer) && this.updateCount > 0;
super.addObserver(observer);
if (shouldCallBeginUpdate) {
observer.beginUpdate(this);
}
}
removeObserver(observer) {
const shouldCallEndUpdate = this.observers.has(observer) && this.updateCount > 0;
super.removeObserver(observer);
if (shouldCallEndUpdate) {
observer.endUpdate(this);
}
}
};
DerivedWithSetter = class extends Derived {
constructor(debugNameData, computeFn, createChangeSummary, handleChange, handleLastObserverRemoved = void 0, equalityComparator, set) {
super(debugNameData, computeFn, createChangeSummary, handleChange, handleLastObserverRemoved, equalityComparator);
this.set = set;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js
function autorun(fn) {
return new AutorunObserver(new DebugNameData(void 0, void 0, fn), fn, void 0, void 0);
}
function autorunOpts(options2, fn) {
var _a10;
return new AutorunObserver(new DebugNameData(options2.owner, options2.debugName, (_a10 = options2.debugReferenceFn) !== null && _a10 !== void 0 ? _a10 : fn), fn, void 0, void 0);
}
function autorunHandleChanges(options2, fn) {
var _a10;
return new AutorunObserver(new DebugNameData(options2.owner, options2.debugName, (_a10 = options2.debugReferenceFn) !== null && _a10 !== void 0 ? _a10 : fn), fn, options2.createEmptyChangeSummary, options2.handleChange);
}
function autorunWithStore(fn) {
const store = new DisposableStore();
const disposable = autorunOpts({
owner: void 0,
debugName: void 0,
debugReferenceFn: fn
}, (reader) => {
store.clear();
fn(reader, store);
});
return toDisposable(() => {
disposable.dispose();
store.dispose();
});
}
var AutorunObserver;
var init_autorun = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/autorun.js"() {
init_assert();
init_lifecycle();
init_debugName();
init_logging();
AutorunObserver = class {
get debugName() {
var _a10;
return (_a10 = this._debugNameData.getDebugName(this)) !== null && _a10 !== void 0 ? _a10 : "(anonymous)";
}
constructor(_debugNameData, _runFn, createChangeSummary, _handleChange) {
var _a10, _b4;
this._debugNameData = _debugNameData;
this._runFn = _runFn;
this.createChangeSummary = createChangeSummary;
this._handleChange = _handleChange;
this.state = 2;
this.updateCount = 0;
this.disposed = false;
this.dependencies = /* @__PURE__ */ new Set();
this.dependenciesToBeRemoved = /* @__PURE__ */ new Set();
this.changeSummary = (_a10 = this.createChangeSummary) === null || _a10 === void 0 ? void 0 : _a10.call(this);
(_b4 = getLogger()) === null || _b4 === void 0 ? void 0 : _b4.handleAutorunCreated(this);
this._runIfNeeded();
trackDisposable(this);
}
dispose() {
this.disposed = true;
for (const o of this.dependencies) {
o.removeObserver(this);
}
this.dependencies.clear();
markAsDisposed(this);
}
_runIfNeeded() {
var _a10, _b4, _c2;
if (this.state === 3) {
return;
}
const emptySet = this.dependenciesToBeRemoved;
this.dependenciesToBeRemoved = this.dependencies;
this.dependencies = emptySet;
this.state = 3;
const isDisposed = this.disposed;
try {
if (!isDisposed) {
(_a10 = getLogger()) === null || _a10 === void 0 ? void 0 : _a10.handleAutorunTriggered(this);
const changeSummary = this.changeSummary;
this.changeSummary = (_b4 = this.createChangeSummary) === null || _b4 === void 0 ? void 0 : _b4.call(this);
this._runFn(this, changeSummary);
}
} finally {
if (!isDisposed) {
(_c2 = getLogger()) === null || _c2 === void 0 ? void 0 : _c2.handleAutorunFinished(this);
}
for (const o of this.dependenciesToBeRemoved) {
o.removeObserver(this);
}
this.dependenciesToBeRemoved.clear();
}
}
toString() {
return `Autorun<${this.debugName}>`;
}
// IObserver implementation
beginUpdate() {
if (this.state === 3) {
this.state = 1;
}
this.updateCount++;
}
endUpdate() {
if (this.updateCount === 1) {
do {
if (this.state === 1) {
this.state = 3;
for (const d of this.dependencies) {
d.reportChanges();
if (this.state === 2) {
break;
}
}
}
this._runIfNeeded();
} while (this.state !== 3);
}
this.updateCount--;
assertFn(() => this.updateCount >= 0);
}
handlePossibleChange(observable) {
if (this.state === 3 && this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {
this.state = 1;
}
}
handleChange(observable, change) {
if (this.dependencies.has(observable) && !this.dependenciesToBeRemoved.has(observable)) {
const shouldReact = this._handleChange ? this._handleChange({
changedObservable: observable,
change,
didChange: (o) => o === observable
}, this.changeSummary) : true;
if (shouldReact) {
this.state = 2;
}
}
}
// IReader implementation
readObservable(observable) {
if (this.disposed) {
return observable.get();
}
observable.addObserver(this);
const value = observable.get();
this.dependencies.add(observable);
this.dependenciesToBeRemoved.delete(observable);
return value;
}
};
(function(autorun2) {
autorun2.Observer = AutorunObserver;
})(autorun || (autorun = {}));
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js
function constObservable(value) {
return new ConstObservable(value);
}
function observableFromEvent(event, getValue) {
return new FromEventObservable(event, getValue);
}
function observableSignalFromEvent(debugName, event) {
return new FromEventObservableSignal(debugName, event);
}
function observableSignal(debugNameOrOwner) {
if (typeof debugNameOrOwner === "string") {
return new ObservableSignal(debugNameOrOwner);
} else {
return new ObservableSignal(void 0, debugNameOrOwner);
}
}
function keepObserved(observable) {
const o = new KeepAliveObserver(false, void 0);
observable.addObserver(o);
return toDisposable(() => {
observable.removeObserver(o);
});
}
function recomputeInitiallyAndOnChange(observable, handleValue) {
const o = new KeepAliveObserver(true, handleValue);
observable.addObserver(o);
if (handleValue) {
handleValue(observable.get());
} else {
observable.reportChanges();
}
return toDisposable(() => {
observable.removeObserver(o);
});
}
function derivedObservableWithCache(owner, computeFn) {
let lastValue = void 0;
const observable = derived(owner, (reader) => {
lastValue = computeFn(reader, lastValue);
return lastValue;
});
return observable;
}
function mapObservableArrayCached(owner, items, map, keySelector) {
let m = new ArrayMap(map, keySelector);
const self2 = derivedOpts({
debugReferenceFn: map,
owner,
onLastObserverRemoved: () => {
m.dispose();
m = new ArrayMap(map);
}
}, (reader) => {
m.setItems(items.read(reader));
return m.getItems();
});
return self2;
}
var ConstObservable, FromEventObservable, FromEventObservableSignal, ObservableSignal, KeepAliveObserver, ArrayMap;
var init_utils3 = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/utils.js"() {
init_event();
init_lifecycle();
init_base();
init_debugName();
init_derived();
init_logging();
ConstObservable = class extends ConvenientObservable {
constructor(value) {
super();
this.value = value;
}
get debugName() {
return this.toString();
}
get() {
return this.value;
}
addObserver(observer) {
}
removeObserver(observer) {
}
toString() {
return `Const: ${this.value}`;
}
};
FromEventObservable = class _FromEventObservable extends BaseObservable {
constructor(event, _getValue) {
super();
this.event = event;
this._getValue = _getValue;
this.hasValue = false;
this.handleEvent = (args) => {
var _a10;
const newValue = this._getValue(args);
const oldValue = this.value;
const didChange = !this.hasValue || oldValue !== newValue;
let didRunTransaction = false;
if (didChange) {
this.value = newValue;
if (this.hasValue) {
didRunTransaction = true;
subtransaction(_FromEventObservable.globalTransaction, (tx) => {
var _a11;
(_a11 = getLogger()) === null || _a11 === void 0 ? void 0 : _a11.handleFromEventObservableTriggered(this, { oldValue, newValue, change: void 0, didChange, hadValue: this.hasValue });
for (const o of this.observers) {
tx.updateObserver(o, this);
o.handleChange(this, void 0);
}
}, () => {
const name = this.getDebugName();
return "Event fired" + (name ? `: ${name}` : "");
});
}
this.hasValue = true;
}
if (!didRunTransaction) {
(_a10 = getLogger()) === null || _a10 === void 0 ? void 0 : _a10.handleFromEventObservableTriggered(this, { oldValue, newValue, change: void 0, didChange, hadValue: this.hasValue });
}
};
}
getDebugName() {
return getFunctionName(this._getValue);
}
get debugName() {
const name = this.getDebugName();
return "From Event" + (name ? `: ${name}` : "");
}
onFirstObserverAdded() {
this.subscription = this.event(this.handleEvent);
}
onLastObserverRemoved() {
this.subscription.dispose();
this.subscription = void 0;
this.hasValue = false;
this.value = void 0;
}
get() {
if (this.subscription) {
if (!this.hasValue) {
this.handleEvent(void 0);
}
return this.value;
} else {
const value = this._getValue(void 0);
return value;
}
}
};
(function(observableFromEvent2) {
observableFromEvent2.Observer = FromEventObservable;
function batchEventsGlobally(tx, fn) {
let didSet = false;
if (FromEventObservable.globalTransaction === void 0) {
FromEventObservable.globalTransaction = tx;
didSet = true;
}
try {
fn();
} finally {
if (didSet) {
FromEventObservable.globalTransaction = void 0;
}
}
}
observableFromEvent2.batchEventsGlobally = batchEventsGlobally;
})(observableFromEvent || (observableFromEvent = {}));
FromEventObservableSignal = class extends BaseObservable {
constructor(debugName, event) {
super();
this.debugName = debugName;
this.event = event;
this.handleEvent = () => {
transaction((tx) => {
for (const o of this.observers) {
tx.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() {
}
};
ObservableSignal = class extends BaseObservable {
get debugName() {
var _a10;
return (_a10 = new DebugNameData(this._owner, this._debugName, void 0).getDebugName(this)) !== null && _a10 !== void 0 ? _a10 : "Observable Signal";
}
constructor(_debugName, _owner) {
super();
this._debugName = _debugName;
this._owner = _owner;
}
trigger(tx, change) {
if (!tx) {
transaction((tx2) => {
this.trigger(tx2, change);
}, () => `Trigger signal ${this.debugName}`);
return;
}
for (const o of this.observers) {
tx.updateObserver(o, this);
o.handleChange(this, change);
}
}
get() {
}
};
_setKeepObserved(keepObserved);
_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);
KeepAliveObserver = class {
constructor(_forceRecompute, _handleValue) {
this._forceRecompute = _forceRecompute;
this._handleValue = _handleValue;
this._counter = 0;
}
beginUpdate(observable) {
this._counter++;
}
endUpdate(observable) {
this._counter--;
if (this._counter === 0 && this._forceRecompute) {
if (this._handleValue) {
this._handleValue(observable.get());
} else {
observable.reportChanges();
}
}
}
handlePossibleChange(observable) {
}
handleChange(observable, change) {
}
};
ArrayMap = class {
constructor(_map, _keySelector) {
this._map = _map;
this._keySelector = _keySelector;
this._cache = /* @__PURE__ */ new Map();
this._items = [];
}
dispose() {
this._cache.forEach((entry) => entry.store.dispose());
this._cache.clear();
}
setItems(items) {
const newItems = [];
const itemsToRemove = new Set(this._cache.keys());
for (const item of items) {
const key = this._keySelector ? this._keySelector(item) : item;
let entry = this._cache.get(key);
if (!entry) {
const store = new DisposableStore();
const out = this._map(item, store);
entry = { out, store };
this._cache.set(key, entry);
} else {
itemsToRemove.delete(key);
}
newItems.push(entry.out);
}
for (const item of itemsToRemove) {
const entry = this._cache.get(item);
entry.store.dispose();
this._cache.delete(item);
}
this._items = newItems;
}
getItems() {
return this._items;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js
function waitForState(observable, predicate, isError, cancellationToken) {
if (!predicate) {
predicate = (state) => state !== null && state !== void 0;
}
return new Promise((resolve2, reject) => {
let isImmediateRun = true;
let shouldDispose = false;
const stateObs = observable.map((state) => {
return {
isFinished: predicate(state),
error: isError ? isError(state) : false,
state
};
});
const d = autorun((reader) => {
const { isFinished, error, state } = stateObs.read(reader);
if (isFinished || error) {
if (isImmediateRun) {
shouldDispose = true;
} else {
d.dispose();
}
if (error) {
reject(error === true ? state : error);
} else {
resolve2(state);
}
}
});
if (cancellationToken) {
const dc = cancellationToken.onCancellationRequested(() => {
d.dispose();
dc.dispose();
reject(new CancellationError());
});
if (cancellationToken.isCancellationRequested) {
d.dispose();
dc.dispose();
reject(new CancellationError());
return;
}
}
isImmediateRun = false;
if (shouldDispose) {
d.dispose();
}
});
}
var init_promise = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observableInternal/promise.js"() {
init_autorun();
init_errors();
}
});
// node_modules/monaco-editor/esm/vs/base/common/observable.js
var enableLogging;
var init_observable = __esm({
"node_modules/monaco-editor/esm/vs/base/common/observable.js"() {
init_base();
init_derived();
init_autorun();
init_utils3();
init_promise();
init_logging();
enableLogging = false;
if (enableLogging) {
setLogger(new ConsoleObservableLogger());
}
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js
function isInputElement(e) {
return e.tagName === "INPUT" || e.tagName === "TEXTAREA";
}
function isListElementDescendantOfClass(e, className) {
if (e.classList.contains(className)) {
return true;
}
if (e.classList.contains("monaco-list")) {
return false;
}
if (!e.parentElement) {
return false;
}
return isListElementDescendantOfClass(e.parentElement, className);
}
function isMonacoEditor(e) {
return isListElementDescendantOfClass(e, "monaco-editor");
}
function isMonacoCustomToggle(e) {
return isListElementDescendantOfClass(e, "monaco-custom-toggle");
}
function isActionItem(e) {
return isListElementDescendantOfClass(e, "action-item");
}
function isStickyScrollElement(e) {
return isListElementDescendantOfClass(e, "monaco-tree-sticky-row");
}
function isStickyScrollContainer(e) {
return e.classList.contains("monaco-tree-sticky-container");
}
function isButton(e) {
if (e.tagName === "A" && e.classList.contains("monaco-button") || e.tagName === "DIV" && e.classList.contains("monaco-button-dropdown")) {
return true;
}
if (e.classList.contains("monaco-list")) {
return false;
}
if (!e.parentElement) {
return false;
}
return isButton(e.parentElement);
}
function isSelectionSingleChangeEvent(event) {
return isMacintosh ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
}
function isSelectionRangeChangeEvent(event) {
return event.browserEvent.shiftKey;
}
function isMouseRightClick(event) {
return isMouseEvent(event) && event.button === 2;
}
function getContiguousRangeContaining(range2, value) {
const index = range2.indexOf(value);
if (index === -1) {
return [];
}
const result = [];
let i = index - 1;
while (i >= 0 && range2[i] === value - (index - i)) {
result.push(range2[i--]);
}
result.reverse();
i = index;
while (i < range2.length && range2[i] === value + (i - index)) {
result.push(range2[i++]);
}
return result;
}
function disjunction(one, other) {
const result = [];
let i = 0, j = 0;
while (i < one.length || j < other.length) {
if (i >= one.length) {
result.push(other[j++]);
} else if (j >= other.length) {
result.push(one[i++]);
} else if (one[i] === other[j]) {
result.push(one[i]);
i++;
j++;
continue;
} else if (one[i] < other[j]) {
result.push(one[i++]);
} else {
result.push(other[j++]);
}
}
return result;
}
function relativeComplement(one, other) {
const result = [];
let i = 0, j = 0;
while (i < one.length || j < other.length) {
if (i >= one.length) {
result.push(other[j++]);
} else if (j >= other.length) {
result.push(one[i++]);
} else if (one[i] === other[j]) {
i++;
j++;
continue;
} else if (one[i] < other[j]) {
result.push(one[i++]);
} else {
j++;
}
}
return result;
}
var __decorate27, TraitRenderer, Trait, SelectionTrait, TraitSpliceable, KeyboardController, TypeNavigationMode, TypeNavigationControllerState, DefaultKeyboardNavigationDelegate, TypeNavigationController, DOMFocusController, DefaultMultipleSelectionController, MouseController, DefaultStyleController, unthemedListStyles, DefaultOptions2, numericSort, PipelineRenderer, AccessibiltyRenderer, ListViewDragAndDrop, List;
var init_listWidget = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js"() {
init_dom();
init_event2();
init_keyboardEvent();
init_touch();
init_aria2();
init_splice();
init_arrays();
init_async();
init_color();
init_decorators();
init_event();
init_filters();
init_lifecycle();
init_numbers();
init_platform();
init_types();
init_list();
init_list2();
init_listView();
init_mouseEvent();
init_observable();
__decorate27 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
TraitRenderer = class {
constructor(trait) {
this.trait = trait;
this.renderedElements = [];
}
get templateId() {
return `template:${this.trait.name}`;
}
renderTemplate(container) {
return container;
}
renderElement(element, index, templateData) {
const renderedElementIndex = this.renderedElements.findIndex((el) => el.templateData === templateData);
if (renderedElementIndex >= 0) {
const rendered = this.renderedElements[renderedElementIndex];
this.trait.unrender(templateData);
rendered.index = index;
} else {
const rendered = { index, templateData };
this.renderedElements.push(rendered);
}
this.trait.renderIndex(index, templateData);
}
splice(start, deleteCount, insertCount) {
const rendered = [];
for (const renderedElement of this.renderedElements) {
if (renderedElement.index < start) {
rendered.push(renderedElement);
} else if (renderedElement.index >= start + deleteCount) {
rendered.push({
index: renderedElement.index + insertCount - deleteCount,
templateData: renderedElement.templateData
});
}
}
this.renderedElements = rendered;
}
renderIndexes(indexes) {
for (const { index, templateData } of this.renderedElements) {
if (indexes.indexOf(index) > -1) {
this.trait.renderIndex(index, templateData);
}
}
}
disposeTemplate(templateData) {
const index = this.renderedElements.findIndex((el) => el.templateData === templateData);
if (index < 0) {
return;
}
this.renderedElements.splice(index, 1);
}
};
Trait = class {
get name() {
return this._trait;
}
get renderer() {
return new TraitRenderer(this);
}
constructor(_trait) {
this._trait = _trait;
this.indexes = [];
this.sortedIndexes = [];
this._onChange = new Emitter();
this.onChange = this._onChange.event;
}
splice(start, deleteCount, elements) {
const diff = elements.length - deleteCount;
const end = start + deleteCount;
const sortedIndexes = [];
let i = 0;
while (i < this.sortedIndexes.length && this.sortedIndexes[i] < start) {
sortedIndexes.push(this.sortedIndexes[i++]);
}
for (let j = 0; j < elements.length; j++) {
if (elements[j]) {
sortedIndexes.push(j + start);
}
}
while (i < this.sortedIndexes.length && this.sortedIndexes[i] >= end) {
sortedIndexes.push(this.sortedIndexes[i++] + diff);
}
this.renderer.splice(start, deleteCount, elements.length);
this._set(sortedIndexes, sortedIndexes);
}
renderIndex(index, container) {
container.classList.toggle(this._trait, this.contains(index));
}
unrender(container) {
container.classList.remove(this._trait);
}
/**
* Sets the indexes which should have this trait.
*
* @param indexes Indexes which should have this trait.
* @return The old indexes which had this trait.
*/
set(indexes, browserEvent) {
return this._set(indexes, [...indexes].sort(numericSort), browserEvent);
}
_set(indexes, sortedIndexes, browserEvent) {
const result = this.indexes;
const sortedResult = this.sortedIndexes;
this.indexes = indexes;
this.sortedIndexes = sortedIndexes;
const toRender = disjunction(sortedResult, indexes);
this.renderer.renderIndexes(toRender);
this._onChange.fire({ indexes, browserEvent });
return result;
}
get() {
return this.indexes;
}
contains(index) {
return binarySearch(this.sortedIndexes, index, numericSort) >= 0;
}
dispose() {
dispose(this._onChange);
}
};
__decorate27([
memoize
], Trait.prototype, "renderer", null);
SelectionTrait = class extends Trait {
constructor(setAriaSelected) {
super("selected");
this.setAriaSelected = setAriaSelected;
}
renderIndex(index, container) {
super.renderIndex(index, container);
if (this.setAriaSelected) {
if (this.contains(index)) {
container.setAttribute("aria-selected", "true");
} else {
container.setAttribute("aria-selected", "false");
}
}
}
};
TraitSpliceable = class {
constructor(trait, view, identityProvider) {
this.trait = trait;
this.view = view;
this.identityProvider = identityProvider;
}
splice(start, deleteCount, elements) {
if (!this.identityProvider) {
return this.trait.splice(start, deleteCount, new Array(elements.length).fill(false));
}
const pastElementsWithTrait = this.trait.get().map((i) => this.identityProvider.getId(this.view.element(i)).toString());
if (pastElementsWithTrait.length === 0) {
return this.trait.splice(start, deleteCount, new Array(elements.length).fill(false));
}
const pastElementsWithTraitSet = new Set(pastElementsWithTrait);
const elementsWithTrait = elements.map((e) => pastElementsWithTraitSet.has(this.identityProvider.getId(e).toString()));
this.trait.splice(start, deleteCount, elementsWithTrait);
}
};
KeyboardController = class {
get onKeyDown() {
return Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, "keydown")).event, ($16) => $16.filter((e) => !isInputElement(e.target)).map((e) => new StandardKeyboardEvent(e)));
}
constructor(list, view, options2) {
this.list = list;
this.view = view;
this.disposables = new DisposableStore();
this.multipleSelectionDisposables = new DisposableStore();
this.multipleSelectionSupport = options2.multipleSelectionSupport;
this.disposables.add(this.onKeyDown((e) => {
switch (e.keyCode) {
case 3:
return this.onEnter(e);
case 16:
return this.onUpArrow(e);
case 18:
return this.onDownArrow(e);
case 11:
return this.onPageUpArrow(e);
case 12:
return this.onPageDownArrow(e);
case 9:
return this.onEscape(e);
case 31:
if (this.multipleSelectionSupport && (isMacintosh ? e.metaKey : e.ctrlKey)) {
this.onCtrlA(e);
}
}
}));
}
updateOptions(optionsUpdate) {
if (optionsUpdate.multipleSelectionSupport !== void 0) {
this.multipleSelectionSupport = optionsUpdate.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, false, e.browserEvent);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
onDownArrow(e) {
e.preventDefault();
e.stopPropagation();
this.list.focusNext(1, false, e.browserEvent);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
onPageUpArrow(e) {
e.preventDefault();
e.stopPropagation();
this.list.focusPreviousPage(e.browserEvent);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
onPageDownArrow(e) {
e.preventDefault();
e.stopPropagation();
this.list.focusNextPage(e.browserEvent);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
onCtrlA(e) {
e.preventDefault();
e.stopPropagation();
this.list.setSelection(range(this.list.length), e.browserEvent);
this.list.setAnchor(void 0);
this.view.domNode.focus();
}
onEscape(e) {
if (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();
}
};
__decorate27([
memoize
], KeyboardController.prototype, "onKeyDown", null);
(function(TypeNavigationMode2) {
TypeNavigationMode2[TypeNavigationMode2["Automatic"] = 0] = "Automatic";
TypeNavigationMode2[TypeNavigationMode2["Trigger"] = 1] = "Trigger";
})(TypeNavigationMode || (TypeNavigationMode = {}));
(function(TypeNavigationControllerState2) {
TypeNavigationControllerState2[TypeNavigationControllerState2["Idle"] = 0] = "Idle";
TypeNavigationControllerState2[TypeNavigationControllerState2["Typing"] = 1] = "Typing";
})(TypeNavigationControllerState || (TypeNavigationControllerState = {}));
DefaultKeyboardNavigationDelegate = new class {
mightProducePrintableCharacter(event) {
if (event.ctrlKey || event.metaKey || event.altKey) {
return false;
}
return event.keyCode >= 31 && event.keyCode <= 56 || event.keyCode >= 21 && event.keyCode <= 30 || event.keyCode >= 98 && event.keyCode <= 107 || event.keyCode >= 85 && event.keyCode <= 95;
}
}();
TypeNavigationController = class {
constructor(list, view, keyboardNavigationLabelProvider, keyboardNavigationEventFilter, delegate) {
this.list = list;
this.view = view;
this.keyboardNavigationLabelProvider = keyboardNavigationLabelProvider;
this.keyboardNavigationEventFilter = keyboardNavigationEventFilter;
this.delegate = delegate;
this.enabled = false;
this.state = TypeNavigationControllerState.Idle;
this.mode = TypeNavigationMode.Automatic;
this.triggered = false;
this.previouslyFocused = -1;
this.enabledDisposables = new DisposableStore();
this.disposables = new DisposableStore();
this.updateOptions(list.options);
}
updateOptions(options2) {
var _a10, _b4;
if ((_a10 = options2.typeNavigationEnabled) !== null && _a10 !== void 0 ? _a10 : true) {
this.enable();
} else {
this.disable();
}
this.mode = (_b4 = options2.typeNavigationMode) !== null && _b4 !== void 0 ? _b4 : TypeNavigationMode.Automatic;
}
enable() {
if (this.enabled) {
return;
}
let typing = false;
const onChar = Event.chain(this.enabledDisposables.add(new DomEmitter(this.view.domNode, "keydown")).event, ($16) => $16.filter((e) => !isInputElement(e.target)).filter(() => this.mode === TypeNavigationMode.Automatic || this.triggered).map((event) => new StandardKeyboardEvent(event)).filter((e) => typing || this.keyboardNavigationEventFilter(e)).filter((e) => this.delegate.mightProducePrintableCharacter(e)).forEach((e) => EventHelper.stop(e, true)).map((event) => event.browserEvent.key));
const onClear = Event.debounce(onChar, () => null, 800, void 0, void 0, void 0, this.enabledDisposables);
const onInput = Event.reduce(Event.any(onChar, onClear), (r, i) => i === null ? null : (r || "") + i, void 0, this.enabledDisposables);
onInput(this.onInput, this, this.enabledDisposables);
onClear(this.onClear, this, this.enabledDisposables);
onChar(() => typing = true, void 0, this.enabledDisposables);
onClear(() => typing = false, void 0, this.enabledDisposables);
this.enabled = true;
this.triggered = false;
}
disable() {
if (!this.enabled) {
return;
}
this.enabledDisposables.clear();
this.enabled = false;
this.triggered = false;
}
onClear() {
var _a10;
const focus = this.list.getFocus();
if (focus.length > 0 && focus[0] === this.previouslyFocused) {
const ariaLabel = (_a10 = this.list.options.accessibilityProvider) === null || _a10 === void 0 ? void 0 : _a10.getAriaLabel(this.list.element(focus[0]));
if (typeof ariaLabel === "string") {
alert(ariaLabel);
} else if (ariaLabel) {
alert(ariaLabel.get());
}
}
this.previouslyFocused = -1;
}
onInput(word) {
if (!word) {
this.state = TypeNavigationControllerState.Idle;
this.triggered = false;
return;
}
const focus = this.list.getFocus();
const start = focus.length > 0 ? focus[0] : 0;
const delta = this.state === TypeNavigationControllerState.Idle ? 1 : 0;
this.state = TypeNavigationControllerState.Typing;
for (let i = 0; i < this.list.length; i++) {
const index = (start + i + delta) % this.list.length;
const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(index));
const labelStr = label && label.toString();
if (this.list.options.typeNavigationEnabled) {
if (typeof labelStr !== "undefined") {
if (matchesPrefix(word, labelStr)) {
this.previouslyFocused = start;
this.list.setFocus([index]);
this.list.reveal(index);
return;
}
const fuzzy = matchesFuzzy2(word, labelStr);
if (fuzzy) {
const fuzzyScore2 = fuzzy[0].end - fuzzy[0].start;
if (fuzzyScore2 > 1 && fuzzy.length === 1) {
this.previouslyFocused = start;
this.list.setFocus([index]);
this.list.reveal(index);
return;
}
}
}
} else if (typeof labelStr === "undefined" || matchesPrefix(word, labelStr)) {
this.previouslyFocused = start;
this.list.setFocus([index]);
this.list.reveal(index);
return;
}
}
}
dispose() {
this.disable();
this.enabledDisposables.dispose();
this.disposables.dispose();
}
};
DOMFocusController = class {
constructor(list, view) {
this.list = list;
this.view = view;
this.disposables = new DisposableStore();
const onKeyDown = Event.chain(this.disposables.add(new DomEmitter(view.domNode, "keydown")).event, ($16) => $16.filter((e) => !isInputElement(e.target)).map((e) => new StandardKeyboardEvent(e)));
const onTab = Event.chain(onKeyDown, ($16) => $16.filter((e) => e.keyCode === 2 && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey));
onTab(this.onTab, this, this.disposables);
}
onTab(e) {
if (e.target !== this.view.domNode) {
return;
}
const focus = this.list.getFocus();
if (focus.length === 0) {
return;
}
const focusedDomElement = this.view.domElement(focus[0]);
if (!focusedDomElement) {
return;
}
const tabIndexElement = focusedDomElement.querySelector("[tabIndex]");
if (!tabIndexElement || !isHTMLElement(tabIndexElement) || tabIndexElement.tabIndex === -1) {
return;
}
const style = getWindow(tabIndexElement).getComputedStyle(tabIndexElement);
if (style.visibility === "hidden" || style.display === "none") {
return;
}
e.preventDefault();
e.stopPropagation();
tabIndexElement.focus();
}
dispose() {
this.disposables.dispose();
}
};
DefaultMultipleSelectionController = {
isSelectionSingleChangeEvent,
isSelectionRangeChangeEvent
};
MouseController = class {
constructor(list) {
this.list = list;
this.disposables = new DisposableStore();
this._onPointer = new Emitter();
this.onPointer = this._onPointer.event;
if (list.options.multipleSelectionSupport !== false) {
this.multipleSelectionController = this.list.options.multipleSelectionController || DefaultMultipleSelectionController;
}
this.mouseSupport = typeof list.options.mouseSupport === "undefined" || !!list.options.mouseSupport;
if (this.mouseSupport) {
list.onMouseDown(this.onMouseDown, this, this.disposables);
list.onContextMenu(this.onContextMenu, this, this.disposables);
list.onMouseDblClick(this.onDoubleClick, this, this.disposables);
list.onTouchStart(this.onMouseDown, this, this.disposables);
this.disposables.add(Gesture.addTarget(list.getHTMLElement()));
}
Event.any(list.onMouseClick, list.onMouseMiddleClick, list.onTap)(this.onViewPointer, this, this.disposables);
}
updateOptions(optionsUpdate) {
if (optionsUpdate.multipleSelectionSupport !== void 0) {
this.multipleSelectionController = void 0;
if (optionsUpdate.multipleSelectionSupport) {
this.multipleSelectionController = this.list.options.multipleSelectionController || DefaultMultipleSelectionController;
}
}
}
isSelectionSingleChangeEvent(event) {
if (!this.multipleSelectionController) {
return false;
}
return this.multipleSelectionController.isSelectionSingleChangeEvent(event);
}
isSelectionRangeChangeEvent(event) {
if (!this.multipleSelectionController) {
return false;
}
return this.multipleSelectionController.isSelectionRangeChangeEvent(event);
}
isSelectionChangeEvent(event) {
return this.isSelectionSingleChangeEvent(event) || this.isSelectionRangeChangeEvent(event);
}
onMouseDown(e) {
if (isMonacoEditor(e.browserEvent.target)) {
return;
}
if (getActiveElement() !== e.browserEvent.target) {
this.list.domFocus();
}
}
onContextMenu(e) {
if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
return;
}
const focus = typeof e.index === "undefined" ? [] : [e.index];
this.list.setFocus(focus, e.browserEvent);
}
onViewPointer(e) {
if (!this.mouseSupport) {
return;
}
if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
return;
}
if (e.browserEvent.isHandledByList) {
return;
}
e.browserEvent.isHandledByList = true;
const focus = e.index;
if (typeof focus === "undefined") {
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([focus], e.browserEvent);
this.list.setAnchor(focus);
if (!isMouseRightClick(e.browserEvent)) {
this.list.setSelection([focus], e.browserEvent);
}
this._onPointer.fire(e);
}
onDoubleClick(e) {
if (isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
return;
}
if (this.isSelectionChangeEvent(e)) {
return;
}
if (e.browserEvent.isHandledByList) {
return;
}
e.browserEvent.isHandledByList = true;
const focus = this.list.getFocus();
this.list.setSelection(focus, e.browserEvent);
}
changeSelection(e) {
const focus = e.index;
let anchor = this.list.getAnchor();
if (this.isSelectionRangeChangeEvent(e)) {
if (typeof anchor === "undefined") {
const currentFocus = this.list.getFocus()[0];
anchor = currentFocus !== null && currentFocus !== void 0 ? currentFocus : focus;
this.list.setAnchor(anchor);
}
const min = Math.min(anchor, focus);
const max = Math.max(anchor, focus);
const rangeSelection = range(min, max + 1);
const selection = this.list.getSelection();
const contiguousRange = getContiguousRangeContaining(disjunction(selection, [anchor]), anchor);
if (contiguousRange.length === 0) {
return;
}
const newSelection = disjunction(rangeSelection, relativeComplement(selection, contiguousRange));
this.list.setSelection(newSelection, e.browserEvent);
this.list.setFocus([focus], e.browserEvent);
} else if (this.isSelectionSingleChangeEvent(e)) {
const selection = this.list.getSelection();
const newSelection = selection.filter((i) => i !== focus);
this.list.setFocus([focus]);
this.list.setAnchor(focus);
if (selection.length === newSelection.length) {
this.list.setSelection([...newSelection, focus], e.browserEvent);
} else {
this.list.setSelection(newSelection, e.browserEvent);
}
}
}
dispose() {
this.disposables.dispose();
}
};
DefaultStyleController = class {
constructor(styleElement, selectorSuffix) {
this.styleElement = styleElement;
this.selectorSuffix = selectorSuffix;
}
style(styles) {
var _a10, _b4;
const suffix = this.selectorSuffix && `.${this.selectorSuffix}`;
const content = [];
if (styles.listBackground) {
content.push(`.monaco-list${suffix} .monaco-list-rows { background: ${styles.listBackground}; }`);
}
if (styles.listFocusBackground) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`);
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`);
}
if (styles.listFocusForeground) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`);
}
if (styles.listActiveSelectionBackground) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { background-color: ${styles.listActiveSelectionBackground}; }`);
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected:hover { background-color: ${styles.listActiveSelectionBackground}; }`);
}
if (styles.listActiveSelectionForeground) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected { color: ${styles.listActiveSelectionForeground}; }`);
}
if (styles.listActiveSelectionIconForeground) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.selected .codicon { color: ${styles.listActiveSelectionIconForeground}; }`);
}
if (styles.listFocusAndSelectionBackground) {
content.push(`
.monaco-drag-image,
.monaco-list${suffix}:focus .monaco-list-row.selected.focused { background-color: ${styles.listFocusAndSelectionBackground}; }
`);
}
if (styles.listFocusAndSelectionForeground) {
content.push(`
.monaco-drag-image,
.monaco-list${suffix}:focus .monaco-list-row.selected.focused { color: ${styles.listFocusAndSelectionForeground}; }
`);
}
if (styles.listInactiveFocusForeground) {
content.push(`.monaco-list${suffix} .monaco-list-row.focused { color: ${styles.listInactiveFocusForeground}; }`);
content.push(`.monaco-list${suffix} .monaco-list-row.focused:hover { color: ${styles.listInactiveFocusForeground}; }`);
}
if (styles.listInactiveSelectionIconForeground) {
content.push(`.monaco-list${suffix} .monaco-list-row.focused .codicon { color: ${styles.listInactiveSelectionIconForeground}; }`);
}
if (styles.listInactiveFocusBackground) {
content.push(`.monaco-list${suffix} .monaco-list-row.focused { background-color: ${styles.listInactiveFocusBackground}; }`);
content.push(`.monaco-list${suffix} .monaco-list-row.focused:hover { background-color: ${styles.listInactiveFocusBackground}; }`);
}
if (styles.listInactiveSelectionBackground) {
content.push(`.monaco-list${suffix} .monaco-list-row.selected { background-color: ${styles.listInactiveSelectionBackground}; }`);
content.push(`.monaco-list${suffix} .monaco-list-row.selected:hover { background-color: ${styles.listInactiveSelectionBackground}; }`);
}
if (styles.listInactiveSelectionForeground) {
content.push(`.monaco-list${suffix} .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`);
}
if (styles.listHoverBackground) {
content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
}
if (styles.listHoverForeground) {
content.push(`.monaco-list${suffix}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
}
const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, (_a10 = styles.listFocusOutline) !== null && _a10 !== void 0 ? _a10 : ""));
if (focusAndSelectionOutline) {
content.push(`.monaco-list${suffix}:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`);
}
if (styles.listFocusOutline) {
content.push(`
.monaco-drag-image,
.monaco-list${suffix}:focus .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
`);
}
const inactiveFocusAndSelectionOutline = asCssValueWithDefault(styles.listSelectionOutline, (_b4 = styles.listInactiveFocusOutline) !== null && _b4 !== void 0 ? _b4 : "");
if (inactiveFocusAndSelectionOutline) {
content.push(`.monaco-list${suffix} .monaco-list-row.focused.selected { outline: 1px dotted ${inactiveFocusAndSelectionOutline}; outline-offset: -1px; }`);
}
if (styles.listSelectionOutline) {
content.push(`.monaco-list${suffix} .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`);
}
if (styles.listInactiveFocusOutline) {
content.push(`.monaco-list${suffix} .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`);
}
if (styles.listHoverOutline) {
content.push(`.monaco-list${suffix} .monaco-list-row:hover { outline: 1px dashed ${styles.listHoverOutline}; outline-offset: -1px; }`);
}
if (styles.listDropOverBackground) {
content.push(`
.monaco-list${suffix}.drop-target,
.monaco-list${suffix} .monaco-list-rows.drop-target,
.monaco-list${suffix} .monaco-list-row.drop-target { background-color: ${styles.listDropOverBackground} !important; color: inherit !important; }
`);
}
if (styles.listDropBetweenBackground) {
content.push(`
.monaco-list${suffix} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
.monaco-list${suffix} .monaco-list-row.drop-target-before::before {
content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${styles.listDropBetweenBackground};
}`);
content.push(`
.monaco-list${suffix} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
.monaco-list${suffix} .monaco-list-row.drop-target-after::after {
content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${styles.listDropBetweenBackground};
}`);
}
if (styles.tableColumnsBorder) {
content.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: ${styles.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;
}
`);
}
if (styles.tableOddRowsBackgroundColor) {
content.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: ${styles.tableOddRowsBackgroundColor};
}
`);
}
this.styleElement.textContent = content.join("\n");
}
};
unthemedListStyles = {
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: Color.fromHex("#a9a9a9").transparent(0.4).toString(),
tableColumnsBorder: Color.fromHex("#cccccc").transparent(0.2).toString(),
tableOddRowsBackgroundColor: Color.fromHex("#cccccc").transparent(0.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
};
DefaultOptions2 = {
keyboardSupport: true,
mouseSupport: true,
multipleSelectionSupport: true,
dnd: {
getDragURI() {
return null;
},
onDragStart() {
},
onDragOver() {
return false;
},
drop() {
},
dispose() {
}
}
};
numericSort = (a3, b) => a3 - b;
PipelineRenderer = class {
constructor(_templateId, renderers) {
this._templateId = _templateId;
this.renderers = renderers;
}
get templateId() {
return this._templateId;
}
renderTemplate(container) {
return this.renderers.map((r) => r.renderTemplate(container));
}
renderElement(element, index, templateData, height) {
let i = 0;
for (const renderer of this.renderers) {
renderer.renderElement(element, index, templateData[i++], height);
}
}
disposeElement(element, index, templateData, height) {
var _a10;
let i = 0;
for (const renderer of this.renderers) {
(_a10 = renderer.disposeElement) === null || _a10 === void 0 ? void 0 : _a10.call(renderer, element, index, templateData[i], height);
i += 1;
}
}
disposeTemplate(templateData) {
let i = 0;
for (const renderer of this.renderers) {
renderer.disposeTemplate(templateData[i++]);
}
}
};
AccessibiltyRenderer = class {
constructor(accessibilityProvider) {
this.accessibilityProvider = accessibilityProvider;
this.templateId = "a18n";
}
renderTemplate(container) {
return { container, disposables: new DisposableStore() };
}
renderElement(element, index, data) {
const ariaLabel = this.accessibilityProvider.getAriaLabel(element);
const observable = ariaLabel && typeof ariaLabel !== "string" ? ariaLabel : constObservable(ariaLabel);
data.disposables.add(autorun((reader) => {
this.setAriaLabel(reader.readObservable(observable), data.container);
}));
const ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element);
if (typeof ariaLevel === "number") {
data.container.setAttribute("aria-level", `${ariaLevel}`);
} else {
data.container.removeAttribute("aria-level");
}
}
setAriaLabel(ariaLabel, element) {
if (ariaLabel) {
element.setAttribute("aria-label", ariaLabel);
} else {
element.removeAttribute("aria-label");
}
}
disposeElement(element, index, templateData, height) {
templateData.disposables.clear();
}
disposeTemplate(templateData) {
templateData.disposables.dispose();
}
};
ListViewDragAndDrop = class {
constructor(list, dnd) {
this.list = list;
this.dnd = dnd;
}
getDragElements(element) {
const selection = this.list.getSelectedElements();
const elements = selection.indexOf(element) > -1 ? selection : [element];
return elements;
}
getDragURI(element) {
return this.dnd.getDragURI(element);
}
getDragLabel(elements, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(elements, originalEvent);
}
return void 0;
}
onDragStart(data, originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragStart) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, data, originalEvent);
}
onDragOver(data, targetElement, targetIndex, targetSector, originalEvent) {
return this.dnd.onDragOver(data, targetElement, targetIndex, targetSector, originalEvent);
}
onDragLeave(data, targetElement, targetIndex, originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragLeave) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, data, targetElement, targetIndex, originalEvent);
}
onDragEnd(originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragEnd) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, originalEvent);
}
drop(data, targetElement, targetIndex, targetSector, originalEvent) {
this.dnd.drop(data, targetElement, targetIndex, targetSector, originalEvent);
}
dispose() {
this.dnd.dispose();
}
};
List = class {
get onDidChangeFocus() {
return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), (e) => this.toListEvent(e), this.disposables);
}
get onDidChangeSelection() {
return Event.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;
}
/**
* Possible context menu trigger events:
* - ContextMenu key
* - Shift F10
* - Ctrl Option Shift M (macOS with VoiceOver)
* - Mouse right click
*/
get onContextMenu() {
let didJustPressContextMenuKey = false;
const fromKeyDown = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, "keydown")).event, ($16) => $16.map((e) => new StandardKeyboardEvent(e)).filter((e) => didJustPressContextMenuKey = e.keyCode === 58 || e.shiftKey && e.keyCode === 68).map((e) => EventHelper.stop(e, true)).filter(() => false));
const fromKeyUp = Event.chain(this.disposables.add(new DomEmitter(this.view.domNode, "keyup")).event, ($16) => $16.forEach(() => didJustPressContextMenuKey = false).map((e) => new StandardKeyboardEvent(e)).filter((e) => e.keyCode === 58 || e.shiftKey && e.keyCode === 68).map((e) => EventHelper.stop(e, true)).map(({ browserEvent }) => {
const focus = this.getFocus();
const index = focus.length ? focus[0] : void 0;
const element = typeof index !== "undefined" ? this.view.element(index) : void 0;
const anchor = typeof index !== "undefined" ? this.view.domElement(index) : this.view.domNode;
return { index, element, anchor, browserEvent };
}));
const fromMouse = Event.chain(this.view.onContextMenu, ($16) => $16.filter((_) => !didJustPressContextMenuKey).map(({ element, index, browserEvent }) => ({ element, index, anchor: new StandardMouseEvent(getWindow(this.view.domNode), browserEvent), browserEvent })));
return Event.any(fromKeyDown, fromKeyUp, fromMouse);
}
get onKeyDown() {
return this.disposables.add(new DomEmitter(this.view.domNode, "keydown")).event;
}
get onDidFocus() {
return Event.signal(this.disposables.add(new DomEmitter(this.view.domNode, "focus", true)).event);
}
get onDidBlur() {
return Event.signal(this.disposables.add(new DomEmitter(this.view.domNode, "blur", true)).event);
}
constructor(user, container, virtualDelegate, renderers, _options = DefaultOptions2) {
var _a10, _b4, _c2, _d2;
this.user = user;
this._options = _options;
this.focus = new Trait("focused");
this.anchor = new Trait("anchor");
this.eventBufferer = new EventBufferer();
this._ariaLabel = "";
this.disposables = new DisposableStore();
this._onDidDispose = new Emitter();
this.onDidDispose = this._onDidDispose.event;
const role = this._options.accessibilityProvider && this._options.accessibilityProvider.getWidgetRole ? (_a10 = this._options.accessibilityProvider) === null || _a10 === void 0 ? void 0 : _a10.getWidgetRole() : "list";
this.selection = new SelectionTrait(role !== "listbox");
const baseRenderers = [this.focus.renderer, this.selection.renderer];
this.accessibilityProvider = _options.accessibilityProvider;
if (this.accessibilityProvider) {
baseRenderers.push(new AccessibiltyRenderer(this.accessibilityProvider));
(_c2 = (_b4 = this.accessibilityProvider).onDidChangeActiveDescendant) === null || _c2 === void 0 ? void 0 : _c2.call(_b4, this.onDidChangeActiveDescendant, this, this.disposables);
}
renderers = renderers.map((r) => new PipelineRenderer(r.templateId, [...baseRenderers, r]));
const viewOptions = __spreadProps(__spreadValues({}, _options), {
dnd: _options.dnd && new ListViewDragAndDrop(this, _options.dnd)
});
this.view = this.createListView(container, virtualDelegate, renderers, viewOptions);
this.view.domNode.setAttribute("role", role);
if (_options.styleController) {
this.styleController = _options.styleController(this.view.domId);
} else {
const styleElement = createStyleSheet(this.view.domNode);
this.styleController = new DefaultStyleController(styleElement, this.view.domId);
}
this.spliceable = new CombinedSpliceable([
new TraitSpliceable(this.focus, this.view, _options.identityProvider),
new TraitSpliceable(this.selection, this.view, _options.identityProvider),
new TraitSpliceable(this.anchor, this.view, _options.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 DOMFocusController(this, this.view));
if (typeof _options.keyboardSupport !== "boolean" || _options.keyboardSupport) {
this.keyboardController = new KeyboardController(this, this.view, _options);
this.disposables.add(this.keyboardController);
}
if (_options.keyboardNavigationLabelProvider) {
const delegate = _options.keyboardNavigationDelegate || DefaultKeyboardNavigationDelegate;
this.typeNavigationController = new TypeNavigationController(this, this.view, _options.keyboardNavigationLabelProvider, (_d2 = _options.keyboardNavigationEventFilter) !== null && _d2 !== void 0 ? _d2 : () => true, delegate);
this.disposables.add(this.typeNavigationController);
}
this.mouseController = this.createMouseController(_options);
this.disposables.add(this.mouseController);
this.onDidChangeFocus(this._onFocusChange, this, this.disposables);
this.onDidChangeSelection(this._onSelectionChange, this, this.disposables);
if (this.accessibilityProvider) {
this.ariaLabel = this.accessibilityProvider.getWidgetAriaLabel();
}
if (this._options.multipleSelectionSupport !== false) {
this.view.domNode.setAttribute("aria-multiselectable", "true");
}
}
createListView(container, virtualDelegate, renderers, viewOptions) {
return new ListView(container, virtualDelegate, renderers, viewOptions);
}
createMouseController(options2) {
return new MouseController(this);
}
updateOptions(optionsUpdate = {}) {
var _a10, _b4;
this._options = __spreadValues(__spreadValues({}, this._options), optionsUpdate);
(_a10 = this.typeNavigationController) === null || _a10 === void 0 ? void 0 : _a10.updateOptions(this._options);
if (this._options.multipleSelectionController !== void 0) {
if (this._options.multipleSelectionSupport) {
this.view.domNode.setAttribute("aria-multiselectable", "true");
} else {
this.view.domNode.removeAttribute("aria-multiselectable");
}
}
this.mouseController.updateOptions(optionsUpdate);
(_b4 = this.keyboardController) === null || _b4 === void 0 ? void 0 : _b4.updateOptions(optionsUpdate);
this.view.updateOptions(optionsUpdate);
}
get options() {
return this._options;
}
splice(start, deleteCount, elements = []) {
if (start < 0 || start > this.view.length) {
throw new ListError(this.user, `Invalid start index: ${start}`);
}
if (deleteCount < 0) {
throw new ListError(this.user, `Invalid delete count: ${deleteCount}`);
}
if (deleteCount === 0 && elements.length === 0) {
return;
}
this.eventBufferer.bufferEvents(() => this.spliceable.splice(start, deleteCount, elements));
}
rerender() {
this.view.rerender();
}
element(index) {
return this.view.element(index);
}
indexOf(element) {
return this.view.indexOf(element);
}
indexAt(position) {
return this.view.indexAt(position);
}
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(scrollTop) {
this.view.setScrollTop(scrollTop);
}
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(value) {
this._ariaLabel = value;
this.view.domNode.setAttribute("aria-label", value);
}
domFocus() {
this.view.domNode.focus({ preventScroll: true });
}
layout(height, width2) {
this.view.layout(height, width2);
}
setSelection(indexes, browserEvent) {
for (const index of indexes) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, `Invalid index ${index}`);
}
}
this.selection.set(indexes, browserEvent);
}
getSelection() {
return this.selection.get();
}
getSelectedElements() {
return this.getSelection().map((i) => this.view.element(i));
}
setAnchor(index) {
if (typeof index === "undefined") {
this.anchor.set([]);
return;
}
if (index < 0 || index >= this.length) {
throw new ListError(this.user, `Invalid index ${index}`);
}
this.anchor.set([index]);
}
getAnchor() {
return firstOrDefault(this.anchor.get(), void 0);
}
getAnchorElement() {
const anchor = this.getAnchor();
return typeof anchor === "undefined" ? void 0 : this.element(anchor);
}
setFocus(indexes, browserEvent) {
for (const index of indexes) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, `Invalid index ${index}`);
}
}
this.focus.set(indexes, browserEvent);
}
focusNext(n = 1, loop = false, browserEvent, filter) {
if (this.length === 0) {
return;
}
const focus = this.focus.get();
const index = this.findNextIndex(focus.length > 0 ? focus[0] + n : 0, loop, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
}
focusPrevious(n = 1, loop = false, browserEvent, filter) {
if (this.length === 0) {
return;
}
const focus = this.focus.get();
const index = this.findPreviousIndex(focus.length > 0 ? focus[0] - n : 0, loop, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
}
focusNextPage(browserEvent, filter) {
return __async(this, null, function* () {
let lastPageIndex = this.view.indexAt(this.view.getScrollTop() + this.view.renderHeight);
lastPageIndex = lastPageIndex === 0 ? 0 : lastPageIndex - 1;
const currentlyFocusedElementIndex = this.getFocus()[0];
if (currentlyFocusedElementIndex !== lastPageIndex && (currentlyFocusedElementIndex === void 0 || lastPageIndex > currentlyFocusedElementIndex)) {
const lastGoodPageIndex = this.findPreviousIndex(lastPageIndex, false, filter);
if (lastGoodPageIndex > -1 && currentlyFocusedElementIndex !== lastGoodPageIndex) {
this.setFocus([lastGoodPageIndex], browserEvent);
} else {
this.setFocus([lastPageIndex], browserEvent);
}
} else {
const previousScrollTop = this.view.getScrollTop();
let nextpageScrollTop = previousScrollTop + this.view.renderHeight;
if (lastPageIndex > currentlyFocusedElementIndex) {
nextpageScrollTop -= this.view.elementHeight(lastPageIndex);
}
this.view.setScrollTop(nextpageScrollTop);
if (this.view.getScrollTop() !== previousScrollTop) {
this.setFocus([]);
yield timeout(0);
yield this.focusNextPage(browserEvent, filter);
}
}
});
}
focusPreviousPage(browserEvent, filter, getPaddingTop = () => 0) {
return __async(this, null, function* () {
let firstPageIndex;
const paddingTop = getPaddingTop();
const scrollTop = this.view.getScrollTop() + paddingTop;
if (scrollTop === 0) {
firstPageIndex = this.view.indexAt(scrollTop);
} else {
firstPageIndex = this.view.indexAfter(scrollTop - 1);
}
const currentlyFocusedElementIndex = this.getFocus()[0];
if (currentlyFocusedElementIndex !== firstPageIndex && (currentlyFocusedElementIndex === void 0 || currentlyFocusedElementIndex >= firstPageIndex)) {
const firstGoodPageIndex = this.findNextIndex(firstPageIndex, false, filter);
if (firstGoodPageIndex > -1 && currentlyFocusedElementIndex !== firstGoodPageIndex) {
this.setFocus([firstGoodPageIndex], browserEvent);
} else {
this.setFocus([firstPageIndex], browserEvent);
}
} else {
const previousScrollTop = scrollTop;
this.view.setScrollTop(scrollTop - this.view.renderHeight - paddingTop);
if (this.view.getScrollTop() + getPaddingTop() !== previousScrollTop) {
this.setFocus([]);
yield timeout(0);
yield this.focusPreviousPage(browserEvent, filter, getPaddingTop);
}
}
});
}
focusLast(browserEvent, filter) {
if (this.length === 0) {
return;
}
const index = this.findPreviousIndex(this.length - 1, false, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
}
focusFirst(browserEvent, filter) {
this.focusNth(0, browserEvent, filter);
}
focusNth(n, browserEvent, filter) {
if (this.length === 0) {
return;
}
const index = this.findNextIndex(n, false, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
}
findNextIndex(index, loop = false, filter) {
for (let i = 0; i < this.length; i++) {
if (index >= this.length && !loop) {
return -1;
}
index = index % this.length;
if (!filter || filter(this.element(index))) {
return index;
}
index++;
}
return -1;
}
findPreviousIndex(index, loop = false, filter) {
for (let i = 0; i < this.length; i++) {
if (index < 0 && !loop) {
return -1;
}
index = (this.length + index % this.length) % this.length;
if (!filter || filter(this.element(index))) {
return index;
}
index--;
}
return -1;
}
getFocus() {
return this.focus.get();
}
getFocusedElements() {
return this.getFocus().map((i) => this.view.element(i));
}
reveal(index, relativeTop, paddingTop = 0) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, `Invalid index ${index}`);
}
const scrollTop = this.view.getScrollTop();
const elementTop = this.view.elementTop(index);
const elementHeight = this.view.elementHeight(index);
if (isNumber(relativeTop)) {
const m = elementHeight - this.view.renderHeight + paddingTop;
this.view.setScrollTop(m * clamp(relativeTop, 0, 1) + elementTop - paddingTop);
} else {
const viewItemBottom = elementTop + elementHeight;
const scrollBottom = scrollTop + this.view.renderHeight;
if (elementTop < scrollTop + paddingTop && viewItemBottom >= scrollBottom) {
} else if (elementTop < scrollTop + paddingTop || viewItemBottom >= scrollBottom && elementHeight >= this.view.renderHeight) {
this.view.setScrollTop(elementTop - paddingTop);
} else if (viewItemBottom >= scrollBottom) {
this.view.setScrollTop(viewItemBottom - this.view.renderHeight);
}
}
}
/**
* Returns the relative position of an element rendered in the list.
* Returns `null` if the element isn't *entirely* in the visible viewport.
*/
getRelativeTop(index, paddingTop = 0) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, `Invalid index ${index}`);
}
const scrollTop = this.view.getScrollTop();
const elementTop = this.view.elementTop(index);
const elementHeight = this.view.elementHeight(index);
if (elementTop < scrollTop + paddingTop || elementTop + elementHeight > scrollTop + this.view.renderHeight) {
return null;
}
const m = elementHeight - this.view.renderHeight + paddingTop;
return Math.abs((scrollTop + paddingTop - elementTop) / m);
}
getHTMLElement() {
return this.view.domNode;
}
getScrollableElement() {
return this.view.scrollableElementDomNode;
}
getElementID(index) {
return this.view.getElementDomId(index);
}
getElementTop(index) {
return this.view.elementTop(index);
}
style(styles) {
this.styleController.style(styles);
}
toListEvent({ indexes, browserEvent }) {
return { indexes, elements: indexes.map((i) => this.view.element(i)), browserEvent };
}
_onFocusChange() {
const focus = this.focus.get();
this.view.domNode.classList.toggle("element-focused", focus.length > 0);
this.onDidChangeActiveDescendant();
}
onDidChangeActiveDescendant() {
var _a10;
const focus = this.focus.get();
if (focus.length > 0) {
let id;
if ((_a10 = this.accessibilityProvider) === null || _a10 === void 0 ? void 0 : _a10.getActiveDescendantId) {
id = this.accessibilityProvider.getActiveDescendantId(this.view.element(focus[0]));
}
this.view.domNode.setAttribute("aria-activedescendant", id || this.view.getElementDomId(focus[0]));
} else {
this.view.domNode.removeAttribute("aria-activedescendant");
}
}
_onSelectionChange() {
const selection = this.selection.get();
this.view.domNode.classList.toggle("selection-none", selection.length === 0);
this.view.domNode.classList.toggle("selection-single", selection.length === 1);
this.view.domNode.classList.toggle("selection-multiple", selection.length > 1);
}
dispose() {
this._onDidDispose.fire();
this.disposables.dispose();
this._onDidDispose.dispose();
}
};
__decorate27([
memoize
], List.prototype, "onDidChangeFocus", null);
__decorate27([
memoize
], List.prototype, "onDidChangeSelection", null);
__decorate27([
memoize
], List.prototype, "onContextMenu", null);
__decorate27([
memoize
], List.prototype, "onKeyDown", null);
__decorate27([
memoize
], List.prototype, "onDidFocus", null);
__decorate27([
memoize
], List.prototype, "onDidBlur", null);
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css
var init_selectBoxCustom = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js
var $4, SELECT_OPTION_ENTRY_TEMPLATE_ID, SelectListRenderer, SelectBoxList;
var init_selectBoxCustom2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js"() {
init_dom();
init_event2();
init_keyboardEvent();
init_markdownRenderer();
init_hoverDelegate2();
init_hoverDelegateFactory();
init_listWidget();
init_arrays();
init_event();
init_keyCodes();
init_lifecycle();
init_platform();
init_selectBoxCustom();
init_nls();
$4 = $;
SELECT_OPTION_ENTRY_TEMPLATE_ID = "selectOption.entry.template";
SelectListRenderer = class {
get templateId() {
return SELECT_OPTION_ENTRY_TEMPLATE_ID;
}
renderTemplate(container) {
const data = /* @__PURE__ */ Object.create(null);
data.root = container;
data.text = append(container, $4(".option-text"));
data.detail = append(container, $4(".option-detail"));
data.decoratorRight = append(container, $4(".option-decorator-right"));
return data;
}
renderElement(element, index, templateData) {
const data = templateData;
const text2 = element.text;
const detail = element.detail;
const decoratorRight = element.decoratorRight;
const isDisabled = element.isDisabled;
data.text.textContent = text2;
data.detail.textContent = !!detail ? detail : "";
data.decoratorRight.innerText = !!decoratorRight ? decoratorRight : "";
if (isDisabled) {
data.root.classList.add("option-disabled");
} else {
data.root.classList.remove("option-disabled");
}
}
disposeTemplate(_templateData) {
}
};
SelectBoxList = class _SelectBoxList extends Disposable {
constructor(options2, selected, contextViewProvider, styles, selectBoxOptions) {
super();
this.options = [];
this._currentSelection = 0;
this._hasDetails = false;
this._skipLayout = false;
this._sticky = false;
this._isVisible = false;
this.styles = styles;
this.selectBoxOptions = selectBoxOptions || /* @__PURE__ */ Object.create(null);
if (typeof this.selectBoxOptions.minBottomMargin !== "number") {
this.selectBoxOptions.minBottomMargin = _SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN;
} else if (this.selectBoxOptions.minBottomMargin < 0) {
this.selectBoxOptions.minBottomMargin = 0;
}
this.selectElement = document.createElement("select");
this.selectElement.className = "monaco-select-box monaco-select-box-dropdown-padding";
if (typeof this.selectBoxOptions.ariaLabel === "string") {
this.selectElement.setAttribute("aria-label", this.selectBoxOptions.ariaLabel);
}
if (typeof this.selectBoxOptions.ariaDescription === "string") {
this.selectElement.setAttribute("aria-description", this.selectBoxOptions.ariaDescription);
}
this._onDidSelect = new Emitter();
this._register(this._onDidSelect);
this.registerListeners();
this.constructSelectDropDown(contextViewProvider);
this.selected = selected || 0;
if (options2) {
this.setOptions(options2, selected);
}
this.initStyleSheet();
}
setTitle(title) {
if (!this._hover && title) {
this._hover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover(getDefaultHoverDelegate("mouse"), this.selectElement, title));
} else if (this._hover) {
this._hover.update(title);
}
}
// IDelegate - List renderer
getHeight() {
return 22;
}
getTemplateId() {
return SELECT_OPTION_ENTRY_TEMPLATE_ID;
}
constructSelectDropDown(contextViewProvider) {
this.contextViewProvider = contextViewProvider;
this.selectDropDownContainer = $(".monaco-select-box-dropdown-container");
this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding");
this.selectionDetailsPane = append(this.selectDropDownContainer, $4(".select-box-details-pane"));
const widthControlOuterDiv = append(this.selectDropDownContainer, $4(".select-box-dropdown-container-width-control"));
const widthControlInnerDiv = append(widthControlOuterDiv, $4(".width-control-div"));
this.widthControlElement = document.createElement("span");
this.widthControlElement.className = "option-text-width-control";
append(widthControlInnerDiv, this.widthControlElement);
this._dropDownPosition = 0;
this.styleElement = createStyleSheet(this.selectDropDownContainer);
this.selectDropDownContainer.setAttribute("draggable", "true");
this._register(addDisposableListener(this.selectDropDownContainer, EventType.DRAG_START, (e) => {
EventHelper.stop(e, true);
}));
}
registerListeners() {
this._register(addStandardDisposableListener(this.selectElement, "change", (e) => {
this.selected = e.target.selectedIndex;
this._onDidSelect.fire({
index: e.target.selectedIndex,
selected: e.target.value
});
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
this.setTitle(this.options[this.selected].text);
}
}));
this._register(addDisposableListener(this.selectElement, EventType.CLICK, (e) => {
EventHelper.stop(e);
if (this._isVisible) {
this.hideSelectDropDown(true);
} else {
this.showSelectDropDown();
}
}));
this._register(addDisposableListener(this.selectElement, EventType.MOUSE_DOWN, (e) => {
EventHelper.stop(e);
}));
let listIsVisibleOnTouchStart;
this._register(addDisposableListener(this.selectElement, "touchstart", (e) => {
listIsVisibleOnTouchStart = this._isVisible;
}));
this._register(addDisposableListener(this.selectElement, "touchend", (e) => {
EventHelper.stop(e);
if (listIsVisibleOnTouchStart) {
this.hideSelectDropDown(true);
} else {
this.showSelectDropDown();
}
}));
this._register(addDisposableListener(this.selectElement, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
let showDropDown = false;
if (isMacintosh) {
if (event.keyCode === 18 || event.keyCode === 16 || event.keyCode === 10 || event.keyCode === 3) {
showDropDown = true;
}
} else {
if (event.keyCode === 18 && event.altKey || event.keyCode === 16 && event.altKey || event.keyCode === 10 || event.keyCode === 3) {
showDropDown = true;
}
}
if (showDropDown) {
this.showSelectDropDown();
EventHelper.stop(e, true);
}
}));
}
get onDidSelect() {
return this._onDidSelect.event;
}
setOptions(options2, selected) {
if (!equals(this.options, options2)) {
this.options = options2;
this.selectElement.options.length = 0;
this._hasDetails = false;
this._cachedMaxDetailsHeight = void 0;
this.options.forEach((option, index) => {
this.selectElement.add(this.createOption(option.text, index, option.isDisabled));
if (typeof option.description === "string") {
this._hasDetails = true;
}
});
}
if (selected !== void 0) {
this.select(selected);
this._currentSelection = this.selected;
}
}
setOptionsList() {
var _a10;
(_a10 = this.selectList) === null || _a10 === void 0 ? void 0 : _a10.splice(0, this.selectList.length, this.options);
}
select(index) {
if (index >= 0 && index < this.options.length) {
this.selected = index;
} else if (index > this.options.length - 1) {
this.select(this.options.length - 1);
} else if (this.selected < 0) {
this.selected = 0;
}
this.selectElement.selectedIndex = this.selected;
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
this.setTitle(this.options[this.selected].text);
}
}
focus() {
if (this.selectElement) {
this.selectElement.tabIndex = 0;
this.selectElement.focus();
}
}
blur() {
if (this.selectElement) {
this.selectElement.tabIndex = -1;
this.selectElement.blur();
}
}
setFocusable(focusable) {
this.selectElement.tabIndex = focusable ? 0 : -1;
}
render(container) {
this.container = container;
container.classList.add("select-container");
container.appendChild(this.selectElement);
this.styleSelectElement();
}
initStyleSheet() {
const content = [];
if (this.styles.listFocusBackground) {
content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`);
}
if (this.styles.listFocusForeground) {
content.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`);
}
if (this.styles.decoratorRightForeground) {
content.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}; }`);
}
if (this.styles.selectBackground && this.styles.selectBorder && this.styles.selectBorder !== this.styles.selectBackground) {
content.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `);
content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `);
content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `);
} else if (this.styles.selectListBorder) {
content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `);
content.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `);
}
if (this.styles.listHoverForeground) {
content.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; }`);
}
if (this.styles.listHoverBackground) {
content.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; }`);
}
if (this.styles.listFocusOutline) {
content.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; }`);
}
if (this.styles.listHoverOutline) {
content.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; }`);
}
content.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; }`);
content.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 = content.join("\n");
}
styleSelectElement() {
var _a10, _b4, _c2;
const background = (_a10 = this.styles.selectBackground) !== null && _a10 !== void 0 ? _a10 : "";
const foreground2 = (_b4 = this.styles.selectForeground) !== null && _b4 !== void 0 ? _b4 : "";
const border = (_c2 = this.styles.selectBorder) !== null && _c2 !== void 0 ? _c2 : "";
this.selectElement.style.backgroundColor = background;
this.selectElement.style.color = foreground2;
this.selectElement.style.borderColor = border;
}
styleList() {
var _a10, _b4;
const background = (_a10 = this.styles.selectBackground) !== null && _a10 !== void 0 ? _a10 : "";
const listBackground = asCssValueWithDefault(this.styles.selectListBackground, background);
this.selectDropDownListContainer.style.backgroundColor = listBackground;
this.selectionDetailsPane.style.backgroundColor = listBackground;
const optionsBorder = (_b4 = this.styles.focusBorder) !== null && _b4 !== void 0 ? _b4 : "";
this.selectDropDownContainer.style.outlineColor = optionsBorder;
this.selectDropDownContainer.style.outlineOffset = "-1px";
this.selectList.style(this.styles);
}
createOption(value, index, disabled) {
const option = document.createElement("option");
option.value = value;
option.text = value;
option.disabled = !!disabled;
return option;
}
// ContextView dropdown methods
showSelectDropDown() {
this.selectionDetailsPane.innerText = "";
if (!this.contextViewProvider || this._isVisible) {
return;
}
this.createSelectList(this.selectDropDownContainer);
this.setOptionsList();
this.contextViewProvider.showContextView({
getAnchor: () => this.selectElement,
render: (container) => this.renderSelectDropDown(container, true),
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 = true;
this.hideSelectDropDown(false);
this.contextViewProvider.showContextView({
getAnchor: () => this.selectElement,
render: (container) => this.renderSelectDropDown(container),
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 = true;
this.selectElement.setAttribute("aria-expanded", "true");
}
hideSelectDropDown(focusSelect) {
if (!this.contextViewProvider || !this._isVisible) {
return;
}
this._isVisible = false;
this.selectElement.setAttribute("aria-expanded", "false");
if (focusSelect) {
this.selectElement.focus();
}
this.contextViewProvider.hideContextView();
}
renderSelectDropDown(container, preLayoutPosition) {
container.appendChild(this.selectDropDownContainer);
this.layoutSelectDropDown(preLayoutPosition);
return {
dispose: () => {
try {
container.removeChild(this.selectDropDownContainer);
} catch (error) {
}
}
};
}
// Iterate over detailed descriptions, find max height
measureMaxDetailsHeight() {
let maxDetailsPaneHeight = 0;
this.options.forEach((_option, index) => {
this.updateDetail(index);
if (this.selectionDetailsPane.offsetHeight > maxDetailsPaneHeight) {
maxDetailsPaneHeight = this.selectionDetailsPane.offsetHeight;
}
});
return maxDetailsPaneHeight;
}
layoutSelectDropDown(preLayoutPosition) {
if (this._skipLayout) {
return false;
}
if (this.selectList) {
this.selectDropDownContainer.classList.add("visible");
const window2 = getWindow(this.selectElement);
const selectPosition = getDomNodePagePosition(this.selectElement);
const styles = getWindow(this.selectElement).getComputedStyle(this.selectElement);
const verticalPadding = parseFloat(styles.getPropertyValue("--dropdown-padding-top")) + parseFloat(styles.getPropertyValue("--dropdown-padding-bottom"));
const maxSelectDropDownHeightBelow = window2.innerHeight - selectPosition.top - selectPosition.height - (this.selectBoxOptions.minBottomMargin || 0);
const maxSelectDropDownHeightAbove = selectPosition.top - _SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN;
const selectWidth = this.selectElement.offsetWidth;
const selectMinWidth = this.setWidthControlElement(this.widthControlElement);
const selectOptimalWidth = Math.max(selectMinWidth, Math.round(selectWidth)).toString() + "px";
this.selectDropDownContainer.style.width = selectOptimalWidth;
this.selectList.getHTMLElement().style.height = "";
this.selectList.layout();
let listHeight = this.selectList.contentHeight;
if (this._hasDetails && this._cachedMaxDetailsHeight === void 0) {
this._cachedMaxDetailsHeight = this.measureMaxDetailsHeight();
}
const maxDetailsPaneHeight = this._hasDetails ? this._cachedMaxDetailsHeight : 0;
const minRequiredDropDownHeight = listHeight + verticalPadding + maxDetailsPaneHeight;
const maxVisibleOptionsBelow = Math.floor((maxSelectDropDownHeightBelow - verticalPadding - maxDetailsPaneHeight) / this.getHeight());
const maxVisibleOptionsAbove = Math.floor((maxSelectDropDownHeightAbove - verticalPadding - maxDetailsPaneHeight) / this.getHeight());
if (preLayoutPosition) {
if (selectPosition.top + selectPosition.height > window2.innerHeight - 22 || selectPosition.top < _SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN || maxVisibleOptionsBelow < 1 && maxVisibleOptionsAbove < 1) {
return false;
}
if (maxVisibleOptionsBelow < _SelectBoxList.DEFAULT_MINIMUM_VISIBLE_OPTIONS && maxVisibleOptionsAbove > maxVisibleOptionsBelow && this.options.length > maxVisibleOptionsBelow) {
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");
} else {
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");
}
return true;
}
if (selectPosition.top + selectPosition.height > window2.innerHeight - 22 || selectPosition.top < _SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN || this._dropDownPosition === 0 && maxVisibleOptionsBelow < 1 || this._dropDownPosition === 1 && maxVisibleOptionsAbove < 1) {
this.hideSelectDropDown(true);
return false;
}
if (this._dropDownPosition === 0) {
if (this._isVisible && maxVisibleOptionsBelow + maxVisibleOptionsAbove < 1) {
this.hideSelectDropDown(true);
return false;
}
if (minRequiredDropDownHeight > maxSelectDropDownHeightBelow) {
listHeight = maxVisibleOptionsBelow * this.getHeight();
}
} else {
if (minRequiredDropDownHeight > maxSelectDropDownHeightAbove) {
listHeight = maxVisibleOptionsAbove * this.getHeight();
}
}
this.selectList.layout(listHeight);
this.selectList.domFocus();
if (this.selectList.length > 0) {
this.selectList.setFocus([this.selected || 0]);
this.selectList.reveal(this.selectList.getFocus()[0] || 0);
}
if (this._hasDetails) {
this.selectList.getHTMLElement().style.height = listHeight + verticalPadding + "px";
this.selectDropDownContainer.style.height = "";
} else {
this.selectDropDownContainer.style.height = listHeight + verticalPadding + "px";
}
this.updateDetail(this.selected);
this.selectDropDownContainer.style.width = selectOptimalWidth;
this.selectDropDownListContainer.setAttribute("tabindex", "0");
this.selectElement.classList.add("synthetic-focus");
this.selectDropDownContainer.classList.add("synthetic-focus");
return true;
} else {
return false;
}
}
setWidthControlElement(container) {
let elementWidth = 0;
if (container) {
let longest = 0;
let longestLength = 0;
this.options.forEach((option, index) => {
const detailLength = !!option.detail ? option.detail.length : 0;
const rightDecoratorLength = !!option.decoratorRight ? option.decoratorRight.length : 0;
const len = option.text.length + detailLength + rightDecoratorLength;
if (len > longestLength) {
longest = index;
longestLength = len;
}
});
container.textContent = this.options[longest].text + (!!this.options[longest].decoratorRight ? this.options[longest].decoratorRight + " " : "");
elementWidth = getTotalWidth(container);
}
return elementWidth;
}
createSelectList(parent) {
if (this.selectList) {
return;
}
this.selectDropDownListContainer = append(parent, $4(".select-box-dropdown-list-container"));
this.listRenderer = new SelectListRenderer();
this.selectList = new List("SelectBoxCustom", this.selectDropDownListContainer, this, [this.listRenderer], {
useShadows: false,
verticalScrollMode: 3,
keyboardSupport: false,
mouseSupport: false,
accessibilityProvider: {
getAriaLabel: (element) => {
let label = element.text;
if (element.detail) {
label += `. ${element.detail}`;
}
if (element.decoratorRight) {
label += `. ${element.decoratorRight}`;
}
if (element.description) {
label += `. ${element.description}`;
}
return label;
},
getWidgetAriaLabel: () => localize({ key: "selectBox", comment: ["Behave like native select dropdown element."] }, "Select Box"),
getRole: () => isMacintosh ? "" : "option",
getWidgetRole: () => "listbox"
}
});
if (this.selectBoxOptions.ariaLabel) {
this.selectList.ariaLabel = this.selectBoxOptions.ariaLabel;
}
const onKeyDown = this._register(new DomEmitter(this.selectDropDownListContainer, "keydown"));
const onSelectDropDownKeyDown = Event.chain(onKeyDown.event, ($16) => $16.filter(() => this.selectList.length > 0).map((e) => new StandardKeyboardEvent(e)));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 3
/* KeyCode.Enter */
))(this.onEnter, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 2
/* KeyCode.Tab */
))(this.onEnter, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 9
/* KeyCode.Escape */
))(this.onEscape, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 16
/* KeyCode.UpArrow */
))(this.onUpArrow, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 18
/* KeyCode.DownArrow */
))(this.onDownArrow, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 12
/* KeyCode.PageDown */
))(this.onPageDown, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 11
/* KeyCode.PageUp */
))(this.onPageUp, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 14
/* KeyCode.Home */
))(this.onHome, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 13
/* KeyCode.End */
))(this.onEnd, this));
this._register(Event.chain(onSelectDropDownKeyDown, ($16) => $16.filter((e) => e.keyCode >= 21 && e.keyCode <= 56 || e.keyCode >= 85 && e.keyCode <= 113))(this.onCharacter, this));
this._register(addDisposableListener(this.selectList.getHTMLElement(), EventType.POINTER_UP, (e) => this.onPointerUp(e)));
this._register(this.selectList.onMouseOver((e) => typeof e.index !== "undefined" && this.selectList.setFocus([e.index])));
this._register(this.selectList.onDidChangeFocus((e) => this.onListFocus(e)));
this._register(addDisposableListener(this.selectDropDownContainer, EventType.FOCUS_OUT, (e) => {
if (!this._isVisible || isAncestor(e.relatedTarget, this.selectDropDownContainer)) {
return;
}
this.onListBlur();
}));
this.selectList.getHTMLElement().setAttribute("aria-label", this.selectBoxOptions.ariaLabel || "");
this.selectList.getHTMLElement().setAttribute("aria-expanded", "true");
this.styleList();
}
// List methods
// List mouse controller - active exit, select option, fire onDidSelect if change, return focus to parent select
// Also takes in touchend events
onPointerUp(e) {
if (!this.selectList.length) {
return;
}
EventHelper.stop(e);
const target = e.target;
if (!target) {
return;
}
if (target.classList.contains("slider")) {
return;
}
const listRowElement = target.closest(".monaco-list-row");
if (!listRowElement) {
return;
}
const index = Number(listRowElement.getAttribute("data-index"));
const disabled = listRowElement.classList.contains("option-disabled");
if (index >= 0 && index < this.options.length && !disabled) {
this.selected = index;
this.select(this.selected);
this.selectList.setFocus([this.selected]);
this.selectList.reveal(this.selectList.getFocus()[0]);
if (this.selected !== this._currentSelection) {
this._currentSelection = this.selected;
this._onDidSelect.fire({
index: this.selectElement.selectedIndex,
selected: this.options[this.selected].text
});
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
this.setTitle(this.options[this.selected].text);
}
}
this.hideSelectDropDown(true);
}
}
// List Exit - passive - implicit no selection change, hide drop-down
onListBlur() {
if (this._sticky) {
return;
}
if (this.selected !== this._currentSelection) {
this.select(this._currentSelection);
}
this.hideSelectDropDown(false);
}
renderDescriptionMarkdown(text2, actionHandler) {
const cleanRenderedMarkdown = (element) => {
for (let i = 0; i < element.childNodes.length; i++) {
const child = element.childNodes.item(i);
const tagName = child.tagName && child.tagName.toLowerCase();
if (tagName === "img") {
element.removeChild(child);
} else {
cleanRenderedMarkdown(child);
}
}
};
const rendered = renderMarkdown({ value: text2, supportThemeIcons: true }, { actionHandler });
rendered.element.classList.add("select-box-description-markdown");
cleanRenderedMarkdown(rendered.element);
return rendered.element;
}
// List Focus Change - passive - update details pane with newly focused element's data
onListFocus(e) {
if (!this._isVisible || !this._hasDetails) {
return;
}
this.updateDetail(e.indexes[0]);
}
updateDetail(selectedIndex) {
var _a10, _b4;
this.selectionDetailsPane.innerText = "";
const option = this.options[selectedIndex];
const description = (_a10 = option === null || option === void 0 ? void 0 : option.description) !== null && _a10 !== void 0 ? _a10 : "";
const descriptionIsMarkdown = (_b4 = option === null || option === void 0 ? void 0 : option.descriptionIsMarkdown) !== null && _b4 !== void 0 ? _b4 : false;
if (description) {
if (descriptionIsMarkdown) {
const actionHandler = option.descriptionMarkdownActionHandler;
this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(description, actionHandler));
} else {
this.selectionDetailsPane.innerText = description;
}
this.selectionDetailsPane.style.display = "block";
} else {
this.selectionDetailsPane.style.display = "none";
}
this._skipLayout = true;
this.contextViewProvider.layout();
this._skipLayout = false;
}
// List keyboard controller
// List exit - active - hide ContextView dropdown, reset selection, return focus to parent select
onEscape(e) {
EventHelper.stop(e);
this.select(this._currentSelection);
this.hideSelectDropDown(true);
}
// List exit - active - hide ContextView dropdown, return focus to parent select, fire onDidSelect if change
onEnter(e) {
EventHelper.stop(e);
if (this.selected !== this._currentSelection) {
this._currentSelection = this.selected;
this._onDidSelect.fire({
index: this.selectElement.selectedIndex,
selected: this.options[this.selected].text
});
if (!!this.options[this.selected] && !!this.options[this.selected].text) {
this.setTitle(this.options[this.selected].text);
}
}
this.hideSelectDropDown(true);
}
// List navigation - have to handle a disabled option (jump over)
onDownArrow(e) {
if (this.selected < this.options.length - 1) {
EventHelper.stop(e, true);
const nextOptionDisabled = this.options[this.selected + 1].isDisabled;
if (nextOptionDisabled && this.options.length > this.selected + 2) {
this.selected += 2;
} else if (nextOptionDisabled) {
return;
} else {
this.selected++;
}
this.select(this.selected);
this.selectList.setFocus([this.selected]);
this.selectList.reveal(this.selectList.getFocus()[0]);
}
}
onUpArrow(e) {
if (this.selected > 0) {
EventHelper.stop(e, true);
const previousOptionDisabled = this.options[this.selected - 1].isDisabled;
if (previousOptionDisabled && this.selected > 1) {
this.selected -= 2;
} else {
this.selected--;
}
this.select(this.selected);
this.selectList.setFocus([this.selected]);
this.selectList.reveal(this.selectList.getFocus()[0]);
}
}
onPageUp(e) {
EventHelper.stop(e);
this.selectList.focusPreviousPage();
setTimeout(() => {
this.selected = this.selectList.getFocus()[0];
if (this.options[this.selected].isDisabled && this.selected < this.options.length - 1) {
this.selected++;
this.selectList.setFocus([this.selected]);
}
this.selectList.reveal(this.selected);
this.select(this.selected);
}, 1);
}
onPageDown(e) {
EventHelper.stop(e);
this.selectList.focusNextPage();
setTimeout(() => {
this.selected = this.selectList.getFocus()[0];
if (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) {
EventHelper.stop(e);
if (this.options.length < 2) {
return;
}
this.selected = 0;
if (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) {
EventHelper.stop(e);
if (this.options.length < 2) {
return;
}
this.selected = this.options.length - 1;
if (this.options[this.selected].isDisabled && this.selected > 1) {
this.selected--;
}
this.selectList.setFocus([this.selected]);
this.selectList.reveal(this.selected);
this.select(this.selected);
}
// Mimic option first character navigation of native select
onCharacter(e) {
const ch = KeyCodeUtils.toString(e.keyCode);
let optionIndex = -1;
for (let i = 0; i < this.options.length - 1; i++) {
optionIndex = (i + this.selected + 1) % this.options.length;
if (this.options[optionIndex].text.charAt(0).toUpperCase() === ch && !this.options[optionIndex].isDisabled) {
this.select(optionIndex);
this.selectList.setFocus([optionIndex]);
this.selectList.reveal(this.selectList.getFocus()[0]);
EventHelper.stop(e);
break;
}
}
}
dispose() {
this.hideSelectDropDown(false);
super.dispose();
}
};
SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN = 32;
SelectBoxList.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN = 2;
SelectBoxList.DEFAULT_MINIMUM_VISIBLE_OPTIONS = 3;
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js
var SelectBoxNative;
var init_selectBoxNative = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBoxNative.js"() {
init_dom();
init_touch();
init_arrays();
init_event();
init_lifecycle();
init_platform();
SelectBoxNative = class extends Disposable {
constructor(options2, selected, styles, selectBoxOptions) {
super();
this.selected = 0;
this.selectBoxOptions = selectBoxOptions || /* @__PURE__ */ Object.create(null);
this.options = [];
this.selectElement = document.createElement("select");
this.selectElement.className = "monaco-select-box";
if (typeof this.selectBoxOptions.ariaLabel === "string") {
this.selectElement.setAttribute("aria-label", this.selectBoxOptions.ariaLabel);
}
if (typeof this.selectBoxOptions.ariaDescription === "string") {
this.selectElement.setAttribute("aria-description", this.selectBoxOptions.ariaDescription);
}
this._onDidSelect = this._register(new Emitter());
this.styles = styles;
this.registerListeners();
this.setOptions(options2, selected);
}
registerListeners() {
this._register(Gesture.addTarget(this.selectElement));
[EventType2.Tap].forEach((eventType) => {
this._register(addDisposableListener(this.selectElement, eventType, (e) => {
this.selectElement.focus();
}));
});
this._register(addStandardDisposableListener(this.selectElement, "click", (e) => {
EventHelper.stop(e, true);
}));
this._register(addStandardDisposableListener(this.selectElement, "change", (e) => {
this.selectElement.title = e.target.value;
this._onDidSelect.fire({
index: e.target.selectedIndex,
selected: e.target.value
});
}));
this._register(addStandardDisposableListener(this.selectElement, "keydown", (e) => {
let showSelect = false;
if (isMacintosh) {
if (e.keyCode === 18 || e.keyCode === 16 || e.keyCode === 10) {
showSelect = true;
}
} else {
if (e.keyCode === 18 && e.altKey || e.keyCode === 10 || e.keyCode === 3) {
showSelect = true;
}
}
if (showSelect) {
e.stopPropagation();
}
}));
}
get onDidSelect() {
return this._onDidSelect.event;
}
setOptions(options2, selected) {
if (!this.options || !equals(this.options, options2)) {
this.options = options2;
this.selectElement.options.length = 0;
this.options.forEach((option, index) => {
this.selectElement.add(this.createOption(option.text, index, option.isDisabled));
});
}
if (selected !== void 0) {
this.select(selected);
}
}
select(index) {
if (this.options.length === 0) {
this.selected = 0;
} else if (index >= 0 && index < this.options.length) {
this.selected = index;
} else if (index > this.options.length - 1) {
this.select(this.options.length - 1);
} else if (this.selected < 0) {
this.selected = 0;
}
this.selectElement.selectedIndex = this.selected;
if (this.selected < this.options.length && typeof this.options[this.selected].text === "string") {
this.selectElement.title = this.options[this.selected].text;
} else {
this.selectElement.title = "";
}
}
focus() {
if (this.selectElement) {
this.selectElement.tabIndex = 0;
this.selectElement.focus();
}
}
blur() {
if (this.selectElement) {
this.selectElement.tabIndex = -1;
this.selectElement.blur();
}
}
setFocusable(focusable) {
this.selectElement.tabIndex = focusable ? 0 : -1;
}
render(container) {
container.classList.add("select-container");
container.appendChild(this.selectElement);
this.setOptions(this.options, this.selected);
this.applyStyles();
}
applyStyles() {
var _a10, _b4, _c2;
if (this.selectElement) {
this.selectElement.style.backgroundColor = (_a10 = this.styles.selectBackground) !== null && _a10 !== void 0 ? _a10 : "";
this.selectElement.style.color = (_b4 = this.styles.selectForeground) !== null && _b4 !== void 0 ? _b4 : "";
this.selectElement.style.borderColor = (_c2 = this.styles.selectBorder) !== null && _c2 !== void 0 ? _c2 : "";
}
}
createOption(value, index, disabled) {
const option = document.createElement("option");
option.value = value;
option.text = value;
option.disabled = !!disabled;
return option;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.css
var init_selectBox = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js
var SelectBox;
var init_selectBox2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/selectBox/selectBox.js"() {
init_selectBoxCustom2();
init_selectBoxNative();
init_widget();
init_platform();
init_selectBox();
SelectBox = class extends Widget {
constructor(options2, selected, contextViewProvider, styles, selectBoxOptions) {
super();
if (isMacintosh && !(selectBoxOptions === null || selectBoxOptions === void 0 ? void 0 : selectBoxOptions.useCustomDrawn)) {
this.selectBoxDelegate = new SelectBoxNative(options2, selected, styles, selectBoxOptions);
} else {
this.selectBoxDelegate = new SelectBoxList(options2, selected, contextViewProvider, styles, selectBoxOptions);
}
this._register(this.selectBoxDelegate);
}
// Public SelectBox Methods - routed through delegate interface
get onDidSelect() {
return this.selectBoxDelegate.onDidSelect;
}
setOptions(options2, selected) {
this.selectBoxDelegate.setOptions(options2, selected);
}
select(index) {
this.selectBoxDelegate.select(index);
}
focus() {
this.selectBoxDelegate.focus();
}
blur() {
this.selectBoxDelegate.blur();
}
setFocusable(focusable) {
this.selectBoxDelegate.setFocusable(focusable);
}
render(container) {
this.selectBoxDelegate.render(container);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css
var init_actionbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js
var BaseActionViewItem, ActionViewItem, SelectActionViewItem;
var init_actionViewItems = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js"() {
init_browser();
init_dnd();
init_dom();
init_touch();
init_hoverDelegateFactory();
init_selectBox2();
init_actions();
init_lifecycle();
init_platform();
init_types();
init_actionbar();
init_nls();
init_hoverDelegate2();
BaseActionViewItem = class extends Disposable {
get action() {
return this._action;
}
constructor(context, action, options2 = {}) {
super();
this.options = options2;
this._context = context || this;
this._action = action;
if (action instanceof Action) {
this._register(action.onDidChange((event) => {
if (!this.element) {
return;
}
this.handleActionChangeEvent(event);
}));
}
}
handleActionChangeEvent(event) {
if (event.enabled !== void 0) {
this.updateEnabled();
}
if (event.checked !== void 0) {
this.updateChecked();
}
if (event.class !== void 0) {
this.updateClass();
}
if (event.label !== void 0) {
this.updateLabel();
this.updateTooltip();
}
if (event.tooltip !== void 0) {
this.updateTooltip();
}
}
get actionRunner() {
if (!this._actionRunner) {
this._actionRunner = this._register(new ActionRunner());
}
return this._actionRunner;
}
set actionRunner(actionRunner) {
this._actionRunner = actionRunner;
}
isEnabled() {
return this._action.enabled;
}
setActionContext(newContext) {
this._context = newContext;
}
render(container) {
const element = this.element = container;
this._register(Gesture.addTarget(container));
const enableDragging = this.options && this.options.draggable;
if (enableDragging) {
container.draggable = true;
if (isFirefox2) {
this._register(addDisposableListener(container, EventType.DRAG_START, (e) => {
var _a10;
return (_a10 = e.dataTransfer) === null || _a10 === void 0 ? void 0 : _a10.setData(DataTransfers.TEXT, this._action.label);
}));
}
}
this._register(addDisposableListener(element, EventType2.Tap, (e) => this.onClick(e, true)));
this._register(addDisposableListener(element, EventType.MOUSE_DOWN, (e) => {
if (!enableDragging) {
EventHelper.stop(e, true);
}
if (this._action.enabled && e.button === 0) {
element.classList.add("active");
}
}));
if (isMacintosh) {
this._register(addDisposableListener(element, EventType.CONTEXT_MENU, (e) => {
if (e.button === 0 && e.ctrlKey === true) {
this.onClick(e);
}
}));
}
this._register(addDisposableListener(element, EventType.CLICK, (e) => {
EventHelper.stop(e, true);
if (!(this.options && this.options.isMenu)) {
this.onClick(e);
}
}));
this._register(addDisposableListener(element, EventType.DBLCLICK, (e) => {
EventHelper.stop(e, true);
}));
[EventType.MOUSE_UP, EventType.MOUSE_OUT].forEach((event) => {
this._register(addDisposableListener(element, event, (e) => {
EventHelper.stop(e);
element.classList.remove("active");
}));
});
}
onClick(event, preserveFocus = false) {
var _a10;
EventHelper.stop(event, true);
const context = isUndefinedOrNull(this._context) ? ((_a10 = this.options) === null || _a10 === void 0 ? void 0 : _a10.useEventAsContext) ? event : { preserveFocus } : this._context;
this.actionRunner.run(this._action, context);
}
// Only set the tabIndex on the element once it is about to get focused
// That way this element wont be a tab stop when it is not needed #106441
focus() {
if (this.element) {
this.element.tabIndex = 0;
this.element.focus();
this.element.classList.add("focused");
}
}
blur() {
if (this.element) {
this.element.blur();
this.element.tabIndex = -1;
this.element.classList.remove("focused");
}
}
setFocusable(focusable) {
if (this.element) {
this.element.tabIndex = focusable ? 0 : -1;
}
}
get trapsArrowNavigation() {
return false;
}
updateEnabled() {
}
updateLabel() {
}
getClass() {
return this.action.class;
}
getTooltip() {
return this.action.tooltip;
}
updateTooltip() {
var _a10, _b4, _c2;
if (!this.element) {
return;
}
const title = (_a10 = this.getTooltip()) !== null && _a10 !== void 0 ? _a10 : "";
this.updateAriaLabel();
if ((_b4 = this.options.hoverDelegate) === null || _b4 === void 0 ? void 0 : _b4.showNativeHover) {
this.element.title = title;
} else {
if (!this.customHover && title !== "") {
const hoverDelegate = (_c2 = this.options.hoverDelegate) !== null && _c2 !== void 0 ? _c2 : getDefaultHoverDelegate("element");
this.customHover = this._store.add(getBaseLayerHoverDelegate().setupUpdatableHover(hoverDelegate, this.element, title));
} else if (this.customHover) {
this.customHover.update(title);
}
}
}
updateAriaLabel() {
var _a10;
if (this.element) {
const title = (_a10 = this.getTooltip()) !== null && _a10 !== void 0 ? _a10 : "";
this.element.setAttribute("aria-label", title);
}
}
updateClass() {
}
updateChecked() {
}
dispose() {
if (this.element) {
this.element.remove();
this.element = void 0;
}
this._context = void 0;
super.dispose();
}
};
ActionViewItem = class extends BaseActionViewItem {
constructor(context, action, options2) {
super(context, action, options2);
this.options = options2;
this.options.icon = options2.icon !== void 0 ? options2.icon : false;
this.options.label = options2.label !== void 0 ? options2.label : true;
this.cssClass = "";
}
render(container) {
super.render(container);
assertType(this.element);
const label = document.createElement("a");
label.classList.add("action-label");
label.setAttribute("role", this.getDefaultAriaRole());
this.label = label;
this.element.appendChild(label);
if (this.options.label && this.options.keybinding) {
const kbLabel = document.createElement("span");
kbLabel.classList.add("keybinding");
kbLabel.textContent = this.options.keybinding;
this.element.appendChild(kbLabel);
}
this.updateClass();
this.updateLabel();
this.updateTooltip();
this.updateEnabled();
this.updateChecked();
}
getDefaultAriaRole() {
if (this._action.id === Separator.ID) {
return "presentation";
} else {
if (this.options.isMenu) {
return "menuitem";
} else {
return "button";
}
}
}
// Only set the tabIndex on the element once it is about to get focused
// That way this element wont be a tab stop when it is not needed #106441
focus() {
if (this.label) {
this.label.tabIndex = 0;
this.label.focus();
}
}
blur() {
if (this.label) {
this.label.tabIndex = -1;
}
}
setFocusable(focusable) {
if (this.label) {
this.label.tabIndex = focusable ? 0 : -1;
}
}
updateLabel() {
if (this.options.label && this.label) {
this.label.textContent = this.action.label;
}
}
getTooltip() {
let title = null;
if (this.action.tooltip) {
title = this.action.tooltip;
} else if (!this.options.label && this.action.label && this.options.icon) {
title = this.action.label;
if (this.options.keybinding) {
title = localize({ key: "titleLabel", comment: ["action title", "action keybinding"] }, "{0} ({1})", title, this.options.keybinding);
}
}
return title !== null && title !== void 0 ? title : void 0;
}
updateClass() {
var _a10;
if (this.cssClass && this.label) {
this.label.classList.remove(...this.cssClass.split(" "));
}
if (this.options.icon) {
this.cssClass = this.getClass();
if (this.label) {
this.label.classList.add("codicon");
if (this.cssClass) {
this.label.classList.add(...this.cssClass.split(" "));
}
}
this.updateEnabled();
} else {
(_a10 = this.label) === null || _a10 === void 0 ? void 0 : _a10.classList.remove("codicon");
}
}
updateEnabled() {
var _a10, _b4;
if (this.action.enabled) {
if (this.label) {
this.label.removeAttribute("aria-disabled");
this.label.classList.remove("disabled");
}
(_a10 = this.element) === null || _a10 === void 0 ? void 0 : _a10.classList.remove("disabled");
} else {
if (this.label) {
this.label.setAttribute("aria-disabled", "true");
this.label.classList.add("disabled");
}
(_b4 = this.element) === null || _b4 === void 0 ? void 0 : _b4.classList.add("disabled");
}
}
updateAriaLabel() {
var _a10;
if (this.label) {
const title = (_a10 = this.getTooltip()) !== null && _a10 !== void 0 ? _a10 : "";
this.label.setAttribute("aria-label", title);
}
}
updateChecked() {
if (this.label) {
if (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");
} else {
this.label.classList.remove("checked");
this.label.removeAttribute("aria-checked");
this.label.setAttribute("role", this.getDefaultAriaRole());
}
}
}
};
SelectActionViewItem = class extends BaseActionViewItem {
constructor(ctx, action, options2, selected, contextViewProvider, styles, selectBoxOptions) {
super(ctx, action);
this.selectBox = new SelectBox(options2, selected, contextViewProvider, styles, selectBoxOptions);
this.selectBox.setFocusable(false);
this._register(this.selectBox);
this.registerListeners();
}
select(index) {
this.selectBox.select(index);
}
registerListeners() {
this._register(this.selectBox.onDidSelect((e) => this.runAction(e.selected, e.index)));
}
runAction(option, index) {
this.actionRunner.run(this._action, this.getActionContext(option, index));
}
getActionContext(option, index) {
return option;
}
setFocusable(focusable) {
this.selectBox.setFocusable(focusable);
}
focus() {
var _a10;
(_a10 = this.selectBox) === null || _a10 === void 0 ? void 0 : _a10.focus();
}
blur() {
var _a10;
(_a10 = this.selectBox) === null || _a10 === void 0 ? void 0 : _a10.blur();
}
render(container) {
this.selectBox.render(container);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css
var init_dropdown = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js
var BaseDropdown, DropdownMenu;
var init_dropdown2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdown.js"() {
init_dom();
init_keyboardEvent();
init_touch();
init_actions();
init_event();
init_dropdown();
BaseDropdown = class extends ActionRunner {
constructor(container, options2) {
super();
this._onDidChangeVisibility = this._register(new Emitter());
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
this._element = append(container, $(".monaco-dropdown"));
this._label = append(this._element, $(".dropdown-label"));
let labelRenderer = options2.labelRenderer;
if (!labelRenderer) {
labelRenderer = (container2) => {
container2.textContent = options2.label || "";
return null;
};
}
for (const event of [EventType.CLICK, EventType.MOUSE_DOWN, EventType2.Tap]) {
this._register(addDisposableListener(this.element, event, (e) => EventHelper.stop(e, true)));
}
for (const event of [EventType.MOUSE_DOWN, EventType2.Tap]) {
this._register(addDisposableListener(this._label, event, (e) => {
if (isMouseEvent(e) && (e.detail > 1 || e.button !== 0)) {
return;
}
if (this.visible) {
this.hide();
} else {
this.show();
}
}));
}
this._register(addDisposableListener(this._label, EventType.KEY_UP, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
3
/* KeyCode.Enter */
) || event.equals(
10
/* KeyCode.Space */
)) {
EventHelper.stop(e, true);
if (this.visible) {
this.hide();
} else {
this.show();
}
}
}));
const cleanupFn = labelRenderer(this._label);
if (cleanupFn) {
this._register(cleanupFn);
}
this._register(Gesture.addTarget(this._label));
}
get element() {
return this._element;
}
show() {
if (!this.visible) {
this.visible = true;
this._onDidChangeVisibility.fire(true);
}
}
hide() {
if (this.visible) {
this.visible = false;
this._onDidChangeVisibility.fire(false);
}
}
dispose() {
super.dispose();
this.hide();
if (this.boxContainer) {
this.boxContainer.remove();
this.boxContainer = void 0;
}
if (this.contents) {
this.contents.remove();
this.contents = void 0;
}
if (this._label) {
this._label.remove();
this._label = void 0;
}
}
};
DropdownMenu = class extends BaseDropdown {
constructor(container, _options) {
super(container, _options);
this._options = _options;
this._actions = [];
this.actions = _options.actions || [];
}
set menuOptions(options2) {
this._menuOptions = options2;
}
get menuOptions() {
return this._menuOptions;
}
get actions() {
if (this._options.actionProvider) {
return this._options.actionProvider.getActions();
}
return this._actions;
}
set actions(actions) {
this._actions = actions;
}
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: (action, options2) => this.menuOptions && this.menuOptions.actionViewItemProvider ? this.menuOptions.actionViewItemProvider(action, options2) : void 0,
getKeyBinding: (action) => this.menuOptions && this.menuOptions.getKeyBinding ? this.menuOptions.getKeyBinding(action) : 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");
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js
var DropdownMenuActionViewItem;
var init_dropdownActionViewItem = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js"() {
init_dom();
init_actionViewItems();
init_dropdown2();
init_event();
init_dropdown();
init_hoverDelegateFactory();
init_hoverDelegate2();
DropdownMenuActionViewItem = class extends BaseActionViewItem {
constructor(action, menuActionsOrProvider, contextMenuProvider, options2 = /* @__PURE__ */ Object.create(null)) {
super(null, action, options2);
this.actionItem = null;
this._onDidChangeVisibility = this._register(new Emitter());
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
this.menuActionsOrProvider = menuActionsOrProvider;
this.contextMenuProvider = contextMenuProvider;
this.options = options2;
if (this.options.actionRunner) {
this.actionRunner = this.options.actionRunner;
}
}
render(container) {
this.actionItem = container;
const labelRenderer = (el) => {
var _a10;
this.element = append(el, $("a.action-label"));
let classNames = [];
if (typeof this.options.classNames === "string") {
classNames = this.options.classNames.split(/\s+/g).filter((s) => !!s);
} else if (this.options.classNames) {
classNames = this.options.classNames;
}
if (!classNames.find((c) => c === "icon")) {
classNames.push("codicon");
}
this.element.classList.add(...classNames);
this.element.setAttribute("role", "button");
this.element.setAttribute("aria-haspopup", "true");
this.element.setAttribute("aria-expanded", "false");
if (this._action.label) {
this._register(getBaseLayerHoverDelegate().setupUpdatableHover((_a10 = this.options.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("mouse"), this.element, this._action.label));
}
this.element.ariaLabel = this._action.label || "";
return null;
};
const isActionsArray = Array.isArray(this.menuActionsOrProvider);
const options2 = {
contextMenuProvider: this.contextMenuProvider,
labelRenderer,
menuAsChild: this.options.menuAsChild,
actions: isActionsArray ? this.menuActionsOrProvider : void 0,
actionProvider: isActionsArray ? void 0 : this.menuActionsOrProvider,
skipTelemetry: this.options.skipTelemetry
};
this.dropdownMenu = this._register(new DropdownMenu(container, options2));
this._register(this.dropdownMenu.onDidChangeVisibility((visible) => {
var _a10;
(_a10 = this.element) === null || _a10 === void 0 ? void 0 : _a10.setAttribute("aria-expanded", `${visible}`);
this._onDidChangeVisibility.fire(visible);
}));
this.dropdownMenu.menuOptions = {
actionViewItemProvider: this.options.actionViewItemProvider,
actionRunner: this.actionRunner,
getKeyBinding: this.options.keybindingProvider,
context: this._context
};
if (this.options.anchorAlignmentProvider) {
const that = this;
this.dropdownMenu.menuOptions = __spreadProps(__spreadValues({}, this.dropdownMenu.menuOptions), {
get anchorAlignment() {
return that.options.anchorAlignmentProvider();
}
});
}
this.updateTooltip();
this.updateEnabled();
}
getTooltip() {
let title = null;
if (this.action.tooltip) {
title = this.action.tooltip;
} else if (this.action.label) {
title = this.action.label;
}
return title !== null && title !== void 0 ? title : void 0;
}
setActionContext(newContext) {
super.setActionContext(newContext);
if (this.dropdownMenu) {
if (this.dropdownMenu.menuOptions) {
this.dropdownMenu.menuOptions.context = newContext;
} else {
this.dropdownMenu.menuOptions = { context: newContext };
}
}
}
show() {
var _a10;
(_a10 = this.dropdownMenu) === null || _a10 === void 0 ? void 0 : _a10.show();
}
updateEnabled() {
var _a10, _b4;
const disabled = !this.action.enabled;
(_a10 = this.actionItem) === null || _a10 === void 0 ? void 0 : _a10.classList.toggle("disabled", disabled);
(_b4 = this.element) === null || _b4 === void 0 ? void 0 : _b4.classList.toggle("disabled", disabled);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.css
var init_menuEntryActionViewItem = __esm({
"node_modules/monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.css"() {
}
});
// node_modules/monaco-editor/esm/vs/platform/action/common/action.js
function isLocalizedString(thing) {
return thing && typeof thing === "object" && typeof thing.original === "string" && typeof thing.value === "string";
}
function isICommandActionToggleInfo(thing) {
return thing ? thing.condition !== void 0 : false;
}
var init_action = __esm({
"node_modules/monaco-editor/esm/vs/platform/action/common/action.js"() {
}
});
// node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js
var StorageHint, StorageState, Storage, InMemoryStorageDatabase;
var init_storage = __esm({
"node_modules/monaco-editor/esm/vs/base/parts/storage/common/storage.js"() {
init_async();
init_event();
init_lifecycle();
init_marshalling();
init_types();
(function(StorageHint2) {
StorageHint2[StorageHint2["STORAGE_DOES_NOT_EXIST"] = 0] = "STORAGE_DOES_NOT_EXIST";
StorageHint2[StorageHint2["STORAGE_IN_MEMORY"] = 1] = "STORAGE_IN_MEMORY";
})(StorageHint || (StorageHint = {}));
(function(StorageState2) {
StorageState2[StorageState2["None"] = 0] = "None";
StorageState2[StorageState2["Initialized"] = 1] = "Initialized";
StorageState2[StorageState2["Closed"] = 2] = "Closed";
})(StorageState || (StorageState = {}));
Storage = class _Storage extends Disposable {
constructor(database, options2 = /* @__PURE__ */ Object.create(null)) {
super();
this.database = database;
this.options = options2;
this._onDidChangeStorage = this._register(new PauseableEmitter());
this.onDidChangeStorage = this._onDidChangeStorage.event;
this.state = StorageState.None;
this.cache = /* @__PURE__ */ new Map();
this.flushDelayer = this._register(new ThrottledDelayer(_Storage.DEFAULT_FLUSH_DELAY));
this.pendingDeletes = /* @__PURE__ */ new Set();
this.pendingInserts = /* @__PURE__ */ new Map();
this.whenFlushedCallbacks = [];
this.registerListeners();
}
registerListeners() {
this._register(this.database.onDidChangeItemsExternal((e) => this.onDidChangeItemsExternal(e)));
}
onDidChangeItemsExternal(e) {
var _a10, _b4;
this._onDidChangeStorage.pause();
try {
(_a10 = e.changed) === null || _a10 === void 0 ? void 0 : _a10.forEach((value, key) => this.acceptExternal(key, value));
(_b4 = e.deleted) === null || _b4 === void 0 ? void 0 : _b4.forEach((key) => this.acceptExternal(key, void 0));
} finally {
this._onDidChangeStorage.resume();
}
}
acceptExternal(key, value) {
if (this.state === StorageState.Closed) {
return;
}
let changed = false;
if (isUndefinedOrNull(value)) {
changed = this.cache.delete(key);
} else {
const currentValue = this.cache.get(key);
if (currentValue !== value) {
this.cache.set(key, value);
changed = true;
}
}
if (changed) {
this._onDidChangeStorage.fire({ key, external: true });
}
}
get(key, fallbackValue) {
const value = this.cache.get(key);
if (isUndefinedOrNull(value)) {
return fallbackValue;
}
return value;
}
getBoolean(key, fallbackValue) {
const value = this.get(key);
if (isUndefinedOrNull(value)) {
return fallbackValue;
}
return value === "true";
}
getNumber(key, fallbackValue) {
const value = this.get(key);
if (isUndefinedOrNull(value)) {
return fallbackValue;
}
return parseInt(value, 10);
}
set(key, value, external = false) {
return __async(this, null, function* () {
if (this.state === StorageState.Closed) {
return;
}
if (isUndefinedOrNull(value)) {
return this.delete(key, external);
}
const valueStr = isObject(value) || Array.isArray(value) ? stringify(value) : String(value);
const currentValue = this.cache.get(key);
if (currentValue === valueStr) {
return;
}
this.cache.set(key, valueStr);
this.pendingInserts.set(key, valueStr);
this.pendingDeletes.delete(key);
this._onDidChangeStorage.fire({ key, external });
return this.doFlush();
});
}
delete(key, external = false) {
return __async(this, null, function* () {
if (this.state === StorageState.Closed) {
return;
}
const wasDeleted = this.cache.delete(key);
if (!wasDeleted) {
return;
}
if (!this.pendingDeletes.has(key)) {
this.pendingDeletes.add(key);
}
this.pendingInserts.delete(key);
this._onDidChangeStorage.fire({ key, external });
return this.doFlush();
});
}
get hasPending() {
return this.pendingInserts.size > 0 || this.pendingDeletes.size > 0;
}
flushPending() {
return __async(this, null, function* () {
if (!this.hasPending) {
return;
}
const updateRequest = { insert: this.pendingInserts, delete: this.pendingDeletes };
this.pendingDeletes = /* @__PURE__ */ new Set();
this.pendingInserts = /* @__PURE__ */ new Map();
return this.database.updateItems(updateRequest).finally(() => {
var _a10;
if (!this.hasPending) {
while (this.whenFlushedCallbacks.length) {
(_a10 = this.whenFlushedCallbacks.pop()) === null || _a10 === void 0 ? void 0 : _a10();
}
}
});
});
}
doFlush(delay) {
return __async(this, null, function* () {
if (this.options.hint === StorageHint.STORAGE_IN_MEMORY) {
return this.flushPending();
}
return this.flushDelayer.trigger(() => this.flushPending(), delay);
});
}
};
Storage.DEFAULT_FLUSH_DELAY = 100;
InMemoryStorageDatabase = class {
constructor() {
this.onDidChangeItemsExternal = Event.None;
this.items = /* @__PURE__ */ new Map();
}
updateItems(request) {
return __async(this, null, function* () {
var _a10, _b4;
(_a10 = request.insert) === null || _a10 === void 0 ? void 0 : _a10.forEach((value, key) => this.items.set(key, value));
(_b4 = request.delete) === null || _b4 === void 0 ? void 0 : _b4.forEach((key) => this.items.delete(key));
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/storage/common/storage.js
function loadKeyTargets(storage) {
const keysRaw = storage.get(TARGET_KEY);
if (keysRaw) {
try {
return JSON.parse(keysRaw);
} catch (error) {
}
}
return /* @__PURE__ */ Object.create(null);
}
var TARGET_KEY, IStorageService, WillSaveStateReason, AbstractStorageService, InMemoryStorageService;
var init_storage2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/storage/common/storage.js"() {
init_event();
init_lifecycle();
init_types();
init_storage();
init_instantiation();
TARGET_KEY = "__$__targetStorageMarker";
IStorageService = createDecorator("storageService");
(function(WillSaveStateReason2) {
WillSaveStateReason2[WillSaveStateReason2["NONE"] = 0] = "NONE";
WillSaveStateReason2[WillSaveStateReason2["SHUTDOWN"] = 1] = "SHUTDOWN";
})(WillSaveStateReason || (WillSaveStateReason = {}));
AbstractStorageService = class _AbstractStorageService extends Disposable {
constructor(options2 = { flushInterval: _AbstractStorageService.DEFAULT_FLUSH_INTERVAL }) {
super();
this.options = options2;
this._onDidChangeValue = this._register(new PauseableEmitter());
this._onDidChangeTarget = this._register(new PauseableEmitter());
this._onWillSaveState = this._register(new Emitter());
this.onWillSaveState = this._onWillSaveState.event;
this._workspaceKeyTargets = void 0;
this._profileKeyTargets = void 0;
this._applicationKeyTargets = void 0;
}
onDidChangeValue(scope, key, disposable) {
return Event.filter(this._onDidChangeValue.event, (e) => e.scope === scope && (key === void 0 || e.key === key), disposable);
}
emitDidChangeValue(scope, event) {
const { key, external } = event;
if (key === TARGET_KEY) {
switch (scope) {
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 });
} else {
this._onDidChangeValue.fire({ scope, key, target: this.getKeyTargets(scope)[key], external });
}
}
get(key, scope, fallbackValue) {
var _a10;
return (_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.get(key, fallbackValue);
}
getBoolean(key, scope, fallbackValue) {
var _a10;
return (_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.getBoolean(key, fallbackValue);
}
getNumber(key, scope, fallbackValue) {
var _a10;
return (_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.getNumber(key, fallbackValue);
}
store(key, value, scope, target, external = false) {
if (isUndefinedOrNull(value)) {
this.remove(key, scope, external);
return;
}
this.withPausedEmitters(() => {
var _a10;
this.updateKeyTarget(key, scope, target);
(_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.set(key, value, external);
});
}
remove(key, scope, external = false) {
this.withPausedEmitters(() => {
var _a10;
this.updateKeyTarget(key, scope, void 0);
(_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.delete(key, external);
});
}
withPausedEmitters(fn) {
this._onDidChangeValue.pause();
this._onDidChangeTarget.pause();
try {
fn();
} finally {
this._onDidChangeValue.resume();
this._onDidChangeTarget.resume();
}
}
updateKeyTarget(key, scope, target, external = false) {
var _a10, _b4;
const keyTargets = this.getKeyTargets(scope);
if (typeof target === "number") {
if (keyTargets[key] !== target) {
keyTargets[key] = target;
(_a10 = this.getStorage(scope)) === null || _a10 === void 0 ? void 0 : _a10.set(TARGET_KEY, JSON.stringify(keyTargets), external);
}
} else {
if (typeof keyTargets[key] === "number") {
delete keyTargets[key];
(_b4 = this.getStorage(scope)) === null || _b4 === void 0 ? void 0 : _b4.set(TARGET_KEY, JSON.stringify(keyTargets), external);
}
}
}
get workspaceKeyTargets() {
if (!this._workspaceKeyTargets) {
this._workspaceKeyTargets = this.loadKeyTargets(
1
/* StorageScope.WORKSPACE */
);
}
return this._workspaceKeyTargets;
}
get profileKeyTargets() {
if (!this._profileKeyTargets) {
this._profileKeyTargets = this.loadKeyTargets(
0
/* StorageScope.PROFILE */
);
}
return this._profileKeyTargets;
}
get applicationKeyTargets() {
if (!this._applicationKeyTargets) {
this._applicationKeyTargets = this.loadKeyTargets(
-1
/* StorageScope.APPLICATION */
);
}
return this._applicationKeyTargets;
}
getKeyTargets(scope) {
switch (scope) {
case -1:
return this.applicationKeyTargets;
case 0:
return this.profileKeyTargets;
default:
return this.workspaceKeyTargets;
}
}
loadKeyTargets(scope) {
const storage = this.getStorage(scope);
return storage ? loadKeyTargets(storage) : /* @__PURE__ */ Object.create(null);
}
};
AbstractStorageService.DEFAULT_FLUSH_INTERVAL = 60 * 1e3;
InMemoryStorageService = class extends AbstractStorageService {
constructor() {
super();
this.applicationStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.STORAGE_IN_MEMORY }));
this.profileStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.STORAGE_IN_MEMORY }));
this.workspaceStorage = this._register(new Storage(new InMemoryStorageDatabase(), { hint: StorageHint.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(scope) {
switch (scope) {
case -1:
return this.applicationStorage;
case 0:
return this.profileStorage;
default:
return this.workspaceStorage;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js
function overrideStyles(override, styles) {
const result = __spreadValues({}, styles);
for (const key in override) {
const val = override[key];
result[key] = val !== void 0 ? asCssVariable(val) : void 0;
}
return result;
}
function getListStyles(override) {
return overrideStyles(override, defaultListStyles);
}
var defaultKeybindingLabelStyles, defaultButtonStyles, defaultProgressBarStyles, defaultToggleStyles, defaultCheckboxStyles, defaultDialogStyles, defaultInputBoxStyles, defaultFindWidgetStyles, defaultCountBadgeStyles, defaultBreadcrumbsWidgetStyles, defaultListStyles, defaultSelectBoxStyles, defaultMenuStyles;
var init_defaultStyles = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js"() {
init_colorRegistry();
init_color();
defaultKeybindingLabelStyles = {
keybindingLabelBackground: asCssVariable(keybindingLabelBackground),
keybindingLabelForeground: asCssVariable(keybindingLabelForeground),
keybindingLabelBorder: asCssVariable(keybindingLabelBorder),
keybindingLabelBottomBorder: asCssVariable(keybindingLabelBottomBorder),
keybindingLabelShadow: asCssVariable(widgetShadow)
};
defaultButtonStyles = {
buttonForeground: asCssVariable(buttonForeground),
buttonSeparator: asCssVariable(buttonSeparator),
buttonBackground: asCssVariable(buttonBackground),
buttonHoverBackground: asCssVariable(buttonHoverBackground),
buttonSecondaryForeground: asCssVariable(buttonSecondaryForeground),
buttonSecondaryBackground: asCssVariable(buttonSecondaryBackground),
buttonSecondaryHoverBackground: asCssVariable(buttonSecondaryHoverBackground),
buttonBorder: asCssVariable(buttonBorder)
};
defaultProgressBarStyles = {
progressBarBackground: asCssVariable(progressBarBackground)
};
defaultToggleStyles = {
inputActiveOptionBorder: asCssVariable(inputActiveOptionBorder),
inputActiveOptionForeground: asCssVariable(inputActiveOptionForeground),
inputActiveOptionBackground: asCssVariable(inputActiveOptionBackground)
};
defaultCheckboxStyles = {
checkboxBackground: asCssVariable(checkboxBackground),
checkboxBorder: asCssVariable(checkboxBorder),
checkboxForeground: asCssVariable(checkboxForeground)
};
defaultDialogStyles = {
dialogBackground: asCssVariable(editorWidgetBackground),
dialogForeground: asCssVariable(editorWidgetForeground),
dialogShadow: asCssVariable(widgetShadow),
dialogBorder: asCssVariable(contrastBorder),
errorIconForeground: asCssVariable(problemsErrorIconForeground),
warningIconForeground: asCssVariable(problemsWarningIconForeground),
infoIconForeground: asCssVariable(problemsInfoIconForeground),
textLinkForeground: asCssVariable(textLinkForeground)
};
defaultInputBoxStyles = {
inputBackground: asCssVariable(inputBackground),
inputForeground: asCssVariable(inputForeground),
inputBorder: asCssVariable(inputBorder),
inputValidationInfoBorder: asCssVariable(inputValidationInfoBorder),
inputValidationInfoBackground: asCssVariable(inputValidationInfoBackground),
inputValidationInfoForeground: asCssVariable(inputValidationInfoForeground),
inputValidationWarningBorder: asCssVariable(inputValidationWarningBorder),
inputValidationWarningBackground: asCssVariable(inputValidationWarningBackground),
inputValidationWarningForeground: asCssVariable(inputValidationWarningForeground),
inputValidationErrorBorder: asCssVariable(inputValidationErrorBorder),
inputValidationErrorBackground: asCssVariable(inputValidationErrorBackground),
inputValidationErrorForeground: asCssVariable(inputValidationErrorForeground)
};
defaultFindWidgetStyles = {
listFilterWidgetBackground: asCssVariable(listFilterWidgetBackground),
listFilterWidgetOutline: asCssVariable(listFilterWidgetOutline),
listFilterWidgetNoMatchesOutline: asCssVariable(listFilterWidgetNoMatchesOutline),
listFilterWidgetShadow: asCssVariable(listFilterWidgetShadow),
inputBoxStyles: defaultInputBoxStyles,
toggleStyles: defaultToggleStyles
};
defaultCountBadgeStyles = {
badgeBackground: asCssVariable(badgeBackground),
badgeForeground: asCssVariable(badgeForeground),
badgeBorder: asCssVariable(contrastBorder)
};
defaultBreadcrumbsWidgetStyles = {
breadcrumbsBackground: asCssVariable(breadcrumbsBackground),
breadcrumbsForeground: asCssVariable(breadcrumbsForeground),
breadcrumbsHoverForeground: asCssVariable(breadcrumbsFocusForeground),
breadcrumbsFocusForeground: asCssVariable(breadcrumbsFocusForeground),
breadcrumbsFocusAndSelectionForeground: asCssVariable(breadcrumbsActiveSelectionForeground)
};
defaultListStyles = {
listBackground: void 0,
listInactiveFocusForeground: void 0,
listFocusBackground: asCssVariable(listFocusBackground),
listFocusForeground: asCssVariable(listFocusForeground),
listFocusOutline: asCssVariable(listFocusOutline),
listActiveSelectionBackground: asCssVariable(listActiveSelectionBackground),
listActiveSelectionForeground: asCssVariable(listActiveSelectionForeground),
listActiveSelectionIconForeground: asCssVariable(listActiveSelectionIconForeground),
listFocusAndSelectionOutline: asCssVariable(listFocusAndSelectionOutline),
listFocusAndSelectionBackground: asCssVariable(listActiveSelectionBackground),
listFocusAndSelectionForeground: asCssVariable(listActiveSelectionForeground),
listInactiveSelectionBackground: asCssVariable(listInactiveSelectionBackground),
listInactiveSelectionIconForeground: asCssVariable(listInactiveSelectionIconForeground),
listInactiveSelectionForeground: asCssVariable(listInactiveSelectionForeground),
listInactiveFocusBackground: asCssVariable(listInactiveFocusBackground),
listInactiveFocusOutline: asCssVariable(listInactiveFocusOutline),
listHoverBackground: asCssVariable(listHoverBackground),
listHoverForeground: asCssVariable(listHoverForeground),
listDropOverBackground: asCssVariable(listDropOverBackground),
listDropBetweenBackground: asCssVariable(listDropBetweenBackground),
listSelectionOutline: asCssVariable(activeContrastBorder),
listHoverOutline: asCssVariable(activeContrastBorder),
treeIndentGuidesStroke: asCssVariable(treeIndentGuidesStroke),
treeInactiveIndentGuidesStroke: asCssVariable(treeInactiveIndentGuidesStroke),
treeStickyScrollBackground: void 0,
treeStickyScrollBorder: void 0,
treeStickyScrollShadow: void 0,
tableColumnsBorder: asCssVariable(tableColumnsBorder),
tableOddRowsBackgroundColor: asCssVariable(tableOddRowsBackgroundColor)
};
defaultSelectBoxStyles = {
selectBackground: asCssVariable(selectBackground),
selectListBackground: asCssVariable(selectListBackground),
selectForeground: asCssVariable(selectForeground),
decoratorRightForeground: asCssVariable(pickerGroupForeground),
selectBorder: asCssVariable(selectBorder),
focusBorder: asCssVariable(focusBorder),
listFocusBackground: asCssVariable(quickInputListFocusBackground),
listInactiveSelectionIconForeground: asCssVariable(quickInputListFocusIconForeground),
listFocusForeground: asCssVariable(quickInputListFocusForeground),
listFocusOutline: asCssVariableWithDefault(activeContrastBorder, Color.transparent.toString()),
listHoverBackground: asCssVariable(listHoverBackground),
listHoverForeground: asCssVariable(listHoverForeground),
listHoverOutline: asCssVariable(activeContrastBorder),
selectListBorder: asCssVariable(editorWidgetBorder),
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
};
defaultMenuStyles = {
shadowColor: asCssVariable(widgetShadow),
borderColor: asCssVariable(menuBorder),
foregroundColor: asCssVariable(menuForeground),
backgroundColor: asCssVariable(menuBackground),
selectionForegroundColor: asCssVariable(menuSelectionForeground),
selectionBackgroundColor: asCssVariable(menuSelectionBackground),
selectionBorderColor: asCssVariable(menuSelectionBorder),
separatorColor: asCssVariable(menuSeparatorBackground),
scrollbarShadow: asCssVariable(scrollbarShadow),
scrollbarSliderBackground: asCssVariable(scrollbarSliderBackground),
scrollbarSliderHoverBackground: asCssVariable(scrollbarSliderHoverBackground),
scrollbarSliderActiveBackground: asCssVariable(scrollbarSliderActiveBackground)
};
}
});
// node_modules/monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js
function createAndFillInContextMenuActions(menu, options2, target, primaryGroup) {
const groups = menu.getActions(options2);
const modifierKeyEmitter = ModifierKeyEmitter.getInstance();
const useAlternativeActions = modifierKeyEmitter.keyStatus.altKey || (isWindows || isLinux) && modifierKeyEmitter.keyStatus.shiftKey;
fillInActions(groups, target, useAlternativeActions, primaryGroup ? (actionGroup) => actionGroup === primaryGroup : (actionGroup) => actionGroup === "navigation");
}
function createAndFillInActionBarActions(menu, options2, target, primaryGroup, shouldInlineSubmenu, useSeparatorsInPrimaryActions) {
const groups = menu.getActions(options2);
const isPrimaryAction = typeof primaryGroup === "string" ? (actionGroup) => actionGroup === primaryGroup : primaryGroup;
fillInActions(groups, target, false, isPrimaryAction, shouldInlineSubmenu, useSeparatorsInPrimaryActions);
}
function fillInActions(groups, target, useAlternativeActions, isPrimaryAction = (actionGroup) => actionGroup === "navigation", shouldInlineSubmenu = () => false, useSeparatorsInPrimaryActions = false) {
let primaryBucket;
let secondaryBucket;
if (Array.isArray(target)) {
primaryBucket = target;
secondaryBucket = target;
} else {
primaryBucket = target.primary;
secondaryBucket = target.secondary;
}
const submenuInfo = /* @__PURE__ */ new Set();
for (const [group, actions] of groups) {
let target2;
if (isPrimaryAction(group)) {
target2 = primaryBucket;
if (target2.length > 0 && useSeparatorsInPrimaryActions) {
target2.push(new Separator());
}
} else {
target2 = secondaryBucket;
if (target2.length > 0) {
target2.push(new Separator());
}
}
for (let action of actions) {
if (useAlternativeActions) {
action = action instanceof MenuItemAction && action.alt ? action.alt : action;
}
const newLen = target2.push(action);
if (action instanceof SubmenuAction) {
submenuInfo.add({ group, action, index: newLen - 1 });
}
}
}
for (const { group, action, index } of submenuInfo) {
const target2 = isPrimaryAction(group) ? primaryBucket : secondaryBucket;
const submenuActions = action.actions;
if (shouldInlineSubmenu(action, group, target2.length)) {
target2.splice(index, 1, ...submenuActions);
}
}
}
function createActionViewItem(instaService, action, options2) {
if (action instanceof MenuItemAction) {
return instaService.createInstance(MenuEntryActionViewItem, action, options2);
} else if (action instanceof SubmenuItemAction) {
if (action.item.isSelection) {
return instaService.createInstance(SubmenuEntrySelectActionViewItem, action);
} else {
if (action.item.rememberDefaultAction) {
return instaService.createInstance(DropdownWithDefaultActionViewItem, action, __spreadProps(__spreadValues({}, options2), { persistLastActionId: true }));
} else {
return instaService.createInstance(SubmenuEntryActionViewItem, action, options2);
}
}
} else {
return void 0;
}
}
var __decorate28, __param25, MenuEntryActionViewItem, SubmenuEntryActionViewItem, DropdownWithDefaultActionViewItem, SubmenuEntrySelectActionViewItem;
var init_menuEntryActionViewItem2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js"() {
init_dom();
init_keyboardEvent();
init_actionViewItems();
init_dropdownActionViewItem();
init_actions();
init_keybindingLabels();
init_lifecycle();
init_platform();
init_menuEntryActionViewItem();
init_nls();
init_actions2();
init_action();
init_contextkey();
init_contextView();
init_instantiation();
init_keybinding();
init_notification();
init_storage2();
init_themeService();
init_themables();
init_theme();
init_types();
init_colorRegistry();
init_defaultStyles();
init_accessibility();
__decorate28 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param25 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MenuEntryActionViewItem = class MenuEntryActionViewItem2 extends ActionViewItem {
constructor(action, options2, _keybindingService, _notificationService, _contextKeyService, _themeService, _contextMenuService, _accessibilityService) {
super(void 0, action, { icon: !!(action.class || action.item.icon), label: !action.class && !action.item.icon, draggable: options2 === null || options2 === void 0 ? void 0 : options2.draggable, keybinding: options2 === null || options2 === void 0 ? void 0 : options2.keybinding, hoverDelegate: options2 === null || options2 === void 0 ? void 0 : options2.hoverDelegate });
this._keybindingService = _keybindingService;
this._notificationService = _notificationService;
this._contextKeyService = _contextKeyService;
this._themeService = _themeService;
this._contextMenuService = _contextMenuService;
this._accessibilityService = _accessibilityService;
this._wantsAltCommand = false;
this._itemClassDispose = this._register(new MutableDisposable());
this._altKey = ModifierKeyEmitter.getInstance();
}
get _menuItemAction() {
return this._action;
}
get _commandAction() {
return this._wantsAltCommand && this._menuItemAction.alt || this._menuItemAction;
}
onClick(event) {
return __async(this, null, function* () {
event.preventDefault();
event.stopPropagation();
try {
yield this.actionRunner.run(this._commandAction, this._context);
} catch (err) {
this._notificationService.error(err);
}
});
}
render(container) {
super.render(container);
container.classList.add("menu-entry");
if (this.options.icon) {
this._updateItemClass(this._menuItemAction.item);
}
if (this._menuItemAction.alt) {
let isMouseOver = false;
const updateAltState = () => {
var _a10;
const wantsAltCommand = !!((_a10 = this._menuItemAction.alt) === null || _a10 === void 0 ? void 0 : _a10.enabled) && (!this._accessibilityService.isMotionReduced() || isMouseOver) && (this._altKey.keyStatus.altKey || this._altKey.keyStatus.shiftKey && isMouseOver);
if (wantsAltCommand !== this._wantsAltCommand) {
this._wantsAltCommand = wantsAltCommand;
this.updateLabel();
this.updateTooltip();
this.updateClass();
}
};
this._register(this._altKey.event(updateAltState));
this._register(addDisposableListener(container, "mouseleave", (_) => {
isMouseOver = false;
updateAltState();
}));
this._register(addDisposableListener(container, "mouseenter", (_) => {
isMouseOver = true;
updateAltState();
}));
updateAltState();
}
}
updateLabel() {
if (this.options.label && this.label) {
this.label.textContent = this._commandAction.label;
}
}
getTooltip() {
var _a10;
const keybinding = this._keybindingService.lookupKeybinding(this._commandAction.id, this._contextKeyService);
const keybindingLabel = keybinding && keybinding.getLabel();
const tooltip = this._commandAction.tooltip || this._commandAction.label;
let title = keybindingLabel ? localize("titleAndKb", "{0} ({1})", tooltip, keybindingLabel) : tooltip;
if (!this._wantsAltCommand && ((_a10 = this._menuItemAction.alt) === null || _a10 === void 0 ? void 0 : _a10.enabled)) {
const altTooltip = this._menuItemAction.alt.tooltip || this._menuItemAction.alt.label;
const altKeybinding = this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id, this._contextKeyService);
const altKeybindingLabel = altKeybinding && altKeybinding.getLabel();
const altTitleSection = altKeybindingLabel ? localize("titleAndKb", "{0} ({1})", altTooltip, altKeybindingLabel) : altTooltip;
title = localize("titleAndKbAndAlt", "{0}\n[{1}] {2}", title, UILabelProvider.modifierLabels[OS].altKey, altTitleSection);
}
return title;
}
updateClass() {
if (this.options.icon) {
if (this._commandAction !== this._menuItemAction) {
if (this._menuItemAction.alt) {
this._updateItemClass(this._menuItemAction.alt.item);
}
} else {
this._updateItemClass(this._menuItemAction.item);
}
}
}
_updateItemClass(item) {
this._itemClassDispose.value = void 0;
const { element, label } = this;
if (!element || !label) {
return;
}
const icon = this._commandAction.checked && isICommandActionToggleInfo(item.toggled) && item.toggled.icon ? item.toggled.icon : item.icon;
if (!icon) {
return;
}
if (ThemeIcon.isThemeIcon(icon)) {
const iconClasses = ThemeIcon.asClassNameArray(icon);
label.classList.add(...iconClasses);
this._itemClassDispose.value = toDisposable(() => {
label.classList.remove(...iconClasses);
});
} else {
label.style.backgroundImage = isDark(this._themeService.getColorTheme().type) ? asCSSUrl(icon.dark) : asCSSUrl(icon.light);
label.classList.add("icon");
this._itemClassDispose.value = combinedDisposable(toDisposable(() => {
label.style.backgroundImage = "";
label.classList.remove("icon");
}), this._themeService.onDidColorThemeChange(() => {
this.updateClass();
}));
}
}
};
MenuEntryActionViewItem = __decorate28([
__param25(2, IKeybindingService),
__param25(3, INotificationService),
__param25(4, IContextKeyService),
__param25(5, IThemeService),
__param25(6, IContextMenuService),
__param25(7, IAccessibilityService)
], MenuEntryActionViewItem);
SubmenuEntryActionViewItem = class SubmenuEntryActionViewItem2 extends DropdownMenuActionViewItem {
constructor(action, options2, _keybindingService, _contextMenuService, _themeService) {
var _a10, _b4, _c2;
const dropdownOptions = __spreadProps(__spreadValues({}, options2), {
menuAsChild: (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.menuAsChild) !== null && _a10 !== void 0 ? _a10 : false,
classNames: (_b4 = options2 === null || options2 === void 0 ? void 0 : options2.classNames) !== null && _b4 !== void 0 ? _b4 : ThemeIcon.isThemeIcon(action.item.icon) ? ThemeIcon.asClassName(action.item.icon) : void 0,
keybindingProvider: (_c2 = options2 === null || options2 === void 0 ? void 0 : options2.keybindingProvider) !== null && _c2 !== void 0 ? _c2 : (action2) => _keybindingService.lookupKeybinding(action2.id)
});
super(action, { getActions: () => action.actions }, _contextMenuService, dropdownOptions);
this._keybindingService = _keybindingService;
this._contextMenuService = _contextMenuService;
this._themeService = _themeService;
}
render(container) {
super.render(container);
assertType(this.element);
container.classList.add("menu-entry");
const action = this._action;
const { icon } = action.item;
if (icon && !ThemeIcon.isThemeIcon(icon)) {
this.element.classList.add("icon");
const setBackgroundImage = () => {
if (this.element) {
this.element.style.backgroundImage = isDark(this._themeService.getColorTheme().type) ? asCSSUrl(icon.dark) : asCSSUrl(icon.light);
}
};
setBackgroundImage();
this._register(this._themeService.onDidColorThemeChange(() => {
setBackgroundImage();
}));
}
}
};
SubmenuEntryActionViewItem = __decorate28([
__param25(2, IKeybindingService),
__param25(3, IContextMenuService),
__param25(4, IThemeService)
], SubmenuEntryActionViewItem);
DropdownWithDefaultActionViewItem = class DropdownWithDefaultActionViewItem2 extends BaseActionViewItem {
constructor(submenuAction, options2, _keybindingService, _notificationService, _contextMenuService, _menuService, _instaService, _storageService) {
var _a10, _b4, _c2;
super(null, submenuAction);
this._keybindingService = _keybindingService;
this._notificationService = _notificationService;
this._contextMenuService = _contextMenuService;
this._menuService = _menuService;
this._instaService = _instaService;
this._storageService = _storageService;
this._container = null;
this._options = options2;
this._storageKey = `${submenuAction.item.submenu.id}_lastActionId`;
let defaultAction;
const defaultActionId = (options2 === null || options2 === void 0 ? void 0 : options2.persistLastActionId) ? _storageService.get(
this._storageKey,
1
/* StorageScope.WORKSPACE */
) : void 0;
if (defaultActionId) {
defaultAction = submenuAction.actions.find((a3) => defaultActionId === a3.id);
}
if (!defaultAction) {
defaultAction = submenuAction.actions[0];
}
this._defaultAction = this._instaService.createInstance(MenuEntryActionViewItem, defaultAction, { keybinding: this._getDefaultActionKeybindingLabel(defaultAction) });
const dropdownOptions = __spreadProps(__spreadValues({
keybindingProvider: (action) => this._keybindingService.lookupKeybinding(action.id)
}, options2), {
menuAsChild: (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.menuAsChild) !== null && _a10 !== void 0 ? _a10 : true,
classNames: (_b4 = options2 === null || options2 === void 0 ? void 0 : options2.classNames) !== null && _b4 !== void 0 ? _b4 : ["codicon", "codicon-chevron-down"],
actionRunner: (_c2 = options2 === null || options2 === void 0 ? void 0 : options2.actionRunner) !== null && _c2 !== void 0 ? _c2 : new ActionRunner()
});
this._dropdown = new DropdownMenuActionViewItem(submenuAction, submenuAction.actions, this._contextMenuService, dropdownOptions);
this._register(this._dropdown.actionRunner.onDidRun((e) => {
if (e.action instanceof MenuItemAction) {
this.update(e.action);
}
}));
}
update(lastAction) {
var _a10;
if ((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.persistLastActionId) {
this._storageService.store(
this._storageKey,
lastAction.id,
1,
1
/* StorageTarget.MACHINE */
);
}
this._defaultAction.dispose();
this._defaultAction = this._instaService.createInstance(MenuEntryActionViewItem, lastAction, { keybinding: this._getDefaultActionKeybindingLabel(lastAction) });
this._defaultAction.actionRunner = new class extends ActionRunner {
runAction(action, context) {
return __async(this, null, function* () {
yield action.run(void 0);
});
}
}();
if (this._container) {
this._defaultAction.render(prepend(this._container, $(".action-container")));
}
}
_getDefaultActionKeybindingLabel(defaultAction) {
var _a10;
let defaultActionKeybinding;
if ((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.renderKeybindingWithDefaultActionLabel) {
const kb = this._keybindingService.lookupKeybinding(defaultAction.id);
if (kb) {
defaultActionKeybinding = `(${kb.getLabel()})`;
}
}
return defaultActionKeybinding;
}
setActionContext(newContext) {
super.setActionContext(newContext);
this._defaultAction.setActionContext(newContext);
this._dropdown.setActionContext(newContext);
}
render(container) {
this._container = container;
super.render(this._container);
this._container.classList.add("monaco-dropdown-with-default");
const primaryContainer = $(".action-container");
this._defaultAction.render(append(this._container, primaryContainer));
this._register(addDisposableListener(primaryContainer, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
17
/* KeyCode.RightArrow */
)) {
this._defaultAction.element.tabIndex = -1;
this._dropdown.focus();
event.stopPropagation();
}
}));
const dropdownContainer = $(".dropdown-action-container");
this._dropdown.render(append(this._container, dropdownContainer));
this._register(addDisposableListener(dropdownContainer, EventType.KEY_DOWN, (e) => {
var _a10;
const event = new StandardKeyboardEvent(e);
if (event.equals(
15
/* KeyCode.LeftArrow */
)) {
this._defaultAction.element.tabIndex = 0;
this._dropdown.setFocusable(false);
(_a10 = this._defaultAction.element) === null || _a10 === void 0 ? void 0 : _a10.focus();
event.stopPropagation();
}
}));
}
focus(fromRight) {
if (fromRight) {
this._dropdown.focus();
} else {
this._defaultAction.element.tabIndex = 0;
this._defaultAction.element.focus();
}
}
blur() {
this._defaultAction.element.tabIndex = -1;
this._dropdown.blur();
this._container.blur();
}
setFocusable(focusable) {
if (focusable) {
this._defaultAction.element.tabIndex = 0;
} else {
this._defaultAction.element.tabIndex = -1;
this._dropdown.setFocusable(false);
}
}
dispose() {
this._defaultAction.dispose();
this._dropdown.dispose();
super.dispose();
}
};
DropdownWithDefaultActionViewItem = __decorate28([
__param25(2, IKeybindingService),
__param25(3, INotificationService),
__param25(4, IContextMenuService),
__param25(5, IMenuService),
__param25(6, IInstantiationService),
__param25(7, IStorageService)
], DropdownWithDefaultActionViewItem);
SubmenuEntrySelectActionViewItem = class SubmenuEntrySelectActionViewItem2 extends SelectActionViewItem {
constructor(action, contextViewService) {
super(null, action, action.actions.map((a3) => ({
text: a3.id === Separator.ID ? "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" : a3.label,
isDisabled: !a3.enabled
})), 0, contextViewService, defaultSelectBoxStyles, { ariaLabel: action.tooltip, optionsAsChildren: true });
this.select(Math.max(0, action.actions.findIndex((a3) => a3.checked)));
}
render(container) {
super.render(container);
container.style.borderColor = asCssVariable(selectBorder);
}
runAction(option, index) {
const action = this.action.actions[index];
if (action) {
this.actionRunner.run(action);
}
}
};
SubmenuEntrySelectActionViewItem = __decorate28([
__param25(1, IContextViewService)
], SubmenuEntrySelectActionViewItem);
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js
var ActionBar;
var init_actionbar2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js"() {
init_dom();
init_keyboardEvent();
init_actionViewItems();
init_hoverDelegateFactory();
init_actions();
init_event();
init_lifecycle();
init_types();
init_actionbar();
ActionBar = class extends Disposable {
constructor(container, options2 = {}) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2;
super();
this._actionRunnerDisposables = this._register(new DisposableStore());
this.viewItemDisposables = this._register(new DisposableMap());
this.triggerKeyDown = false;
this.focusable = true;
this._onDidBlur = this._register(new Emitter());
this.onDidBlur = this._onDidBlur.event;
this._onDidCancel = this._register(new Emitter({ onWillAddFirstListener: () => this.cancelHasListener = true }));
this.onDidCancel = this._onDidCancel.event;
this.cancelHasListener = false;
this._onDidRun = this._register(new Emitter());
this.onDidRun = this._onDidRun.event;
this._onWillRun = this._register(new Emitter());
this.onWillRun = this._onWillRun.event;
this.options = options2;
this._context = (_a10 = options2.context) !== null && _a10 !== void 0 ? _a10 : null;
this._orientation = (_b4 = this.options.orientation) !== null && _b4 !== void 0 ? _b4 : 0;
this._triggerKeys = {
keyDown: (_d2 = (_c2 = this.options.triggerKeys) === null || _c2 === void 0 ? void 0 : _c2.keyDown) !== null && _d2 !== void 0 ? _d2 : false,
keys: (_f3 = (_e2 = this.options.triggerKeys) === null || _e2 === void 0 ? void 0 : _e2.keys) !== null && _f3 !== void 0 ? _f3 : [
3,
10
/* KeyCode.Space */
]
};
this._hoverDelegate = (_g2 = options2.hoverDelegate) !== null && _g2 !== void 0 ? _g2 : this._register(createInstantHoverDelegate());
if (this.options.actionRunner) {
this._actionRunner = this.options.actionRunner;
} else {
this._actionRunner = new ActionRunner();
this._actionRunnerDisposables.add(this._actionRunner);
}
this._actionRunnerDisposables.add(this._actionRunner.onDidRun((e) => this._onDidRun.fire(e)));
this._actionRunnerDisposables.add(this._actionRunner.onWillRun((e) => this._onWillRun.fire(e)));
this.viewItems = [];
this.focusedItem = void 0;
this.domNode = document.createElement("div");
this.domNode.className = "monaco-action-bar";
let previousKeys;
let nextKeys;
switch (this._orientation) {
case 0:
previousKeys = [
15
/* KeyCode.LeftArrow */
];
nextKeys = [
17
/* KeyCode.RightArrow */
];
break;
case 1:
previousKeys = [
16
/* KeyCode.UpArrow */
];
nextKeys = [
18
/* KeyCode.DownArrow */
];
this.domNode.className += " vertical";
break;
}
this._register(addDisposableListener(this.domNode, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
let eventHandled = true;
const focusedItem = typeof this.focusedItem === "number" ? this.viewItems[this.focusedItem] : void 0;
if (previousKeys && (event.equals(previousKeys[0]) || event.equals(previousKeys[1]))) {
eventHandled = this.focusPrevious();
} else if (nextKeys && (event.equals(nextKeys[0]) || event.equals(nextKeys[1]))) {
eventHandled = this.focusNext();
} else if (event.equals(
9
/* KeyCode.Escape */
) && this.cancelHasListener) {
this._onDidCancel.fire();
} else if (event.equals(
14
/* KeyCode.Home */
)) {
eventHandled = this.focusFirst();
} else if (event.equals(
13
/* KeyCode.End */
)) {
eventHandled = this.focusLast();
} else if (event.equals(
2
/* KeyCode.Tab */
) && focusedItem instanceof BaseActionViewItem && focusedItem.trapsArrowNavigation) {
eventHandled = this.focusNext();
} else if (this.isTriggerKeyEvent(event)) {
if (this._triggerKeys.keyDown) {
this.doTrigger(event);
} else {
this.triggerKeyDown = true;
}
} else {
eventHandled = false;
}
if (eventHandled) {
event.preventDefault();
event.stopPropagation();
}
}));
this._register(addDisposableListener(this.domNode, EventType.KEY_UP, (e) => {
const event = new StandardKeyboardEvent(e);
if (this.isTriggerKeyEvent(event)) {
if (!this._triggerKeys.keyDown && this.triggerKeyDown) {
this.triggerKeyDown = false;
this.doTrigger(event);
}
event.preventDefault();
event.stopPropagation();
} else if (event.equals(
2
/* KeyCode.Tab */
) || event.equals(
1024 | 2
/* KeyCode.Tab */
) || event.equals(
16
/* KeyCode.UpArrow */
) || event.equals(
18
/* KeyCode.DownArrow */
) || event.equals(
15
/* KeyCode.LeftArrow */
) || event.equals(
17
/* KeyCode.RightArrow */
)) {
this.updateFocusedItem();
}
}));
this.focusTracker = this._register(trackFocus(this.domNode));
this._register(this.focusTracker.onDidBlur(() => {
if (getActiveElement() === this.domNode || !isAncestor(getActiveElement(), this.domNode)) {
this._onDidBlur.fire();
this.previouslyFocusedItem = this.focusedItem;
this.focusedItem = void 0;
this.triggerKeyDown = false;
}
}));
this._register(this.focusTracker.onDidFocus(() => this.updateFocusedItem()));
this.actionsList = document.createElement("ul");
this.actionsList.className = "actions-container";
if (this.options.highlightToggledItems) {
this.actionsList.classList.add("highlight-toggled");
}
this.actionsList.setAttribute("role", this.options.ariaRole || "toolbar");
if (this.options.ariaLabel) {
this.actionsList.setAttribute("aria-label", this.options.ariaLabel);
}
this.domNode.appendChild(this.actionsList);
container.appendChild(this.domNode);
}
refreshRole() {
if (this.length() >= 1) {
this.actionsList.setAttribute("role", this.options.ariaRole || "toolbar");
} else {
this.actionsList.setAttribute("role", "presentation");
}
}
// Some action bars should not be focusable at times
// When an action bar is not focusable make sure to make all the elements inside it not focusable
// When an action bar is focusable again, make sure the first item can be focused
setFocusable(focusable) {
this.focusable = focusable;
if (this.focusable) {
const firstEnabled = this.viewItems.find((vi) => vi instanceof BaseActionViewItem && vi.isEnabled());
if (firstEnabled instanceof BaseActionViewItem) {
firstEnabled.setFocusable(true);
}
} else {
this.viewItems.forEach((vi) => {
if (vi instanceof BaseActionViewItem) {
vi.setFocusable(false);
}
});
}
}
isTriggerKeyEvent(event) {
let ret = false;
this._triggerKeys.keys.forEach((keyCode) => {
ret = ret || event.equals(keyCode);
});
return ret;
}
updateFocusedItem() {
var _a10, _b4;
for (let i = 0; i < this.actionsList.children.length; i++) {
const elem = this.actionsList.children[i];
if (isAncestor(getActiveElement(), elem)) {
this.focusedItem = i;
(_b4 = (_a10 = this.viewItems[this.focusedItem]) === null || _a10 === void 0 ? void 0 : _a10.showHover) === null || _b4 === void 0 ? void 0 : _b4.call(_a10);
break;
}
}
}
get context() {
return this._context;
}
set context(context) {
this._context = context;
this.viewItems.forEach((i) => i.setActionContext(context));
}
get actionRunner() {
return this._actionRunner;
}
set actionRunner(actionRunner) {
this._actionRunner = actionRunner;
this._actionRunnerDisposables.clear();
this._actionRunnerDisposables.add(this._actionRunner.onDidRun((e) => this._onDidRun.fire(e)));
this._actionRunnerDisposables.add(this._actionRunner.onWillRun((e) => this._onWillRun.fire(e)));
this.viewItems.forEach((item) => item.actionRunner = actionRunner);
}
getContainer() {
return this.domNode;
}
getAction(indexOrElement) {
var _a10;
if (typeof indexOrElement === "number") {
return (_a10 = this.viewItems[indexOrElement]) === null || _a10 === void 0 ? void 0 : _a10.action;
}
if (isHTMLElement(indexOrElement)) {
while (indexOrElement.parentElement !== this.actionsList) {
if (!indexOrElement.parentElement) {
return void 0;
}
indexOrElement = indexOrElement.parentElement;
}
for (let i = 0; i < this.actionsList.childNodes.length; i++) {
if (this.actionsList.childNodes[i] === indexOrElement) {
return this.viewItems[i].action;
}
}
}
return void 0;
}
push(arg, options2 = {}) {
const actions = Array.isArray(arg) ? arg : [arg];
let index = isNumber(options2.index) ? options2.index : null;
actions.forEach((action) => {
const actionViewItemElement = document.createElement("li");
actionViewItemElement.className = "action-item";
actionViewItemElement.setAttribute("role", "presentation");
let item;
const viewItemOptions = __spreadValues({ hoverDelegate: this._hoverDelegate }, options2);
if (this.options.actionViewItemProvider) {
item = this.options.actionViewItemProvider(action, viewItemOptions);
}
if (!item) {
item = new ActionViewItem(this.context, action, viewItemOptions);
}
if (!this.options.allowContextMenu) {
this.viewItemDisposables.set(item, addDisposableListener(actionViewItemElement, EventType.CONTEXT_MENU, (e) => {
EventHelper.stop(e, true);
}));
}
item.actionRunner = this._actionRunner;
item.setActionContext(this.context);
item.render(actionViewItemElement);
if (this.focusable && item instanceof BaseActionViewItem && this.viewItems.length === 0) {
item.setFocusable(true);
}
if (index === null || index < 0 || index >= this.actionsList.children.length) {
this.actionsList.appendChild(actionViewItemElement);
this.viewItems.push(item);
} else {
this.actionsList.insertBefore(actionViewItemElement, this.actionsList.children[index]);
this.viewItems.splice(index, 0, item);
index++;
}
});
if (typeof this.focusedItem === "number") {
this.focus(this.focusedItem);
}
this.refreshRole();
}
clear() {
if (this.isEmpty()) {
return;
}
this.viewItems = dispose(this.viewItems);
this.viewItemDisposables.clearAndDisposeAll();
clearNode(this.actionsList);
this.refreshRole();
}
length() {
return this.viewItems.length;
}
isEmpty() {
return this.viewItems.length === 0;
}
focus(arg) {
let selectFirst = false;
let index = void 0;
if (arg === void 0) {
selectFirst = true;
} else if (typeof arg === "number") {
index = arg;
} else if (typeof arg === "boolean") {
selectFirst = arg;
}
if (selectFirst && typeof this.focusedItem === "undefined") {
const firstEnabled = this.viewItems.findIndex((item) => item.isEnabled());
this.focusedItem = firstEnabled === -1 ? void 0 : firstEnabled;
this.updateFocus(void 0, void 0, true);
} else {
if (index !== void 0) {
this.focusedItem = index;
}
this.updateFocus(void 0, void 0, true);
}
}
focusFirst() {
this.focusedItem = this.length() - 1;
return this.focusNext(true);
}
focusLast() {
this.focusedItem = 0;
return this.focusPrevious(true);
}
focusNext(forceLoop) {
if (typeof this.focusedItem === "undefined") {
this.focusedItem = this.viewItems.length - 1;
} else if (this.viewItems.length <= 1) {
return false;
}
const startIndex = this.focusedItem;
let item;
do {
if (!forceLoop && this.options.preventLoopNavigation && this.focusedItem + 1 >= this.viewItems.length) {
this.focusedItem = startIndex;
return false;
}
this.focusedItem = (this.focusedItem + 1) % this.viewItems.length;
item = this.viewItems[this.focusedItem];
} while (this.focusedItem !== startIndex && (this.options.focusOnlyEnabledItems && !item.isEnabled() || item.action.id === Separator.ID));
this.updateFocus();
return true;
}
focusPrevious(forceLoop) {
if (typeof this.focusedItem === "undefined") {
this.focusedItem = 0;
} else if (this.viewItems.length <= 1) {
return false;
}
const startIndex = this.focusedItem;
let item;
do {
this.focusedItem = this.focusedItem - 1;
if (this.focusedItem < 0) {
if (!forceLoop && this.options.preventLoopNavigation) {
this.focusedItem = startIndex;
return false;
}
this.focusedItem = this.viewItems.length - 1;
}
item = this.viewItems[this.focusedItem];
} while (this.focusedItem !== startIndex && (this.options.focusOnlyEnabledItems && !item.isEnabled() || item.action.id === Separator.ID));
this.updateFocus(true);
return true;
}
updateFocus(fromRight, preventScroll, forceFocus = false) {
var _a10, _b4;
if (typeof this.focusedItem === "undefined") {
this.actionsList.focus({ preventScroll });
}
if (this.previouslyFocusedItem !== void 0 && this.previouslyFocusedItem !== this.focusedItem) {
(_a10 = this.viewItems[this.previouslyFocusedItem]) === null || _a10 === void 0 ? void 0 : _a10.blur();
}
const actionViewItem = this.focusedItem !== void 0 ? this.viewItems[this.focusedItem] : void 0;
if (actionViewItem) {
let focusItem = true;
if (!isFunction(actionViewItem.focus)) {
focusItem = false;
}
if (this.options.focusOnlyEnabledItems && isFunction(actionViewItem.isEnabled) && !actionViewItem.isEnabled()) {
focusItem = false;
}
if (actionViewItem.action.id === Separator.ID) {
focusItem = false;
}
if (!focusItem) {
this.actionsList.focus({ preventScroll });
this.previouslyFocusedItem = void 0;
} else if (forceFocus || this.previouslyFocusedItem !== this.focusedItem) {
actionViewItem.focus(fromRight);
this.previouslyFocusedItem = this.focusedItem;
}
if (focusItem) {
(_b4 = actionViewItem.showHover) === null || _b4 === void 0 ? void 0 : _b4.call(actionViewItem);
}
}
}
doTrigger(event) {
if (typeof this.focusedItem === "undefined") {
return;
}
const actionViewItem = this.viewItems[this.focusedItem];
if (actionViewItem instanceof BaseActionViewItem) {
const context = actionViewItem._context === null || actionViewItem._context === void 0 ? event : actionViewItem._context;
this.run(actionViewItem._action, context);
}
}
run(action, context) {
return __async(this, null, function* () {
yield this._actionRunner.run(action, context);
});
}
dispose() {
this._context = void 0;
this.viewItems = dispose(this.viewItems);
this.getContainer().remove();
super.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js
function cleanMnemonic(label) {
const regex = MENU_MNEMONIC_REGEX;
const matches2 = regex.exec(label);
if (!matches2) {
return label;
}
const mnemonicInText = !matches2[1];
return label.replace(regex, mnemonicInText ? "$2$3" : "").trim();
}
function formatRule(c) {
const fontCharacter = getCodiconFontCharacters()[c.id];
return `.codicon-${c.id}:before { content: '\\${fontCharacter.toString(16)}'; }`;
}
function getMenuWidgetCSS(style, isForShadowDom) {
let result = (
/* css */
`
.monaco-menu {
font-size: 13px;
border-radius: 5px;
min-width: 160px;
}
${formatRule(Codicon.menuSelection)}
${formatRule(Codicon.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 (isForShadowDom) {
result += `
/* 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;
}
`;
const scrollbarShadowColor = style.scrollbarShadow;
if (scrollbarShadowColor) {
result += `
.monaco-scrollable-element > .shadow.top {
box-shadow: ${scrollbarShadowColor} 0 6px 6px -6px inset;
}
.monaco-scrollable-element > .shadow.left {
box-shadow: ${scrollbarShadowColor} 6px 0 6px -6px inset;
}
.monaco-scrollable-element > .shadow.top.left {
box-shadow: ${scrollbarShadowColor} 6px 6px 6px -6px inset;
}
`;
}
const scrollbarSliderBackgroundColor = style.scrollbarSliderBackground;
if (scrollbarSliderBackgroundColor) {
result += `
.monaco-scrollable-element > .scrollbar > .slider {
background: ${scrollbarSliderBackgroundColor};
}
`;
}
const scrollbarSliderHoverBackgroundColor = style.scrollbarSliderHoverBackground;
if (scrollbarSliderHoverBackgroundColor) {
result += `
.monaco-scrollable-element > .scrollbar > .slider:hover {
background: ${scrollbarSliderHoverBackgroundColor};
}
`;
}
const scrollbarSliderActiveBackgroundColor = style.scrollbarSliderActiveBackground;
if (scrollbarSliderActiveBackgroundColor) {
result += `
.monaco-scrollable-element > .scrollbar > .slider.active {
background: ${scrollbarSliderActiveBackgroundColor};
}
`;
}
}
return result;
}
var MENU_MNEMONIC_REGEX, MENU_ESCAPED_MNEMONIC_REGEX, HorizontalDirection, VerticalDirection, Menu, BaseMenuActionViewItem, SubmenuMenuActionViewItem, MenuSeparatorActionViewItem;
var init_menu = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js"() {
init_browser();
init_touch();
init_dom();
init_keyboardEvent();
init_mouseEvent();
init_actionbar2();
init_actionViewItems();
init_contextview2();
init_scrollableElement();
init_actions();
init_async();
init_codicons();
init_codiconsUtil();
init_themables();
init_iconLabels2();
init_lifecycle();
init_platform();
init_strings();
MENU_MNEMONIC_REGEX = /\(&([^\s&])\)|(^|[^&])&([^\s&])/;
MENU_ESCAPED_MNEMONIC_REGEX = /(&)?(&)([^\s&])/g;
(function(HorizontalDirection2) {
HorizontalDirection2[HorizontalDirection2["Right"] = 0] = "Right";
HorizontalDirection2[HorizontalDirection2["Left"] = 1] = "Left";
})(HorizontalDirection || (HorizontalDirection = {}));
(function(VerticalDirection2) {
VerticalDirection2[VerticalDirection2["Above"] = 0] = "Above";
VerticalDirection2[VerticalDirection2["Below"] = 1] = "Below";
})(VerticalDirection || (VerticalDirection = {}));
Menu = class _Menu extends ActionBar {
constructor(container, actions, options2, menuStyles) {
container.classList.add("monaco-menu-container");
container.setAttribute("role", "presentation");
const menuElement = document.createElement("div");
menuElement.classList.add("monaco-menu");
menuElement.setAttribute("role", "presentation");
super(menuElement, {
orientation: 1,
actionViewItemProvider: (action) => this.doGetActionViewItem(action, options2, parentData),
context: options2.context,
actionRunner: options2.actionRunner,
ariaLabel: options2.ariaLabel,
ariaRole: "menu",
focusOnlyEnabledItems: true,
triggerKeys: { keys: [3, ...isMacintosh || isLinux ? [
10
/* KeyCode.Space */
] : []], keyDown: true }
});
this.menuStyles = menuStyles;
this.menuElement = menuElement;
this.actionsList.tabIndex = 0;
this.initializeOrUpdateStyleSheet(container, menuStyles);
this._register(Gesture.addTarget(menuElement));
this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
2
/* KeyCode.Tab */
)) {
e.preventDefault();
}
}));
if (options2.enableMnemonics) {
this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => {
const key = e.key.toLocaleLowerCase();
if (this.mnemonics.has(key)) {
EventHelper.stop(e, true);
const actions2 = this.mnemonics.get(key);
if (actions2.length === 1) {
if (actions2[0] instanceof SubmenuMenuActionViewItem && actions2[0].container) {
this.focusItemByElement(actions2[0].container);
}
actions2[0].onClick(e);
}
if (actions2.length > 1) {
const action = actions2.shift();
if (action && action.container) {
this.focusItemByElement(action.container);
actions2.push(action);
}
this.mnemonics.set(key, actions2);
}
}
}));
}
if (isLinux) {
this._register(addDisposableListener(menuElement, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
14
/* KeyCode.Home */
) || event.equals(
11
/* KeyCode.PageUp */
)) {
this.focusedItem = this.viewItems.length - 1;
this.focusNext();
EventHelper.stop(e, true);
} else if (event.equals(
13
/* KeyCode.End */
) || event.equals(
12
/* KeyCode.PageDown */
)) {
this.focusedItem = 0;
this.focusPrevious();
EventHelper.stop(e, true);
}
}));
}
this._register(addDisposableListener(this.domNode, EventType.MOUSE_OUT, (e) => {
const relatedTarget = e.relatedTarget;
if (!isAncestor(relatedTarget, this.domNode)) {
this.focusedItem = void 0;
this.updateFocus();
e.stopPropagation();
}
}));
this._register(addDisposableListener(this.actionsList, EventType.MOUSE_OVER, (e) => {
let target = e.target;
if (!target || !isAncestor(target, this.actionsList) || target === this.actionsList) {
return;
}
while (target.parentElement !== this.actionsList && target.parentElement !== null) {
target = target.parentElement;
}
if (target.classList.contains("action-item")) {
const lastFocusedItem = this.focusedItem;
this.setFocusedItem(target);
if (lastFocusedItem !== this.focusedItem) {
this.updateFocus();
}
}
}));
this._register(Gesture.addTarget(this.actionsList));
this._register(addDisposableListener(this.actionsList, EventType2.Tap, (e) => {
let target = e.initialTarget;
if (!target || !isAncestor(target, this.actionsList) || target === this.actionsList) {
return;
}
while (target.parentElement !== this.actionsList && target.parentElement !== null) {
target = target.parentElement;
}
if (target.classList.contains("action-item")) {
const lastFocusedItem = this.focusedItem;
this.setFocusedItem(target);
if (lastFocusedItem !== this.focusedItem) {
this.updateFocus();
}
}
}));
const parentData = {
parent: this
};
this.mnemonics = /* @__PURE__ */ new Map();
this.scrollableElement = this._register(new DomScrollableElement(menuElement, {
alwaysConsumeMouseWheel: true,
horizontal: 2,
vertical: 3,
verticalScrollbarSize: 7,
handleMouseWheel: true,
useShadows: true
}));
const scrollElement = this.scrollableElement.getDomNode();
scrollElement.style.position = "";
this.styleScrollElement(scrollElement, menuStyles);
this._register(addDisposableListener(menuElement, EventType2.Change, (e) => {
EventHelper.stop(e, true);
const scrollTop = this.scrollableElement.getScrollPosition().scrollTop;
this.scrollableElement.setScrollPosition({ scrollTop: scrollTop - e.translationY });
}));
this._register(addDisposableListener(scrollElement, EventType.MOUSE_UP, (e) => {
e.preventDefault();
}));
const window2 = getWindow(container);
menuElement.style.maxHeight = `${Math.max(10, window2.innerHeight - container.getBoundingClientRect().top - 35)}px`;
actions = actions.filter((a3, idx) => {
var _a10;
if ((_a10 = options2.submenuIds) === null || _a10 === void 0 ? void 0 : _a10.has(a3.id)) {
console.warn(`Found submenu cycle: ${a3.id}`);
return false;
}
if (a3 instanceof Separator) {
if (idx === actions.length - 1 || idx === 0) {
return false;
}
const prevAction = actions[idx - 1];
if (prevAction instanceof Separator) {
return false;
}
}
return true;
});
this.push(actions, { icon: true, label: true, isMenu: true });
container.appendChild(this.scrollableElement.getDomNode());
this.scrollableElement.scanDomNode();
this.viewItems.filter((item) => !(item instanceof MenuSeparatorActionViewItem)).forEach((item, index, array2) => {
item.updatePositionInSet(index + 1, array2.length);
});
}
initializeOrUpdateStyleSheet(container, style) {
if (!this.styleSheet) {
if (isInShadowDOM(container)) {
this.styleSheet = createStyleSheet(container);
} else {
if (!_Menu.globalStyleSheet) {
_Menu.globalStyleSheet = createStyleSheet();
}
this.styleSheet = _Menu.globalStyleSheet;
}
}
this.styleSheet.textContent = getMenuWidgetCSS(style, isInShadowDOM(container));
}
styleScrollElement(scrollElement, style) {
var _a10, _b4;
const fgColor = (_a10 = style.foregroundColor) !== null && _a10 !== void 0 ? _a10 : "";
const bgColor = (_b4 = style.backgroundColor) !== null && _b4 !== void 0 ? _b4 : "";
const border = style.borderColor ? `1px solid ${style.borderColor}` : "";
const borderRadius = "5px";
const shadow = style.shadowColor ? `0 2px 8px ${style.shadowColor}` : "";
scrollElement.style.outline = border;
scrollElement.style.borderRadius = borderRadius;
scrollElement.style.color = fgColor;
scrollElement.style.backgroundColor = bgColor;
scrollElement.style.boxShadow = shadow;
}
getContainer() {
return this.scrollableElement.getDomNode();
}
get onScroll() {
return this.scrollableElement.onScroll;
}
focusItemByElement(element) {
const lastFocusedItem = this.focusedItem;
this.setFocusedItem(element);
if (lastFocusedItem !== this.focusedItem) {
this.updateFocus();
}
}
setFocusedItem(element) {
for (let i = 0; i < this.actionsList.children.length; i++) {
const elem = this.actionsList.children[i];
if (element === elem) {
this.focusedItem = i;
break;
}
}
}
updateFocus(fromRight) {
super.updateFocus(fromRight, true, true);
if (typeof this.focusedItem !== "undefined") {
this.scrollableElement.setScrollPosition({
scrollTop: Math.round(this.menuElement.scrollTop)
});
}
}
doGetActionViewItem(action, options2, parentData) {
if (action instanceof Separator) {
return new MenuSeparatorActionViewItem(options2.context, action, { icon: true }, this.menuStyles);
} else if (action instanceof SubmenuAction) {
const menuActionViewItem = new SubmenuMenuActionViewItem(action, action.actions, parentData, __spreadProps(__spreadValues({}, options2), { submenuIds: /* @__PURE__ */ new Set([...options2.submenuIds || [], action.id]) }), this.menuStyles);
if (options2.enableMnemonics) {
const mnemonic = menuActionViewItem.getMnemonic();
if (mnemonic && menuActionViewItem.isEnabled()) {
let actionViewItems = [];
if (this.mnemonics.has(mnemonic)) {
actionViewItems = this.mnemonics.get(mnemonic);
}
actionViewItems.push(menuActionViewItem);
this.mnemonics.set(mnemonic, actionViewItems);
}
}
return menuActionViewItem;
} else {
const menuItemOptions = { enableMnemonics: options2.enableMnemonics, useEventAsContext: options2.useEventAsContext };
if (options2.getKeyBinding) {
const keybinding = options2.getKeyBinding(action);
if (keybinding) {
const keybindingLabel = keybinding.getLabel();
if (keybindingLabel) {
menuItemOptions.keybinding = keybindingLabel;
}
}
}
const menuActionViewItem = new BaseMenuActionViewItem(options2.context, action, menuItemOptions, this.menuStyles);
if (options2.enableMnemonics) {
const mnemonic = menuActionViewItem.getMnemonic();
if (mnemonic && menuActionViewItem.isEnabled()) {
let actionViewItems = [];
if (this.mnemonics.has(mnemonic)) {
actionViewItems = this.mnemonics.get(mnemonic);
}
actionViewItems.push(menuActionViewItem);
this.mnemonics.set(mnemonic, actionViewItems);
}
}
return menuActionViewItem;
}
}
};
BaseMenuActionViewItem = class extends BaseActionViewItem {
constructor(ctx, action, options2, menuStyle) {
options2.isMenu = true;
super(action, action, options2);
this.menuStyle = menuStyle;
this.options = options2;
this.options.icon = options2.icon !== void 0 ? options2.icon : false;
this.options.label = options2.label !== void 0 ? options2.label : true;
this.cssClass = "";
if (this.options.label && options2.enableMnemonics) {
const label = this.action.label;
if (label) {
const matches2 = MENU_MNEMONIC_REGEX.exec(label);
if (matches2) {
this.mnemonic = (!!matches2[1] ? matches2[1] : matches2[3]).toLocaleLowerCase();
}
}
}
this.runOnceToEnableMouseUp = new RunOnceScheduler(() => {
if (!this.element) {
return;
}
this._register(addDisposableListener(this.element, EventType.MOUSE_UP, (e) => {
EventHelper.stop(e, true);
if (isFirefox2) {
const mouseEvent = new StandardMouseEvent(getWindow(this.element), e);
if (mouseEvent.rightButton) {
return;
}
this.onClick(e);
} else {
setTimeout(() => {
this.onClick(e);
}, 0);
}
}));
this._register(addDisposableListener(this.element, EventType.CONTEXT_MENU, (e) => {
EventHelper.stop(e, true);
}));
}, 100);
this._register(this.runOnceToEnableMouseUp);
}
render(container) {
super.render(container);
if (!this.element) {
return;
}
this.container = container;
this.item = append(this.element, $("a.action-menu-item"));
if (this._action.id === Separator.ID) {
this.item.setAttribute("role", "presentation");
} else {
this.item.setAttribute("role", "menuitem");
if (this.mnemonic) {
this.item.setAttribute("aria-keyshortcuts", `${this.mnemonic}`);
}
}
this.check = append(this.item, $("span.menu-item-check" + ThemeIcon.asCSSSelector(Codicon.menuSelection)));
this.check.setAttribute("role", "none");
this.label = append(this.item, $("span.action-label"));
if (this.options.label && this.options.keybinding) {
append(this.item, $("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 _a10;
super.focus();
(_a10 = this.item) === null || _a10 === void 0 ? void 0 : _a10.focus();
this.applyStyle();
}
updatePositionInSet(pos, setSize) {
if (this.item) {
this.item.setAttribute("aria-posinset", `${pos}`);
this.item.setAttribute("aria-setsize", `${setSize}`);
}
}
updateLabel() {
var _a10;
if (!this.label) {
return;
}
if (this.options.label) {
clearNode(this.label);
let label = stripIcons(this.action.label);
if (label) {
const cleanLabel = cleanMnemonic(label);
if (!this.options.enableMnemonics) {
label = cleanLabel;
}
this.label.setAttribute("aria-label", cleanLabel.replace(/&&/g, "&"));
const matches2 = MENU_MNEMONIC_REGEX.exec(label);
if (matches2) {
label = escape(label);
MENU_ESCAPED_MNEMONIC_REGEX.lastIndex = 0;
let escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label);
while (escMatch && escMatch[1]) {
escMatch = MENU_ESCAPED_MNEMONIC_REGEX.exec(label);
}
const replaceDoubleEscapes = (str) => str.replace(/&&/g, "&");
if (escMatch) {
this.label.append(ltrim(replaceDoubleEscapes(label.substr(0, escMatch.index)), " "), $("u", { "aria-hidden": "true" }, escMatch[3]), rtrim(replaceDoubleEscapes(label.substr(escMatch.index + escMatch[0].length)), " "));
} else {
this.label.innerText = replaceDoubleEscapes(label).trim();
}
(_a10 = this.item) === null || _a10 === void 0 ? void 0 : _a10.setAttribute("aria-keyshortcuts", (!!matches2[1] ? matches2[1] : matches2[3]).toLocaleLowerCase());
} else {
this.label.innerText = label.replace(/&&/g, "&").trim();
}
}
}
}
updateTooltip() {
}
updateClass() {
if (this.cssClass && this.item) {
this.item.classList.remove(...this.cssClass.split(" "));
}
if (this.options.icon && this.label) {
this.cssClass = this.action.class || "";
this.label.classList.add("icon");
if (this.cssClass) {
this.label.classList.add(...this.cssClass.split(" "));
}
this.updateEnabled();
} else if (this.label) {
this.label.classList.remove("icon");
}
}
updateEnabled() {
if (this.action.enabled) {
if (this.element) {
this.element.classList.remove("disabled");
this.element.removeAttribute("aria-disabled");
}
if (this.item) {
this.item.classList.remove("disabled");
this.item.removeAttribute("aria-disabled");
this.item.tabIndex = 0;
}
} else {
if (this.element) {
this.element.classList.add("disabled");
this.element.setAttribute("aria-disabled", "true");
}
if (this.item) {
this.item.classList.add("disabled");
this.item.setAttribute("aria-disabled", "true");
}
}
}
updateChecked() {
if (!this.item) {
return;
}
const checked = this.action.checked;
this.item.classList.toggle("checked", !!checked);
if (checked !== void 0) {
this.item.setAttribute("role", "menuitemcheckbox");
this.item.setAttribute("aria-checked", checked ? "true" : "false");
} else {
this.item.setAttribute("role", "menuitem");
this.item.setAttribute("aria-checked", "");
}
}
getMnemonic() {
return this.mnemonic;
}
applyStyle() {
const isSelected = this.element && this.element.classList.contains("focused");
const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
const bgColor = isSelected && this.menuStyle.selectionBackgroundColor ? this.menuStyle.selectionBackgroundColor : void 0;
const outline = isSelected && this.menuStyle.selectionBorderColor ? `1px solid ${this.menuStyle.selectionBorderColor}` : "";
const outlineOffset = isSelected && this.menuStyle.selectionBorderColor ? `-1px` : "";
if (this.item) {
this.item.style.color = fgColor !== null && fgColor !== void 0 ? fgColor : "";
this.item.style.backgroundColor = bgColor !== null && bgColor !== void 0 ? bgColor : "";
this.item.style.outline = outline;
this.item.style.outlineOffset = outlineOffset;
}
if (this.check) {
this.check.style.color = fgColor !== null && fgColor !== void 0 ? fgColor : "";
}
}
};
SubmenuMenuActionViewItem = class extends BaseMenuActionViewItem {
constructor(action, submenuActions, parentData, submenuOptions, menuStyles) {
super(action, action, submenuOptions, menuStyles);
this.submenuActions = submenuActions;
this.parentData = parentData;
this.submenuOptions = submenuOptions;
this.mysubmenu = null;
this.submenuDisposables = this._register(new DisposableStore());
this.mouseOver = false;
this.expandDirection = submenuOptions && submenuOptions.expandDirection !== void 0 ? submenuOptions.expandDirection : { horizontal: HorizontalDirection.Right, vertical: VerticalDirection.Below };
this.showScheduler = new RunOnceScheduler(() => {
if (this.mouseOver) {
this.cleanupExistingSubmenu(false);
this.createSubmenu(false);
}
}, 250);
this.hideScheduler = new RunOnceScheduler(() => {
if (this.element && (!isAncestor(getActiveElement(), this.element) && this.parentData.submenu === this.mysubmenu)) {
this.parentData.parent.focus(false);
this.cleanupExistingSubmenu(true);
}
}, 750);
}
render(container) {
super.render(container);
if (!this.element) {
return;
}
if (this.item) {
this.item.classList.add("monaco-submenu-item");
this.item.tabIndex = 0;
this.item.setAttribute("aria-haspopup", "true");
this.updateAriaExpanded("false");
this.submenuIndicator = append(this.item, $("span.submenu-indicator" + ThemeIcon.asCSSSelector(Codicon.menuSubmenu)));
this.submenuIndicator.setAttribute("aria-hidden", "true");
}
this._register(addDisposableListener(this.element, EventType.KEY_UP, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
17
/* KeyCode.RightArrow */
) || event.equals(
3
/* KeyCode.Enter */
)) {
EventHelper.stop(e, true);
this.createSubmenu(true);
}
}));
this._register(addDisposableListener(this.element, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (getActiveElement() === this.item) {
if (event.equals(
17
/* KeyCode.RightArrow */
) || event.equals(
3
/* KeyCode.Enter */
)) {
EventHelper.stop(e, true);
}
}
}));
this._register(addDisposableListener(this.element, EventType.MOUSE_OVER, (e) => {
if (!this.mouseOver) {
this.mouseOver = true;
this.showScheduler.schedule();
}
}));
this._register(addDisposableListener(this.element, EventType.MOUSE_LEAVE, (e) => {
this.mouseOver = false;
}));
this._register(addDisposableListener(this.element, EventType.FOCUS_OUT, (e) => {
if (this.element && !isAncestor(getActiveElement(), this.element)) {
this.hideScheduler.schedule();
}
}));
this._register(this.parentData.parent.onScroll(() => {
if (this.parentData.submenu === this.mysubmenu) {
this.parentData.parent.focus(false);
this.cleanupExistingSubmenu(true);
}
}));
}
updateEnabled() {
}
onClick(e) {
EventHelper.stop(e, true);
this.cleanupExistingSubmenu(false);
this.createSubmenu(true);
}
cleanupExistingSubmenu(force) {
if (this.parentData.submenu && (force || this.parentData.submenu !== this.mysubmenu)) {
try {
this.parentData.submenu.dispose();
} catch (_a10) {
}
this.parentData.submenu = void 0;
this.updateAriaExpanded("false");
if (this.submenuContainer) {
this.submenuDisposables.clear();
this.submenuContainer = void 0;
}
}
}
calculateSubmenuMenuLayout(windowDimensions, submenu, entry, expandDirection) {
const ret = { top: 0, left: 0 };
ret.left = layout(windowDimensions.width, submenu.width, { position: expandDirection.horizontal === HorizontalDirection.Right ? 0 : 1, offset: entry.left, size: entry.width });
if (ret.left >= entry.left && ret.left < entry.left + entry.width) {
if (entry.left + 10 + submenu.width <= windowDimensions.width) {
ret.left = entry.left + 10;
}
entry.top += 10;
entry.height = 0;
}
ret.top = layout(windowDimensions.height, submenu.height, { position: 0, offset: entry.top, size: 0 });
if (ret.top + submenu.height === entry.top && ret.top + entry.height + submenu.height <= windowDimensions.height) {
ret.top += entry.height;
}
return ret;
}
createSubmenu(selectFirstItem = true) {
if (!this.element) {
return;
}
if (!this.parentData.submenu) {
this.updateAriaExpanded("true");
this.submenuContainer = append(this.element, $("div.monaco-submenu"));
this.submenuContainer.classList.add("menubar-menu-items-holder", "context-view");
const computedStyles = getWindow(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode);
const paddingTop = parseFloat(computedStyles.paddingTop || "0") || 0;
this.submenuContainer.style.zIndex = "1";
this.submenuContainer.style.position = "fixed";
this.submenuContainer.style.top = "0";
this.submenuContainer.style.left = "0";
this.parentData.submenu = new Menu(this.submenuContainer, this.submenuActions.length ? this.submenuActions : [new EmptySubmenuAction()], this.submenuOptions, this.menuStyle);
const entryBox = this.element.getBoundingClientRect();
const entryBoxUpdated = {
top: entryBox.top - paddingTop,
left: entryBox.left,
height: entryBox.height + 2 * paddingTop,
width: entryBox.width
};
const viewBox = this.submenuContainer.getBoundingClientRect();
const window2 = getWindow(this.element);
const { top, left } = this.calculateSubmenuMenuLayout(new Dimension(window2.innerWidth, window2.innerHeight), Dimension.lift(viewBox), entryBoxUpdated, this.expandDirection);
this.submenuContainer.style.left = `${left - viewBox.left}px`;
this.submenuContainer.style.top = `${top - viewBox.top}px`;
this.submenuDisposables.add(addDisposableListener(this.submenuContainer, EventType.KEY_UP, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
15
/* KeyCode.LeftArrow */
)) {
EventHelper.stop(e, true);
this.parentData.parent.focus();
this.cleanupExistingSubmenu(true);
}
}));
this.submenuDisposables.add(addDisposableListener(this.submenuContainer, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
if (event.equals(
15
/* KeyCode.LeftArrow */
)) {
EventHelper.stop(e, true);
}
}));
this.submenuDisposables.add(this.parentData.submenu.onDidCancel(() => {
this.parentData.parent.focus();
this.cleanupExistingSubmenu(true);
}));
this.parentData.submenu.focus(selectFirstItem);
this.mysubmenu = this.parentData.submenu;
} else {
this.parentData.submenu.focus(false);
}
}
updateAriaExpanded(value) {
var _a10;
if (this.item) {
(_a10 = this.item) === null || _a10 === void 0 ? void 0 : _a10.setAttribute("aria-expanded", value);
}
}
applyStyle() {
super.applyStyle();
const isSelected = this.element && this.element.classList.contains("focused");
const fgColor = isSelected && this.menuStyle.selectionForegroundColor ? this.menuStyle.selectionForegroundColor : this.menuStyle.foregroundColor;
if (this.submenuIndicator) {
this.submenuIndicator.style.color = fgColor !== null && fgColor !== void 0 ? fgColor : "";
}
}
dispose() {
super.dispose();
this.hideScheduler.dispose();
if (this.mysubmenu) {
this.mysubmenu.dispose();
this.mysubmenu = null;
}
if (this.submenuContainer) {
this.submenuContainer = void 0;
}
}
};
MenuSeparatorActionViewItem = class extends ActionViewItem {
constructor(context, action, options2, menuStyles) {
super(context, action, options2);
this.menuStyles = menuStyles;
}
render(container) {
super.render(container);
if (this.label) {
this.label.style.borderBottomColor = this.menuStyles.separatorColor ? `${this.menuStyles.separatorColor}` : "";
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.js
var ContextMenuHandler;
var init_contextMenuHandler = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.js"() {
init_dom();
init_mouseEvent();
init_menu();
init_actions();
init_errors();
init_lifecycle();
init_defaultStyles();
ContextMenuHandler = class {
constructor(contextViewService, telemetryService, notificationService, keybindingService) {
this.contextViewService = contextViewService;
this.telemetryService = telemetryService;
this.notificationService = notificationService;
this.keybindingService = keybindingService;
this.focusToReturn = null;
this.lastContainer = null;
this.block = null;
this.blockDisposable = null;
this.options = { blockMouse: true };
}
configure(options2) {
this.options = options2;
}
showContextMenu(delegate) {
const actions = delegate.getActions();
if (!actions.length) {
return;
}
this.focusToReturn = getActiveElement();
let menu;
const shadowRootElement = isHTMLElement(delegate.domForShadowRoot) ? delegate.domForShadowRoot : void 0;
this.contextViewService.showContextView({
getAnchor: () => delegate.getAnchor(),
canRelayout: false,
anchorAlignment: delegate.anchorAlignment,
anchorAxisAlignment: delegate.anchorAxisAlignment,
render: (container) => {
var _a10;
this.lastContainer = container;
const className = delegate.getMenuClassName ? delegate.getMenuClassName() : "";
if (className) {
container.className += " " + className;
}
if (this.options.blockMouse) {
this.block = container.appendChild($(".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";
(_a10 = this.blockDisposable) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this.blockDisposable = addDisposableListener(this.block, EventType.MOUSE_DOWN, (e) => e.stopPropagation());
}
const menuDisposables = new DisposableStore();
const actionRunner = delegate.actionRunner || new ActionRunner();
actionRunner.onWillRun((evt) => this.onActionRun(evt, !delegate.skipTelemetry), this, menuDisposables);
actionRunner.onDidRun(this.onDidActionRun, this, menuDisposables);
menu = new Menu(container, actions, {
actionViewItemProvider: delegate.getActionViewItem,
context: delegate.getActionsContext ? delegate.getActionsContext() : null,
actionRunner,
getKeyBinding: delegate.getKeyBinding ? delegate.getKeyBinding : (action) => this.keybindingService.lookupKeybinding(action.id)
}, defaultMenuStyles);
menu.onDidCancel(() => this.contextViewService.hideContextView(true), null, menuDisposables);
menu.onDidBlur(() => this.contextViewService.hideContextView(true), null, menuDisposables);
const targetWindow = getWindow(container);
menuDisposables.add(addDisposableListener(targetWindow, EventType.BLUR, () => this.contextViewService.hideContextView(true)));
menuDisposables.add(addDisposableListener(targetWindow, EventType.MOUSE_DOWN, (e) => {
if (e.defaultPrevented) {
return;
}
const event = new StandardMouseEvent(targetWindow, e);
let element = event.target;
if (event.rightButton) {
return;
}
while (element) {
if (element === container) {
return;
}
element = element.parentElement;
}
this.contextViewService.hideContextView(true);
}));
return combinedDisposable(menuDisposables, menu);
},
focus: () => {
menu === null || menu === void 0 ? void 0 : menu.focus(!!delegate.autoSelectFirstItem);
},
onHide: (didCancel) => {
var _a10, _b4, _c2;
(_a10 = delegate.onHide) === null || _a10 === void 0 ? void 0 : _a10.call(delegate, !!didCancel);
if (this.block) {
this.block.remove();
this.block = null;
}
(_b4 = this.blockDisposable) === null || _b4 === void 0 ? void 0 : _b4.dispose();
this.blockDisposable = null;
if (!!this.lastContainer && (getActiveElement() === this.lastContainer || isAncestor(getActiveElement(), this.lastContainer))) {
(_c2 = this.focusToReturn) === null || _c2 === void 0 ? void 0 : _c2.focus();
}
this.lastContainer = null;
}
}, shadowRootElement, !!shadowRootElement);
}
onActionRun(e, logTelemetry) {
if (logTelemetry) {
this.telemetryService.publicLog2("workbenchActionExecuted", { id: e.action.id, from: "contextMenu" });
}
this.contextViewService.hideContextView(false);
}
onDidActionRun(e) {
if (e.error && !isCancellationError(e.error)) {
this.notificationService.error(e.error);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuService.js
var __decorate29, __param26, ContextMenuService, ContextMenuMenuDelegate;
var init_contextMenuService = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuService.js"() {
init_dom();
init_actions();
init_event();
init_lifecycle();
init_menuEntryActionViewItem2();
init_actions2();
init_contextkey();
init_keybinding();
init_notification();
init_telemetry();
init_contextMenuHandler();
init_contextView();
__decorate29 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param26 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
ContextMenuService = class ContextMenuService2 extends Disposable {
get contextMenuHandler() {
if (!this._contextMenuHandler) {
this._contextMenuHandler = new ContextMenuHandler(this.contextViewService, this.telemetryService, this.notificationService, this.keybindingService);
}
return this._contextMenuHandler;
}
constructor(telemetryService, notificationService, contextViewService, keybindingService, menuService, contextKeyService) {
super();
this.telemetryService = telemetryService;
this.notificationService = notificationService;
this.contextViewService = contextViewService;
this.keybindingService = keybindingService;
this.menuService = menuService;
this.contextKeyService = contextKeyService;
this._contextMenuHandler = void 0;
this._onDidShowContextMenu = this._store.add(new Emitter());
this.onDidShowContextMenu = this._onDidShowContextMenu.event;
this._onDidHideContextMenu = this._store.add(new Emitter());
}
configure(options2) {
this.contextMenuHandler.configure(options2);
}
// ContextMenu
showContextMenu(delegate) {
delegate = ContextMenuMenuDelegate.transform(delegate, this.menuService, this.contextKeyService);
this.contextMenuHandler.showContextMenu(__spreadProps(__spreadValues({}, delegate), {
onHide: (didCancel) => {
var _a10;
(_a10 = delegate.onHide) === null || _a10 === void 0 ? void 0 : _a10.call(delegate, didCancel);
this._onDidHideContextMenu.fire();
}
}));
ModifierKeyEmitter.getInstance().resetKeyStatus();
this._onDidShowContextMenu.fire();
}
};
ContextMenuService = __decorate29([
__param26(0, ITelemetryService),
__param26(1, INotificationService),
__param26(2, IContextViewService),
__param26(3, IKeybindingService),
__param26(4, IMenuService),
__param26(5, IContextKeyService)
], ContextMenuService);
(function(ContextMenuMenuDelegate2) {
function is(thing) {
return thing && thing.menuId instanceof MenuId;
}
function transform(delegate, menuService, globalContextKeyService) {
if (!is(delegate)) {
return delegate;
}
const { menuId, menuActionOptions, contextKeyService } = delegate;
return __spreadProps(__spreadValues({}, delegate), {
getActions: () => {
const target = [];
if (menuId) {
const menu = menuService.createMenu(menuId, contextKeyService !== null && contextKeyService !== void 0 ? contextKeyService : globalContextKeyService);
createAndFillInContextMenuActions(menu, menuActionOptions, target);
menu.dispose();
}
if (!delegate.getActions) {
return target;
} else {
return Separator.join(delegate.getActions(), target);
}
}
});
}
ContextMenuMenuDelegate2.transform = transform;
})(ContextMenuMenuDelegate || (ContextMenuMenuDelegate = {}));
}
});
// node_modules/monaco-editor/esm/vs/platform/editor/common/editor.js
var EditorOpenSource;
var init_editor2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/editor/common/editor.js"() {
(function(EditorOpenSource2) {
EditorOpenSource2[EditorOpenSource2["API"] = 0] = "API";
EditorOpenSource2[EditorOpenSource2["USER"] = 1] = "USER";
})(EditorOpenSource || (EditorOpenSource = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/services/openerService.js
var __decorate30, __param27, CommandOpener, EditorOpener, OpenerService;
var init_openerService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/services/openerService.js"() {
init_dom();
init_window();
init_cancellation();
init_linkedList();
init_map();
init_marshalling();
init_network();
init_resources();
init_uri();
init_codeEditorService();
init_commands();
init_editor2();
init_opener();
__decorate30 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param27 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
CommandOpener = class CommandOpener2 {
constructor(_commandService) {
this._commandService = _commandService;
}
open(target, options2) {
return __async(this, null, function* () {
if (!matchesScheme(target, Schemas.command)) {
return false;
}
if (!(options2 === null || options2 === void 0 ? void 0 : options2.allowCommands)) {
return true;
}
if (typeof target === "string") {
target = URI.parse(target);
}
if (Array.isArray(options2.allowCommands)) {
if (!options2.allowCommands.includes(target.path)) {
return true;
}
}
let args = [];
try {
args = parse3(decodeURIComponent(target.query));
} catch (_a10) {
try {
args = parse3(target.query);
} catch (_b4) {
}
}
if (!Array.isArray(args)) {
args = [args];
}
yield this._commandService.executeCommand(target.path, ...args);
return true;
});
}
};
CommandOpener = __decorate30([
__param27(0, ICommandService)
], CommandOpener);
EditorOpener = class EditorOpener2 {
constructor(_editorService) {
this._editorService = _editorService;
}
open(target, options2) {
return __async(this, null, function* () {
if (typeof target === "string") {
target = URI.parse(target);
}
const { selection, uri } = extractSelection(target);
target = uri;
if (target.scheme === Schemas.file) {
target = normalizePath(target);
}
yield this._editorService.openCodeEditor({
resource: target,
options: __spreadValues({
selection,
source: (options2 === null || options2 === void 0 ? void 0 : options2.fromUserGesture) ? EditorOpenSource.USER : EditorOpenSource.API
}, options2 === null || options2 === void 0 ? void 0 : options2.editorOptions)
}, this._editorService.getFocusedCodeEditor(), options2 === null || options2 === void 0 ? void 0 : options2.openToSide);
return true;
});
}
};
EditorOpener = __decorate30([
__param27(0, ICodeEditorService)
], EditorOpener);
OpenerService = class OpenerService2 {
constructor(editorService, commandService) {
this._openers = new LinkedList();
this._validators = new LinkedList();
this._resolvers = new LinkedList();
this._resolvedUriTargets = new ResourceMap((uri) => uri.with({ path: null, fragment: null, query: null }).toString());
this._externalOpeners = new LinkedList();
this._defaultExternalOpener = {
openExternal: (href) => __async(this, null, function* () {
if (matchesSomeScheme(href, Schemas.http, Schemas.https)) {
windowOpenNoOpener(href);
} else {
mainWindow.location.href = href;
}
return true;
})
};
this._openers.push({
open: (target, options2) => __async(this, null, function* () {
if ((options2 === null || options2 === void 0 ? void 0 : options2.openExternal) || matchesSomeScheme(target, Schemas.mailto, Schemas.http, Schemas.https, Schemas.vsls)) {
yield this._doOpenExternal(target, options2);
return true;
}
return false;
})
});
this._openers.push(new CommandOpener(commandService));
this._openers.push(new EditorOpener(editorService));
}
registerOpener(opener) {
const remove = this._openers.unshift(opener);
return { dispose: remove };
}
open(target, options2) {
return __async(this, null, function* () {
var _a10;
const targetURI = typeof target === "string" ? URI.parse(target) : target;
const validationTarget = (_a10 = this._resolvedUriTargets.get(targetURI)) !== null && _a10 !== void 0 ? _a10 : target;
for (const validator of this._validators) {
if (!(yield validator.shouldOpen(validationTarget, options2))) {
return false;
}
}
for (const opener of this._openers) {
const handled = yield opener.open(target, options2);
if (handled) {
return true;
}
}
return false;
});
}
resolveExternalUri(resource, options2) {
return __async(this, null, function* () {
for (const resolver of this._resolvers) {
try {
const result = yield resolver.resolveExternalUri(resource, options2);
if (result) {
if (!this._resolvedUriTargets.has(result.resolved)) {
this._resolvedUriTargets.set(result.resolved, resource);
}
return result;
}
} catch (_a10) {
}
}
throw new Error("Could not resolve external URI: " + resource.toString());
});
}
_doOpenExternal(resource, options2) {
return __async(this, null, function* () {
const uri = typeof resource === "string" ? URI.parse(resource) : resource;
let externalUri;
try {
externalUri = (yield this.resolveExternalUri(uri, options2)).resolved;
} catch (_a10) {
externalUri = uri;
}
let href;
if (typeof resource === "string" && uri.toString() === externalUri.toString()) {
href = resource;
} else {
href = encodeURI(externalUri.toString(true));
}
if (options2 === null || options2 === void 0 ? void 0 : options2.allowContributedOpeners) {
const preferredOpenerId = typeof (options2 === null || options2 === void 0 ? void 0 : options2.allowContributedOpeners) === "string" ? options2 === null || options2 === void 0 ? void 0 : options2.allowContributedOpeners : void 0;
for (const opener of this._externalOpeners) {
const didOpen = yield opener.openExternal(href, {
sourceUri: uri,
preferredOpenerId
}, CancellationToken.None);
if (didOpen) {
return true;
}
}
}
return this._defaultExternalOpener.openExternal(href, { sourceUri: uri }, CancellationToken.None);
});
}
dispose() {
this._validators.clear();
}
};
OpenerService = __decorate30([
__param27(0, ICodeEditorService),
__param27(1, ICommandService)
], OpenerService);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/editorWorker.js
var IEditorWorkerService;
var init_editorWorker = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/editorWorker.js"() {
init_instantiation();
IEditorWorkerService = createDecorator("editorWorkerService");
}
});
// node_modules/monaco-editor/esm/vs/platform/markers/common/markers.js
var MarkerSeverity2, IMarkerData, IMarkerService;
var init_markers = __esm({
"node_modules/monaco-editor/esm/vs/platform/markers/common/markers.js"() {
init_severity();
init_nls();
init_instantiation();
(function(MarkerSeverity4) {
MarkerSeverity4[MarkerSeverity4["Hint"] = 1] = "Hint";
MarkerSeverity4[MarkerSeverity4["Info"] = 2] = "Info";
MarkerSeverity4[MarkerSeverity4["Warning"] = 4] = "Warning";
MarkerSeverity4[MarkerSeverity4["Error"] = 8] = "Error";
})(MarkerSeverity2 || (MarkerSeverity2 = {}));
(function(MarkerSeverity4) {
function compare2(a3, b) {
return b - a3;
}
MarkerSeverity4.compare = compare2;
const _displayStrings = /* @__PURE__ */ Object.create(null);
_displayStrings[MarkerSeverity4.Error] = localize("sev.error", "Error");
_displayStrings[MarkerSeverity4.Warning] = localize("sev.warning", "Warning");
_displayStrings[MarkerSeverity4.Info] = localize("sev.info", "Info");
function toString(a3) {
return _displayStrings[a3] || "";
}
MarkerSeverity4.toString = toString;
function fromSeverity(severity) {
switch (severity) {
case severity_default.Error:
return MarkerSeverity4.Error;
case severity_default.Warning:
return MarkerSeverity4.Warning;
case severity_default.Info:
return MarkerSeverity4.Info;
case severity_default.Ignore:
return MarkerSeverity4.Hint;
}
}
MarkerSeverity4.fromSeverity = fromSeverity;
function toSeverity4(severity) {
switch (severity) {
case MarkerSeverity4.Error:
return severity_default.Error;
case MarkerSeverity4.Warning:
return severity_default.Warning;
case MarkerSeverity4.Info:
return severity_default.Info;
case MarkerSeverity4.Hint:
return severity_default.Ignore;
}
}
MarkerSeverity4.toSeverity = toSeverity4;
})(MarkerSeverity2 || (MarkerSeverity2 = {}));
(function(IMarkerData2) {
const emptyString = "";
function makeKey(markerData) {
return makeKeyOptionalMessage(markerData, true);
}
IMarkerData2.makeKey = makeKey;
function makeKeyOptionalMessage(markerData, useMessage) {
const result = [emptyString];
if (markerData.source) {
result.push(markerData.source.replace("\xA6", "\\\xA6"));
} else {
result.push(emptyString);
}
if (markerData.code) {
if (typeof markerData.code === "string") {
result.push(markerData.code.replace("\xA6", "\\\xA6"));
} else {
result.push(markerData.code.value.replace("\xA6", "\\\xA6"));
}
} else {
result.push(emptyString);
}
if (markerData.severity !== void 0 && markerData.severity !== null) {
result.push(MarkerSeverity2.toString(markerData.severity));
} else {
result.push(emptyString);
}
if (markerData.message && useMessage) {
result.push(markerData.message.replace("\xA6", "\\\xA6"));
} else {
result.push(emptyString);
}
if (markerData.startLineNumber !== void 0 && markerData.startLineNumber !== null) {
result.push(markerData.startLineNumber.toString());
} else {
result.push(emptyString);
}
if (markerData.startColumn !== void 0 && markerData.startColumn !== null) {
result.push(markerData.startColumn.toString());
} else {
result.push(emptyString);
}
if (markerData.endLineNumber !== void 0 && markerData.endLineNumber !== null) {
result.push(markerData.endLineNumber.toString());
} else {
result.push(emptyString);
}
if (markerData.endColumn !== void 0 && markerData.endColumn !== null) {
result.push(markerData.endColumn.toString());
} else {
result.push(emptyString);
}
result.push(emptyString);
return result.join("\xA6");
}
IMarkerData2.makeKeyOptionalMessage = makeKeyOptionalMessage;
})(IMarkerData || (IMarkerData = {}));
IMarkerService = createDecorator("markerService");
}
});
// node_modules/monaco-editor/esm/vs/base/common/collections.js
function diffSets(before, after2) {
const removed = [];
const added = [];
for (const element of before) {
if (!after2.has(element)) {
removed.push(element);
}
}
for (const element of after2) {
if (!before.has(element)) {
added.push(element);
}
}
return { removed, added };
}
function intersection(setA, setB) {
const result = /* @__PURE__ */ new Set();
for (const elem of setB) {
if (setA.has(elem)) {
result.add(elem);
}
}
return result;
}
var init_collections = __esm({
"node_modules/monaco-editor/esm/vs/base/common/collections.js"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorationsService.js
var __decorate31, __param28, MarkerDecorationsService, MarkerDecorations;
var init_markerDecorationsService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorationsService.js"() {
init_markers();
init_lifecycle();
init_model2();
init_themeService();
init_editorColorRegistry();
init_model();
init_range();
init_network();
init_event();
init_colorRegistry();
init_map();
init_collections();
__decorate31 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param28 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MarkerDecorationsService = class MarkerDecorationsService2 extends Disposable {
constructor(modelService, _markerService) {
super();
this._markerService = _markerService;
this._onDidChangeMarker = this._register(new Emitter());
this._markerDecorations = new ResourceMap();
modelService.getModels().forEach((model) => this._onModelAdded(model));
this._register(modelService.onModelAdded(this._onModelAdded, this));
this._register(modelService.onModelRemoved(this._onModelRemoved, this));
this._register(this._markerService.onMarkerChanged(this._handleMarkerChange, this));
}
dispose() {
super.dispose();
this._markerDecorations.forEach((value) => value.dispose());
this._markerDecorations.clear();
}
getMarker(uri, decoration3) {
const markerDecorations = this._markerDecorations.get(uri);
return markerDecorations ? markerDecorations.getMarker(decoration3) || null : null;
}
_handleMarkerChange(changedResources) {
changedResources.forEach((resource) => {
const markerDecorations = this._markerDecorations.get(resource);
if (markerDecorations) {
this._updateDecorations(markerDecorations);
}
});
}
_onModelAdded(model) {
const markerDecorations = new MarkerDecorations(model);
this._markerDecorations.set(model.uri, markerDecorations);
this._updateDecorations(markerDecorations);
}
_onModelRemoved(model) {
var _a10;
const markerDecorations = this._markerDecorations.get(model.uri);
if (markerDecorations) {
markerDecorations.dispose();
this._markerDecorations.delete(model.uri);
}
if (model.uri.scheme === Schemas.inMemory || model.uri.scheme === Schemas.internal || model.uri.scheme === Schemas.vscode) {
(_a10 = this._markerService) === null || _a10 === void 0 ? void 0 : _a10.read({ resource: model.uri }).map((marker) => marker.owner).forEach((owner) => this._markerService.remove(owner, [model.uri]));
}
}
_updateDecorations(markerDecorations) {
const markers = this._markerService.read({ resource: markerDecorations.model.uri, take: 500 });
if (markerDecorations.update(markers)) {
this._onDidChangeMarker.fire(markerDecorations.model);
}
}
};
MarkerDecorationsService = __decorate31([
__param28(0, IModelService),
__param28(1, IMarkerService)
], MarkerDecorationsService);
MarkerDecorations = class extends Disposable {
constructor(model) {
super();
this.model = model;
this._map = new BidirectionalMap();
this._register(toDisposable(() => {
this.model.deltaDecorations([...this._map.values()], []);
this._map.clear();
}));
}
update(markers) {
const { added, removed } = diffSets(new Set(this._map.keys()), new Set(markers));
if (added.length === 0 && removed.length === 0) {
return false;
}
const oldIds = removed.map((marker) => this._map.get(marker));
const newDecorations = added.map((marker) => {
return {
range: this._createDecorationRange(this.model, marker),
options: this._createDecorationOption(marker)
};
});
const ids = this.model.deltaDecorations(oldIds, newDecorations);
for (const removedMarker of removed) {
this._map.delete(removedMarker);
}
for (let index = 0; index < ids.length; index++) {
this._map.set(added[index], ids[index]);
}
return true;
}
getMarker(decoration3) {
return this._map.getKey(decoration3.id);
}
_createDecorationRange(model, rawMarker) {
let ret = Range.lift(rawMarker);
if (rawMarker.severity === MarkerSeverity2.Hint && !this._hasMarkerTag(
rawMarker,
1
/* MarkerTag.Unnecessary */
) && !this._hasMarkerTag(
rawMarker,
2
/* MarkerTag.Deprecated */
)) {
ret = ret.setEndPosition(ret.startLineNumber, ret.startColumn + 2);
}
ret = model.validateRange(ret);
if (ret.isEmpty()) {
const maxColumn = model.getLineLastNonWhitespaceColumn(ret.startLineNumber) || model.getLineMaxColumn(ret.startLineNumber);
if (maxColumn === 1 || ret.endColumn >= maxColumn) {
return ret;
}
const word = model.getWordAtPosition(ret.getStartPosition());
if (word) {
ret = new Range(ret.startLineNumber, word.startColumn, ret.endLineNumber, word.endColumn);
}
} else if (rawMarker.endColumn === Number.MAX_VALUE && rawMarker.startColumn === 1 && ret.startLineNumber === ret.endLineNumber) {
const minColumn = model.getLineFirstNonWhitespaceColumn(rawMarker.startLineNumber);
if (minColumn < ret.endColumn) {
ret = new Range(ret.startLineNumber, minColumn, ret.endLineNumber, ret.endColumn);
rawMarker.startColumn = minColumn;
}
}
return ret;
}
_createDecorationOption(marker) {
let className;
let color = void 0;
let zIndex;
let inlineClassName = void 0;
let minimap;
switch (marker.severity) {
case MarkerSeverity2.Hint:
if (this._hasMarkerTag(
marker,
2
/* MarkerTag.Deprecated */
)) {
className = void 0;
} else if (this._hasMarkerTag(
marker,
1
/* MarkerTag.Unnecessary */
)) {
className = "squiggly-unnecessary";
} else {
className = "squiggly-hint";
}
zIndex = 0;
break;
case MarkerSeverity2.Info:
className = "squiggly-info";
color = themeColorFromId(overviewRulerInfo);
zIndex = 10;
minimap = {
color: themeColorFromId(minimapInfo),
position: 1
/* MinimapPosition.Inline */
};
break;
case MarkerSeverity2.Warning:
className = "squiggly-warning";
color = themeColorFromId(overviewRulerWarning);
zIndex = 20;
minimap = {
color: themeColorFromId(minimapWarning),
position: 1
/* MinimapPosition.Inline */
};
break;
case MarkerSeverity2.Error:
default:
className = "squiggly-error";
color = themeColorFromId(overviewRulerError);
zIndex = 30;
minimap = {
color: themeColorFromId(minimapError),
position: 1
/* MinimapPosition.Inline */
};
break;
}
if (marker.tags) {
if (marker.tags.indexOf(
1
/* MarkerTag.Unnecessary */
) !== -1) {
inlineClassName = "squiggly-inline-unnecessary";
}
if (marker.tags.indexOf(
2
/* MarkerTag.Deprecated */
) !== -1) {
inlineClassName = "squiggly-inline-deprecated";
}
}
return {
description: "marker-decoration",
stickiness: 1,
className,
showIfCollapsed: true,
overviewRuler: {
color,
position: OverviewRulerLane2.Right
},
minimap,
zIndex,
inlineClassName
};
}
_hasMarkerTag(marker, tag) {
if (marker.tags) {
return marker.tags.indexOf(tag) >= 0;
}
return false;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js
function MODEL_ID2(resource) {
return resource.toString();
}
var __decorate32, __param29, ModelService_1, ModelData2, DEFAULT_EOL, DisposedModelInfo, ModelService, DefaultModelSHA1Computer;
var init_modelService = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js"() {
init_event();
init_lifecycle();
init_platform();
init_textModel();
init_textModelDefaults();
init_modesRegistry();
init_language();
init_textResourceConfiguration();
init_configuration();
init_undoRedo();
init_hash();
init_editStack();
init_network();
init_objects();
init_languageConfigurationRegistry();
__decorate32 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param29 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
ModelData2 = class {
constructor(model, onWillDispose, onDidChangeLanguage) {
this.model = model;
this._modelEventListeners = new DisposableStore();
this.model = model;
this._modelEventListeners.add(model.onWillDispose(() => onWillDispose(model)));
this._modelEventListeners.add(model.onDidChangeLanguage((e) => onDidChangeLanguage(model, e)));
}
dispose() {
this._modelEventListeners.dispose();
}
};
DEFAULT_EOL = isLinux || isMacintosh ? 1 : 2;
DisposedModelInfo = class {
constructor(uri, initialUndoRedoSnapshot, time, sharesUndoRedoStack, heapSize, sha1, versionId, alternativeVersionId) {
this.uri = uri;
this.initialUndoRedoSnapshot = initialUndoRedoSnapshot;
this.time = time;
this.sharesUndoRedoStack = sharesUndoRedoStack;
this.heapSize = heapSize;
this.sha1 = sha1;
this.versionId = versionId;
this.alternativeVersionId = alternativeVersionId;
}
};
ModelService = ModelService_1 = class ModelService2 extends Disposable {
constructor(_configurationService, _resourcePropertiesService, _undoRedoService, _languageService, _languageConfigurationService) {
super();
this._configurationService = _configurationService;
this._resourcePropertiesService = _resourcePropertiesService;
this._undoRedoService = _undoRedoService;
this._languageService = _languageService;
this._languageConfigurationService = _languageConfigurationService;
this._onModelAdded = this._register(new Emitter());
this.onModelAdded = this._onModelAdded.event;
this._onModelRemoved = this._register(new Emitter());
this.onModelRemoved = this._onModelRemoved.event;
this._onModelModeChanged = this._register(new Emitter());
this.onModelLanguageChanged = this._onModelModeChanged.event;
this._modelCreationOptionsByLanguageAndResource = /* @__PURE__ */ Object.create(null);
this._models = {};
this._disposedModels = /* @__PURE__ */ new Map();
this._disposedModelsHeapSize = 0;
this._register(this._configurationService.onDidChangeConfiguration((e) => this._updateModelOptions(e)));
this._updateModelOptions(void 0);
}
static _readModelOptions(config, isForSimpleWidget) {
var _a10;
let tabSize = EDITOR_MODEL_DEFAULTS.tabSize;
if (config.editor && typeof config.editor.tabSize !== "undefined") {
const parsedTabSize = parseInt(config.editor.tabSize, 10);
if (!isNaN(parsedTabSize)) {
tabSize = parsedTabSize;
}
if (tabSize < 1) {
tabSize = 1;
}
}
let indentSize = "tabSize";
if (config.editor && typeof config.editor.indentSize !== "undefined" && config.editor.indentSize !== "tabSize") {
const parsedIndentSize = parseInt(config.editor.indentSize, 10);
if (!isNaN(parsedIndentSize)) {
indentSize = Math.max(parsedIndentSize, 1);
}
}
let insertSpaces = EDITOR_MODEL_DEFAULTS.insertSpaces;
if (config.editor && typeof config.editor.insertSpaces !== "undefined") {
insertSpaces = config.editor.insertSpaces === "false" ? false : Boolean(config.editor.insertSpaces);
}
let newDefaultEOL = DEFAULT_EOL;
const eol = config.eol;
if (eol === "\r\n") {
newDefaultEOL = 2;
} else if (eol === "\n") {
newDefaultEOL = 1;
}
let trimAutoWhitespace = EDITOR_MODEL_DEFAULTS.trimAutoWhitespace;
if (config.editor && typeof config.editor.trimAutoWhitespace !== "undefined") {
trimAutoWhitespace = config.editor.trimAutoWhitespace === "false" ? false : Boolean(config.editor.trimAutoWhitespace);
}
let detectIndentation = EDITOR_MODEL_DEFAULTS.detectIndentation;
if (config.editor && typeof config.editor.detectIndentation !== "undefined") {
detectIndentation = config.editor.detectIndentation === "false" ? false : Boolean(config.editor.detectIndentation);
}
let largeFileOptimizations = EDITOR_MODEL_DEFAULTS.largeFileOptimizations;
if (config.editor && typeof config.editor.largeFileOptimizations !== "undefined") {
largeFileOptimizations = config.editor.largeFileOptimizations === "false" ? false : Boolean(config.editor.largeFileOptimizations);
}
let bracketPairColorizationOptions = EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions;
if (((_a10 = config.editor) === null || _a10 === void 0 ? void 0 : _a10.bracketPairColorization) && typeof config.editor.bracketPairColorization === "object") {
bracketPairColorizationOptions = {
enabled: !!config.editor.bracketPairColorization.enabled,
independentColorPoolPerBracketType: !!config.editor.bracketPairColorization.independentColorPoolPerBracketType
};
}
return {
isForSimpleWidget,
tabSize,
indentSize,
insertSpaces,
detectIndentation,
defaultEOL: newDefaultEOL,
trimAutoWhitespace,
largeFileOptimizations,
bracketPairColorizationOptions
};
}
_getEOL(resource, language82) {
if (resource) {
return this._resourcePropertiesService.getEOL(resource, language82);
}
const eol = this._configurationService.getValue("files.eol", { overrideIdentifier: language82 });
if (eol && typeof eol === "string" && eol !== "auto") {
return eol;
}
return OS === 3 || OS === 2 ? "\n" : "\r\n";
}
_shouldRestoreUndoStack() {
const result = this._configurationService.getValue("files.restoreUndoStack");
if (typeof result === "boolean") {
return result;
}
return true;
}
getCreationOptions(languageIdOrSelection, resource, isForSimpleWidget) {
const language82 = typeof languageIdOrSelection === "string" ? languageIdOrSelection : languageIdOrSelection.languageId;
let creationOptions = this._modelCreationOptionsByLanguageAndResource[language82 + resource];
if (!creationOptions) {
const editor2 = this._configurationService.getValue("editor", { overrideIdentifier: language82, resource });
const eol = this._getEOL(resource, language82);
creationOptions = ModelService_1._readModelOptions({ editor: editor2, eol }, isForSimpleWidget);
this._modelCreationOptionsByLanguageAndResource[language82 + resource] = creationOptions;
}
return creationOptions;
}
_updateModelOptions(e) {
const oldOptionsByLanguageAndResource = this._modelCreationOptionsByLanguageAndResource;
this._modelCreationOptionsByLanguageAndResource = /* @__PURE__ */ Object.create(null);
const keys = Object.keys(this._models);
for (let i = 0, len = keys.length; i < len; i++) {
const modelId = keys[i];
const modelData = this._models[modelId];
const language82 = modelData.model.getLanguageId();
const uri = modelData.model.uri;
if (e && !e.affectsConfiguration("editor", { overrideIdentifier: language82, resource: uri }) && !e.affectsConfiguration("files.eol", { overrideIdentifier: language82, resource: uri })) {
continue;
}
const oldOptions = oldOptionsByLanguageAndResource[language82 + uri];
const newOptions = this.getCreationOptions(language82, uri, modelData.model.isForSimpleWidget);
ModelService_1._setModelOptionsForModel(modelData.model, newOptions, oldOptions);
}
}
static _setModelOptionsForModel(model, newOptions, currentOptions) {
if (currentOptions && currentOptions.defaultEOL !== newOptions.defaultEOL && model.getLineCount() === 1) {
model.setEOL(
newOptions.defaultEOL === 1 ? 0 : 1
/* EndOfLineSequence.CRLF */
);
}
if (currentOptions && currentOptions.detectIndentation === newOptions.detectIndentation && currentOptions.insertSpaces === newOptions.insertSpaces && currentOptions.tabSize === newOptions.tabSize && currentOptions.indentSize === newOptions.indentSize && currentOptions.trimAutoWhitespace === newOptions.trimAutoWhitespace && equals2(currentOptions.bracketPairColorizationOptions, newOptions.bracketPairColorizationOptions)) {
return;
}
if (newOptions.detectIndentation) {
model.detectIndentation(newOptions.insertSpaces, newOptions.tabSize);
model.updateOptions({
trimAutoWhitespace: newOptions.trimAutoWhitespace,
bracketColorizationOptions: newOptions.bracketPairColorizationOptions
});
} else {
model.updateOptions({
insertSpaces: newOptions.insertSpaces,
tabSize: newOptions.tabSize,
indentSize: newOptions.indentSize,
trimAutoWhitespace: newOptions.trimAutoWhitespace,
bracketColorizationOptions: newOptions.bracketPairColorizationOptions
});
}
}
// --- begin IModelService
_insertDisposedModel(disposedModelData) {
this._disposedModels.set(MODEL_ID2(disposedModelData.uri), disposedModelData);
this._disposedModelsHeapSize += disposedModelData.heapSize;
}
_removeDisposedModel(resource) {
const disposedModelData = this._disposedModels.get(MODEL_ID2(resource));
if (disposedModelData) {
this._disposedModelsHeapSize -= disposedModelData.heapSize;
}
this._disposedModels.delete(MODEL_ID2(resource));
return disposedModelData;
}
_ensureDisposedModelsHeapSize(maxModelsHeapSize) {
if (this._disposedModelsHeapSize > maxModelsHeapSize) {
const disposedModels = [];
this._disposedModels.forEach((entry) => {
if (!entry.sharesUndoRedoStack) {
disposedModels.push(entry);
}
});
disposedModels.sort((a3, b) => a3.time - b.time);
while (disposedModels.length > 0 && this._disposedModelsHeapSize > maxModelsHeapSize) {
const disposedModel = disposedModels.shift();
this._removeDisposedModel(disposedModel.uri);
if (disposedModel.initialUndoRedoSnapshot !== null) {
this._undoRedoService.restoreSnapshot(disposedModel.initialUndoRedoSnapshot);
}
}
}
}
_createModelData(value, languageIdOrSelection, resource, isForSimpleWidget) {
const options2 = this.getCreationOptions(languageIdOrSelection, resource, isForSimpleWidget);
const model = new TextModel(value, languageIdOrSelection, options2, resource, this._undoRedoService, this._languageService, this._languageConfigurationService);
if (resource && this._disposedModels.has(MODEL_ID2(resource))) {
const disposedModelData = this._removeDisposedModel(resource);
const elements = this._undoRedoService.getElements(resource);
const sha1Computer = this._getSHA1Computer();
const sha1IsEqual = sha1Computer.canComputeSHA1(model) ? sha1Computer.computeSHA1(model) === disposedModelData.sha1 : false;
if (sha1IsEqual || disposedModelData.sharesUndoRedoStack) {
for (const element of elements.past) {
if (isEditStackElement(element) && element.matchesResource(resource)) {
element.setModel(model);
}
}
for (const element of elements.future) {
if (isEditStackElement(element) && element.matchesResource(resource)) {
element.setModel(model);
}
}
this._undoRedoService.setElementsValidFlag(resource, true, (element) => isEditStackElement(element) && element.matchesResource(resource));
if (sha1IsEqual) {
model._overwriteVersionId(disposedModelData.versionId);
model._overwriteAlternativeVersionId(disposedModelData.alternativeVersionId);
model._overwriteInitialUndoRedoSnapshot(disposedModelData.initialUndoRedoSnapshot);
}
} else {
if (disposedModelData.initialUndoRedoSnapshot !== null) {
this._undoRedoService.restoreSnapshot(disposedModelData.initialUndoRedoSnapshot);
}
}
}
const modelId = MODEL_ID2(model.uri);
if (this._models[modelId]) {
throw new Error("ModelService: Cannot add model because it already exists!");
}
const modelData = new ModelData2(model, (model2) => this._onWillDispose(model2), (model2, e) => this._onDidChangeLanguage(model2, e));
this._models[modelId] = modelData;
return modelData;
}
createModel(value, languageSelection, resource, isForSimpleWidget = false) {
let modelData;
if (languageSelection) {
modelData = this._createModelData(value, languageSelection, resource, isForSimpleWidget);
} else {
modelData = this._createModelData(value, PLAINTEXT_LANGUAGE_ID, resource, isForSimpleWidget);
}
this._onModelAdded.fire(modelData.model);
return modelData.model;
}
getModels() {
const ret = [];
const keys = Object.keys(this._models);
for (let i = 0, len = keys.length; i < len; i++) {
const modelId = keys[i];
ret.push(this._models[modelId].model);
}
return ret;
}
getModel(resource) {
const modelId = MODEL_ID2(resource);
const modelData = this._models[modelId];
if (!modelData) {
return null;
}
return modelData.model;
}
// --- end IModelService
_schemaShouldMaintainUndoRedoElements(resource) {
return resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote || resource.scheme === Schemas.vscodeUserData || resource.scheme === Schemas.vscodeNotebookCell || resource.scheme === "fake-fs";
}
_onWillDispose(model) {
const modelId = MODEL_ID2(model.uri);
const modelData = this._models[modelId];
const sharesUndoRedoStack = this._undoRedoService.getUriComparisonKey(model.uri) !== model.uri.toString();
let maintainUndoRedoStack = false;
let heapSize = 0;
if (sharesUndoRedoStack || this._shouldRestoreUndoStack() && this._schemaShouldMaintainUndoRedoElements(model.uri)) {
const elements = this._undoRedoService.getElements(model.uri);
if (elements.past.length > 0 || elements.future.length > 0) {
for (const element of elements.past) {
if (isEditStackElement(element) && element.matchesResource(model.uri)) {
maintainUndoRedoStack = true;
heapSize += element.heapSize(model.uri);
element.setModel(model.uri);
}
}
for (const element of elements.future) {
if (isEditStackElement(element) && element.matchesResource(model.uri)) {
maintainUndoRedoStack = true;
heapSize += element.heapSize(model.uri);
element.setModel(model.uri);
}
}
}
}
const maxMemory = ModelService_1.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK;
const sha1Computer = this._getSHA1Computer();
if (!maintainUndoRedoStack) {
if (!sharesUndoRedoStack) {
const initialUndoRedoSnapshot = modelData.model.getInitialUndoRedoSnapshot();
if (initialUndoRedoSnapshot !== null) {
this._undoRedoService.restoreSnapshot(initialUndoRedoSnapshot);
}
}
} else if (!sharesUndoRedoStack && (heapSize > maxMemory || !sha1Computer.canComputeSHA1(model))) {
const initialUndoRedoSnapshot = modelData.model.getInitialUndoRedoSnapshot();
if (initialUndoRedoSnapshot !== null) {
this._undoRedoService.restoreSnapshot(initialUndoRedoSnapshot);
}
} else {
this._ensureDisposedModelsHeapSize(maxMemory - heapSize);
this._undoRedoService.setElementsValidFlag(model.uri, false, (element) => isEditStackElement(element) && element.matchesResource(model.uri));
this._insertDisposedModel(new DisposedModelInfo(model.uri, modelData.model.getInitialUndoRedoSnapshot(), Date.now(), sharesUndoRedoStack, heapSize, sha1Computer.computeSHA1(model), model.getVersionId(), model.getAlternativeVersionId()));
}
delete this._models[modelId];
modelData.dispose();
delete this._modelCreationOptionsByLanguageAndResource[model.getLanguageId() + model.uri];
this._onModelRemoved.fire(model);
}
_onDidChangeLanguage(model, e) {
const oldLanguageId = e.oldLanguage;
const newLanguageId = model.getLanguageId();
const oldOptions = this.getCreationOptions(oldLanguageId, model.uri, model.isForSimpleWidget);
const newOptions = this.getCreationOptions(newLanguageId, model.uri, model.isForSimpleWidget);
ModelService_1._setModelOptionsForModel(model, newOptions, oldOptions);
this._onModelModeChanged.fire({ model, oldLanguageId });
}
_getSHA1Computer() {
return new DefaultModelSHA1Computer();
}
};
ModelService.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK = 20 * 1024 * 1024;
ModelService = ModelService_1 = __decorate32([
__param29(0, IConfigurationService),
__param29(1, ITextResourcePropertiesService),
__param29(2, IUndoRedoService),
__param29(3, ILanguageService),
__param29(4, ILanguageConfigurationService)
], ModelService);
DefaultModelSHA1Computer = class _DefaultModelSHA1Computer {
canComputeSHA1(model) {
return model.getValueLength() <= _DefaultModelSHA1Computer.MAX_MODEL_SIZE;
}
computeSHA1(model) {
const shaComputer = new StringSHA1();
const snapshot = model.createSnapshot();
let text2;
while (text2 = snapshot.read()) {
shaComputer.update(text2);
}
return shaComputer.digest();
}
};
DefaultModelSHA1Computer.MAX_MODEL_SIZE = 10 * 1024 * 1024;
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInput.css
var init_standaloneQuickInput = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInput.css"() {
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js
var DefaultQuickAccessFilterValue, Extensions8, QuickAccessRegistry;
var init_quickAccess = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js"() {
init_arrays();
init_lifecycle();
init_platform2();
(function(DefaultQuickAccessFilterValue2) {
DefaultQuickAccessFilterValue2[DefaultQuickAccessFilterValue2["PRESERVE"] = 0] = "PRESERVE";
DefaultQuickAccessFilterValue2[DefaultQuickAccessFilterValue2["LAST"] = 1] = "LAST";
})(DefaultQuickAccessFilterValue || (DefaultQuickAccessFilterValue = {}));
Extensions8 = {
Quickaccess: "workbench.contributions.quickaccess"
};
QuickAccessRegistry = class {
constructor() {
this.providers = [];
this.defaultProvider = void 0;
}
registerQuickAccessProvider(provider) {
if (provider.prefix.length === 0) {
this.defaultProvider = provider;
} else {
this.providers.push(provider);
}
this.providers.sort((providerA, providerB) => providerB.prefix.length - providerA.prefix.length);
return toDisposable(() => {
this.providers.splice(this.providers.indexOf(provider), 1);
if (this.defaultProvider === provider) {
this.defaultProvider = void 0;
}
});
}
getQuickAccessProviders() {
return coalesce([this.defaultProvider, ...this.providers]);
}
getQuickAccessProvider(prefix) {
const result = prefix ? this.providers.find((provider) => prefix.startsWith(provider.prefix)) || void 0 : void 0;
return result || this.defaultProvider;
}
};
Registry.add(Extensions8.Quickaccess, new QuickAccessRegistry());
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickInput.js
var NO_KEY_MODS, QuickInputHideReason, ItemActivation, QuickPickFocus, QuickPickItemScorerAccessor, quickPickItemScorerAccessor, IQuickInputService;
var init_quickInput = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/common/quickInput.js"() {
init_instantiation();
NO_KEY_MODS = { ctrlCmd: false, alt: false };
(function(QuickInputHideReason2) {
QuickInputHideReason2[QuickInputHideReason2["Blur"] = 1] = "Blur";
QuickInputHideReason2[QuickInputHideReason2["Gesture"] = 2] = "Gesture";
QuickInputHideReason2[QuickInputHideReason2["Other"] = 3] = "Other";
})(QuickInputHideReason || (QuickInputHideReason = {}));
(function(ItemActivation2) {
ItemActivation2[ItemActivation2["NONE"] = 0] = "NONE";
ItemActivation2[ItemActivation2["FIRST"] = 1] = "FIRST";
ItemActivation2[ItemActivation2["SECOND"] = 2] = "SECOND";
ItemActivation2[ItemActivation2["LAST"] = 3] = "LAST";
})(ItemActivation || (ItemActivation = {}));
(function(QuickPickFocus2) {
QuickPickFocus2[QuickPickFocus2["First"] = 1] = "First";
QuickPickFocus2[QuickPickFocus2["Second"] = 2] = "Second";
QuickPickFocus2[QuickPickFocus2["Last"] = 3] = "Last";
QuickPickFocus2[QuickPickFocus2["Next"] = 4] = "Next";
QuickPickFocus2[QuickPickFocus2["Previous"] = 5] = "Previous";
QuickPickFocus2[QuickPickFocus2["NextPage"] = 6] = "NextPage";
QuickPickFocus2[QuickPickFocus2["PreviousPage"] = 7] = "PreviousPage";
QuickPickFocus2[QuickPickFocus2["NextSeparator"] = 8] = "NextSeparator";
QuickPickFocus2[QuickPickFocus2["PreviousSeparator"] = 9] = "PreviousSeparator";
})(QuickPickFocus || (QuickPickFocus = {}));
QuickPickItemScorerAccessor = class {
constructor(options2) {
this.options = options2;
}
};
quickPickItemScorerAccessor = new QuickPickItemScorerAccessor();
IQuickInputService = createDecorator("quickInputService");
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickAccess.js
var __decorate33, __param30, QuickAccessController;
var init_quickAccess2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickAccess.js"() {
init_async();
init_cancellation();
init_event();
init_lifecycle();
init_instantiation();
init_quickAccess();
init_quickInput();
init_platform2();
__decorate33 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param30 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
QuickAccessController = class QuickAccessController2 extends Disposable {
constructor(quickInputService, instantiationService) {
super();
this.quickInputService = quickInputService;
this.instantiationService = instantiationService;
this.registry = Registry.as(Extensions8.Quickaccess);
this.mapProviderToDescriptor = /* @__PURE__ */ new Map();
this.lastAcceptedPickerValues = /* @__PURE__ */ new Map();
this.visibleQuickAccess = void 0;
}
show(value = "", options2) {
this.doShowOrPick(value, false, options2);
}
doShowOrPick(value, pick, options2) {
var _a10, _b4, _c2, _d2;
const [provider, descriptor] = this.getOrInstantiateProvider(value, options2 === null || options2 === void 0 ? void 0 : options2.enabledProviderPrefixes);
const visibleQuickAccess = this.visibleQuickAccess;
const visibleDescriptor = visibleQuickAccess === null || visibleQuickAccess === void 0 ? void 0 : visibleQuickAccess.descriptor;
if (visibleQuickAccess && descriptor && visibleDescriptor === descriptor) {
if (value !== descriptor.prefix && !(options2 === null || options2 === void 0 ? void 0 : options2.preserveValue)) {
visibleQuickAccess.picker.value = value;
}
this.adjustValueSelection(visibleQuickAccess.picker, descriptor, options2);
return;
}
if (descriptor && !(options2 === null || options2 === void 0 ? void 0 : options2.preserveValue)) {
let newValue = void 0;
if (visibleQuickAccess && visibleDescriptor && visibleDescriptor !== descriptor) {
const newValueCandidateWithoutPrefix = visibleQuickAccess.value.substr(visibleDescriptor.prefix.length);
if (newValueCandidateWithoutPrefix) {
newValue = `${descriptor.prefix}${newValueCandidateWithoutPrefix}`;
}
}
if (!newValue) {
const defaultFilterValue = provider === null || provider === void 0 ? void 0 : provider.defaultFilterValue;
if (defaultFilterValue === DefaultQuickAccessFilterValue.LAST) {
newValue = this.lastAcceptedPickerValues.get(descriptor);
} else if (typeof defaultFilterValue === "string") {
newValue = `${descriptor.prefix}${defaultFilterValue}`;
}
}
if (typeof newValue === "string") {
value = newValue;
}
}
const visibleSelection = (_a10 = visibleQuickAccess === null || visibleQuickAccess === void 0 ? void 0 : visibleQuickAccess.picker) === null || _a10 === void 0 ? void 0 : _a10.valueSelection;
const visibleValue = (_b4 = visibleQuickAccess === null || visibleQuickAccess === void 0 ? void 0 : visibleQuickAccess.picker) === null || _b4 === void 0 ? void 0 : _b4.value;
const disposables = new DisposableStore();
const picker = disposables.add(this.quickInputService.createQuickPick());
picker.value = value;
this.adjustValueSelection(picker, descriptor, options2);
picker.placeholder = (_c2 = options2 === null || options2 === void 0 ? void 0 : options2.placeholder) !== null && _c2 !== void 0 ? _c2 : descriptor === null || descriptor === void 0 ? void 0 : descriptor.placeholder;
picker.quickNavigate = options2 === null || options2 === void 0 ? void 0 : options2.quickNavigateConfiguration;
picker.hideInput = !!picker.quickNavigate && !visibleQuickAccess;
if (typeof (options2 === null || options2 === void 0 ? void 0 : options2.itemActivation) === "number" || (options2 === null || options2 === void 0 ? void 0 : options2.quickNavigateConfiguration)) {
picker.itemActivation = (_d2 = options2 === null || options2 === void 0 ? void 0 : options2.itemActivation) !== null && _d2 !== void 0 ? _d2 : ItemActivation.SECOND;
}
picker.contextKey = descriptor === null || descriptor === void 0 ? void 0 : descriptor.contextKey;
picker.filterValue = (value2) => value2.substring(descriptor ? descriptor.prefix.length : 0);
let pickPromise = void 0;
if (pick) {
pickPromise = new DeferredPromise();
disposables.add(Event.once(picker.onWillAccept)((e) => {
e.veto();
picker.hide();
}));
}
disposables.add(this.registerPickerListeners(picker, provider, descriptor, value, options2));
const cts = disposables.add(new CancellationTokenSource());
if (provider) {
disposables.add(provider.provide(picker, cts.token, options2 === null || options2 === void 0 ? void 0 : options2.providerOptions));
}
Event.once(picker.onDidHide)(() => {
if (picker.selectedItems.length === 0) {
cts.cancel();
}
disposables.dispose();
pickPromise === null || pickPromise === void 0 ? void 0 : pickPromise.complete(picker.selectedItems.slice(0));
});
picker.show();
if (visibleSelection && visibleValue === value) {
picker.valueSelection = visibleSelection;
}
if (pick) {
return pickPromise === null || pickPromise === void 0 ? void 0 : pickPromise.p;
}
}
adjustValueSelection(picker, descriptor, options2) {
var _a10;
let valueSelection;
if (options2 === null || options2 === void 0 ? void 0 : options2.preserveValue) {
valueSelection = [picker.value.length, picker.value.length];
} else {
valueSelection = [(_a10 = descriptor === null || descriptor === void 0 ? void 0 : descriptor.prefix.length) !== null && _a10 !== void 0 ? _a10 : 0, picker.value.length];
}
picker.valueSelection = valueSelection;
}
registerPickerListeners(picker, provider, descriptor, value, options2) {
const disposables = new DisposableStore();
const visibleQuickAccess = this.visibleQuickAccess = { picker, descriptor, value };
disposables.add(toDisposable(() => {
if (visibleQuickAccess === this.visibleQuickAccess) {
this.visibleQuickAccess = void 0;
}
}));
disposables.add(picker.onDidChangeValue((value2) => {
const [providerForValue] = this.getOrInstantiateProvider(value2, options2 === null || options2 === void 0 ? void 0 : options2.enabledProviderPrefixes);
if (providerForValue !== provider) {
this.show(value2, {
enabledProviderPrefixes: options2 === null || options2 === void 0 ? void 0 : options2.enabledProviderPrefixes,
// do not rewrite value from user typing!
preserveValue: true,
// persist the value of the providerOptions from the original showing
providerOptions: options2 === null || options2 === void 0 ? void 0 : options2.providerOptions
});
} else {
visibleQuickAccess.value = value2;
}
}));
if (descriptor) {
disposables.add(picker.onDidAccept(() => {
this.lastAcceptedPickerValues.set(descriptor, picker.value);
}));
}
return disposables;
}
getOrInstantiateProvider(value, enabledProviderPrefixes) {
const providerDescriptor = this.registry.getQuickAccessProvider(value);
if (!providerDescriptor || enabledProviderPrefixes && !(enabledProviderPrefixes === null || enabledProviderPrefixes === void 0 ? void 0 : enabledProviderPrefixes.includes(providerDescriptor.prefix))) {
return [void 0, void 0];
}
let provider = this.mapProviderToDescriptor.get(providerDescriptor);
if (!provider) {
provider = this.instantiationService.createInstance(providerDescriptor.ctor);
this.mapProviderToDescriptor.set(providerDescriptor, provider);
}
return [provider, providerDescriptor];
}
};
QuickAccessController = __decorate33([
__param30(0, IQuickInputService),
__param30(1, IInstantiationService)
], QuickAccessController);
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.css
var init_toggle = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js
var Toggle;
var init_toggle2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/toggle/toggle.js"() {
init_widget();
init_themables();
init_event();
init_toggle();
init_hoverDelegateFactory();
init_hoverDelegate2();
Toggle = class extends Widget {
constructor(opts) {
var _a10;
super();
this._onChange = this._register(new Emitter());
this.onChange = this._onChange.event;
this._onKeyDown = this._register(new Emitter());
this.onKeyDown = this._onKeyDown.event;
this._opts = opts;
this._checked = this._opts.isChecked;
const classes = ["monaco-custom-toggle"];
if (this._opts.icon) {
this._icon = this._opts.icon;
classes.push(...ThemeIcon.asClassNameArray(this._icon));
}
if (this._opts.actionClassName) {
classes.push(...this._opts.actionClassName.split(" "));
}
if (this._checked) {
classes.push("checked");
}
this.domNode = document.createElement("div");
this._hover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover((_a10 = opts.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("mouse"), this.domNode, this._opts.title));
this.domNode.classList.add(...classes);
if (!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, (ev) => {
if (this.enabled) {
this.checked = !this._checked;
this._onChange.fire(false);
ev.preventDefault();
}
});
this._register(this.ignoreGesture(this.domNode));
this.onkeydown(this.domNode, (keyboardEvent) => {
if (keyboardEvent.keyCode === 10 || keyboardEvent.keyCode === 3) {
this.checked = !this._checked;
this._onChange.fire(true);
keyboardEvent.preventDefault();
keyboardEvent.stopPropagation();
return;
}
this._onKeyDown.fire(keyboardEvent);
});
}
get enabled() {
return this.domNode.getAttribute("aria-disabled") !== "true";
}
focus() {
this.domNode.focus();
}
get checked() {
return this._checked;
}
set checked(newIsChecked) {
this._checked = newIsChecked;
this.domNode.setAttribute("aria-checked", String(this._checked));
this.domNode.classList.toggle("checked", this._checked);
this.applyStyles();
}
width() {
return 2 + 2 + 2 + 16;
}
applyStyles() {
if (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(false));
}
disable() {
this.domNode.setAttribute("aria-disabled", String(true));
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/media/quickInput.css
var init_quickInput2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/media/quickInput.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/common/linkedText.js
function parseLinkedText(text2) {
const result = [];
let index = 0;
let match2;
while (match2 = LINK_REGEX.exec(text2)) {
if (match2.index - index > 0) {
result.push(text2.substring(index, match2.index));
}
const [, label, href, , title] = match2;
if (title) {
result.push({ label, href, title });
} else {
result.push({ label, href });
}
index = match2.index + match2[0].length;
}
if (index < text2.length) {
result.push(text2.substring(index));
}
return new LinkedText(result);
}
var __decorate34, LinkedText, LINK_REGEX;
var init_linkedText = __esm({
"node_modules/monaco-editor/esm/vs/base/common/linkedText.js"() {
init_decorators();
__decorate34 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
LinkedText = class {
constructor(nodes) {
this.nodes = nodes;
}
toString() {
return this.nodes.map((node) => typeof node === "string" ? node : node.label).join("");
}
};
__decorate34([
memoize
], LinkedText.prototype, "toString", null);
LINK_REGEX = /\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputUtils.js
function getIconClass(iconPath) {
if (!iconPath) {
return void 0;
}
let iconClass;
const key = iconPath.dark.toString();
if (iconPathToClass[key]) {
iconClass = iconPathToClass[key];
} else {
iconClass = iconClassGenerator.nextId();
createCSSRule(`.${iconClass}, .hc-light .${iconClass}`, `background-image: ${asCSSUrl(iconPath.light || iconPath.dark)}`);
createCSSRule(`.vs-dark .${iconClass}, .hc-black .${iconClass}`, `background-image: ${asCSSUrl(iconPath.dark)}`);
iconPathToClass[key] = iconClass;
}
return iconClass;
}
function quickInputButtonToAction(button, id, run) {
let cssClasses = button.iconClass || getIconClass(button.iconPath);
if (button.alwaysVisible) {
cssClasses = cssClasses ? `${cssClasses} always-visible` : "always-visible";
}
return {
id,
label: "",
tooltip: button.tooltip || "",
class: cssClasses,
enabled: true,
run
};
}
function renderQuickInputDescription(description, container, actionHandler) {
reset(container);
const parsed = parseLinkedText(description);
let tabIndex = 0;
for (const node of parsed.nodes) {
if (typeof node === "string") {
container.append(...renderLabelWithIcons(node));
} else {
let title = node.title;
if (!title && node.href.startsWith("command:")) {
title = localize("executeCommand", "Click to execute command '{0}'", node.href.substring("command:".length));
} else if (!title) {
title = node.href;
}
const anchor = $("a", { href: node.href, title, tabIndex: tabIndex++ }, node.label);
anchor.style.textDecoration = "underline";
const handleOpen = (e) => {
if (isEventLike(e)) {
EventHelper.stop(e, true);
}
actionHandler.callback(node.href);
};
const onClick = actionHandler.disposables.add(new DomEmitter(anchor, EventType.CLICK)).event;
const onKeydown = actionHandler.disposables.add(new DomEmitter(anchor, EventType.KEY_DOWN)).event;
const onSpaceOrEnter = Event.chain(onKeydown, ($16) => $16.filter((e) => {
const event = new StandardKeyboardEvent(e);
return event.equals(
10
/* KeyCode.Space */
) || event.equals(
3
/* KeyCode.Enter */
);
}));
actionHandler.disposables.add(Gesture.addTarget(anchor));
const onTap = actionHandler.disposables.add(new DomEmitter(anchor, EventType2.Tap)).event;
Event.any(onClick, onTap, onSpaceOrEnter)(handleOpen, null, actionHandler.disposables);
container.appendChild(anchor);
}
}
}
var iconPathToClass, iconClassGenerator;
var init_quickInputUtils = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputUtils.js"() {
init_dom();
init_event2();
init_event();
init_keyboardEvent();
init_touch();
init_iconLabels();
init_idGenerator();
init_linkedText();
init_quickInput2();
init_nls();
iconPathToClass = {};
iconClassGenerator = new IdGenerator("quick-input-button-icon-");
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js
var __decorate35, __param31, inQuickInputContextKeyValue, InQuickInputContextKey, inQuickInputContext, quickInputTypeContextKeyValue, QuickInputTypeContextKey, endOfQuickInputBoxContextKeyValue, EndOfQuickInputBoxContextKey, endOfQuickInputBoxContext, backButton, QuickInput, QuickPick, InputBox, QuickInputHoverDelegate;
var init_quickInput3 = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInput.js"() {
init_dom();
init_keyboardEvent();
init_toggle2();
init_arrays();
init_async();
init_codicons();
init_event();
init_lifecycle();
init_platform();
init_severity();
init_themables();
init_quickInput2();
init_nls();
init_quickInput();
init_quickInputUtils();
init_configuration();
init_hover();
init_quickInput();
init_contextkey();
__decorate35 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param31 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
inQuickInputContextKeyValue = "inQuickInput";
InQuickInputContextKey = new RawContextKey(inQuickInputContextKeyValue, false, localize("inQuickInput", "Whether keyboard focus is inside the quick input control"));
inQuickInputContext = ContextKeyExpr.has(inQuickInputContextKeyValue);
quickInputTypeContextKeyValue = "quickInputType";
QuickInputTypeContextKey = new RawContextKey(quickInputTypeContextKeyValue, void 0, localize("quickInputType", "The type of the currently visible quick input"));
endOfQuickInputBoxContextKeyValue = "cursorAtEndOfQuickInputBox";
EndOfQuickInputBoxContextKey = new RawContextKey(endOfQuickInputBoxContextKeyValue, false, localize("cursorAtEndOfQuickInputBox", "Whether the cursor in the quick input is at the end of the input box"));
endOfQuickInputBoxContext = ContextKeyExpr.has(endOfQuickInputBoxContextKeyValue);
backButton = {
iconClass: ThemeIcon.asClassName(Codicon.quickInputBack),
tooltip: localize("quickInput.back", "Back"),
handle: -1
// TODO
};
QuickInput = class _QuickInput extends Disposable {
constructor(ui) {
super();
this.ui = ui;
this._widgetUpdated = false;
this.visible = false;
this._enabled = true;
this._busy = false;
this._ignoreFocusOut = false;
this._buttons = [];
this.buttonsUpdated = false;
this._toggles = [];
this.togglesUpdated = false;
this.noValidationMessage = _QuickInput.noPromptMessage;
this._severity = severity_default.Ignore;
this.onDidTriggerButtonEmitter = this._register(new Emitter());
this.onDidHideEmitter = this._register(new Emitter());
this.onWillHideEmitter = this._register(new Emitter());
this.onDisposeEmitter = this._register(new Emitter());
this.visibleDisposables = this._register(new DisposableStore());
this.onDidHide = this.onDidHideEmitter.event;
}
get title() {
return this._title;
}
set title(title) {
this._title = title;
this.update();
}
get description() {
return this._description;
}
set description(description) {
this._description = description;
this.update();
}
get step() {
return this._steps;
}
set step(step) {
this._steps = step;
this.update();
}
get totalSteps() {
return this._totalSteps;
}
set totalSteps(totalSteps) {
this._totalSteps = totalSteps;
this.update();
}
get enabled() {
return this._enabled;
}
set enabled(enabled) {
this._enabled = enabled;
this.update();
}
get contextKey() {
return this._contextKey;
}
set contextKey(contextKey) {
this._contextKey = contextKey;
this.update();
}
get busy() {
return this._busy;
}
set busy(busy) {
this._busy = busy;
this.update();
}
get ignoreFocusOut() {
return this._ignoreFocusOut;
}
set ignoreFocusOut(ignoreFocusOut) {
const shouldUpdate = this._ignoreFocusOut !== ignoreFocusOut && !isIOS;
this._ignoreFocusOut = ignoreFocusOut && !isIOS;
if (shouldUpdate) {
this.update();
}
}
get buttons() {
return this._buttons;
}
set buttons(buttons) {
this._buttons = buttons;
this.buttonsUpdated = true;
this.update();
}
get toggles() {
return this._toggles;
}
set toggles(toggles) {
this._toggles = toggles !== null && toggles !== void 0 ? toggles : [];
this.togglesUpdated = true;
this.update();
}
get validationMessage() {
return this._validationMessage;
}
set validationMessage(validationMessage) {
this._validationMessage = validationMessage;
this.update();
}
get severity() {
return this._severity;
}
set severity(severity) {
this._severity = severity;
this.update();
}
show() {
if (this.visible) {
return;
}
this.visibleDisposables.add(this.ui.onDidTriggerButton((button) => {
if (this.buttons.indexOf(button) !== -1) {
this.onDidTriggerButtonEmitter.fire(button);
}
}));
this.ui.show(this);
this.visible = true;
this._lastValidationMessage = void 0;
this._lastSeverity = void 0;
if (this.buttons.length) {
this.buttonsUpdated = true;
}
if (this.toggles.length) {
this.togglesUpdated = true;
}
this.update();
}
hide() {
if (!this.visible) {
return;
}
this.ui.hide();
}
didHide(reason = QuickInputHideReason.Other) {
this.visible = false;
this.visibleDisposables.clear();
this.onDidHideEmitter.fire({ reason });
}
willHide(reason = QuickInputHideReason.Other) {
this.onWillHideEmitter.fire({ reason });
}
update() {
var _a10, _b4;
if (!this.visible) {
return;
}
const title = this.getTitle();
if (title && this.ui.title.textContent !== title) {
this.ui.title.textContent = title;
} else if (!title && this.ui.title.innerHTML !== " ") {
this.ui.title.innerText = "\xA0";
}
const description = this.getDescription();
if (this.ui.description1.textContent !== description) {
this.ui.description1.textContent = description;
}
if (this.ui.description2.textContent !== description) {
this.ui.description2.textContent = description;
}
if (this._widgetUpdated) {
this._widgetUpdated = false;
if (this._widget) {
reset(this.ui.widget, this._widget);
} else {
reset(this.ui.widget);
}
}
if (this.busy && !this.busyDelay) {
this.busyDelay = new TimeoutTimer();
this.busyDelay.setIfNotSet(() => {
if (this.visible) {
this.ui.progressBar.infinite();
}
}, 800);
}
if (!this.busy && this.busyDelay) {
this.ui.progressBar.stop();
this.busyDelay.cancel();
this.busyDelay = void 0;
}
if (this.buttonsUpdated) {
this.buttonsUpdated = false;
this.ui.leftActionBar.clear();
const leftButtons = this.buttons.filter((button) => button === backButton).map((button, index) => quickInputButtonToAction(button, `id-${index}`, () => __async(this, null, function* () {
return this.onDidTriggerButtonEmitter.fire(button);
})));
this.ui.leftActionBar.push(leftButtons, { icon: true, label: false });
this.ui.rightActionBar.clear();
const rightButtons = this.buttons.filter((button) => button !== backButton).map((button, index) => quickInputButtonToAction(button, `id-${index}`, () => __async(this, null, function* () {
return this.onDidTriggerButtonEmitter.fire(button);
})));
this.ui.rightActionBar.push(rightButtons, { icon: true, label: false });
}
if (this.togglesUpdated) {
this.togglesUpdated = false;
const concreteToggles = (_b4 = (_a10 = this.toggles) === null || _a10 === void 0 ? void 0 : _a10.filter((opts) => opts instanceof Toggle)) !== null && _b4 !== void 0 ? _b4 : [];
this.ui.inputBox.toggles = concreteToggles;
}
this.ui.ignoreFocusOut = this.ignoreFocusOut;
this.ui.setEnabled(this.enabled);
this.ui.setContextKey(this.contextKey);
const validationMessage = this.validationMessage || this.noValidationMessage;
if (this._lastValidationMessage !== validationMessage) {
this._lastValidationMessage = validationMessage;
reset(this.ui.message);
renderQuickInputDescription(validationMessage, this.ui.message, {
callback: (content) => {
this.ui.linkOpenerDelegate(content);
},
disposables: this.visibleDisposables
});
}
if (this._lastSeverity !== this.severity) {
this._lastSeverity = this.severity;
this.showMessageDecoration(this.severity);
}
}
getTitle() {
if (this.title && this.step) {
return `${this.title} (${this.getSteps()})`;
}
if (this.title) {
return this.title;
}
if (this.step) {
return this.getSteps();
}
return "";
}
getDescription() {
return this.description || "";
}
getSteps() {
if (this.step && this.totalSteps) {
return localize("quickInput.steps", "{0}/{1}", this.step, this.totalSteps);
}
if (this.step) {
return String(this.step);
}
return "";
}
showMessageDecoration(severity) {
this.ui.inputBox.showDecoration(severity);
if (severity !== severity_default.Ignore) {
const styles = this.ui.inputBox.stylesForType(severity);
this.ui.message.style.color = styles.foreground ? `${styles.foreground}` : "";
this.ui.message.style.backgroundColor = styles.background ? `${styles.background}` : "";
this.ui.message.style.border = styles.border ? `1px solid ${styles.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();
}
};
QuickInput.noPromptMessage = localize("inputModeEntry", "Press 'Enter' to confirm your input or 'Escape' to cancel");
QuickPick = class _QuickPick extends QuickInput {
constructor() {
super(...arguments);
this._value = "";
this.onDidChangeValueEmitter = this._register(new Emitter());
this.onWillAcceptEmitter = this._register(new Emitter());
this.onDidAcceptEmitter = this._register(new Emitter());
this.onDidCustomEmitter = this._register(new Emitter());
this._items = [];
this.itemsUpdated = false;
this._canSelectMany = false;
this._canAcceptInBackground = false;
this._matchOnDescription = false;
this._matchOnDetail = false;
this._matchOnLabel = true;
this._matchOnLabelMode = "fuzzy";
this._sortByLabel = true;
this._keepScrollPosition = false;
this._itemActivation = ItemActivation.FIRST;
this._activeItems = [];
this.activeItemsUpdated = false;
this.activeItemsToConfirm = [];
this.onDidChangeActiveEmitter = this._register(new Emitter());
this._selectedItems = [];
this.selectedItemsUpdated = false;
this.selectedItemsToConfirm = [];
this.onDidChangeSelectionEmitter = this._register(new Emitter());
this.onDidTriggerItemButtonEmitter = this._register(new Emitter());
this.onDidTriggerSeparatorButtonEmitter = this._register(new Emitter());
this.valueSelectionUpdated = true;
this._ok = "default";
this._customButton = false;
this._focusEventBufferer = new EventBufferer();
this.type = "quickPick";
this.filterValue = (value) => value;
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(quickNavigate) {
this._quickNavigate = quickNavigate;
this.update();
}
get value() {
return this._value;
}
set value(value) {
this.doSetValue(value);
}
doSetValue(value, skipUpdate) {
if (this._value !== value) {
this._value = value;
if (!skipUpdate) {
this.update();
}
if (this.visible) {
const didFilter = this.ui.list.filter(this.filterValue(this._value));
if (didFilter) {
this.trySelectFirst();
}
}
this.onDidChangeValueEmitter.fire(this._value);
}
}
set ariaLabel(ariaLabel) {
this._ariaLabel = ariaLabel;
this.update();
}
get ariaLabel() {
return this._ariaLabel;
}
get placeholder() {
return this._placeholder;
}
set placeholder(placeholder) {
this._placeholder = placeholder;
this.update();
}
get items() {
return this._items;
}
get scrollTop() {
return this.ui.list.scrollTop;
}
set scrollTop(scrollTop) {
this.ui.list.scrollTop = scrollTop;
}
set items(items) {
this._items = items;
this.itemsUpdated = true;
this.update();
}
get canSelectMany() {
return this._canSelectMany;
}
set canSelectMany(canSelectMany) {
this._canSelectMany = canSelectMany;
this.update();
}
get canAcceptInBackground() {
return this._canAcceptInBackground;
}
set canAcceptInBackground(canAcceptInBackground) {
this._canAcceptInBackground = canAcceptInBackground;
}
get matchOnDescription() {
return this._matchOnDescription;
}
set matchOnDescription(matchOnDescription) {
this._matchOnDescription = matchOnDescription;
this.update();
}
get matchOnDetail() {
return this._matchOnDetail;
}
set matchOnDetail(matchOnDetail) {
this._matchOnDetail = matchOnDetail;
this.update();
}
get matchOnLabel() {
return this._matchOnLabel;
}
set matchOnLabel(matchOnLabel) {
this._matchOnLabel = matchOnLabel;
this.update();
}
get matchOnLabelMode() {
return this._matchOnLabelMode;
}
set matchOnLabelMode(matchOnLabelMode) {
this._matchOnLabelMode = matchOnLabelMode;
this.update();
}
get sortByLabel() {
return this._sortByLabel;
}
set sortByLabel(sortByLabel) {
this._sortByLabel = sortByLabel;
this.update();
}
get keepScrollPosition() {
return this._keepScrollPosition;
}
set keepScrollPosition(keepScrollPosition) {
this._keepScrollPosition = keepScrollPosition;
}
get itemActivation() {
return this._itemActivation;
}
set itemActivation(itemActivation) {
this._itemActivation = itemActivation;
}
get activeItems() {
return this._activeItems;
}
set activeItems(activeItems) {
this._activeItems = activeItems;
this.activeItemsUpdated = true;
this.update();
}
get selectedItems() {
return this._selectedItems;
}
set selectedItems(selectedItems) {
this._selectedItems = selectedItems;
this.selectedItemsUpdated = true;
this.update();
}
get keyMods() {
if (this._quickNavigate) {
return NO_KEY_MODS;
}
return this.ui.keyMods;
}
get valueSelection() {
const selection = this.ui.inputBox.getSelection();
if (!selection) {
return void 0;
}
return [selection.start, selection.end];
}
set valueSelection(valueSelection) {
this._valueSelection = valueSelection;
this.valueSelectionUpdated = true;
this.update();
}
get customButton() {
return this._customButton;
}
set customButton(showCustomButton) {
this._customButton = showCustomButton;
this.update();
}
get customLabel() {
return this._customButtonLabel;
}
set customLabel(label) {
this._customButtonLabel = label;
this.update();
}
get customHover() {
return this._customButtonHover;
}
set customHover(hover) {
this._customButtonHover = hover;
this.update();
}
get ok() {
return this._ok;
}
set ok(showOkButton) {
this._ok = showOkButton;
this.update();
}
get hideInput() {
return !!this._hideInput;
}
set hideInput(hideInput) {
this._hideInput = hideInput;
this.update();
}
trySelectFirst() {
if (!this.canSelectMany) {
this.ui.list.focus(QuickPickFocus.First);
}
}
show() {
if (!this.visible) {
this.visibleDisposables.add(this.ui.inputBox.onDidChange((value) => {
this.doSetValue(
value,
true
/* skip update since this originates from the UI */
);
}));
this.visibleDisposables.add(this.ui.onDidAccept(() => {
if (this.canSelectMany) {
if (!this.ui.list.getCheckedElements().length) {
this._selectedItems = [];
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
}
} else if (this.activeItems[0]) {
this._selectedItems = [this.activeItems[0]];
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
}
this.handleAccept(false);
}));
this.visibleDisposables.add(this.ui.onDidCustom(() => {
this.onDidCustomEmitter.fire();
}));
this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(
this.ui.list.onDidChangeFocus,
// Only fire the last event
(_, e) => e
)((focusedItems) => {
if (this.activeItemsUpdated) {
return;
}
if (this.activeItemsToConfirm !== this._activeItems && equals(focusedItems, this._activeItems, (a3, b) => a3 === b)) {
return;
}
this._activeItems = focusedItems;
this.onDidChangeActiveEmitter.fire(focusedItems);
}));
this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({ items: selectedItems, event }) => {
if (this.canSelectMany) {
if (selectedItems.length) {
this.ui.list.setSelectedElements([]);
}
return;
}
if (this.selectedItemsToConfirm !== this._selectedItems && equals(selectedItems, this._selectedItems, (a3, b) => a3 === b)) {
return;
}
this._selectedItems = selectedItems;
this.onDidChangeSelectionEmitter.fire(selectedItems);
if (selectedItems.length) {
this.handleAccept(
isMouseEvent(event) && event.button === 1
/* mouse middle click */
);
}
}));
this.visibleDisposables.add(this.ui.list.onChangedCheckedElements((checkedItems) => {
if (!this.canSelectMany) {
return;
}
if (this.selectedItemsToConfirm !== this._selectedItems && equals(checkedItems, this._selectedItems, (a3, b) => a3 === b)) {
return;
}
this._selectedItems = checkedItems;
this.onDidChangeSelectionEmitter.fire(checkedItems);
}));
this.visibleDisposables.add(this.ui.list.onButtonTriggered((event) => this.onDidTriggerItemButtonEmitter.fire(event)));
this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered((event) => this.onDidTriggerSeparatorButtonEmitter.fire(event)));
this.visibleDisposables.add(this.registerQuickNavigation());
this.valueSelectionUpdated = true;
}
super.show();
}
handleAccept(inBackground) {
let veto = false;
this.onWillAcceptEmitter.fire({ veto: () => veto = true });
if (!veto) {
this.onDidAcceptEmitter.fire({ inBackground });
}
}
registerQuickNavigation() {
return addDisposableListener(this.ui.container, EventType.KEY_UP, (e) => {
if (this.canSelectMany || !this._quickNavigate) {
return;
}
const keyboardEvent = new StandardKeyboardEvent(e);
const keyCode = keyboardEvent.keyCode;
const quickNavKeys = this._quickNavigate.keybindings;
const wasTriggerKeyPressed = quickNavKeys.some((k) => {
const chords = k.getChords();
if (chords.length > 1) {
return false;
}
if (chords[0].shiftKey && keyCode === 4) {
if (keyboardEvent.ctrlKey || keyboardEvent.altKey || keyboardEvent.metaKey) {
return false;
}
return true;
}
if (chords[0].altKey && keyCode === 6) {
return true;
}
if (chords[0].ctrlKey && keyCode === 5) {
return true;
}
if (chords[0].metaKey && keyCode === 57) {
return true;
}
return false;
});
if (wasTriggerKeyPressed) {
if (this.activeItems[0]) {
this._selectedItems = [this.activeItems[0]];
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
this.handleAccept(false);
}
this._quickNavigate = void 0;
}
});
}
update() {
if (!this.visible) {
return;
}
const scrollTopBefore = this.keepScrollPosition ? this.scrollTop : 0;
const hasDescription = !!this.description;
const visibilities = {
title: !!this.title || !!this.step || !!this.buttons.length,
description: hasDescription,
checkAll: this.canSelectMany && !this._hideCheckAll,
checkBox: this.canSelectMany,
inputBox: !this._hideInput,
progressBar: !this._hideInput || hasDescription,
visibleCount: true,
count: this.canSelectMany && !this._hideCountBadge,
ok: this.ok === "default" ? this.canSelectMany : this.ok,
list: true,
message: !!this.validationMessage,
customButton: this.customButton
};
this.ui.setVisibilities(visibilities);
super.update();
if (this.ui.inputBox.value !== this.value) {
this.ui.inputBox.value = this.value;
}
if (this.valueSelectionUpdated) {
this.valueSelectionUpdated = false;
this.ui.inputBox.select(this._valueSelection && { start: this._valueSelection[0], end: this._valueSelection[1] });
}
if (this.ui.inputBox.placeholder !== (this.placeholder || "")) {
this.ui.inputBox.placeholder = this.placeholder || "";
}
let ariaLabel = this.ariaLabel;
if (!ariaLabel && visibilities.inputBox) {
ariaLabel = this.placeholder || _QuickPick.DEFAULT_ARIA_LABEL;
if (this.title) {
ariaLabel += ` - ${this.title}`;
}
}
if (this.ui.list.ariaLabel !== ariaLabel) {
this.ui.list.ariaLabel = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 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;
if (this.itemsUpdated) {
this.itemsUpdated = false;
this._focusEventBufferer.bufferEvents(() => {
this.ui.list.setElements(this.items);
this.ui.list.shouldLoop = !this.canSelectMany;
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());
switch (this._itemActivation) {
case ItemActivation.NONE:
this._itemActivation = ItemActivation.FIRST;
break;
case ItemActivation.SECOND:
this.ui.list.focus(QuickPickFocus.Second);
this._itemActivation = ItemActivation.FIRST;
break;
case ItemActivation.LAST:
this.ui.list.focus(QuickPickFocus.Last);
this._itemActivation = ItemActivation.FIRST;
break;
default:
this.trySelectFirst();
break;
}
});
}
if (this.ui.container.classList.contains("show-checkboxes") !== !!this.canSelectMany) {
if (this.canSelectMany) {
this.ui.list.clearFocus();
} else {
this.trySelectFirst();
}
}
if (this.activeItemsUpdated) {
this.activeItemsUpdated = false;
this.activeItemsToConfirm = this._activeItems;
this.ui.list.setFocusedElements(this.activeItems);
if (this.activeItemsToConfirm === this._activeItems) {
this.activeItemsToConfirm = null;
}
}
if (this.selectedItemsUpdated) {
this.selectedItemsUpdated = false;
this.selectedItemsToConfirm = this._selectedItems;
if (this.canSelectMany) {
this.ui.list.setCheckedElements(this.selectedItems);
} else {
this.ui.list.setSelectedElements(this.selectedItems);
}
if (this.selectedItemsToConfirm === this._selectedItems) {
this.selectedItemsToConfirm = null;
}
}
this.ui.customButton.label = this.customLabel || "";
this.ui.customButton.element.title = this.customHover || "";
if (!visibilities.inputBox) {
this.ui.list.domFocus();
if (this.canSelectMany) {
this.ui.list.focus(QuickPickFocus.First);
}
}
if (this.keepScrollPosition) {
this.scrollTop = scrollTopBefore;
}
}
focus(focus) {
this.ui.list.focus(focus);
if (this.canSelectMany) {
this.ui.list.domFocus();
}
}
accept(inBackground) {
if (inBackground && !this._canAcceptInBackground) {
return;
}
if (this.activeItems[0]) {
this._selectedItems = [this.activeItems[0]];
this.onDidChangeSelectionEmitter.fire(this.selectedItems);
this.handleAccept(inBackground !== null && inBackground !== void 0 ? inBackground : false);
}
}
};
QuickPick.DEFAULT_ARIA_LABEL = localize("quickInputBox.ariaLabel", "Type to narrow down results.");
InputBox = class extends QuickInput {
constructor() {
super(...arguments);
this._value = "";
this.valueSelectionUpdated = true;
this._password = false;
this.onDidValueChangeEmitter = this._register(new Emitter());
this.onDidAcceptEmitter = this._register(new Emitter());
this.type = "inputBox";
this.onDidChangeValue = this.onDidValueChangeEmitter.event;
this.onDidAccept = this.onDidAcceptEmitter.event;
}
get value() {
return this._value;
}
set value(value) {
this._value = value || "";
this.update();
}
get placeholder() {
return this._placeholder;
}
set placeholder(placeholder) {
this._placeholder = placeholder;
this.update();
}
get password() {
return this._password;
}
set password(password) {
this._password = password;
this.update();
}
show() {
if (!this.visible) {
this.visibleDisposables.add(this.ui.inputBox.onDidChange((value) => {
if (value === this.value) {
return;
}
this._value = value;
this.onDidValueChangeEmitter.fire(value);
}));
this.visibleDisposables.add(this.ui.onDidAccept(() => this.onDidAcceptEmitter.fire()));
this.valueSelectionUpdated = true;
}
super.show();
}
update() {
if (!this.visible) {
return;
}
this.ui.container.classList.remove("hidden-input");
const visibilities = {
title: !!this.title || !!this.step || !!this.buttons.length,
description: !!this.description || !!this.step,
inputBox: true,
message: true,
progressBar: true
};
this.ui.setVisibilities(visibilities);
super.update();
if (this.ui.inputBox.value !== this.value) {
this.ui.inputBox.value = this.value;
}
if (this.valueSelectionUpdated) {
this.valueSelectionUpdated = false;
this.ui.inputBox.select(this._valueSelection && { start: this._valueSelection[0], end: this._valueSelection[1] });
}
if (this.ui.inputBox.placeholder !== (this.placeholder || "")) {
this.ui.inputBox.placeholder = this.placeholder || "";
}
if (this.ui.inputBox.password !== this.password) {
this.ui.inputBox.password = this.password;
}
}
};
QuickInputHoverDelegate = class QuickInputHoverDelegate2 extends WorkbenchHoverDelegate {
constructor(configurationService, hoverService) {
super("element", false, (options2) => this.getOverrideOptions(options2), configurationService, hoverService);
}
getOverrideOptions(options2) {
var _a10;
const showHoverHint = (isHTMLElement(options2.content) ? (_a10 = options2.content.textContent) !== null && _a10 !== void 0 ? _a10 : "" : typeof options2.content === "string" ? options2.content : options2.content.value).includes("\n");
return {
persistence: {
hideOnKeyDown: false
},
appearance: {
showHoverHint,
skipFadeInAnimation: true
}
};
}
};
QuickInputHoverDelegate = __decorate35([
__param31(0, IConfigurationService),
__param31(1, IHoverService)
], QuickInputHoverDelegate);
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css
var init_button = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js
var unthemedButtonStyles, Button;
var init_button2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/button/button.js"() {
init_dom();
init_dompurify();
init_keyboardEvent();
init_markdownRenderer();
init_touch();
init_hoverDelegateFactory();
init_iconLabels();
init_color();
init_event();
init_htmlContent();
init_lifecycle();
init_themables();
init_button();
init_hoverDelegate2();
unthemedButtonStyles = {
buttonBackground: "#0E639C",
buttonHoverBackground: "#006BB3",
buttonSeparator: Color.white.toString(),
buttonForeground: Color.white.toString(),
buttonBorder: void 0,
buttonSecondaryBackground: void 0,
buttonSecondaryForeground: void 0,
buttonSecondaryHoverBackground: void 0
};
Button = class extends Disposable {
get onDidClick() {
return this._onDidClick.event;
}
constructor(container, options2) {
super();
this._label = "";
this._onDidClick = this._register(new Emitter());
this._onDidEscape = this._register(new Emitter());
this.options = options2;
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", !!options2.secondary);
const background = options2.secondary ? options2.buttonSecondaryBackground : options2.buttonBackground;
const foreground2 = options2.secondary ? options2.buttonSecondaryForeground : options2.buttonForeground;
this._element.style.color = foreground2 || "";
this._element.style.backgroundColor = background || "";
if (options2.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");
}
if (typeof options2.title === "string") {
this.setTitle(options2.title);
}
if (typeof options2.ariaLabel === "string") {
this._element.setAttribute("aria-label", options2.ariaLabel);
}
container.appendChild(this._element);
this._register(Gesture.addTarget(this._element));
[EventType.CLICK, EventType2.Tap].forEach((eventType) => {
this._register(addDisposableListener(this._element, eventType, (e) => {
if (!this.enabled) {
EventHelper.stop(e);
return;
}
this._onDidClick.fire(e);
}));
});
this._register(addDisposableListener(this._element, EventType.KEY_DOWN, (e) => {
const event = new StandardKeyboardEvent(e);
let eventHandled = false;
if (this.enabled && (event.equals(
3
/* KeyCode.Enter */
) || event.equals(
10
/* KeyCode.Space */
))) {
this._onDidClick.fire(e);
eventHandled = true;
} else if (event.equals(
9
/* KeyCode.Escape */
)) {
this._onDidEscape.fire(e);
this._element.blur();
eventHandled = true;
}
if (eventHandled) {
EventHelper.stop(event, true);
}
}));
this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, (e) => {
if (!this._element.classList.contains("disabled")) {
this.updateBackground(true);
}
}));
this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, (e) => {
this.updateBackground(false);
}));
this.focusTracker = this._register(trackFocus(this._element));
this._register(this.focusTracker.onDidFocus(() => {
if (this.enabled) {
this.updateBackground(true);
}
}));
this._register(this.focusTracker.onDidBlur(() => {
if (this.enabled) {
this.updateBackground(false);
}
}));
}
dispose() {
super.dispose();
this._element.remove();
}
getContentElements(content) {
const elements = [];
for (let segment of renderLabelWithIcons(content)) {
if (typeof segment === "string") {
segment = segment.trim();
if (segment === "") {
continue;
}
const node = document.createElement("span");
node.textContent = segment;
elements.push(node);
} else {
elements.push(segment);
}
}
return elements;
}
updateBackground(hover) {
let background;
if (this.options.secondary) {
background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
} else {
background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
}
if (background) {
this._element.style.backgroundColor = background;
}
}
get element() {
return this._element;
}
set label(value) {
var _a10;
if (this._label === value) {
return;
}
if (isMarkdownString(this._label) && isMarkdownString(value) && markdownStringEqual(this._label, value)) {
return;
}
this._element.classList.add("monaco-text-button");
const labelElement = this.options.supportShortLabel ? this._labelElement : this._element;
if (isMarkdownString(value)) {
const rendered = renderMarkdown(value, { inline: true });
rendered.dispose();
const root = (_a10 = rendered.element.querySelector("p")) === null || _a10 === void 0 ? void 0 : _a10.innerHTML;
if (root) {
const sanitized = sanitize(root, { ADD_TAGS: ["b", "i", "u", "code", "span"], ALLOWED_ATTR: ["class"], RETURN_TRUSTED_TYPE: true });
labelElement.innerHTML = sanitized;
} else {
reset(labelElement);
}
} else {
if (this.options.supportIcons) {
reset(labelElement, ...this.getContentElements(value));
} else {
labelElement.textContent = value;
}
}
let title = "";
if (typeof this.options.title === "string") {
title = this.options.title;
} else if (this.options.title) {
title = renderStringAsPlaintext(value);
}
this.setTitle(title);
if (typeof this.options.ariaLabel === "string") {
this._element.setAttribute("aria-label", this.options.ariaLabel);
} else if (this.options.ariaLabel) {
this._element.setAttribute("aria-label", title);
}
this._label = value;
}
get label() {
return this._label;
}
set icon(icon) {
this._element.classList.add(...ThemeIcon.asClassNameArray(icon));
}
set enabled(value) {
if (value) {
this._element.classList.remove("disabled");
this._element.setAttribute("aria-disabled", String(false));
this._element.tabIndex = 0;
} else {
this._element.classList.add("disabled");
this._element.setAttribute("aria-disabled", String(true));
}
}
get enabled() {
return !this._element.classList.contains("disabled");
}
setTitle(title) {
var _a10;
if (!this._hover && title !== "") {
this._hover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover((_a10 = this.options.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("mouse"), this._element, title));
} else if (this._hover) {
this._hover.update(title);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css
var init_countBadge = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js
var CountBadge;
var init_countBadge2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/countBadge/countBadge.js"() {
init_dom();
init_strings();
init_countBadge();
CountBadge = class {
constructor(container, options2, styles) {
this.options = options2;
this.styles = styles;
this.count = 0;
this.element = append(container, $(".monaco-count-badge"));
this.countFormat = this.options.countFormat || "{0}";
this.titleFormat = this.options.titleFormat || "";
this.setCount(this.options.count || 0);
}
setCount(count) {
this.count = count;
this.render();
}
setTitleFormat(titleFormat) {
this.titleFormat = titleFormat;
this.render();
}
render() {
var _a10, _b4;
this.element.textContent = format(this.countFormat, this.count);
this.element.title = format(this.titleFormat, this.count);
this.element.style.backgroundColor = (_a10 = this.styles.badgeBackground) !== null && _a10 !== void 0 ? _a10 : "";
this.element.style.color = (_b4 = this.styles.badgeForeground) !== null && _b4 !== void 0 ? _b4 : "";
if (this.styles.badgeBorder) {
this.element.style.border = `1px solid ${this.styles.badgeBorder}`;
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.css
var init_progressbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js
var CSS_DONE, CSS_ACTIVE, CSS_INFINITE, CSS_INFINITE_LONG_RUNNING, CSS_DISCRETE, ProgressBar;
var init_progressbar2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js"() {
init_dom();
init_async();
init_lifecycle();
init_progressbar();
CSS_DONE = "done";
CSS_ACTIVE = "active";
CSS_INFINITE = "infinite";
CSS_INFINITE_LONG_RUNNING = "infinite-long-running";
CSS_DISCRETE = "discrete";
ProgressBar = class _ProgressBar extends Disposable {
constructor(container, options2) {
super();
this.progressSignal = this._register(new MutableDisposable());
this.workedVal = 0;
this.showDelayedScheduler = this._register(new RunOnceScheduler(() => show(this.element), 0));
this.longRunningScheduler = this._register(new RunOnceScheduler(() => this.infiniteLongRunning(), _ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD));
this.create(container, options2);
}
create(container, options2) {
this.element = document.createElement("div");
this.element.classList.add("monaco-progress-container");
this.element.setAttribute("role", "progressbar");
this.element.setAttribute("aria-valuemin", "0");
container.appendChild(this.element);
this.bit = document.createElement("div");
this.bit.classList.add("progress-bit");
this.bit.style.backgroundColor = (options2 === null || options2 === void 0 ? void 0 : options2.progressBarBackground) || "#0E70C0";
this.element.appendChild(this.bit);
}
off() {
this.bit.style.width = "inherit";
this.bit.style.opacity = "1";
this.element.classList.remove(CSS_ACTIVE, CSS_INFINITE, CSS_INFINITE_LONG_RUNNING, CSS_DISCRETE);
this.workedVal = 0;
this.totalWork = void 0;
this.longRunningScheduler.cancel();
this.progressSignal.clear();
}
/**
* Stops the progressbar from showing any progress instantly without fading out.
*/
stop() {
return this.doDone(false);
}
doDone(delayed) {
this.element.classList.add(CSS_DONE);
if (!this.element.classList.contains(CSS_INFINITE)) {
this.bit.style.width = "inherit";
if (delayed) {
setTimeout(() => this.off(), 200);
} else {
this.off();
}
} else {
this.bit.style.opacity = "0";
if (delayed) {
setTimeout(() => this.off(), 200);
} else {
this.off();
}
}
return this;
}
/**
* Use this mode to indicate progress that has no total number of work units.
*/
infinite() {
this.bit.style.width = "2%";
this.bit.style.opacity = "1";
this.element.classList.remove(CSS_DISCRETE, CSS_DONE, CSS_INFINITE_LONG_RUNNING);
this.element.classList.add(CSS_ACTIVE, CSS_INFINITE);
this.longRunningScheduler.schedule();
return this;
}
infiniteLongRunning() {
this.element.classList.add(CSS_INFINITE_LONG_RUNNING);
}
getContainer() {
return this.element;
}
};
ProgressBar.LONG_RUNNING_INFINITE_THRESHOLD = 1e4;
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js
var NLS_CASE_SENSITIVE_TOGGLE_LABEL, NLS_WHOLE_WORD_TOGGLE_LABEL, NLS_REGEX_TOGGLE_LABEL, CaseSensitiveToggle, WholeWordsToggle, RegexToggle;
var init_findInputToggles = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInputToggles.js"() {
init_hoverDelegateFactory();
init_toggle2();
init_codicons();
init_nls();
NLS_CASE_SENSITIVE_TOGGLE_LABEL = localize("caseDescription", "Match Case");
NLS_WHOLE_WORD_TOGGLE_LABEL = localize("wordsDescription", "Match Whole Word");
NLS_REGEX_TOGGLE_LABEL = localize("regexDescription", "Use Regular Expression");
CaseSensitiveToggle = class extends Toggle {
constructor(opts) {
var _a10;
super({
icon: Codicon.caseSensitive,
title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle,
isChecked: opts.isChecked,
hoverDelegate: (_a10 = opts.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("element"),
inputActiveOptionBorder: opts.inputActiveOptionBorder,
inputActiveOptionForeground: opts.inputActiveOptionForeground,
inputActiveOptionBackground: opts.inputActiveOptionBackground
});
}
};
WholeWordsToggle = class extends Toggle {
constructor(opts) {
var _a10;
super({
icon: Codicon.wholeWord,
title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle,
isChecked: opts.isChecked,
hoverDelegate: (_a10 = opts.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("element"),
inputActiveOptionBorder: opts.inputActiveOptionBorder,
inputActiveOptionForeground: opts.inputActiveOptionForeground,
inputActiveOptionBackground: opts.inputActiveOptionBackground
});
}
};
RegexToggle = class extends Toggle {
constructor(opts) {
var _a10;
super({
icon: Codicon.regex,
title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle,
isChecked: opts.isChecked,
hoverDelegate: (_a10 = opts.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("element"),
inputActiveOptionBorder: opts.inputActiveOptionBorder,
inputActiveOptionForeground: opts.inputActiveOptionForeground,
inputActiveOptionBackground: opts.inputActiveOptionBackground
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/navigator.js
var ArrayNavigator;
var init_navigator = __esm({
"node_modules/monaco-editor/esm/vs/base/common/navigator.js"() {
ArrayNavigator = class {
constructor(items, start = 0, end = items.length, index = start - 1) {
this.items = items;
this.start = start;
this.end = end;
this.index = index;
}
current() {
if (this.index === this.start - 1 || this.index === this.end) {
return null;
}
return this.items[this.index];
}
next() {
this.index = Math.min(this.index + 1, this.end);
return this.current();
}
previous() {
this.index = Math.max(this.index - 1, this.start - 1);
return this.current();
}
first() {
this.index = this.start;
return this.current();
}
last() {
this.index = this.end - 1;
return this.current();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/history.js
var HistoryNavigator;
var init_history = __esm({
"node_modules/monaco-editor/esm/vs/base/common/history.js"() {
init_navigator();
HistoryNavigator = class {
constructor(history = [], limit = 10) {
this._initialize(history);
this._limit = limit;
this._onChange();
}
getHistory() {
return this._elements;
}
add(t4) {
this._history.delete(t4);
this._history.add(t4);
this._onChange();
}
next() {
return this._navigator.next();
}
previous() {
if (this._currentPosition() !== 0) {
return this._navigator.previous();
}
return 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(t4) {
return this._history.has(t4);
}
_onChange() {
this._reduceToLimit();
const elements = this._elements;
this._navigator = new ArrayNavigator(elements, 0, elements.length, elements.length);
}
_reduceToLimit() {
const data = this._elements;
if (data.length > this._limit) {
this._initialize(data.slice(data.length - this._limit));
}
}
_currentPosition() {
const currentElement = this._navigator.current();
if (!currentElement) {
return -1;
}
return this._elements.indexOf(currentElement);
}
_initialize(history) {
this._history = /* @__PURE__ */ new Set();
for (const entry of history) {
this._history.add(entry);
}
}
get _elements() {
const elements = [];
this._history.forEach((e) => elements.push(e));
return elements;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.css
var init_inputBox = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js
var $5, InputBox2, HistoryInputBox;
var init_inputBox2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/inputbox/inputBox.js"() {
init_dom();
init_event2();
init_formattedTextRenderer();
init_actionbar2();
init_aria2();
init_hoverDelegate2();
init_hoverDelegateFactory();
init_scrollableElement();
init_widget();
init_event();
init_history();
init_objects();
init_inputBox();
init_nls();
$5 = $;
InputBox2 = class extends Widget {
constructor(container, contextViewProvider, options2) {
var _a10;
super();
this.state = "idle";
this.maxHeight = Number.POSITIVE_INFINITY;
this._onDidChange = this._register(new Emitter());
this.onDidChange = this._onDidChange.event;
this._onDidHeightChange = this._register(new Emitter());
this.onDidHeightChange = this._onDidHeightChange.event;
this.contextViewProvider = contextViewProvider;
this.options = options2;
this.message = null;
this.placeholder = this.options.placeholder || "";
this.tooltip = (_a10 = this.options.tooltip) !== null && _a10 !== void 0 ? _a10 : this.placeholder || "";
this.ariaLabel = this.options.ariaLabel || "";
if (this.options.validationOptions) {
this.validation = this.options.validationOptions.validation;
}
this.element = append(container, $5(".monaco-inputbox.idle"));
const tagName = this.options.flexibleHeight ? "textarea" : "input";
const wrapper = append(this.element, $5(".ibwrapper"));
this.input = append(wrapper, $5(tagName + ".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"));
if (this.options.flexibleHeight) {
this.maxHeight = typeof this.options.flexibleMaxHeight === "number" ? this.options.flexibleMaxHeight : Number.POSITIVE_INFINITY;
this.mirror = append(wrapper, $5("div.mirror"));
this.mirror.innerText = "\xA0";
this.scrollableElement = new ScrollableElement(this.element, {
vertical: 1
/* ScrollbarVisibility.Auto */
});
if (this.options.flexibleWidth) {
this.input.setAttribute("wrap", "off");
this.mirror.style.whiteSpace = "pre";
this.mirror.style.wordWrap = "initial";
}
append(container, this.scrollableElement.getDomNode());
this._register(this.scrollableElement);
this._register(this.scrollableElement.onScroll((e) => this.input.scrollTop = e.scrollTop));
const onSelectionChange = this._register(new DomEmitter(container.ownerDocument, "selectionchange"));
const onAnchoredSelectionChange = Event.filter(onSelectionChange.event, () => {
const selection = container.ownerDocument.getSelection();
return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === wrapper;
});
this._register(onAnchoredSelectionChange(this.updateScrollDimensions, this));
this._register(this.onDidHeightChange(this.updateScrollDimensions, this));
} else {
this.input.type = this.options.type || "text";
this.input.setAttribute("wrap", "off");
}
if (this.ariaLabel) {
this.input.setAttribute("aria-label", this.ariaLabel);
}
if (this.placeholder && !this.options.showPlaceholderOnFocus) {
this.setPlaceHolder(this.placeholder);
}
if (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);
if (this.options.actions) {
this.actionbar = this._register(new ActionBar(this.element));
this.actionbar.push(this.options.actions, { icon: true, label: false });
}
this.applyStyles();
}
onBlur() {
this._hideMessage();
if (this.options.showPlaceholderOnFocus) {
this.input.setAttribute("placeholder", "");
}
}
onFocus() {
this._showMessage();
if (this.options.showPlaceholderOnFocus) {
this.input.setAttribute("placeholder", this.placeholder || "");
}
}
setPlaceHolder(placeHolder) {
this.placeholder = placeHolder;
this.input.setAttribute("placeholder", placeHolder);
}
setTooltip(tooltip) {
this.tooltip = tooltip;
if (!this.hover) {
this.hover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover(getDefaultHoverDelegate("mouse"), this.input, tooltip));
} else {
this.hover.update(tooltip);
}
}
get inputElement() {
return this.input;
}
get value() {
return this.input.value;
}
set value(newValue) {
if (this.input.value !== newValue) {
this.input.value = newValue;
this.onValueChange();
}
}
get height() {
return typeof this.cachedHeight === "number" ? this.cachedHeight : getTotalHeight(this.element);
}
focus() {
this.input.focus();
}
blur() {
this.input.blur();
}
hasFocus() {
return isActiveElement(this.input);
}
select(range2 = null) {
this.input.select();
if (range2) {
this.input.setSelectionRange(range2.start, range2.end);
if (range2.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 _a10;
const selectionStart = this.input.selectionStart;
if (selectionStart === null) {
return null;
}
const selectionEnd = (_a10 = this.input.selectionEnd) !== null && _a10 !== void 0 ? _a10 : selectionStart;
return {
start: selectionStart,
end: selectionEnd
};
}
enable() {
this.input.removeAttribute("disabled");
}
disable() {
this.blur();
this.input.disabled = true;
this._hideMessage();
}
set paddingRight(paddingRight) {
this.input.style.width = `calc(100% - ${paddingRight}px)`;
if (this.mirror) {
this.mirror.style.paddingRight = paddingRight + "px";
}
}
updateScrollDimensions() {
if (typeof this.cachedContentHeight !== "number" || typeof this.cachedHeight !== "number" || !this.scrollableElement) {
return;
}
const scrollHeight = this.cachedContentHeight;
const height = this.cachedHeight;
const scrollTop = this.input.scrollTop;
this.scrollableElement.setScrollDimensions({ scrollHeight, height });
this.scrollableElement.setScrollPosition({ scrollTop });
}
showMessage(message, force) {
if (this.state === "open" && equals2(this.message, message)) {
return;
}
this.message = message;
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(message.type));
const styles = this.stylesForType(this.message.type);
this.element.style.border = `1px solid ${asCssValueWithDefault(styles.border, "transparent")}`;
if (this.message.content && (this.hasFocus() || force)) {
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 errorMsg = null;
if (this.validation) {
errorMsg = this.validation(this.value);
if (errorMsg) {
this.inputElement.setAttribute("aria-invalid", "true");
this.showMessage(errorMsg);
} else if (this.inputElement.hasAttribute("aria-invalid")) {
this.inputElement.removeAttribute("aria-invalid");
this.hideMessage();
}
}
return errorMsg === null || errorMsg === void 0 ? void 0 : errorMsg.type;
}
stylesForType(type) {
const styles = this.options.inputBoxStyles;
switch (type) {
case 1:
return { border: styles.inputValidationInfoBorder, background: styles.inputValidationInfoBackground, foreground: styles.inputValidationInfoForeground };
case 2:
return { border: styles.inputValidationWarningBorder, background: styles.inputValidationWarningBackground, foreground: styles.inputValidationWarningForeground };
default:
return { border: styles.inputValidationErrorBorder, background: styles.inputValidationErrorBackground, foreground: styles.inputValidationErrorForeground };
}
}
classForType(type) {
switch (type) {
case 1:
return "info";
case 2:
return "warning";
default:
return "error";
}
}
_showMessage() {
if (!this.contextViewProvider || !this.message) {
return;
}
let div;
const layout2 = () => div.style.width = getTotalWidth(this.element) + "px";
this.contextViewProvider.showContextView({
getAnchor: () => this.element,
anchorAlignment: 1,
render: (container) => {
var _a10, _b4;
if (!this.message) {
return null;
}
div = append(container, $5(".monaco-inputbox-container"));
layout2();
const renderOptions = {
inline: true,
className: "monaco-inputbox-message"
};
const spanElement = this.message.formatContent ? renderFormattedText(this.message.content, renderOptions) : renderText(this.message.content, renderOptions);
spanElement.classList.add(this.classForType(this.message.type));
const styles = this.stylesForType(this.message.type);
spanElement.style.backgroundColor = (_a10 = styles.background) !== null && _a10 !== void 0 ? _a10 : "";
spanElement.style.color = (_b4 = styles.foreground) !== null && _b4 !== void 0 ? _b4 : "";
spanElement.style.border = styles.border ? `1px solid ${styles.border}` : "";
append(div, spanElement);
return null;
},
onHide: () => {
this.state = "closed";
},
layout: layout2
});
let alertText;
if (this.message.type === 3) {
alertText = localize("alertErrorMessage", "Error: {0}", this.message.content);
} else if (this.message.type === 2) {
alertText = localize("alertWarningMessage", "Warning: {0}", this.message.content);
} else {
alertText = localize("alertInfoMessage", "Info: {0}", this.message.content);
}
alert(alertText);
this.state = "open";
}
_hideMessage() {
if (!this.contextViewProvider) {
return;
}
if (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);
if (this.state === "open" && this.contextViewProvider) {
this.contextViewProvider.layout();
}
}
updateMirror() {
if (!this.mirror) {
return;
}
const value = this.value;
const lastCharCode = value.charCodeAt(value.length - 1);
const suffix = lastCharCode === 10 ? " " : "";
const mirrorTextContent = (value + suffix).replace(/\u000c/g, "");
if (mirrorTextContent) {
this.mirror.textContent = value + suffix;
} else {
this.mirror.innerText = "\xA0";
}
this.layout();
}
applyStyles() {
var _a10, _b4, _c2;
const styles = this.options.inputBoxStyles;
const background = (_a10 = styles.inputBackground) !== null && _a10 !== void 0 ? _a10 : "";
const foreground2 = (_b4 = styles.inputForeground) !== null && _b4 !== void 0 ? _b4 : "";
const border = (_c2 = styles.inputBorder) !== null && _c2 !== void 0 ? _c2 : "";
this.element.style.backgroundColor = background;
this.element.style.color = foreground2;
this.input.style.backgroundColor = "inherit";
this.input.style.color = foreground2;
this.element.style.border = `1px solid ${asCssValueWithDefault(border, "transparent")}`;
}
layout() {
if (!this.mirror) {
return;
}
const previousHeight = this.cachedContentHeight;
this.cachedContentHeight = getTotalHeight(this.mirror);
if (previousHeight !== this.cachedContentHeight) {
this.cachedHeight = Math.min(this.cachedContentHeight, this.maxHeight);
this.input.style.height = this.cachedHeight + "px";
this._onDidHeightChange.fire(this.cachedContentHeight);
}
}
insertAtCursor(text2) {
const inputElement = this.inputElement;
const start = inputElement.selectionStart;
const end = inputElement.selectionEnd;
const content = inputElement.value;
if (start !== null && end !== null) {
this.value = content.substr(0, start) + text2 + content.substr(end);
inputElement.setSelectionRange(start + 1, start + 1);
this.layout();
}
}
dispose() {
var _a10;
this._hideMessage();
this.message = null;
(_a10 = this.actionbar) === null || _a10 === void 0 ? void 0 : _a10.dispose();
super.dispose();
}
};
HistoryInputBox = class extends InputBox2 {
constructor(container, contextViewProvider, options2) {
const NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS = localize({
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`);
const NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS = localize({
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(container, contextViewProvider, options2);
this._onDidFocus = this._register(new Emitter());
this.onDidFocus = this._onDidFocus.event;
this._onDidBlur = this._register(new Emitter());
this.onDidBlur = this._onDidBlur.event;
this.history = new HistoryNavigator(options2.history, 100);
const addSuffix = () => {
if (options2.showHistoryHint && options2.showHistoryHint() && !this.placeholder.endsWith(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS) && !this.placeholder.endsWith(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS) && this.history.getHistory().length) {
const suffix = this.placeholder.endsWith(")") ? NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS : NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS;
const suffixedPlaceholder = this.placeholder + suffix;
if (options2.showPlaceholderOnFocus && !isActiveElement(this.input)) {
this.placeholder = suffixedPlaceholder;
} else {
this.setPlaceHolder(suffixedPlaceholder);
}
}
};
this.observer = new MutationObserver((mutationList, observer) => {
mutationList.forEach((mutation) => {
if (!mutation.target.textContent) {
addSuffix();
}
});
});
this.observer.observe(this.input, { attributeFilter: ["class"] });
this.onfocus(this.input, () => addSuffix());
this.onblur(this.input, () => {
const resetPlaceholder = (historyHint) => {
if (!this.placeholder.endsWith(historyHint)) {
return false;
} else {
const revertedPlaceholder = this.placeholder.slice(0, this.placeholder.length - historyHint.length);
if (options2.showPlaceholderOnFocus) {
this.placeholder = revertedPlaceholder;
} else {
this.setPlaceHolder(revertedPlaceholder);
}
return true;
}
};
if (!resetPlaceholder(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_IN_PARENS)) {
resetPlaceholder(NLS_PLACEHOLDER_HISTORY_HINT_SUFFIX_NO_PARENS);
}
});
}
dispose() {
super.dispose();
if (this.observer) {
this.observer.disconnect();
this.observer = void 0;
}
}
addToHistory(always) {
if (this.value && (always || this.value !== this.getCurrentValue())) {
this.history.add(this.value);
}
}
isAtLastInHistory() {
return this.history.isLast();
}
isNowhereInHistory() {
return this.history.isNowhere();
}
showNextValue() {
if (!this.history.has(this.value)) {
this.addToHistory();
}
let next = this.getNextValue();
if (next) {
next = next === this.value ? this.getNextValue() : next;
}
this.value = next !== null && next !== void 0 ? next : "";
status(this.value ? this.value : localize("clearedInput", "Cleared Input"));
}
showPreviousValue() {
if (!this.history.has(this.value)) {
this.addToHistory();
}
let previous = this.getPreviousValue();
if (previous) {
previous = previous === this.value ? this.getPreviousValue() : previous;
}
if (previous) {
this.value = previous;
status(this.value);
}
}
setPlaceHolder(placeHolder) {
super.setPlaceHolder(placeHolder);
this.setTooltip(placeHolder);
}
onBlur() {
super.onBlur();
this._onDidBlur.fire();
}
onFocus() {
super.onFocus();
this._onDidFocus.fire();
}
getCurrentValue() {
let currentValue = this.history.current();
if (!currentValue) {
currentValue = this.history.last();
this.history.next();
}
return currentValue;
}
getPreviousValue() {
return this.history.previous() || this.history.first();
}
getNextValue() {
return this.history.next();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css
var init_findInput = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js
var NLS_DEFAULT_LABEL, FindInput;
var init_findInput2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/findinput/findInput.js"() {
init_dom();
init_findInputToggles();
init_inputBox2();
init_widget();
init_event();
init_findInput();
init_nls();
init_lifecycle();
init_hoverDelegateFactory();
NLS_DEFAULT_LABEL = localize("defaultLabel", "input");
FindInput = class extends Widget {
constructor(parent, contextViewProvider, options2) {
super();
this.fixFocusOnOptionClickEnabled = true;
this.imeSessionInProgress = false;
this.additionalTogglesDisposables = this._register(new MutableDisposable());
this.additionalToggles = [];
this._onDidOptionChange = this._register(new Emitter());
this.onDidOptionChange = this._onDidOptionChange.event;
this._onKeyDown = this._register(new Emitter());
this.onKeyDown = this._onKeyDown.event;
this._onMouseDown = this._register(new Emitter());
this.onMouseDown = this._onMouseDown.event;
this._onInput = this._register(new Emitter());
this._onKeyUp = this._register(new Emitter());
this._onCaseSensitiveKeyDown = this._register(new Emitter());
this.onCaseSensitiveKeyDown = this._onCaseSensitiveKeyDown.event;
this._onRegexKeyDown = this._register(new Emitter());
this.onRegexKeyDown = this._onRegexKeyDown.event;
this._lastHighlightFindOptions = 0;
this.placeholder = options2.placeholder || "";
this.validation = options2.validation;
this.label = options2.label || NLS_DEFAULT_LABEL;
this.showCommonFindToggles = !!options2.showCommonFindToggles;
const appendCaseSensitiveLabel = options2.appendCaseSensitiveLabel || "";
const appendWholeWordsLabel = options2.appendWholeWordsLabel || "";
const appendRegexLabel = options2.appendRegexLabel || "";
const history = options2.history || [];
const flexibleHeight = !!options2.flexibleHeight;
const flexibleWidth = !!options2.flexibleWidth;
const flexibleMaxHeight = options2.flexibleMaxHeight;
this.domNode = document.createElement("div");
this.domNode.classList.add("monaco-findInput");
this.inputBox = this._register(new HistoryInputBox(this.domNode, contextViewProvider, {
placeholder: this.placeholder || "",
ariaLabel: this.label || "",
validationOptions: {
validation: this.validation
},
history,
showHistoryHint: options2.showHistoryHint,
flexibleHeight,
flexibleWidth,
flexibleMaxHeight,
inputBoxStyles: options2.inputBoxStyles
}));
const hoverDelegate = this._register(createInstantHoverDelegate());
if (this.showCommonFindToggles) {
this.regex = this._register(new RegexToggle(__spreadValues({
appendTitle: appendRegexLabel,
isChecked: false,
hoverDelegate
}, options2.toggleStyles)));
this._register(this.regex.onChange((viaKeyboard) => {
this._onDidOptionChange.fire(viaKeyboard);
if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
this.inputBox.focus();
}
this.validate();
}));
this._register(this.regex.onKeyDown((e) => {
this._onRegexKeyDown.fire(e);
}));
this.wholeWords = this._register(new WholeWordsToggle(__spreadValues({
appendTitle: appendWholeWordsLabel,
isChecked: false,
hoverDelegate
}, options2.toggleStyles)));
this._register(this.wholeWords.onChange((viaKeyboard) => {
this._onDidOptionChange.fire(viaKeyboard);
if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
this.inputBox.focus();
}
this.validate();
}));
this.caseSensitive = this._register(new CaseSensitiveToggle(__spreadValues({
appendTitle: appendCaseSensitiveLabel,
isChecked: false,
hoverDelegate
}, options2.toggleStyles)));
this._register(this.caseSensitive.onChange((viaKeyboard) => {
this._onDidOptionChange.fire(viaKeyboard);
if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
this.inputBox.focus();
}
this.validate();
}));
this._register(this.caseSensitive.onKeyDown((e) => {
this._onCaseSensitiveKeyDown.fire(e);
}));
const indexes = [this.caseSensitive.domNode, this.wholeWords.domNode, this.regex.domNode];
this.onkeydown(this.domNode, (event) => {
if (event.equals(
15
/* KeyCode.LeftArrow */
) || event.equals(
17
/* KeyCode.RightArrow */
) || event.equals(
9
/* KeyCode.Escape */
)) {
const index = indexes.indexOf(this.domNode.ownerDocument.activeElement);
if (index >= 0) {
let newIndex = -1;
if (event.equals(
17
/* KeyCode.RightArrow */
)) {
newIndex = (index + 1) % indexes.length;
} else if (event.equals(
15
/* KeyCode.LeftArrow */
)) {
if (index === 0) {
newIndex = indexes.length - 1;
} else {
newIndex = index - 1;
}
}
if (event.equals(
9
/* KeyCode.Escape */
)) {
indexes[index].blur();
this.inputBox.focus();
} else if (newIndex >= 0) {
indexes[newIndex].focus();
}
EventHelper.stop(event, true);
}
}
});
}
this.controls = document.createElement("div");
this.controls.className = "controls";
this.controls.style.display = this.showCommonFindToggles ? "" : "none";
if (this.caseSensitive) {
this.controls.append(this.caseSensitive.domNode);
}
if (this.wholeWords) {
this.controls.appendChild(this.wholeWords.domNode);
}
if (this.regex) {
this.controls.appendChild(this.regex.domNode);
}
this.setAdditionalToggles(options2 === null || options2 === void 0 ? void 0 : options2.additionalToggles);
if (this.controls) {
this.domNode.appendChild(this.controls);
}
parent === null || parent === void 0 ? void 0 : parent.appendChild(this.domNode);
this._register(addDisposableListener(this.inputBox.inputElement, "compositionstart", (e) => {
this.imeSessionInProgress = true;
}));
this._register(addDisposableListener(this.inputBox.inputElement, "compositionend", (e) => {
this.imeSessionInProgress = false;
this._onInput.fire();
}));
this.onkeydown(this.inputBox.inputElement, (e) => this._onKeyDown.fire(e));
this.onkeyup(this.inputBox.inputElement, (e) => this._onKeyUp.fire(e));
this.oninput(this.inputBox.inputElement, (e) => this._onInput.fire());
this.onmousedown(this.inputBox.inputElement, (e) => this._onMouseDown.fire(e));
}
get onDidChange() {
return this.inputBox.onDidChange;
}
layout(style) {
this.inputBox.layout();
this.updateInputBoxPadding(style.collapsedFindWidget);
}
enable() {
var _a10, _b4, _c2;
this.domNode.classList.remove("disabled");
this.inputBox.enable();
(_a10 = this.regex) === null || _a10 === void 0 ? void 0 : _a10.enable();
(_b4 = this.wholeWords) === null || _b4 === void 0 ? void 0 : _b4.enable();
(_c2 = this.caseSensitive) === null || _c2 === void 0 ? void 0 : _c2.enable();
for (const toggle of this.additionalToggles) {
toggle.enable();
}
}
disable() {
var _a10, _b4, _c2;
this.domNode.classList.add("disabled");
this.inputBox.disable();
(_a10 = this.regex) === null || _a10 === void 0 ? void 0 : _a10.disable();
(_b4 = this.wholeWords) === null || _b4 === void 0 ? void 0 : _b4.disable();
(_c2 = this.caseSensitive) === null || _c2 === void 0 ? void 0 : _c2.disable();
for (const toggle of this.additionalToggles) {
toggle.disable();
}
}
setFocusInputOnOptionClick(value) {
this.fixFocusOnOptionClickEnabled = value;
}
setEnabled(enabled) {
if (enabled) {
this.enable();
} else {
this.disable();
}
}
setAdditionalToggles(toggles) {
for (const currentToggle of this.additionalToggles) {
currentToggle.domNode.remove();
}
this.additionalToggles = [];
this.additionalTogglesDisposables.value = new DisposableStore();
for (const toggle of toggles !== null && toggles !== void 0 ? toggles : []) {
this.additionalTogglesDisposables.value.add(toggle);
this.controls.appendChild(toggle.domNode);
this.additionalTogglesDisposables.value.add(toggle.onChange((viaKeyboard) => {
this._onDidOptionChange.fire(viaKeyboard);
if (!viaKeyboard && this.fixFocusOnOptionClickEnabled) {
this.inputBox.focus();
}
}));
this.additionalToggles.push(toggle);
}
if (this.additionalToggles.length > 0) {
this.controls.style.display = "";
}
this.updateInputBoxPadding();
}
updateInputBoxPadding(controlsHidden = false) {
var _a10, _b4, _c2, _d2, _e2, _f3;
if (controlsHidden) {
this.inputBox.paddingRight = 0;
} else {
this.inputBox.paddingRight = ((_b4 = (_a10 = this.caseSensitive) === null || _a10 === void 0 ? void 0 : _a10.width()) !== null && _b4 !== void 0 ? _b4 : 0) + ((_d2 = (_c2 = this.wholeWords) === null || _c2 === void 0 ? void 0 : _c2.width()) !== null && _d2 !== void 0 ? _d2 : 0) + ((_f3 = (_e2 = this.regex) === null || _e2 === void 0 ? void 0 : _e2.width()) !== null && _f3 !== void 0 ? _f3 : 0) + this.additionalToggles.reduce((r, t4) => r + t4.width(), 0);
}
}
getValue() {
return this.inputBox.value;
}
setValue(value) {
if (this.inputBox.value !== value) {
this.inputBox.value = value;
}
}
select() {
this.inputBox.select();
}
focus() {
this.inputBox.focus();
}
getCaseSensitive() {
var _a10, _b4;
return (_b4 = (_a10 = this.caseSensitive) === null || _a10 === void 0 ? void 0 : _a10.checked) !== null && _b4 !== void 0 ? _b4 : false;
}
setCaseSensitive(value) {
if (this.caseSensitive) {
this.caseSensitive.checked = value;
}
}
getWholeWords() {
var _a10, _b4;
return (_b4 = (_a10 = this.wholeWords) === null || _a10 === void 0 ? void 0 : _a10.checked) !== null && _b4 !== void 0 ? _b4 : false;
}
setWholeWords(value) {
if (this.wholeWords) {
this.wholeWords.checked = value;
}
}
getRegex() {
var _a10, _b4;
return (_b4 = (_a10 = this.regex) === null || _a10 === void 0 ? void 0 : _a10.checked) !== null && _b4 !== void 0 ? _b4 : false;
}
setRegex(value) {
if (this.regex) {
this.regex.checked = value;
this.validate();
}
}
focusOnCaseSensitive() {
var _a10;
(_a10 = this.caseSensitive) === null || _a10 === void 0 ? void 0 : _a10.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(message) {
this.inputBox.showMessage(message);
}
clearMessage() {
this.inputBox.hideMessage();
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputBox.js
var $6, QuickInputBox;
var init_quickInputBox = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputBox.js"() {
init_dom();
init_findInput2();
init_lifecycle();
init_severity();
init_quickInput2();
$6 = $;
QuickInputBox = class extends Disposable {
constructor(parent, inputBoxStyles, toggleStyles) {
super();
this.parent = parent;
this.onKeyDown = (handler) => {
return addStandardDisposableListener(this.findInput.inputBox.inputElement, EventType.KEY_DOWN, handler);
};
this.onDidChange = (handler) => {
return this.findInput.onDidChange(handler);
};
this.container = append(this.parent, $6(".quick-input-box"));
this.findInput = this._register(new FindInput(this.container, void 0, { label: "", inputBoxStyles, toggleStyles }));
const input = this.findInput.inputBox.inputElement;
input.role = "combobox";
input.ariaHasPopup = "menu";
input.ariaAutoComplete = "list";
input.ariaExpanded = "true";
}
get value() {
return this.findInput.getValue();
}
set value(value) {
this.findInput.setValue(value);
}
select(range2 = null) {
this.findInput.inputBox.select(range2);
}
getSelection() {
return this.findInput.inputBox.getSelection();
}
isSelectionAtEnd() {
return this.findInput.inputBox.isSelectionAtEnd();
}
get placeholder() {
return this.findInput.inputBox.inputElement.getAttribute("placeholder") || "";
}
set placeholder(placeholder) {
this.findInput.inputBox.setPlaceHolder(placeholder);
}
get password() {
return this.findInput.inputBox.inputElement.type === "password";
}
set password(password) {
this.findInput.inputBox.inputElement.type = password ? "password" : "text";
}
set enabled(enabled) {
this.findInput.inputBox.inputElement.toggleAttribute("readonly", !enabled);
}
set toggles(toggles) {
this.findInput.setAdditionalToggles(toggles);
}
setAttribute(name, value) {
this.findInput.inputBox.inputElement.setAttribute(name, value);
}
showDecoration(decoration3) {
if (decoration3 === severity_default.Ignore) {
this.findInput.clearMessage();
} else {
this.findInput.showMessage({ type: decoration3 === severity_default.Info ? 1 : decoration3 === severity_default.Warning ? 2 : 3, content: "" });
}
}
stylesForType(decoration3) {
return this.findInput.inputBox.stylesForType(
decoration3 === severity_default.Info ? 1 : decoration3 === severity_default.Warning ? 2 : 3
/* MessageType.ERROR */
);
}
setFocus() {
this.findInput.focus();
}
layout() {
this.findInput.inputBox.layout();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js
function fromPagedListOptions(modelProvider, options2) {
return __spreadProps(__spreadValues({}, options2), {
accessibilityProvider: options2.accessibilityProvider && new PagedAccessibilityProvider(modelProvider, options2.accessibilityProvider)
});
}
var PagedRenderer, PagedAccessibilityProvider, PagedList;
var init_listPaging = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/list/listPaging.js"() {
init_arrays();
init_cancellation();
init_event();
init_lifecycle();
init_list();
init_listWidget();
PagedRenderer = class {
get templateId() {
return this.renderer.templateId;
}
constructor(renderer, modelProvider) {
this.renderer = renderer;
this.modelProvider = modelProvider;
}
renderTemplate(container) {
const data = this.renderer.renderTemplate(container);
return { data, disposable: Disposable.None };
}
renderElement(index, _, data, height) {
var _a10;
(_a10 = data.disposable) === null || _a10 === void 0 ? void 0 : _a10.dispose();
if (!data.data) {
return;
}
const model = this.modelProvider();
if (model.isResolved(index)) {
return this.renderer.renderElement(model.get(index), index, data.data, height);
}
const cts = new CancellationTokenSource();
const promise = model.resolve(index, cts.token);
data.disposable = { dispose: () => cts.cancel() };
this.renderer.renderPlaceholder(index, data.data);
promise.then((entry) => this.renderer.renderElement(entry, index, data.data, height));
}
disposeTemplate(data) {
if (data.disposable) {
data.disposable.dispose();
data.disposable = void 0;
}
if (data.data) {
this.renderer.disposeTemplate(data.data);
data.data = void 0;
}
}
};
PagedAccessibilityProvider = class {
constructor(modelProvider, accessibilityProvider) {
this.modelProvider = modelProvider;
this.accessibilityProvider = accessibilityProvider;
}
getWidgetAriaLabel() {
return this.accessibilityProvider.getWidgetAriaLabel();
}
getAriaLabel(index) {
const model = this.modelProvider();
if (!model.isResolved(index)) {
return null;
}
return this.accessibilityProvider.getAriaLabel(model.get(index));
}
};
PagedList = class {
constructor(user, container, virtualDelegate, renderers, options2 = {}) {
const modelProvider = () => this.model;
const pagedRenderers = renderers.map((r) => new PagedRenderer(r, modelProvider));
this.list = new List(user, container, virtualDelegate, pagedRenderers, fromPagedListOptions(modelProvider, options2));
}
updateOptions(options2) {
this.list.updateOptions(options2);
}
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 Event.map(this.list.onMouseDblClick, ({ element, index, browserEvent }) => ({ element: element === void 0 ? void 0 : this._model.get(element), index, browserEvent }));
}
get onPointer() {
return Event.map(this.list.onPointer, ({ element, index, browserEvent }) => ({ element: element === void 0 ? void 0 : this._model.get(element), index, browserEvent }));
}
get onDidChangeSelection() {
return Event.map(this.list.onDidChangeSelection, ({ elements, indexes, browserEvent }) => ({ elements: elements.map((e) => this._model.get(e)), indexes, browserEvent }));
}
get model() {
return this._model;
}
set model(model) {
this._model = model;
this.list.splice(0, this.list.length, range(model.length));
}
getFocus() {
return this.list.getFocus();
}
getSelection() {
return this.list.getSelection();
}
getSelectedElements() {
return this.getSelection().map((i) => this.model.get(i));
}
style(styles) {
this.list.style(styles);
}
dispose() {
this.list.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.css
var init_sash = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js
var __decorate36, DEBUG2, OrthogonalEdge, globalSize, onDidChangeGlobalSize, globalHoverDelay, onDidChangeHoverDelay, MouseEventFactory, GestureEventFactory, OrthogonalPointerEventFactory, PointerEventsDisabledCssClass, Sash;
var init_sash2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/sash/sash.js"() {
init_dom();
init_event2();
init_touch();
init_async();
init_decorators();
init_event();
init_lifecycle();
init_platform();
init_sash();
__decorate36 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
DEBUG2 = false;
(function(OrthogonalEdge2) {
OrthogonalEdge2["North"] = "north";
OrthogonalEdge2["South"] = "south";
OrthogonalEdge2["East"] = "east";
OrthogonalEdge2["West"] = "west";
})(OrthogonalEdge || (OrthogonalEdge = {}));
globalSize = 4;
onDidChangeGlobalSize = new Emitter();
globalHoverDelay = 300;
onDidChangeHoverDelay = new Emitter();
MouseEventFactory = class {
constructor(el) {
this.el = el;
this.disposables = new DisposableStore();
}
get onPointerMove() {
return this.disposables.add(new DomEmitter(getWindow(this.el), "mousemove")).event;
}
get onPointerUp() {
return this.disposables.add(new DomEmitter(getWindow(this.el), "mouseup")).event;
}
dispose() {
this.disposables.dispose();
}
};
__decorate36([
memoize
], MouseEventFactory.prototype, "onPointerMove", null);
__decorate36([
memoize
], MouseEventFactory.prototype, "onPointerUp", null);
GestureEventFactory = class {
get onPointerMove() {
return this.disposables.add(new DomEmitter(this.el, EventType2.Change)).event;
}
get onPointerUp() {
return this.disposables.add(new DomEmitter(this.el, EventType2.End)).event;
}
constructor(el) {
this.el = el;
this.disposables = new DisposableStore();
}
dispose() {
this.disposables.dispose();
}
};
__decorate36([
memoize
], GestureEventFactory.prototype, "onPointerMove", null);
__decorate36([
memoize
], GestureEventFactory.prototype, "onPointerUp", null);
OrthogonalPointerEventFactory = class {
get onPointerMove() {
return this.factory.onPointerMove;
}
get onPointerUp() {
return this.factory.onPointerUp;
}
constructor(factory) {
this.factory = factory;
}
dispose() {
}
};
__decorate36([
memoize
], OrthogonalPointerEventFactory.prototype, "onPointerMove", null);
__decorate36([
memoize
], OrthogonalPointerEventFactory.prototype, "onPointerUp", null);
PointerEventsDisabledCssClass = "pointer-events-disabled";
Sash = class _Sash extends Disposable {
get state() {
return this._state;
}
get orthogonalStartSash() {
return this._orthogonalStartSash;
}
get orthogonalEndSash() {
return this._orthogonalEndSash;
}
/**
* The state of a sash defines whether it can be interacted with by the user
* as well as what mouse cursor to use, when hovered.
*/
set state(state) {
if (this._state === state) {
return;
}
this.el.classList.toggle(
"disabled",
state === 0
/* SashState.Disabled */
);
this.el.classList.toggle(
"minimum",
state === 1
/* SashState.AtMinimum */
);
this.el.classList.toggle(
"maximum",
state === 2
/* SashState.AtMaximum */
);
this._state = state;
this.onDidEnablementChange.fire(state);
}
/**
* A reference to another sash, perpendicular to this one, which
* aligns at the start of this one. A corner sash will be created
* automatically at that location.
*
* The start of a horizontal sash is its left-most position.
* The start of a vertical sash is its top-most position.
*/
set orthogonalStartSash(sash) {
if (this._orthogonalStartSash === sash) {
return;
}
this.orthogonalStartDragHandleDisposables.clear();
this.orthogonalStartSashDisposables.clear();
if (sash) {
const onChange = (state) => {
this.orthogonalStartDragHandleDisposables.clear();
if (state !== 0) {
this._orthogonalStartDragHandle = append(this.el, $(".orthogonal-drag-handle.start"));
this.orthogonalStartDragHandleDisposables.add(toDisposable(() => this._orthogonalStartDragHandle.remove()));
this.orthogonalStartDragHandleDisposables.add(new DomEmitter(this._orthogonalStartDragHandle, "mouseenter")).event(() => _Sash.onMouseEnter(sash), void 0, this.orthogonalStartDragHandleDisposables);
this.orthogonalStartDragHandleDisposables.add(new DomEmitter(this._orthogonalStartDragHandle, "mouseleave")).event(() => _Sash.onMouseLeave(sash), void 0, this.orthogonalStartDragHandleDisposables);
}
};
this.orthogonalStartSashDisposables.add(sash.onDidEnablementChange.event(onChange, this));
onChange(sash.state);
}
this._orthogonalStartSash = sash;
}
/**
* A reference to another sash, perpendicular to this one, which
* aligns at the end of this one. A corner sash will be created
* automatically at that location.
*
* The end of a horizontal sash is its right-most position.
* The end of a vertical sash is its bottom-most position.
*/
set orthogonalEndSash(sash) {
if (this._orthogonalEndSash === sash) {
return;
}
this.orthogonalEndDragHandleDisposables.clear();
this.orthogonalEndSashDisposables.clear();
if (sash) {
const onChange = (state) => {
this.orthogonalEndDragHandleDisposables.clear();
if (state !== 0) {
this._orthogonalEndDragHandle = append(this.el, $(".orthogonal-drag-handle.end"));
this.orthogonalEndDragHandleDisposables.add(toDisposable(() => this._orthogonalEndDragHandle.remove()));
this.orthogonalEndDragHandleDisposables.add(new DomEmitter(this._orthogonalEndDragHandle, "mouseenter")).event(() => _Sash.onMouseEnter(sash), void 0, this.orthogonalEndDragHandleDisposables);
this.orthogonalEndDragHandleDisposables.add(new DomEmitter(this._orthogonalEndDragHandle, "mouseleave")).event(() => _Sash.onMouseLeave(sash), void 0, this.orthogonalEndDragHandleDisposables);
}
};
this.orthogonalEndSashDisposables.add(sash.onDidEnablementChange.event(onChange, this));
onChange(sash.state);
}
this._orthogonalEndSash = sash;
}
constructor(container, layoutProvider, options2) {
super();
this.hoverDelay = globalHoverDelay;
this.hoverDelayer = this._register(new Delayer(this.hoverDelay));
this._state = 3;
this.onDidEnablementChange = this._register(new Emitter());
this._onDidStart = this._register(new Emitter());
this._onDidChange = this._register(new Emitter());
this._onDidReset = this._register(new Emitter());
this._onDidEnd = this._register(new Emitter());
this.orthogonalStartSashDisposables = this._register(new DisposableStore());
this.orthogonalStartDragHandleDisposables = this._register(new DisposableStore());
this.orthogonalEndSashDisposables = this._register(new DisposableStore());
this.orthogonalEndDragHandleDisposables = this._register(new DisposableStore());
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 = append(container, $(".monaco-sash"));
if (options2.orthogonalEdge) {
this.el.classList.add(`orthogonal-edge-${options2.orthogonalEdge}`);
}
if (isMacintosh) {
this.el.classList.add("mac");
}
const onMouseDown = this._register(new DomEmitter(this.el, "mousedown")).event;
this._register(onMouseDown((e) => this.onPointerStart(e, new MouseEventFactory(container)), this));
const onMouseDoubleClick = this._register(new DomEmitter(this.el, "dblclick")).event;
this._register(onMouseDoubleClick(this.onPointerDoublePress, this));
const onMouseEnter = this._register(new DomEmitter(this.el, "mouseenter")).event;
this._register(onMouseEnter(() => _Sash.onMouseEnter(this)));
const onMouseLeave = this._register(new DomEmitter(this.el, "mouseleave")).event;
this._register(onMouseLeave(() => _Sash.onMouseLeave(this)));
this._register(Gesture.addTarget(this.el));
const onTouchStart = this._register(new DomEmitter(this.el, EventType2.Start)).event;
this._register(onTouchStart((e) => this.onPointerStart(e, new GestureEventFactory(this.el)), this));
const onTap = this._register(new DomEmitter(this.el, EventType2.Tap)).event;
let doubleTapTimeout = void 0;
this._register(onTap((event) => {
if (doubleTapTimeout) {
clearTimeout(doubleTapTimeout);
doubleTapTimeout = void 0;
this.onPointerDoublePress(event);
return;
}
clearTimeout(doubleTapTimeout);
doubleTapTimeout = setTimeout(() => doubleTapTimeout = void 0, 250);
}, this));
if (typeof options2.size === "number") {
this.size = options2.size;
if (options2.orientation === 0) {
this.el.style.width = `${this.size}px`;
} else {
this.el.style.height = `${this.size}px`;
}
} else {
this.size = globalSize;
this._register(onDidChangeGlobalSize.event((size2) => {
this.size = size2;
this.layout();
}));
}
this._register(onDidChangeHoverDelay.event((delay) => this.hoverDelay = delay));
this.layoutProvider = layoutProvider;
this.orthogonalStartSash = options2.orthogonalStartSash;
this.orthogonalEndSash = options2.orthogonalEndSash;
this.orientation = options2.orientation || 0;
if (this.orientation === 1) {
this.el.classList.add("horizontal");
this.el.classList.remove("vertical");
} else {
this.el.classList.remove("horizontal");
this.el.classList.add("vertical");
}
this.el.classList.toggle("debug", DEBUG2);
this.layout();
}
onPointerStart(event, pointerEventFactory) {
EventHelper.stop(event);
let isMultisashResize = false;
if (!event.__orthogonalSashEvent) {
const orthogonalSash = this.getOrthogonalSash(event);
if (orthogonalSash) {
isMultisashResize = true;
event.__orthogonalSashEvent = true;
orthogonalSash.onPointerStart(event, new OrthogonalPointerEventFactory(pointerEventFactory));
}
}
if (this.linkedSash && !event.__linkedSashEvent) {
event.__linkedSashEvent = true;
this.linkedSash.onPointerStart(event, new OrthogonalPointerEventFactory(pointerEventFactory));
}
if (!this.state) {
return;
}
const iframes = this.el.ownerDocument.getElementsByTagName("iframe");
for (const iframe of iframes) {
iframe.classList.add(PointerEventsDisabledCssClass);
}
const startX = event.pageX;
const startY = event.pageY;
const altKey = event.altKey;
const startEvent = { startX, currentX: startX, startY, currentY: startY, altKey };
this.el.classList.add("active");
this._onDidStart.fire(startEvent);
const style = createStyleSheet(this.el);
const updateStyle = () => {
let cursor = "";
if (isMultisashResize) {
cursor = "all-scroll";
} else if (this.orientation === 1) {
if (this.state === 1) {
cursor = "s-resize";
} else if (this.state === 2) {
cursor = "n-resize";
} else {
cursor = isMacintosh ? "row-resize" : "ns-resize";
}
} else {
if (this.state === 1) {
cursor = "e-resize";
} else if (this.state === 2) {
cursor = "w-resize";
} else {
cursor = isMacintosh ? "col-resize" : "ew-resize";
}
}
style.textContent = `* { cursor: ${cursor} !important; }`;
};
const disposables = new DisposableStore();
updateStyle();
if (!isMultisashResize) {
this.onDidEnablementChange.event(updateStyle, null, disposables);
}
const onPointerMove = (e) => {
EventHelper.stop(e, false);
const event2 = { startX, currentX: e.pageX, startY, currentY: e.pageY, altKey };
this._onDidChange.fire(event2);
};
const onPointerUp = (e) => {
EventHelper.stop(e, false);
this.el.removeChild(style);
this.el.classList.remove("active");
this._onDidEnd.fire();
disposables.dispose();
for (const iframe of iframes) {
iframe.classList.remove(PointerEventsDisabledCssClass);
}
};
pointerEventFactory.onPointerMove(onPointerMove, null, disposables);
pointerEventFactory.onPointerUp(onPointerUp, null, disposables);
disposables.add(pointerEventFactory);
}
onPointerDoublePress(e) {
const orthogonalSash = this.getOrthogonalSash(e);
if (orthogonalSash) {
orthogonalSash._onDidReset.fire();
}
if (this.linkedSash) {
this.linkedSash._onDidReset.fire();
}
this._onDidReset.fire();
}
static onMouseEnter(sash, fromLinkedSash = false) {
if (sash.el.classList.contains("active")) {
sash.hoverDelayer.cancel();
sash.el.classList.add("hover");
} else {
sash.hoverDelayer.trigger(() => sash.el.classList.add("hover"), sash.hoverDelay).then(void 0, () => {
});
}
if (!fromLinkedSash && sash.linkedSash) {
_Sash.onMouseEnter(sash.linkedSash, true);
}
}
static onMouseLeave(sash, fromLinkedSash = false) {
sash.hoverDelayer.cancel();
sash.el.classList.remove("hover");
if (!fromLinkedSash && sash.linkedSash) {
_Sash.onMouseLeave(sash.linkedSash, true);
}
}
/**
* Forcefully stop any user interactions with this sash.
* Useful when hiding a parent component, while the user is still
* interacting with the sash.
*/
clearSashHoverState() {
_Sash.onMouseLeave(this);
}
/**
* Layout the sash. The sash will size and position itself
* based on its provided {@link ISashLayoutProvider layout provider}.
*/
layout() {
if (this.orientation === 0) {
const verticalProvider = this.layoutProvider;
this.el.style.left = verticalProvider.getVerticalSashLeft(this) - this.size / 2 + "px";
if (verticalProvider.getVerticalSashTop) {
this.el.style.top = verticalProvider.getVerticalSashTop(this) + "px";
}
if (verticalProvider.getVerticalSashHeight) {
this.el.style.height = verticalProvider.getVerticalSashHeight(this) + "px";
}
} else {
const horizontalProvider = this.layoutProvider;
this.el.style.top = horizontalProvider.getHorizontalSashTop(this) - this.size / 2 + "px";
if (horizontalProvider.getHorizontalSashLeft) {
this.el.style.left = horizontalProvider.getHorizontalSashLeft(this) + "px";
}
if (horizontalProvider.getHorizontalSashWidth) {
this.el.style.width = horizontalProvider.getHorizontalSashWidth(this) + "px";
}
}
}
getOrthogonalSash(e) {
var _a10;
const target = (_a10 = e.initialTarget) !== null && _a10 !== void 0 ? _a10 : e.target;
if (!target || !isHTMLElement(target)) {
return void 0;
}
if (target.classList.contains("orthogonal-drag-handle")) {
return target.classList.contains("start") ? this.orthogonalStartSash : this.orthogonalEndSash;
}
return void 0;
}
dispose() {
super.dispose();
this.el.remove();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.css
var init_splitview = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js
var defaultStyles, ViewItem, VerticalViewItem, HorizontalViewItem, State, Sizing, SplitView;
var init_splitview2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/splitview/splitview.js"() {
init_dom();
init_event2();
init_sash2();
init_scrollableElement();
init_arrays();
init_color();
init_event();
init_lifecycle();
init_numbers();
init_scrollable();
init_types();
init_splitview();
defaultStyles = {
separatorBorder: Color.transparent
};
ViewItem = class {
set size(size2) {
this._size = size2;
}
get size() {
return this._size;
}
get visible() {
return typeof this._cachedVisibleSize === "undefined";
}
setVisible(visible, size2) {
var _a10, _b4;
if (visible === this.visible) {
return;
}
if (visible) {
this.size = clamp(this._cachedVisibleSize, this.viewMinimumSize, this.viewMaximumSize);
this._cachedVisibleSize = void 0;
} else {
this._cachedVisibleSize = typeof size2 === "number" ? size2 : this.size;
this.size = 0;
}
this.container.classList.toggle("visible", visible);
try {
(_b4 = (_a10 = this.view).setVisible) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, visible);
} catch (e) {
console.error("Splitview: Failed to set visible view");
console.error(e);
}
}
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 _a10;
return (_a10 = this.view.proportionalLayout) !== null && _a10 !== void 0 ? _a10 : true;
}
get snap() {
return !!this.view.snap;
}
set enabled(enabled) {
this.container.style.pointerEvents = enabled ? "" : "none";
}
constructor(container, view, size2, disposable) {
this.container = container;
this.view = view;
this.disposable = disposable;
this._cachedVisibleSize = void 0;
if (typeof size2 === "number") {
this._size = size2;
this._cachedVisibleSize = void 0;
container.classList.add("visible");
} else {
this._size = 0;
this._cachedVisibleSize = size2.cachedVisibleSize;
}
}
layout(offset, layoutContext) {
this.layoutContainer(offset);
try {
this.view.layout(this.size, offset, layoutContext);
} catch (e) {
console.error("Splitview: Failed to layout view");
console.error(e);
}
}
dispose() {
this.disposable.dispose();
}
};
VerticalViewItem = class extends ViewItem {
layoutContainer(offset) {
this.container.style.top = `${offset}px`;
this.container.style.height = `${this.size}px`;
}
};
HorizontalViewItem = class extends ViewItem {
layoutContainer(offset) {
this.container.style.left = `${offset}px`;
this.container.style.width = `${this.size}px`;
}
};
(function(State2) {
State2[State2["Idle"] = 0] = "Idle";
State2[State2["Busy"] = 1] = "Busy";
})(State || (State = {}));
(function(Sizing2) {
Sizing2.Distribute = { type: "distribute" };
function Split(index) {
return { type: "split", index };
}
Sizing2.Split = Split;
function Auto(index) {
return { type: "auto", index };
}
Sizing2.Auto = Auto;
function Invisible(cachedVisibleSize) {
return { type: "invisible", cachedVisibleSize };
}
Sizing2.Invisible = Invisible;
})(Sizing || (Sizing = {}));
SplitView = class extends Disposable {
get orthogonalStartSash() {
return this._orthogonalStartSash;
}
get orthogonalEndSash() {
return this._orthogonalEndSash;
}
get startSnappingEnabled() {
return this._startSnappingEnabled;
}
get endSnappingEnabled() {
return this._endSnappingEnabled;
}
/**
* A reference to a sash, perpendicular to all sashes in this {@link SplitView},
* located at the left- or top-most side of the SplitView.
* Corner sashes will be created automatically at the intersections.
*/
set orthogonalStartSash(sash) {
for (const sashItem of this.sashItems) {
sashItem.sash.orthogonalStartSash = sash;
}
this._orthogonalStartSash = sash;
}
/**
* A reference to a sash, perpendicular to all sashes in this {@link SplitView},
* located at the right- or bottom-most side of the SplitView.
* Corner sashes will be created automatically at the intersections.
*/
set orthogonalEndSash(sash) {
for (const sashItem of this.sashItems) {
sashItem.sash.orthogonalEndSash = sash;
}
this._orthogonalEndSash = sash;
}
/**
* Enable/disable snapping at the beginning of this {@link SplitView}.
*/
set startSnappingEnabled(startSnappingEnabled) {
if (this._startSnappingEnabled === startSnappingEnabled) {
return;
}
this._startSnappingEnabled = startSnappingEnabled;
this.updateSashEnablement();
}
/**
* Enable/disable snapping at the end of this {@link SplitView}.
*/
set endSnappingEnabled(endSnappingEnabled) {
if (this._endSnappingEnabled === endSnappingEnabled) {
return;
}
this._endSnappingEnabled = endSnappingEnabled;
this.updateSashEnablement();
}
/**
* Create a new {@link SplitView} instance.
*/
constructor(container, options2 = {}) {
var _a10, _b4, _c2, _d2, _e2;
super();
this.size = 0;
this._contentSize = 0;
this.proportions = void 0;
this.viewItems = [];
this.sashItems = [];
this.state = State.Idle;
this._onDidSashChange = this._register(new Emitter());
this._onDidSashReset = this._register(new Emitter());
this._startSnappingEnabled = true;
this._endSnappingEnabled = true;
this.onDidSashChange = this._onDidSashChange.event;
this.onDidSashReset = this._onDidSashReset.event;
this.orientation = (_a10 = options2.orientation) !== null && _a10 !== void 0 ? _a10 : 0;
this.inverseAltBehavior = (_b4 = options2.inverseAltBehavior) !== null && _b4 !== void 0 ? _b4 : false;
this.proportionalLayout = (_c2 = options2.proportionalLayout) !== null && _c2 !== void 0 ? _c2 : true;
this.getSashOrthogonalSize = options2.getSashOrthogonalSize;
this.el = document.createElement("div");
this.el.classList.add("monaco-split-view2");
this.el.classList.add(this.orientation === 0 ? "vertical" : "horizontal");
container.appendChild(this.el);
this.sashContainer = append(this.el, $(".sash-container"));
this.viewContainer = $(".split-view-container");
this.scrollable = this._register(new Scrollable({
forceIntegerValues: true,
smoothScrollDuration: 125,
scheduleAtNextAnimationFrame: (callback) => scheduleAtNextAnimationFrame(getWindow(this.el), callback)
}));
this.scrollableElement = this._register(new SmoothScrollableElement(this.viewContainer, {
vertical: this.orientation === 0 ? (_d2 = options2.scrollbarVisibility) !== null && _d2 !== void 0 ? _d2 : 1 : 2,
horizontal: this.orientation === 1 ? (_e2 = options2.scrollbarVisibility) !== null && _e2 !== void 0 ? _e2 : 1 : 2
/* ScrollbarVisibility.Hidden */
}, this.scrollable));
const onDidScrollViewContainer = this._register(new DomEmitter(this.viewContainer, "scroll")).event;
this._register(onDidScrollViewContainer((_) => {
const position = this.scrollableElement.getScrollPosition();
const scrollLeft = Math.abs(this.viewContainer.scrollLeft - position.scrollLeft) <= 1 ? void 0 : this.viewContainer.scrollLeft;
const scrollTop = Math.abs(this.viewContainer.scrollTop - position.scrollTop) <= 1 ? void 0 : this.viewContainer.scrollTop;
if (scrollLeft !== void 0 || scrollTop !== void 0) {
this.scrollableElement.setScrollPosition({ scrollLeft, scrollTop });
}
}));
this.onDidScroll = this.scrollableElement.onScroll;
this._register(this.onDidScroll((e) => {
if (e.scrollTopChanged) {
this.viewContainer.scrollTop = e.scrollTop;
}
if (e.scrollLeftChanged) {
this.viewContainer.scrollLeft = e.scrollLeft;
}
}));
append(this.el, this.scrollableElement.getDomNode());
this.style(options2.styles || defaultStyles);
if (options2.descriptor) {
this.size = options2.descriptor.size;
options2.descriptor.views.forEach((viewDescriptor, index) => {
const sizing = isUndefined(viewDescriptor.visible) || viewDescriptor.visible ? viewDescriptor.size : { type: "invisible", cachedVisibleSize: viewDescriptor.size };
const view = viewDescriptor.view;
this.doAddView(view, sizing, index, true);
});
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
this.saveProportions();
}
}
style(styles) {
if (styles.separatorBorder.isTransparent()) {
this.el.classList.remove("separator-border");
this.el.style.removeProperty("--separator-border");
} else {
this.el.classList.add("separator-border");
this.el.style.setProperty("--separator-border", styles.separatorBorder.toString());
}
}
/**
* Add a {@link IView view} to this {@link SplitView}.
*
* @param view The view to add.
* @param size Either a fixed size, or a dynamic {@link Sizing} strategy.
* @param index The index to insert the view on.
* @param skipLayout Whether layout should be skipped.
*/
addView(view, size2, index = this.viewItems.length, skipLayout) {
this.doAddView(view, size2, index, skipLayout);
}
/**
* Layout the {@link SplitView}.
*
* @param size The entire size of the {@link SplitView}.
* @param layoutContext An optional layout context to pass along to {@link IView views}.
*/
layout(size2, layoutContext) {
const previousSize = Math.max(this.size, this._contentSize);
this.size = size2;
this.layoutContext = layoutContext;
if (!this.proportions) {
const indexes = range(this.viewItems.length);
const lowPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 1
/* LayoutPriority.Low */
);
const highPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 2
/* LayoutPriority.High */
);
this.resize(this.viewItems.length - 1, size2 - previousSize, void 0, lowPriorityIndexes, highPriorityIndexes);
} else {
let total = 0;
for (let i = 0; i < this.viewItems.length; i++) {
const item = this.viewItems[i];
const proportion = this.proportions[i];
if (typeof proportion === "number") {
total += proportion;
} else {
size2 -= item.size;
}
}
for (let i = 0; i < this.viewItems.length; i++) {
const item = this.viewItems[i];
const proportion = this.proportions[i];
if (typeof proportion === "number" && total > 0) {
item.size = clamp(Math.round(proportion * size2 / total), item.minimumSize, item.maximumSize);
}
}
}
this.distributeEmptySpace();
this.layoutViews();
}
saveProportions() {
if (this.proportionalLayout && this._contentSize > 0) {
this.proportions = this.viewItems.map((v) => v.proportionalLayout && v.visible ? v.size / this._contentSize : void 0);
}
}
onSashStart({ sash, start, alt }) {
for (const item of this.viewItems) {
item.enabled = false;
}
const index = this.sashItems.findIndex((item) => item.sash === sash);
const disposable = combinedDisposable(addDisposableListener(this.el.ownerDocument.body, "keydown", (e) => resetSashDragState(this.sashDragState.current, e.altKey)), addDisposableListener(this.el.ownerDocument.body, "keyup", () => resetSashDragState(this.sashDragState.current, false)));
const resetSashDragState = (start2, alt2) => {
const sizes = this.viewItems.map((i) => i.size);
let minDelta = Number.NEGATIVE_INFINITY;
let maxDelta = Number.POSITIVE_INFINITY;
if (this.inverseAltBehavior) {
alt2 = !alt2;
}
if (alt2) {
const isLastSash = index === this.sashItems.length - 1;
if (isLastSash) {
const viewItem = this.viewItems[index];
minDelta = (viewItem.minimumSize - viewItem.size) / 2;
maxDelta = (viewItem.maximumSize - viewItem.size) / 2;
} else {
const viewItem = this.viewItems[index + 1];
minDelta = (viewItem.size - viewItem.maximumSize) / 2;
maxDelta = (viewItem.size - viewItem.minimumSize) / 2;
}
}
let snapBefore;
let snapAfter;
if (!alt2) {
const upIndexes = range(index, -1);
const downIndexes = range(index + 1, this.viewItems.length);
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);
const maxDeltaDown = downIndexes.length === 0 ? Number.POSITIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].minimumSize), 0);
const minDeltaDown = downIndexes.length === 0 ? Number.NEGATIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].viewMaximumSize), 0);
const minDelta2 = Math.max(minDeltaUp, minDeltaDown);
const maxDelta2 = Math.min(maxDeltaDown, maxDeltaUp);
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
if (typeof snapBeforeIndex === "number") {
const viewItem = this.viewItems[snapBeforeIndex];
const halfSize = Math.floor(viewItem.viewMinimumSize / 2);
snapBefore = {
index: snapBeforeIndex,
limitDelta: viewItem.visible ? minDelta2 - halfSize : minDelta2 + halfSize,
size: viewItem.size
};
}
if (typeof snapAfterIndex === "number") {
const viewItem = this.viewItems[snapAfterIndex];
const halfSize = Math.floor(viewItem.viewMinimumSize / 2);
snapAfter = {
index: snapAfterIndex,
limitDelta: viewItem.visible ? maxDelta2 + halfSize : maxDelta2 - halfSize,
size: viewItem.size
};
}
}
this.sashDragState = { start: start2, current: start2, index, sizes, minDelta, maxDelta, alt: alt2, snapBefore, snapAfter, disposable };
};
resetSashDragState(start, alt);
}
onSashChange({ current }) {
const { index, start, sizes, alt, minDelta, maxDelta, snapBefore, snapAfter } = this.sashDragState;
this.sashDragState.current = current;
const delta = current - start;
const newDelta = this.resize(index, delta, sizes, void 0, void 0, minDelta, maxDelta, snapBefore, snapAfter);
if (alt) {
const isLastSash = index === this.sashItems.length - 1;
const newSizes = this.viewItems.map((i) => i.size);
const viewItemIndex = isLastSash ? index : index + 1;
const viewItem = this.viewItems[viewItemIndex];
const newMinDelta = viewItem.size - viewItem.maximumSize;
const newMaxDelta = viewItem.size - viewItem.minimumSize;
const resizeIndex = isLastSash ? index - 1 : index + 1;
this.resize(resizeIndex, -newDelta, newSizes, void 0, void 0, newMinDelta, newMaxDelta);
}
this.distributeEmptySpace();
this.layoutViews();
}
onSashEnd(index) {
this._onDidSashChange.fire(index);
this.sashDragState.disposable.dispose();
this.saveProportions();
for (const item of this.viewItems) {
item.enabled = true;
}
}
onViewChange(item, size2) {
const index = this.viewItems.indexOf(item);
if (index < 0 || index >= this.viewItems.length) {
return;
}
size2 = typeof size2 === "number" ? size2 : item.size;
size2 = clamp(size2, item.minimumSize, item.maximumSize);
if (this.inverseAltBehavior && index > 0) {
this.resize(index - 1, Math.floor((item.size - size2) / 2));
this.distributeEmptySpace();
this.layoutViews();
} else {
item.size = size2;
this.relayout([index], void 0);
}
}
/**
* Resize a {@link IView view} within the {@link SplitView}.
*
* @param index The {@link IView view} index.
* @param size The {@link IView view} size.
*/
resizeView(index, size2) {
if (index < 0 || index >= this.viewItems.length) {
return;
}
if (this.state !== State.Idle) {
throw new Error("Cant modify splitview");
}
this.state = State.Busy;
try {
const indexes = range(this.viewItems.length).filter((i) => i !== index);
const lowPriorityIndexes = [...indexes.filter(
(i) => this.viewItems[i].priority === 1
/* LayoutPriority.Low */
), index];
const highPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 2
/* LayoutPriority.High */
);
const item = this.viewItems[index];
size2 = Math.round(size2);
size2 = clamp(size2, item.minimumSize, Math.min(item.maximumSize, this.size));
item.size = size2;
this.relayout(lowPriorityIndexes, highPriorityIndexes);
} finally {
this.state = State.Idle;
}
}
/**
* Distribute the entire {@link SplitView} size among all {@link IView views}.
*/
distributeViewSizes() {
const flexibleViewItems = [];
let flexibleSize = 0;
for (const item of this.viewItems) {
if (item.maximumSize - item.minimumSize > 0) {
flexibleViewItems.push(item);
flexibleSize += item.size;
}
}
const size2 = Math.floor(flexibleSize / flexibleViewItems.length);
for (const item of flexibleViewItems) {
item.size = clamp(size2, item.minimumSize, item.maximumSize);
}
const indexes = range(this.viewItems.length);
const lowPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 1
/* LayoutPriority.Low */
);
const highPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 2
/* LayoutPriority.High */
);
this.relayout(lowPriorityIndexes, highPriorityIndexes);
}
/**
* Returns the size of a {@link IView view}.
*/
getViewSize(index) {
if (index < 0 || index >= this.viewItems.length) {
return -1;
}
return this.viewItems[index].size;
}
doAddView(view, size2, index = this.viewItems.length, skipLayout) {
if (this.state !== State.Idle) {
throw new Error("Cant modify splitview");
}
this.state = State.Busy;
try {
const container = $(".split-view-view");
if (index === this.viewItems.length) {
this.viewContainer.appendChild(container);
} else {
this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));
}
const onChangeDisposable = view.onDidChange((size3) => this.onViewChange(item, size3));
const containerDisposable = toDisposable(() => this.viewContainer.removeChild(container));
const disposable = combinedDisposable(onChangeDisposable, containerDisposable);
let viewSize;
if (typeof size2 === "number") {
viewSize = size2;
} else {
if (size2.type === "auto") {
if (this.areViewsDistributed()) {
size2 = { type: "distribute" };
} else {
size2 = { type: "split", index: size2.index };
}
}
if (size2.type === "split") {
viewSize = this.getViewSize(size2.index) / 2;
} else if (size2.type === "invisible") {
viewSize = { cachedVisibleSize: size2.cachedVisibleSize };
} else {
viewSize = view.minimumSize;
}
}
const item = this.orientation === 0 ? new VerticalViewItem(container, view, viewSize, disposable) : new HorizontalViewItem(container, view, viewSize, disposable);
this.viewItems.splice(index, 0, item);
if (this.viewItems.length > 1) {
const opts = { orthogonalStartSash: this.orthogonalStartSash, orthogonalEndSash: this.orthogonalEndSash };
const sash = this.orientation === 0 ? new Sash(this.sashContainer, { getHorizontalSashTop: (s) => this.getSashPosition(s), getHorizontalSashWidth: this.getSashOrthogonalSize }, __spreadProps(__spreadValues({}, opts), {
orientation: 1
/* Orientation.HORIZONTAL */
})) : new Sash(this.sashContainer, { getVerticalSashLeft: (s) => this.getSashPosition(s), getVerticalSashHeight: this.getSashOrthogonalSize }, __spreadProps(__spreadValues({}, opts), {
orientation: 0
/* Orientation.VERTICAL */
}));
const sashEventMapper = this.orientation === 0 ? (e) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) : (e) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey });
const onStart = Event.map(sash.onDidStart, sashEventMapper);
const onStartDisposable = onStart(this.onSashStart, this);
const onChange = Event.map(sash.onDidChange, sashEventMapper);
const onChangeDisposable2 = onChange(this.onSashChange, this);
const onEnd = Event.map(sash.onDidEnd, () => this.sashItems.findIndex((item2) => item2.sash === sash));
const onEndDisposable = onEnd(this.onSashEnd, this);
const onDidResetDisposable = sash.onDidReset(() => {
const index2 = this.sashItems.findIndex((item2) => item2.sash === sash);
const upIndexes = range(index2, -1);
const downIndexes = range(index2 + 1, this.viewItems.length);
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
if (typeof snapBeforeIndex === "number" && !this.viewItems[snapBeforeIndex].visible) {
return;
}
if (typeof snapAfterIndex === "number" && !this.viewItems[snapAfterIndex].visible) {
return;
}
this._onDidSashReset.fire(index2);
});
const disposable2 = combinedDisposable(onStartDisposable, onChangeDisposable2, onEndDisposable, onDidResetDisposable, sash);
const sashItem = { sash, disposable: disposable2 };
this.sashItems.splice(index - 1, 0, sashItem);
}
container.appendChild(view.element);
let highPriorityIndexes;
if (typeof size2 !== "number" && size2.type === "split") {
highPriorityIndexes = [size2.index];
}
if (!skipLayout) {
this.relayout([index], highPriorityIndexes);
}
if (!skipLayout && typeof size2 !== "number" && size2.type === "distribute") {
this.distributeViewSizes();
}
} finally {
this.state = State.Idle;
}
}
relayout(lowPriorityIndexes, highPriorityIndexes) {
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
this.resize(this.viewItems.length - 1, this.size - contentSize, void 0, lowPriorityIndexes, highPriorityIndexes);
this.distributeEmptySpace();
this.layoutViews();
this.saveProportions();
}
resize(index, delta, sizes = this.viewItems.map((i) => i.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) {
if (index < 0 || index >= this.viewItems.length) {
return 0;
}
const upIndexes = range(index, -1);
const downIndexes = range(index + 1, this.viewItems.length);
if (highPriorityIndexes) {
for (const index2 of highPriorityIndexes) {
pushToStart(upIndexes, index2);
pushToStart(downIndexes, index2);
}
}
if (lowPriorityIndexes) {
for (const index2 of lowPriorityIndexes) {
pushToEnd(upIndexes, index2);
pushToEnd(downIndexes, index2);
}
}
const upItems = upIndexes.map((i) => this.viewItems[i]);
const upSizes = upIndexes.map((i) => sizes[i]);
const downItems = downIndexes.map((i) => this.viewItems[i]);
const downSizes = downIndexes.map((i) => sizes[i]);
const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);
const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].maximumSize - sizes[i]), 0);
const maxDeltaDown = downIndexes.length === 0 ? Number.POSITIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].minimumSize), 0);
const minDeltaDown = downIndexes.length === 0 ? Number.NEGATIVE_INFINITY : downIndexes.reduce((r, i) => r + (sizes[i] - this.viewItems[i].maximumSize), 0);
const minDelta = Math.max(minDeltaUp, minDeltaDown, overloadMinDelta);
const maxDelta = Math.min(maxDeltaDown, maxDeltaUp, overloadMaxDelta);
let snapped = false;
if (snapBefore) {
const snapView = this.viewItems[snapBefore.index];
const visible = delta >= snapBefore.limitDelta;
snapped = visible !== snapView.visible;
snapView.setVisible(visible, snapBefore.size);
}
if (!snapped && snapAfter) {
const snapView = this.viewItems[snapAfter.index];
const visible = delta < snapAfter.limitDelta;
snapped = visible !== snapView.visible;
snapView.setVisible(visible, snapAfter.size);
}
if (snapped) {
return this.resize(index, delta, sizes, lowPriorityIndexes, highPriorityIndexes, overloadMinDelta, overloadMaxDelta);
}
delta = clamp(delta, minDelta, maxDelta);
for (let i = 0, deltaUp = delta; i < upItems.length; i++) {
const item = upItems[i];
const size2 = clamp(upSizes[i] + deltaUp, item.minimumSize, item.maximumSize);
const viewDelta = size2 - upSizes[i];
deltaUp -= viewDelta;
item.size = size2;
}
for (let i = 0, deltaDown = delta; i < downItems.length; i++) {
const item = downItems[i];
const size2 = clamp(downSizes[i] - deltaDown, item.minimumSize, item.maximumSize);
const viewDelta = size2 - downSizes[i];
deltaDown += viewDelta;
item.size = size2;
}
return delta;
}
distributeEmptySpace(lowPriorityIndex) {
const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
let emptyDelta = this.size - contentSize;
const indexes = range(this.viewItems.length - 1, -1);
const lowPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 1
/* LayoutPriority.Low */
);
const highPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === 2
/* LayoutPriority.High */
);
for (const index of highPriorityIndexes) {
pushToStart(indexes, index);
}
for (const index of lowPriorityIndexes) {
pushToEnd(indexes, index);
}
if (typeof lowPriorityIndex === "number") {
pushToEnd(indexes, lowPriorityIndex);
}
for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {
const item = this.viewItems[indexes[i]];
const size2 = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);
const viewDelta = size2 - item.size;
emptyDelta -= viewDelta;
item.size = size2;
}
}
layoutViews() {
this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
let offset = 0;
for (const viewItem of this.viewItems) {
viewItem.layout(offset, this.layoutContext);
offset += viewItem.size;
}
this.sashItems.forEach((item) => item.sash.layout());
this.updateSashEnablement();
this.updateScrollableElement();
}
updateScrollableElement() {
if (this.orientation === 0) {
this.scrollableElement.setScrollDimensions({
height: this.size,
scrollHeight: this._contentSize
});
} else {
this.scrollableElement.setScrollDimensions({
width: this.size,
scrollWidth: this._contentSize
});
}
}
updateSashEnablement() {
let previous = false;
const collapsesDown = this.viewItems.map((i) => previous = i.size - i.minimumSize > 0 || previous);
previous = false;
const expandsDown = this.viewItems.map((i) => previous = i.maximumSize - i.size > 0 || previous);
const reverseViews = [...this.viewItems].reverse();
previous = false;
const collapsesUp = reverseViews.map((i) => previous = i.size - i.minimumSize > 0 || previous).reverse();
previous = false;
const expandsUp = reverseViews.map((i) => previous = i.maximumSize - i.size > 0 || previous).reverse();
let position = 0;
for (let index = 0; index < this.sashItems.length; index++) {
const { sash } = this.sashItems[index];
const viewItem = this.viewItems[index];
position += viewItem.size;
const min = !(collapsesDown[index] && expandsUp[index + 1]);
const max = !(expandsDown[index] && collapsesUp[index + 1]);
if (min && max) {
const upIndexes = range(index, -1);
const downIndexes = range(index + 1, this.viewItems.length);
const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);
const snapAfterIndex = this.findFirstSnapIndex(downIndexes);
const snappedBefore = typeof snapBeforeIndex === "number" && !this.viewItems[snapBeforeIndex].visible;
const snappedAfter = typeof snapAfterIndex === "number" && !this.viewItems[snapAfterIndex].visible;
if (snappedBefore && collapsesUp[index] && (position > 0 || this.startSnappingEnabled)) {
sash.state = 1;
} else if (snappedAfter && collapsesDown[index] && (position < this._contentSize || this.endSnappingEnabled)) {
sash.state = 2;
} else {
sash.state = 0;
}
} else if (min && !max) {
sash.state = 1;
} else if (!min && max) {
sash.state = 2;
} else {
sash.state = 3;
}
}
}
getSashPosition(sash) {
let position = 0;
for (let i = 0; i < this.sashItems.length; i++) {
position += this.viewItems[i].size;
if (this.sashItems[i].sash === sash) {
return position;
}
}
return 0;
}
findFirstSnapIndex(indexes) {
for (const index of indexes) {
const viewItem = this.viewItems[index];
if (!viewItem.visible) {
continue;
}
if (viewItem.snap) {
return index;
}
}
for (const index of indexes) {
const viewItem = this.viewItems[index];
if (viewItem.visible && viewItem.maximumSize - viewItem.minimumSize > 0) {
return void 0;
}
if (!viewItem.visible && viewItem.snap) {
return index;
}
}
return void 0;
}
areViewsDistributed() {
let min = void 0, max = void 0;
for (const view of this.viewItems) {
min = min === void 0 ? view.size : Math.min(min, view.size);
max = max === void 0 ? view.size : Math.max(max, view.size);
if (max - min > 2) {
return false;
}
}
return true;
}
dispose() {
var _a10;
(_a10 = this.sashDragState) === null || _a10 === void 0 ? void 0 : _a10.disposable.dispose();
dispose(this.viewItems);
this.viewItems = [];
this.sashItems.forEach((i) => i.disposable.dispose());
this.sashItems = [];
super.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.css
var init_table = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/table/table.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js
function asListVirtualDelegate(delegate) {
return {
getHeight(row) {
return delegate.getHeight(row);
},
getTemplateId() {
return TableListRenderer.TemplateId;
}
};
}
var TableListRenderer, ColumnHeader, Table;
var init_tableWidget = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/table/tableWidget.js"() {
init_dom();
init_hoverDelegate2();
init_hoverDelegateFactory();
init_listWidget();
init_splitview2();
init_event();
init_lifecycle();
init_table();
TableListRenderer = class _TableListRenderer {
constructor(columns, renderers, getColumnSize) {
this.columns = columns;
this.getColumnSize = getColumnSize;
this.templateId = _TableListRenderer.TemplateId;
this.renderedTemplates = /* @__PURE__ */ new Set();
const rendererMap = new Map(renderers.map((r) => [r.templateId, r]));
this.renderers = [];
for (const column of columns) {
const renderer = rendererMap.get(column.templateId);
if (!renderer) {
throw new Error(`Table cell renderer for template id ${column.templateId} not found.`);
}
this.renderers.push(renderer);
}
}
renderTemplate(container) {
const rowContainer = append(container, $(".monaco-table-tr"));
const cellContainers = [];
const cellTemplateData = [];
for (let i = 0; i < this.columns.length; i++) {
const renderer = this.renderers[i];
const cellContainer = append(rowContainer, $(".monaco-table-td", { "data-col-index": i }));
cellContainer.style.width = `${this.getColumnSize(i)}px`;
cellContainers.push(cellContainer);
cellTemplateData.push(renderer.renderTemplate(cellContainer));
}
const result = { container, cellContainers, cellTemplateData };
this.renderedTemplates.add(result);
return result;
}
renderElement(element, index, templateData, height) {
for (let i = 0; i < this.columns.length; i++) {
const column = this.columns[i];
const cell = column.project(element);
const renderer = this.renderers[i];
renderer.renderElement(cell, index, templateData.cellTemplateData[i], height);
}
}
disposeElement(element, index, templateData, height) {
for (let i = 0; i < this.columns.length; i++) {
const renderer = this.renderers[i];
if (renderer.disposeElement) {
const column = this.columns[i];
const cell = column.project(element);
renderer.disposeElement(cell, index, templateData.cellTemplateData[i], height);
}
}
}
disposeTemplate(templateData) {
for (let i = 0; i < this.columns.length; i++) {
const renderer = this.renderers[i];
renderer.disposeTemplate(templateData.cellTemplateData[i]);
}
clearNode(templateData.container);
this.renderedTemplates.delete(templateData);
}
layoutColumn(index, size2) {
for (const { cellContainers } of this.renderedTemplates) {
cellContainers[index].style.width = `${size2}px`;
}
}
};
TableListRenderer.TemplateId = "row";
ColumnHeader = class extends Disposable {
get minimumSize() {
var _a10;
return (_a10 = this.column.minimumWidth) !== null && _a10 !== void 0 ? _a10 : 120;
}
get maximumSize() {
var _a10;
return (_a10 = this.column.maximumWidth) !== null && _a10 !== void 0 ? _a10 : Number.POSITIVE_INFINITY;
}
get onDidChange() {
var _a10;
return (_a10 = this.column.onDidChangeWidthConstraints) !== null && _a10 !== void 0 ? _a10 : Event.None;
}
constructor(column, index) {
super();
this.column = column;
this.index = index;
this._onDidLayout = new Emitter();
this.onDidLayout = this._onDidLayout.event;
this.element = $(".monaco-table-th", { "data-col-index": index }, column.label);
if (column.tooltip) {
this._register(getBaseLayerHoverDelegate().setupUpdatableHover(getDefaultHoverDelegate("mouse"), this.element, column.tooltip));
}
}
layout(size2) {
this._onDidLayout.fire([this.index, size2]);
}
};
Table = class _Table {
get onDidChangeFocus() {
return this.list.onDidChangeFocus;
}
get onDidChangeSelection() {
return this.list.onDidChangeSelection;
}
get onDidScroll() {
return this.list.onDidScroll;
}
get onMouseDblClick() {
return this.list.onMouseDblClick;
}
get onPointer() {
return this.list.onPointer;
}
get onDidFocus() {
return this.list.onDidFocus;
}
get scrollTop() {
return this.list.scrollTop;
}
set scrollTop(scrollTop) {
this.list.scrollTop = scrollTop;
}
get scrollHeight() {
return this.list.scrollHeight;
}
get renderHeight() {
return this.list.renderHeight;
}
get onDidDispose() {
return this.list.onDidDispose;
}
constructor(user, container, virtualDelegate, columns, renderers, _options) {
this.virtualDelegate = virtualDelegate;
this.domId = `table_id_${++_Table.InstanceCount}`;
this.disposables = new DisposableStore();
this.cachedWidth = 0;
this.cachedHeight = 0;
this.domNode = append(container, $(`.monaco-table.${this.domId}`));
const headers = columns.map((c, i) => this.disposables.add(new ColumnHeader(c, i)));
const descriptor = {
size: headers.reduce((a3, b) => a3 + b.column.weight, 0),
views: headers.map((view) => ({ size: view.column.weight, view }))
};
this.splitview = this.disposables.add(new SplitView(this.domNode, {
orientation: 1,
scrollbarVisibility: 2,
getSashOrthogonalSize: () => this.cachedHeight,
descriptor
}));
this.splitview.el.style.height = `${virtualDelegate.headerRowHeight}px`;
this.splitview.el.style.lineHeight = `${virtualDelegate.headerRowHeight}px`;
const renderer = new TableListRenderer(columns, renderers, (i) => this.splitview.getViewSize(i));
this.list = this.disposables.add(new List(user, this.domNode, asListVirtualDelegate(virtualDelegate), [renderer], _options));
Event.any(...headers.map((h2) => h2.onDidLayout))(([index, size2]) => renderer.layoutColumn(index, size2), null, this.disposables);
this.splitview.onDidSashReset((index) => {
const totalWeight = columns.reduce((r, c) => r + c.weight, 0);
const size2 = columns[index].weight / totalWeight * this.cachedWidth;
this.splitview.resizeView(index, size2);
}, null, this.disposables);
this.styleElement = createStyleSheet(this.domNode);
this.style(unthemedListStyles);
}
updateOptions(options2) {
this.list.updateOptions(options2);
}
splice(start, deleteCount, elements = []) {
this.list.splice(start, deleteCount, elements);
}
getHTMLElement() {
return this.domNode;
}
style(styles) {
const content = [];
content.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 = content.join("\n");
this.list.style(styles);
}
getSelectedElements() {
return this.list.getSelectedElements();
}
getSelection() {
return this.list.getSelection();
}
getFocus() {
return this.list.getFocus();
}
dispose() {
this.disposables.dispose();
}
};
Table.InstanceCount = 0;
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js
var ObjectTreeElementCollapseState, TreeMouseEventTarget, TreeError, WeakMapper;
var init_tree = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js"() {
(function(ObjectTreeElementCollapseState2) {
ObjectTreeElementCollapseState2[ObjectTreeElementCollapseState2["Expanded"] = 0] = "Expanded";
ObjectTreeElementCollapseState2[ObjectTreeElementCollapseState2["Collapsed"] = 1] = "Collapsed";
ObjectTreeElementCollapseState2[ObjectTreeElementCollapseState2["PreserveOrExpanded"] = 2] = "PreserveOrExpanded";
ObjectTreeElementCollapseState2[ObjectTreeElementCollapseState2["PreserveOrCollapsed"] = 3] = "PreserveOrCollapsed";
})(ObjectTreeElementCollapseState || (ObjectTreeElementCollapseState = {}));
(function(TreeMouseEventTarget2) {
TreeMouseEventTarget2[TreeMouseEventTarget2["Unknown"] = 0] = "Unknown";
TreeMouseEventTarget2[TreeMouseEventTarget2["Twistie"] = 1] = "Twistie";
TreeMouseEventTarget2[TreeMouseEventTarget2["Element"] = 2] = "Element";
TreeMouseEventTarget2[TreeMouseEventTarget2["Filter"] = 3] = "Filter";
})(TreeMouseEventTarget || (TreeMouseEventTarget = {}));
TreeError = class extends Error {
constructor(user, message) {
super(`TreeError [${user}] ${message}`);
}
};
WeakMapper = class {
constructor(fn) {
this.fn = fn;
this._map = /* @__PURE__ */ new WeakMap();
}
map(key) {
let result = this._map.get(key);
if (!result) {
result = this.fn(key);
this._map.set(key, result);
}
return result;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js
function isFilterResult(obj) {
return typeof obj === "object" && "visibility" in obj && "data" in obj;
}
function getVisibleState(visibility) {
switch (visibility) {
case true:
return 1;
case false:
return 0;
default:
return visibility;
}
}
function isCollapsibleStateUpdate(update) {
return typeof update.collapsible === "boolean";
}
var IndexTreeModel;
var init_indexTreeModel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js"() {
init_tree();
init_arrays();
init_async();
init_symbols();
init_diff();
init_event();
init_iterator();
IndexTreeModel = class {
constructor(user, list, rootElement, options2 = {}) {
var _a10;
this.user = user;
this.list = list;
this.rootRef = [];
this.eventBufferer = new EventBufferer();
this._onDidChangeCollapseState = new Emitter();
this.onDidChangeCollapseState = this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);
this._onDidChangeRenderNodeCount = new Emitter();
this.onDidChangeRenderNodeCount = this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);
this._onDidSplice = new Emitter();
this.onDidSplice = this._onDidSplice.event;
this.refilterDelayer = new Delayer(MicrotaskDelay);
this.collapseByDefault = typeof options2.collapseByDefault === "undefined" ? false : options2.collapseByDefault;
this.allowNonCollapsibleParents = (_a10 = options2.allowNonCollapsibleParents) !== null && _a10 !== void 0 ? _a10 : false;
this.filter = options2.filter;
this.autoExpandSingleChildren = typeof options2.autoExpandSingleChildren === "undefined" ? false : options2.autoExpandSingleChildren;
this.root = {
parent: void 0,
element: rootElement,
children: [],
depth: 0,
visibleChildrenCount: 0,
visibleChildIndex: -1,
collapsible: false,
collapsed: false,
renderNodeCount: 0,
visibility: 1,
visible: true,
filterData: void 0
};
}
splice(location, deleteCount, toInsert = Iterable.empty(), options2 = {}) {
if (location.length === 0) {
throw new TreeError(this.user, "Invalid tree location");
}
if (options2.diffIdentityProvider) {
this.spliceSmart(options2.diffIdentityProvider, location, deleteCount, toInsert, options2);
} else {
this.spliceSimple(location, deleteCount, toInsert, options2);
}
}
spliceSmart(identity2, location, deleteCount, toInsertIterable, options2, recurseLevels) {
var _a10;
if (toInsertIterable === void 0) {
toInsertIterable = Iterable.empty();
}
if (recurseLevels === void 0) {
recurseLevels = (_a10 = options2.diffDepth) !== null && _a10 !== void 0 ? _a10 : 0;
}
const { parentNode } = this.getParentNodeWithListIndex(location);
if (!parentNode.lastDiffIds) {
return this.spliceSimple(location, deleteCount, toInsertIterable, options2);
}
const toInsert = [...toInsertIterable];
const index = location[location.length - 1];
const diff = new LcsDiff({ getElements: () => parentNode.lastDiffIds }, {
getElements: () => [
...parentNode.children.slice(0, index),
...toInsert,
...parentNode.children.slice(index + deleteCount)
].map((e) => identity2.getId(e.element).toString())
}).ComputeDiff(false);
if (diff.quitEarly) {
parentNode.lastDiffIds = void 0;
return this.spliceSimple(location, deleteCount, toInsert, options2);
}
const locationPrefix = location.slice(0, -1);
const recurseSplice = (fromOriginal, fromModified, count) => {
if (recurseLevels > 0) {
for (let i = 0; i < count; i++) {
fromOriginal--;
fromModified--;
this.spliceSmart(identity2, [...locationPrefix, fromOriginal, 0], Number.MAX_SAFE_INTEGER, toInsert[fromModified].children, options2, recurseLevels - 1);
}
}
};
let lastStartO = Math.min(parentNode.children.length, index + deleteCount);
let lastStartM = toInsert.length;
for (const change of diff.changes.sort((a3, b) => b.originalStart - a3.originalStart)) {
recurseSplice(lastStartO, lastStartM, lastStartO - (change.originalStart + change.originalLength));
lastStartO = change.originalStart;
lastStartM = change.modifiedStart - index;
this.spliceSimple([...locationPrefix, lastStartO], change.originalLength, Iterable.slice(toInsert, lastStartM, lastStartM + change.modifiedLength), options2);
}
recurseSplice(lastStartO, lastStartM, lastStartO);
}
spliceSimple(location, deleteCount, toInsert = Iterable.empty(), { onDidCreateNode, onDidDeleteNode, diffIdentityProvider }) {
const { parentNode, listIndex, revealed, visible } = this.getParentNodeWithListIndex(location);
const treeListElementsToInsert = [];
const nodesToInsertIterator = Iterable.map(toInsert, (el) => this.createTreeNode(el, parentNode, parentNode.visible ? 1 : 0, revealed, treeListElementsToInsert, onDidCreateNode));
const lastIndex = location[location.length - 1];
let visibleChildStartIndex = 0;
for (let i = lastIndex; i >= 0 && i < parentNode.children.length; i--) {
const child = parentNode.children[i];
if (child.visible) {
visibleChildStartIndex = child.visibleChildIndex;
break;
}
}
const nodesToInsert = [];
let insertedVisibleChildrenCount = 0;
let renderNodeCount = 0;
for (const child of nodesToInsertIterator) {
nodesToInsert.push(child);
renderNodeCount += child.renderNodeCount;
if (child.visible) {
child.visibleChildIndex = visibleChildStartIndex + insertedVisibleChildrenCount++;
}
}
const deletedNodes = splice(parentNode.children, lastIndex, deleteCount, nodesToInsert);
if (!diffIdentityProvider) {
parentNode.lastDiffIds = void 0;
} else if (parentNode.lastDiffIds) {
splice(parentNode.lastDiffIds, lastIndex, deleteCount, nodesToInsert.map((n) => diffIdentityProvider.getId(n.element).toString()));
} else {
parentNode.lastDiffIds = parentNode.children.map((n) => diffIdentityProvider.getId(n.element).toString());
}
let deletedVisibleChildrenCount = 0;
for (const child of deletedNodes) {
if (child.visible) {
deletedVisibleChildrenCount++;
}
}
if (deletedVisibleChildrenCount !== 0) {
for (let i = lastIndex + nodesToInsert.length; i < parentNode.children.length; i++) {
const child = parentNode.children[i];
if (child.visible) {
child.visibleChildIndex -= deletedVisibleChildrenCount;
}
}
}
parentNode.visibleChildrenCount += insertedVisibleChildrenCount - deletedVisibleChildrenCount;
if (revealed && visible) {
const visibleDeleteCount = deletedNodes.reduce((r, node2) => r + (node2.visible ? node2.renderNodeCount : 0), 0);
this._updateAncestorsRenderNodeCount(parentNode, renderNodeCount - visibleDeleteCount);
this.list.splice(listIndex, visibleDeleteCount, treeListElementsToInsert);
}
if (deletedNodes.length > 0 && onDidDeleteNode) {
const visit2 = (node2) => {
onDidDeleteNode(node2);
node2.children.forEach(visit2);
};
deletedNodes.forEach(visit2);
}
this._onDidSplice.fire({ insertedNodes: nodesToInsert, deletedNodes });
let node = parentNode;
while (node) {
if (node.visibility === 2) {
this.refilterDelayer.trigger(() => this.refilter());
break;
}
node = node.parent;
}
}
rerender(location) {
if (location.length === 0) {
throw new TreeError(this.user, "Invalid tree location");
}
const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location);
if (node.visible && revealed) {
this.list.splice(listIndex, 1, [node]);
}
}
has(location) {
return this.hasTreeNode(location);
}
getListIndex(location) {
const { listIndex, visible, revealed } = this.getTreeNodeWithListIndex(location);
return visible && revealed ? listIndex : -1;
}
getListRenderCount(location) {
return this.getTreeNode(location).renderNodeCount;
}
isCollapsible(location) {
return this.getTreeNode(location).collapsible;
}
setCollapsible(location, collapsible) {
const node = this.getTreeNode(location);
if (typeof collapsible === "undefined") {
collapsible = !node.collapsible;
}
const update = { collapsible };
return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update));
}
isCollapsed(location) {
return this.getTreeNode(location).collapsed;
}
setCollapsed(location, collapsed2, recursive) {
const node = this.getTreeNode(location);
if (typeof collapsed2 === "undefined") {
collapsed2 = !node.collapsed;
}
const update = { collapsed: collapsed2, recursive: recursive || false };
return this.eventBufferer.bufferEvents(() => this._setCollapseState(location, update));
}
_setCollapseState(location, update) {
const { node, listIndex, revealed } = this.getTreeNodeWithListIndex(location);
const result = this._setListNodeCollapseState(node, listIndex, revealed, update);
if (node !== this.root && this.autoExpandSingleChildren && result && !isCollapsibleStateUpdate(update) && node.collapsible && !node.collapsed && !update.recursive) {
let onlyVisibleChildIndex = -1;
for (let i = 0; i < node.children.length; i++) {
const child = node.children[i];
if (child.visible) {
if (onlyVisibleChildIndex > -1) {
onlyVisibleChildIndex = -1;
break;
} else {
onlyVisibleChildIndex = i;
}
}
}
if (onlyVisibleChildIndex > -1) {
this._setCollapseState([...location, onlyVisibleChildIndex], update);
}
}
return result;
}
_setListNodeCollapseState(node, listIndex, revealed, update) {
const result = this._setNodeCollapseState(node, update, false);
if (!revealed || !node.visible || !result) {
return result;
}
const previousRenderNodeCount = node.renderNodeCount;
const toInsert = this.updateNodeAfterCollapseChange(node);
const deleteCount = previousRenderNodeCount - (listIndex === -1 ? 0 : 1);
this.list.splice(listIndex + 1, deleteCount, toInsert.slice(1));
return result;
}
_setNodeCollapseState(node, update, deep) {
let result;
if (node === this.root) {
result = false;
} else {
if (isCollapsibleStateUpdate(update)) {
result = node.collapsible !== update.collapsible;
node.collapsible = update.collapsible;
} else if (!node.collapsible) {
result = false;
} else {
result = node.collapsed !== update.collapsed;
node.collapsed = update.collapsed;
}
if (result) {
this._onDidChangeCollapseState.fire({ node, deep });
}
}
if (!isCollapsibleStateUpdate(update) && update.recursive) {
for (const child of node.children) {
result = this._setNodeCollapseState(child, update, true) || result;
}
}
return result;
}
expandTo(location) {
this.eventBufferer.bufferEvents(() => {
let node = this.getTreeNode(location);
while (node.parent) {
node = node.parent;
location = location.slice(0, location.length - 1);
if (node.collapsed) {
this._setCollapseState(location, { collapsed: false, recursive: false });
}
}
});
}
refilter() {
const previousRenderNodeCount = this.root.renderNodeCount;
const toInsert = this.updateNodeAfterFilterChange(this.root);
this.list.splice(0, previousRenderNodeCount, toInsert);
this.refilterDelayer.cancel();
}
createTreeNode(treeElement, parent, parentVisibility, revealed, treeListElements, onDidCreateNode) {
const node = {
parent,
element: treeElement.element,
children: [],
depth: parent.depth + 1,
visibleChildrenCount: 0,
visibleChildIndex: -1,
collapsible: typeof treeElement.collapsible === "boolean" ? treeElement.collapsible : typeof treeElement.collapsed !== "undefined",
collapsed: typeof treeElement.collapsed === "undefined" ? this.collapseByDefault : treeElement.collapsed,
renderNodeCount: 1,
visibility: 1,
visible: true,
filterData: void 0
};
const visibility = this._filterNode(node, parentVisibility);
node.visibility = visibility;
if (revealed) {
treeListElements.push(node);
}
const childElements = treeElement.children || Iterable.empty();
const childRevealed = revealed && visibility !== 0 && !node.collapsed;
let visibleChildrenCount = 0;
let renderNodeCount = 1;
for (const el of childElements) {
const child = this.createTreeNode(el, node, visibility, childRevealed, treeListElements, onDidCreateNode);
node.children.push(child);
renderNodeCount += child.renderNodeCount;
if (child.visible) {
child.visibleChildIndex = visibleChildrenCount++;
}
}
if (!this.allowNonCollapsibleParents) {
node.collapsible = node.collapsible || node.children.length > 0;
}
node.visibleChildrenCount = visibleChildrenCount;
node.visible = visibility === 2 ? visibleChildrenCount > 0 : visibility === 1;
if (!node.visible) {
node.renderNodeCount = 0;
if (revealed) {
treeListElements.pop();
}
} else if (!node.collapsed) {
node.renderNodeCount = renderNodeCount;
}
onDidCreateNode === null || onDidCreateNode === void 0 ? void 0 : onDidCreateNode(node);
return node;
}
updateNodeAfterCollapseChange(node) {
const previousRenderNodeCount = node.renderNodeCount;
const result = [];
this._updateNodeAfterCollapseChange(node, result);
this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount);
return result;
}
_updateNodeAfterCollapseChange(node, result) {
if (node.visible === false) {
return 0;
}
result.push(node);
node.renderNodeCount = 1;
if (!node.collapsed) {
for (const child of node.children) {
node.renderNodeCount += this._updateNodeAfterCollapseChange(child, result);
}
}
this._onDidChangeRenderNodeCount.fire(node);
return node.renderNodeCount;
}
updateNodeAfterFilterChange(node) {
const previousRenderNodeCount = node.renderNodeCount;
const result = [];
this._updateNodeAfterFilterChange(node, node.visible ? 1 : 0, result);
this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount);
return result;
}
_updateNodeAfterFilterChange(node, parentVisibility, result, revealed = true) {
let visibility;
if (node !== this.root) {
visibility = this._filterNode(node, parentVisibility);
if (visibility === 0) {
node.visible = false;
node.renderNodeCount = 0;
return false;
}
if (revealed) {
result.push(node);
}
}
const resultStartLength = result.length;
node.renderNodeCount = node === this.root ? 0 : 1;
let hasVisibleDescendants = false;
if (!node.collapsed || visibility !== 0) {
let visibleChildIndex = 0;
for (const child of node.children) {
hasVisibleDescendants = this._updateNodeAfterFilterChange(child, visibility, result, revealed && !node.collapsed) || hasVisibleDescendants;
if (child.visible) {
child.visibleChildIndex = visibleChildIndex++;
}
}
node.visibleChildrenCount = visibleChildIndex;
} else {
node.visibleChildrenCount = 0;
}
if (node !== this.root) {
node.visible = visibility === 2 ? hasVisibleDescendants : visibility === 1;
node.visibility = visibility;
}
if (!node.visible) {
node.renderNodeCount = 0;
if (revealed) {
result.pop();
}
} else if (!node.collapsed) {
node.renderNodeCount += result.length - resultStartLength;
}
this._onDidChangeRenderNodeCount.fire(node);
return node.visible;
}
_updateAncestorsRenderNodeCount(node, diff) {
if (diff === 0) {
return;
}
while (node) {
node.renderNodeCount += diff;
this._onDidChangeRenderNodeCount.fire(node);
node = node.parent;
}
}
_filterNode(node, parentVisibility) {
const result = this.filter ? this.filter.filter(node.element, parentVisibility) : 1;
if (typeof result === "boolean") {
node.filterData = void 0;
return result ? 1 : 0;
} else if (isFilterResult(result)) {
node.filterData = result.data;
return getVisibleState(result.visibility);
} else {
node.filterData = void 0;
return getVisibleState(result);
}
}
// cheap
hasTreeNode(location, node = this.root) {
if (!location || location.length === 0) {
return true;
}
const [index, ...rest] = location;
if (index < 0 || index > node.children.length) {
return false;
}
return this.hasTreeNode(rest, node.children[index]);
}
// cheap
getTreeNode(location, node = this.root) {
if (!location || location.length === 0) {
return node;
}
const [index, ...rest] = location;
if (index < 0 || index > node.children.length) {
throw new TreeError(this.user, "Invalid tree location");
}
return this.getTreeNode(rest, node.children[index]);
}
// expensive
getTreeNodeWithListIndex(location) {
if (location.length === 0) {
return { node: this.root, listIndex: -1, revealed: true, visible: false };
}
const { parentNode, listIndex, revealed, visible } = this.getParentNodeWithListIndex(location);
const index = location[location.length - 1];
if (index < 0 || index > parentNode.children.length) {
throw new TreeError(this.user, "Invalid tree location");
}
const node = parentNode.children[index];
return { node, listIndex, revealed, visible: visible && node.visible };
}
getParentNodeWithListIndex(location, node = this.root, listIndex = 0, revealed = true, visible = true) {
const [index, ...rest] = location;
if (index < 0 || index > node.children.length) {
throw new TreeError(this.user, "Invalid tree location");
}
for (let i = 0; i < index; i++) {
listIndex += node.children[i].renderNodeCount;
}
revealed = revealed && !node.collapsed;
visible = visible && node.visible;
if (rest.length === 0) {
return { parentNode: node, listIndex, revealed, visible };
}
return this.getParentNodeWithListIndex(rest, node.children[index], listIndex + 1, revealed, visible);
}
getNode(location = []) {
return this.getTreeNode(location);
}
// TODO@joao perf!
getNodeLocation(node) {
const location = [];
let indexTreeNode = node;
while (indexTreeNode.parent) {
location.push(indexTreeNode.parent.children.indexOf(indexTreeNode));
indexTreeNode = indexTreeNode.parent;
}
return location.reverse();
}
getParentNodeLocation(location) {
if (location.length === 0) {
return void 0;
} else if (location.length === 1) {
return [];
} else {
return tail2(location)[0];
}
}
getFirstElementChild(location) {
const node = this.getTreeNode(location);
if (node.children.length === 0) {
return void 0;
}
return node.children[0].element;
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css
var init_tree2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js
function asTreeDragAndDropData(data) {
if (data instanceof ElementsDragAndDropData) {
return new TreeElementsDragAndDropData(data);
}
return data;
}
function asListOptions(modelProvider, options2) {
return options2 && __spreadProps(__spreadValues({}, options2), {
identityProvider: options2.identityProvider && {
getId(el) {
return options2.identityProvider.getId(el.element);
}
},
dnd: options2.dnd && new TreeNodeListDragAndDrop(modelProvider, options2.dnd),
multipleSelectionController: options2.multipleSelectionController && {
isSelectionSingleChangeEvent(e) {
return options2.multipleSelectionController.isSelectionSingleChangeEvent(__spreadProps(__spreadValues({}, e), { element: e.element }));
},
isSelectionRangeChangeEvent(e) {
return options2.multipleSelectionController.isSelectionRangeChangeEvent(__spreadProps(__spreadValues({}, e), { element: e.element }));
}
},
accessibilityProvider: options2.accessibilityProvider && __spreadProps(__spreadValues({}, options2.accessibilityProvider), {
getSetSize(node) {
const model = modelProvider();
const ref = model.getNodeLocation(node);
const parentRef = model.getParentNodeLocation(ref);
const parentNode = model.getNode(parentRef);
return parentNode.visibleChildrenCount;
},
getPosInSet(node) {
return node.visibleChildIndex + 1;
},
isChecked: options2.accessibilityProvider && options2.accessibilityProvider.isChecked ? (node) => {
return options2.accessibilityProvider.isChecked(node.element);
} : void 0,
getRole: options2.accessibilityProvider && options2.accessibilityProvider.getRole ? (node) => {
return options2.accessibilityProvider.getRole(node.element);
} : () => "treeitem",
getAriaLabel(e) {
return options2.accessibilityProvider.getAriaLabel(e.element);
},
getWidgetAriaLabel() {
return options2.accessibilityProvider.getWidgetAriaLabel();
},
getWidgetRole: options2.accessibilityProvider && options2.accessibilityProvider.getWidgetRole ? () => options2.accessibilityProvider.getWidgetRole() : () => "tree",
getAriaLevel: options2.accessibilityProvider && options2.accessibilityProvider.getAriaLevel ? (node) => options2.accessibilityProvider.getAriaLevel(node.element) : (node) => {
return node.depth;
},
getActiveDescendantId: options2.accessibilityProvider.getActiveDescendantId && ((node) => {
return options2.accessibilityProvider.getActiveDescendantId(node.element);
})
}),
keyboardNavigationLabelProvider: options2.keyboardNavigationLabelProvider && __spreadProps(__spreadValues({}, options2.keyboardNavigationLabelProvider), {
getKeyboardNavigationLabel(node) {
return options2.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(node.element);
}
})
});
}
function stickyScrollNodeStateEquals(node1, node2) {
return node1.position === node2.position && stickyScrollNodeEquals(node1, node2);
}
function stickyScrollNodeEquals(node1, node2) {
return node1.node.element === node2.node.element && node1.startIndex === node2.startIndex && node1.height === node2.height && node1.endIndex === node2.endIndex;
}
function asTreeMouseEvent(event) {
let target = TreeMouseEventTarget.Unknown;
if (hasParentWithClass(event.browserEvent.target, "monaco-tl-twistie", "monaco-tl-row")) {
target = TreeMouseEventTarget.Twistie;
} else if (hasParentWithClass(event.browserEvent.target, "monaco-tl-contents", "monaco-tl-row")) {
target = TreeMouseEventTarget.Element;
} else if (hasParentWithClass(event.browserEvent.target, "monaco-tree-type-filter", "monaco-list")) {
target = TreeMouseEventTarget.Filter;
}
return {
browserEvent: event.browserEvent,
element: event.element ? event.element.element : null,
target
};
}
function asTreeContextMenuEvent(event) {
const isStickyScroll = isStickyScrollContainer(event.browserEvent.target);
return {
element: event.element ? event.element.element : null,
browserEvent: event.browserEvent,
anchor: event.anchor,
isStickyScroll
};
}
function dfs(node, fn) {
fn(node);
node.children.forEach((child) => dfs(child, fn));
}
var TreeElementsDragAndDropData, TreeNodeListDragAndDrop, ComposedTreeDelegate, RenderIndentGuides, EventCollection, TreeRenderer, FindFilter, TreeFindMode, TreeFindMatchType, FindController, StickyScrollState, DefaultStickyScrollDelegate, StickyScrollController, StickyScrollWidget, StickyScrollFocus, Trait2, TreeNodeListMouseController, TreeNodeList, AbstractTree;
var init_abstractTree = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js"() {
init_dom();
init_event2();
init_keyboardEvent();
init_actionbar2();
init_findInput2();
init_inputBox2();
init_listView();
init_listWidget();
init_toggle2();
init_indexTreeModel();
init_tree();
init_actions();
init_arrays();
init_async();
init_codicons();
init_themables();
init_map();
init_event();
init_filters();
init_lifecycle();
init_numbers();
init_types();
init_tree2();
init_nls();
init_hoverDelegateFactory();
init_observable();
TreeElementsDragAndDropData = class extends ElementsDragAndDropData {
constructor(data) {
super(data.elements.map((node) => node.element));
this.data = data;
}
};
TreeNodeListDragAndDrop = class {
constructor(modelProvider, dnd) {
this.modelProvider = modelProvider;
this.dnd = dnd;
this.autoExpandDisposable = Disposable.None;
this.disposables = new DisposableStore();
}
getDragURI(node) {
return this.dnd.getDragURI(node.element);
}
getDragLabel(nodes, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(nodes.map((node) => node.element), originalEvent);
}
return void 0;
}
onDragStart(data, originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragStart) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, asTreeDragAndDropData(data), originalEvent);
}
onDragOver(data, targetNode, targetIndex, targetSector, originalEvent, raw = true) {
const result = this.dnd.onDragOver(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
const didChangeAutoExpandNode = this.autoExpandNode !== targetNode;
if (didChangeAutoExpandNode) {
this.autoExpandDisposable.dispose();
this.autoExpandNode = targetNode;
}
if (typeof targetNode === "undefined") {
return result;
}
if (didChangeAutoExpandNode && typeof result !== "boolean" && result.autoExpand) {
this.autoExpandDisposable = disposableTimeout(() => {
const model2 = this.modelProvider();
const ref2 = model2.getNodeLocation(targetNode);
if (model2.isCollapsed(ref2)) {
model2.setCollapsed(ref2, false);
}
this.autoExpandNode = void 0;
}, 500, this.disposables);
}
if (typeof result === "boolean" || !result.accept || typeof result.bubble === "undefined" || result.feedback) {
if (!raw) {
const accept = typeof result === "boolean" ? result : result.accept;
const effect = typeof result === "boolean" ? void 0 : result.effect;
return { accept, effect, feedback: [targetIndex] };
}
return result;
}
if (result.bubble === 1) {
const model2 = this.modelProvider();
const ref2 = model2.getNodeLocation(targetNode);
const parentRef = model2.getParentNodeLocation(ref2);
const parentNode = model2.getNode(parentRef);
const parentIndex = parentRef && model2.getListIndex(parentRef);
return this.onDragOver(data, parentNode, parentIndex, targetSector, originalEvent, false);
}
const model = this.modelProvider();
const ref = model.getNodeLocation(targetNode);
const start = model.getListIndex(ref);
const length = model.getListRenderCount(ref);
return __spreadProps(__spreadValues({}, result), { feedback: range(start, start + length) });
}
drop(data, targetNode, targetIndex, targetSector, originalEvent) {
this.autoExpandDisposable.dispose();
this.autoExpandNode = void 0;
this.dnd.drop(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
}
onDragEnd(originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragEnd) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, originalEvent);
}
dispose() {
this.disposables.dispose();
this.dnd.dispose();
}
};
ComposedTreeDelegate = class {
constructor(delegate) {
this.delegate = delegate;
}
getHeight(element) {
return this.delegate.getHeight(element.element);
}
getTemplateId(element) {
return this.delegate.getTemplateId(element.element);
}
hasDynamicHeight(element) {
return !!this.delegate.hasDynamicHeight && this.delegate.hasDynamicHeight(element.element);
}
setDynamicHeight(element, height) {
var _a10, _b4;
(_b4 = (_a10 = this.delegate).setDynamicHeight) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, element.element, height);
}
};
(function(RenderIndentGuides2) {
RenderIndentGuides2["None"] = "none";
RenderIndentGuides2["OnHover"] = "onHover";
RenderIndentGuides2["Always"] = "always";
})(RenderIndentGuides || (RenderIndentGuides = {}));
EventCollection = class {
get elements() {
return this._elements;
}
constructor(onDidChange, _elements = []) {
this._elements = _elements;
this.disposables = new DisposableStore();
this.onDidChange = Event.forEach(onDidChange, (elements) => this._elements = elements, this.disposables);
}
dispose() {
this.disposables.dispose();
}
};
TreeRenderer = class _TreeRenderer {
constructor(renderer, modelProvider, onDidChangeCollapseState, activeNodes, renderedIndentGuides, options2 = {}) {
var _a10;
this.renderer = renderer;
this.modelProvider = modelProvider;
this.activeNodes = activeNodes;
this.renderedIndentGuides = renderedIndentGuides;
this.renderedElements = /* @__PURE__ */ new Map();
this.renderedNodes = /* @__PURE__ */ new Map();
this.indent = _TreeRenderer.DefaultIndent;
this.hideTwistiesOfChildlessElements = false;
this.shouldRenderIndentGuides = false;
this.activeIndentNodes = /* @__PURE__ */ new Set();
this.indentGuidesDisposable = Disposable.None;
this.disposables = new DisposableStore();
this.templateId = renderer.templateId;
this.updateOptions(options2);
Event.map(onDidChangeCollapseState, (e) => e.node)(this.onDidChangeNodeTwistieState, this, this.disposables);
(_a10 = renderer.onDidChangeTwistieState) === null || _a10 === void 0 ? void 0 : _a10.call(renderer, this.onDidChangeTwistieState, this, this.disposables);
}
updateOptions(options2 = {}) {
if (typeof options2.indent !== "undefined") {
const indent = clamp(options2.indent, 0, 40);
if (indent !== this.indent) {
this.indent = indent;
for (const [node, templateData] of this.renderedNodes) {
this.renderTreeElement(node, templateData);
}
}
}
if (typeof options2.renderIndentGuides !== "undefined") {
const shouldRenderIndentGuides = options2.renderIndentGuides !== RenderIndentGuides.None;
if (shouldRenderIndentGuides !== this.shouldRenderIndentGuides) {
this.shouldRenderIndentGuides = shouldRenderIndentGuides;
for (const [node, templateData] of this.renderedNodes) {
this._renderIndentGuides(node, templateData);
}
this.indentGuidesDisposable.dispose();
if (shouldRenderIndentGuides) {
const disposables = new DisposableStore();
this.activeNodes.onDidChange(this._onDidChangeActiveNodes, this, disposables);
this.indentGuidesDisposable = disposables;
this._onDidChangeActiveNodes(this.activeNodes.elements);
}
}
}
if (typeof options2.hideTwistiesOfChildlessElements !== "undefined") {
this.hideTwistiesOfChildlessElements = options2.hideTwistiesOfChildlessElements;
}
}
renderTemplate(container) {
const el = append(container, $(".monaco-tl-row"));
const indent = append(el, $(".monaco-tl-indent"));
const twistie = append(el, $(".monaco-tl-twistie"));
const contents = append(el, $(".monaco-tl-contents"));
const templateData = this.renderer.renderTemplate(contents);
return { container, indent, twistie, indentGuidesDisposable: Disposable.None, templateData };
}
renderElement(node, index, templateData, height) {
this.renderedNodes.set(node, templateData);
this.renderedElements.set(node.element, node);
this.renderTreeElement(node, templateData);
this.renderer.renderElement(node, index, templateData.templateData, height);
}
disposeElement(node, index, templateData, height) {
var _a10, _b4;
templateData.indentGuidesDisposable.dispose();
(_b4 = (_a10 = this.renderer).disposeElement) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, node, index, templateData.templateData, height);
if (typeof height === "number") {
this.renderedNodes.delete(node);
this.renderedElements.delete(node.element);
}
}
disposeTemplate(templateData) {
this.renderer.disposeTemplate(templateData.templateData);
}
onDidChangeTwistieState(element) {
const node = this.renderedElements.get(element);
if (!node) {
return;
}
this.onDidChangeNodeTwistieState(node);
}
onDidChangeNodeTwistieState(node) {
const templateData = this.renderedNodes.get(node);
if (!templateData) {
return;
}
this._onDidChangeActiveNodes(this.activeNodes.elements);
this.renderTreeElement(node, templateData);
}
renderTreeElement(node, templateData) {
const indent = _TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent;
templateData.twistie.style.paddingLeft = `${indent}px`;
templateData.indent.style.width = `${indent + this.indent - 16}px`;
if (node.collapsible) {
templateData.container.setAttribute("aria-expanded", String(!node.collapsed));
} else {
templateData.container.removeAttribute("aria-expanded");
}
templateData.twistie.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded));
let twistieRendered = false;
if (this.renderer.renderTwistie) {
twistieRendered = this.renderer.renderTwistie(node.element, templateData.twistie);
}
if (node.collapsible && (!this.hideTwistiesOfChildlessElements || node.visibleChildrenCount > 0)) {
if (!twistieRendered) {
templateData.twistie.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemExpanded));
}
templateData.twistie.classList.add("collapsible");
templateData.twistie.classList.toggle("collapsed", node.collapsed);
} else {
templateData.twistie.classList.remove("collapsible", "collapsed");
}
this._renderIndentGuides(node, templateData);
}
_renderIndentGuides(node, templateData) {
clearNode(templateData.indent);
templateData.indentGuidesDisposable.dispose();
if (!this.shouldRenderIndentGuides) {
return;
}
const disposableStore = new DisposableStore();
const model = this.modelProvider();
while (true) {
const ref = model.getNodeLocation(node);
const parentRef = model.getParentNodeLocation(ref);
if (!parentRef) {
break;
}
const parent = model.getNode(parentRef);
const guide = $(".indent-guide", { style: `width: ${this.indent}px` });
if (this.activeIndentNodes.has(parent)) {
guide.classList.add("active");
}
if (templateData.indent.childElementCount === 0) {
templateData.indent.appendChild(guide);
} else {
templateData.indent.insertBefore(guide, templateData.indent.firstElementChild);
}
this.renderedIndentGuides.add(parent, guide);
disposableStore.add(toDisposable(() => this.renderedIndentGuides.delete(parent, guide)));
node = parent;
}
templateData.indentGuidesDisposable = disposableStore;
}
_onDidChangeActiveNodes(nodes) {
if (!this.shouldRenderIndentGuides) {
return;
}
const set = /* @__PURE__ */ new Set();
const model = this.modelProvider();
nodes.forEach((node) => {
const ref = model.getNodeLocation(node);
try {
const parentRef = model.getParentNodeLocation(ref);
if (node.collapsible && node.children.length > 0 && !node.collapsed) {
set.add(node);
} else if (parentRef) {
set.add(model.getNode(parentRef));
}
} catch (_a10) {
}
});
this.activeIndentNodes.forEach((node) => {
if (!set.has(node)) {
this.renderedIndentGuides.forEach(node, (line) => line.classList.remove("active"));
}
});
set.forEach((node) => {
if (!this.activeIndentNodes.has(node)) {
this.renderedIndentGuides.forEach(node, (line) => line.classList.add("active"));
}
});
this.activeIndentNodes = set;
}
dispose() {
this.renderedNodes.clear();
this.renderedElements.clear();
this.indentGuidesDisposable.dispose();
dispose(this.disposables);
}
};
TreeRenderer.DefaultIndent = 8;
FindFilter = class {
get totalCount() {
return this._totalCount;
}
get matchCount() {
return this._matchCount;
}
constructor(tree, keyboardNavigationLabelProvider, _filter) {
this.tree = tree;
this.keyboardNavigationLabelProvider = keyboardNavigationLabelProvider;
this._filter = _filter;
this._totalCount = 0;
this._matchCount = 0;
this._pattern = "";
this._lowercasePattern = "";
this.disposables = new DisposableStore();
tree.onWillRefilter(this.reset, this, this.disposables);
}
filter(element, parentVisibility) {
let visibility = 1;
if (this._filter) {
const result = this._filter.filter(element, parentVisibility);
if (typeof result === "boolean") {
visibility = result ? 1 : 0;
} else if (isFilterResult(result)) {
visibility = getVisibleState(result.visibility);
} else {
visibility = result;
}
if (visibility === 0) {
return false;
}
}
this._totalCount++;
if (!this._pattern) {
this._matchCount++;
return { data: FuzzyScore.Default, visibility };
}
const label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element);
const labels = Array.isArray(label) ? label : [label];
for (const l of labels) {
const labelStr = l && l.toString();
if (typeof labelStr === "undefined") {
return { data: FuzzyScore.Default, visibility };
}
let score3;
if (this.tree.findMatchType === TreeFindMatchType.Contiguous) {
const index = labelStr.toLowerCase().indexOf(this._lowercasePattern);
if (index > -1) {
score3 = [Number.MAX_SAFE_INTEGER, 0];
for (let i = this._lowercasePattern.length; i > 0; i--) {
score3.push(index + i - 1);
}
}
} else {
score3 = fuzzyScore(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, { firstMatchCanBeWeak: true, boostFullMatch: true });
}
if (score3) {
this._matchCount++;
return labels.length === 1 ? { data: score3, visibility } : { data: { label: labelStr, score: score3 }, visibility };
}
}
if (this.tree.findMode === TreeFindMode.Filter) {
if (typeof this.tree.options.defaultFindVisibility === "number") {
return this.tree.options.defaultFindVisibility;
} else if (this.tree.options.defaultFindVisibility) {
return this.tree.options.defaultFindVisibility(element);
} else {
return 2;
}
} else {
return { data: FuzzyScore.Default, visibility };
}
}
reset() {
this._totalCount = 0;
this._matchCount = 0;
}
dispose() {
dispose(this.disposables);
}
};
(function(TreeFindMode2) {
TreeFindMode2[TreeFindMode2["Highlight"] = 0] = "Highlight";
TreeFindMode2[TreeFindMode2["Filter"] = 1] = "Filter";
})(TreeFindMode || (TreeFindMode = {}));
(function(TreeFindMatchType2) {
TreeFindMatchType2[TreeFindMatchType2["Fuzzy"] = 0] = "Fuzzy";
TreeFindMatchType2[TreeFindMatchType2["Contiguous"] = 1] = "Contiguous";
})(TreeFindMatchType || (TreeFindMatchType = {}));
FindController = class {
get pattern() {
return this._pattern;
}
get mode() {
return this._mode;
}
set mode(mode) {
if (mode === this._mode) {
return;
}
this._mode = mode;
if (this.widget) {
this.widget.mode = this._mode;
}
this.tree.refilter();
this.render();
this._onDidChangeMode.fire(mode);
}
get matchType() {
return this._matchType;
}
set matchType(matchType) {
if (matchType === this._matchType) {
return;
}
this._matchType = matchType;
if (this.widget) {
this.widget.matchType = this._matchType;
}
this.tree.refilter();
this.render();
this._onDidChangeMatchType.fire(matchType);
}
constructor(tree, model, view, filter, contextViewProvider, options2 = {}) {
var _a10, _b4;
this.tree = tree;
this.view = view;
this.filter = filter;
this.contextViewProvider = contextViewProvider;
this.options = options2;
this._pattern = "";
this.width = 0;
this._onDidChangeMode = new Emitter();
this.onDidChangeMode = this._onDidChangeMode.event;
this._onDidChangeMatchType = new Emitter();
this.onDidChangeMatchType = this._onDidChangeMatchType.event;
this._onDidChangePattern = new Emitter();
this._onDidChangeOpenState = new Emitter();
this.onDidChangeOpenState = this._onDidChangeOpenState.event;
this.enabledDisposables = new DisposableStore();
this.disposables = new DisposableStore();
this._mode = (_a10 = tree.options.defaultFindMode) !== null && _a10 !== void 0 ? _a10 : TreeFindMode.Highlight;
this._matchType = (_b4 = tree.options.defaultFindMatchType) !== null && _b4 !== void 0 ? _b4 : TreeFindMatchType.Fuzzy;
model.onDidSplice(this.onDidSpliceModel, this, this.disposables);
}
updateOptions(optionsUpdate = {}) {
if (optionsUpdate.defaultFindMode !== void 0) {
this.mode = optionsUpdate.defaultFindMode;
}
if (optionsUpdate.defaultFindMatchType !== void 0) {
this.matchType = optionsUpdate.defaultFindMatchType;
}
}
onDidSpliceModel() {
if (!this.widget || this.pattern.length === 0) {
return;
}
this.tree.refilter();
this.render();
}
render() {
var _a10, _b4, _c2, _d2;
const noMatches = this.filter.totalCount > 0 && this.filter.matchCount === 0;
if (this.pattern && noMatches) {
if ((_a10 = this.tree.options.showNotFoundMessage) !== null && _a10 !== void 0 ? _a10 : true) {
(_b4 = this.widget) === null || _b4 === void 0 ? void 0 : _b4.showMessage({ type: 2, content: localize("not found", "No elements found.") });
} else {
(_c2 = this.widget) === null || _c2 === void 0 ? void 0 : _c2.showMessage({
type: 2
/* MessageType.WARNING */
});
}
} else {
(_d2 = this.widget) === null || _d2 === void 0 ? void 0 : _d2.clearMessage();
}
}
shouldAllowFocus(node) {
if (!this.widget || !this.pattern) {
return true;
}
if (this.filter.totalCount > 0 && this.filter.matchCount <= 1) {
return true;
}
return !FuzzyScore.isDefault(node.filterData);
}
layout(width2) {
var _a10;
this.width = width2;
(_a10 = this.widget) === null || _a10 === void 0 ? void 0 : _a10.layout(width2);
}
dispose() {
this._history = void 0;
this._onDidChangePattern.dispose();
this.enabledDisposables.dispose();
this.disposables.dispose();
}
};
StickyScrollState = class {
constructor(stickyNodes = []) {
this.stickyNodes = stickyNodes;
}
get count() {
return this.stickyNodes.length;
}
equal(state) {
return equals(this.stickyNodes, state.stickyNodes, stickyScrollNodeStateEquals);
}
lastNodePartiallyVisible() {
if (this.count === 0) {
return false;
}
const lastStickyNode = this.stickyNodes[this.count - 1];
if (this.count === 1) {
return lastStickyNode.position !== 0;
}
const secondLastStickyNode = this.stickyNodes[this.count - 2];
return secondLastStickyNode.position + secondLastStickyNode.height !== lastStickyNode.position;
}
animationStateChanged(previousState) {
if (!equals(this.stickyNodes, previousState.stickyNodes, stickyScrollNodeEquals)) {
return false;
}
if (this.count === 0) {
return false;
}
const lastStickyNode = this.stickyNodes[this.count - 1];
const previousLastStickyNode = previousState.stickyNodes[previousState.count - 1];
return lastStickyNode.position !== previousLastStickyNode.position;
}
};
DefaultStickyScrollDelegate = class {
constrainStickyScrollNodes(stickyNodes, stickyScrollMaxItemCount, maxWidgetHeight) {
for (let i = 0; i < stickyNodes.length; i++) {
const stickyNode = stickyNodes[i];
const stickyNodeBottom = stickyNode.position + stickyNode.height;
if (stickyNodeBottom > maxWidgetHeight || i >= stickyScrollMaxItemCount) {
return stickyNodes.slice(0, i);
}
}
return stickyNodes;
}
};
StickyScrollController = class extends Disposable {
constructor(tree, model, view, renderers, treeDelegate, options2 = {}) {
var _a10;
super();
this.tree = tree;
this.model = model;
this.view = view;
this.treeDelegate = treeDelegate;
this.maxWidgetViewRatio = 0.4;
const stickyScrollOptions = this.validateStickySettings(options2);
this.stickyScrollMaxItemCount = stickyScrollOptions.stickyScrollMaxItemCount;
this.stickyScrollDelegate = (_a10 = options2.stickyScrollDelegate) !== null && _a10 !== void 0 ? _a10 : new DefaultStickyScrollDelegate();
this._widget = this._register(new StickyScrollWidget(view.getScrollableElement(), view, tree, renderers, treeDelegate, options2.accessibilityProvider));
this.onDidChangeHasFocus = this._widget.onDidChangeHasFocus;
this.onContextMenu = this._widget.onContextMenu;
this._register(view.onDidScroll(() => this.update()));
this._register(view.onDidChangeContentHeight(() => this.update()));
this._register(tree.onDidChangeCollapseState(() => this.update()));
this.update();
}
get height() {
return this._widget.height;
}
getNodeAtHeight(height) {
let index;
if (height === 0) {
index = this.view.firstVisibleIndex;
} else {
index = this.view.indexAt(height + this.view.scrollTop);
}
if (index < 0 || index >= this.view.length) {
return void 0;
}
return this.view.element(index);
}
update() {
const firstVisibleNode = this.getNodeAtHeight(0);
if (!firstVisibleNode || this.tree.scrollTop === 0) {
this._widget.setState(void 0);
return;
}
const stickyState = this.findStickyState(firstVisibleNode);
this._widget.setState(stickyState);
}
findStickyState(firstVisibleNode) {
const stickyNodes = [];
let firstVisibleNodeUnderWidget = firstVisibleNode;
let stickyNodesHeight = 0;
let nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, void 0, stickyNodesHeight);
while (nextStickyNode) {
stickyNodes.push(nextStickyNode);
stickyNodesHeight += nextStickyNode.height;
if (stickyNodes.length <= this.stickyScrollMaxItemCount) {
firstVisibleNodeUnderWidget = this.getNextVisibleNode(nextStickyNode);
if (!firstVisibleNodeUnderWidget) {
break;
}
}
nextStickyNode = this.getNextStickyNode(firstVisibleNodeUnderWidget, nextStickyNode.node, stickyNodesHeight);
}
const contrainedStickyNodes = this.constrainStickyNodes(stickyNodes);
return contrainedStickyNodes.length ? new StickyScrollState(contrainedStickyNodes) : void 0;
}
getNextVisibleNode(previousStickyNode) {
return this.getNodeAtHeight(previousStickyNode.position + previousStickyNode.height);
}
getNextStickyNode(firstVisibleNodeUnderWidget, previousStickyNode, stickyNodesHeight) {
const nextStickyNode = this.getAncestorUnderPrevious(firstVisibleNodeUnderWidget, previousStickyNode);
if (!nextStickyNode) {
return void 0;
}
if (nextStickyNode === firstVisibleNodeUnderWidget) {
if (!this.nodeIsUncollapsedParent(firstVisibleNodeUnderWidget)) {
return void 0;
}
if (this.nodeTopAlignsWithStickyNodesBottom(firstVisibleNodeUnderWidget, stickyNodesHeight)) {
return void 0;
}
}
return this.createStickyScrollNode(nextStickyNode, stickyNodesHeight);
}
nodeTopAlignsWithStickyNodesBottom(node, stickyNodesHeight) {
const nodeIndex = this.getNodeIndex(node);
const elementTop = this.view.getElementTop(nodeIndex);
const stickyPosition = stickyNodesHeight;
return this.view.scrollTop === elementTop - stickyPosition;
}
createStickyScrollNode(node, currentStickyNodesHeight) {
const height = this.treeDelegate.getHeight(node);
const { startIndex, endIndex } = this.getNodeRange(node);
const position = this.calculateStickyNodePosition(endIndex, currentStickyNodesHeight, height);
return { node, position, height, startIndex, endIndex };
}
getAncestorUnderPrevious(node, previousAncestor = void 0) {
let currentAncestor = node;
let parentOfcurrentAncestor = this.getParentNode(currentAncestor);
while (parentOfcurrentAncestor) {
if (parentOfcurrentAncestor === previousAncestor) {
return currentAncestor;
}
currentAncestor = parentOfcurrentAncestor;
parentOfcurrentAncestor = this.getParentNode(currentAncestor);
}
if (previousAncestor === void 0) {
return currentAncestor;
}
return void 0;
}
calculateStickyNodePosition(lastDescendantIndex, stickyRowPositionTop, stickyNodeHeight) {
let lastChildRelativeTop = this.view.getRelativeTop(lastDescendantIndex);
if (lastChildRelativeTop === null && this.view.firstVisibleIndex === lastDescendantIndex && lastDescendantIndex + 1 < this.view.length) {
const nodeHeight = this.treeDelegate.getHeight(this.view.element(lastDescendantIndex));
const nextNodeRelativeTop = this.view.getRelativeTop(lastDescendantIndex + 1);
lastChildRelativeTop = nextNodeRelativeTop ? nextNodeRelativeTop - nodeHeight / this.view.renderHeight : null;
}
if (lastChildRelativeTop === null) {
return stickyRowPositionTop;
}
const lastChildNode = this.view.element(lastDescendantIndex);
const lastChildHeight = this.treeDelegate.getHeight(lastChildNode);
const topOfLastChild = lastChildRelativeTop * this.view.renderHeight;
const bottomOfLastChild = topOfLastChild + lastChildHeight;
if (stickyRowPositionTop + stickyNodeHeight > bottomOfLastChild && stickyRowPositionTop <= bottomOfLastChild) {
return bottomOfLastChild - stickyNodeHeight;
}
return stickyRowPositionTop;
}
constrainStickyNodes(stickyNodes) {
if (stickyNodes.length === 0) {
return [];
}
const maximumStickyWidgetHeight = this.view.renderHeight * this.maxWidgetViewRatio;
const lastStickyNode = stickyNodes[stickyNodes.length - 1];
if (stickyNodes.length <= this.stickyScrollMaxItemCount && lastStickyNode.position + lastStickyNode.height <= maximumStickyWidgetHeight) {
return stickyNodes;
}
const constrainedStickyNodes = this.stickyScrollDelegate.constrainStickyScrollNodes(stickyNodes, this.stickyScrollMaxItemCount, maximumStickyWidgetHeight);
if (!constrainedStickyNodes.length) {
return [];
}
const lastConstrainedStickyNode = constrainedStickyNodes[constrainedStickyNodes.length - 1];
if (constrainedStickyNodes.length > this.stickyScrollMaxItemCount || lastConstrainedStickyNode.position + lastConstrainedStickyNode.height > maximumStickyWidgetHeight) {
throw new Error("stickyScrollDelegate violates constraints");
}
return constrainedStickyNodes;
}
getParentNode(node) {
const nodeLocation = this.model.getNodeLocation(node);
const parentLocation = this.model.getParentNodeLocation(nodeLocation);
return parentLocation ? this.model.getNode(parentLocation) : void 0;
}
nodeIsUncollapsedParent(node) {
const nodeLocation = this.model.getNodeLocation(node);
return this.model.getListRenderCount(nodeLocation) > 1;
}
getNodeIndex(node) {
const nodeLocation = this.model.getNodeLocation(node);
const nodeIndex = this.model.getListIndex(nodeLocation);
return nodeIndex;
}
getNodeRange(node) {
const nodeLocation = this.model.getNodeLocation(node);
const startIndex = this.model.getListIndex(nodeLocation);
if (startIndex < 0) {
throw new Error("Node not found in tree");
}
const renderCount = this.model.getListRenderCount(nodeLocation);
const endIndex = startIndex + renderCount - 1;
return { startIndex, endIndex };
}
nodePositionTopBelowWidget(node) {
const ancestors = [];
let currentAncestor = this.getParentNode(node);
while (currentAncestor) {
ancestors.push(currentAncestor);
currentAncestor = this.getParentNode(currentAncestor);
}
let widgetHeight = 0;
for (let i = 0; i < ancestors.length && i < this.stickyScrollMaxItemCount; i++) {
widgetHeight += this.treeDelegate.getHeight(ancestors[i]);
}
return widgetHeight;
}
domFocus() {
this._widget.domFocus();
}
// Whether sticky scroll was the last focused part in the tree or not
focusedLast() {
return this._widget.focusedLast();
}
updateOptions(optionsUpdate = {}) {
if (!optionsUpdate.stickyScrollMaxItemCount) {
return;
}
const validatedOptions = this.validateStickySettings(optionsUpdate);
if (this.stickyScrollMaxItemCount !== validatedOptions.stickyScrollMaxItemCount) {
this.stickyScrollMaxItemCount = validatedOptions.stickyScrollMaxItemCount;
this.update();
}
}
validateStickySettings(options2) {
let stickyScrollMaxItemCount = 7;
if (typeof options2.stickyScrollMaxItemCount === "number") {
stickyScrollMaxItemCount = Math.max(options2.stickyScrollMaxItemCount, 1);
}
return { stickyScrollMaxItemCount };
}
};
StickyScrollWidget = class {
constructor(container, view, tree, treeRenderers, treeDelegate, accessibilityProvider) {
this.view = view;
this.tree = tree;
this.treeRenderers = treeRenderers;
this.treeDelegate = treeDelegate;
this.accessibilityProvider = accessibilityProvider;
this._previousElements = [];
this._previousStateDisposables = new DisposableStore();
this._rootDomNode = $(".monaco-tree-sticky-container.empty");
container.appendChild(this._rootDomNode);
const shadow = $(".monaco-tree-sticky-container-shadow");
this._rootDomNode.appendChild(shadow);
this.stickyScrollFocus = new StickyScrollFocus(this._rootDomNode, view);
this.onDidChangeHasFocus = this.stickyScrollFocus.onDidChangeHasFocus;
this.onContextMenu = this.stickyScrollFocus.onContextMenu;
}
get height() {
if (!this._previousState) {
return 0;
}
const lastElement = this._previousState.stickyNodes[this._previousState.count - 1];
return lastElement.position + lastElement.height;
}
setState(state) {
const wasVisible = !!this._previousState && this._previousState.count > 0;
const isVisible = !!state && state.count > 0;
if (!wasVisible && !isVisible || wasVisible && isVisible && this._previousState.equal(state)) {
return;
}
if (wasVisible !== isVisible) {
this.setVisible(isVisible);
}
if (!isVisible) {
this._previousState = void 0;
this._previousElements = [];
this._previousStateDisposables.clear();
return;
}
const lastStickyNode = state.stickyNodes[state.count - 1];
if (this._previousState && state.animationStateChanged(this._previousState)) {
this._previousElements[this._previousState.count - 1].style.top = `${lastStickyNode.position}px`;
} else {
this._previousStateDisposables.clear();
const elements = Array(state.count);
for (let stickyIndex = state.count - 1; stickyIndex >= 0; stickyIndex--) {
const stickyNode = state.stickyNodes[stickyIndex];
const { element, disposable } = this.createElement(stickyNode, stickyIndex, state.count);
elements[stickyIndex] = element;
this._rootDomNode.appendChild(element);
this._previousStateDisposables.add(disposable);
}
this.stickyScrollFocus.updateElements(elements, state);
this._previousElements = elements;
}
this._previousState = state;
this._rootDomNode.style.height = `${lastStickyNode.position + lastStickyNode.height}px`;
}
createElement(stickyNode, stickyIndex, stickyNodesTotal) {
const nodeIndex = stickyNode.startIndex;
const stickyElement = document.createElement("div");
stickyElement.style.top = `${stickyNode.position}px`;
if (this.tree.options.setRowHeight !== false) {
stickyElement.style.height = `${stickyNode.height}px`;
}
if (this.tree.options.setRowLineHeight !== false) {
stickyElement.style.lineHeight = `${stickyNode.height}px`;
}
stickyElement.classList.add("monaco-tree-sticky-row");
stickyElement.classList.add("monaco-list-row");
stickyElement.setAttribute("data-index", `${nodeIndex}`);
stickyElement.setAttribute("data-parity", nodeIndex % 2 === 0 ? "even" : "odd");
stickyElement.setAttribute("id", this.view.getElementID(nodeIndex));
const accessibilityDisposable = this.setAccessibilityAttributes(stickyElement, stickyNode.node.element, stickyIndex, stickyNodesTotal);
const nodeTemplateId = this.treeDelegate.getTemplateId(stickyNode.node);
const renderer = this.treeRenderers.find((renderer2) => renderer2.templateId === nodeTemplateId);
if (!renderer) {
throw new Error(`No renderer found for template id ${nodeTemplateId}`);
}
let nodeCopy = stickyNode.node;
if (nodeCopy === this.tree.getNode(this.tree.getNodeLocation(stickyNode.node))) {
nodeCopy = new Proxy(stickyNode.node, {});
}
const templateData = renderer.renderTemplate(stickyElement);
renderer.renderElement(nodeCopy, stickyNode.startIndex, templateData, stickyNode.height);
const disposable = toDisposable(() => {
accessibilityDisposable.dispose();
renderer.disposeElement(nodeCopy, stickyNode.startIndex, templateData, stickyNode.height);
renderer.disposeTemplate(templateData);
stickyElement.remove();
});
return { element: stickyElement, disposable };
}
setAccessibilityAttributes(container, element, stickyIndex, stickyNodesTotal) {
var _a10;
if (!this.accessibilityProvider) {
return Disposable.None;
}
if (this.accessibilityProvider.getSetSize) {
container.setAttribute("aria-setsize", String(this.accessibilityProvider.getSetSize(element, stickyIndex, stickyNodesTotal)));
}
if (this.accessibilityProvider.getPosInSet) {
container.setAttribute("aria-posinset", String(this.accessibilityProvider.getPosInSet(element, stickyIndex)));
}
if (this.accessibilityProvider.getRole) {
container.setAttribute("role", (_a10 = this.accessibilityProvider.getRole(element)) !== null && _a10 !== void 0 ? _a10 : "treeitem");
}
const ariaLabel = this.accessibilityProvider.getAriaLabel(element);
const observable = ariaLabel && typeof ariaLabel !== "string" ? ariaLabel : constObservable(ariaLabel);
const result = autorun((reader) => {
const value = reader.readObservable(observable);
if (value) {
container.setAttribute("aria-label", value);
} else {
container.removeAttribute("aria-label");
}
});
if (typeof ariaLabel === "string") {
} else if (ariaLabel) {
container.setAttribute("aria-label", ariaLabel.get());
}
const ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element);
if (typeof ariaLevel === "number") {
container.setAttribute("aria-level", `${ariaLevel}`);
}
container.setAttribute("aria-selected", String(false));
return result;
}
setVisible(visible) {
this._rootDomNode.classList.toggle("empty", !visible);
if (!visible) {
this.stickyScrollFocus.updateElements([], void 0);
}
}
domFocus() {
this.stickyScrollFocus.domFocus();
}
focusedLast() {
return this.stickyScrollFocus.focusedLast();
}
dispose() {
this.stickyScrollFocus.dispose();
this._previousStateDisposables.dispose();
this._rootDomNode.remove();
}
};
StickyScrollFocus = class extends Disposable {
get domHasFocus() {
return this._domHasFocus;
}
set domHasFocus(hasFocus) {
if (hasFocus !== this._domHasFocus) {
this._onDidChangeHasFocus.fire(hasFocus);
this._domHasFocus = hasFocus;
}
}
constructor(container, view) {
super();
this.container = container;
this.view = view;
this.focusedIndex = -1;
this.elements = [];
this._onDidChangeHasFocus = new Emitter();
this.onDidChangeHasFocus = this._onDidChangeHasFocus.event;
this._onContextMenu = new Emitter();
this.onContextMenu = this._onContextMenu.event;
this._domHasFocus = false;
this.container.addEventListener("focus", () => this.onFocus());
this.container.addEventListener("blur", () => this.onBlur());
this._register(this.view.onDidFocus(() => this.toggleStickyScrollFocused(false)));
this._register(this.view.onKeyDown((e) => this.onKeyDown(e)));
this._register(this.view.onMouseDown((e) => this.onMouseDown(e)));
this._register(this.view.onContextMenu((e) => this.handleContextMenu(e)));
}
handleContextMenu(e) {
const target = e.browserEvent.target;
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
if (this.focusedLast()) {
this.view.domFocus();
}
return;
}
if (!isKeyboardEvent(e.browserEvent)) {
if (!this.state) {
throw new Error("Context menu should not be triggered when state is undefined");
}
const stickyIndex = this.state.stickyNodes.findIndex((stickyNode2) => {
var _a10;
return stickyNode2.node.element === ((_a10 = e.element) === null || _a10 === void 0 ? void 0 : _a10.element);
});
if (stickyIndex === -1) {
throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");
}
this.container.focus();
this.setFocus(stickyIndex);
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");
}
const stickyNode = this.state.stickyNodes[this.focusedIndex];
const element = stickyNode.node.element;
const anchor = this.elements[this.focusedIndex];
this._onContextMenu.fire({ element, anchor, browserEvent: e.browserEvent, isStickyScroll: true });
}
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) {
const nodeIndexToFocus = this.state.stickyNodes[this.state.count - 1].startIndex + 1;
this.view.domFocus();
this.view.setFocus([nodeIndexToFocus]);
this.scrollNodeUnderWidget(nodeIndexToFocus, this.state);
} else {
this.setFocusedElement(this.focusedIndex + 1);
}
e.preventDefault();
e.stopPropagation();
}
}
}
onMouseDown(e) {
const target = e.browserEvent.target;
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
return;
}
e.browserEvent.preventDefault();
e.browserEvent.stopPropagation();
}
updateElements(elements, state) {
if (state && state.count === 0) {
throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");
}
if (state && state.count !== elements.length) {
throw new Error("Sticky scroll focus received illigel state");
}
const previousIndex = this.focusedIndex;
this.removeFocus();
this.elements = elements;
this.state = state;
if (state) {
const newFocusedIndex = clamp(previousIndex, 0, state.count - 1);
this.setFocus(newFocusedIndex);
} else {
if (this.domHasFocus) {
this.view.domFocus();
}
}
this.container.tabIndex = state ? 0 : -1;
}
setFocusedElement(stickyIndex) {
const state = this.state;
if (!state) {
throw new Error("Cannot set focus when state is undefined");
}
this.setFocus(stickyIndex);
if (stickyIndex < state.count - 1) {
return;
}
if (state.lastNodePartiallyVisible()) {
const lastStickyNode = state.stickyNodes[stickyIndex];
this.scrollNodeUnderWidget(lastStickyNode.endIndex + 1, state);
}
}
scrollNodeUnderWidget(nodeIndex, state) {
const lastStickyNode = state.stickyNodes[state.count - 1];
const secondLastStickyNode = state.count > 1 ? state.stickyNodes[state.count - 2] : void 0;
const elementScrollTop = this.view.getElementTop(nodeIndex);
const elementTargetViewTop = secondLastStickyNode ? secondLastStickyNode.position + secondLastStickyNode.height + lastStickyNode.height : lastStickyNode.height;
this.view.scrollTop = elementScrollTop - elementTargetViewTop;
}
domFocus() {
if (!this.state) {
throw new Error("Cannot focus when state is undefined");
}
this.container.focus();
}
focusedLast() {
if (!this.state) {
return false;
}
return this.view.getHTMLElement().classList.contains("sticky-scroll-focused");
}
removeFocus() {
if (this.focusedIndex === -1) {
return;
}
this.toggleElementFocus(this.elements[this.focusedIndex], false);
this.focusedIndex = -1;
}
setFocus(newFocusIndex) {
if (0 > newFocusIndex) {
throw new Error("addFocus() can not remove focus");
}
if (!this.state && newFocusIndex >= 0) {
throw new Error("Cannot set focus index when state is undefined");
}
if (this.state && newFocusIndex >= this.state.count) {
throw new Error("Cannot set focus index to an index that does not exist");
}
const oldIndex = this.focusedIndex;
if (oldIndex >= 0) {
this.toggleElementFocus(this.elements[oldIndex], false);
}
if (newFocusIndex >= 0) {
this.toggleElementFocus(this.elements[newFocusIndex], true);
}
this.focusedIndex = newFocusIndex;
}
toggleElementFocus(element, focused) {
this.toggleElementActiveFocus(element, focused && this.domHasFocus);
this.toggleElementPassiveFocus(element, focused);
}
toggleCurrentElementActiveFocus(focused) {
if (this.focusedIndex === -1) {
return;
}
this.toggleElementActiveFocus(this.elements[this.focusedIndex], focused);
}
toggleElementActiveFocus(element, focused) {
element.classList.toggle("focused", focused);
}
toggleElementPassiveFocus(element, focused) {
element.classList.toggle("passive-focused", focused);
}
toggleStickyScrollFocused(focused) {
this.view.getHTMLElement().classList.toggle("sticky-scroll-focused", focused);
}
onFocus() {
if (!this.state || this.elements.length === 0) {
throw new Error("Cannot focus when state is undefined or elements are empty");
}
this.domHasFocus = true;
this.toggleStickyScrollFocused(true);
this.toggleCurrentElementActiveFocus(true);
if (this.focusedIndex === -1) {
this.setFocus(0);
}
}
onBlur() {
this.domHasFocus = false;
this.toggleCurrentElementActiveFocus(false);
}
dispose() {
this.toggleStickyScrollFocused(false);
this._onDidChangeHasFocus.fire(false);
super.dispose();
}
};
Trait2 = class {
get nodeSet() {
if (!this._nodeSet) {
this._nodeSet = this.createNodeSet();
}
return this._nodeSet;
}
constructor(getFirstViewElementWithTrait, identityProvider) {
this.getFirstViewElementWithTrait = getFirstViewElementWithTrait;
this.identityProvider = identityProvider;
this.nodes = [];
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
}
set(nodes, browserEvent) {
if (!(browserEvent === null || browserEvent === void 0 ? void 0 : browserEvent.__forceEvent) && equals(this.nodes, nodes)) {
return;
}
this._set(nodes, false, browserEvent);
}
_set(nodes, silent, browserEvent) {
this.nodes = [...nodes];
this.elements = void 0;
this._nodeSet = void 0;
if (!silent) {
const that = this;
this._onDidChange.fire({ get elements() {
return that.get();
}, browserEvent });
}
}
get() {
if (!this.elements) {
this.elements = this.nodes.map((node) => node.element);
}
return [...this.elements];
}
getNodes() {
return this.nodes;
}
has(node) {
return this.nodeSet.has(node);
}
onDidModelSplice({ insertedNodes, deletedNodes }) {
if (!this.identityProvider) {
const set = this.createNodeSet();
const visit2 = (node) => set.delete(node);
deletedNodes.forEach((node) => dfs(node, visit2));
this.set([...set.values()]);
return;
}
const deletedNodesIdSet = /* @__PURE__ */ new Set();
const deletedNodesVisitor = (node) => deletedNodesIdSet.add(this.identityProvider.getId(node.element).toString());
deletedNodes.forEach((node) => dfs(node, deletedNodesVisitor));
const insertedNodesMap = /* @__PURE__ */ new Map();
const insertedNodesVisitor = (node) => insertedNodesMap.set(this.identityProvider.getId(node.element).toString(), node);
insertedNodes.forEach((node) => dfs(node, insertedNodesVisitor));
const nodes = [];
for (const node of this.nodes) {
const id = this.identityProvider.getId(node.element).toString();
const wasDeleted = deletedNodesIdSet.has(id);
if (!wasDeleted) {
nodes.push(node);
} else {
const insertedNode = insertedNodesMap.get(id);
if (insertedNode && insertedNode.visible) {
nodes.push(insertedNode);
}
}
}
if (this.nodes.length > 0 && nodes.length === 0) {
const node = this.getFirstViewElementWithTrait();
if (node) {
nodes.push(node);
}
}
this._set(nodes, true);
}
createNodeSet() {
const set = /* @__PURE__ */ new Set();
for (const node of this.nodes) {
set.add(node);
}
return set;
}
};
TreeNodeListMouseController = class extends MouseController {
constructor(list, tree, stickyScrollProvider) {
super(list);
this.tree = tree;
this.stickyScrollProvider = stickyScrollProvider;
}
onViewPointer(e) {
if (isButton(e.browserEvent.target) || isInputElement(e.browserEvent.target) || isMonacoEditor(e.browserEvent.target)) {
return;
}
if (e.browserEvent.isHandledByList) {
return;
}
const node = e.element;
if (!node) {
return super.onViewPointer(e);
}
if (this.isSelectionRangeChangeEvent(e) || this.isSelectionSingleChangeEvent(e)) {
return super.onViewPointer(e);
}
const target = e.browserEvent.target;
const onTwistie = target.classList.contains("monaco-tl-twistie") || target.classList.contains("monaco-icon-label") && target.classList.contains("folder-icon") && e.browserEvent.offsetX < 16;
const isStickyElement = isStickyScrollElement(e.browserEvent.target);
let expandOnlyOnTwistieClick = false;
if (isStickyElement) {
expandOnlyOnTwistieClick = true;
} else if (typeof this.tree.expandOnlyOnTwistieClick === "function") {
expandOnlyOnTwistieClick = this.tree.expandOnlyOnTwistieClick(node.element);
} else {
expandOnlyOnTwistieClick = !!this.tree.expandOnlyOnTwistieClick;
}
if (!isStickyElement) {
if (expandOnlyOnTwistieClick && !onTwistie && e.browserEvent.detail !== 2) {
return super.onViewPointer(e);
}
if (!this.tree.expandOnDoubleClick && e.browserEvent.detail === 2) {
return super.onViewPointer(e);
}
} else {
this.handleStickyScrollMouseEvent(e, node);
}
if (node.collapsible && (!isStickyElement || onTwistie)) {
const location = this.tree.getNodeLocation(node);
const recursive = e.browserEvent.altKey;
this.tree.setFocus([location]);
this.tree.toggleCollapsed(location, recursive);
if (onTwistie) {
e.browserEvent.isHandledByList = true;
return;
}
}
if (!isStickyElement) {
super.onViewPointer(e);
}
}
handleStickyScrollMouseEvent(e, node) {
if (isMonacoCustomToggle(e.browserEvent.target) || isActionItem(e.browserEvent.target)) {
return;
}
const stickyScrollController = this.stickyScrollProvider();
if (!stickyScrollController) {
throw new Error("Sticky scroll controller not found");
}
const nodeIndex = this.list.indexOf(node);
const elementScrollTop = this.list.getElementTop(nodeIndex);
const elementTargetViewTop = stickyScrollController.nodePositionTopBelowWidget(node);
this.tree.scrollTop = elementScrollTop - elementTargetViewTop;
this.list.domFocus();
this.list.setFocus([nodeIndex]);
this.list.setSelection([nodeIndex]);
}
onDoubleClick(e) {
const onTwistie = e.browserEvent.target.classList.contains("monaco-tl-twistie");
if (onTwistie || !this.tree.expandOnDoubleClick) {
return;
}
if (e.browserEvent.isHandledByList) {
return;
}
super.onDoubleClick(e);
}
// to make sure dom focus is not stolen (for example with context menu)
onMouseDown(e) {
const target = e.browserEvent.target;
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
super.onMouseDown(e);
return;
}
}
onContextMenu(e) {
const target = e.browserEvent.target;
if (!isStickyScrollContainer(target) && !isStickyScrollElement(target)) {
super.onContextMenu(e);
return;
}
}
};
TreeNodeList = class extends List {
constructor(user, container, virtualDelegate, renderers, focusTrait, selectionTrait, anchorTrait, options2) {
super(user, container, virtualDelegate, renderers, options2);
this.focusTrait = focusTrait;
this.selectionTrait = selectionTrait;
this.anchorTrait = anchorTrait;
}
createMouseController(options2) {
return new TreeNodeListMouseController(this, options2.tree, options2.stickyScrollProvider);
}
splice(start, deleteCount, elements = []) {
super.splice(start, deleteCount, elements);
if (elements.length === 0) {
return;
}
const additionalFocus = [];
const additionalSelection = [];
let anchor;
elements.forEach((node, index) => {
if (this.focusTrait.has(node)) {
additionalFocus.push(start + index);
}
if (this.selectionTrait.has(node)) {
additionalSelection.push(start + index);
}
if (this.anchorTrait.has(node)) {
anchor = start + index;
}
});
if (additionalFocus.length > 0) {
super.setFocus(distinct([...super.getFocus(), ...additionalFocus]));
}
if (additionalSelection.length > 0) {
super.setSelection(distinct([...super.getSelection(), ...additionalSelection]));
}
if (typeof anchor === "number") {
super.setAnchor(anchor);
}
}
setFocus(indexes, browserEvent, fromAPI = false) {
super.setFocus(indexes, browserEvent);
if (!fromAPI) {
this.focusTrait.set(indexes.map((i) => this.element(i)), browserEvent);
}
}
setSelection(indexes, browserEvent, fromAPI = false) {
super.setSelection(indexes, browserEvent);
if (!fromAPI) {
this.selectionTrait.set(indexes.map((i) => this.element(i)), browserEvent);
}
}
setAnchor(index, fromAPI = false) {
super.setAnchor(index);
if (!fromAPI) {
if (typeof index === "undefined") {
this.anchorTrait.set([]);
} else {
this.anchorTrait.set([this.element(index)]);
}
}
}
};
AbstractTree = 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 Event.filter(Event.map(this.view.onMouseDblClick, asTreeMouseEvent), (e) => e.target !== TreeMouseEventTarget.Filter);
}
get onMouseOver() {
return Event.map(this.view.onMouseOver, asTreeMouseEvent);
}
get onMouseOut() {
return Event.map(this.view.onMouseOut, asTreeMouseEvent);
}
get onContextMenu() {
var _a10, _b4;
return Event.any(Event.filter(Event.map(this.view.onContextMenu, asTreeContextMenuEvent), (e) => !e.isStickyScroll), (_b4 = (_a10 = this.stickyScrollController) === null || _a10 === void 0 ? void 0 : _a10.onContextMenu) !== null && _b4 !== void 0 ? _b4 : Event.None);
}
get onPointer() {
return Event.map(this.view.onPointer, asTreeMouseEvent);
}
get onKeyDown() {
return this.view.onKeyDown;
}
get onDidFocus() {
return this.view.onDidFocus;
}
get onDidChangeModel() {
return Event.signal(this.model.onDidSplice);
}
get onDidChangeCollapseState() {
return this.model.onDidChangeCollapseState;
}
get findMode() {
var _a10, _b4;
return (_b4 = (_a10 = this.findController) === null || _a10 === void 0 ? void 0 : _a10.mode) !== null && _b4 !== void 0 ? _b4 : TreeFindMode.Highlight;
}
set findMode(findMode) {
if (this.findController) {
this.findController.mode = findMode;
}
}
get findMatchType() {
var _a10, _b4;
return (_b4 = (_a10 = this.findController) === null || _a10 === void 0 ? void 0 : _a10.matchType) !== null && _b4 !== void 0 ? _b4 : TreeFindMatchType.Fuzzy;
}
set findMatchType(findFuzzy) {
if (this.findController) {
this.findController.matchType = findFuzzy;
}
}
get expandOnDoubleClick() {
return typeof this._options.expandOnDoubleClick === "undefined" ? true : this._options.expandOnDoubleClick;
}
get expandOnlyOnTwistieClick() {
return typeof this._options.expandOnlyOnTwistieClick === "undefined" ? true : this._options.expandOnlyOnTwistieClick;
}
get onDidDispose() {
return this.view.onDidDispose;
}
constructor(_user, container, delegate, renderers, _options = {}) {
var _a10;
this._user = _user;
this._options = _options;
this.eventBufferer = new EventBufferer();
this.onDidChangeFindOpenState = Event.None;
this.onDidChangeStickyScrollFocused = Event.None;
this.disposables = new DisposableStore();
this._onWillRefilter = new Emitter();
this.onWillRefilter = this._onWillRefilter.event;
this._onDidUpdateOptions = new Emitter();
this.treeDelegate = new ComposedTreeDelegate(delegate);
const onDidChangeCollapseStateRelay = new Relay();
const onDidChangeActiveNodes = new Relay();
const activeNodes = this.disposables.add(new EventCollection(onDidChangeActiveNodes.event));
const renderedIndentGuides = new SetMap();
this.renderers = renderers.map((r) => new TreeRenderer(r, () => this.model, onDidChangeCollapseStateRelay.event, activeNodes, renderedIndentGuides, _options));
for (const r of this.renderers) {
this.disposables.add(r);
}
let filter;
if (_options.keyboardNavigationLabelProvider) {
filter = new FindFilter(this, _options.keyboardNavigationLabelProvider, _options.filter);
_options = __spreadProps(__spreadValues({}, _options), { filter });
this.disposables.add(filter);
}
this.focus = new Trait2(() => this.view.getFocusedElements()[0], _options.identityProvider);
this.selection = new Trait2(() => this.view.getSelectedElements()[0], _options.identityProvider);
this.anchor = new Trait2(() => this.view.getAnchorElement(), _options.identityProvider);
this.view = new TreeNodeList(_user, container, this.treeDelegate, this.renderers, this.focus, this.selection, this.anchor, __spreadProps(__spreadValues({}, asListOptions(() => this.model, _options)), { tree: this, stickyScrollProvider: () => this.stickyScrollController }));
this.model = this.createModel(_user, this.view, _options);
onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState;
const onDidModelSplice = Event.forEach(this.model.onDidSplice, (e) => {
this.eventBufferer.bufferEvents(() => {
this.focus.onDidModelSplice(e);
this.selection.onDidModelSplice(e);
});
}, this.disposables);
onDidModelSplice(() => null, null, this.disposables);
const activeNodesEmitter = this.disposables.add(new Emitter());
const activeNodesDebounce = this.disposables.add(new Delayer(0));
this.disposables.add(Event.any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange)(() => {
activeNodesDebounce.trigger(() => {
const set = /* @__PURE__ */ new Set();
for (const node of this.focus.getNodes()) {
set.add(node);
}
for (const node of this.selection.getNodes()) {
set.add(node);
}
activeNodesEmitter.fire([...set.values()]);
});
}));
onDidChangeActiveNodes.input = activeNodesEmitter.event;
if (_options.keyboardSupport !== false) {
const onKeyDown = Event.chain(this.view.onKeyDown, ($16) => $16.filter((e) => !isInputElement(e.target)).map((e) => new StandardKeyboardEvent(e)));
Event.chain(onKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 15
/* KeyCode.LeftArrow */
))(this.onLeftArrow, this, this.disposables);
Event.chain(onKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 17
/* KeyCode.RightArrow */
))(this.onRightArrow, this, this.disposables);
Event.chain(onKeyDown, ($16) => $16.filter(
(e) => e.keyCode === 10
/* KeyCode.Space */
))(this.onSpace, this, this.disposables);
}
if (((_a10 = _options.findWidgetEnabled) !== null && _a10 !== void 0 ? _a10 : true) && _options.keyboardNavigationLabelProvider && _options.contextViewProvider) {
const opts = this.options.findWidgetStyles ? { styles: this.options.findWidgetStyles } : void 0;
this.findController = new FindController(this, this.model, this.view, filter, _options.contextViewProvider, opts);
this.focusNavigationFilter = (node) => this.findController.shouldAllowFocus(node);
this.onDidChangeFindOpenState = this.findController.onDidChangeOpenState;
this.disposables.add(this.findController);
this.onDidChangeFindMode = this.findController.onDidChangeMode;
this.onDidChangeFindMatchType = this.findController.onDidChangeMatchType;
} else {
this.onDidChangeFindMode = Event.None;
this.onDidChangeFindMatchType = Event.None;
}
if (_options.enableStickyScroll) {
this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, _options);
this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus;
}
this.styleElement = createStyleSheet(this.view.getHTMLElement());
this.getHTMLElement().classList.toggle("always", this._options.renderIndentGuides === RenderIndentGuides.Always);
}
updateOptions(optionsUpdate = {}) {
var _a10;
this._options = __spreadValues(__spreadValues({}, this._options), optionsUpdate);
for (const renderer of this.renderers) {
renderer.updateOptions(optionsUpdate);
}
this.view.updateOptions(this._options);
(_a10 = this.findController) === null || _a10 === void 0 ? void 0 : _a10.updateOptions(optionsUpdate);
this.updateStickyScroll(optionsUpdate);
this._onDidUpdateOptions.fire(this._options);
this.getHTMLElement().classList.toggle("always", this._options.renderIndentGuides === RenderIndentGuides.Always);
}
get options() {
return this._options;
}
updateStickyScroll(optionsUpdate) {
var _a10;
if (!this.stickyScrollController && this._options.enableStickyScroll) {
this.stickyScrollController = new StickyScrollController(this, this.model, this.view, this.renderers, this.treeDelegate, this._options);
this.onDidChangeStickyScrollFocused = this.stickyScrollController.onDidChangeHasFocus;
} else if (this.stickyScrollController && !this._options.enableStickyScroll) {
this.onDidChangeStickyScrollFocused = Event.None;
this.stickyScrollController.dispose();
this.stickyScrollController = void 0;
}
(_a10 = this.stickyScrollController) === null || _a10 === void 0 ? void 0 : _a10.updateOptions(optionsUpdate);
}
// Widget
getHTMLElement() {
return this.view.getHTMLElement();
}
get scrollTop() {
return this.view.scrollTop;
}
set scrollTop(scrollTop) {
this.view.scrollTop = scrollTop;
}
get scrollHeight() {
return this.view.scrollHeight;
}
get renderHeight() {
return this.view.renderHeight;
}
get ariaLabel() {
return this.view.ariaLabel;
}
set ariaLabel(value) {
this.view.ariaLabel = value;
}
domFocus() {
var _a10;
if ((_a10 = this.stickyScrollController) === null || _a10 === void 0 ? void 0 : _a10.focusedLast()) {
this.stickyScrollController.domFocus();
} else {
this.view.domFocus();
}
}
layout(height, width2) {
var _a10;
this.view.layout(height, width2);
if (isNumber(width2)) {
(_a10 = this.findController) === null || _a10 === void 0 ? void 0 : _a10.layout(width2);
}
}
style(styles) {
var _a10, _b4;
const suffix = `.${this.view.domId}`;
const content = [];
if (styles.treeIndentGuidesStroke) {
content.push(`.monaco-list${suffix}:hover .monaco-tl-indent > .indent-guide, .monaco-list${suffix}.always .monaco-tl-indent > .indent-guide { border-color: ${styles.treeInactiveIndentGuidesStroke}; }`);
content.push(`.monaco-list${suffix} .monaco-tl-indent > .indent-guide.active { border-color: ${styles.treeIndentGuidesStroke}; }`);
}
const stickyScrollBackground = (_a10 = styles.treeStickyScrollBackground) !== null && _a10 !== void 0 ? _a10 : styles.listBackground;
if (stickyScrollBackground) {
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${stickyScrollBackground}; }`);
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${stickyScrollBackground}; }`);
}
if (styles.treeStickyScrollBorder) {
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${styles.treeStickyScrollBorder}; }`);
}
if (styles.treeStickyScrollShadow) {
content.push(`.monaco-list${suffix} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${styles.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`);
}
if (styles.listFocusForeground) {
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`);
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`);
}
const focusAndSelectionOutline = asCssValueWithDefault(styles.listFocusAndSelectionOutline, asCssValueWithDefault(styles.listSelectionOutline, (_b4 = styles.listFocusOutline) !== null && _b4 !== void 0 ? _b4 : ""));
if (focusAndSelectionOutline) {
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${focusAndSelectionOutline}; outline-offset: -1px;}`);
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`);
}
if (styles.listFocusOutline) {
content.push(`.monaco-list${suffix}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`);
content.push(`.monaco-list${suffix}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`);
content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }`);
content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`);
content.push(`.monaco-workbench.context-menu-visible .monaco-list${suffix}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`);
}
this.styleElement.textContent = content.join("\n");
this.view.style(styles);
}
// Tree navigation
getParentElement(location) {
const parentRef = this.model.getParentNodeLocation(location);
const parentNode = this.model.getNode(parentRef);
return parentNode.element;
}
getFirstElementChild(location) {
return this.model.getFirstElementChild(location);
}
// Tree
getNode(location) {
return this.model.getNode(location);
}
getNodeLocation(node) {
return this.model.getNodeLocation(node);
}
collapse(location, recursive = false) {
return this.model.setCollapsed(location, true, recursive);
}
expand(location, recursive = false) {
return this.model.setCollapsed(location, false, recursive);
}
toggleCollapsed(location, recursive = false) {
return this.model.setCollapsed(location, void 0, recursive);
}
isCollapsible(location) {
return this.model.isCollapsible(location);
}
setCollapsible(location, collapsible) {
return this.model.setCollapsible(location, collapsible);
}
isCollapsed(location) {
return this.model.isCollapsed(location);
}
refilter() {
this._onWillRefilter.fire(void 0);
this.model.refilter();
}
setSelection(elements, browserEvent) {
this.eventBufferer.bufferEvents(() => {
const nodes = elements.map((e) => this.model.getNode(e));
this.selection.set(nodes, browserEvent);
const indexes = elements.map((e) => this.model.getListIndex(e)).filter((i) => i > -1);
this.view.setSelection(indexes, browserEvent, true);
});
}
getSelection() {
return this.selection.get();
}
setFocus(elements, browserEvent) {
this.eventBufferer.bufferEvents(() => {
const nodes = elements.map((e) => this.model.getNode(e));
this.focus.set(nodes, browserEvent);
const indexes = elements.map((e) => this.model.getListIndex(e)).filter((i) => i > -1);
this.view.setFocus(indexes, browserEvent, true);
});
}
focusNext(n = 1, loop = false, browserEvent, filter = isKeyboardEvent(browserEvent) && browserEvent.altKey ? void 0 : this.focusNavigationFilter) {
this.view.focusNext(n, loop, browserEvent, filter);
}
focusPrevious(n = 1, loop = false, browserEvent, filter = isKeyboardEvent(browserEvent) && browserEvent.altKey ? void 0 : this.focusNavigationFilter) {
this.view.focusPrevious(n, loop, browserEvent, filter);
}
focusNextPage(browserEvent, filter = isKeyboardEvent(browserEvent) && browserEvent.altKey ? void 0 : this.focusNavigationFilter) {
return this.view.focusNextPage(browserEvent, filter);
}
focusPreviousPage(browserEvent, filter = isKeyboardEvent(browserEvent) && browserEvent.altKey ? void 0 : this.focusNavigationFilter) {
return this.view.focusPreviousPage(browserEvent, filter, () => {
var _a10, _b4;
return (_b4 = (_a10 = this.stickyScrollController) === null || _a10 === void 0 ? void 0 : _a10.height) !== null && _b4 !== void 0 ? _b4 : 0;
});
}
focusFirst(browserEvent, filter = isKeyboardEvent(browserEvent) && browserEvent.altKey ? void 0 : this.focusNavigationFilter) {
this.view.focusFirst(browserEvent, filter);
}
getFocus() {
return this.focus.get();
}
reveal(location, relativeTop) {
this.model.expandTo(location);
const index = this.model.getListIndex(location);
if (index === -1) {
return;
}
if (!this.stickyScrollController) {
this.view.reveal(index, relativeTop);
} else {
const paddingTop = this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(location));
this.view.reveal(index, relativeTop, paddingTop);
}
}
// List
onLeftArrow(e) {
e.preventDefault();
e.stopPropagation();
const nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
const node = nodes[0];
const location = this.model.getNodeLocation(node);
const didChange = this.model.setCollapsed(location, true);
if (!didChange) {
const parentLocation = this.model.getParentNodeLocation(location);
if (!parentLocation) {
return;
}
const parentListIndex = this.model.getListIndex(parentLocation);
this.view.reveal(parentListIndex);
this.view.setFocus([parentListIndex]);
}
}
onRightArrow(e) {
e.preventDefault();
e.stopPropagation();
const nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
const node = nodes[0];
const location = this.model.getNodeLocation(node);
const didChange = this.model.setCollapsed(location, false);
if (!didChange) {
if (!node.children.some((child) => child.visible)) {
return;
}
const [focusedIndex] = this.view.getFocus();
const firstChildIndex = focusedIndex + 1;
this.view.reveal(firstChildIndex);
this.view.setFocus([firstChildIndex]);
}
}
onSpace(e) {
e.preventDefault();
e.stopPropagation();
const nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
const node = nodes[0];
const location = this.model.getNodeLocation(node);
const recursive = e.browserEvent.altKey;
this.model.setCollapsed(location, void 0, recursive);
}
dispose() {
var _a10;
dispose(this.disposables);
(_a10 = this.stickyScrollController) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this.view.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js
var ObjectTreeModel;
var init_objectTreeModel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js"() {
init_indexTreeModel();
init_tree();
init_iterator();
ObjectTreeModel = class {
constructor(user, list, options2 = {}) {
this.user = user;
this.rootRef = null;
this.nodes = /* @__PURE__ */ new Map();
this.nodesByIdentity = /* @__PURE__ */ new Map();
this.model = new IndexTreeModel(user, list, null, options2);
this.onDidSplice = this.model.onDidSplice;
this.onDidChangeCollapseState = this.model.onDidChangeCollapseState;
this.onDidChangeRenderNodeCount = this.model.onDidChangeRenderNodeCount;
if (options2.sorter) {
this.sorter = {
compare(a3, b) {
return options2.sorter.compare(a3.element, b.element);
}
};
}
this.identityProvider = options2.identityProvider;
}
setChildren(element, children = Iterable.empty(), options2 = {}) {
const location = this.getElementLocation(element);
this._setChildren(location, this.preserveCollapseState(children), options2);
}
_setChildren(location, children = Iterable.empty(), options2) {
const insertedElements = /* @__PURE__ */ new Set();
const insertedElementIds = /* @__PURE__ */ new Set();
const onDidCreateNode = (node) => {
var _a10;
if (node.element === null) {
return;
}
const tnode = node;
insertedElements.add(tnode.element);
this.nodes.set(tnode.element, tnode);
if (this.identityProvider) {
const id = this.identityProvider.getId(tnode.element).toString();
insertedElementIds.add(id);
this.nodesByIdentity.set(id, tnode);
}
(_a10 = options2.onDidCreateNode) === null || _a10 === void 0 ? void 0 : _a10.call(options2, tnode);
};
const onDidDeleteNode = (node) => {
var _a10;
if (node.element === null) {
return;
}
const tnode = node;
if (!insertedElements.has(tnode.element)) {
this.nodes.delete(tnode.element);
}
if (this.identityProvider) {
const id = this.identityProvider.getId(tnode.element).toString();
if (!insertedElementIds.has(id)) {
this.nodesByIdentity.delete(id);
}
}
(_a10 = options2.onDidDeleteNode) === null || _a10 === void 0 ? void 0 : _a10.call(options2, tnode);
};
this.model.splice([...location, 0], Number.MAX_VALUE, children, __spreadProps(__spreadValues({}, options2), { onDidCreateNode, onDidDeleteNode }));
}
preserveCollapseState(elements = Iterable.empty()) {
if (this.sorter) {
elements = [...elements].sort(this.sorter.compare.bind(this.sorter));
}
return Iterable.map(elements, (treeElement) => {
let node = this.nodes.get(treeElement.element);
if (!node && this.identityProvider) {
const id = this.identityProvider.getId(treeElement.element).toString();
node = this.nodesByIdentity.get(id);
}
if (!node) {
let collapsed3;
if (typeof treeElement.collapsed === "undefined") {
collapsed3 = void 0;
} else if (treeElement.collapsed === ObjectTreeElementCollapseState.Collapsed || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrCollapsed) {
collapsed3 = true;
} else if (treeElement.collapsed === ObjectTreeElementCollapseState.Expanded || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrExpanded) {
collapsed3 = false;
} else {
collapsed3 = Boolean(treeElement.collapsed);
}
return __spreadProps(__spreadValues({}, treeElement), {
children: this.preserveCollapseState(treeElement.children),
collapsed: collapsed3
});
}
const collapsible = typeof treeElement.collapsible === "boolean" ? treeElement.collapsible : node.collapsible;
let collapsed2;
if (typeof treeElement.collapsed === "undefined" || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrCollapsed || treeElement.collapsed === ObjectTreeElementCollapseState.PreserveOrExpanded) {
collapsed2 = node.collapsed;
} else if (treeElement.collapsed === ObjectTreeElementCollapseState.Collapsed) {
collapsed2 = true;
} else if (treeElement.collapsed === ObjectTreeElementCollapseState.Expanded) {
collapsed2 = false;
} else {
collapsed2 = Boolean(treeElement.collapsed);
}
return __spreadProps(__spreadValues({}, treeElement), {
collapsible,
collapsed: collapsed2,
children: this.preserveCollapseState(treeElement.children)
});
});
}
rerender(element) {
const location = this.getElementLocation(element);
this.model.rerender(location);
}
getFirstElementChild(ref = null) {
const location = this.getElementLocation(ref);
return this.model.getFirstElementChild(location);
}
has(element) {
return this.nodes.has(element);
}
getListIndex(element) {
const location = this.getElementLocation(element);
return this.model.getListIndex(location);
}
getListRenderCount(element) {
const location = this.getElementLocation(element);
return this.model.getListRenderCount(location);
}
isCollapsible(element) {
const location = this.getElementLocation(element);
return this.model.isCollapsible(location);
}
setCollapsible(element, collapsible) {
const location = this.getElementLocation(element);
return this.model.setCollapsible(location, collapsible);
}
isCollapsed(element) {
const location = this.getElementLocation(element);
return this.model.isCollapsed(location);
}
setCollapsed(element, collapsed2, recursive) {
const location = this.getElementLocation(element);
return this.model.setCollapsed(location, collapsed2, recursive);
}
expandTo(element) {
const location = this.getElementLocation(element);
this.model.expandTo(location);
}
refilter() {
this.model.refilter();
}
getNode(element = null) {
if (element === null) {
return this.model.getNode(this.model.rootRef);
}
const node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, `Tree element not found: ${element}`);
}
return node;
}
getNodeLocation(node) {
return node.element;
}
getParentNodeLocation(element) {
if (element === null) {
throw new TreeError(this.user, `Invalid getParentNodeLocation call`);
}
const node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, `Tree element not found: ${element}`);
}
const location = this.model.getNodeLocation(node);
const parentLocation = this.model.getParentNodeLocation(location);
const parent = this.model.getNode(parentLocation);
return parent.element;
}
getElementLocation(element) {
if (element === null) {
return [];
}
const node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, `Tree element not found: ${element}`);
}
return this.model.getNodeLocation(node);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js
function noCompress(element) {
const elements = [element.element];
const incompressible = element.incompressible || false;
return {
element: { elements, incompressible },
children: Iterable.map(Iterable.from(element.children), noCompress),
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
function compress(element) {
const elements = [element.element];
const incompressible = element.incompressible || false;
let childrenIterator;
let children;
while (true) {
[children, childrenIterator] = Iterable.consume(Iterable.from(element.children), 2);
if (children.length !== 1) {
break;
}
if (children[0].incompressible) {
break;
}
element = children[0];
elements.push(element.element);
}
return {
element: { elements, incompressible },
children: Iterable.map(Iterable.concat(children, childrenIterator), compress),
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
function _decompress(element, index = 0) {
let children;
if (index < element.element.elements.length - 1) {
children = [_decompress(element, index + 1)];
} else {
children = Iterable.map(Iterable.from(element.children), (el) => _decompress(el, 0));
}
if (index === 0 && element.element.incompressible) {
return {
element: element.element.elements[index],
children,
incompressible: true,
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
return {
element: element.element.elements[index],
children,
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
function decompress(element) {
return _decompress(element, 0);
}
function splice2(treeElement, element, children) {
if (treeElement.element === element) {
return __spreadProps(__spreadValues({}, treeElement), { children });
}
return __spreadProps(__spreadValues({}, treeElement), { children: Iterable.map(Iterable.from(treeElement.children), (e) => splice2(e, element, children)) });
}
function mapList(nodeMapper, list) {
return {
splice(start, deleteCount, toInsert) {
list.splice(start, deleteCount, toInsert.map((node) => nodeMapper.map(node)));
},
updateElementHeight(index, height) {
list.updateElementHeight(index, height);
}
};
}
function mapOptions(compressedNodeUnwrapper, options2) {
return __spreadProps(__spreadValues({}, options2), {
identityProvider: options2.identityProvider && {
getId(node) {
return options2.identityProvider.getId(compressedNodeUnwrapper(node));
}
},
sorter: options2.sorter && {
compare(node, otherNode) {
return options2.sorter.compare(node.elements[0], otherNode.elements[0]);
}
},
filter: options2.filter && {
filter(node, parentVisibility) {
return options2.filter.filter(compressedNodeUnwrapper(node), parentVisibility);
}
}
});
}
var wrapIdentityProvider, CompressedObjectTreeModel, DefaultElementMapper, CompressedTreeNodeWrapper, CompressibleObjectTreeModel;
var init_compressedObjectTreeModel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js"() {
init_objectTreeModel();
init_tree();
init_arrays();
init_event();
init_iterator();
wrapIdentityProvider = (base) => ({
getId(node) {
return node.elements.map((e) => base.getId(e).toString()).join("\0");
}
});
CompressedObjectTreeModel = class {
get onDidSplice() {
return this.model.onDidSplice;
}
get onDidChangeCollapseState() {
return this.model.onDidChangeCollapseState;
}
get onDidChangeRenderNodeCount() {
return this.model.onDidChangeRenderNodeCount;
}
constructor(user, list, options2 = {}) {
this.user = user;
this.rootRef = null;
this.nodes = /* @__PURE__ */ new Map();
this.model = new ObjectTreeModel(user, list, options2);
this.enabled = typeof options2.compressionEnabled === "undefined" ? true : options2.compressionEnabled;
this.identityProvider = options2.identityProvider;
}
setChildren(element, children = Iterable.empty(), options2) {
const diffIdentityProvider = options2.diffIdentityProvider && wrapIdentityProvider(options2.diffIdentityProvider);
if (element === null) {
const compressedChildren = Iterable.map(children, this.enabled ? compress : noCompress);
this._setChildren(null, compressedChildren, { diffIdentityProvider, diffDepth: Infinity });
return;
}
const compressedNode = this.nodes.get(element);
if (!compressedNode) {
throw new TreeError(this.user, "Unknown compressed tree node");
}
const node = this.model.getNode(compressedNode);
const compressedParentNode = this.model.getParentNodeLocation(compressedNode);
const parent = this.model.getNode(compressedParentNode);
const decompressedElement = decompress(node);
const splicedElement = splice2(decompressedElement, element, children);
const recompressedElement = (this.enabled ? compress : noCompress)(splicedElement);
const elementComparator = options2.diffIdentityProvider ? (a3, b) => options2.diffIdentityProvider.getId(a3) === options2.diffIdentityProvider.getId(b) : void 0;
if (equals(recompressedElement.element.elements, node.element.elements, elementComparator)) {
this._setChildren(compressedNode, recompressedElement.children || Iterable.empty(), { diffIdentityProvider, diffDepth: 1 });
return;
}
const parentChildren = parent.children.map((child) => child === node ? recompressedElement : child);
this._setChildren(parent.element, parentChildren, {
diffIdentityProvider,
diffDepth: node.depth - parent.depth
});
}
isCompressionEnabled() {
return this.enabled;
}
setCompressionEnabled(enabled) {
if (enabled === this.enabled) {
return;
}
this.enabled = enabled;
const root = this.model.getNode();
const rootChildren = root.children;
const decompressedRootChildren = Iterable.map(rootChildren, decompress);
const recompressedRootChildren = Iterable.map(decompressedRootChildren, enabled ? compress : noCompress);
this._setChildren(null, recompressedRootChildren, {
diffIdentityProvider: this.identityProvider,
diffDepth: Infinity
});
}
_setChildren(node, children, options2) {
const insertedElements = /* @__PURE__ */ new Set();
const onDidCreateNode = (node2) => {
for (const element of node2.element.elements) {
insertedElements.add(element);
this.nodes.set(element, node2.element);
}
};
const onDidDeleteNode = (node2) => {
for (const element of node2.element.elements) {
if (!insertedElements.has(element)) {
this.nodes.delete(element);
}
}
};
this.model.setChildren(node, children, __spreadProps(__spreadValues({}, options2), { onDidCreateNode, onDidDeleteNode }));
}
has(element) {
return this.nodes.has(element);
}
getListIndex(location) {
const node = this.getCompressedNode(location);
return this.model.getListIndex(node);
}
getListRenderCount(location) {
const node = this.getCompressedNode(location);
return this.model.getListRenderCount(node);
}
getNode(location) {
if (typeof location === "undefined") {
return this.model.getNode();
}
const node = this.getCompressedNode(location);
return this.model.getNode(node);
}
// TODO: review this
getNodeLocation(node) {
const compressedNode = this.model.getNodeLocation(node);
if (compressedNode === null) {
return null;
}
return compressedNode.elements[compressedNode.elements.length - 1];
}
// TODO: review this
getParentNodeLocation(location) {
const compressedNode = this.getCompressedNode(location);
const parentNode = this.model.getParentNodeLocation(compressedNode);
if (parentNode === null) {
return null;
}
return parentNode.elements[parentNode.elements.length - 1];
}
getFirstElementChild(location) {
const compressedNode = this.getCompressedNode(location);
return this.model.getFirstElementChild(compressedNode);
}
isCollapsible(location) {
const compressedNode = this.getCompressedNode(location);
return this.model.isCollapsible(compressedNode);
}
setCollapsible(location, collapsible) {
const compressedNode = this.getCompressedNode(location);
return this.model.setCollapsible(compressedNode, collapsible);
}
isCollapsed(location) {
const compressedNode = this.getCompressedNode(location);
return this.model.isCollapsed(compressedNode);
}
setCollapsed(location, collapsed2, recursive) {
const compressedNode = this.getCompressedNode(location);
return this.model.setCollapsed(compressedNode, collapsed2, recursive);
}
expandTo(location) {
const compressedNode = this.getCompressedNode(location);
this.model.expandTo(compressedNode);
}
rerender(location) {
const compressedNode = this.getCompressedNode(location);
this.model.rerender(compressedNode);
}
refilter() {
this.model.refilter();
}
getCompressedNode(element) {
if (element === null) {
return null;
}
const node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, `Tree element not found: ${element}`);
}
return node;
}
};
DefaultElementMapper = (elements) => elements[elements.length - 1];
CompressedTreeNodeWrapper = class _CompressedTreeNodeWrapper {
get element() {
return this.node.element === null ? null : this.unwrapper(this.node.element);
}
get children() {
return this.node.children.map((node) => new _CompressedTreeNodeWrapper(this.unwrapper, node));
}
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(unwrapper, node) {
this.unwrapper = unwrapper;
this.node = node;
}
};
CompressibleObjectTreeModel = class {
get onDidSplice() {
return Event.map(this.model.onDidSplice, ({ insertedNodes, deletedNodes }) => ({
insertedNodes: insertedNodes.map((node) => this.nodeMapper.map(node)),
deletedNodes: deletedNodes.map((node) => this.nodeMapper.map(node))
}));
}
get onDidChangeCollapseState() {
return Event.map(this.model.onDidChangeCollapseState, ({ node, deep }) => ({
node: this.nodeMapper.map(node),
deep
}));
}
get onDidChangeRenderNodeCount() {
return Event.map(this.model.onDidChangeRenderNodeCount, (node) => this.nodeMapper.map(node));
}
constructor(user, list, options2 = {}) {
this.rootRef = null;
this.elementMapper = options2.elementMapper || DefaultElementMapper;
const compressedNodeUnwrapper = (node) => this.elementMapper(node.elements);
this.nodeMapper = new WeakMapper((node) => new CompressedTreeNodeWrapper(compressedNodeUnwrapper, node));
this.model = new CompressedObjectTreeModel(user, mapList(this.nodeMapper, list), mapOptions(compressedNodeUnwrapper, options2));
}
setChildren(element, children = Iterable.empty(), options2 = {}) {
this.model.setChildren(element, children, options2);
}
isCompressionEnabled() {
return this.model.isCompressionEnabled();
}
setCompressionEnabled(enabled) {
this.model.setCompressionEnabled(enabled);
}
has(location) {
return this.model.has(location);
}
getListIndex(location) {
return this.model.getListIndex(location);
}
getListRenderCount(location) {
return this.model.getListRenderCount(location);
}
getNode(location) {
return this.nodeMapper.map(this.model.getNode(location));
}
getNodeLocation(node) {
return node.element;
}
getParentNodeLocation(location) {
return this.model.getParentNodeLocation(location);
}
getFirstElementChild(location) {
const result = this.model.getFirstElementChild(location);
if (result === null || typeof result === "undefined") {
return result;
}
return this.elementMapper(result.elements);
}
isCollapsible(location) {
return this.model.isCollapsible(location);
}
setCollapsible(location, collapsed2) {
return this.model.setCollapsible(location, collapsed2);
}
isCollapsed(location) {
return this.model.isCollapsed(location);
}
setCollapsed(location, collapsed2, recursive) {
return this.model.setCollapsed(location, collapsed2, recursive);
}
expandTo(location) {
return this.model.expandTo(location);
}
rerender(location) {
return this.model.rerender(location);
}
refilter() {
return this.model.refilter();
}
getCompressedTreeNode(location = null) {
return this.model.getNode(location);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js
function asObjectTreeOptions(compressedTreeNodeProvider, options2) {
return options2 && __spreadProps(__spreadValues({}, options2), {
keyboardNavigationLabelProvider: options2.keyboardNavigationLabelProvider && {
getKeyboardNavigationLabel(e) {
let compressedTreeNode;
try {
compressedTreeNode = compressedTreeNodeProvider().getCompressedTreeNode(e);
} catch (_a10) {
return options2.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e);
}
if (compressedTreeNode.element.elements.length === 1) {
return options2.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e);
} else {
return options2.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(compressedTreeNode.element.elements);
}
}
}
});
}
var __decorate37, ObjectTree, CompressibleRenderer, CompressibleStickyScrollDelegate, CompressibleObjectTree;
var init_objectTree = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js"() {
init_abstractTree();
init_compressedObjectTreeModel();
init_objectTreeModel();
init_decorators();
init_iterator();
__decorate37 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
ObjectTree = class extends AbstractTree {
get onDidChangeCollapseState() {
return this.model.onDidChangeCollapseState;
}
constructor(user, container, delegate, renderers, options2 = {}) {
super(user, container, delegate, renderers, options2);
this.user = user;
}
setChildren(element, children = Iterable.empty(), options2) {
this.model.setChildren(element, children, options2);
}
rerender(element) {
if (element === void 0) {
this.view.rerender();
return;
}
this.model.rerender(element);
}
hasElement(element) {
return this.model.has(element);
}
createModel(user, view, options2) {
return new ObjectTreeModel(user, view, options2);
}
};
CompressibleRenderer = class {
get compressedTreeNodeProvider() {
return this._compressedTreeNodeProvider();
}
constructor(_compressedTreeNodeProvider, stickyScrollDelegate, renderer) {
this._compressedTreeNodeProvider = _compressedTreeNodeProvider;
this.stickyScrollDelegate = stickyScrollDelegate;
this.renderer = renderer;
this.templateId = renderer.templateId;
if (renderer.onDidChangeTwistieState) {
this.onDidChangeTwistieState = renderer.onDidChangeTwistieState;
}
}
renderTemplate(container) {
const data = this.renderer.renderTemplate(container);
return { compressedTreeNode: void 0, data };
}
renderElement(node, index, templateData, height) {
let compressedTreeNode = this.stickyScrollDelegate.getCompressedNode(node);
if (!compressedTreeNode) {
compressedTreeNode = this.compressedTreeNodeProvider.getCompressedTreeNode(node.element);
}
if (compressedTreeNode.element.elements.length === 1) {
templateData.compressedTreeNode = void 0;
this.renderer.renderElement(node, index, templateData.data, height);
} else {
templateData.compressedTreeNode = compressedTreeNode;
this.renderer.renderCompressedElements(compressedTreeNode, index, templateData.data, height);
}
}
disposeElement(node, index, templateData, height) {
var _a10, _b4, _c2, _d2;
if (templateData.compressedTreeNode) {
(_b4 = (_a10 = this.renderer).disposeCompressedElements) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, templateData.compressedTreeNode, index, templateData.data, height);
} else {
(_d2 = (_c2 = this.renderer).disposeElement) === null || _d2 === void 0 ? void 0 : _d2.call(_c2, node, index, templateData.data, height);
}
}
disposeTemplate(templateData) {
this.renderer.disposeTemplate(templateData.data);
}
renderTwistie(element, twistieElement) {
if (this.renderer.renderTwistie) {
return this.renderer.renderTwistie(element, twistieElement);
}
return false;
}
};
__decorate37([
memoize
], CompressibleRenderer.prototype, "compressedTreeNodeProvider", null);
CompressibleStickyScrollDelegate = class {
constructor(modelProvider) {
this.modelProvider = modelProvider;
this.compressedStickyNodes = /* @__PURE__ */ new Map();
}
getCompressedNode(node) {
return this.compressedStickyNodes.get(node);
}
constrainStickyScrollNodes(stickyNodes, stickyScrollMaxItemCount, maxWidgetHeight) {
this.compressedStickyNodes.clear();
if (stickyNodes.length === 0) {
return [];
}
for (let i = 0; i < stickyNodes.length; i++) {
const stickyNode = stickyNodes[i];
const stickyNodeBottom = stickyNode.position + stickyNode.height;
const followingReachesMaxHeight = i + 1 < stickyNodes.length && stickyNodeBottom + stickyNodes[i + 1].height > maxWidgetHeight;
if (followingReachesMaxHeight || i >= stickyScrollMaxItemCount - 1 && stickyScrollMaxItemCount < stickyNodes.length) {
const uncompressedStickyNodes = stickyNodes.slice(0, i);
const overflowingStickyNodes = stickyNodes.slice(i);
const compressedStickyNode = this.compressStickyNodes(overflowingStickyNodes);
return [...uncompressedStickyNodes, compressedStickyNode];
}
}
return stickyNodes;
}
compressStickyNodes(stickyNodes) {
if (stickyNodes.length === 0) {
throw new Error("Can't compress empty sticky nodes");
}
const compressionModel = this.modelProvider();
if (!compressionModel.isCompressionEnabled()) {
return stickyNodes[0];
}
const elements = [];
for (let i = 0; i < stickyNodes.length; i++) {
const stickyNode = stickyNodes[i];
const compressedNode2 = compressionModel.getCompressedTreeNode(stickyNode.node.element);
if (compressedNode2.element) {
if (i !== 0 && compressedNode2.element.incompressible) {
break;
}
elements.push(...compressedNode2.element.elements);
}
}
if (elements.length < 2) {
return stickyNodes[0];
}
const lastStickyNode = stickyNodes[stickyNodes.length - 1];
const compressedElement = { elements, incompressible: false };
const compressedNode = __spreadProps(__spreadValues({}, lastStickyNode.node), { children: [], element: compressedElement });
const stickyTreeNode = new Proxy(stickyNodes[0].node, {});
const compressedStickyNode = {
node: stickyTreeNode,
startIndex: stickyNodes[0].startIndex,
endIndex: lastStickyNode.endIndex,
position: stickyNodes[0].position,
height: stickyNodes[0].height
};
this.compressedStickyNodes.set(stickyTreeNode, compressedNode);
return compressedStickyNode;
}
};
CompressibleObjectTree = class extends ObjectTree {
constructor(user, container, delegate, renderers, options2 = {}) {
const compressedTreeNodeProvider = () => this;
const stickyScrollDelegate = new CompressibleStickyScrollDelegate(() => this.model);
const compressibleRenderers = renderers.map((r) => new CompressibleRenderer(compressedTreeNodeProvider, stickyScrollDelegate, r));
super(user, container, delegate, compressibleRenderers, __spreadProps(__spreadValues({}, asObjectTreeOptions(compressedTreeNodeProvider, options2)), { stickyScrollDelegate }));
}
setChildren(element, children = Iterable.empty(), options2) {
this.model.setChildren(element, children, options2);
}
createModel(user, view, options2) {
return new CompressibleObjectTreeModel(user, view, options2);
}
updateOptions(optionsUpdate = {}) {
super.updateOptions(optionsUpdate);
if (typeof optionsUpdate.compressionEnabled !== "undefined") {
this.model.setCompressionEnabled(optionsUpdate.compressionEnabled);
}
}
getCompressedTreeNode(element = null) {
return this.model.getCompressedTreeNode(element);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js
function createAsyncDataTreeNode(props) {
return __spreadProps(__spreadValues({}, props), {
children: [],
refreshPromise: void 0,
stale: true,
slow: false,
forceExpanded: false
});
}
function isAncestor2(ancestor, descendant) {
if (!descendant.parent) {
return false;
} else if (descendant.parent === ancestor) {
return true;
} else {
return isAncestor2(ancestor, descendant.parent);
}
}
function intersects(node, other) {
return node === other || isAncestor2(node, other) || isAncestor2(other, node);
}
function asTreeEvent(e) {
return {
browserEvent: e.browserEvent,
elements: e.elements.map((e2) => e2.element)
};
}
function asTreeMouseEvent2(e) {
return {
browserEvent: e.browserEvent,
element: e.element && e.element.element,
target: e.target
};
}
function asAsyncDataTreeDragAndDropData(data) {
if (data instanceof ElementsDragAndDropData) {
return new AsyncDataTreeElementsDragAndDropData(data);
}
return data;
}
function asObjectTreeOptions2(options2) {
return options2 && __spreadProps(__spreadValues({}, options2), {
collapseByDefault: true,
identityProvider: options2.identityProvider && {
getId(el) {
return options2.identityProvider.getId(el.element);
}
},
dnd: options2.dnd && new AsyncDataTreeNodeListDragAndDrop(options2.dnd),
multipleSelectionController: options2.multipleSelectionController && {
isSelectionSingleChangeEvent(e) {
return options2.multipleSelectionController.isSelectionSingleChangeEvent(__spreadProps(__spreadValues({}, e), { element: e.element }));
},
isSelectionRangeChangeEvent(e) {
return options2.multipleSelectionController.isSelectionRangeChangeEvent(__spreadProps(__spreadValues({}, e), { element: e.element }));
}
},
accessibilityProvider: options2.accessibilityProvider && __spreadProps(__spreadValues({}, options2.accessibilityProvider), {
getPosInSet: void 0,
getSetSize: void 0,
getRole: options2.accessibilityProvider.getRole ? (el) => {
return options2.accessibilityProvider.getRole(el.element);
} : () => "treeitem",
isChecked: options2.accessibilityProvider.isChecked ? (e) => {
var _a10;
return !!((_a10 = options2.accessibilityProvider) === null || _a10 === void 0 ? void 0 : _a10.isChecked(e.element));
} : void 0,
getAriaLabel(e) {
return options2.accessibilityProvider.getAriaLabel(e.element);
},
getWidgetAriaLabel() {
return options2.accessibilityProvider.getWidgetAriaLabel();
},
getWidgetRole: options2.accessibilityProvider.getWidgetRole ? () => options2.accessibilityProvider.getWidgetRole() : () => "tree",
getAriaLevel: options2.accessibilityProvider.getAriaLevel && ((node) => {
return options2.accessibilityProvider.getAriaLevel(node.element);
}),
getActiveDescendantId: options2.accessibilityProvider.getActiveDescendantId && ((node) => {
return options2.accessibilityProvider.getActiveDescendantId(node.element);
})
}),
filter: options2.filter && {
filter(e, parentVisibility) {
return options2.filter.filter(e.element, parentVisibility);
}
},
keyboardNavigationLabelProvider: options2.keyboardNavigationLabelProvider && __spreadProps(__spreadValues({}, options2.keyboardNavigationLabelProvider), {
getKeyboardNavigationLabel(e) {
return options2.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element);
}
}),
sorter: void 0,
expandOnlyOnTwistieClick: typeof options2.expandOnlyOnTwistieClick === "undefined" ? void 0 : typeof options2.expandOnlyOnTwistieClick !== "function" ? options2.expandOnlyOnTwistieClick : (e) => options2.expandOnlyOnTwistieClick(e.element),
defaultFindVisibility: (e) => {
if (e.hasChildren && e.stale) {
return 1;
} else if (typeof options2.defaultFindVisibility === "number") {
return options2.defaultFindVisibility;
} else if (typeof options2.defaultFindVisibility === "undefined") {
return 2;
} else {
return options2.defaultFindVisibility(e.element);
}
}
});
}
function dfs2(node, fn) {
fn(node);
node.children.forEach((child) => dfs2(child, fn));
}
function asCompressibleObjectTreeOptions(options2) {
const objectTreeOptions = options2 && asObjectTreeOptions2(options2);
return objectTreeOptions && __spreadProps(__spreadValues({}, objectTreeOptions), {
keyboardNavigationLabelProvider: objectTreeOptions.keyboardNavigationLabelProvider && __spreadProps(__spreadValues({}, objectTreeOptions.keyboardNavigationLabelProvider), {
getCompressedNodeKeyboardNavigationLabel(els) {
return options2.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(els.map((e) => e.element));
}
})
});
}
function getVisibility(filterResult) {
if (typeof filterResult === "boolean") {
return filterResult ? 1 : 0;
} else if (isFilterResult(filterResult)) {
return getVisibleState(filterResult.visibility);
} else {
return getVisibleState(filterResult);
}
}
var AsyncDataTreeNodeWrapper, AsyncDataTreeRenderer, AsyncDataTreeElementsDragAndDropData, AsyncDataTreeNodeListDragAndDrop, AsyncDataTree, CompressibleAsyncDataTreeNodeWrapper, CompressibleAsyncDataTreeRenderer, CompressibleAsyncDataTree;
var init_asyncDataTree = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js"() {
init_listView();
init_abstractTree();
init_indexTreeModel();
init_objectTree();
init_tree();
init_async();
init_codicons();
init_themables();
init_errors();
init_event();
init_iterator();
init_lifecycle();
init_types();
AsyncDataTreeNodeWrapper = class _AsyncDataTreeNodeWrapper {
get element() {
return this.node.element.element;
}
get children() {
return this.node.children.map((node) => new _AsyncDataTreeNodeWrapper(node));
}
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(node) {
this.node = node;
}
};
AsyncDataTreeRenderer = class {
constructor(renderer, nodeMapper, onDidChangeTwistieState) {
this.renderer = renderer;
this.nodeMapper = nodeMapper;
this.onDidChangeTwistieState = onDidChangeTwistieState;
this.renderedNodes = /* @__PURE__ */ new Map();
this.templateId = renderer.templateId;
}
renderTemplate(container) {
const templateData = this.renderer.renderTemplate(container);
return { templateData };
}
renderElement(node, index, templateData, height) {
this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height);
}
renderTwistie(element, twistieElement) {
if (element.slow) {
twistieElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading));
return true;
} else {
twistieElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading));
return false;
}
}
disposeElement(node, index, templateData, height) {
var _a10, _b4;
(_b4 = (_a10 = this.renderer).disposeElement) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this.nodeMapper.map(node), index, templateData.templateData, height);
}
disposeTemplate(templateData) {
this.renderer.disposeTemplate(templateData.templateData);
}
dispose() {
this.renderedNodes.clear();
}
};
AsyncDataTreeElementsDragAndDropData = class extends ElementsDragAndDropData {
constructor(data) {
super(data.elements.map((node) => node.element));
this.data = data;
}
};
AsyncDataTreeNodeListDragAndDrop = class {
constructor(dnd) {
this.dnd = dnd;
}
getDragURI(node) {
return this.dnd.getDragURI(node.element);
}
getDragLabel(nodes, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(nodes.map((node) => node.element), originalEvent);
}
return void 0;
}
onDragStart(data, originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragStart) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, asAsyncDataTreeDragAndDropData(data), originalEvent);
}
onDragOver(data, targetNode, targetIndex, targetSector, originalEvent, raw = true) {
return this.dnd.onDragOver(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
}
drop(data, targetNode, targetIndex, targetSector, originalEvent) {
this.dnd.drop(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, targetSector, originalEvent);
}
onDragEnd(originalEvent) {
var _a10, _b4;
(_b4 = (_a10 = this.dnd).onDragEnd) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, originalEvent);
}
dispose() {
this.dnd.dispose();
}
};
AsyncDataTree = class {
get onDidScroll() {
return this.tree.onDidScroll;
}
get onDidChangeFocus() {
return Event.map(this.tree.onDidChangeFocus, asTreeEvent);
}
get onDidChangeSelection() {
return Event.map(this.tree.onDidChangeSelection, asTreeEvent);
}
get onMouseDblClick() {
return Event.map(this.tree.onMouseDblClick, asTreeMouseEvent2);
}
get onPointer() {
return Event.map(this.tree.onPointer, asTreeMouseEvent2);
}
get onDidFocus() {
return this.tree.onDidFocus;
}
/**
* To be used internally only!
* @deprecated
*/
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(user, container, delegate, renderers, dataSource, options2 = {}) {
this.user = user;
this.dataSource = dataSource;
this.nodes = /* @__PURE__ */ new Map();
this.subTreeRefreshPromises = /* @__PURE__ */ new Map();
this.refreshPromises = /* @__PURE__ */ new Map();
this._onDidRender = new Emitter();
this._onDidChangeNodeSlowState = new Emitter();
this.nodeMapper = new WeakMapper((node) => new AsyncDataTreeNodeWrapper(node));
this.disposables = new DisposableStore();
this.identityProvider = options2.identityProvider;
this.autoExpandSingleChildren = typeof options2.autoExpandSingleChildren === "undefined" ? false : options2.autoExpandSingleChildren;
this.sorter = options2.sorter;
this.getDefaultCollapseState = (e) => options2.collapseByDefault ? options2.collapseByDefault(e) ? ObjectTreeElementCollapseState.PreserveOrCollapsed : ObjectTreeElementCollapseState.PreserveOrExpanded : void 0;
this.tree = this.createTree(user, container, delegate, renderers, options2);
this.onDidChangeFindMode = this.tree.onDidChangeFindMode;
this.onDidChangeFindMatchType = this.tree.onDidChangeFindMatchType;
this.root = createAsyncDataTreeNode({
element: void 0,
parent: null,
hasChildren: true,
defaultCollapseState: void 0
});
if (this.identityProvider) {
this.root = __spreadProps(__spreadValues({}, this.root), {
id: null
});
}
this.nodes.set(null, this.root);
this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState, this, this.disposables);
}
createTree(user, container, delegate, renderers, options2) {
const objectTreeDelegate = new ComposedTreeDelegate(delegate);
const objectTreeRenderers = renderers.map((r) => new AsyncDataTreeRenderer(r, this.nodeMapper, this._onDidChangeNodeSlowState.event));
const objectTreeOptions = asObjectTreeOptions2(options2) || {};
return new ObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
}
updateOptions(options2 = {}) {
this.tree.updateOptions(options2);
}
// Widget
getHTMLElement() {
return this.tree.getHTMLElement();
}
get scrollTop() {
return this.tree.scrollTop;
}
set scrollTop(scrollTop) {
this.tree.scrollTop = scrollTop;
}
get scrollHeight() {
return this.tree.scrollHeight;
}
get renderHeight() {
return this.tree.renderHeight;
}
domFocus() {
this.tree.domFocus();
}
layout(height, width2) {
this.tree.layout(height, width2);
}
style(styles) {
this.tree.style(styles);
}
// Model
getInput() {
return this.root.element;
}
setInput(input, viewState) {
return __async(this, null, function* () {
this.refreshPromises.forEach((promise) => promise.cancel());
this.refreshPromises.clear();
this.root.element = input;
const viewStateContext = viewState && { viewState, focus: [], selection: [] };
yield this._updateChildren(input, true, false, viewStateContext);
if (viewStateContext) {
this.tree.setFocus(viewStateContext.focus);
this.tree.setSelection(viewStateContext.selection);
}
if (viewState && typeof viewState.scrollTop === "number") {
this.scrollTop = viewState.scrollTop;
}
});
}
_updateChildren() {
return __async(this, arguments, function* (element = this.root.element, recursive = true, rerender = false, viewStateContext, options2) {
if (typeof this.root.element === "undefined") {
throw new TreeError(this.user, "Tree input not set");
}
if (this.root.refreshPromise) {
yield this.root.refreshPromise;
yield Event.toPromise(this._onDidRender.event);
}
const node = this.getDataNode(element);
yield this.refreshAndRenderNode(node, recursive, viewStateContext, options2);
if (rerender) {
try {
this.tree.rerender(node);
} catch (_a10) {
}
}
});
}
// View
rerender(element) {
if (element === void 0 || element === this.root.element) {
this.tree.rerender();
return;
}
const node = this.getDataNode(element);
this.tree.rerender(node);
}
// Tree
getNode(element = this.root.element) {
const dataNode = this.getDataNode(element);
const node = this.tree.getNode(dataNode === this.root ? null : dataNode);
return this.nodeMapper.map(node);
}
collapse(element, recursive = false) {
const node = this.getDataNode(element);
return this.tree.collapse(node === this.root ? null : node, recursive);
}
expand(element, recursive = false) {
return __async(this, null, function* () {
if (typeof this.root.element === "undefined") {
throw new TreeError(this.user, "Tree input not set");
}
if (this.root.refreshPromise) {
yield this.root.refreshPromise;
yield Event.toPromise(this._onDidRender.event);
}
const node = this.getDataNode(element);
if (this.tree.hasElement(node) && !this.tree.isCollapsible(node)) {
return false;
}
if (node.refreshPromise) {
yield this.root.refreshPromise;
yield Event.toPromise(this._onDidRender.event);
}
if (node !== this.root && !node.refreshPromise && !this.tree.isCollapsed(node)) {
return false;
}
const result = this.tree.expand(node === this.root ? null : node, recursive);
if (node.refreshPromise) {
yield this.root.refreshPromise;
yield Event.toPromise(this._onDidRender.event);
}
return result;
});
}
setSelection(elements, browserEvent) {
const nodes = elements.map((e) => this.getDataNode(e));
this.tree.setSelection(nodes, browserEvent);
}
getSelection() {
const nodes = this.tree.getSelection();
return nodes.map((n) => n.element);
}
setFocus(elements, browserEvent) {
const nodes = elements.map((e) => this.getDataNode(e));
this.tree.setFocus(nodes, browserEvent);
}
getFocus() {
const nodes = this.tree.getFocus();
return nodes.map((n) => n.element);
}
reveal(element, relativeTop) {
this.tree.reveal(this.getDataNode(element), relativeTop);
}
// Tree navigation
getParentElement(element) {
const node = this.tree.getParentElement(this.getDataNode(element));
return node && node.element;
}
getFirstElementChild(element = this.root.element) {
const dataNode = this.getDataNode(element);
const node = this.tree.getFirstElementChild(dataNode === this.root ? null : dataNode);
return node && node.element;
}
// Implementation
getDataNode(element) {
const node = this.nodes.get(element === this.root.element ? null : element);
if (!node) {
throw new TreeError(this.user, `Data tree node not found: ${element}`);
}
return node;
}
refreshAndRenderNode(node, recursive, viewStateContext, options2) {
return __async(this, null, function* () {
yield this.refreshNode(node, recursive, viewStateContext);
if (this.disposables.isDisposed) {
return;
}
this.render(node, viewStateContext, options2);
});
}
refreshNode(node, recursive, viewStateContext) {
return __async(this, null, function* () {
let result;
this.subTreeRefreshPromises.forEach((refreshPromise, refreshNode) => {
if (!result && intersects(refreshNode, node)) {
result = refreshPromise.then(() => this.refreshNode(node, recursive, viewStateContext));
}
});
if (result) {
return result;
}
if (node !== this.root) {
const treeNode = this.tree.getNode(node);
if (treeNode.collapsed) {
node.hasChildren = !!this.dataSource.hasChildren(node.element);
node.stale = true;
this.setChildren(node, [], recursive, viewStateContext);
return;
}
}
return this.doRefreshSubTree(node, recursive, viewStateContext);
});
}
doRefreshSubTree(node, recursive, viewStateContext) {
return __async(this, null, function* () {
let done;
node.refreshPromise = new Promise((c) => done = c);
this.subTreeRefreshPromises.set(node, node.refreshPromise);
node.refreshPromise.finally(() => {
node.refreshPromise = void 0;
this.subTreeRefreshPromises.delete(node);
});
try {
const childrenToRefresh = yield this.doRefreshNode(node, recursive, viewStateContext);
node.stale = false;
yield Promises.settled(childrenToRefresh.map((child) => this.doRefreshSubTree(child, recursive, viewStateContext)));
} finally {
done();
}
});
}
doRefreshNode(node, recursive, viewStateContext) {
return __async(this, null, function* () {
node.hasChildren = !!this.dataSource.hasChildren(node.element);
let childrenPromise;
if (!node.hasChildren) {
childrenPromise = Promise.resolve(Iterable.empty());
} else {
const children = this.doGetChildren(node);
if (isIterable(children)) {
childrenPromise = Promise.resolve(children);
} else {
const slowTimeout = timeout(800);
slowTimeout.then(() => {
node.slow = true;
this._onDidChangeNodeSlowState.fire(node);
}, (_) => null);
childrenPromise = children.finally(() => slowTimeout.cancel());
}
}
try {
const children = yield childrenPromise;
return this.setChildren(node, children, recursive, viewStateContext);
} catch (err) {
if (node !== this.root && this.tree.hasElement(node)) {
this.tree.collapse(node);
}
if (isCancellationError(err)) {
return [];
}
throw err;
} finally {
if (node.slow) {
node.slow = false;
this._onDidChangeNodeSlowState.fire(node);
}
}
});
}
doGetChildren(node) {
let result = this.refreshPromises.get(node);
if (result) {
return result;
}
const children = this.dataSource.getChildren(node.element);
if (isIterable(children)) {
return this.processChildren(children);
} else {
result = createCancelablePromise(() => __async(this, null, function* () {
return this.processChildren(yield children);
}));
this.refreshPromises.set(node, result);
return result.finally(() => {
this.refreshPromises.delete(node);
});
}
}
_onDidChangeCollapseState({ node, deep }) {
if (node.element === null) {
return;
}
if (!node.collapsed && node.element.stale) {
if (deep) {
this.collapse(node.element.element);
} else {
this.refreshAndRenderNode(node.element, false).catch(onUnexpectedError);
}
}
}
setChildren(node, childrenElementsIterable, recursive, viewStateContext) {
const childrenElements = [...childrenElementsIterable];
if (node.children.length === 0 && childrenElements.length === 0) {
return [];
}
const nodesToForget = /* @__PURE__ */ new Map();
const childrenTreeNodesById = /* @__PURE__ */ new Map();
for (const child of node.children) {
nodesToForget.set(child.element, child);
if (this.identityProvider) {
childrenTreeNodesById.set(child.id, { node: child, collapsed: this.tree.hasElement(child) && this.tree.isCollapsed(child) });
}
}
const childrenToRefresh = [];
const children = childrenElements.map((element) => {
const hasChildren = !!this.dataSource.hasChildren(element);
if (!this.identityProvider) {
const asyncDataTreeNode = createAsyncDataTreeNode({ element, parent: node, hasChildren, defaultCollapseState: this.getDefaultCollapseState(element) });
if (hasChildren && asyncDataTreeNode.defaultCollapseState === ObjectTreeElementCollapseState.PreserveOrExpanded) {
childrenToRefresh.push(asyncDataTreeNode);
}
return asyncDataTreeNode;
}
const id = this.identityProvider.getId(element).toString();
const result = childrenTreeNodesById.get(id);
if (result) {
const asyncDataTreeNode = result.node;
nodesToForget.delete(asyncDataTreeNode.element);
this.nodes.delete(asyncDataTreeNode.element);
this.nodes.set(element, asyncDataTreeNode);
asyncDataTreeNode.element = element;
asyncDataTreeNode.hasChildren = hasChildren;
if (recursive) {
if (result.collapsed) {
asyncDataTreeNode.children.forEach((node2) => dfs2(node2, (node3) => this.nodes.delete(node3.element)));
asyncDataTreeNode.children.splice(0, asyncDataTreeNode.children.length);
asyncDataTreeNode.stale = true;
} else {
childrenToRefresh.push(asyncDataTreeNode);
}
} else if (hasChildren && !result.collapsed) {
childrenToRefresh.push(asyncDataTreeNode);
}
return asyncDataTreeNode;
}
const childAsyncDataTreeNode = createAsyncDataTreeNode({ element, parent: node, id, hasChildren, defaultCollapseState: this.getDefaultCollapseState(element) });
if (viewStateContext && viewStateContext.viewState.focus && viewStateContext.viewState.focus.indexOf(id) > -1) {
viewStateContext.focus.push(childAsyncDataTreeNode);
}
if (viewStateContext && viewStateContext.viewState.selection && viewStateContext.viewState.selection.indexOf(id) > -1) {
viewStateContext.selection.push(childAsyncDataTreeNode);
}
if (viewStateContext && viewStateContext.viewState.expanded && viewStateContext.viewState.expanded.indexOf(id) > -1) {
childrenToRefresh.push(childAsyncDataTreeNode);
} else if (hasChildren && childAsyncDataTreeNode.defaultCollapseState === ObjectTreeElementCollapseState.PreserveOrExpanded) {
childrenToRefresh.push(childAsyncDataTreeNode);
}
return childAsyncDataTreeNode;
});
for (const node2 of nodesToForget.values()) {
dfs2(node2, (node3) => this.nodes.delete(node3.element));
}
for (const child of children) {
this.nodes.set(child.element, child);
}
node.children.splice(0, node.children.length, ...children);
if (node !== this.root && this.autoExpandSingleChildren && children.length === 1 && childrenToRefresh.length === 0) {
children[0].forceExpanded = true;
childrenToRefresh.push(children[0]);
}
return childrenToRefresh;
}
render(node, viewStateContext, options2) {
const children = node.children.map((node2) => this.asTreeElement(node2, viewStateContext));
const objectTreeOptions = options2 && __spreadProps(__spreadValues({}, options2), {
diffIdentityProvider: options2.diffIdentityProvider && {
getId(node2) {
return options2.diffIdentityProvider.getId(node2.element);
}
}
});
this.tree.setChildren(node === this.root ? null : node, children, objectTreeOptions);
if (node !== this.root) {
this.tree.setCollapsible(node, node.hasChildren);
}
this._onDidRender.fire();
}
asTreeElement(node, viewStateContext) {
if (node.stale) {
return {
element: node,
collapsible: node.hasChildren,
collapsed: true
};
}
let collapsed2;
if (viewStateContext && viewStateContext.viewState.expanded && node.id && viewStateContext.viewState.expanded.indexOf(node.id) > -1) {
collapsed2 = false;
} else if (node.forceExpanded) {
collapsed2 = false;
node.forceExpanded = false;
} else {
collapsed2 = node.defaultCollapseState;
}
return {
element: node,
children: node.hasChildren ? Iterable.map(node.children, (child) => this.asTreeElement(child, viewStateContext)) : [],
collapsible: node.hasChildren,
collapsed: collapsed2
};
}
processChildren(children) {
if (this.sorter) {
children = [...children].sort(this.sorter.compare.bind(this.sorter));
}
return children;
}
dispose() {
this.disposables.dispose();
this.tree.dispose();
}
};
CompressibleAsyncDataTreeNodeWrapper = class _CompressibleAsyncDataTreeNodeWrapper {
get element() {
return {
elements: this.node.element.elements.map((e) => e.element),
incompressible: this.node.element.incompressible
};
}
get children() {
return this.node.children.map((node) => new _CompressibleAsyncDataTreeNodeWrapper(node));
}
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(node) {
this.node = node;
}
};
CompressibleAsyncDataTreeRenderer = class {
constructor(renderer, nodeMapper, compressibleNodeMapperProvider, onDidChangeTwistieState) {
this.renderer = renderer;
this.nodeMapper = nodeMapper;
this.compressibleNodeMapperProvider = compressibleNodeMapperProvider;
this.onDidChangeTwistieState = onDidChangeTwistieState;
this.renderedNodes = /* @__PURE__ */ new Map();
this.disposables = [];
this.templateId = renderer.templateId;
}
renderTemplate(container) {
const templateData = this.renderer.renderTemplate(container);
return { templateData };
}
renderElement(node, index, templateData, height) {
this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height);
}
renderCompressedElements(node, index, templateData, height) {
this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height);
}
renderTwistie(element, twistieElement) {
if (element.slow) {
twistieElement.classList.add(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading));
return true;
} else {
twistieElement.classList.remove(...ThemeIcon.asClassNameArray(Codicon.treeItemLoading));
return false;
}
}
disposeElement(node, index, templateData, height) {
var _a10, _b4;
(_b4 = (_a10 = this.renderer).disposeElement) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this.nodeMapper.map(node), index, templateData.templateData, height);
}
disposeCompressedElements(node, index, templateData, height) {
var _a10, _b4;
(_b4 = (_a10 = this.renderer).disposeCompressedElements) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height);
}
disposeTemplate(templateData) {
this.renderer.disposeTemplate(templateData.templateData);
}
dispose() {
this.renderedNodes.clear();
this.disposables = dispose(this.disposables);
}
};
CompressibleAsyncDataTree = class extends AsyncDataTree {
constructor(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, options2 = {}) {
super(user, container, virtualDelegate, renderers, dataSource, options2);
this.compressionDelegate = compressionDelegate;
this.compressibleNodeMapper = new WeakMapper((node) => new CompressibleAsyncDataTreeNodeWrapper(node));
this.filter = options2.filter;
}
createTree(user, container, delegate, renderers, options2) {
const objectTreeDelegate = new ComposedTreeDelegate(delegate);
const objectTreeRenderers = renderers.map((r) => new CompressibleAsyncDataTreeRenderer(r, this.nodeMapper, () => this.compressibleNodeMapper, this._onDidChangeNodeSlowState.event));
const objectTreeOptions = asCompressibleObjectTreeOptions(options2) || {};
return new CompressibleObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
}
asTreeElement(node, viewStateContext) {
return __spreadValues({
incompressible: this.compressionDelegate.isIncompressible(node.element)
}, super.asTreeElement(node, viewStateContext));
}
updateOptions(options2 = {}) {
this.tree.updateOptions(options2);
}
render(node, viewStateContext, options2) {
if (!this.identityProvider) {
return super.render(node, viewStateContext);
}
const getId = (element) => this.identityProvider.getId(element).toString();
const getUncompressedIds = (nodes) => {
const result = /* @__PURE__ */ new Set();
for (const node2 of nodes) {
const compressedNode = this.tree.getCompressedTreeNode(node2 === this.root ? null : node2);
if (!compressedNode.element) {
continue;
}
for (const node3 of compressedNode.element.elements) {
result.add(getId(node3.element));
}
}
return result;
};
const oldSelection = getUncompressedIds(this.tree.getSelection());
const oldFocus = getUncompressedIds(this.tree.getFocus());
super.render(node, viewStateContext, options2);
const selection = this.getSelection();
let didChangeSelection = false;
const focus = this.getFocus();
let didChangeFocus = false;
const visit2 = (node2) => {
const compressedNode = node2.element;
if (compressedNode) {
for (let i = 0; i < compressedNode.elements.length; i++) {
const id = getId(compressedNode.elements[i].element);
const element = compressedNode.elements[compressedNode.elements.length - 1].element;
if (oldSelection.has(id) && selection.indexOf(element) === -1) {
selection.push(element);
didChangeSelection = true;
}
if (oldFocus.has(id) && focus.indexOf(element) === -1) {
focus.push(element);
didChangeFocus = true;
}
}
}
node2.children.forEach(visit2);
};
visit2(this.tree.getCompressedTreeNode(node === this.root ? null : node));
if (didChangeSelection) {
this.setSelection(selection);
}
if (didChangeFocus) {
this.setFocus(focus);
}
}
// For compressed async data trees, `TreeVisibility.Recurse` doesn't currently work
// and we have to filter everything beforehand
// Related to #85193 and #85835
processChildren(children) {
if (this.filter) {
children = Iterable.filter(children, (e) => {
const result = this.filter.filter(
e,
1
/* TreeVisibility.Visible */
);
const visibility = getVisibility(result);
if (visibility === 2) {
throw new Error("Recursive tree visibility not supported in async data compressed trees");
}
return visibility === 1;
});
}
return super.processChildren(children);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js
var DataTree;
var init_dataTree = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js"() {
init_abstractTree();
init_objectTreeModel();
DataTree = class extends AbstractTree {
constructor(user, container, delegate, renderers, dataSource, options2 = {}) {
super(user, container, delegate, renderers, options2);
this.user = user;
this.dataSource = dataSource;
this.identityProvider = options2.identityProvider;
}
createModel(user, view, options2) {
return new ObjectTreeModel(user, view, options2);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js
var IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsIOSContext, IsMobileContext, IsDevelopmentContext, ProductQualityContext, InputFocusedContextKey, InputFocusedContext;
var init_contextkeys = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js"() {
init_platform();
init_nls();
init_contextkey();
IsMacContext = new RawContextKey("isMac", isMacintosh, localize("isMac", "Whether the operating system is macOS"));
IsLinuxContext = new RawContextKey("isLinux", isLinux, localize("isLinux", "Whether the operating system is Linux"));
IsWindowsContext = new RawContextKey("isWindows", isWindows, localize("isWindows", "Whether the operating system is Windows"));
IsWebContext = new RawContextKey("isWeb", isWeb, localize("isWeb", "Whether the platform is a web browser"));
IsMacNativeContext = new RawContextKey("isMacNative", isMacintosh && !isWeb, localize("isMacNative", "Whether the operating system is macOS on a non-browser platform"));
IsIOSContext = new RawContextKey("isIOS", isIOS, localize("isIOS", "Whether the operating system is iOS"));
IsMobileContext = new RawContextKey("isMobile", isMobile, localize("isMobile", "Whether the platform is a mobile web browser"));
IsDevelopmentContext = new RawContextKey("isDevelopment", false, true);
ProductQualityContext = new RawContextKey("productQualityType", "", localize("productQualityType", "Quality type of VS Code"));
InputFocusedContextKey = "inputFocus";
InputFocusedContext = new RawContextKey(InputFocusedContextKey, false, localize("inputFocus", "Whether keyboard focus is inside an input box"));
}
});
// node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js
function createScopedContextKeyService(contextKeyService, widget) {
const result = contextKeyService.createScoped(widget.getHTMLElement());
RawWorkbenchListFocusContextKey.bindTo(result);
return result;
}
function createScrollObserver(contextKeyService, widget) {
const listScrollAt = RawWorkbenchListScrollAtBoundaryContextKey.bindTo(contextKeyService);
const update = () => {
const atTop = widget.scrollTop === 0;
const atBottom = widget.scrollHeight - widget.renderHeight - widget.scrollTop < 1;
if (atTop && atBottom) {
listScrollAt.set("both");
} else if (atTop) {
listScrollAt.set("top");
} else if (atBottom) {
listScrollAt.set("bottom");
} else {
listScrollAt.set("none");
}
};
update();
return widget.onDidScroll(update);
}
function useAltAsMultipleSelectionModifier(configurationService) {
return configurationService.getValue(multiSelectModifierSettingKey) === "alt";
}
function toWorkbenchListOptions(accessor, options2) {
var _a10;
const configurationService = accessor.get(IConfigurationService);
const keybindingService = accessor.get(IKeybindingService);
const disposables = new DisposableStore();
const result = __spreadProps(__spreadValues({}, options2), {
keyboardNavigationDelegate: { mightProducePrintableCharacter(e) {
return keybindingService.mightProducePrintableCharacter(e);
} },
smoothScrolling: Boolean(configurationService.getValue(listSmoothScrolling)),
mouseWheelScrollSensitivity: configurationService.getValue(mouseWheelScrollSensitivityKey),
fastScrollSensitivity: configurationService.getValue(fastScrollSensitivityKey),
multipleSelectionController: (_a10 = options2.multipleSelectionController) !== null && _a10 !== void 0 ? _a10 : disposables.add(new MultipleSelectionController(configurationService)),
keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(keybindingService),
scrollByPage: Boolean(configurationService.getValue(scrollByPageKey))
});
return [result, disposables];
}
function createKeyboardNavigationEventFilter(keybindingService) {
let inMultiChord = false;
return (event) => {
if (event.toKeyCodeChord().isModifierKey()) {
return false;
}
if (inMultiChord) {
inMultiChord = false;
return false;
}
const result = keybindingService.softDispatch(event, event.target);
if (result.kind === 1) {
inMultiChord = true;
return false;
}
inMultiChord = false;
return result.kind === 0;
};
}
function getDefaultTreeFindMode(configurationService) {
const value = configurationService.getValue(defaultFindModeSettingKey);
if (value === "highlight") {
return TreeFindMode.Highlight;
} else if (value === "filter") {
return TreeFindMode.Filter;
}
const deprecatedValue = configurationService.getValue(keyboardNavigationSettingKey);
if (deprecatedValue === "simple" || deprecatedValue === "highlight") {
return TreeFindMode.Highlight;
} else if (deprecatedValue === "filter") {
return TreeFindMode.Filter;
}
return void 0;
}
function getDefaultTreeFindMatchType(configurationService) {
const value = configurationService.getValue(defaultFindMatchTypeSettingKey);
if (value === "fuzzy") {
return TreeFindMatchType.Fuzzy;
} else if (value === "contiguous") {
return TreeFindMatchType.Contiguous;
}
return void 0;
}
function workbenchTreeDataPreamble(accessor, options2) {
var _a10;
const configurationService = accessor.get(IConfigurationService);
const contextViewService = accessor.get(IContextViewService);
const contextKeyService = accessor.get(IContextKeyService);
const instantiationService = accessor.get(IInstantiationService);
const getTypeNavigationMode = () => {
const modeString = contextKeyService.getContextKeyValue(WorkbenchListTypeNavigationModeKey);
if (modeString === "automatic") {
return TypeNavigationMode.Automatic;
} else if (modeString === "trigger") {
return TypeNavigationMode.Trigger;
}
const modeBoolean = contextKeyService.getContextKeyValue(WorkbenchListAutomaticKeyboardNavigationLegacyKey);
if (modeBoolean === false) {
return TypeNavigationMode.Trigger;
}
const configString = configurationService.getValue(typeNavigationModeSettingKey);
if (configString === "automatic") {
return TypeNavigationMode.Automatic;
} else if (configString === "trigger") {
return TypeNavigationMode.Trigger;
}
return void 0;
};
const horizontalScrolling = options2.horizontalScrolling !== void 0 ? options2.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey));
const [workbenchListOptions, disposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options2);
const paddingBottom = options2.paddingBottom;
const renderIndentGuides = options2.renderIndentGuides !== void 0 ? options2.renderIndentGuides : configurationService.getValue(treeRenderIndentGuidesKey);
return {
getTypeNavigationMode,
disposable,
options: __spreadProps(__spreadValues({
// ...options, // TODO@Joao why is this not splatted here?
keyboardSupport: false
}, workbenchListOptions), {
indent: typeof configurationService.getValue(treeIndentKey) === "number" ? configurationService.getValue(treeIndentKey) : void 0,
renderIndentGuides,
smoothScrolling: Boolean(configurationService.getValue(listSmoothScrolling)),
defaultFindMode: getDefaultTreeFindMode(configurationService),
defaultFindMatchType: getDefaultTreeFindMatchType(configurationService),
horizontalScrolling,
scrollByPage: Boolean(configurationService.getValue(scrollByPageKey)),
paddingBottom,
hideTwistiesOfChildlessElements: options2.hideTwistiesOfChildlessElements,
expandOnlyOnTwistieClick: (_a10 = options2.expandOnlyOnTwistieClick) !== null && _a10 !== void 0 ? _a10 : configurationService.getValue(treeExpandMode) === "doubleClick",
contextViewProvider: contextViewService,
findWidgetStyles: defaultFindWidgetStyles,
enableStickyScroll: Boolean(configurationService.getValue(treeStickyScroll)),
stickyScrollMaxItemCount: Number(configurationService.getValue(treeStickyScrollMaxElements))
})
};
}
var __decorate38, __param32, IListService, ListService, RawWorkbenchListScrollAtBoundaryContextKey, WorkbenchListScrollAtTopContextKey, WorkbenchListScrollAtBottomContextKey, RawWorkbenchListFocusContextKey, WorkbenchTreeStickyScrollFocused, WorkbenchListSupportsMultiSelectContextKey, WorkbenchListFocusContextKey, WorkbenchListHasSelectionOrFocus, WorkbenchListDoubleSelection, WorkbenchListMultiSelection, WorkbenchListSelectionNavigation, WorkbenchListSupportsFind, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeElementCanExpand, WorkbenchTreeElementHasChild, WorkbenchTreeFindOpen, WorkbenchListTypeNavigationModeKey, WorkbenchListAutomaticKeyboardNavigationLegacyKey, multiSelectModifierSettingKey, openModeSettingKey, horizontalScrollingKey, defaultFindModeSettingKey, typeNavigationModeSettingKey, keyboardNavigationSettingKey, scrollByPageKey, defaultFindMatchTypeSettingKey, treeIndentKey, treeRenderIndentGuidesKey, listSmoothScrolling, mouseWheelScrollSensitivityKey, fastScrollSensitivityKey, treeExpandMode, treeStickyScroll, treeStickyScrollMaxElements, MultipleSelectionController, WorkbenchList, WorkbenchPagedList, WorkbenchTable, ResourceNavigator, ListResourceNavigator, TableResourceNavigator, TreeResourceNavigator, WorkbenchObjectTree, WorkbenchCompressibleObjectTree, WorkbenchDataTree, WorkbenchAsyncDataTree, WorkbenchCompressibleAsyncDataTree, WorkbenchTreeInternals, configurationRegistry3;
var init_listService = __esm({
"node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js"() {
init_dom();
init_listPaging();
init_listWidget();
init_tableWidget();
init_abstractTree();
init_asyncDataTree();
init_dataTree();
init_objectTree();
init_event();
init_lifecycle();
init_nls();
init_configuration();
init_configurationRegistry();
init_contextkey();
init_contextkeys();
init_contextView();
init_instantiation();
init_keybinding();
init_platform2();
init_defaultStyles();
__decorate38 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param32 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
IListService = createDecorator("listService");
ListService = class {
get lastFocusedList() {
return this._lastFocusedWidget;
}
constructor() {
this.disposables = new DisposableStore();
this.lists = [];
this._lastFocusedWidget = void 0;
this._hasCreatedStyleController = false;
}
setLastFocusedList(widget) {
var _a10, _b4;
if (widget === this._lastFocusedWidget) {
return;
}
(_a10 = this._lastFocusedWidget) === null || _a10 === void 0 ? void 0 : _a10.getHTMLElement().classList.remove("last-focused");
this._lastFocusedWidget = widget;
(_b4 = this._lastFocusedWidget) === null || _b4 === void 0 ? void 0 : _b4.getHTMLElement().classList.add("last-focused");
}
register(widget, extraContextKeys) {
if (!this._hasCreatedStyleController) {
this._hasCreatedStyleController = true;
const styleController = new DefaultStyleController(createStyleSheet(), "");
styleController.style(defaultListStyles);
}
if (this.lists.some((l) => l.widget === widget)) {
throw new Error("Cannot register the same widget multiple times");
}
const registeredList = { widget, extraContextKeys };
this.lists.push(registeredList);
if (isActiveElement(widget.getHTMLElement())) {
this.setLastFocusedList(widget);
}
return combinedDisposable(widget.onDidFocus(() => this.setLastFocusedList(widget)), toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1)), widget.onDidDispose(() => {
this.lists = this.lists.filter((l) => l !== registeredList);
if (this._lastFocusedWidget === widget) {
this.setLastFocusedList(void 0);
}
}));
}
dispose() {
this.disposables.dispose();
}
};
RawWorkbenchListScrollAtBoundaryContextKey = new RawContextKey("listScrollAtBoundary", "none");
WorkbenchListScrollAtTopContextKey = ContextKeyExpr.or(RawWorkbenchListScrollAtBoundaryContextKey.isEqualTo("top"), RawWorkbenchListScrollAtBoundaryContextKey.isEqualTo("both"));
WorkbenchListScrollAtBottomContextKey = ContextKeyExpr.or(RawWorkbenchListScrollAtBoundaryContextKey.isEqualTo("bottom"), RawWorkbenchListScrollAtBoundaryContextKey.isEqualTo("both"));
RawWorkbenchListFocusContextKey = new RawContextKey("listFocus", true);
WorkbenchTreeStickyScrollFocused = new RawContextKey("treestickyScrollFocused", false);
WorkbenchListSupportsMultiSelectContextKey = new RawContextKey("listSupportsMultiselect", true);
WorkbenchListFocusContextKey = ContextKeyExpr.and(RawWorkbenchListFocusContextKey, ContextKeyExpr.not(InputFocusedContextKey), WorkbenchTreeStickyScrollFocused.negate());
WorkbenchListHasSelectionOrFocus = new RawContextKey("listHasSelectionOrFocus", false);
WorkbenchListDoubleSelection = new RawContextKey("listDoubleSelection", false);
WorkbenchListMultiSelection = new RawContextKey("listMultiSelection", false);
WorkbenchListSelectionNavigation = new RawContextKey("listSelectionNavigation", false);
WorkbenchListSupportsFind = new RawContextKey("listSupportsFind", true);
WorkbenchTreeElementCanCollapse = new RawContextKey("treeElementCanCollapse", false);
WorkbenchTreeElementHasParent = new RawContextKey("treeElementHasParent", false);
WorkbenchTreeElementCanExpand = new RawContextKey("treeElementCanExpand", false);
WorkbenchTreeElementHasChild = new RawContextKey("treeElementHasChild", false);
WorkbenchTreeFindOpen = new RawContextKey("treeFindOpen", false);
WorkbenchListTypeNavigationModeKey = "listTypeNavigationMode";
WorkbenchListAutomaticKeyboardNavigationLegacyKey = "listAutomaticKeyboardNavigation";
multiSelectModifierSettingKey = "workbench.list.multiSelectModifier";
openModeSettingKey = "workbench.list.openMode";
horizontalScrollingKey = "workbench.list.horizontalScrolling";
defaultFindModeSettingKey = "workbench.list.defaultFindMode";
typeNavigationModeSettingKey = "workbench.list.typeNavigationMode";
keyboardNavigationSettingKey = "workbench.list.keyboardNavigation";
scrollByPageKey = "workbench.list.scrollByPage";
defaultFindMatchTypeSettingKey = "workbench.list.defaultFindMatchType";
treeIndentKey = "workbench.tree.indent";
treeRenderIndentGuidesKey = "workbench.tree.renderIndentGuides";
listSmoothScrolling = "workbench.list.smoothScrolling";
mouseWheelScrollSensitivityKey = "workbench.list.mouseWheelScrollSensitivity";
fastScrollSensitivityKey = "workbench.list.fastScrollSensitivity";
treeExpandMode = "workbench.tree.expandMode";
treeStickyScroll = "workbench.tree.enableStickyScroll";
treeStickyScrollMaxElements = "workbench.tree.stickyScrollMaxItemCount";
MultipleSelectionController = class extends Disposable {
constructor(configurationService) {
super();
this.configurationService = configurationService;
this.useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
this.registerListeners();
}
registerListeners() {
this._register(this.configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this.useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(this.configurationService);
}
}));
}
isSelectionSingleChangeEvent(event) {
if (this.useAltAsMultipleSelectionModifier) {
return event.browserEvent.altKey;
}
return isSelectionSingleChangeEvent(event);
}
isSelectionRangeChangeEvent(event) {
return isSelectionRangeChangeEvent(event);
}
};
WorkbenchList = class WorkbenchList2 extends List {
constructor(user, container, delegate, renderers, options2, contextKeyService, listService, configurationService, instantiationService) {
const horizontalScrolling = typeof options2.horizontalScrolling !== "undefined" ? options2.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey));
const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options2);
super(user, container, delegate, renderers, __spreadProps(__spreadValues({
keyboardSupport: false
}, workbenchListOptions), {
horizontalScrolling
}));
this.disposables.add(workbenchListOptionsDisposable);
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.disposables.add(createScrollObserver(this.contextKeyService, this));
this.listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
this.listSupportsMultiSelect.set(options2.multipleSelectionSupport !== false);
const listSelectionNavigation = WorkbenchListSelectionNavigation.bindTo(this.contextKeyService);
listSelectionNavigation.set(Boolean(options2.selectionNavigation));
this.listHasSelectionOrFocus = WorkbenchListHasSelectionOrFocus.bindTo(this.contextKeyService);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.listMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this.horizontalScrolling = options2.horizontalScrolling;
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
this.disposables.add(this.contextKeyService);
this.disposables.add(listService.register(this));
this.updateStyles(options2.overrideStyles);
this.disposables.add(this.onDidChangeSelection(() => {
const selection = this.getSelection();
const focus = this.getFocus();
this.contextKeyService.bufferChangeEvents(() => {
this.listHasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
this.listMultiSelection.set(selection.length > 1);
this.listDoubleSelection.set(selection.length === 2);
});
}));
this.disposables.add(this.onDidChangeFocus(() => {
const selection = this.getSelection();
const focus = this.getFocus();
this.listHasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
}));
this.disposables.add(configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
let options3 = {};
if (e.affectsConfiguration(horizontalScrollingKey) && this.horizontalScrolling === void 0) {
const horizontalScrolling2 = Boolean(configurationService.getValue(horizontalScrollingKey));
options3 = __spreadProps(__spreadValues({}, options3), { horizontalScrolling: horizontalScrolling2 });
}
if (e.affectsConfiguration(scrollByPageKey)) {
const scrollByPage = Boolean(configurationService.getValue(scrollByPageKey));
options3 = __spreadProps(__spreadValues({}, options3), { scrollByPage });
}
if (e.affectsConfiguration(listSmoothScrolling)) {
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
options3 = __spreadProps(__spreadValues({}, options3), { smoothScrolling });
}
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
const mouseWheelScrollSensitivity = configurationService.getValue(mouseWheelScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { mouseWheelScrollSensitivity });
}
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
const fastScrollSensitivity = configurationService.getValue(fastScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { fastScrollSensitivity });
}
if (Object.keys(options3).length > 0) {
this.updateOptions(options3);
}
}));
this.navigator = new ListResourceNavigator(this, __spreadValues({ configurationService }, options2));
this.disposables.add(this.navigator);
}
updateOptions(options2) {
super.updateOptions(options2);
if (options2.overrideStyles !== void 0) {
this.updateStyles(options2.overrideStyles);
}
if (options2.multipleSelectionSupport !== void 0) {
this.listSupportsMultiSelect.set(!!options2.multipleSelectionSupport);
}
}
updateStyles(styles) {
this.style(styles ? getListStyles(styles) : defaultListStyles);
}
};
WorkbenchList = __decorate38([
__param32(5, IContextKeyService),
__param32(6, IListService),
__param32(7, IConfigurationService),
__param32(8, IInstantiationService)
], WorkbenchList);
WorkbenchPagedList = class WorkbenchPagedList2 extends PagedList {
constructor(user, container, delegate, renderers, options2, contextKeyService, listService, configurationService, instantiationService) {
const horizontalScrolling = typeof options2.horizontalScrolling !== "undefined" ? options2.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey));
const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options2);
super(user, container, delegate, renderers, __spreadProps(__spreadValues({
keyboardSupport: false
}, workbenchListOptions), {
horizontalScrolling
}));
this.disposables = new DisposableStore();
this.disposables.add(workbenchListOptionsDisposable);
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.disposables.add(createScrollObserver(this.contextKeyService, this.widget));
this.horizontalScrolling = options2.horizontalScrolling;
this.listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
this.listSupportsMultiSelect.set(options2.multipleSelectionSupport !== false);
const listSelectionNavigation = WorkbenchListSelectionNavigation.bindTo(this.contextKeyService);
listSelectionNavigation.set(Boolean(options2.selectionNavigation));
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
this.disposables.add(this.contextKeyService);
this.disposables.add(listService.register(this));
this.updateStyles(options2.overrideStyles);
this.disposables.add(configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
let options3 = {};
if (e.affectsConfiguration(horizontalScrollingKey) && this.horizontalScrolling === void 0) {
const horizontalScrolling2 = Boolean(configurationService.getValue(horizontalScrollingKey));
options3 = __spreadProps(__spreadValues({}, options3), { horizontalScrolling: horizontalScrolling2 });
}
if (e.affectsConfiguration(scrollByPageKey)) {
const scrollByPage = Boolean(configurationService.getValue(scrollByPageKey));
options3 = __spreadProps(__spreadValues({}, options3), { scrollByPage });
}
if (e.affectsConfiguration(listSmoothScrolling)) {
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
options3 = __spreadProps(__spreadValues({}, options3), { smoothScrolling });
}
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
const mouseWheelScrollSensitivity = configurationService.getValue(mouseWheelScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { mouseWheelScrollSensitivity });
}
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
const fastScrollSensitivity = configurationService.getValue(fastScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { fastScrollSensitivity });
}
if (Object.keys(options3).length > 0) {
this.updateOptions(options3);
}
}));
this.navigator = new ListResourceNavigator(this, __spreadValues({ configurationService }, options2));
this.disposables.add(this.navigator);
}
updateOptions(options2) {
super.updateOptions(options2);
if (options2.overrideStyles !== void 0) {
this.updateStyles(options2.overrideStyles);
}
if (options2.multipleSelectionSupport !== void 0) {
this.listSupportsMultiSelect.set(!!options2.multipleSelectionSupport);
}
}
updateStyles(styles) {
this.style(styles ? getListStyles(styles) : defaultListStyles);
}
dispose() {
this.disposables.dispose();
super.dispose();
}
};
WorkbenchPagedList = __decorate38([
__param32(5, IContextKeyService),
__param32(6, IListService),
__param32(7, IConfigurationService),
__param32(8, IInstantiationService)
], WorkbenchPagedList);
WorkbenchTable = class WorkbenchTable2 extends Table {
constructor(user, container, delegate, columns, renderers, options2, contextKeyService, listService, configurationService, instantiationService) {
const horizontalScrolling = typeof options2.horizontalScrolling !== "undefined" ? options2.horizontalScrolling : Boolean(configurationService.getValue(horizontalScrollingKey));
const [workbenchListOptions, workbenchListOptionsDisposable] = instantiationService.invokeFunction(toWorkbenchListOptions, options2);
super(user, container, delegate, columns, renderers, __spreadProps(__spreadValues({
keyboardSupport: false
}, workbenchListOptions), {
horizontalScrolling
}));
this.disposables.add(workbenchListOptionsDisposable);
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
this.disposables.add(createScrollObserver(this.contextKeyService, this));
this.listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
this.listSupportsMultiSelect.set(options2.multipleSelectionSupport !== false);
const listSelectionNavigation = WorkbenchListSelectionNavigation.bindTo(this.contextKeyService);
listSelectionNavigation.set(Boolean(options2.selectionNavigation));
this.listHasSelectionOrFocus = WorkbenchListHasSelectionOrFocus.bindTo(this.contextKeyService);
this.listDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.listMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this.horizontalScrolling = options2.horizontalScrolling;
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
this.disposables.add(this.contextKeyService);
this.disposables.add(listService.register(this));
this.updateStyles(options2.overrideStyles);
this.disposables.add(this.onDidChangeSelection(() => {
const selection = this.getSelection();
const focus = this.getFocus();
this.contextKeyService.bufferChangeEvents(() => {
this.listHasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
this.listMultiSelection.set(selection.length > 1);
this.listDoubleSelection.set(selection.length === 2);
});
}));
this.disposables.add(this.onDidChangeFocus(() => {
const selection = this.getSelection();
const focus = this.getFocus();
this.listHasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
}));
this.disposables.add(configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
let options3 = {};
if (e.affectsConfiguration(horizontalScrollingKey) && this.horizontalScrolling === void 0) {
const horizontalScrolling2 = Boolean(configurationService.getValue(horizontalScrollingKey));
options3 = __spreadProps(__spreadValues({}, options3), { horizontalScrolling: horizontalScrolling2 });
}
if (e.affectsConfiguration(scrollByPageKey)) {
const scrollByPage = Boolean(configurationService.getValue(scrollByPageKey));
options3 = __spreadProps(__spreadValues({}, options3), { scrollByPage });
}
if (e.affectsConfiguration(listSmoothScrolling)) {
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
options3 = __spreadProps(__spreadValues({}, options3), { smoothScrolling });
}
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
const mouseWheelScrollSensitivity = configurationService.getValue(mouseWheelScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { mouseWheelScrollSensitivity });
}
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
const fastScrollSensitivity = configurationService.getValue(fastScrollSensitivityKey);
options3 = __spreadProps(__spreadValues({}, options3), { fastScrollSensitivity });
}
if (Object.keys(options3).length > 0) {
this.updateOptions(options3);
}
}));
this.navigator = new TableResourceNavigator(this, __spreadValues({ configurationService }, options2));
this.disposables.add(this.navigator);
}
updateOptions(options2) {
super.updateOptions(options2);
if (options2.overrideStyles !== void 0) {
this.updateStyles(options2.overrideStyles);
}
if (options2.multipleSelectionSupport !== void 0) {
this.listSupportsMultiSelect.set(!!options2.multipleSelectionSupport);
}
}
updateStyles(styles) {
this.style(styles ? getListStyles(styles) : defaultListStyles);
}
dispose() {
this.disposables.dispose();
super.dispose();
}
};
WorkbenchTable = __decorate38([
__param32(6, IContextKeyService),
__param32(7, IListService),
__param32(8, IConfigurationService),
__param32(9, IInstantiationService)
], WorkbenchTable);
ResourceNavigator = class extends Disposable {
constructor(widget, options2) {
var _a10;
super();
this.widget = widget;
this._onDidOpen = this._register(new Emitter());
this.onDidOpen = this._onDidOpen.event;
this._register(Event.filter(this.widget.onDidChangeSelection, (e) => isKeyboardEvent(e.browserEvent))((e) => this.onSelectionFromKeyboard(e)));
this._register(this.widget.onPointer((e) => this.onPointer(e.element, e.browserEvent)));
this._register(this.widget.onMouseDblClick((e) => this.onMouseDblClick(e.element, e.browserEvent)));
if (typeof (options2 === null || options2 === void 0 ? void 0 : options2.openOnSingleClick) !== "boolean" && (options2 === null || options2 === void 0 ? void 0 : options2.configurationService)) {
this.openOnSingleClick = (options2 === null || options2 === void 0 ? void 0 : options2.configurationService.getValue(openModeSettingKey)) !== "doubleClick";
this._register(options2 === null || options2 === void 0 ? void 0 : options2.configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration(openModeSettingKey)) {
this.openOnSingleClick = (options2 === null || options2 === void 0 ? void 0 : options2.configurationService.getValue(openModeSettingKey)) !== "doubleClick";
}
}));
} else {
this.openOnSingleClick = (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.openOnSingleClick) !== null && _a10 !== void 0 ? _a10 : true;
}
}
onSelectionFromKeyboard(event) {
if (event.elements.length !== 1) {
return;
}
const selectionKeyboardEvent = event.browserEvent;
const preserveFocus = typeof selectionKeyboardEvent.preserveFocus === "boolean" ? selectionKeyboardEvent.preserveFocus : true;
const pinned = typeof selectionKeyboardEvent.pinned === "boolean" ? selectionKeyboardEvent.pinned : !preserveFocus;
const sideBySide = false;
this._open(this.getSelectedElement(), preserveFocus, pinned, sideBySide, event.browserEvent);
}
onPointer(element, browserEvent) {
if (!this.openOnSingleClick) {
return;
}
const isDoubleClick = browserEvent.detail === 2;
if (isDoubleClick) {
return;
}
const isMiddleClick = browserEvent.button === 1;
const preserveFocus = true;
const pinned = isMiddleClick;
const sideBySide = browserEvent.ctrlKey || browserEvent.metaKey || browserEvent.altKey;
this._open(element, preserveFocus, pinned, sideBySide, browserEvent);
}
onMouseDblClick(element, browserEvent) {
if (!browserEvent) {
return;
}
const target = browserEvent.target;
const onTwistie = target.classList.contains("monaco-tl-twistie") || target.classList.contains("monaco-icon-label") && target.classList.contains("folder-icon") && browserEvent.offsetX < 16;
if (onTwistie) {
return;
}
const preserveFocus = false;
const pinned = true;
const sideBySide = browserEvent.ctrlKey || browserEvent.metaKey || browserEvent.altKey;
this._open(element, preserveFocus, pinned, sideBySide, browserEvent);
}
_open(element, preserveFocus, pinned, sideBySide, browserEvent) {
if (!element) {
return;
}
this._onDidOpen.fire({
editorOptions: {
preserveFocus,
pinned,
revealIfVisible: true
},
sideBySide,
element,
browserEvent
});
}
};
ListResourceNavigator = class extends ResourceNavigator {
constructor(widget, options2) {
super(widget, options2);
this.widget = widget;
}
getSelectedElement() {
return this.widget.getSelectedElements()[0];
}
};
TableResourceNavigator = class extends ResourceNavigator {
constructor(widget, options2) {
super(widget, options2);
}
getSelectedElement() {
return this.widget.getSelectedElements()[0];
}
};
TreeResourceNavigator = class extends ResourceNavigator {
constructor(widget, options2) {
super(widget, options2);
}
getSelectedElement() {
var _a10;
return (_a10 = this.widget.getSelection()[0]) !== null && _a10 !== void 0 ? _a10 : void 0;
}
};
WorkbenchObjectTree = class WorkbenchObjectTree2 extends ObjectTree {
constructor(user, container, delegate, renderers, options2, instantiationService, contextKeyService, listService, configurationService) {
const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options2);
super(user, container, delegate, renderers, treeOptions);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, options2, getTypeNavigationMode, options2.overrideStyles, contextKeyService, listService, configurationService);
this.disposables.add(this.internals);
}
updateOptions(options2) {
super.updateOptions(options2);
this.internals.updateOptions(options2);
}
};
WorkbenchObjectTree = __decorate38([
__param32(5, IInstantiationService),
__param32(6, IContextKeyService),
__param32(7, IListService),
__param32(8, IConfigurationService)
], WorkbenchObjectTree);
WorkbenchCompressibleObjectTree = class WorkbenchCompressibleObjectTree2 extends CompressibleObjectTree {
constructor(user, container, delegate, renderers, options2, instantiationService, contextKeyService, listService, configurationService) {
const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options2);
super(user, container, delegate, renderers, treeOptions);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, options2, getTypeNavigationMode, options2.overrideStyles, contextKeyService, listService, configurationService);
this.disposables.add(this.internals);
}
updateOptions(options2 = {}) {
super.updateOptions(options2);
if (options2.overrideStyles) {
this.internals.updateStyleOverrides(options2.overrideStyles);
}
this.internals.updateOptions(options2);
}
};
WorkbenchCompressibleObjectTree = __decorate38([
__param32(5, IInstantiationService),
__param32(6, IContextKeyService),
__param32(7, IListService),
__param32(8, IConfigurationService)
], WorkbenchCompressibleObjectTree);
WorkbenchDataTree = class WorkbenchDataTree2 extends DataTree {
constructor(user, container, delegate, renderers, dataSource, options2, instantiationService, contextKeyService, listService, configurationService) {
const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options2);
super(user, container, delegate, renderers, dataSource, treeOptions);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, options2, getTypeNavigationMode, options2.overrideStyles, contextKeyService, listService, configurationService);
this.disposables.add(this.internals);
}
updateOptions(options2 = {}) {
super.updateOptions(options2);
if (options2.overrideStyles !== void 0) {
this.internals.updateStyleOverrides(options2.overrideStyles);
}
this.internals.updateOptions(options2);
}
};
WorkbenchDataTree = __decorate38([
__param32(6, IInstantiationService),
__param32(7, IContextKeyService),
__param32(8, IListService),
__param32(9, IConfigurationService)
], WorkbenchDataTree);
WorkbenchAsyncDataTree = class WorkbenchAsyncDataTree2 extends AsyncDataTree {
get onDidOpen() {
return this.internals.onDidOpen;
}
constructor(user, container, delegate, renderers, dataSource, options2, instantiationService, contextKeyService, listService, configurationService) {
const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options2);
super(user, container, delegate, renderers, dataSource, treeOptions);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, options2, getTypeNavigationMode, options2.overrideStyles, contextKeyService, listService, configurationService);
this.disposables.add(this.internals);
}
updateOptions(options2 = {}) {
super.updateOptions(options2);
if (options2.overrideStyles) {
this.internals.updateStyleOverrides(options2.overrideStyles);
}
this.internals.updateOptions(options2);
}
};
WorkbenchAsyncDataTree = __decorate38([
__param32(6, IInstantiationService),
__param32(7, IContextKeyService),
__param32(8, IListService),
__param32(9, IConfigurationService)
], WorkbenchAsyncDataTree);
WorkbenchCompressibleAsyncDataTree = class WorkbenchCompressibleAsyncDataTree2 extends CompressibleAsyncDataTree {
constructor(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, options2, instantiationService, contextKeyService, listService, configurationService) {
const { options: treeOptions, getTypeNavigationMode, disposable } = instantiationService.invokeFunction(workbenchTreeDataPreamble, options2);
super(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, treeOptions);
this.disposables.add(disposable);
this.internals = new WorkbenchTreeInternals(this, options2, getTypeNavigationMode, options2.overrideStyles, contextKeyService, listService, configurationService);
this.disposables.add(this.internals);
}
updateOptions(options2) {
super.updateOptions(options2);
this.internals.updateOptions(options2);
}
};
WorkbenchCompressibleAsyncDataTree = __decorate38([
__param32(7, IInstantiationService),
__param32(8, IContextKeyService),
__param32(9, IListService),
__param32(10, IConfigurationService)
], WorkbenchCompressibleAsyncDataTree);
WorkbenchTreeInternals = class WorkbenchTreeInternals2 {
get onDidOpen() {
return this.navigator.onDidOpen;
}
constructor(tree, options2, getTypeNavigationMode, overrideStyles2, contextKeyService, listService, configurationService) {
var _a10;
this.tree = tree;
this.disposables = [];
this.contextKeyService = createScopedContextKeyService(contextKeyService, tree);
this.disposables.push(createScrollObserver(this.contextKeyService, tree));
this.listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
this.listSupportsMultiSelect.set(options2.multipleSelectionSupport !== false);
const listSelectionNavigation = WorkbenchListSelectionNavigation.bindTo(this.contextKeyService);
listSelectionNavigation.set(Boolean(options2.selectionNavigation));
this.listSupportFindWidget = WorkbenchListSupportsFind.bindTo(this.contextKeyService);
this.listSupportFindWidget.set((_a10 = options2.findWidgetEnabled) !== null && _a10 !== void 0 ? _a10 : true);
this.hasSelectionOrFocus = WorkbenchListHasSelectionOrFocus.bindTo(this.contextKeyService);
this.hasDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.hasMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this.treeElementCanCollapse = WorkbenchTreeElementCanCollapse.bindTo(this.contextKeyService);
this.treeElementHasParent = WorkbenchTreeElementHasParent.bindTo(this.contextKeyService);
this.treeElementCanExpand = WorkbenchTreeElementCanExpand.bindTo(this.contextKeyService);
this.treeElementHasChild = WorkbenchTreeElementHasChild.bindTo(this.contextKeyService);
this.treeFindOpen = WorkbenchTreeFindOpen.bindTo(this.contextKeyService);
this.treeStickyScrollFocused = WorkbenchTreeStickyScrollFocused.bindTo(this.contextKeyService);
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
this.updateStyleOverrides(overrideStyles2);
const updateCollapseContextKeys = () => {
const focus = tree.getFocus()[0];
if (!focus) {
return;
}
const node = tree.getNode(focus);
this.treeElementCanCollapse.set(node.collapsible && !node.collapsed);
this.treeElementHasParent.set(!!tree.getParentElement(focus));
this.treeElementCanExpand.set(node.collapsible && node.collapsed);
this.treeElementHasChild.set(!!tree.getFirstElementChild(focus));
};
const interestingContextKeys = /* @__PURE__ */ new Set();
interestingContextKeys.add(WorkbenchListTypeNavigationModeKey);
interestingContextKeys.add(WorkbenchListAutomaticKeyboardNavigationLegacyKey);
this.disposables.push(this.contextKeyService, listService.register(tree), tree.onDidChangeSelection(() => {
const selection = tree.getSelection();
const focus = tree.getFocus();
this.contextKeyService.bufferChangeEvents(() => {
this.hasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
this.hasMultiSelection.set(selection.length > 1);
this.hasDoubleSelection.set(selection.length === 2);
});
}), tree.onDidChangeFocus(() => {
const selection = tree.getSelection();
const focus = tree.getFocus();
this.hasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
updateCollapseContextKeys();
}), tree.onDidChangeCollapseState(updateCollapseContextKeys), tree.onDidChangeModel(updateCollapseContextKeys), tree.onDidChangeFindOpenState((enabled) => this.treeFindOpen.set(enabled)), tree.onDidChangeStickyScrollFocused((focused) => this.treeStickyScrollFocused.set(focused)), configurationService.onDidChangeConfiguration((e) => {
let newOptions = {};
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
if (e.affectsConfiguration(treeIndentKey)) {
const indent = configurationService.getValue(treeIndentKey);
newOptions = __spreadProps(__spreadValues({}, newOptions), { indent });
}
if (e.affectsConfiguration(treeRenderIndentGuidesKey) && options2.renderIndentGuides === void 0) {
const renderIndentGuides = configurationService.getValue(treeRenderIndentGuidesKey);
newOptions = __spreadProps(__spreadValues({}, newOptions), { renderIndentGuides });
}
if (e.affectsConfiguration(listSmoothScrolling)) {
const smoothScrolling = Boolean(configurationService.getValue(listSmoothScrolling));
newOptions = __spreadProps(__spreadValues({}, newOptions), { smoothScrolling });
}
if (e.affectsConfiguration(defaultFindModeSettingKey) || e.affectsConfiguration(keyboardNavigationSettingKey)) {
const defaultFindMode = getDefaultTreeFindMode(configurationService);
newOptions = __spreadProps(__spreadValues({}, newOptions), { defaultFindMode });
}
if (e.affectsConfiguration(typeNavigationModeSettingKey) || e.affectsConfiguration(keyboardNavigationSettingKey)) {
const typeNavigationMode = getTypeNavigationMode();
newOptions = __spreadProps(__spreadValues({}, newOptions), { typeNavigationMode });
}
if (e.affectsConfiguration(defaultFindMatchTypeSettingKey)) {
const defaultFindMatchType = getDefaultTreeFindMatchType(configurationService);
newOptions = __spreadProps(__spreadValues({}, newOptions), { defaultFindMatchType });
}
if (e.affectsConfiguration(horizontalScrollingKey) && options2.horizontalScrolling === void 0) {
const horizontalScrolling = Boolean(configurationService.getValue(horizontalScrollingKey));
newOptions = __spreadProps(__spreadValues({}, newOptions), { horizontalScrolling });
}
if (e.affectsConfiguration(scrollByPageKey)) {
const scrollByPage = Boolean(configurationService.getValue(scrollByPageKey));
newOptions = __spreadProps(__spreadValues({}, newOptions), { scrollByPage });
}
if (e.affectsConfiguration(treeExpandMode) && options2.expandOnlyOnTwistieClick === void 0) {
newOptions = __spreadProps(__spreadValues({}, newOptions), { expandOnlyOnTwistieClick: configurationService.getValue(treeExpandMode) === "doubleClick" });
}
if (e.affectsConfiguration(treeStickyScroll)) {
const enableStickyScroll = configurationService.getValue(treeStickyScroll);
newOptions = __spreadProps(__spreadValues({}, newOptions), { enableStickyScroll });
}
if (e.affectsConfiguration(treeStickyScrollMaxElements)) {
const stickyScrollMaxItemCount = Math.max(1, configurationService.getValue(treeStickyScrollMaxElements));
newOptions = __spreadProps(__spreadValues({}, newOptions), { stickyScrollMaxItemCount });
}
if (e.affectsConfiguration(mouseWheelScrollSensitivityKey)) {
const mouseWheelScrollSensitivity = configurationService.getValue(mouseWheelScrollSensitivityKey);
newOptions = __spreadProps(__spreadValues({}, newOptions), { mouseWheelScrollSensitivity });
}
if (e.affectsConfiguration(fastScrollSensitivityKey)) {
const fastScrollSensitivity = configurationService.getValue(fastScrollSensitivityKey);
newOptions = __spreadProps(__spreadValues({}, newOptions), { fastScrollSensitivity });
}
if (Object.keys(newOptions).length > 0) {
tree.updateOptions(newOptions);
}
}), this.contextKeyService.onDidChangeContext((e) => {
if (e.affectsSome(interestingContextKeys)) {
tree.updateOptions({ typeNavigationMode: getTypeNavigationMode() });
}
}));
this.navigator = new TreeResourceNavigator(tree, __spreadValues({ configurationService }, options2));
this.disposables.push(this.navigator);
}
updateOptions(options2) {
if (options2.multipleSelectionSupport !== void 0) {
this.listSupportsMultiSelect.set(!!options2.multipleSelectionSupport);
}
}
updateStyleOverrides(overrideStyles2) {
this.tree.style(overrideStyles2 ? getListStyles(overrideStyles2) : defaultListStyles);
}
dispose() {
this.disposables = dispose(this.disposables);
}
};
WorkbenchTreeInternals = __decorate38([
__param32(4, IContextKeyService),
__param32(5, IListService),
__param32(6, IConfigurationService)
], WorkbenchTreeInternals);
configurationRegistry3 = Registry.as(Extensions4.Configuration);
configurationRegistry3.registerConfiguration({
id: "workbench",
order: 7,
title: localize("workbenchConfigurationTitle", "Workbench"),
type: "object",
properties: {
[multiSelectModifierSettingKey]: {
type: "string",
enum: ["ctrlCmd", "alt"],
markdownEnumDescriptions: [
localize("multiSelectModifier.ctrlCmd", "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
localize("multiSelectModifier.alt", "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
],
default: "ctrlCmd",
description: localize({
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.")
},
[openModeSettingKey]: {
type: "string",
enum: ["singleClick", "doubleClick"],
default: "singleClick",
description: localize({
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.")
},
[horizontalScrollingKey]: {
type: "boolean",
default: false,
description: localize("horizontalScrolling setting", "Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")
},
[scrollByPageKey]: {
type: "boolean",
default: false,
description: localize("list.scrollByPage", "Controls whether clicks in the scrollbar scroll page by page.")
},
[treeIndentKey]: {
type: "number",
default: 8,
minimum: 4,
maximum: 40,
description: localize("tree indent setting", "Controls tree indentation in pixels.")
},
[treeRenderIndentGuidesKey]: {
type: "string",
enum: ["none", "onHover", "always"],
default: "onHover",
description: localize("render tree indent guides", "Controls whether the tree should render indent guides.")
},
[listSmoothScrolling]: {
type: "boolean",
default: false,
description: localize("list smoothScrolling setting", "Controls whether lists and trees have smooth scrolling.")
},
[mouseWheelScrollSensitivityKey]: {
type: "number",
default: 1,
markdownDescription: localize("Mouse Wheel Scroll Sensitivity", "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")
},
[fastScrollSensitivityKey]: {
type: "number",
default: 5,
markdownDescription: localize("Fast Scroll Sensitivity", "Scrolling speed multiplier when pressing `Alt`.")
},
[defaultFindModeSettingKey]: {
type: "string",
enum: ["highlight", "filter"],
enumDescriptions: [
localize("defaultFindModeSettingKey.highlight", "Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),
localize("defaultFindModeSettingKey.filter", "Filter elements when searching.")
],
default: "highlight",
description: localize("defaultFindModeSettingKey", "Controls the default find mode for lists and trees in the workbench.")
},
[keyboardNavigationSettingKey]: {
type: "string",
enum: ["simple", "highlight", "filter"],
enumDescriptions: [
localize("keyboardNavigationSettingKey.simple", "Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),
localize("keyboardNavigationSettingKey.highlight", "Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),
localize("keyboardNavigationSettingKey.filter", "Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")
],
default: "highlight",
description: localize("keyboardNavigationSettingKey", "Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),
deprecated: true,
deprecationMessage: localize("keyboardNavigationSettingKeyDeprecated", "Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")
},
[defaultFindMatchTypeSettingKey]: {
type: "string",
enum: ["fuzzy", "contiguous"],
enumDescriptions: [
localize("defaultFindMatchTypeSettingKey.fuzzy", "Use fuzzy matching when searching."),
localize("defaultFindMatchTypeSettingKey.contiguous", "Use contiguous matching when searching.")
],
default: "fuzzy",
description: localize("defaultFindMatchTypeSettingKey", "Controls the type of matching used when searching lists and trees in the workbench.")
},
[treeExpandMode]: {
type: "string",
enum: ["singleClick", "doubleClick"],
default: "singleClick",
description: localize("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.")
},
[treeStickyScroll]: {
type: "boolean",
default: true,
description: localize("sticky scroll", "Controls whether sticky scrolling is enabled in trees.")
},
[treeStickyScrollMaxElements]: {
type: "number",
minimum: 1,
default: 7,
markdownDescription: localize("sticky scroll maximum items", "Controls the number of sticky elements displayed in the tree when `#workbench.tree.enableStickyScroll#` is enabled.")
},
[typeNavigationModeSettingKey]: {
type: "string",
enum: ["automatic", "trigger"],
default: "automatic",
markdownDescription: localize("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.")
}
}
});
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconlabel.css
var init_iconlabel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconlabel.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js
var HighlightedLabel;
var init_highlightedLabel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js"() {
init_dom();
init_hoverDelegate2();
init_hoverDelegateFactory();
init_iconLabels();
init_lifecycle();
init_objects();
HighlightedLabel = class _HighlightedLabel extends Disposable {
/**
* Create a new {@link HighlightedLabel}.
*
* @param container The parent container to append to.
*/
constructor(container, options2) {
var _a10;
super();
this.options = options2;
this.text = "";
this.title = "";
this.highlights = [];
this.didEverRender = false;
this.supportIcons = (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.supportIcons) !== null && _a10 !== void 0 ? _a10 : false;
this.domNode = append(container, $("span.monaco-highlighted-label"));
}
/**
* The label's DOM node.
*/
get element() {
return this.domNode;
}
/**
* Set the label and highlights.
*
* @param text The label to display.
* @param highlights The ranges to highlight.
* @param title An optional title for the hover tooltip.
* @param escapeNewLines Whether to escape new lines.
* @returns
*/
set(text2, highlights = [], title = "", escapeNewLines) {
if (!text2) {
text2 = "";
}
if (escapeNewLines) {
text2 = _HighlightedLabel.escapeNewLines(text2, highlights);
}
if (this.didEverRender && this.text === text2 && this.title === title && equals2(this.highlights, highlights)) {
return;
}
this.text = text2;
this.title = title;
this.highlights = highlights;
this.render();
}
render() {
var _a10, _b4, _c2, _d2;
const children = [];
let pos = 0;
for (const highlight of this.highlights) {
if (highlight.end === highlight.start) {
continue;
}
if (pos < highlight.start) {
const substring2 = this.text.substring(pos, highlight.start);
if (this.supportIcons) {
children.push(...renderLabelWithIcons(substring2));
} else {
children.push(substring2);
}
pos = highlight.start;
}
const substring = this.text.substring(pos, highlight.end);
const element = $("span.highlight", void 0, ...this.supportIcons ? renderLabelWithIcons(substring) : [substring]);
if (highlight.extraClasses) {
element.classList.add(...highlight.extraClasses);
}
children.push(element);
pos = highlight.end;
}
if (pos < this.text.length) {
const substring = this.text.substring(pos);
if (this.supportIcons) {
children.push(...renderLabelWithIcons(substring));
} else {
children.push(substring);
}
}
reset(this.domNode, ...children);
if ((_b4 = (_a10 = this.options) === null || _a10 === void 0 ? void 0 : _a10.hoverDelegate) === null || _b4 === void 0 ? void 0 : _b4.showNativeHover) {
this.domNode.title = this.title;
} else {
if (!this.customHover && this.title !== "") {
const hoverDelegate = (_d2 = (_c2 = this.options) === null || _c2 === void 0 ? void 0 : _c2.hoverDelegate) !== null && _d2 !== void 0 ? _d2 : getDefaultHoverDelegate("mouse");
this.customHover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover(hoverDelegate, this.domNode, this.title));
} else if (this.customHover) {
this.customHover.update(this.title);
}
}
this.didEverRender = true;
}
static escapeNewLines(text2, highlights) {
let total = 0;
let extra = 0;
return text2.replace(/\r\n|\r|\n/g, (match2, offset) => {
extra = match2 === "\r\n" ? -1 : 0;
offset += total;
for (const highlight of highlights) {
if (highlight.end <= offset) {
continue;
}
if (highlight.start >= offset) {
highlight.start += extra;
}
if (highlight.end >= offset) {
highlight.end += extra;
}
}
total += extra;
return "\u23CE";
});
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js
function splitMatches(labels, separator, matches2) {
if (!matches2) {
return void 0;
}
let labelStart = 0;
return labels.map((label) => {
const labelRange = { start: labelStart, end: labelStart + label.length };
const result = matches2.map((match2) => Range2.intersect(labelRange, match2)).filter((range2) => !Range2.isEmpty(range2)).map(({ start, end }) => ({ start: start - labelStart, end: end - labelStart }));
labelStart = labelRange.end + separator.length;
return result;
});
}
var FastLabelNode, IconLabel, Label, LabelWithHighlights;
var init_iconLabel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js"() {
init_iconlabel();
init_dom();
init_highlightedLabel();
init_lifecycle();
init_objects();
init_range2();
init_hoverDelegateFactory();
init_hoverDelegate2();
init_types();
init_iconLabels2();
FastLabelNode = class {
constructor(_element) {
this._element = _element;
}
get element() {
return this._element;
}
set textContent(content) {
if (this.disposed || content === this._textContent) {
return;
}
this._textContent = content;
this._element.textContent = content;
}
set className(className) {
if (this.disposed || className === this._className) {
return;
}
this._className = className;
this._element.className = className;
}
set empty(empty2) {
if (this.disposed || empty2 === this._empty) {
return;
}
this._empty = empty2;
this._element.style.marginLeft = empty2 ? "0" : "";
}
dispose() {
this.disposed = true;
}
};
IconLabel = class extends Disposable {
constructor(container, options2) {
var _a10;
super();
this.customHovers = /* @__PURE__ */ new Map();
this.creationOptions = options2;
this.domNode = this._register(new FastLabelNode(append(container, $(".monaco-icon-label"))));
this.labelContainer = append(this.domNode.element, $(".monaco-icon-label-container"));
this.nameContainer = append(this.labelContainer, $("span.monaco-icon-name-container"));
if ((options2 === null || options2 === void 0 ? void 0 : options2.supportHighlights) || (options2 === null || options2 === void 0 ? void 0 : options2.supportIcons)) {
this.nameNode = this._register(new LabelWithHighlights(this.nameContainer, !!options2.supportIcons));
} else {
this.nameNode = new Label(this.nameContainer);
}
this.hoverDelegate = (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : getDefaultHoverDelegate("mouse");
}
get element() {
return this.domNode.element;
}
setLabel(label, description, options2) {
var _a10;
const labelClasses = ["monaco-icon-label"];
const containerClasses = ["monaco-icon-label-container"];
let ariaLabel = "";
if (options2) {
if (options2.extraClasses) {
labelClasses.push(...options2.extraClasses);
}
if (options2.italic) {
labelClasses.push("italic");
}
if (options2.strikethrough) {
labelClasses.push("strikethrough");
}
if (options2.disabledCommand) {
containerClasses.push("disabled");
}
if (options2.title) {
if (typeof options2.title === "string") {
ariaLabel += options2.title;
} else {
ariaLabel += label;
}
}
}
const existingIconNode = this.domNode.element.querySelector(".monaco-icon-label-iconpath");
if (options2 === null || options2 === void 0 ? void 0 : options2.iconPath) {
let iconNode;
if (!existingIconNode || !isHTMLElement(existingIconNode)) {
iconNode = $(".monaco-icon-label-iconpath");
this.domNode.element.prepend(iconNode);
} else {
iconNode = existingIconNode;
}
iconNode.style.backgroundImage = asCSSUrl(options2 === null || options2 === void 0 ? void 0 : options2.iconPath);
} else if (existingIconNode) {
existingIconNode.remove();
}
this.domNode.className = labelClasses.join(" ");
this.domNode.element.setAttribute("aria-label", ariaLabel);
this.labelContainer.className = containerClasses.join(" ");
this.setupHover((options2 === null || options2 === void 0 ? void 0 : options2.descriptionTitle) ? this.labelContainer : this.element, options2 === null || options2 === void 0 ? void 0 : options2.title);
this.nameNode.setLabel(label, options2);
if (description || this.descriptionNode) {
const descriptionNode = this.getOrCreateDescriptionNode();
if (descriptionNode instanceof HighlightedLabel) {
descriptionNode.set(description || "", options2 ? options2.descriptionMatches : void 0, void 0, options2 === null || options2 === void 0 ? void 0 : options2.labelEscapeNewLines);
this.setupHover(descriptionNode.element, options2 === null || options2 === void 0 ? void 0 : options2.descriptionTitle);
} else {
descriptionNode.textContent = description && (options2 === null || options2 === void 0 ? void 0 : options2.labelEscapeNewLines) ? HighlightedLabel.escapeNewLines(description, []) : description || "";
this.setupHover(descriptionNode.element, (options2 === null || options2 === void 0 ? void 0 : options2.descriptionTitle) || "");
descriptionNode.empty = !description;
}
}
if ((options2 === null || options2 === void 0 ? void 0 : options2.suffix) || this.suffixNode) {
const suffixNode = this.getOrCreateSuffixNode();
suffixNode.textContent = (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.suffix) !== null && _a10 !== void 0 ? _a10 : "";
}
}
setupHover(htmlElement, tooltip) {
const previousCustomHover = this.customHovers.get(htmlElement);
if (previousCustomHover) {
previousCustomHover.dispose();
this.customHovers.delete(htmlElement);
}
if (!tooltip) {
htmlElement.removeAttribute("title");
return;
}
if (this.hoverDelegate.showNativeHover) {
let setupNativeHover = function(htmlElement2, tooltip2) {
if (isString(tooltip2)) {
htmlElement2.title = stripIcons(tooltip2);
} else if (tooltip2 === null || tooltip2 === void 0 ? void 0 : tooltip2.markdownNotSupportedFallback) {
htmlElement2.title = tooltip2.markdownNotSupportedFallback;
} else {
htmlElement2.removeAttribute("title");
}
};
setupNativeHover(htmlElement, tooltip);
} else {
const hoverDisposable = getBaseLayerHoverDelegate().setupUpdatableHover(this.hoverDelegate, htmlElement, tooltip);
if (hoverDisposable) {
this.customHovers.set(htmlElement, hoverDisposable);
}
}
}
dispose() {
super.dispose();
for (const disposable of this.customHovers.values()) {
disposable.dispose();
}
this.customHovers.clear();
}
getOrCreateSuffixNode() {
if (!this.suffixNode) {
const suffixContainer = this._register(new FastLabelNode(after(this.nameContainer, $("span.monaco-icon-suffix-container"))));
this.suffixNode = this._register(new FastLabelNode(append(suffixContainer.element, $("span.label-suffix"))));
}
return this.suffixNode;
}
getOrCreateDescriptionNode() {
var _a10;
if (!this.descriptionNode) {
const descriptionContainer = this._register(new FastLabelNode(append(this.labelContainer, $("span.monaco-icon-description-container"))));
if ((_a10 = this.creationOptions) === null || _a10 === void 0 ? void 0 : _a10.supportDescriptionHighlights) {
this.descriptionNode = this._register(new HighlightedLabel(append(descriptionContainer.element, $("span.label-description")), { supportIcons: !!this.creationOptions.supportIcons }));
} else {
this.descriptionNode = this._register(new FastLabelNode(append(descriptionContainer.element, $("span.label-description"))));
}
}
return this.descriptionNode;
}
};
Label = class {
constructor(container) {
this.container = container;
this.label = void 0;
this.singleLabel = void 0;
}
setLabel(label, options2) {
if (this.label === label && equals2(this.options, options2)) {
return;
}
this.label = label;
this.options = options2;
if (typeof label === "string") {
if (!this.singleLabel) {
this.container.innerText = "";
this.container.classList.remove("multiple");
this.singleLabel = append(this.container, $("a.label-name", { id: options2 === null || options2 === void 0 ? void 0 : options2.domId }));
}
this.singleLabel.textContent = label;
} else {
this.container.innerText = "";
this.container.classList.add("multiple");
this.singleLabel = void 0;
for (let i = 0; i < label.length; i++) {
const l = label[i];
const id = (options2 === null || options2 === void 0 ? void 0 : options2.domId) && `${options2 === null || options2 === void 0 ? void 0 : options2.domId}_${i}`;
append(this.container, $("a.label-name", { id, "data-icon-label-count": label.length, "data-icon-label-index": i, "role": "treeitem" }, l));
if (i < label.length - 1) {
append(this.container, $("span.label-separator", void 0, (options2 === null || options2 === void 0 ? void 0 : options2.separator) || "/"));
}
}
}
}
};
LabelWithHighlights = class extends Disposable {
constructor(container, supportIcons) {
super();
this.container = container;
this.supportIcons = supportIcons;
this.label = void 0;
this.singleLabel = void 0;
}
setLabel(label, options2) {
if (this.label === label && equals2(this.options, options2)) {
return;
}
this.label = label;
this.options = options2;
if (typeof label === "string") {
if (!this.singleLabel) {
this.container.innerText = "";
this.container.classList.remove("multiple");
this.singleLabel = this._register(new HighlightedLabel(append(this.container, $("a.label-name", { id: options2 === null || options2 === void 0 ? void 0 : options2.domId })), { supportIcons: this.supportIcons }));
}
this.singleLabel.set(label, options2 === null || options2 === void 0 ? void 0 : options2.matches, void 0, options2 === null || options2 === void 0 ? void 0 : options2.labelEscapeNewLines);
} else {
this.container.innerText = "";
this.container.classList.add("multiple");
this.singleLabel = void 0;
const separator = (options2 === null || options2 === void 0 ? void 0 : options2.separator) || "/";
const matches2 = splitMatches(label, separator, options2 === null || options2 === void 0 ? void 0 : options2.matches);
for (let i = 0; i < label.length; i++) {
const l = label[i];
const m = matches2 ? matches2[i] : void 0;
const id = (options2 === null || options2 === void 0 ? void 0 : options2.domId) && `${options2 === null || options2 === void 0 ? void 0 : options2.domId}_${i}`;
const name = $("a.label-name", { id, "data-icon-label-count": label.length, "data-icon-label-index": i, "role": "treeitem" });
const highlightedLabel = this._register(new HighlightedLabel(append(this.container, name), { supportIcons: this.supportIcons }));
highlightedLabel.set(l, m, void 0, options2 === null || options2 === void 0 ? void 0 : options2.labelEscapeNewLines);
if (i < label.length - 1) {
append(name, $("span.label-separator", void 0, separator));
}
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css
var init_keybindingLabel = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js
var $7, unthemedKeybindingLabelOptions, KeybindingLabel;
var init_keybindingLabel2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.js"() {
init_dom();
init_hoverDelegate2();
init_hoverDelegateFactory();
init_keybindingLabels();
init_lifecycle();
init_objects();
init_keybindingLabel();
init_nls();
$7 = $;
unthemedKeybindingLabelOptions = {
keybindingLabelBackground: void 0,
keybindingLabelForeground: void 0,
keybindingLabelBorder: void 0,
keybindingLabelBottomBorder: void 0,
keybindingLabelShadow: void 0
};
KeybindingLabel = class _KeybindingLabel extends Disposable {
constructor(container, os, options2) {
super();
this.os = os;
this.keyElements = /* @__PURE__ */ new Set();
this.options = options2 || /* @__PURE__ */ Object.create(null);
const labelForeground = this.options.keybindingLabelForeground;
this.domNode = append(container, $7(".monaco-keybinding"));
if (labelForeground) {
this.domNode.style.color = labelForeground;
}
this.hover = this._register(getBaseLayerHoverDelegate().setupUpdatableHover(getDefaultHoverDelegate("mouse"), this.domNode, ""));
this.didEverRender = false;
container.appendChild(this.domNode);
}
get element() {
return this.domNode;
}
set(keybinding, matches2) {
if (this.didEverRender && this.keybinding === keybinding && _KeybindingLabel.areSame(this.matches, matches2)) {
return;
}
this.keybinding = keybinding;
this.matches = matches2;
this.render();
}
render() {
var _a10;
this.clear();
if (this.keybinding) {
const chords = this.keybinding.getChords();
if (chords[0]) {
this.renderChord(this.domNode, chords[0], this.matches ? this.matches.firstPart : null);
}
for (let i = 1; i < chords.length; i++) {
append(this.domNode, $7("span.monaco-keybinding-key-chord-separator", void 0, " "));
this.renderChord(this.domNode, chords[i], this.matches ? this.matches.chordPart : null);
}
const title = ((_a10 = this.options.disableTitle) !== null && _a10 !== void 0 ? _a10 : false) ? void 0 : this.keybinding.getAriaLabel() || void 0;
this.hover.update(title);
this.domNode.setAttribute("aria-label", title || "");
} else if (this.options && this.options.renderUnboundKeybindings) {
this.renderUnbound(this.domNode);
}
this.didEverRender = true;
}
clear() {
clearNode(this.domNode);
this.keyElements.clear();
}
renderChord(parent, chord, match2) {
const modifierLabels = UILabelProvider.modifierLabels[this.os];
if (chord.ctrlKey) {
this.renderKey(parent, modifierLabels.ctrlKey, Boolean(match2 === null || match2 === void 0 ? void 0 : match2.ctrlKey), modifierLabels.separator);
}
if (chord.shiftKey) {
this.renderKey(parent, modifierLabels.shiftKey, Boolean(match2 === null || match2 === void 0 ? void 0 : match2.shiftKey), modifierLabels.separator);
}
if (chord.altKey) {
this.renderKey(parent, modifierLabels.altKey, Boolean(match2 === null || match2 === void 0 ? void 0 : match2.altKey), modifierLabels.separator);
}
if (chord.metaKey) {
this.renderKey(parent, modifierLabels.metaKey, Boolean(match2 === null || match2 === void 0 ? void 0 : match2.metaKey), modifierLabels.separator);
}
const keyLabel = chord.keyLabel;
if (keyLabel) {
this.renderKey(parent, keyLabel, Boolean(match2 === null || match2 === void 0 ? void 0 : match2.keyCode), "");
}
}
renderKey(parent, label, highlight, separator) {
append(parent, this.createKeyElement(label, highlight ? ".highlight" : ""));
if (separator) {
append(parent, $7("span.monaco-keybinding-key-separator", void 0, separator));
}
}
renderUnbound(parent) {
append(parent, this.createKeyElement(localize("unbound", "Unbound")));
}
createKeyElement(label, extraClass = "") {
const keyElement = $7("span.monaco-keybinding-key" + extraClass, void 0, label);
this.keyElements.add(keyElement);
if (this.options.keybindingLabelBackground) {
keyElement.style.backgroundColor = this.options.keybindingLabelBackground;
}
if (this.options.keybindingLabelBorder) {
keyElement.style.borderColor = this.options.keybindingLabelBorder;
}
if (this.options.keybindingLabelBottomBorder) {
keyElement.style.borderBottomColor = this.options.keybindingLabelBottomBorder;
}
if (this.options.keybindingLabelShadow) {
keyElement.style.boxShadow = `inset 0 -1px 0 ${this.options.keybindingLabelShadow}`;
}
return keyElement;
}
static areSame(a3, b) {
if (a3 === b || !a3 && !b) {
return true;
}
return !!a3 && !!b && equals2(a3.firstPart, b.firstPart) && equals2(a3.chordPart, b.chordPart);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/comparers.js
function compareFileNames(one, other, caseSensitive = false) {
const a3 = one || "";
const b = other || "";
const result = intlFileNameCollatorBaseNumeric.value.collator.compare(a3, b);
if (intlFileNameCollatorBaseNumeric.value.collatorIsNumeric && result === 0 && a3 !== b) {
return a3 < b ? -1 : 1;
}
return result;
}
function compareAnything(one, other, lookFor) {
const elementAName = one.toLowerCase();
const elementBName = other.toLowerCase();
const prefixCompare = compareByPrefix(one, other, lookFor);
if (prefixCompare) {
return prefixCompare;
}
const elementASuffixMatch = elementAName.endsWith(lookFor);
const elementBSuffixMatch = elementBName.endsWith(lookFor);
if (elementASuffixMatch !== elementBSuffixMatch) {
return elementASuffixMatch ? -1 : 1;
}
const r = compareFileNames(elementAName, elementBName);
if (r !== 0) {
return r;
}
return elementAName.localeCompare(elementBName);
}
function compareByPrefix(one, other, lookFor) {
const elementAName = one.toLowerCase();
const elementBName = other.toLowerCase();
const elementAPrefixMatch = elementAName.startsWith(lookFor);
const elementBPrefixMatch = elementBName.startsWith(lookFor);
if (elementAPrefixMatch !== elementBPrefixMatch) {
return elementAPrefixMatch ? -1 : 1;
} else if (elementAPrefixMatch && elementBPrefixMatch) {
if (elementAName.length < elementBName.length) {
return -1;
}
if (elementAName.length > elementBName.length) {
return 1;
}
}
return 0;
}
var intlFileNameCollatorBaseNumeric, intlFileNameCollatorNumeric, intlFileNameCollatorNumericCaseInsensitive;
var init_comparers = __esm({
"node_modules/monaco-editor/esm/vs/base/common/comparers.js"() {
init_lazy();
intlFileNameCollatorBaseNumeric = new Lazy(() => {
const collator = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
return {
collator,
collatorIsNumeric: collator.resolvedOptions().numeric
};
});
intlFileNameCollatorNumeric = new Lazy(() => {
const collator = new Intl.Collator(void 0, { numeric: true });
return {
collator
};
});
intlFileNameCollatorNumericCaseInsensitive = new Lazy(() => {
const collator = new Intl.Collator(void 0, { numeric: true, sensitivity: "accent" });
return {
collator
};
});
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputTree.js
function matchesContiguousIconAware(query, target) {
const { text: text2, iconOffsets } = target;
if (!iconOffsets || iconOffsets.length === 0) {
return matchesContiguous(query, text2);
}
const wordToMatchAgainstWithoutIconsTrimmed = ltrim(text2, " ");
const leadingWhitespaceOffset = text2.length - wordToMatchAgainstWithoutIconsTrimmed.length;
const matches2 = matchesContiguous(query, wordToMatchAgainstWithoutIconsTrimmed);
if (matches2) {
for (const match2 of matches2) {
const iconOffset = iconOffsets[match2.start + leadingWhitespaceOffset] + leadingWhitespaceOffset;
match2.start += iconOffset;
match2.end += iconOffset;
}
}
return matches2;
}
function matchesContiguous(word, wordToMatchAgainst) {
const matchIndex = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
if (matchIndex !== -1) {
return [{ start: matchIndex, end: matchIndex + word.length }];
}
return null;
}
function compareEntries(elementA, elementB, lookFor) {
const labelHighlightsA = elementA.labelHighlights || [];
const labelHighlightsB = elementB.labelHighlights || [];
if (labelHighlightsA.length && !labelHighlightsB.length) {
return -1;
}
if (!labelHighlightsA.length && labelHighlightsB.length) {
return 1;
}
if (labelHighlightsA.length === 0 && labelHighlightsB.length === 0) {
return 0;
}
return compareAnything(elementA.saneSortLabel, elementB.saneSortLabel, lookFor);
}
var __decorate39, __param33, QuickPickItemElementRenderer_1, $8, BaseQuickPickItemElement, QuickPickItemElement, QuickPickSeparatorFocusReason, QuickPickSeparatorElement, QuickInputItemDelegate, QuickInputAccessibilityProvider, BaseQuickInputListRenderer, QuickPickItemElementRenderer, QuickPickSeparatorElementRenderer, QuickInputTree;
var init_quickInputTree = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputTree.js"() {
init_dom();
init_event();
init_nls();
init_instantiation();
init_listService();
init_themeService();
init_lifecycle();
init_keyboardEvent();
init_platform();
init_decorators();
init_iconLabel();
init_keybindingLabel2();
init_actionbar2();
init_theme();
init_uri();
init_quickInputUtils();
init_lazy();
init_iconLabels2();
init_comparers();
init_strings();
init_abstractTree();
init_async();
init_errors();
init_quickInput();
init_accessibility();
__decorate39 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param33 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
$8 = $;
BaseQuickPickItemElement = class {
constructor(index, hasCheckbox, mainItem) {
this.index = index;
this.hasCheckbox = hasCheckbox;
this._hidden = false;
this._init = new Lazy(() => {
var _a10;
const saneLabel = (_a10 = mainItem.label) !== null && _a10 !== void 0 ? _a10 : "";
const saneSortLabel = parseLabelWithIcons(saneLabel).text.trim();
const saneAriaLabel = mainItem.ariaLabel || [saneLabel, this.saneDescription, this.saneDetail].map((s) => getCodiconAriaLabel(s)).filter((s) => !!s).join(", ");
return {
saneLabel,
saneSortLabel,
saneAriaLabel
};
});
this._saneDescription = mainItem.description;
this._saneTooltip = mainItem.tooltip;
}
// #region Lazy Getters
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(value) {
this._element = value;
}
get hidden() {
return this._hidden;
}
set hidden(value) {
this._hidden = value;
}
get saneDescription() {
return this._saneDescription;
}
set saneDescription(value) {
this._saneDescription = value;
}
get saneDetail() {
return this._saneDetail;
}
set saneDetail(value) {
this._saneDetail = value;
}
get saneTooltip() {
return this._saneTooltip;
}
set saneTooltip(value) {
this._saneTooltip = value;
}
get labelHighlights() {
return this._labelHighlights;
}
set labelHighlights(value) {
this._labelHighlights = value;
}
get descriptionHighlights() {
return this._descriptionHighlights;
}
set descriptionHighlights(value) {
this._descriptionHighlights = value;
}
get detailHighlights() {
return this._detailHighlights;
}
set detailHighlights(value) {
this._detailHighlights = value;
}
};
QuickPickItemElement = class extends BaseQuickPickItemElement {
constructor(index, hasCheckbox, fireButtonTriggered, _onChecked, item, _separator) {
var _a10, _b4, _c2;
super(index, hasCheckbox, item);
this.fireButtonTriggered = fireButtonTriggered;
this._onChecked = _onChecked;
this.item = item;
this._separator = _separator;
this._checked = false;
this.onChecked = hasCheckbox ? Event.map(Event.filter(this._onChecked.event, (e) => e.element === this), (e) => e.checked) : Event.None;
this._saneDetail = item.detail;
this._labelHighlights = (_a10 = item.highlights) === null || _a10 === void 0 ? void 0 : _a10.label;
this._descriptionHighlights = (_b4 = item.highlights) === null || _b4 === void 0 ? void 0 : _b4.description;
this._detailHighlights = (_c2 = item.highlights) === null || _c2 === void 0 ? void 0 : _c2.detail;
}
get separator() {
return this._separator;
}
set separator(value) {
this._separator = value;
}
get checked() {
return this._checked;
}
set checked(value) {
if (value !== this._checked) {
this._checked = value;
this._onChecked.fire({ element: this, checked: value });
}
}
get checkboxDisabled() {
return !!this.item.disabled;
}
};
(function(QuickPickSeparatorFocusReason2) {
QuickPickSeparatorFocusReason2[QuickPickSeparatorFocusReason2["NONE"] = 0] = "NONE";
QuickPickSeparatorFocusReason2[QuickPickSeparatorFocusReason2["MOUSE_HOVER"] = 1] = "MOUSE_HOVER";
QuickPickSeparatorFocusReason2[QuickPickSeparatorFocusReason2["ACTIVE_ITEM"] = 2] = "ACTIVE_ITEM";
})(QuickPickSeparatorFocusReason || (QuickPickSeparatorFocusReason = {}));
QuickPickSeparatorElement = class extends BaseQuickPickItemElement {
constructor(index, fireSeparatorButtonTriggered, separator) {
super(index, false, separator);
this.fireSeparatorButtonTriggered = fireSeparatorButtonTriggered;
this.separator = separator;
this.children = new Array();
this.focusInsideSeparator = QuickPickSeparatorFocusReason.NONE;
}
};
QuickInputItemDelegate = class {
getHeight(element) {
if (element instanceof QuickPickSeparatorElement) {
return 30;
}
return element.saneDetail ? 44 : 22;
}
getTemplateId(element) {
if (element instanceof QuickPickItemElement) {
return QuickPickItemElementRenderer.ID;
} else {
return QuickPickSeparatorElementRenderer.ID;
}
}
};
QuickInputAccessibilityProvider = class {
getWidgetAriaLabel() {
return localize("quickInput", "Quick Input");
}
getAriaLabel(element) {
var _a10;
return ((_a10 = element.separator) === null || _a10 === void 0 ? void 0 : _a10.label) ? `${element.saneAriaLabel}, ${element.separator.label}` : element.saneAriaLabel;
}
getWidgetRole() {
return "listbox";
}
getRole(element) {
return element.hasCheckbox ? "checkbox" : "option";
}
isChecked(element) {
if (!element.hasCheckbox || !(element instanceof QuickPickItemElement)) {
return void 0;
}
return {
get value() {
return element.checked;
},
onDidChange: (e) => element.onChecked(() => e())
};
}
};
BaseQuickInputListRenderer = class {
constructor(hoverDelegate) {
this.hoverDelegate = hoverDelegate;
}
// TODO: only do the common stuff here and have a subclass handle their specific stuff
renderTemplate(container) {
const data = /* @__PURE__ */ Object.create(null);
data.toDisposeElement = new DisposableStore();
data.toDisposeTemplate = new DisposableStore();
data.entry = append(container, $8(".quick-input-list-entry"));
const label = append(data.entry, $8("label.quick-input-list-label"));
data.toDisposeTemplate.add(addStandardDisposableListener(label, EventType.CLICK, (e) => {
if (!data.checkbox.offsetParent) {
e.preventDefault();
}
}));
data.checkbox = append(label, $8("input.quick-input-list-checkbox"));
data.checkbox.type = "checkbox";
const rows = append(label, $8(".quick-input-list-rows"));
const row1 = append(rows, $8(".quick-input-list-row"));
const row2 = append(rows, $8(".quick-input-list-row"));
data.label = new IconLabel(row1, { supportHighlights: true, supportDescriptionHighlights: true, supportIcons: true, hoverDelegate: this.hoverDelegate });
data.toDisposeTemplate.add(data.label);
data.icon = prepend(data.label.element, $8(".quick-input-list-icon"));
const keybindingContainer = append(row1, $8(".quick-input-list-entry-keybinding"));
data.keybinding = new KeybindingLabel(keybindingContainer, OS);
data.toDisposeTemplate.add(data.keybinding);
const detailContainer = append(row2, $8(".quick-input-list-label-meta"));
data.detail = new IconLabel(detailContainer, { supportHighlights: true, supportIcons: true, hoverDelegate: this.hoverDelegate });
data.toDisposeTemplate.add(data.detail);
data.separator = append(data.entry, $8(".quick-input-list-separator"));
data.actionBar = new ActionBar(data.entry, this.hoverDelegate ? { hoverDelegate: this.hoverDelegate } : void 0);
data.actionBar.domNode.classList.add("quick-input-list-entry-action-bar");
data.toDisposeTemplate.add(data.actionBar);
return data;
}
disposeTemplate(data) {
data.toDisposeElement.dispose();
data.toDisposeTemplate.dispose();
}
disposeElement(_element, _index, data) {
data.toDisposeElement.clear();
data.actionBar.clear();
}
};
QuickPickItemElementRenderer = QuickPickItemElementRenderer_1 = class QuickPickItemElementRenderer2 extends BaseQuickInputListRenderer {
constructor(hoverDelegate, themeService) {
super(hoverDelegate);
this.themeService = themeService;
this._itemsWithSeparatorsFrequency = /* @__PURE__ */ new Map();
}
get templateId() {
return QuickPickItemElementRenderer_1.ID;
}
renderTemplate(container) {
const data = super.renderTemplate(container);
data.toDisposeTemplate.add(addStandardDisposableListener(data.checkbox, EventType.CHANGE, (e) => {
data.element.checked = data.checkbox.checked;
}));
return data;
}
renderElement(node, index, data) {
var _a10, _b4, _c2;
const element = node.element;
data.element = element;
element.element = (_a10 = data.entry) !== null && _a10 !== void 0 ? _a10 : void 0;
const mainItem = element.item;
data.checkbox.checked = element.checked;
data.toDisposeElement.add(element.onChecked((checked) => data.checkbox.checked = checked));
data.checkbox.disabled = element.checkboxDisabled;
const { labelHighlights, descriptionHighlights, detailHighlights } = element;
if (mainItem.iconPath) {
const icon = isDark(this.themeService.getColorTheme().type) ? mainItem.iconPath.dark : (_b4 = mainItem.iconPath.light) !== null && _b4 !== void 0 ? _b4 : mainItem.iconPath.dark;
const iconUrl = URI.revive(icon);
data.icon.className = "quick-input-list-icon";
data.icon.style.backgroundImage = asCSSUrl(iconUrl);
} else {
data.icon.style.backgroundImage = "";
data.icon.className = mainItem.iconClass ? `quick-input-list-icon ${mainItem.iconClass}` : "";
}
let descriptionTitle;
if (!element.saneTooltip && element.saneDescription) {
descriptionTitle = {
markdown: {
value: element.saneDescription,
supportThemeIcons: true
},
markdownNotSupportedFallback: element.saneDescription
};
}
const options2 = {
matches: labelHighlights || [],
// If we have a tooltip, we want that to be shown and not any other hover
descriptionTitle,
descriptionMatches: descriptionHighlights || [],
labelEscapeNewLines: true
};
options2.extraClasses = mainItem.iconClasses;
options2.italic = mainItem.italic;
options2.strikethrough = mainItem.strikethrough;
data.entry.classList.remove("quick-input-list-separator-as-item");
data.label.setLabel(element.saneLabel, element.saneDescription, options2);
data.keybinding.set(mainItem.keybinding);
if (element.saneDetail) {
let title;
if (!element.saneTooltip) {
title = {
markdown: {
value: element.saneDetail,
supportThemeIcons: true
},
markdownNotSupportedFallback: element.saneDetail
};
}
data.detail.element.style.display = "";
data.detail.setLabel(element.saneDetail, void 0, {
matches: detailHighlights,
title,
labelEscapeNewLines: true
});
} else {
data.detail.element.style.display = "none";
}
if ((_c2 = element.separator) === null || _c2 === void 0 ? void 0 : _c2.label) {
data.separator.textContent = element.separator.label;
data.separator.style.display = "";
this.addItemWithSeparator(element);
} else {
data.separator.style.display = "none";
}
data.entry.classList.toggle("quick-input-list-separator-border", !!element.separator);
const buttons = mainItem.buttons;
if (buttons && buttons.length) {
data.actionBar.push(buttons.map((button, index2) => quickInputButtonToAction(button, `id-${index2}`, () => element.fireButtonTriggered({ button, item: element.item }))), { icon: true, label: false });
data.entry.classList.add("has-actions");
} else {
data.entry.classList.remove("has-actions");
}
}
disposeElement(element, _index, data) {
this.removeItemWithSeparator(element.element);
super.disposeElement(element, _index, data);
}
isItemWithSeparatorVisible(item) {
return this._itemsWithSeparatorsFrequency.has(item);
}
addItemWithSeparator(item) {
this._itemsWithSeparatorsFrequency.set(item, (this._itemsWithSeparatorsFrequency.get(item) || 0) + 1);
}
removeItemWithSeparator(item) {
const frequency = this._itemsWithSeparatorsFrequency.get(item) || 0;
if (frequency > 1) {
this._itemsWithSeparatorsFrequency.set(item, frequency - 1);
} else {
this._itemsWithSeparatorsFrequency.delete(item);
}
}
};
QuickPickItemElementRenderer.ID = "quickpickitem";
QuickPickItemElementRenderer = QuickPickItemElementRenderer_1 = __decorate39([
__param33(1, IThemeService)
], QuickPickItemElementRenderer);
QuickPickSeparatorElementRenderer = class _QuickPickSeparatorElementRenderer extends BaseQuickInputListRenderer {
constructor() {
super(...arguments);
this._visibleSeparatorsFrequency = /* @__PURE__ */ new Map();
}
get templateId() {
return _QuickPickSeparatorElementRenderer.ID;
}
get visibleSeparators() {
return [...this._visibleSeparatorsFrequency.keys()];
}
isSeparatorVisible(separator) {
return this._visibleSeparatorsFrequency.has(separator);
}
renderElement(node, index, data) {
var _a10;
const element = node.element;
data.element = element;
element.element = (_a10 = data.entry) !== null && _a10 !== void 0 ? _a10 : void 0;
element.element.classList.toggle("focus-inside", !!element.focusInsideSeparator);
const mainItem = element.separator;
const { labelHighlights, descriptionHighlights, detailHighlights } = element;
data.icon.style.backgroundImage = "";
data.icon.className = "";
let descriptionTitle;
if (!element.saneTooltip && element.saneDescription) {
descriptionTitle = {
markdown: {
value: element.saneDescription,
supportThemeIcons: true
},
markdownNotSupportedFallback: element.saneDescription
};
}
const options2 = {
matches: labelHighlights || [],
// If we have a tooltip, we want that to be shown and not any other hover
descriptionTitle,
descriptionMatches: descriptionHighlights || [],
labelEscapeNewLines: true
};
data.entry.classList.add("quick-input-list-separator-as-item");
data.label.setLabel(element.saneLabel, element.saneDescription, options2);
if (element.saneDetail) {
let title;
if (!element.saneTooltip) {
title = {
markdown: {
value: element.saneDetail,
supportThemeIcons: true
},
markdownNotSupportedFallback: element.saneDetail
};
}
data.detail.element.style.display = "";
data.detail.setLabel(element.saneDetail, void 0, {
matches: detailHighlights,
title,
labelEscapeNewLines: true
});
} else {
data.detail.element.style.display = "none";
}
data.separator.style.display = "none";
data.entry.classList.add("quick-input-list-separator-border");
const buttons = mainItem.buttons;
if (buttons && buttons.length) {
data.actionBar.push(buttons.map((button, index2) => quickInputButtonToAction(button, `id-${index2}`, () => element.fireSeparatorButtonTriggered({ button, separator: element.separator }))), { icon: true, label: false });
data.entry.classList.add("has-actions");
} else {
data.entry.classList.remove("has-actions");
}
this.addSeparator(element);
}
disposeElement(element, _index, data) {
var _a10;
this.removeSeparator(element.element);
if (!this.isSeparatorVisible(element.element)) {
(_a10 = element.element.element) === null || _a10 === void 0 ? void 0 : _a10.classList.remove("focus-inside");
}
super.disposeElement(element, _index, data);
}
addSeparator(separator) {
this._visibleSeparatorsFrequency.set(separator, (this._visibleSeparatorsFrequency.get(separator) || 0) + 1);
}
removeSeparator(separator) {
const frequency = this._visibleSeparatorsFrequency.get(separator) || 0;
if (frequency > 1) {
this._visibleSeparatorsFrequency.set(separator, frequency - 1);
} else {
this._visibleSeparatorsFrequency.delete(separator);
}
}
};
QuickPickSeparatorElementRenderer.ID = "quickpickseparator";
QuickInputTree = class QuickInputTree2 extends Disposable {
constructor(parent, hoverDelegate, linkOpenerDelegate, id, instantiationService, accessibilityService) {
super();
this.parent = parent;
this.hoverDelegate = hoverDelegate;
this.linkOpenerDelegate = linkOpenerDelegate;
this.accessibilityService = accessibilityService;
this._onKeyDown = new Emitter();
this._onLeave = new Emitter();
this.onLeave = this._onLeave.event;
this._onChangedAllVisibleChecked = new Emitter();
this.onChangedAllVisibleChecked = this._onChangedAllVisibleChecked.event;
this._onChangedCheckedCount = new Emitter();
this.onChangedCheckedCount = this._onChangedCheckedCount.event;
this._onChangedVisibleCount = new Emitter();
this.onChangedVisibleCount = this._onChangedVisibleCount.event;
this._onChangedCheckedElements = new Emitter();
this.onChangedCheckedElements = this._onChangedCheckedElements.event;
this._onButtonTriggered = new Emitter();
this.onButtonTriggered = this._onButtonTriggered.event;
this._onSeparatorButtonTriggered = new Emitter();
this.onSeparatorButtonTriggered = this._onSeparatorButtonTriggered.event;
this._elementChecked = new Emitter();
this._inputElements = new Array();
this._elementTree = new Array();
this._itemElements = new Array();
this._elementDisposable = this._register(new DisposableStore());
this._shouldFireCheckedEvents = true;
this._matchOnDescription = false;
this._matchOnDetail = false;
this._matchOnLabel = true;
this._matchOnLabelMode = "fuzzy";
this._sortByLabel = true;
this._shouldLoop = true;
this._container = append(this.parent, $8(".quick-input-list"));
this._separatorRenderer = new QuickPickSeparatorElementRenderer(hoverDelegate);
this._itemRenderer = instantiationService.createInstance(QuickPickItemElementRenderer, hoverDelegate);
this._tree = this._register(instantiationService.createInstance(WorkbenchObjectTree, "QuickInput", this._container, new QuickInputItemDelegate(), [this._itemRenderer, this._separatorRenderer], {
accessibilityProvider: new QuickInputAccessibilityProvider(),
setRowLineHeight: false,
multipleSelectionSupport: false,
hideTwistiesOfChildlessElements: true,
renderIndentGuides: RenderIndentGuides.None,
findWidgetEnabled: false,
indent: 0,
horizontalScrolling: false,
allowNonCollapsibleParents: true,
alwaysConsumeMouseWheel: true
}));
this._tree.getHTMLElement().id = id;
this._registerListeners();
}
//#region public getters/setters
get onDidChangeFocus() {
return Event.map(this._tree.onDidChangeFocus, (e) => e.elements.filter((e2) => e2 instanceof QuickPickItemElement).map((e2) => e2.item));
}
get onDidChangeSelection() {
return Event.map(this._tree.onDidChangeSelection, (e) => ({
items: e.elements.filter((e2) => e2 instanceof QuickPickItemElement).map((e2) => e2.item),
event: e.browserEvent
}));
}
get scrollTop() {
return this._tree.scrollTop;
}
set scrollTop(scrollTop) {
this._tree.scrollTop = scrollTop;
}
get ariaLabel() {
return this._tree.ariaLabel;
}
set ariaLabel(label) {
this._tree.ariaLabel = label !== null && label !== void 0 ? label : "";
}
set enabled(value) {
this._tree.getHTMLElement().style.pointerEvents = value ? "" : "none";
}
get matchOnDescription() {
return this._matchOnDescription;
}
set matchOnDescription(value) {
this._matchOnDescription = value;
}
get matchOnDetail() {
return this._matchOnDetail;
}
set matchOnDetail(value) {
this._matchOnDetail = value;
}
get matchOnLabel() {
return this._matchOnLabel;
}
set matchOnLabel(value) {
this._matchOnLabel = value;
}
get matchOnLabelMode() {
return this._matchOnLabelMode;
}
set matchOnLabelMode(value) {
this._matchOnLabelMode = value;
}
get sortByLabel() {
return this._sortByLabel;
}
set sortByLabel(value) {
this._sortByLabel = value;
}
get shouldLoop() {
return this._shouldLoop;
}
set shouldLoop(value) {
this._shouldLoop = value;
}
//#endregion
//#region register listeners
_registerListeners() {
this._registerOnKeyDown();
this._registerOnContainerClick();
this._registerOnMouseMiddleClick();
this._registerOnElementChecked();
this._registerOnContextMenu();
this._registerHoverListeners();
this._registerSelectionChangeListener();
this._registerSeparatorActionShowingListeners();
}
_registerOnKeyDown() {
this._register(this._tree.onKeyDown((e) => {
const event = new StandardKeyboardEvent(e);
switch (event.keyCode) {
case 10:
this.toggleCheckbox();
break;
}
this._onKeyDown.fire(event);
}));
}
_registerOnContainerClick() {
this._register(addDisposableListener(this._container, EventType.CLICK, (e) => {
if (e.x || e.y) {
this._onLeave.fire();
}
}));
}
_registerOnMouseMiddleClick() {
this._register(addDisposableListener(this._container, EventType.AUXCLICK, (e) => {
if (e.button === 1) {
this._onLeave.fire();
}
}));
}
_registerOnElementChecked() {
this._register(this._elementChecked.event((_) => this._fireCheckedEvents()));
}
_registerOnContextMenu() {
this._register(this._tree.onContextMenu((e) => {
if (e.element) {
e.browserEvent.preventDefault();
this._tree.setSelection([e.element]);
}
}));
}
_registerHoverListeners() {
const delayer3 = this._register(new ThrottledDelayer(this.hoverDelegate.delay));
this._register(this._tree.onMouseOver((e) => __async(this, null, function* () {
var _a10;
if (isHTMLAnchorElement(e.browserEvent.target)) {
delayer3.cancel();
return;
}
if (
// anchors are an exception as called out above so we skip them here
!isHTMLAnchorElement(e.browserEvent.relatedTarget) && // check if the mouse is still over the same element
isAncestor(e.browserEvent.relatedTarget, (_a10 = e.element) === null || _a10 === void 0 ? void 0 : _a10.element)
) {
return;
}
try {
yield delayer3.trigger(() => __async(this, null, function* () {
if (e.element instanceof QuickPickItemElement) {
this.showHover(e.element);
}
}));
} catch (e2) {
if (!isCancellationError(e2)) {
throw e2;
}
}
})));
this._register(this._tree.onMouseOut((e) => {
var _a10;
if (isAncestor(e.browserEvent.relatedTarget, (_a10 = e.element) === null || _a10 === void 0 ? void 0 : _a10.element)) {
return;
}
delayer3.cancel();
}));
}
/**
* Register's focus change and mouse events so that we can track when items inside of a
* separator's section are focused or hovered so that we can display the separator's actions
*/
_registerSeparatorActionShowingListeners() {
this._register(this._tree.onDidChangeFocus((e) => {
const parent = e.elements[0] ? this._tree.getParentElement(e.elements[0]) : null;
for (const separator of this._separatorRenderer.visibleSeparators) {
const value = separator === parent;
const currentActive = !!(separator.focusInsideSeparator & QuickPickSeparatorFocusReason.ACTIVE_ITEM);
if (currentActive !== value) {
if (value) {
separator.focusInsideSeparator |= QuickPickSeparatorFocusReason.ACTIVE_ITEM;
} else {
separator.focusInsideSeparator &= ~QuickPickSeparatorFocusReason.ACTIVE_ITEM;
}
this._tree.rerender(separator);
}
}
}));
this._register(this._tree.onMouseOver((e) => {
const parent = e.element ? this._tree.getParentElement(e.element) : null;
for (const separator of this._separatorRenderer.visibleSeparators) {
if (separator !== parent) {
continue;
}
const currentMouse = !!(separator.focusInsideSeparator & QuickPickSeparatorFocusReason.MOUSE_HOVER);
if (!currentMouse) {
separator.focusInsideSeparator |= QuickPickSeparatorFocusReason.MOUSE_HOVER;
this._tree.rerender(separator);
}
}
}));
this._register(this._tree.onMouseOut((e) => {
const parent = e.element ? this._tree.getParentElement(e.element) : null;
for (const separator of this._separatorRenderer.visibleSeparators) {
if (separator !== parent) {
continue;
}
const currentMouse = !!(separator.focusInsideSeparator & QuickPickSeparatorFocusReason.MOUSE_HOVER);
if (currentMouse) {
separator.focusInsideSeparator &= ~QuickPickSeparatorFocusReason.MOUSE_HOVER;
this._tree.rerender(separator);
}
}
}));
}
_registerSelectionChangeListener() {
this._register(this._tree.onDidChangeSelection((e) => {
const elementsWithoutSeparators = e.elements.filter((e2) => e2 instanceof QuickPickItemElement);
if (elementsWithoutSeparators.length !== e.elements.length) {
if (e.elements.length === 1 && e.elements[0] instanceof QuickPickSeparatorElement) {
this._tree.setFocus([e.elements[0].children[0]]);
this._tree.reveal(e.elements[0], 0);
}
this._tree.setSelection(elementsWithoutSeparators);
}
}));
}
//#endregion
//#region public methods
getAllVisibleChecked() {
return this._allVisibleChecked(this._itemElements, false);
}
getCheckedCount() {
return this._itemElements.filter((element) => element.checked).length;
}
getVisibleCount() {
return this._itemElements.filter((e) => !e.hidden).length;
}
setAllVisibleChecked(checked) {
try {
this._shouldFireCheckedEvents = false;
this._itemElements.forEach((element) => {
if (!element.hidden && !element.checkboxDisabled) {
element.checked = checked;
}
});
} finally {
this._shouldFireCheckedEvents = true;
this._fireCheckedEvents();
}
}
setElements(inputElements) {
this._elementDisposable.clear();
this._inputElements = inputElements;
const hasCheckbox = this.parent.classList.contains("show-checkboxes");
let currentSeparatorElement;
this._itemElements = new Array();
this._elementTree = inputElements.reduce((result, item, index) => {
let element;
if (item.type === "separator") {
if (!item.buttons) {
return result;
}
currentSeparatorElement = new QuickPickSeparatorElement(index, (event) => this.fireSeparatorButtonTriggered(event), item);
element = currentSeparatorElement;
} else {
const previous = index > 0 ? inputElements[index - 1] : void 0;
let separator;
if (previous && previous.type === "separator" && !previous.buttons) {
currentSeparatorElement = void 0;
separator = previous;
}
const qpi = new QuickPickItemElement(index, hasCheckbox, (event) => this.fireButtonTriggered(event), this._elementChecked, item, separator);
this._itemElements.push(qpi);
if (currentSeparatorElement) {
currentSeparatorElement.children.push(qpi);
return result;
}
element = qpi;
}
result.push(element);
return result;
}, new Array());
const elements = new Array();
let visibleCount = 0;
for (const element of this._elementTree) {
if (element instanceof QuickPickSeparatorElement) {
elements.push({
element,
collapsible: false,
collapsed: false,
children: element.children.map((e) => ({
element: e,
collapsible: false,
collapsed: false
}))
});
visibleCount += element.children.length + 1;
} else {
elements.push({
element,
collapsible: false,
collapsed: false
});
visibleCount++;
}
}
this._tree.setChildren(null, elements);
this._onChangedVisibleCount.fire(visibleCount);
if (this.accessibilityService.isScreenReaderOptimized()) {
setTimeout(() => {
const focusedElement = this._tree.getHTMLElement().querySelector(`.monaco-list-row.focused`);
const parent = focusedElement === null || focusedElement === void 0 ? void 0 : focusedElement.parentNode;
if (focusedElement && parent) {
const nextSibling = focusedElement.nextSibling;
parent.removeChild(focusedElement);
parent.insertBefore(focusedElement, nextSibling);
}
}, 0);
}
}
setFocusedElements(items) {
const elements = items.map((item) => this._itemElements.find((e) => e.item === item)).filter((e) => !!e);
this._tree.setFocus(elements);
if (items.length > 0) {
const focused = this._tree.getFocus()[0];
if (focused) {
this._tree.reveal(focused);
}
}
}
getActiveDescendant() {
return this._tree.getHTMLElement().getAttribute("aria-activedescendant");
}
setSelectedElements(items) {
const elements = items.map((item) => this._itemElements.find((e) => e.item === item)).filter((e) => !!e);
this._tree.setSelection(elements);
}
getCheckedElements() {
return this._itemElements.filter((e) => e.checked).map((e) => e.item);
}
setCheckedElements(items) {
try {
this._shouldFireCheckedEvents = false;
const checked = /* @__PURE__ */ new Set();
for (const item of items) {
checked.add(item);
}
for (const element of this._itemElements) {
element.checked = checked.has(element.item);
}
} finally {
this._shouldFireCheckedEvents = true;
this._fireCheckedEvents();
}
}
focus(what) {
var _a10;
if (!this._itemElements.length) {
return;
}
if (what === QuickPickFocus.Second && this._itemElements.length < 2) {
what = QuickPickFocus.First;
}
switch (what) {
case QuickPickFocus.First:
this._tree.scrollTop = 0;
this._tree.focusFirst(void 0, (e) => e.element instanceof QuickPickItemElement);
break;
case QuickPickFocus.Second:
this._tree.scrollTop = 0;
this._tree.setFocus([this._itemElements[1]]);
break;
case QuickPickFocus.Last:
this._tree.scrollTop = this._tree.scrollHeight;
this._tree.setFocus([this._itemElements[this._itemElements.length - 1]]);
break;
case QuickPickFocus.Next: {
const prevFocus = this._tree.getFocus();
this._tree.focusNext(void 0, this._shouldLoop, void 0, (e) => {
if (!(e.element instanceof QuickPickItemElement)) {
return false;
}
this._tree.reveal(e.element);
return true;
});
const currentFocus = this._tree.getFocus();
if (prevFocus.length && prevFocus[0] === currentFocus[0] && prevFocus[0] === this._itemElements[this._itemElements.length - 1]) {
this._onLeave.fire();
}
break;
}
case QuickPickFocus.Previous: {
const prevFocus = this._tree.getFocus();
this._tree.focusPrevious(void 0, this._shouldLoop, void 0, (e) => {
if (!(e.element instanceof QuickPickItemElement)) {
return false;
}
const parent = this._tree.getParentElement(e.element);
if (parent === null || parent.children[0] !== e.element) {
this._tree.reveal(e.element);
} else {
this._tree.reveal(parent);
}
return true;
});
const currentFocus = this._tree.getFocus();
if (prevFocus.length && prevFocus[0] === currentFocus[0] && prevFocus[0] === this._itemElements[0]) {
this._onLeave.fire();
}
break;
}
case QuickPickFocus.NextPage:
this._tree.focusNextPage(void 0, (e) => {
if (!(e.element instanceof QuickPickItemElement)) {
return false;
}
this._tree.reveal(e.element);
return true;
});
break;
case QuickPickFocus.PreviousPage:
this._tree.focusPreviousPage(void 0, (e) => {
if (!(e.element instanceof QuickPickItemElement)) {
return false;
}
const parent = this._tree.getParentElement(e.element);
if (parent === null || parent.children[0] !== e.element) {
this._tree.reveal(e.element);
} else {
this._tree.reveal(parent);
}
return true;
});
break;
case QuickPickFocus.NextSeparator: {
let foundSeparatorAsItem = false;
const before = this._tree.getFocus()[0];
this._tree.focusNext(void 0, true, void 0, (e) => {
if (foundSeparatorAsItem) {
return true;
}
if (e.element instanceof QuickPickSeparatorElement) {
foundSeparatorAsItem = true;
if (this._separatorRenderer.isSeparatorVisible(e.element)) {
this._tree.reveal(e.element.children[0]);
} else {
this._tree.reveal(e.element, 0);
}
} else if (e.element instanceof QuickPickItemElement) {
if (e.element.separator) {
if (this._itemRenderer.isItemWithSeparatorVisible(e.element)) {
this._tree.reveal(e.element);
} else {
this._tree.reveal(e.element, 0);
}
return true;
} else if (e.element === this._elementTree[0]) {
this._tree.reveal(e.element, 0);
return true;
}
}
return false;
});
const after2 = this._tree.getFocus()[0];
if (before === after2) {
this._tree.scrollTop = this._tree.scrollHeight;
this._tree.setFocus([this._itemElements[this._itemElements.length - 1]]);
}
break;
}
case QuickPickFocus.PreviousSeparator: {
let focusElement;
let foundSeparator = !!((_a10 = this._tree.getFocus()[0]) === null || _a10 === void 0 ? void 0 : _a10.separator);
this._tree.focusPrevious(void 0, true, void 0, (e) => {
if (e.element instanceof QuickPickSeparatorElement) {
if (foundSeparator) {
if (!focusElement) {
if (this._separatorRenderer.isSeparatorVisible(e.element)) {
this._tree.reveal(e.element);
} else {
this._tree.reveal(e.element, 0);
}
focusElement = e.element.children[0];
}
} else {
foundSeparator = true;
}
} else if (e.element instanceof QuickPickItemElement) {
if (!focusElement) {
if (e.element.separator) {
if (this._itemRenderer.isItemWithSeparatorVisible(e.element)) {
this._tree.reveal(e.element);
} else {
this._tree.reveal(e.element, 0);
}
focusElement = e.element;
} else if (e.element === this._elementTree[0]) {
this._tree.reveal(e.element, 0);
return true;
}
}
}
return false;
});
if (focusElement) {
this._tree.setFocus([focusElement]);
}
break;
}
}
}
clearFocus() {
this._tree.setFocus([]);
}
domFocus() {
this._tree.domFocus();
}
layout(maxHeight) {
this._tree.getHTMLElement().style.maxHeight = maxHeight ? `${// Make sure height aligns with list item heights
Math.floor(maxHeight / 44) * 44 + 6}px` : "";
this._tree.layout();
}
filter(query) {
if (!(this._sortByLabel || this._matchOnLabel || this._matchOnDescription || this._matchOnDetail)) {
this._tree.layout();
return false;
}
const queryWithWhitespace = query;
query = query.trim();
if (!query || !(this.matchOnLabel || this.matchOnDescription || this.matchOnDetail)) {
this._itemElements.forEach((element) => {
element.labelHighlights = void 0;
element.descriptionHighlights = void 0;
element.detailHighlights = void 0;
element.hidden = false;
const previous = element.index && this._inputElements[element.index - 1];
if (element.item) {
element.separator = previous && previous.type === "separator" && !previous.buttons ? previous : void 0;
}
});
} else {
let currentSeparator2;
this._elementTree.forEach((element) => {
var _a10, _b4, _c2, _d2;
let labelHighlights;
if (this.matchOnLabelMode === "fuzzy") {
labelHighlights = this.matchOnLabel ? (_a10 = matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneLabel))) !== null && _a10 !== void 0 ? _a10 : void 0 : void 0;
} else {
labelHighlights = this.matchOnLabel ? (_b4 = matchesContiguousIconAware(queryWithWhitespace, parseLabelWithIcons(element.saneLabel))) !== null && _b4 !== void 0 ? _b4 : void 0 : void 0;
}
const descriptionHighlights = this.matchOnDescription ? (_c2 = matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneDescription || ""))) !== null && _c2 !== void 0 ? _c2 : void 0 : void 0;
const detailHighlights = this.matchOnDetail ? (_d2 = matchesFuzzyIconAware(query, parseLabelWithIcons(element.saneDetail || ""))) !== null && _d2 !== void 0 ? _d2 : void 0 : void 0;
if (labelHighlights || descriptionHighlights || detailHighlights) {
element.labelHighlights = labelHighlights;
element.descriptionHighlights = descriptionHighlights;
element.detailHighlights = detailHighlights;
element.hidden = false;
} else {
element.labelHighlights = void 0;
element.descriptionHighlights = void 0;
element.detailHighlights = void 0;
element.hidden = element.item ? !element.item.alwaysShow : true;
}
if (element.item) {
element.separator = void 0;
} else if (element.separator) {
element.hidden = true;
}
if (!this.sortByLabel) {
const previous = element.index && this._inputElements[element.index - 1];
currentSeparator2 = previous && previous.type === "separator" ? previous : currentSeparator2;
if (currentSeparator2 && !element.hidden) {
element.separator = currentSeparator2;
currentSeparator2 = void 0;
}
}
});
}
const shownElements = this._elementTree.filter((element) => !element.hidden);
if (this.sortByLabel && query) {
const normalizedSearchValue = query.toLowerCase();
shownElements.sort((a3, b) => {
return compareEntries(a3, b, normalizedSearchValue);
});
}
let currentSeparator;
const finalElements = shownElements.reduce((result, element, index) => {
if (element instanceof QuickPickItemElement) {
if (currentSeparator) {
currentSeparator.children.push(element);
} else {
result.push(element);
}
} else if (element instanceof QuickPickSeparatorElement) {
element.children = [];
currentSeparator = element;
result.push(element);
}
return result;
}, new Array());
const elements = new Array();
for (const element of finalElements) {
if (element instanceof QuickPickSeparatorElement) {
elements.push({
element,
collapsible: false,
collapsed: false,
children: element.children.map((e) => ({
element: e,
collapsible: false,
collapsed: false
}))
});
} else {
elements.push({
element,
collapsible: false,
collapsed: false
});
}
}
this._tree.setChildren(null, elements);
this._tree.layout();
this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked());
this._onChangedVisibleCount.fire(shownElements.length);
return true;
}
toggleCheckbox() {
try {
this._shouldFireCheckedEvents = false;
const elements = this._tree.getFocus().filter((e) => e instanceof QuickPickItemElement);
const allChecked = this._allVisibleChecked(elements);
for (const element of elements) {
if (!element.checkboxDisabled) {
element.checked = !allChecked;
}
}
} finally {
this._shouldFireCheckedEvents = true;
this._fireCheckedEvents();
}
}
display(display) {
this._container.style.display = display ? "" : "none";
}
isDisplayed() {
return this._container.style.display !== "none";
}
style(styles) {
this._tree.style(styles);
}
toggleHover() {
const focused = this._tree.getFocus()[0];
if (!(focused === null || focused === void 0 ? void 0 : focused.saneTooltip) || !(focused instanceof QuickPickItemElement)) {
return;
}
if (this._lastHover && !this._lastHover.isDisposed) {
this._lastHover.dispose();
return;
}
this.showHover(focused);
const store = new DisposableStore();
store.add(this._tree.onDidChangeFocus((e) => {
if (e.elements[0] instanceof QuickPickItemElement) {
this.showHover(e.elements[0]);
}
}));
if (this._lastHover) {
store.add(this._lastHover);
}
this._elementDisposable.add(store);
}
//#endregion
//#region private methods
_allVisibleChecked(elements, whenNoneVisible = true) {
for (let i = 0, n = elements.length; i < n; i++) {
const element = elements[i];
if (!element.hidden) {
if (!element.checked) {
return false;
} else {
whenNoneVisible = true;
}
}
}
return whenNoneVisible;
}
_fireCheckedEvents() {
if (!this._shouldFireCheckedEvents) {
return;
}
this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked());
this._onChangedCheckedCount.fire(this.getCheckedCount());
this._onChangedCheckedElements.fire(this.getCheckedElements());
}
fireButtonTriggered(event) {
this._onButtonTriggered.fire(event);
}
fireSeparatorButtonTriggered(event) {
this._onSeparatorButtonTriggered.fire(event);
}
/**
* Disposes of the hover and shows a new one for the given index if it has a tooltip.
* @param element The element to show the hover for
*/
showHover(element) {
var _a10, _b4, _c2;
if (this._lastHover && !this._lastHover.isDisposed) {
(_b4 = (_a10 = this.hoverDelegate).onDidHideHover) === null || _b4 === void 0 ? void 0 : _b4.call(_a10);
(_c2 = this._lastHover) === null || _c2 === void 0 ? void 0 : _c2.dispose();
}
if (!element.element || !element.saneTooltip) {
return;
}
this._lastHover = this.hoverDelegate.showHover({
content: element.saneTooltip,
target: element.element,
linkHandler: (url) => {
this.linkOpenerDelegate(url);
},
appearance: {
showPointer: true
},
container: this._container,
position: {
hoverPosition: 1
/* HoverPosition.RIGHT */
}
}, false);
}
};
__decorate39([
memoize
], QuickInputTree.prototype, "onDidChangeFocus", null);
__decorate39([
memoize
], QuickInputTree.prototype, "onDidChangeSelection", null);
QuickInputTree = __decorate39([
__param33(4, IInstantiationService),
__param33(5, IAccessibilityService)
], QuickInputTree);
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputActions.js
function registerQuickPickCommandAndKeybindingRule(rule, options2 = {}) {
var _a10;
KeybindingsRegistry.registerCommandAndKeybindingRule(__spreadProps(__spreadValues(__spreadValues({}, defaultCommandAndKeybindingRule), rule), {
secondary: getSecondary(rule.primary, (_a10 = rule.secondary) !== null && _a10 !== void 0 ? _a10 : [], options2)
}));
}
function getSecondary(primary, secondary, options2 = {}) {
if (options2.withAltMod) {
secondary.push(512 + primary);
}
if (options2.withCtrlMod) {
secondary.push(ctrlKeyMod2 + primary);
if (options2.withAltMod) {
secondary.push(512 + ctrlKeyMod2 + primary);
}
}
if (options2.withCmdMod && isMacintosh) {
secondary.push(2048 + primary);
if (options2.withCtrlMod) {
secondary.push(2048 + 256 + primary);
}
if (options2.withAltMod) {
secondary.push(2048 + 512 + primary);
if (options2.withCtrlMod) {
secondary.push(2048 + 512 + 256 + primary);
}
}
}
return secondary;
}
function focusHandler(focus, focusOnQuickNatigate) {
return (accessor) => {
const currentQuickPick = accessor.get(IQuickInputService).currentQuickInput;
if (!currentQuickPick) {
return;
}
if (focusOnQuickNatigate && currentQuickPick.quickNavigate) {
return currentQuickPick.focus(focusOnQuickNatigate);
}
return currentQuickPick.focus(focus);
};
}
var defaultCommandAndKeybindingRule, ctrlKeyMod2, nextSeparatorFallbackDesc, prevSeparatorFallbackDesc;
var init_quickInputActions = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputActions.js"() {
init_platform();
init_nls();
init_contextkey();
init_contextkeys();
init_keybindingsRegistry();
init_quickInput3();
init_quickInput();
defaultCommandAndKeybindingRule = {
weight: 200,
when: ContextKeyExpr.and(ContextKeyExpr.equals(
quickInputTypeContextKeyValue,
"quickPick"
/* QuickInputType.QuickPick */
), inQuickInputContext),
metadata: { description: localize("quickPick", "Used while in the context of the quick pick. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.") }
};
ctrlKeyMod2 = isMacintosh ? 256 : 2048;
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.pageNext", primary: 12, handler: focusHandler(QuickPickFocus.NextPage) }, { withAltMod: true, withCtrlMod: true, withCmdMod: true });
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.pagePrevious", primary: 11, handler: focusHandler(QuickPickFocus.PreviousPage) }, { withAltMod: true, withCtrlMod: true, withCmdMod: true });
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.first", primary: ctrlKeyMod2 + 14, handler: focusHandler(QuickPickFocus.First) }, { withAltMod: true, withCmdMod: true });
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.last", primary: ctrlKeyMod2 + 13, handler: focusHandler(QuickPickFocus.Last) }, { withAltMod: true, withCmdMod: true });
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.next", primary: 18, handler: focusHandler(QuickPickFocus.Next) }, { withCtrlMod: true });
registerQuickPickCommandAndKeybindingRule({ id: "quickInput.previous", primary: 16, handler: focusHandler(QuickPickFocus.Previous) }, { withCtrlMod: true });
nextSeparatorFallbackDesc = localize("quickInput.nextSeparatorWithQuickAccessFallback", "If we're in quick access mode, this will navigate to the next item. If we are not in quick access mode, this will navigate to the next separator.");
prevSeparatorFallbackDesc = localize("quickInput.previousSeparatorWithQuickAccessFallback", "If we're in quick access mode, this will navigate to the previous item. If we are not in quick access mode, this will navigate to the previous separator.");
if (isMacintosh) {
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.nextSeparatorWithQuickAccessFallback",
primary: 2048 + 18,
handler: focusHandler(QuickPickFocus.NextSeparator, QuickPickFocus.Next),
metadata: { description: nextSeparatorFallbackDesc }
});
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.nextSeparator",
primary: 2048 + 512 + 18,
// Since macOS has the cmd key as the primary modifier, we need to add this additional
// keybinding to capture cmd+ctrl+upArrow
secondary: [
2048 + 256 + 18
/* KeyCode.DownArrow */
],
handler: focusHandler(QuickPickFocus.NextSeparator)
}, { withCtrlMod: true });
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.previousSeparatorWithQuickAccessFallback",
primary: 2048 + 16,
handler: focusHandler(QuickPickFocus.PreviousSeparator, QuickPickFocus.Previous),
metadata: { description: prevSeparatorFallbackDesc }
});
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.previousSeparator",
primary: 2048 + 512 + 16,
// Since macOS has the cmd key as the primary modifier, we need to add this additional
// keybinding to capture cmd+ctrl+upArrow
secondary: [
2048 + 256 + 16
/* KeyCode.UpArrow */
],
handler: focusHandler(QuickPickFocus.PreviousSeparator)
}, { withCtrlMod: true });
} else {
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.nextSeparatorWithQuickAccessFallback",
primary: 512 + 18,
handler: focusHandler(QuickPickFocus.NextSeparator, QuickPickFocus.Next),
metadata: { description: nextSeparatorFallbackDesc }
});
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.nextSeparator",
primary: 2048 + 512 + 18,
handler: focusHandler(QuickPickFocus.NextSeparator)
});
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.previousSeparatorWithQuickAccessFallback",
primary: 512 + 16,
handler: focusHandler(QuickPickFocus.PreviousSeparator, QuickPickFocus.Previous),
metadata: { description: prevSeparatorFallbackDesc }
});
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.previousSeparator",
primary: 2048 + 512 + 16,
handler: focusHandler(QuickPickFocus.PreviousSeparator)
});
}
registerQuickPickCommandAndKeybindingRule({
id: "quickInput.acceptInBackground",
// If we are in the quick pick but the input box is not focused or our cursor is at the end of the input box
when: ContextKeyExpr.and(defaultCommandAndKeybindingRule.when, ContextKeyExpr.or(InputFocusedContext.negate(), endOfQuickInputBoxContext)),
primary: 17,
// Need a little extra weight to ensure this keybinding is preferred over the default cmd+alt+right arrow keybinding
// https://github.com/microsoft/vscode/blob/1451e4fbbbf074a4355cc537c35b547b80ce1c52/src/vs/workbench/browser/parts/editor/editorActions.ts#L1178-L1195
weight: 200 + 50,
handler: (accessor) => {
const currentQuickPick = accessor.get(IQuickInputService).currentQuickInput;
currentQuickPick === null || currentQuickPick === void 0 ? void 0 : currentQuickPick.accept(true);
}
}, { withAltMod: true, withCtrlMod: true, withCmdMod: true });
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputController.js
var __decorate40, __param34, QuickInputController_1, $9, QuickInputController;
var init_quickInputController = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputController.js"() {
init_dom();
init_actionbar2();
init_button2();
init_countBadge2();
init_progressbar2();
init_cancellation();
init_event();
init_lifecycle();
init_severity();
init_nls();
init_quickInput();
init_quickInputBox();
init_quickInput3();
init_layoutService();
init_window();
init_instantiation();
init_quickInputTree();
init_contextkey();
init_quickInputActions();
__decorate40 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param34 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
$9 = $;
QuickInputController = QuickInputController_1 = class QuickInputController2 extends Disposable {
get currentQuickInput() {
var _a10;
return (_a10 = this.controller) !== null && _a10 !== void 0 ? _a10 : void 0;
}
get container() {
return this._container;
}
constructor(options2, layoutService, instantiationService, contextKeyService) {
super();
this.options = options2;
this.layoutService = layoutService;
this.instantiationService = instantiationService;
this.contextKeyService = contextKeyService;
this.enabled = true;
this.onDidAcceptEmitter = this._register(new Emitter());
this.onDidCustomEmitter = this._register(new Emitter());
this.onDidTriggerButtonEmitter = this._register(new Emitter());
this.keyMods = { ctrlCmd: false, alt: false };
this.controller = null;
this.onShowEmitter = this._register(new Emitter());
this.onShow = this.onShowEmitter.event;
this.onHideEmitter = this._register(new Emitter());
this.onHide = this.onHideEmitter.event;
this.inQuickInputContext = InQuickInputContextKey.bindTo(this.contextKeyService);
this.quickInputTypeContext = QuickInputTypeContextKey.bindTo(this.contextKeyService);
this.endOfQuickInputBoxContext = EndOfQuickInputBoxContextKey.bindTo(this.contextKeyService);
this.idPrefix = options2.idPrefix;
this._container = options2.container;
this.styles = options2.styles;
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window: window2, disposables }) => this.registerKeyModsListeners(window2, disposables), { window: mainWindow, disposables: this._store }));
this._register(onWillUnregisterWindow((window2) => {
if (this.ui && getWindow(this.ui.container) === window2) {
this.reparentUI(this.layoutService.mainContainer);
this.layout(this.layoutService.mainContainerDimension, this.layoutService.mainContainerOffset.quickPickTop);
}
}));
}
registerKeyModsListeners(window2, disposables) {
const listener = (e) => {
this.keyMods.ctrlCmd = e.ctrlKey || e.metaKey;
this.keyMods.alt = e.altKey;
};
for (const event of [EventType.KEY_DOWN, EventType.KEY_UP, EventType.MOUSE_DOWN]) {
disposables.add(addDisposableListener(window2, event, listener, true));
}
}
getUI(showInActiveContainer) {
if (this.ui) {
if (showInActiveContainer) {
if (getWindow(this._container) !== getWindow(this.layoutService.activeContainer)) {
this.reparentUI(this.layoutService.activeContainer);
this.layout(this.layoutService.activeContainerDimension, this.layoutService.activeContainerOffset.quickPickTop);
}
}
return this.ui;
}
const container = append(this._container, $9(".quick-input-widget.show-file-icons"));
container.tabIndex = -1;
container.style.display = "none";
const styleSheet = createStyleSheet(container);
const titleBar = append(container, $9(".quick-input-titlebar"));
const leftActionBar = this._register(new ActionBar(titleBar, { hoverDelegate: this.options.hoverDelegate }));
leftActionBar.domNode.classList.add("quick-input-left-action-bar");
const title = append(titleBar, $9(".quick-input-title"));
const rightActionBar = this._register(new ActionBar(titleBar, { hoverDelegate: this.options.hoverDelegate }));
rightActionBar.domNode.classList.add("quick-input-right-action-bar");
const headerContainer = append(container, $9(".quick-input-header"));
const checkAll = append(headerContainer, $9("input.quick-input-check-all"));
checkAll.type = "checkbox";
checkAll.setAttribute("aria-label", localize("quickInput.checkAll", "Toggle all checkboxes"));
this._register(addStandardDisposableListener(checkAll, EventType.CHANGE, (e) => {
const checked = checkAll.checked;
list.setAllVisibleChecked(checked);
}));
this._register(addDisposableListener(checkAll, EventType.CLICK, (e) => {
if (e.x || e.y) {
inputBox.setFocus();
}
}));
const description2 = append(headerContainer, $9(".quick-input-description"));
const inputContainer = append(headerContainer, $9(".quick-input-and-message"));
const filterContainer = append(inputContainer, $9(".quick-input-filter"));
const inputBox = this._register(new QuickInputBox(filterContainer, this.styles.inputBox, this.styles.toggle));
inputBox.setAttribute("aria-describedby", `${this.idPrefix}message`);
const visibleCountContainer = append(filterContainer, $9(".quick-input-visible-count"));
visibleCountContainer.setAttribute("aria-live", "polite");
visibleCountContainer.setAttribute("aria-atomic", "true");
const visibleCount = new CountBadge(visibleCountContainer, { countFormat: localize({ 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);
const countContainer = append(filterContainer, $9(".quick-input-count"));
countContainer.setAttribute("aria-live", "polite");
const count = new CountBadge(countContainer, { countFormat: localize({ 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);
const okContainer = append(headerContainer, $9(".quick-input-action"));
const ok2 = this._register(new Button(okContainer, this.styles.button));
ok2.label = localize("ok", "OK");
this._register(ok2.onDidClick((e) => {
this.onDidAcceptEmitter.fire();
}));
const customButtonContainer = append(headerContainer, $9(".quick-input-action"));
const customButton = this._register(new Button(customButtonContainer, __spreadProps(__spreadValues({}, this.styles.button), { supportIcons: true })));
customButton.label = localize("custom", "Custom");
this._register(customButton.onDidClick((e) => {
this.onDidCustomEmitter.fire();
}));
const message = append(inputContainer, $9(`#${this.idPrefix}message.quick-input-message`));
const progressBar = this._register(new ProgressBar(container, this.styles.progressBar));
progressBar.getContainer().classList.add("quick-input-progress");
const widget = append(container, $9(".quick-input-html-widget"));
widget.tabIndex = -1;
const description1 = append(container, $9(".quick-input-description"));
const listId = this.idPrefix + "list";
const list = this._register(this.instantiationService.createInstance(QuickInputTree, container, this.options.hoverDelegate, this.options.linkOpenerDelegate, listId));
inputBox.setAttribute("aria-controls", listId);
this._register(list.onDidChangeFocus(() => {
var _a10;
inputBox.setAttribute("aria-activedescendant", (_a10 = list.getActiveDescendant()) !== null && _a10 !== void 0 ? _a10 : "");
}));
this._register(list.onChangedAllVisibleChecked((checked) => {
checkAll.checked = checked;
}));
this._register(list.onChangedVisibleCount((c) => {
visibleCount.setCount(c);
}));
this._register(list.onChangedCheckedCount((c) => {
count.setCount(c);
}));
this._register(list.onLeave(() => {
setTimeout(() => {
if (!this.controller) {
return;
}
inputBox.setFocus();
if (this.controller instanceof QuickPick && this.controller.canSelectMany) {
list.clearFocus();
}
}, 0);
}));
const focusTracker = trackFocus(container);
this._register(focusTracker);
this._register(addDisposableListener(container, EventType.FOCUS, (e) => {
const ui = this.getUI();
if (isAncestor(e.relatedTarget, ui.inputContainer)) {
const value = ui.inputBox.isSelectionAtEnd();
if (this.endOfQuickInputBoxContext.get() !== value) {
this.endOfQuickInputBoxContext.set(value);
}
}
if (isAncestor(e.relatedTarget, ui.container)) {
return;
}
this.inQuickInputContext.set(true);
this.previousFocusElement = isHTMLElement(e.relatedTarget) ? e.relatedTarget : void 0;
}, true));
this._register(focusTracker.onDidBlur(() => {
if (!this.getUI().ignoreFocusOut && !this.options.ignoreFocusOut()) {
this.hide(QuickInputHideReason.Blur);
}
this.inQuickInputContext.set(false);
this.endOfQuickInputBoxContext.set(false);
this.previousFocusElement = void 0;
}));
this._register(inputBox.onKeyDown((_) => {
const value = this.getUI().inputBox.isSelectionAtEnd();
if (this.endOfQuickInputBoxContext.get() !== value) {
this.endOfQuickInputBoxContext.set(value);
}
}));
this._register(addDisposableListener(container, EventType.FOCUS, (e) => {
inputBox.setFocus();
}));
this._register(addStandardDisposableListener(container, EventType.KEY_DOWN, (event) => {
if (isAncestor(event.target, widget)) {
return;
}
switch (event.keyCode) {
case 3:
EventHelper.stop(event, true);
if (this.enabled) {
this.onDidAcceptEmitter.fire();
}
break;
case 9:
EventHelper.stop(event, true);
this.hide(QuickInputHideReason.Gesture);
break;
case 2:
if (!event.altKey && !event.ctrlKey && !event.metaKey) {
const selectors = [
".quick-input-list .monaco-action-bar .always-visible",
".quick-input-list-entry:hover .monaco-action-bar",
".monaco-list-row.focused .monaco-action-bar"
];
if (container.classList.contains("show-checkboxes")) {
selectors.push("input");
} else {
selectors.push("input[type=text]");
}
if (this.getUI().list.isDisplayed()) {
selectors.push(".monaco-list");
}
if (this.getUI().message) {
selectors.push(".quick-input-message a");
}
if (this.getUI().widget) {
if (isAncestor(event.target, this.getUI().widget)) {
break;
}
selectors.push(".quick-input-html-widget");
}
const stops = container.querySelectorAll(selectors.join(", "));
if (event.shiftKey && event.target === stops[0]) {
EventHelper.stop(event, true);
list.clearFocus();
} else if (!event.shiftKey && isAncestor(event.target, stops[stops.length - 1])) {
EventHelper.stop(event, true);
stops[0].focus();
}
}
break;
case 10:
if (event.ctrlKey) {
EventHelper.stop(event, true);
this.getUI().list.toggleHover();
}
break;
}
}));
this.ui = {
container,
styleSheet,
leftActionBar,
titleBar,
title,
description1,
description2,
widget,
rightActionBar,
checkAll,
inputContainer,
filterContainer,
inputBox,
visibleCountContainer,
visibleCount,
countContainer,
count,
okContainer,
ok: ok2,
message,
customButtonContainer,
customButton,
list,
progressBar,
onDidAccept: this.onDidAcceptEmitter.event,
onDidCustom: this.onDidCustomEmitter.event,
onDidTriggerButton: this.onDidTriggerButtonEmitter.event,
ignoreFocusOut: false,
keyMods: this.keyMods,
show: (controller) => this.show(controller),
hide: () => this.hide(),
setVisibilities: (visibilities) => this.setVisibilities(visibilities),
setEnabled: (enabled) => this.setEnabled(enabled),
setContextKey: (contextKey) => this.options.setContextKey(contextKey),
linkOpenerDelegate: (content) => this.options.linkOpenerDelegate(content)
};
this.updateStyles();
return this.ui;
}
reparentUI(container) {
if (this.ui) {
this._container = container;
append(this._container, this.ui.container);
}
}
pick(picks, options2 = {}, token = CancellationToken.None) {
return new Promise((doResolve, reject) => {
let resolve2 = (result) => {
var _a10;
resolve2 = doResolve;
(_a10 = options2.onKeyMods) === null || _a10 === void 0 ? void 0 : _a10.call(options2, input.keyMods);
doResolve(result);
};
if (token.isCancellationRequested) {
resolve2(void 0);
return;
}
const input = this.createQuickPick();
let activeItem;
const disposables = [
input,
input.onDidAccept(() => {
if (input.canSelectMany) {
resolve2(input.selectedItems.slice());
input.hide();
} else {
const result = input.activeItems[0];
if (result) {
resolve2(result);
input.hide();
}
}
}),
input.onDidChangeActive((items) => {
const focused = items[0];
if (focused && options2.onDidFocus) {
options2.onDidFocus(focused);
}
}),
input.onDidChangeSelection((items) => {
if (!input.canSelectMany) {
const result = items[0];
if (result) {
resolve2(result);
input.hide();
}
}
}),
input.onDidTriggerItemButton((event) => options2.onDidTriggerItemButton && options2.onDidTriggerItemButton(__spreadProps(__spreadValues({}, event), {
removeItem: () => {
const index = input.items.indexOf(event.item);
if (index !== -1) {
const items = input.items.slice();
const removed = items.splice(index, 1);
const activeItems = input.activeItems.filter((activeItem2) => activeItem2 !== removed[0]);
const keepScrollPositionBefore = input.keepScrollPosition;
input.keepScrollPosition = true;
input.items = items;
if (activeItems) {
input.activeItems = activeItems;
}
input.keepScrollPosition = keepScrollPositionBefore;
}
}
}))),
input.onDidTriggerSeparatorButton((event) => {
var _a10;
return (_a10 = options2.onDidTriggerSeparatorButton) === null || _a10 === void 0 ? void 0 : _a10.call(options2, event);
}),
input.onDidChangeValue((value) => {
if (activeItem && !value && (input.activeItems.length !== 1 || input.activeItems[0] !== activeItem)) {
input.activeItems = [activeItem];
}
}),
token.onCancellationRequested(() => {
input.hide();
}),
input.onDidHide(() => {
dispose(disposables);
resolve2(void 0);
})
];
input.title = options2.title;
input.canSelectMany = !!options2.canPickMany;
input.placeholder = options2.placeHolder;
input.ignoreFocusOut = !!options2.ignoreFocusLost;
input.matchOnDescription = !!options2.matchOnDescription;
input.matchOnDetail = !!options2.matchOnDetail;
input.matchOnLabel = options2.matchOnLabel === void 0 || options2.matchOnLabel;
input.quickNavigate = options2.quickNavigate;
input.hideInput = !!options2.hideInput;
input.contextKey = options2.contextKey;
input.busy = true;
Promise.all([picks, options2.activeItem]).then(([items, _activeItem]) => {
activeItem = _activeItem;
input.busy = false;
input.items = items;
if (input.canSelectMany) {
input.selectedItems = items.filter((item) => item.type !== "separator" && item.picked);
}
if (activeItem) {
input.activeItems = [activeItem];
}
});
input.show();
Promise.resolve(picks).then(void 0, (err) => {
reject(err);
input.hide();
});
});
}
createQuickPick() {
const ui = this.getUI(true);
return new QuickPick(ui);
}
createInputBox() {
const ui = this.getUI(true);
return new InputBox(ui);
}
show(controller) {
const ui = this.getUI(true);
this.onShowEmitter.fire();
const oldController = this.controller;
this.controller = controller;
oldController === null || oldController === void 0 ? void 0 : oldController.didHide();
this.setEnabled(true);
ui.leftActionBar.clear();
ui.title.textContent = "";
ui.description1.textContent = "";
ui.description2.textContent = "";
reset(ui.widget);
ui.rightActionBar.clear();
ui.checkAll.checked = false;
ui.inputBox.placeholder = "";
ui.inputBox.password = false;
ui.inputBox.showDecoration(severity_default.Ignore);
ui.visibleCount.setCount(0);
ui.count.setCount(0);
reset(ui.message);
ui.progressBar.stop();
ui.list.setElements([]);
ui.list.matchOnDescription = false;
ui.list.matchOnDetail = false;
ui.list.matchOnLabel = true;
ui.list.sortByLabel = true;
ui.ignoreFocusOut = false;
ui.inputBox.toggles = void 0;
const backKeybindingLabel = this.options.backKeybindingLabel();
backButton.tooltip = backKeybindingLabel ? localize("quickInput.backWithKeybinding", "Back ({0})", backKeybindingLabel) : localize("quickInput.back", "Back");
ui.container.style.display = "";
this.updateLayout();
ui.inputBox.setFocus();
this.quickInputTypeContext.set(controller.type);
}
isVisible() {
return !!this.ui && this.ui.container.style.display !== "none";
}
setVisibilities(visibilities) {
const ui = this.getUI();
ui.title.style.display = visibilities.title ? "" : "none";
ui.description1.style.display = visibilities.description && (visibilities.inputBox || visibilities.checkAll) ? "" : "none";
ui.description2.style.display = visibilities.description && !(visibilities.inputBox || visibilities.checkAll) ? "" : "none";
ui.checkAll.style.display = visibilities.checkAll ? "" : "none";
ui.inputContainer.style.display = visibilities.inputBox ? "" : "none";
ui.filterContainer.style.display = visibilities.inputBox ? "" : "none";
ui.visibleCountContainer.style.display = visibilities.visibleCount ? "" : "none";
ui.countContainer.style.display = visibilities.count ? "" : "none";
ui.okContainer.style.display = visibilities.ok ? "" : "none";
ui.customButtonContainer.style.display = visibilities.customButton ? "" : "none";
ui.message.style.display = visibilities.message ? "" : "none";
ui.progressBar.getContainer().style.display = visibilities.progressBar ? "" : "none";
ui.list.display(!!visibilities.list);
ui.container.classList.toggle("show-checkboxes", !!visibilities.checkBox);
ui.container.classList.toggle("hidden-input", !visibilities.inputBox && !visibilities.description);
this.updateLayout();
}
setEnabled(enabled) {
if (enabled !== this.enabled) {
this.enabled = enabled;
for (const item of this.getUI().leftActionBar.viewItems) {
item.action.enabled = enabled;
}
for (const item of this.getUI().rightActionBar.viewItems) {
item.action.enabled = enabled;
}
this.getUI().checkAll.disabled = !enabled;
this.getUI().inputBox.enabled = enabled;
this.getUI().ok.enabled = enabled;
this.getUI().list.enabled = enabled;
}
}
hide(reason) {
var _a10, _b4;
const controller = this.controller;
if (!controller) {
return;
}
controller.willHide(reason);
const container = (_a10 = this.ui) === null || _a10 === void 0 ? void 0 : _a10.container;
const focusChanged = container && !isAncestorOfActiveElement(container);
this.controller = null;
this.onHideEmitter.fire();
if (container) {
container.style.display = "none";
}
if (!focusChanged) {
let currentElement = this.previousFocusElement;
while (currentElement && !currentElement.offsetParent) {
currentElement = (_b4 = currentElement.parentElement) !== null && _b4 !== void 0 ? _b4 : void 0;
}
if (currentElement === null || currentElement === void 0 ? void 0 : currentElement.offsetParent) {
currentElement.focus();
this.previousFocusElement = void 0;
} else {
this.options.returnFocus();
}
}
controller.didHide(reason);
}
layout(dimension, titleBarOffset) {
this.dimension = dimension;
this.titleBarOffset = titleBarOffset;
this.updateLayout();
}
updateLayout() {
if (this.ui && this.isVisible()) {
this.ui.container.style.top = `${this.titleBarOffset}px`;
const style = this.ui.container.style;
const width2 = Math.min(this.dimension.width * 0.62, QuickInputController_1.MAX_WIDTH);
style.width = width2 + "px";
style.marginLeft = "-" + width2 / 2 + "px";
this.ui.inputBox.layout();
this.ui.list.layout(this.dimension && this.dimension.height * 0.4);
}
}
applyStyles(styles) {
this.styles = styles;
this.updateStyles();
}
updateStyles() {
if (this.ui) {
const { quickInputTitleBackground: quickInputTitleBackground2, quickInputBackground: quickInputBackground2, quickInputForeground: quickInputForeground2, widgetBorder: widgetBorder2, widgetShadow: widgetShadow2 } = this.styles.widget;
this.ui.titleBar.style.backgroundColor = quickInputTitleBackground2 !== null && quickInputTitleBackground2 !== void 0 ? quickInputTitleBackground2 : "";
this.ui.container.style.backgroundColor = quickInputBackground2 !== null && quickInputBackground2 !== void 0 ? quickInputBackground2 : "";
this.ui.container.style.color = quickInputForeground2 !== null && quickInputForeground2 !== void 0 ? quickInputForeground2 : "";
this.ui.container.style.border = widgetBorder2 ? `1px solid ${widgetBorder2}` : "";
this.ui.container.style.boxShadow = widgetShadow2 ? `0 0 8px 2px ${widgetShadow2}` : "";
this.ui.list.style(this.styles.list);
const content = [];
if (this.styles.pickerGroup.pickerGroupBorder) {
content.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`);
}
if (this.styles.pickerGroup.pickerGroupForeground) {
content.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`);
}
if (this.styles.pickerGroup.pickerGroupForeground) {
content.push(`.quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }`);
}
if (this.styles.keybindingLabel.keybindingLabelBackground || this.styles.keybindingLabel.keybindingLabelBorder || this.styles.keybindingLabel.keybindingLabelBottomBorder || this.styles.keybindingLabel.keybindingLabelShadow || this.styles.keybindingLabel.keybindingLabelForeground) {
content.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {");
if (this.styles.keybindingLabel.keybindingLabelBackground) {
content.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`);
}
if (this.styles.keybindingLabel.keybindingLabelBorder) {
content.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`);
}
if (this.styles.keybindingLabel.keybindingLabelBottomBorder) {
content.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`);
}
if (this.styles.keybindingLabel.keybindingLabelShadow) {
content.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`);
}
if (this.styles.keybindingLabel.keybindingLabelForeground) {
content.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`);
}
content.push("}");
}
const newStyles = content.join("\n");
if (newStyles !== this.ui.styleSheet.textContent) {
this.ui.styleSheet.textContent = newStyles;
}
}
}
};
QuickInputController.MAX_WIDTH = 600;
QuickInputController = QuickInputController_1 = __decorate40([
__param34(1, ILayoutService),
__param34(2, IInstantiationService),
__param34(3, IContextKeyService)
], QuickInputController);
}
});
// node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputService.js
var __decorate41, __param35, QuickInputService;
var init_quickInputService = __esm({
"node_modules/monaco-editor/esm/vs/platform/quickinput/browser/quickInputService.js"() {
init_cancellation();
init_event();
init_contextkey();
init_instantiation();
init_layoutService();
init_opener();
init_quickAccess2();
init_defaultStyles();
init_colorRegistry();
init_themeService();
init_quickInput3();
init_quickInputController();
init_configuration();
init_dom();
__decorate41 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param35 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
QuickInputService = class QuickInputService2 extends Themable {
get controller() {
if (!this._controller) {
this._controller = this._register(this.createController());
}
return this._controller;
}
get hasController() {
return !!this._controller;
}
get currentQuickInput() {
return this.controller.currentQuickInput;
}
get quickAccess() {
if (!this._quickAccess) {
this._quickAccess = this._register(this.instantiationService.createInstance(QuickAccessController));
}
return this._quickAccess;
}
constructor(instantiationService, contextKeyService, themeService, layoutService, configurationService) {
super(themeService);
this.instantiationService = instantiationService;
this.contextKeyService = contextKeyService;
this.layoutService = layoutService;
this.configurationService = configurationService;
this._onShow = this._register(new Emitter());
this._onHide = this._register(new Emitter());
this.contexts = /* @__PURE__ */ new Map();
}
createController(host = this.layoutService, options2) {
const defaultOptions3 = {
idPrefix: "quickInput_",
container: host.activeContainer,
ignoreFocusOut: () => false,
backKeybindingLabel: () => void 0,
setContextKey: (id) => this.setContextKey(id),
linkOpenerDelegate: (content) => {
this.instantiationService.invokeFunction((accessor) => {
const openerService = accessor.get(IOpenerService);
openerService.open(content, { allowCommands: true, fromUserGesture: true });
});
},
returnFocus: () => host.focus(),
styles: this.computeStyles(),
hoverDelegate: this._register(this.instantiationService.createInstance(QuickInputHoverDelegate))
};
const controller = this._register(this.instantiationService.createInstance(QuickInputController, __spreadValues(__spreadValues({}, defaultOptions3), options2)));
controller.layout(host.activeContainerDimension, host.activeContainerOffset.quickPickTop);
this._register(host.onDidLayoutActiveContainer((dimension) => {
if (getWindow(host.activeContainer) === getWindow(controller.container)) {
controller.layout(dimension, host.activeContainerOffset.quickPickTop);
}
}));
this._register(host.onDidChangeActiveContainer(() => {
if (controller.isVisible()) {
return;
}
controller.layout(host.activeContainerDimension, host.activeContainerOffset.quickPickTop);
}));
this._register(controller.onShow(() => {
this.resetContextKeys();
this._onShow.fire();
}));
this._register(controller.onHide(() => {
this.resetContextKeys();
this._onHide.fire();
}));
return controller;
}
setContextKey(id) {
let key;
if (id) {
key = this.contexts.get(id);
if (!key) {
key = new RawContextKey(id, false).bindTo(this.contextKeyService);
this.contexts.set(id, key);
}
}
if (key && key.get()) {
return;
}
this.resetContextKeys();
key === null || key === void 0 ? void 0 : key.set(true);
}
resetContextKeys() {
this.contexts.forEach((context) => {
if (context.get()) {
context.reset();
}
});
}
pick(picks, options2 = {}, token = CancellationToken.None) {
return this.controller.pick(picks, options2, token);
}
createQuickPick() {
return this.controller.createQuickPick();
}
createInputBox() {
return this.controller.createInputBox();
}
updateStyles() {
if (this.hasController) {
this.controller.applyStyles(this.computeStyles());
}
}
computeStyles() {
return {
widget: {
quickInputBackground: asCssVariable(quickInputBackground),
quickInputForeground: asCssVariable(quickInputForeground),
quickInputTitleBackground: asCssVariable(quickInputTitleBackground),
widgetBorder: asCssVariable(widgetBorder),
widgetShadow: asCssVariable(widgetShadow)
},
inputBox: defaultInputBoxStyles,
toggle: defaultToggleStyles,
countBadge: defaultCountBadgeStyles,
button: defaultButtonStyles,
progressBar: defaultProgressBarStyles,
keybindingLabel: defaultKeybindingLabelStyles,
list: getListStyles({
listBackground: quickInputBackground,
listFocusBackground: quickInputListFocusBackground,
listFocusForeground: quickInputListFocusForeground,
// Look like focused when inactive.
listInactiveFocusForeground: quickInputListFocusForeground,
listInactiveSelectionIconForeground: quickInputListFocusIconForeground,
listInactiveFocusBackground: quickInputListFocusBackground,
listFocusOutline: activeContrastBorder,
listInactiveFocusOutline: activeContrastBorder
}),
pickerGroup: {
pickerGroupBorder: asCssVariable(pickerGroupBorder),
pickerGroupForeground: asCssVariable(pickerGroupForeground)
}
};
}
};
QuickInputService = __decorate41([
__param35(0, IInstantiationService),
__param35(1, IContextKeyService),
__param35(2, IThemeService),
__param35(3, ILayoutService),
__param35(4, IConfigurationService)
], QuickInputService);
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js
var __decorate42, __param36, EditorScopedQuickInputService, StandaloneQuickInputService, QuickInputEditorContribution, QuickInputEditorWidget;
var init_standaloneQuickInputService = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js"() {
init_standaloneQuickInput();
init_event();
init_editorExtensions();
init_themeService();
init_cancellation();
init_instantiation();
init_contextkey();
init_standaloneLayoutService();
init_codeEditorService();
init_quickInputService();
init_functional();
init_configuration();
__decorate42 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param36 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
EditorScopedQuickInputService = class EditorScopedQuickInputService2 extends QuickInputService {
constructor(editor2, instantiationService, contextKeyService, themeService, codeEditorService, configurationService) {
super(instantiationService, contextKeyService, themeService, new EditorScopedLayoutService(editor2.getContainerDomNode(), codeEditorService), configurationService);
this.host = void 0;
const contribution = QuickInputEditorContribution.get(editor2);
if (contribution) {
const widget = contribution.widget;
this.host = {
_serviceBrand: void 0,
get mainContainer() {
return widget.getDomNode();
},
getContainer() {
return widget.getDomNode();
},
whenContainerStylesLoaded() {
return void 0;
},
get containers() {
return [widget.getDomNode()];
},
get activeContainer() {
return widget.getDomNode();
},
get mainContainerDimension() {
return editor2.getLayoutInfo();
},
get activeContainerDimension() {
return editor2.getLayoutInfo();
},
get onDidLayoutMainContainer() {
return editor2.onDidLayoutChange;
},
get onDidLayoutActiveContainer() {
return editor2.onDidLayoutChange;
},
get onDidLayoutContainer() {
return Event.map(editor2.onDidLayoutChange, (dimension) => ({ container: widget.getDomNode(), dimension }));
},
get onDidChangeActiveContainer() {
return Event.None;
},
get onDidAddContainer() {
return Event.None;
},
get mainContainerOffset() {
return { top: 0, quickPickTop: 0 };
},
get activeContainerOffset() {
return { top: 0, quickPickTop: 0 };
},
focus: () => editor2.focus()
};
} else {
this.host = void 0;
}
}
createController() {
return super.createController(this.host);
}
};
EditorScopedQuickInputService = __decorate42([
__param36(1, IInstantiationService),
__param36(2, IContextKeyService),
__param36(3, IThemeService),
__param36(4, ICodeEditorService),
__param36(5, IConfigurationService)
], EditorScopedQuickInputService);
StandaloneQuickInputService = class StandaloneQuickInputService2 {
get activeService() {
const editor2 = this.codeEditorService.getFocusedCodeEditor();
if (!editor2) {
throw new Error("Quick input service needs a focused editor to work.");
}
let quickInputService = this.mapEditorToService.get(editor2);
if (!quickInputService) {
const newQuickInputService = quickInputService = this.instantiationService.createInstance(EditorScopedQuickInputService, editor2);
this.mapEditorToService.set(editor2, quickInputService);
createSingleCallFunction(editor2.onDidDispose)(() => {
newQuickInputService.dispose();
this.mapEditorToService.delete(editor2);
});
}
return quickInputService;
}
get currentQuickInput() {
return this.activeService.currentQuickInput;
}
get quickAccess() {
return this.activeService.quickAccess;
}
constructor(instantiationService, codeEditorService) {
this.instantiationService = instantiationService;
this.codeEditorService = codeEditorService;
this.mapEditorToService = /* @__PURE__ */ new Map();
}
pick(picks, options2 = {}, token = CancellationToken.None) {
return this.activeService.pick(picks, options2, token);
}
createQuickPick() {
return this.activeService.createQuickPick();
}
createInputBox() {
return this.activeService.createInputBox();
}
};
StandaloneQuickInputService = __decorate42([
__param36(0, IInstantiationService),
__param36(1, ICodeEditorService)
], StandaloneQuickInputService);
QuickInputEditorContribution = class _QuickInputEditorContribution {
static get(editor2) {
return editor2.getContribution(_QuickInputEditorContribution.ID);
}
constructor(editor2) {
this.editor = editor2;
this.widget = new QuickInputEditorWidget(this.editor);
}
dispose() {
this.widget.dispose();
}
};
QuickInputEditorContribution.ID = "editor.controller.quickInput";
QuickInputEditorWidget = class _QuickInputEditorWidget {
constructor(codeEditor) {
this.codeEditor = codeEditor;
this.domNode = document.createElement("div");
this.codeEditor.addOverlayWidget(this);
}
getId() {
return _QuickInputEditorWidget.ID;
}
getDomNode() {
return this.domNode;
}
getPosition() {
return {
preference: 2
/* OverlayWidgetPositionPreference.TOP_CENTER */
};
}
dispose() {
this.codeEditor.removeOverlayWidget(this);
}
};
QuickInputEditorWidget.ID = "editor.contrib.quickInputWidget";
registerEditorContribution(
QuickInputEditorContribution.ID,
QuickInputEditorContribution,
4
/* EditorContributionInstantiation.Lazy */
);
}
});
// node_modules/monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js
function parseTokenTheme(source) {
if (!source || !Array.isArray(source)) {
return [];
}
const result = [];
let resultLen = 0;
for (let i = 0, len = source.length; i < len; i++) {
const entry = source[i];
let fontStyle = -1;
if (typeof entry.fontStyle === "string") {
fontStyle = 0;
const segments = entry.fontStyle.split(" ");
for (let j = 0, lenJ = segments.length; j < lenJ; j++) {
const segment = segments[j];
switch (segment) {
case "italic":
fontStyle = fontStyle | 1;
break;
case "bold":
fontStyle = fontStyle | 2;
break;
case "underline":
fontStyle = fontStyle | 4;
break;
case "strikethrough":
fontStyle = fontStyle | 8;
break;
}
}
}
let foreground2 = null;
if (typeof entry.foreground === "string") {
foreground2 = entry.foreground;
}
let background = null;
if (typeof entry.background === "string") {
background = entry.background;
}
result[resultLen++] = new ParsedTokenThemeRule(entry.token || "", i, fontStyle, foreground2, background);
}
return result;
}
function resolveParsedTokenThemeRules(parsedThemeRules, customTokenColors) {
parsedThemeRules.sort((a3, b) => {
const r = strcmp(a3.token, b.token);
if (r !== 0) {
return r;
}
return a3.index - b.index;
});
let defaultFontStyle = 0;
let defaultForeground = "000000";
let defaultBackground = "ffffff";
while (parsedThemeRules.length >= 1 && parsedThemeRules[0].token === "") {
const incomingDefaults = parsedThemeRules.shift();
if (incomingDefaults.fontStyle !== -1) {
defaultFontStyle = incomingDefaults.fontStyle;
}
if (incomingDefaults.foreground !== null) {
defaultForeground = incomingDefaults.foreground;
}
if (incomingDefaults.background !== null) {
defaultBackground = incomingDefaults.background;
}
}
const colorMap = new ColorMap();
for (const color of customTokenColors) {
colorMap.getId(color);
}
const foregroundColorId = colorMap.getId(defaultForeground);
const backgroundColorId = colorMap.getId(defaultBackground);
const defaults = new ThemeTrieElementRule(defaultFontStyle, foregroundColorId, backgroundColorId);
const root = new ThemeTrieElement(defaults);
for (let i = 0, len = parsedThemeRules.length; i < len; i++) {
const rule = parsedThemeRules[i];
root.insert(rule.token, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
}
return new TokenTheme(colorMap, root);
}
function toStandardTokenType(tokenType) {
const m = tokenType.match(STANDARD_TOKEN_TYPE_REGEXP);
if (!m) {
return 0;
}
switch (m[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 strcmp(a3, b) {
if (a3 < b) {
return -1;
}
if (a3 > b) {
return 1;
}
return 0;
}
function generateTokensCSSForColorMap(colorMap) {
const rules = [];
for (let i = 1, len = colorMap.length; i < len; i++) {
const color = colorMap[i];
rules[i] = `.mtk${i} { color: ${color}; }`;
}
rules.push(".mtki { font-style: italic; }");
rules.push(".mtkb { font-weight: bold; }");
rules.push(".mtku { text-decoration: underline; text-underline-position: under; }");
rules.push(".mtks { text-decoration: line-through; }");
rules.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }");
return rules.join("\n");
}
var ParsedTokenThemeRule, colorRegExp, ColorMap, TokenTheme, STANDARD_TOKEN_TYPE_REGEXP, ThemeTrieElementRule, ThemeTrieElement;
var init_tokenization = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js"() {
init_color();
ParsedTokenThemeRule = class {
constructor(token, index, fontStyle, foreground2, background) {
this._parsedThemeRuleBrand = void 0;
this.token = token;
this.index = index;
this.fontStyle = fontStyle;
this.foreground = foreground2;
this.background = background;
}
};
colorRegExp = /^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;
ColorMap = class {
constructor() {
this._lastColorId = 0;
this._id2color = [];
this._color2id = /* @__PURE__ */ new Map();
}
getId(color) {
if (color === null) {
return 0;
}
const match2 = color.match(colorRegExp);
if (!match2) {
throw new Error("Illegal value for token color: " + color);
}
color = match2[1].toUpperCase();
let value = this._color2id.get(color);
if (value) {
return value;
}
value = ++this._lastColorId;
this._color2id.set(color, value);
this._id2color[value] = Color.fromHex("#" + color);
return value;
}
getColorMap() {
return this._id2color.slice(0);
}
};
TokenTheme = class {
static createFromRawTokenTheme(source, customTokenColors) {
return this.createFromParsedTokenTheme(parseTokenTheme(source), customTokenColors);
}
static createFromParsedTokenTheme(source, customTokenColors) {
return resolveParsedTokenThemeRules(source, customTokenColors);
}
constructor(colorMap, root) {
this._colorMap = colorMap;
this._root = root;
this._cache = /* @__PURE__ */ new Map();
}
getColorMap() {
return this._colorMap.getColorMap();
}
_match(token) {
return this._root.match(token);
}
match(languageId, token) {
let result = this._cache.get(token);
if (typeof result === "undefined") {
const rule = this._match(token);
const standardToken = toStandardTokenType(token);
result = (rule.metadata | standardToken << 8) >>> 0;
this._cache.set(token, result);
}
return (result | languageId << 0) >>> 0;
}
};
STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|regexp)\b/;
ThemeTrieElementRule = class _ThemeTrieElementRule {
constructor(fontStyle, foreground2, background) {
this._themeTrieElementRuleBrand = void 0;
this._fontStyle = fontStyle;
this._foreground = foreground2;
this._background = background;
this.metadata = (this._fontStyle << 11 | this._foreground << 15 | this._background << 24) >>> 0;
}
clone() {
return new _ThemeTrieElementRule(this._fontStyle, this._foreground, this._background);
}
acceptOverwrite(fontStyle, foreground2, background) {
if (fontStyle !== -1) {
this._fontStyle = fontStyle;
}
if (foreground2 !== 0) {
this._foreground = foreground2;
}
if (background !== 0) {
this._background = background;
}
this.metadata = (this._fontStyle << 11 | this._foreground << 15 | this._background << 24) >>> 0;
}
};
ThemeTrieElement = class _ThemeTrieElement {
constructor(mainRule) {
this._themeTrieElementBrand = void 0;
this._mainRule = mainRule;
this._children = /* @__PURE__ */ new Map();
}
match(token) {
if (token === "") {
return this._mainRule;
}
const dotIndex = token.indexOf(".");
let head;
let tail3;
if (dotIndex === -1) {
head = token;
tail3 = "";
} else {
head = token.substring(0, dotIndex);
tail3 = token.substring(dotIndex + 1);
}
const child = this._children.get(head);
if (typeof child !== "undefined") {
return child.match(tail3);
}
return this._mainRule;
}
insert(token, fontStyle, foreground2, background) {
if (token === "") {
this._mainRule.acceptOverwrite(fontStyle, foreground2, background);
return;
}
const dotIndex = token.indexOf(".");
let head;
let tail3;
if (dotIndex === -1) {
head = token;
tail3 = "";
} else {
head = token.substring(0, dotIndex);
tail3 = token.substring(dotIndex + 1);
}
let child = this._children.get(head);
if (typeof child === "undefined") {
child = new _ThemeTrieElement(this._mainRule.clone());
this._children.set(head, child);
}
child.insert(tail3, fontStyle, foreground2, background);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/common/themes.js
var vs, vs_dark, hc_black, hc_light;
var init_themes = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/common/themes.js"() {
init_editorColorRegistry();
init_colorRegistry();
vs = {
base: "vs",
inherit: false,
rules: [
{ token: "", foreground: "000000", background: "fffffe" },
{ token: "invalid", foreground: "cd3131" },
{ token: "emphasis", fontStyle: "italic" },
{ token: "strong", fontStyle: "bold" },
{ token: "variable", foreground: "001188" },
{ token: "variable.predefined", foreground: "4864AA" },
{ token: "constant", foreground: "dd0000" },
{ token: "comment", foreground: "008000" },
{ token: "number", foreground: "098658" },
{ token: "number.hex", foreground: "3030c0" },
{ token: "regexp", foreground: "800000" },
{ token: "annotation", foreground: "808080" },
{ token: "type", foreground: "008080" },
{ token: "delimiter", foreground: "000000" },
{ token: "delimiter.html", foreground: "383838" },
{ token: "delimiter.xml", foreground: "0000FF" },
{ token: "tag", foreground: "800000" },
{ token: "tag.id.pug", foreground: "4F76AC" },
{ token: "tag.class.pug", foreground: "4F76AC" },
{ token: "meta.scss", foreground: "800000" },
{ token: "metatag", foreground: "e00000" },
{ token: "metatag.content.html", foreground: "FF0000" },
{ token: "metatag.html", foreground: "808080" },
{ token: "metatag.xml", foreground: "808080" },
{ token: "metatag.php", fontStyle: "bold" },
{ token: "key", foreground: "863B00" },
{ token: "string.key.json", foreground: "A31515" },
{ token: "string.value.json", foreground: "0451A5" },
{ token: "attribute.name", foreground: "FF0000" },
{ token: "attribute.value", foreground: "0451A5" },
{ token: "attribute.value.number", foreground: "098658" },
{ token: "attribute.value.unit", foreground: "098658" },
{ token: "attribute.value.html", foreground: "0000FF" },
{ token: "attribute.value.xml", foreground: "0000FF" },
{ token: "string", foreground: "A31515" },
{ token: "string.html", foreground: "0000FF" },
{ token: "string.sql", foreground: "FF0000" },
{ token: "string.yaml", foreground: "0451A5" },
{ token: "keyword", foreground: "0000FF" },
{ token: "keyword.json", foreground: "0451A5" },
{ token: "keyword.flow", foreground: "AF00DB" },
{ token: "keyword.flow.scss", foreground: "0000FF" },
{ token: "operator.scss", foreground: "666666" },
{ token: "operator.sql", foreground: "778899" },
{ token: "operator.swift", foreground: "666666" },
{ token: "predefined.sql", foreground: "C700C7" }
],
colors: {
[editorBackground]: "#FFFFFE",
[editorForeground]: "#000000",
[editorInactiveSelection]: "#E5EBF1",
[editorIndentGuide1]: "#D3D3D3",
[editorActiveIndentGuide1]: "#939393",
[editorSelectionHighlight]: "#ADD6FF4D"
}
};
vs_dark = {
base: "vs-dark",
inherit: false,
rules: [
{ token: "", foreground: "D4D4D4", background: "1E1E1E" },
{ token: "invalid", foreground: "f44747" },
{ token: "emphasis", fontStyle: "italic" },
{ token: "strong", fontStyle: "bold" },
{ token: "variable", foreground: "74B0DF" },
{ token: "variable.predefined", foreground: "4864AA" },
{ token: "variable.parameter", foreground: "9CDCFE" },
{ token: "constant", foreground: "569CD6" },
{ token: "comment", foreground: "608B4E" },
{ token: "number", foreground: "B5CEA8" },
{ token: "number.hex", foreground: "5BB498" },
{ token: "regexp", foreground: "B46695" },
{ token: "annotation", foreground: "cc6666" },
{ token: "type", foreground: "3DC9B0" },
{ token: "delimiter", foreground: "DCDCDC" },
{ token: "delimiter.html", foreground: "808080" },
{ token: "delimiter.xml", foreground: "808080" },
{ token: "tag", foreground: "569CD6" },
{ token: "tag.id.pug", foreground: "4F76AC" },
{ token: "tag.class.pug", foreground: "4F76AC" },
{ token: "meta.scss", foreground: "A79873" },
{ token: "meta.tag", foreground: "CE9178" },
{ token: "metatag", foreground: "DD6A6F" },
{ token: "metatag.content.html", foreground: "9CDCFE" },
{ token: "metatag.html", foreground: "569CD6" },
{ token: "metatag.xml", foreground: "569CD6" },
{ token: "metatag.php", fontStyle: "bold" },
{ token: "key", foreground: "9CDCFE" },
{ token: "string.key.json", foreground: "9CDCFE" },
{ token: "string.value.json", foreground: "CE9178" },
{ token: "attribute.name", foreground: "9CDCFE" },
{ token: "attribute.value", foreground: "CE9178" },
{ token: "attribute.value.number.css", foreground: "B5CEA8" },
{ token: "attribute.value.unit.css", foreground: "B5CEA8" },
{ token: "attribute.value.hex.css", foreground: "D4D4D4" },
{ token: "string", foreground: "CE9178" },
{ token: "string.sql", foreground: "FF0000" },
{ token: "keyword", foreground: "569CD6" },
{ token: "keyword.flow", foreground: "C586C0" },
{ token: "keyword.json", foreground: "CE9178" },
{ token: "keyword.flow.scss", foreground: "569CD6" },
{ token: "operator.scss", foreground: "909090" },
{ token: "operator.sql", foreground: "778899" },
{ token: "operator.swift", foreground: "909090" },
{ token: "predefined.sql", foreground: "FF00FF" }
],
colors: {
[editorBackground]: "#1E1E1E",
[editorForeground]: "#D4D4D4",
[editorInactiveSelection]: "#3A3D41",
[editorIndentGuide1]: "#404040",
[editorActiveIndentGuide1]: "#707070",
[editorSelectionHighlight]: "#ADD6FF26"
}
};
hc_black = {
base: "hc-black",
inherit: false,
rules: [
{ token: "", foreground: "FFFFFF", background: "000000" },
{ token: "invalid", foreground: "f44747" },
{ token: "emphasis", fontStyle: "italic" },
{ token: "strong", fontStyle: "bold" },
{ token: "variable", foreground: "1AEBFF" },
{ token: "variable.parameter", foreground: "9CDCFE" },
{ token: "constant", foreground: "569CD6" },
{ token: "comment", foreground: "608B4E" },
{ token: "number", foreground: "FFFFFF" },
{ token: "regexp", foreground: "C0C0C0" },
{ token: "annotation", foreground: "569CD6" },
{ token: "type", foreground: "3DC9B0" },
{ token: "delimiter", foreground: "FFFF00" },
{ token: "delimiter.html", foreground: "FFFF00" },
{ token: "tag", foreground: "569CD6" },
{ token: "tag.id.pug", foreground: "4F76AC" },
{ token: "tag.class.pug", foreground: "4F76AC" },
{ token: "meta", foreground: "D4D4D4" },
{ token: "meta.tag", foreground: "CE9178" },
{ token: "metatag", foreground: "569CD6" },
{ token: "metatag.content.html", foreground: "1AEBFF" },
{ token: "metatag.html", foreground: "569CD6" },
{ token: "metatag.xml", foreground: "569CD6" },
{ token: "metatag.php", fontStyle: "bold" },
{ token: "key", foreground: "9CDCFE" },
{ token: "string.key", foreground: "9CDCFE" },
{ token: "string.value", foreground: "CE9178" },
{ token: "attribute.name", foreground: "569CD6" },
{ token: "attribute.value", foreground: "3FF23F" },
{ token: "string", foreground: "CE9178" },
{ token: "string.sql", foreground: "FF0000" },
{ token: "keyword", foreground: "569CD6" },
{ token: "keyword.flow", foreground: "C586C0" },
{ token: "operator.sql", foreground: "778899" },
{ token: "operator.swift", foreground: "909090" },
{ token: "predefined.sql", foreground: "FF00FF" }
],
colors: {
[editorBackground]: "#000000",
[editorForeground]: "#FFFFFF",
[editorIndentGuide1]: "#FFFFFF",
[editorActiveIndentGuide1]: "#FFFFFF"
}
};
hc_light = {
base: "hc-light",
inherit: false,
rules: [
{ token: "", foreground: "292929", background: "FFFFFF" },
{ token: "invalid", foreground: "B5200D" },
{ token: "emphasis", fontStyle: "italic" },
{ token: "strong", fontStyle: "bold" },
{ token: "variable", foreground: "264F70" },
{ token: "variable.predefined", foreground: "4864AA" },
{ token: "constant", foreground: "dd0000" },
{ token: "comment", foreground: "008000" },
{ token: "number", foreground: "098658" },
{ token: "number.hex", foreground: "3030c0" },
{ token: "regexp", foreground: "800000" },
{ token: "annotation", foreground: "808080" },
{ token: "type", foreground: "008080" },
{ token: "delimiter", foreground: "000000" },
{ token: "delimiter.html", foreground: "383838" },
{ token: "tag", foreground: "800000" },
{ token: "tag.id.pug", foreground: "4F76AC" },
{ token: "tag.class.pug", foreground: "4F76AC" },
{ token: "meta.scss", foreground: "800000" },
{ token: "metatag", foreground: "e00000" },
{ token: "metatag.content.html", foreground: "B5200D" },
{ token: "metatag.html", foreground: "808080" },
{ token: "metatag.xml", foreground: "808080" },
{ token: "metatag.php", fontStyle: "bold" },
{ token: "key", foreground: "863B00" },
{ token: "string.key.json", foreground: "A31515" },
{ token: "string.value.json", foreground: "0451A5" },
{ token: "attribute.name", foreground: "264F78" },
{ token: "attribute.value", foreground: "0451A5" },
{ token: "string", foreground: "A31515" },
{ token: "string.sql", foreground: "B5200D" },
{ token: "keyword", foreground: "0000FF" },
{ token: "keyword.flow", foreground: "AF00DB" },
{ token: "operator.sql", foreground: "778899" },
{ token: "operator.swift", foreground: "666666" },
{ token: "predefined.sql", foreground: "C700C7" }
],
colors: {
[editorBackground]: "#FFFFFF",
[editorForeground]: "#292929",
[editorIndentGuide1]: "#292929",
[editorActiveIndentGuide1]: "#292929"
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/common/iconRegistry.js
function registerIcon(id, defaults, description, deprecationMessage) {
return iconRegistry.registerIcon(id, defaults, description, deprecationMessage);
}
function getIconRegistry() {
return iconRegistry;
}
function initialize() {
const codiconFontCharacters = getCodiconFontCharacters();
for (const icon in codiconFontCharacters) {
const fontCharacter = "\\" + codiconFontCharacters[icon].toString(16);
iconRegistry.registerIcon(icon, { fontCharacter });
}
}
var Extensions9, IconContribution, IconFontDefinition, IconRegistry, iconRegistry, iconsSchemaId, schemaRegistry2, delayer2, widgetClose, gotoPreviousLocation, gotoNextLocation, syncing, spinningLoading;
var init_iconRegistry = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/common/iconRegistry.js"() {
init_async();
init_codicons();
init_codiconsUtil();
init_themables();
init_event();
init_types();
init_uri();
init_nls();
init_jsonContributionRegistry();
init_platform2();
Extensions9 = {
IconContribution: "base.contributions.icons"
};
(function(IconContribution2) {
function getDefinition(contribution, registry) {
let definition = contribution.defaults;
while (ThemeIcon.isThemeIcon(definition)) {
const c = iconRegistry.getIcon(definition.id);
if (!c) {
return void 0;
}
definition = c.defaults;
}
return definition;
}
IconContribution2.getDefinition = getDefinition;
})(IconContribution || (IconContribution = {}));
(function(IconFontDefinition2) {
function toJSONObject(iconFont) {
return {
weight: iconFont.weight,
style: iconFont.style,
src: iconFont.src.map((s) => ({ format: s.format, location: s.location.toString() }))
};
}
IconFontDefinition2.toJSONObject = toJSONObject;
function fromJSONObject(json) {
const stringOrUndef = (s) => isString(s) ? s : void 0;
if (json && Array.isArray(json.src) && json.src.every((s) => isString(s.format) && isString(s.location))) {
return {
weight: stringOrUndef(json.weight),
style: stringOrUndef(json.style),
src: json.src.map((s) => ({ format: s.format, location: URI.parse(s.location) }))
};
}
return void 0;
}
IconFontDefinition2.fromJSONObject = fromJSONObject;
})(IconFontDefinition || (IconFontDefinition = {}));
IconRegistry = class {
constructor() {
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
this.iconSchema = {
definitions: {
icons: {
type: "object",
properties: {
fontId: { type: "string", description: localize("iconDefinition.fontId", "The id of the font to use. If not set, the font that is defined first is used.") },
fontCharacter: { type: "string", description: localize("iconDefinition.fontCharacter", "The font character associated with the icon definition.") }
},
additionalProperties: false,
defaultSnippets: [{ body: { fontCharacter: "\\\\e030" } }]
}
},
type: "object",
properties: {}
};
this.iconReferenceSchema = { type: "string", pattern: `^${ThemeIcon.iconNameExpression}$`, enum: [], enumDescriptions: [] };
this.iconsById = {};
this.iconFontsById = {};
}
registerIcon(id, defaults, description, deprecationMessage) {
const existing = this.iconsById[id];
if (existing) {
if (description && !existing.description) {
existing.description = description;
this.iconSchema.properties[id].markdownDescription = `${description} $(${id})`;
const enumIndex = this.iconReferenceSchema.enum.indexOf(id);
if (enumIndex !== -1) {
this.iconReferenceSchema.enumDescriptions[enumIndex] = description;
}
this._onDidChange.fire();
}
return existing;
}
const iconContribution = { id, description, defaults, deprecationMessage };
this.iconsById[id] = iconContribution;
const propertySchema = { $ref: "#/definitions/icons" };
if (deprecationMessage) {
propertySchema.deprecationMessage = deprecationMessage;
}
if (description) {
propertySchema.markdownDescription = `${description}: $(${id})`;
}
this.iconSchema.properties[id] = propertySchema;
this.iconReferenceSchema.enum.push(id);
this.iconReferenceSchema.enumDescriptions.push(description || "");
this._onDidChange.fire();
return { id };
}
getIcons() {
return Object.keys(this.iconsById).map((id) => this.iconsById[id]);
}
getIcon(id) {
return this.iconsById[id];
}
getIconSchema() {
return this.iconSchema;
}
toString() {
const sorter2 = (i1, i2) => {
return i1.id.localeCompare(i2.id);
};
const classNames = (i) => {
while (ThemeIcon.isThemeIcon(i.defaults)) {
i = this.iconsById[i.defaults.id];
}
return `codicon codicon-${i ? i.id : ""}`;
};
const reference = [];
reference.push(`| preview | identifier | default codicon ID | description`);
reference.push(`| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |`);
const contributions = Object.keys(this.iconsById).map((key) => this.iconsById[key]);
for (const i of contributions.filter((i2) => !!i2.description).sort(sorter2)) {
reference.push(`||${i.id}|${ThemeIcon.isThemeIcon(i.defaults) ? i.defaults.id : i.id}|${i.description || ""}|`);
}
reference.push(`| preview | identifier `);
reference.push(`| ----------- | --------------------------------- |`);
for (const i of contributions.filter((i2) => !ThemeIcon.isThemeIcon(i2.defaults)).sort(sorter2)) {
reference.push(`||${i.id}|`);
}
return reference.join("\n");
}
};
iconRegistry = new IconRegistry();
Registry.add(Extensions9.IconContribution, iconRegistry);
initialize();
iconsSchemaId = "vscode://schemas/icons";
schemaRegistry2 = Registry.as(Extensions3.JSONContribution);
schemaRegistry2.registerSchema(iconsSchemaId, iconRegistry.getIconSchema());
delayer2 = new RunOnceScheduler(() => schemaRegistry2.notifySchemaChanged(iconsSchemaId), 200);
iconRegistry.onDidChange(() => {
if (!delayer2.isScheduled()) {
delayer2.schedule();
}
});
widgetClose = registerIcon("widget-close", Codicon.close, localize("widgetClose", "Icon for the close action in widgets."));
gotoPreviousLocation = registerIcon("goto-previous-location", Codicon.arrowUp, localize("previousChangeIcon", "Icon for goto previous editor location."));
gotoNextLocation = registerIcon("goto-next-location", Codicon.arrowDown, localize("nextChangeIcon", "Icon for goto next editor location."));
syncing = ThemeIcon.modify(Codicon.sync, "spin");
spinningLoading = ThemeIcon.modify(Codicon.loading, "spin");
}
});
// node_modules/monaco-editor/esm/vs/platform/theme/browser/iconsStyleSheet.js
function getIconsStyleSheet(themeService) {
const disposable = new DisposableStore();
const onDidChangeEmmiter = disposable.add(new Emitter());
const iconRegistry2 = getIconRegistry();
disposable.add(iconRegistry2.onDidChange(() => onDidChangeEmmiter.fire()));
if (themeService) {
disposable.add(themeService.onDidProductIconThemeChange(() => onDidChangeEmmiter.fire()));
}
return {
dispose: () => disposable.dispose(),
onDidChange: onDidChangeEmmiter.event,
getCSS() {
const productIconTheme = themeService ? themeService.getProductIconTheme() : new UnthemedProductIconTheme();
const usedFontIds = {};
const rules = [];
const rootAttribs = [];
for (const contribution of iconRegistry2.getIcons()) {
const definition = productIconTheme.getIcon(contribution);
if (!definition) {
continue;
}
const fontContribution = definition.font;
const fontFamilyVar = `--vscode-icon-${contribution.id}-font-family`;
const contentVar = `--vscode-icon-${contribution.id}-content`;
if (fontContribution) {
usedFontIds[fontContribution.id] = fontContribution.definition;
rootAttribs.push(`${fontFamilyVar}: ${asCSSPropertyValue(fontContribution.id)};`, `${contentVar}: '${definition.fontCharacter}';`);
rules.push(`.codicon-${contribution.id}:before { content: '${definition.fontCharacter}'; font-family: ${asCSSPropertyValue(fontContribution.id)}; }`);
} else {
rootAttribs.push(`${contentVar}: '${definition.fontCharacter}'; ${fontFamilyVar}: 'codicon';`);
rules.push(`.codicon-${contribution.id}:before { content: '${definition.fontCharacter}'; }`);
}
}
for (const id in usedFontIds) {
const definition = usedFontIds[id];
const fontWeight = definition.weight ? `font-weight: ${definition.weight};` : "";
const fontStyle = definition.style ? `font-style: ${definition.style};` : "";
const src = definition.src.map((l) => `${asCSSUrl(l.location)} format('${l.format}')`).join(", ");
rules.push(`@font-face { src: ${src}; font-family: ${asCSSPropertyValue(id)};${fontWeight}${fontStyle} font-display: block; }`);
}
rules.push(`:root { ${rootAttribs.join(" ")} }`);
return rules.join("\n");
}
};
}
var UnthemedProductIconTheme;
var init_iconsStyleSheet = __esm({
"node_modules/monaco-editor/esm/vs/platform/theme/browser/iconsStyleSheet.js"() {
init_dom();
init_event();
init_lifecycle();
init_themables();
init_iconRegistry();
UnthemedProductIconTheme = class {
getIcon(contribution) {
const iconRegistry2 = getIconRegistry();
let definition = contribution.defaults;
while (ThemeIcon.isThemeIcon(definition)) {
const c = iconRegistry2.getIcon(definition.id);
if (!c) {
return void 0;
}
definition = c.defaults;
}
return definition;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneThemeService.js
function isBuiltinTheme(themeName) {
return themeName === VS_LIGHT_THEME_NAME || themeName === VS_DARK_THEME_NAME || themeName === HC_BLACK_THEME_NAME || themeName === HC_LIGHT_THEME_NAME;
}
function getBuiltinRules(builtinTheme) {
switch (builtinTheme) {
case VS_LIGHT_THEME_NAME:
return vs;
case VS_DARK_THEME_NAME:
return vs_dark;
case HC_BLACK_THEME_NAME:
return hc_black;
case HC_LIGHT_THEME_NAME:
return hc_light;
}
}
function newBuiltInTheme(builtinTheme) {
const themeData = getBuiltinRules(builtinTheme);
return new StandaloneTheme(builtinTheme, themeData);
}
var VS_LIGHT_THEME_NAME, VS_DARK_THEME_NAME, HC_BLACK_THEME_NAME, HC_LIGHT_THEME_NAME, colorRegistry2, themingRegistry2, StandaloneTheme, StandaloneThemeService;
var init_standaloneThemeService = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneThemeService.js"() {
init_dom();
init_browser();
init_color();
init_event();
init_languages();
init_encodedTokenAttributes();
init_tokenization();
init_themes();
init_platform2();
init_colorRegistry();
init_themeService();
init_lifecycle();
init_theme();
init_iconsStyleSheet();
init_window();
VS_LIGHT_THEME_NAME = "vs";
VS_DARK_THEME_NAME = "vs-dark";
HC_BLACK_THEME_NAME = "hc-black";
HC_LIGHT_THEME_NAME = "hc-light";
colorRegistry2 = Registry.as(Extensions6.ColorContribution);
themingRegistry2 = Registry.as(Extensions7.ThemingContribution);
StandaloneTheme = class {
constructor(name, standaloneThemeData) {
this.semanticHighlighting = false;
this.themeData = standaloneThemeData;
const base = standaloneThemeData.base;
if (name.length > 0) {
if (isBuiltinTheme(name)) {
this.id = name;
} else {
this.id = base + " " + name;
}
this.themeName = name;
} else {
this.id = base;
this.themeName = base;
}
this.colors = null;
this.defaultColors = /* @__PURE__ */ Object.create(null);
this._tokenTheme = null;
}
get base() {
return this.themeData.base;
}
notifyBaseUpdated() {
if (this.themeData.inherit) {
this.colors = null;
this._tokenTheme = null;
}
}
getColors() {
if (!this.colors) {
const colors2 = /* @__PURE__ */ new Map();
for (const id in this.themeData.colors) {
colors2.set(id, Color.fromHex(this.themeData.colors[id]));
}
if (this.themeData.inherit) {
const baseData = getBuiltinRules(this.themeData.base);
for (const id in baseData.colors) {
if (!colors2.has(id)) {
colors2.set(id, Color.fromHex(baseData.colors[id]));
}
}
}
this.colors = colors2;
}
return this.colors;
}
getColor(colorId, useDefault) {
const color = this.getColors().get(colorId);
if (color) {
return color;
}
if (useDefault !== false) {
return this.getDefault(colorId);
}
return void 0;
}
getDefault(colorId) {
let color = this.defaultColors[colorId];
if (color) {
return color;
}
color = colorRegistry2.resolveDefaultColor(colorId, this);
this.defaultColors[colorId] = color;
return color;
}
defines(colorId) {
return this.getColors().has(colorId);
}
get type() {
switch (this.base) {
case VS_LIGHT_THEME_NAME:
return ColorScheme.LIGHT;
case HC_BLACK_THEME_NAME:
return ColorScheme.HIGH_CONTRAST_DARK;
case HC_LIGHT_THEME_NAME:
return ColorScheme.HIGH_CONTRAST_LIGHT;
default:
return ColorScheme.DARK;
}
}
get tokenTheme() {
if (!this._tokenTheme) {
let rules = [];
let encodedTokensColors = [];
if (this.themeData.inherit) {
const baseData = getBuiltinRules(this.themeData.base);
rules = baseData.rules;
if (baseData.encodedTokensColors) {
encodedTokensColors = baseData.encodedTokensColors;
}
}
const editorForeground2 = this.themeData.colors["editor.foreground"];
const editorBackground2 = this.themeData.colors["editor.background"];
if (editorForeground2 || editorBackground2) {
const rule = { token: "" };
if (editorForeground2) {
rule.foreground = editorForeground2;
}
if (editorBackground2) {
rule.background = editorBackground2;
}
rules.push(rule);
}
rules = rules.concat(this.themeData.rules);
if (this.themeData.encodedTokensColors) {
encodedTokensColors = this.themeData.encodedTokensColors;
}
this._tokenTheme = TokenTheme.createFromRawTokenTheme(rules, encodedTokensColors);
}
return this._tokenTheme;
}
getTokenStyleMetadata(type, modifiers, modelLanguage) {
const style = this.tokenTheme._match([type].concat(modifiers).join("."));
const metadata = style.metadata;
const foreground2 = TokenMetadata.getForeground(metadata);
const fontStyle = TokenMetadata.getFontStyle(metadata);
return {
foreground: foreground2,
italic: Boolean(
fontStyle & 1
/* FontStyle.Italic */
),
bold: Boolean(
fontStyle & 2
/* FontStyle.Bold */
),
underline: Boolean(
fontStyle & 4
/* FontStyle.Underline */
),
strikethrough: Boolean(
fontStyle & 8
/* FontStyle.Strikethrough */
)
};
}
};
StandaloneThemeService = class extends Disposable {
constructor() {
super();
this._onColorThemeChange = this._register(new Emitter());
this.onDidColorThemeChange = this._onColorThemeChange.event;
this._onProductIconThemeChange = this._register(new Emitter());
this.onDidProductIconThemeChange = this._onProductIconThemeChange.event;
this._environment = /* @__PURE__ */ Object.create(null);
this._builtInProductIconTheme = new UnthemedProductIconTheme();
this._autoDetectHighContrast = true;
this._knownThemes = /* @__PURE__ */ new Map();
this._knownThemes.set(VS_LIGHT_THEME_NAME, newBuiltInTheme(VS_LIGHT_THEME_NAME));
this._knownThemes.set(VS_DARK_THEME_NAME, newBuiltInTheme(VS_DARK_THEME_NAME));
this._knownThemes.set(HC_BLACK_THEME_NAME, newBuiltInTheme(HC_BLACK_THEME_NAME));
this._knownThemes.set(HC_LIGHT_THEME_NAME, newBuiltInTheme(HC_LIGHT_THEME_NAME));
const iconsStyleSheet = this._register(getIconsStyleSheet(this));
this._codiconCSS = iconsStyleSheet.getCSS();
this._themeCSS = "";
this._allCSS = `${this._codiconCSS}
${this._themeCSS}`;
this._globalStyleElement = null;
this._styleElements = [];
this._colorMapOverride = null;
this.setTheme(VS_LIGHT_THEME_NAME);
this._onOSSchemeChanged();
this._register(iconsStyleSheet.onDidChange(() => {
this._codiconCSS = iconsStyleSheet.getCSS();
this._updateCSS();
}));
addMatchMediaChangeListener(mainWindow, "(forced-colors: active)", () => {
this._onOSSchemeChanged();
});
}
registerEditorContainer(domNode) {
if (isInShadowDOM(domNode)) {
return this._registerShadowDomContainer(domNode);
}
return this._registerRegularEditorContainer();
}
_registerRegularEditorContainer() {
if (!this._globalStyleElement) {
this._globalStyleElement = createStyleSheet(void 0, (style) => {
style.className = "monaco-colors";
style.textContent = this._allCSS;
});
this._styleElements.push(this._globalStyleElement);
}
return Disposable.None;
}
_registerShadowDomContainer(domNode) {
const styleElement = createStyleSheet(domNode, (style) => {
style.className = "monaco-colors";
style.textContent = this._allCSS;
});
this._styleElements.push(styleElement);
return {
dispose: () => {
for (let i = 0; i < this._styleElements.length; i++) {
if (this._styleElements[i] === styleElement) {
this._styleElements.splice(i, 1);
return;
}
}
}
};
}
defineTheme(themeName, themeData) {
if (!/^[a-z0-9\-]+$/i.test(themeName)) {
throw new Error("Illegal theme name!");
}
if (!isBuiltinTheme(themeData.base) && !isBuiltinTheme(themeName)) {
throw new Error("Illegal theme base!");
}
this._knownThemes.set(themeName, new StandaloneTheme(themeName, themeData));
if (isBuiltinTheme(themeName)) {
this._knownThemes.forEach((theme) => {
if (theme.base === themeName) {
theme.notifyBaseUpdated();
}
});
}
if (this._theme.themeName === themeName) {
this.setTheme(themeName);
}
}
getColorTheme() {
return this._theme;
}
setColorMapOverride(colorMapOverride) {
this._colorMapOverride = colorMapOverride;
this._updateThemeOrColorMap();
}
setTheme(themeName) {
let theme;
if (this._knownThemes.has(themeName)) {
theme = this._knownThemes.get(themeName);
} else {
theme = this._knownThemes.get(VS_LIGHT_THEME_NAME);
}
this._updateActualTheme(theme);
}
_updateActualTheme(desiredTheme) {
if (!desiredTheme || this._theme === desiredTheme) {
return;
}
this._theme = desiredTheme;
this._updateThemeOrColorMap();
}
_onOSSchemeChanged() {
if (this._autoDetectHighContrast) {
const wantsHighContrast = mainWindow.matchMedia(`(forced-colors: active)`).matches;
if (wantsHighContrast !== isHighContrast(this._theme.type)) {
let newThemeName;
if (isDark(this._theme.type)) {
newThemeName = wantsHighContrast ? HC_BLACK_THEME_NAME : VS_DARK_THEME_NAME;
} else {
newThemeName = wantsHighContrast ? HC_LIGHT_THEME_NAME : VS_LIGHT_THEME_NAME;
}
this._updateActualTheme(this._knownThemes.get(newThemeName));
}
}
}
setAutoDetectHighContrast(autoDetectHighContrast) {
this._autoDetectHighContrast = autoDetectHighContrast;
this._onOSSchemeChanged();
}
_updateThemeOrColorMap() {
const cssRules = [];
const hasRule = {};
const ruleCollector = {
addRule: (rule) => {
if (!hasRule[rule]) {
cssRules.push(rule);
hasRule[rule] = true;
}
}
};
themingRegistry2.getThemingParticipants().forEach((p) => p(this._theme, ruleCollector, this._environment));
const colorVariables = [];
for (const item of colorRegistry2.getColors()) {
const color = this._theme.getColor(item.id, true);
if (color) {
colorVariables.push(`${asCssVariableName(item.id)}: ${color.toString()};`);
}
}
ruleCollector.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${colorVariables.join("\n")} }`);
const colorMap = this._colorMapOverride || this._theme.tokenTheme.getColorMap();
ruleCollector.addRule(generateTokensCSSForColorMap(colorMap));
this._themeCSS = cssRules.join("\n");
this._updateCSS();
TokenizationRegistry2.setColorMap(colorMap);
this._onColorThemeChange.fire(this._theme);
}
_updateCSS() {
this._allCSS = `${this._codiconCSS}
${this._themeCSS}`;
this._styleElements.forEach((styleElement) => styleElement.textContent = this._allCSS);
}
getFileIconTheme() {
return {
hasFileIcons: false,
hasFolderIcons: false,
hidesExplorerArrows: false
};
}
getProductIconTheme() {
return this._builtInProductIconTheme;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js
var IStandaloneThemeService;
var init_standaloneTheme = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js"() {
init_instantiation();
IStandaloneThemeService = createDecorator("themeService");
}
});
// node_modules/monaco-editor/esm/vs/platform/accessibility/browser/accessibilityService.js
var __decorate43, __param37, AccessibilityService;
var init_accessibilityService = __esm({
"node_modules/monaco-editor/esm/vs/platform/accessibility/browser/accessibilityService.js"() {
init_dom();
init_window();
init_event();
init_lifecycle();
init_accessibility();
init_configuration();
init_contextkey();
init_layoutService();
__decorate43 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param37 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
AccessibilityService = class AccessibilityService2 extends Disposable {
constructor(_contextKeyService, _layoutService, _configurationService) {
super();
this._contextKeyService = _contextKeyService;
this._layoutService = _layoutService;
this._configurationService = _configurationService;
this._accessibilitySupport = 0;
this._onDidChangeScreenReaderOptimized = new Emitter();
this._onDidChangeReducedMotion = new Emitter();
this._accessibilityModeEnabledContext = CONTEXT_ACCESSIBILITY_MODE_ENABLED.bindTo(this._contextKeyService);
const updateContextKey = () => this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());
this._register(this._configurationService.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration("editor.accessibilitySupport")) {
updateContextKey();
this._onDidChangeScreenReaderOptimized.fire();
}
if (e.affectsConfiguration("workbench.reduceMotion")) {
this._configMotionReduced = this._configurationService.getValue("workbench.reduceMotion");
this._onDidChangeReducedMotion.fire();
}
}));
updateContextKey();
this._register(this.onDidChangeScreenReaderOptimized(() => updateContextKey()));
const reduceMotionMatcher = mainWindow.matchMedia(`(prefers-reduced-motion: reduce)`);
this._systemMotionReduced = reduceMotionMatcher.matches;
this._configMotionReduced = this._configurationService.getValue("workbench.reduceMotion");
this.initReducedMotionListeners(reduceMotionMatcher);
}
initReducedMotionListeners(reduceMotionMatcher) {
this._register(addDisposableListener(reduceMotionMatcher, "change", () => {
this._systemMotionReduced = reduceMotionMatcher.matches;
if (this._configMotionReduced === "auto") {
this._onDidChangeReducedMotion.fire();
}
}));
const updateRootClasses = () => {
const reduce = this.isMotionReduced();
this._layoutService.mainContainer.classList.toggle("reduce-motion", reduce);
this._layoutService.mainContainer.classList.toggle("enable-motion", !reduce);
};
updateRootClasses();
this._register(this.onDidChangeReducedMotion(() => updateRootClasses()));
}
get onDidChangeScreenReaderOptimized() {
return this._onDidChangeScreenReaderOptimized.event;
}
isScreenReaderOptimized() {
const config = this._configurationService.getValue("editor.accessibilitySupport");
return config === "on" || config === "auto" && this._accessibilitySupport === 2;
}
get onDidChangeReducedMotion() {
return this._onDidChangeReducedMotion.event;
}
isMotionReduced() {
const config = this._configMotionReduced;
return config === "on" || config === "auto" && this._systemMotionReduced;
}
getAccessibilitySupport() {
return this._accessibilitySupport;
}
};
AccessibilityService = __decorate43([
__param37(0, IContextKeyService),
__param37(1, ILayoutService),
__param37(2, IConfigurationService)
], AccessibilityService);
}
});
// node_modules/monaco-editor/esm/vs/platform/actions/common/menuService.js
function createMenuHide(menu, command, states) {
const id = isISubmenuItem(command) ? command.submenu.id : command.id;
const title = typeof command.title === "string" ? command.title : command.title.value;
const hide2 = toAction({
id: `hide/${menu.id}/${id}`,
label: localize("hide.label", "Hide '{0}'", title),
run() {
states.updateHidden(menu, id, true);
}
});
const toggle = toAction({
id: `toggle/${menu.id}/${id}`,
label: title,
get checked() {
return !states.isHidden(menu, id);
},
run() {
states.updateHidden(menu, id, !!this.checked);
}
});
return {
hide: hide2,
toggle,
get isHidden() {
return !toggle.checked;
}
};
}
function createConfigureKeybindingAction(commandId, when = void 0, commandService, keybindingService) {
return toAction({
id: `configureKeybinding/${commandId}`,
label: localize("configure keybinding", "Configure Keybinding"),
run() {
const hasKeybinding = !!keybindingService.lookupKeybinding(commandId);
const whenValue = !hasKeybinding && when ? when.serialize() : void 0;
commandService.executeCommand("workbench.action.openGlobalKeybindings", `@command:${commandId}` + (whenValue ? ` +when:${whenValue}` : ""));
}
});
}
var __decorate44, __param38, PersistedMenuHideState_1, MenuInfo_1, MenuService, PersistedMenuHideState, MenuInfo, MenuImpl;
var init_menuService = __esm({
"node_modules/monaco-editor/esm/vs/platform/actions/common/menuService.js"() {
init_async();
init_event();
init_lifecycle();
init_actions2();
init_commands();
init_contextkey();
init_actions();
init_storage2();
init_arrays();
init_nls();
init_keybinding();
__decorate44 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param38 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MenuService = class MenuService2 {
constructor(_commandService, _keybindingService, storageService) {
this._commandService = _commandService;
this._keybindingService = _keybindingService;
this._hiddenStates = new PersistedMenuHideState(storageService);
}
createMenu(id, contextKeyService, options2) {
return new MenuImpl(id, this._hiddenStates, __spreadValues({ emitEventsForSubmenuChanges: false, eventDebounceDelay: 50 }, options2), this._commandService, this._keybindingService, contextKeyService);
}
resetHiddenStates(ids) {
this._hiddenStates.reset(ids);
}
};
MenuService = __decorate44([
__param38(0, ICommandService),
__param38(1, IKeybindingService),
__param38(2, IStorageService)
], MenuService);
PersistedMenuHideState = PersistedMenuHideState_1 = class PersistedMenuHideState2 {
constructor(_storageService) {
this._storageService = _storageService;
this._disposables = new DisposableStore();
this._onDidChange = new Emitter();
this.onDidChange = this._onDidChange.event;
this._ignoreChangeEvent = false;
this._hiddenByDefaultCache = /* @__PURE__ */ new Map();
try {
const raw = _storageService.get(PersistedMenuHideState_1._key, 0, "{}");
this._data = JSON.parse(raw);
} catch (err) {
this._data = /* @__PURE__ */ Object.create(null);
}
this._disposables.add(_storageService.onDidChangeValue(0, PersistedMenuHideState_1._key, this._disposables)(() => {
if (!this._ignoreChangeEvent) {
try {
const raw = _storageService.get(PersistedMenuHideState_1._key, 0, "{}");
this._data = JSON.parse(raw);
} catch (err) {
console.log("FAILED to read storage after UPDATE", err);
}
}
this._onDidChange.fire();
}));
}
dispose() {
this._onDidChange.dispose();
this._disposables.dispose();
}
_isHiddenByDefault(menu, commandId) {
var _a10;
return (_a10 = this._hiddenByDefaultCache.get(`${menu.id}/${commandId}`)) !== null && _a10 !== void 0 ? _a10 : false;
}
setDefaultState(menu, commandId, hidden) {
this._hiddenByDefaultCache.set(`${menu.id}/${commandId}`, hidden);
}
isHidden(menu, commandId) {
var _a10, _b4;
const hiddenByDefault = this._isHiddenByDefault(menu, commandId);
const state = (_b4 = (_a10 = this._data[menu.id]) === null || _a10 === void 0 ? void 0 : _a10.includes(commandId)) !== null && _b4 !== void 0 ? _b4 : false;
return hiddenByDefault ? !state : state;
}
updateHidden(menu, commandId, hidden) {
const hiddenByDefault = this._isHiddenByDefault(menu, commandId);
if (hiddenByDefault) {
hidden = !hidden;
}
const entries2 = this._data[menu.id];
if (!hidden) {
if (entries2) {
const idx = entries2.indexOf(commandId);
if (idx >= 0) {
removeFastWithoutKeepingOrder(entries2, idx);
}
if (entries2.length === 0) {
delete this._data[menu.id];
}
}
} else {
if (!entries2) {
this._data[menu.id] = [commandId];
} else {
const idx = entries2.indexOf(commandId);
if (idx < 0) {
entries2.push(commandId);
}
}
}
this._persist();
}
reset(menus) {
if (menus === void 0) {
this._data = /* @__PURE__ */ Object.create(null);
this._persist();
} else {
for (const { id } of menus) {
if (this._data[id]) {
delete this._data[id];
}
}
this._persist();
}
}
_persist() {
try {
this._ignoreChangeEvent = true;
const raw = JSON.stringify(this._data);
this._storageService.store(
PersistedMenuHideState_1._key,
raw,
0,
0
/* StorageTarget.USER */
);
} finally {
this._ignoreChangeEvent = false;
}
}
};
PersistedMenuHideState._key = "menu.hiddenCommands";
PersistedMenuHideState = PersistedMenuHideState_1 = __decorate44([
__param38(0, IStorageService)
], PersistedMenuHideState);
MenuInfo = MenuInfo_1 = class MenuInfo2 {
constructor(_id, _hiddenStates, _collectContextKeysForSubmenus, _commandService, _keybindingService, _contextKeyService) {
this._id = _id;
this._hiddenStates = _hiddenStates;
this._collectContextKeysForSubmenus = _collectContextKeysForSubmenus;
this._commandService = _commandService;
this._keybindingService = _keybindingService;
this._contextKeyService = _contextKeyService;
this._menuGroups = [];
this._structureContextKeys = /* @__PURE__ */ new Set();
this._preconditionContextKeys = /* @__PURE__ */ new Set();
this._toggledContextKeys = /* @__PURE__ */ 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();
const menuItems = MenuRegistry.getMenuItems(this._id);
let group;
menuItems.sort(MenuInfo_1._compareMenuItems);
for (const item of menuItems) {
const groupName = item.group || "";
if (!group || group[0] !== groupName) {
group = [groupName, []];
this._menuGroups.push(group);
}
group[1].push(item);
this._collectContextKeys(item);
}
}
_collectContextKeys(item) {
MenuInfo_1._fillInKbExprKeys(item.when, this._structureContextKeys);
if (isIMenuItem(item)) {
if (item.command.precondition) {
MenuInfo_1._fillInKbExprKeys(item.command.precondition, this._preconditionContextKeys);
}
if (item.command.toggled) {
const toggledExpression = item.command.toggled.condition || item.command.toggled;
MenuInfo_1._fillInKbExprKeys(toggledExpression, this._toggledContextKeys);
}
} else if (this._collectContextKeysForSubmenus) {
MenuRegistry.getMenuItems(item.submenu).forEach(this._collectContextKeys, this);
}
}
createActionGroups(options2) {
const result = [];
for (const group of this._menuGroups) {
const [id, items] = group;
let activeActions;
for (const item of items) {
if (this._contextKeyService.contextMatchesRules(item.when)) {
const isMenuItem = isIMenuItem(item);
if (isMenuItem) {
this._hiddenStates.setDefaultState(this._id, item.command.id, !!item.isHiddenByDefault);
}
const menuHide = createMenuHide(this._id, isMenuItem ? item.command : item, this._hiddenStates);
if (isMenuItem) {
const menuKeybinding = createConfigureKeybindingAction(item.command.id, item.when, this._commandService, this._keybindingService);
(activeActions !== null && activeActions !== void 0 ? activeActions : activeActions = []).push(new MenuItemAction(item.command, item.alt, options2, menuHide, menuKeybinding, this._contextKeyService, this._commandService));
} else {
const groups = new MenuInfo_1(item.submenu, this._hiddenStates, this._collectContextKeysForSubmenus, this._commandService, this._keybindingService, this._contextKeyService).createActionGroups(options2);
const submenuActions = Separator.join(...groups.map((g) => g[1]));
if (submenuActions.length > 0) {
(activeActions !== null && activeActions !== void 0 ? activeActions : activeActions = []).push(new SubmenuItemAction(item, menuHide, submenuActions));
}
}
}
}
if (activeActions && activeActions.length > 0) {
result.push([id, activeActions]);
}
}
return result;
}
static _fillInKbExprKeys(exp, set) {
if (exp) {
for (const key of exp.keys()) {
set.add(key);
}
}
}
static _compareMenuItems(a3, b) {
const aGroup = a3.group;
const bGroup = b.group;
if (aGroup !== bGroup) {
if (!aGroup) {
return 1;
} else if (!bGroup) {
return -1;
}
if (aGroup === "navigation") {
return -1;
} else if (bGroup === "navigation") {
return 1;
}
const value = aGroup.localeCompare(bGroup);
if (value !== 0) {
return value;
}
}
const aPrio = a3.order || 0;
const bPrio = b.order || 0;
if (aPrio < bPrio) {
return -1;
} else if (aPrio > bPrio) {
return 1;
}
return MenuInfo_1._compareTitles(isIMenuItem(a3) ? a3.command.title : a3.title, isIMenuItem(b) ? b.command.title : b.title);
}
static _compareTitles(a3, b) {
const aStr = typeof a3 === "string" ? a3 : a3.original;
const bStr = typeof b === "string" ? b : b.original;
return aStr.localeCompare(bStr);
}
};
MenuInfo = MenuInfo_1 = __decorate44([
__param38(3, ICommandService),
__param38(4, IKeybindingService),
__param38(5, IContextKeyService)
], MenuInfo);
MenuImpl = class MenuImpl2 {
constructor(id, hiddenStates, options2, commandService, keybindingService, contextKeyService) {
this._disposables = new DisposableStore();
this._menuInfo = new MenuInfo(id, hiddenStates, options2.emitEventsForSubmenuChanges, commandService, keybindingService, contextKeyService);
const rebuildMenuSoon = new RunOnceScheduler(() => {
this._menuInfo.refresh();
this._onDidChange.fire({ menu: this, isStructuralChange: true, isEnablementChange: true, isToggleChange: true });
}, options2.eventDebounceDelay);
this._disposables.add(rebuildMenuSoon);
this._disposables.add(MenuRegistry.onDidChangeMenu((e) => {
if (e.has(id)) {
rebuildMenuSoon.schedule();
}
}));
const lazyListener = this._disposables.add(new DisposableStore());
const merge = (events) => {
let isStructuralChange = false;
let isEnablementChange = false;
let isToggleChange = false;
for (const item of events) {
isStructuralChange = isStructuralChange || item.isStructuralChange;
isEnablementChange = isEnablementChange || item.isEnablementChange;
isToggleChange = isToggleChange || item.isToggleChange;
if (isStructuralChange && isEnablementChange && isToggleChange) {
break;
}
}
return { menu: this, isStructuralChange, isEnablementChange, isToggleChange };
};
const startLazyListener = () => {
lazyListener.add(contextKeyService.onDidChangeContext((e) => {
const isStructuralChange = e.affectsSome(this._menuInfo.structureContextKeys);
const isEnablementChange = e.affectsSome(this._menuInfo.preconditionContextKeys);
const isToggleChange = e.affectsSome(this._menuInfo.toggledContextKeys);
if (isStructuralChange || isEnablementChange || isToggleChange) {
this._onDidChange.fire({ menu: this, isStructuralChange, isEnablementChange, isToggleChange });
}
}));
lazyListener.add(hiddenStates.onDidChange((e) => {
this._onDidChange.fire({ menu: this, isStructuralChange: true, isEnablementChange: false, isToggleChange: false });
}));
};
this._onDidChange = new DebounceEmitter({
// start/stop context key listener
onWillAddFirstListener: startLazyListener,
onDidRemoveLastListener: lazyListener.clear.bind(lazyListener),
delay: options2.eventDebounceDelay,
merge
});
this.onDidChange = this._onDidChange.event;
}
getActions(options2) {
return this._menuInfo.createActionGroups(options2);
}
dispose() {
this._disposables.dispose();
this._onDidChange.dispose();
}
};
MenuImpl = __decorate44([
__param38(3, ICommandService),
__param38(4, IKeybindingService),
__param38(5, IContextKeyService)
], MenuImpl);
}
});
// node_modules/monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js
var __decorate45, __param39, BrowserClipboardService_1, BrowserClipboardService;
var init_clipboardService = __esm({
"node_modules/monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js"() {
init_browser();
init_dom();
init_window();
init_async();
init_event();
init_hash();
init_lifecycle();
init_layoutService();
init_log();
__decorate45 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param39 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
BrowserClipboardService = BrowserClipboardService_1 = class BrowserClipboardService2 extends Disposable {
constructor(layoutService, logService) {
super();
this.layoutService = layoutService;
this.logService = logService;
this.mapTextToType = /* @__PURE__ */ new Map();
this.findText = "";
this.resources = [];
this.resourcesStateHash = void 0;
if (isSafari2 || isWebkitWebView) {
this.installWebKitWriteTextWorkaround();
}
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window: window2, disposables }) => {
disposables.add(addDisposableListener(window2.document, "copy", () => this.clearResources()));
}, { window: mainWindow, disposables: this._store }));
}
// In Safari, it has the following note:
//
// "The request to write to the clipboard must be triggered during a user gesture.
// A call to clipboard.write or clipboard.writeText outside the scope of a user
// gesture(such as "click" or "touch" event handlers) will result in the immediate
// rejection of the promise returned by the API call."
// From: https://webkit.org/blog/10855/async-clipboard-api/
//
// Since extensions run in a web worker, and handle gestures in an asynchronous way,
// they are not classified by Safari as "in response to a user gesture" and will reject.
//
// This function sets up some handlers to work around that behavior.
installWebKitWriteTextWorkaround() {
const handler = () => {
const currentWritePromise = new DeferredPromise();
if (this.webKitPendingClipboardWritePromise && !this.webKitPendingClipboardWritePromise.isSettled) {
this.webKitPendingClipboardWritePromise.cancel();
}
this.webKitPendingClipboardWritePromise = currentWritePromise;
getActiveWindow().navigator.clipboard.write([new ClipboardItem({
"text/plain": currentWritePromise.p
})]).catch((err) => __async(this, null, function* () {
if (!(err instanceof Error) || err.name !== "NotAllowedError" || !currentWritePromise.isRejected) {
this.logService.error(err);
}
}));
};
this._register(Event.runAndSubscribe(this.layoutService.onDidAddContainer, ({ container, disposables }) => {
disposables.add(addDisposableListener(container, "click", handler));
disposables.add(addDisposableListener(container, "keydown", handler));
}, { container: this.layoutService.mainContainer, disposables: this._store }));
}
writeText(text2, type) {
return __async(this, null, function* () {
this.writeResources([]);
if (type) {
this.mapTextToType.set(type, text2);
return;
}
if (this.webKitPendingClipboardWritePromise) {
return this.webKitPendingClipboardWritePromise.complete(text2);
}
try {
return yield getActiveWindow().navigator.clipboard.writeText(text2);
} catch (error) {
console.error(error);
}
this.fallbackWriteText(text2);
});
}
fallbackWriteText(text2) {
const activeDocument = getActiveDocument();
const activeElement = activeDocument.activeElement;
const textArea = activeDocument.body.appendChild($("textarea", { "aria-hidden": true }));
textArea.style.height = "1px";
textArea.style.width = "1px";
textArea.style.position = "absolute";
textArea.value = text2;
textArea.focus();
textArea.select();
activeDocument.execCommand("copy");
if (isHTMLElement(activeElement)) {
activeElement.focus();
}
activeDocument.body.removeChild(textArea);
}
readText(type) {
return __async(this, null, function* () {
if (type) {
return this.mapTextToType.get(type) || "";
}
try {
return yield getActiveWindow().navigator.clipboard.readText();
} catch (error) {
console.error(error);
}
return "";
});
}
readFindText() {
return __async(this, null, function* () {
return this.findText;
});
}
writeFindText(text2) {
return __async(this, null, function* () {
this.findText = text2;
});
}
writeResources(resources) {
return __async(this, null, function* () {
if (resources.length === 0) {
this.clearResources();
} else {
this.resources = resources;
this.resourcesStateHash = yield this.computeResourcesStateHash();
}
});
}
readResources() {
return __async(this, null, function* () {
const resourcesStateHash = yield this.computeResourcesStateHash();
if (this.resourcesStateHash !== resourcesStateHash) {
this.clearResources();
}
return this.resources;
});
}
computeResourcesStateHash() {
return __async(this, null, function* () {
if (this.resources.length === 0) {
return void 0;
}
const clipboardText = yield this.readText();
return hash(clipboardText.substring(0, BrowserClipboardService_1.MAX_RESOURCE_STATE_SOURCE_LENGTH));
});
}
clearResources() {
this.resources = [];
this.resourcesStateHash = void 0;
}
};
BrowserClipboardService.MAX_RESOURCE_STATE_SOURCE_LENGTH = 1e3;
BrowserClipboardService = BrowserClipboardService_1 = __decorate45([
__param39(0, ILayoutService),
__param39(1, ILogService)
], BrowserClipboardService);
}
});
// node_modules/monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js
var IClipboardService;
var init_clipboardService2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js"() {
init_instantiation();
IClipboardService = createDecorator("clipboardService");
}
});
// node_modules/monaco-editor/esm/vs/platform/contextkey/browser/contextKeyService.js
function allEventKeysInContext(event, context) {
return event.allKeysContainedIn(new Set(Object.keys(context)));
}
function findContextAttr(domNode) {
while (domNode) {
if (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
const attr = domNode.getAttribute(KEYBINDING_CONTEXT_ATTR);
if (attr) {
return parseInt(attr, 10);
}
return NaN;
}
domNode = domNode.parentElement;
}
return 0;
}
function setContext(accessor, contextKey, contextValue) {
const contextKeyService = accessor.get(IContextKeyService);
contextKeyService.createKey(String(contextKey), stringifyURIs(contextValue));
}
function stringifyURIs(contextValue) {
return cloneAndChange(contextValue, (obj) => {
if (typeof obj === "object" && obj.$mid === 1) {
return URI.revive(obj).toString();
}
if (obj instanceof URI) {
return obj.toString();
}
return void 0;
});
}
var __decorate46, __param40, KEYBINDING_CONTEXT_ATTR, Context, NullContext, ConfigAwareContextValuesContainer, ContextKey, SimpleContextKeyChangeEvent, ArrayContextKeyChangeEvent, CompositeContextKeyChangeEvent, AbstractContextKeyService, ContextKeyService, ScopedContextKeyService;
var init_contextKeyService = __esm({
"node_modules/monaco-editor/esm/vs/platform/contextkey/browser/contextKeyService.js"() {
init_event();
init_iterator();
init_lifecycle();
init_objects();
init_ternarySearchTree();
init_uri();
init_nls();
init_commands();
init_configuration();
init_contextkey();
__decorate46 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param40 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
KEYBINDING_CONTEXT_ATTR = "data-keybinding-context";
Context = class {
constructor(id, parent) {
this._id = id;
this._parent = parent;
this._value = /* @__PURE__ */ Object.create(null);
this._value["_contextId"] = id;
}
get value() {
return __spreadValues({}, this._value);
}
setValue(key, value) {
if (this._value[key] !== value) {
this._value[key] = value;
return true;
}
return false;
}
removeValue(key) {
if (key in this._value) {
delete this._value[key];
return true;
}
return false;
}
getValue(key) {
const ret = this._value[key];
if (typeof ret === "undefined" && this._parent) {
return this._parent.getValue(key);
}
return ret;
}
};
NullContext = class extends Context {
constructor() {
super(-1, null);
}
setValue(key, value) {
return false;
}
removeValue(key) {
return false;
}
getValue(key) {
return void 0;
}
};
NullContext.INSTANCE = new NullContext();
ConfigAwareContextValuesContainer = class _ConfigAwareContextValuesContainer extends Context {
constructor(id, _configurationService, emitter) {
super(id, null);
this._configurationService = _configurationService;
this._values = TernarySearchTree.forConfigKeys();
this._listener = this._configurationService.onDidChangeConfiguration((event) => {
if (event.source === 7) {
const allKeys = Array.from(this._values, ([k]) => k);
this._values.clear();
emitter.fire(new ArrayContextKeyChangeEvent(allKeys));
} else {
const changedKeys = [];
for (const configKey of event.affectedKeys) {
const contextKey = `config.${configKey}`;
const cachedItems = this._values.findSuperstr(contextKey);
if (cachedItems !== void 0) {
changedKeys.push(...Iterable.map(cachedItems, ([key]) => key));
this._values.deleteSuperstr(contextKey);
}
if (this._values.has(contextKey)) {
changedKeys.push(contextKey);
this._values.delete(contextKey);
}
}
emitter.fire(new ArrayContextKeyChangeEvent(changedKeys));
}
});
}
dispose() {
this._listener.dispose();
}
getValue(key) {
if (key.indexOf(_ConfigAwareContextValuesContainer._keyPrefix) !== 0) {
return super.getValue(key);
}
if (this._values.has(key)) {
return this._values.get(key);
}
const configKey = key.substr(_ConfigAwareContextValuesContainer._keyPrefix.length);
const configValue = this._configurationService.getValue(configKey);
let value = void 0;
switch (typeof configValue) {
case "number":
case "boolean":
case "string":
value = configValue;
break;
default:
if (Array.isArray(configValue)) {
value = JSON.stringify(configValue);
} else {
value = configValue;
}
}
this._values.set(key, value);
return value;
}
setValue(key, value) {
return super.setValue(key, value);
}
removeValue(key) {
return super.removeValue(key);
}
};
ConfigAwareContextValuesContainer._keyPrefix = "config.";
ContextKey = class {
constructor(service, key, defaultValue) {
this._service = service;
this._key = key;
this._defaultValue = defaultValue;
this.reset();
}
set(value) {
this._service.setContext(this._key, value);
}
reset() {
if (typeof this._defaultValue === "undefined") {
this._service.removeContext(this._key);
} else {
this._service.setContext(this._key, this._defaultValue);
}
}
get() {
return this._service.getContextKeyValue(this._key);
}
};
SimpleContextKeyChangeEvent = class {
constructor(key) {
this.key = key;
}
affectsSome(keys) {
return keys.has(this.key);
}
allKeysContainedIn(keys) {
return this.affectsSome(keys);
}
};
ArrayContextKeyChangeEvent = class {
constructor(keys) {
this.keys = keys;
}
affectsSome(keys) {
for (const key of this.keys) {
if (keys.has(key)) {
return true;
}
}
return false;
}
allKeysContainedIn(keys) {
return this.keys.every((key) => keys.has(key));
}
};
CompositeContextKeyChangeEvent = class {
constructor(events) {
this.events = events;
}
affectsSome(keys) {
for (const e of this.events) {
if (e.affectsSome(keys)) {
return true;
}
}
return false;
}
allKeysContainedIn(keys) {
return this.events.every((evt) => evt.allKeysContainedIn(keys));
}
};
AbstractContextKeyService = class extends Disposable {
constructor(myContextId) {
super();
this._onDidChangeContext = this._register(new PauseableEmitter({ merge: (input) => new CompositeContextKeyChangeEvent(input) }));
this.onDidChangeContext = this._onDidChangeContext.event;
this._isDisposed = false;
this._myContextId = myContextId;
}
createKey(key, defaultValue) {
if (this._isDisposed) {
throw new Error(`AbstractContextKeyService has been disposed`);
}
return new ContextKey(this, key, defaultValue);
}
bufferChangeEvents(callback) {
this._onDidChangeContext.pause();
try {
callback();
} finally {
this._onDidChangeContext.resume();
}
}
createScoped(domNode) {
if (this._isDisposed) {
throw new Error(`AbstractContextKeyService has been disposed`);
}
return new ScopedContextKeyService(this, domNode);
}
contextMatchesRules(rules) {
if (this._isDisposed) {
throw new Error(`AbstractContextKeyService has been disposed`);
}
const context = this.getContextValuesContainer(this._myContextId);
const result = rules ? rules.evaluate(context) : true;
return result;
}
getContextKeyValue(key) {
if (this._isDisposed) {
return void 0;
}
return this.getContextValuesContainer(this._myContextId).getValue(key);
}
setContext(key, value) {
if (this._isDisposed) {
return;
}
const myContext = this.getContextValuesContainer(this._myContextId);
if (!myContext) {
return;
}
if (myContext.setValue(key, value)) {
this._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));
}
}
removeContext(key) {
if (this._isDisposed) {
return;
}
if (this.getContextValuesContainer(this._myContextId).removeValue(key)) {
this._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));
}
}
getContext(target) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this.getContextValuesContainer(findContextAttr(target));
}
dispose() {
super.dispose();
this._isDisposed = true;
}
};
ContextKeyService = class ContextKeyService2 extends AbstractContextKeyService {
constructor(configurationService) {
super(0);
this._contexts = /* @__PURE__ */ new Map();
this._lastContextId = 0;
const myContext = this._register(new ConfigAwareContextValuesContainer(this._myContextId, configurationService, this._onDidChangeContext));
this._contexts.set(this._myContextId, myContext);
}
getContextValuesContainer(contextId) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this._contexts.get(contextId) || NullContext.INSTANCE;
}
createChildContext(parentContextId = this._myContextId) {
if (this._isDisposed) {
throw new Error(`ContextKeyService has been disposed`);
}
const id = ++this._lastContextId;
this._contexts.set(id, new Context(id, this.getContextValuesContainer(parentContextId)));
return id;
}
disposeContext(contextId) {
if (!this._isDisposed) {
this._contexts.delete(contextId);
}
}
};
ContextKeyService = __decorate46([
__param40(0, IConfigurationService)
], ContextKeyService);
ScopedContextKeyService = class extends AbstractContextKeyService {
constructor(parent, domNode) {
super(parent.createChildContext());
this._parentChangeListener = this._register(new MutableDisposable());
this._parent = parent;
this._updateParentChangeListener();
this._domNode = domNode;
if (this._domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
let extraInfo = "";
if (this._domNode.classList) {
extraInfo = Array.from(this._domNode.classList.values()).join(", ");
}
console.error(`Element already has context attribute${extraInfo ? ": " + extraInfo : ""}`);
}
this._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(this._myContextId));
}
_updateParentChangeListener() {
this._parentChangeListener.value = this._parent.onDidChangeContext((e) => {
const thisContainer = this._parent.getContextValuesContainer(this._myContextId);
const thisContextValues = thisContainer.value;
if (!allEventKeysInContext(e, thisContextValues)) {
this._onDidChangeContext.fire(e);
}
});
}
dispose() {
if (this._isDisposed) {
return;
}
this._parent.disposeContext(this._myContextId);
this._domNode.removeAttribute(KEYBINDING_CONTEXT_ATTR);
super.dispose();
}
getContextValuesContainer(contextId) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this._parent.getContextValuesContainer(contextId);
}
createChildContext(parentContextId = this._myContextId) {
if (this._isDisposed) {
throw new Error(`ScopedContextKeyService has been disposed`);
}
return this._parent.createChildContext(parentContextId);
}
disposeContext(contextId) {
if (this._isDisposed) {
return;
}
this._parent.disposeContext(contextId);
}
};
CommandsRegistry.registerCommand("_setContext", setContext);
CommandsRegistry.registerCommand({
id: "getContextKeyInfo",
handler() {
return [...RawContextKey.all()].sort((a3, b) => a3.key.localeCompare(b.key));
},
metadata: {
description: localize("getContextKeyInfo", "A command that returns information about context keys"),
args: []
}
});
CommandsRegistry.registerCommand("_generateContextKeyInfo", function() {
const result = [];
const seen = /* @__PURE__ */ new Set();
for (const info of RawContextKey.all()) {
if (!seen.has(info.key)) {
seen.add(info.key);
result.push(info);
}
}
result.sort((a3, b) => a3.key.localeCompare(b.key));
console.log(JSON.stringify(result, void 0, 2));
});
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/graph.js
var Node3, Graph;
var init_graph = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/graph.js"() {
Node3 = class {
constructor(key, data) {
this.key = key;
this.data = data;
this.incoming = /* @__PURE__ */ new Map();
this.outgoing = /* @__PURE__ */ new Map();
}
};
Graph = class {
constructor(_hashFn) {
this._hashFn = _hashFn;
this._nodes = /* @__PURE__ */ new Map();
}
roots() {
const ret = [];
for (const node of this._nodes.values()) {
if (node.outgoing.size === 0) {
ret.push(node);
}
}
return ret;
}
insertEdge(from, to) {
const fromNode = this.lookupOrInsertNode(from);
const toNode = this.lookupOrInsertNode(to);
fromNode.outgoing.set(toNode.key, toNode);
toNode.incoming.set(fromNode.key, fromNode);
}
removeNode(data) {
const key = this._hashFn(data);
this._nodes.delete(key);
for (const node of this._nodes.values()) {
node.outgoing.delete(key);
node.incoming.delete(key);
}
}
lookupOrInsertNode(data) {
const key = this._hashFn(data);
let node = this._nodes.get(key);
if (!node) {
node = new Node3(key, data);
this._nodes.set(key, node);
}
return node;
}
isEmpty() {
return this._nodes.size === 0;
}
toString() {
const data = [];
for (const [key, value] of this._nodes) {
data.push(`${key}
(-> incoming)[${[...value.incoming.keys()].join(", ")}]
(outgoing ->)[${[...value.outgoing.keys()].join(",")}]
`);
}
return data.join("\n");
}
/**
* This is brute force and slow and **only** be used
* to trouble shoot.
*/
findCycleSlow() {
for (const [id, node] of this._nodes) {
const seen = /* @__PURE__ */ new Set([id]);
const res = this._findCycle(node, seen);
if (res) {
return res;
}
}
return void 0;
}
_findCycle(node, seen) {
for (const [id, outgoing] of node.outgoing) {
if (seen.has(id)) {
return [...seen, id].join(" -> ");
}
seen.add(id);
const value = this._findCycle(outgoing, seen);
if (value) {
return value;
}
seen.delete(id);
}
return void 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiationService.js
var _enableAllTracing, CyclicDependencyError, InstantiationService, Trace;
var init_instantiationService = __esm({
"node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiationService.js"() {
init_async();
init_errors();
init_lifecycle();
init_descriptors();
init_graph();
init_instantiation();
init_serviceCollection();
init_linkedList();
_enableAllTracing = false;
CyclicDependencyError = class extends Error {
constructor(graph) {
var _a10;
super("cyclic dependency between services");
this.message = (_a10 = graph.findCycleSlow()) !== null && _a10 !== void 0 ? _a10 : `UNABLE to detect cycle, dumping graph:
${graph.toString()}`;
}
};
InstantiationService = class _InstantiationService {
constructor(_services = new ServiceCollection(), _strict = false, _parent, _enableTracing = _enableAllTracing) {
var _a10;
this._services = _services;
this._strict = _strict;
this._parent = _parent;
this._enableTracing = _enableTracing;
this._isDisposed = false;
this._servicesToMaybeDispose = /* @__PURE__ */ new Set();
this._children = /* @__PURE__ */ new Set();
this._activeInstantiations = /* @__PURE__ */ new Set();
this._services.set(IInstantiationService, this);
this._globalGraph = _enableTracing ? (_a10 = _parent === null || _parent === void 0 ? void 0 : _parent._globalGraph) !== null && _a10 !== void 0 ? _a10 : new Graph((e) => e) : void 0;
}
dispose() {
if (!this._isDisposed) {
this._isDisposed = true;
dispose(this._children);
this._children.clear();
for (const candidate of this._servicesToMaybeDispose) {
if (isDisposable(candidate)) {
candidate.dispose();
}
}
this._servicesToMaybeDispose.clear();
}
}
_throwIfDisposed() {
if (this._isDisposed) {
throw new Error("InstantiationService has been disposed");
}
}
createChild(services, store) {
this._throwIfDisposed();
const that = this;
const result = new class extends _InstantiationService {
dispose() {
that._children.delete(result);
super.dispose();
}
}(services, this._strict, this, this._enableTracing);
this._children.add(result);
store === null || store === void 0 ? void 0 : store.add(result);
return result;
}
invokeFunction(fn, ...args) {
this._throwIfDisposed();
const _trace = Trace.traceInvocation(this._enableTracing, fn);
let _done = false;
try {
const accessor = {
get: (id) => {
if (_done) {
throw illegalState("service accessor is only valid during the invocation of its target method");
}
const result = this._getOrCreateServiceInstance(id, _trace);
if (!result) {
throw new Error(`[invokeFunction] unknown service '${id}'`);
}
return result;
}
};
return fn(accessor, ...args);
} finally {
_done = true;
_trace.stop();
}
}
createInstance(ctorOrDescriptor, ...rest) {
this._throwIfDisposed();
let _trace;
let result;
if (ctorOrDescriptor instanceof SyncDescriptor) {
_trace = Trace.traceCreation(this._enableTracing, ctorOrDescriptor.ctor);
result = this._createInstance(ctorOrDescriptor.ctor, ctorOrDescriptor.staticArguments.concat(rest), _trace);
} else {
_trace = Trace.traceCreation(this._enableTracing, ctorOrDescriptor);
result = this._createInstance(ctorOrDescriptor, rest, _trace);
}
_trace.stop();
return result;
}
_createInstance(ctor, args = [], _trace) {
const serviceDependencies = _util.getServiceDependencies(ctor).sort((a3, b) => a3.index - b.index);
const serviceArgs = [];
for (const dependency of serviceDependencies) {
const service = this._getOrCreateServiceInstance(dependency.id, _trace);
if (!service) {
this._throwIfStrict(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`, false);
}
serviceArgs.push(service);
}
const firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;
if (args.length !== firstServiceArgPos) {
console.trace(`[createInstance] First service dependency of ${ctor.name} at position ${firstServiceArgPos + 1} conflicts with ${args.length} static arguments`);
const delta = firstServiceArgPos - args.length;
if (delta > 0) {
args = args.concat(new Array(delta));
} else {
args = args.slice(0, firstServiceArgPos);
}
}
return Reflect.construct(ctor, args.concat(serviceArgs));
}
_setCreatedServiceInstance(id, instance) {
if (this._services.get(id) instanceof SyncDescriptor) {
this._services.set(id, instance);
} else if (this._parent) {
this._parent._setCreatedServiceInstance(id, instance);
} else {
throw new Error("illegalState - setting UNKNOWN service instance");
}
}
_getServiceInstanceOrDescriptor(id) {
const instanceOrDesc = this._services.get(id);
if (!instanceOrDesc && this._parent) {
return this._parent._getServiceInstanceOrDescriptor(id);
} else {
return instanceOrDesc;
}
}
_getOrCreateServiceInstance(id, _trace) {
if (this._globalGraph && this._globalGraphImplicitDependency) {
this._globalGraph.insertEdge(this._globalGraphImplicitDependency, String(id));
}
const thing = this._getServiceInstanceOrDescriptor(id);
if (thing instanceof SyncDescriptor) {
return this._safeCreateAndCacheServiceInstance(id, thing, _trace.branch(id, true));
} else {
_trace.branch(id, false);
return thing;
}
}
_safeCreateAndCacheServiceInstance(id, desc, _trace) {
if (this._activeInstantiations.has(id)) {
throw new Error(`illegal state - RECURSIVELY instantiating service '${id}'`);
}
this._activeInstantiations.add(id);
try {
return this._createAndCacheServiceInstance(id, desc, _trace);
} finally {
this._activeInstantiations.delete(id);
}
}
_createAndCacheServiceInstance(id, desc, _trace) {
var _a10;
const graph = new Graph((data) => data.id.toString());
let cycleCount = 0;
const stack = [{ id, desc, _trace }];
while (stack.length) {
const item = stack.pop();
graph.lookupOrInsertNode(item);
if (cycleCount++ > 1e3) {
throw new CyclicDependencyError(graph);
}
for (const dependency of _util.getServiceDependencies(item.desc.ctor)) {
const instanceOrDesc = this._getServiceInstanceOrDescriptor(dependency.id);
if (!instanceOrDesc) {
this._throwIfStrict(`[createInstance] ${id} depends on ${dependency.id} which is NOT registered.`, true);
}
(_a10 = this._globalGraph) === null || _a10 === void 0 ? void 0 : _a10.insertEdge(String(item.id), String(dependency.id));
if (instanceOrDesc instanceof SyncDescriptor) {
const d = { id: dependency.id, desc: instanceOrDesc, _trace: item._trace.branch(dependency.id, true) };
graph.insertEdge(item, d);
stack.push(d);
}
}
}
while (true) {
const roots = graph.roots();
if (roots.length === 0) {
if (!graph.isEmpty()) {
throw new CyclicDependencyError(graph);
}
break;
}
for (const { data } of roots) {
const instanceOrDesc = this._getServiceInstanceOrDescriptor(data.id);
if (instanceOrDesc instanceof SyncDescriptor) {
const instance = this._createServiceInstanceWithOwner(data.id, data.desc.ctor, data.desc.staticArguments, data.desc.supportsDelayedInstantiation, data._trace);
this._setCreatedServiceInstance(data.id, instance);
}
graph.removeNode(data);
}
}
return this._getServiceInstanceOrDescriptor(id);
}
_createServiceInstanceWithOwner(id, ctor, args = [], supportsDelayedInstantiation, _trace) {
if (this._services.get(id) instanceof SyncDescriptor) {
return this._createServiceInstance(id, ctor, args, supportsDelayedInstantiation, _trace, this._servicesToMaybeDispose);
} else if (this._parent) {
return this._parent._createServiceInstanceWithOwner(id, ctor, args, supportsDelayedInstantiation, _trace);
} else {
throw new Error(`illegalState - creating UNKNOWN service instance ${ctor.name}`);
}
}
_createServiceInstance(id, ctor, args = [], supportsDelayedInstantiation, _trace, disposeBucket) {
if (!supportsDelayedInstantiation) {
const result = this._createInstance(ctor, args, _trace);
disposeBucket.add(result);
return result;
} else {
const child = new _InstantiationService(void 0, this._strict, this, this._enableTracing);
child._globalGraphImplicitDependency = String(id);
const earlyListeners = /* @__PURE__ */ new Map();
const idle = new GlobalIdleValue(() => {
const result = child._createInstance(ctor, args, _trace);
for (const [key, values2] of earlyListeners) {
const candidate = result[key];
if (typeof candidate === "function") {
for (const value of values2) {
value.disposable = candidate.apply(result, value.listener);
}
}
}
earlyListeners.clear();
disposeBucket.add(result);
return result;
});
return new Proxy(/* @__PURE__ */ Object.create(null), {
get(target, key) {
if (!idle.isInitialized) {
if (typeof key === "string" && (key.startsWith("onDid") || key.startsWith("onWill"))) {
let list = earlyListeners.get(key);
if (!list) {
list = new LinkedList();
earlyListeners.set(key, list);
}
const event = (callback, thisArg, disposables) => {
if (idle.isInitialized) {
return idle.value[key](callback, thisArg, disposables);
} else {
const entry = { listener: [callback, thisArg, disposables], disposable: void 0 };
const rm = list.push(entry);
const result = toDisposable(() => {
var _a10;
rm();
(_a10 = entry.disposable) === null || _a10 === void 0 ? void 0 : _a10.dispose();
});
return result;
}
};
return event;
}
}
if (key in target) {
return target[key];
}
const obj = idle.value;
let prop = obj[key];
if (typeof prop !== "function") {
return prop;
}
prop = prop.bind(obj);
target[key] = prop;
return prop;
},
set(_target, p, value) {
idle.value[p] = value;
return true;
},
getPrototypeOf(_target) {
return ctor.prototype;
}
});
}
}
_throwIfStrict(msg, printWarning) {
if (printWarning) {
console.warn(msg);
}
if (this._strict) {
throw new Error(msg);
}
}
};
Trace = class _Trace {
static traceInvocation(_enableTracing, ctor) {
return !_enableTracing ? _Trace._None : new _Trace(2, ctor.name || new Error().stack.split("\n").slice(3, 4).join("\n"));
}
static traceCreation(_enableTracing, ctor) {
return !_enableTracing ? _Trace._None : new _Trace(1, ctor.name);
}
constructor(type, name) {
this.type = type;
this.name = name;
this._start = Date.now();
this._dep = [];
}
branch(id, first2) {
const child = new _Trace(3, id.toString());
this._dep.push([id, first2, child]);
return child;
}
stop() {
const dur = Date.now() - this._start;
_Trace._totals += dur;
let causedCreation = false;
function printChild(n, trace) {
const res = [];
const prefix = new Array(n + 1).join(" ");
for (const [id, first2, child] of trace._dep) {
if (first2 && child) {
causedCreation = true;
res.push(`${prefix}CREATES -> ${id}`);
const nested = printChild(n + 1, child);
if (nested) {
res.push(nested);
}
} else {
res.push(`${prefix}uses -> ${id}`);
}
}
return res.join("\n");
}
const lines = [
`${this.type === 1 ? "CREATE" : "CALL"} ${this.name}`,
`${printChild(1, this)}`,
`DONE, took ${dur.toFixed(2)}ms (grand total ${_Trace._totals.toFixed(2)}ms)`
];
if (dur > 2 || causedCreation) {
_Trace.all.add(lines.join("\n"));
}
}
};
Trace.all = /* @__PURE__ */ new Set();
Trace._None = new class extends Trace {
constructor() {
super(0, null);
}
stop() {
}
branch() {
return this;
}
}();
Trace._totals = 0;
}
});
// node_modules/monaco-editor/esm/vs/platform/markers/common/markerService.js
var unsupportedSchemas, DoubleResourceMap, MarkerStats, MarkerService;
var init_markerService = __esm({
"node_modules/monaco-editor/esm/vs/platform/markers/common/markerService.js"() {
init_arrays();
init_event();
init_iterator();
init_map();
init_network();
init_uri();
init_markers();
unsupportedSchemas = /* @__PURE__ */ new Set([
Schemas.inMemory,
Schemas.vscodeSourceControl,
Schemas.walkThrough,
Schemas.walkThroughSnippet,
Schemas.vscodeChatCodeBlock,
Schemas.vscodeCopilotBackingChatCodeBlock
]);
DoubleResourceMap = class {
constructor() {
this._byResource = new ResourceMap();
this._byOwner = /* @__PURE__ */ new Map();
}
set(resource, owner, value) {
let ownerMap = this._byResource.get(resource);
if (!ownerMap) {
ownerMap = /* @__PURE__ */ new Map();
this._byResource.set(resource, ownerMap);
}
ownerMap.set(owner, value);
let resourceMap = this._byOwner.get(owner);
if (!resourceMap) {
resourceMap = new ResourceMap();
this._byOwner.set(owner, resourceMap);
}
resourceMap.set(resource, value);
}
get(resource, owner) {
const ownerMap = this._byResource.get(resource);
return ownerMap === null || ownerMap === void 0 ? void 0 : ownerMap.get(owner);
}
delete(resource, owner) {
let removedA = false;
let removedB = false;
const ownerMap = this._byResource.get(resource);
if (ownerMap) {
removedA = ownerMap.delete(owner);
}
const resourceMap = this._byOwner.get(owner);
if (resourceMap) {
removedB = resourceMap.delete(resource);
}
if (removedA !== removedB) {
throw new Error("illegal state");
}
return removedA && removedB;
}
values(key) {
var _a10, _b4, _c2, _d2;
if (typeof key === "string") {
return (_b4 = (_a10 = this._byOwner.get(key)) === null || _a10 === void 0 ? void 0 : _a10.values()) !== null && _b4 !== void 0 ? _b4 : Iterable.empty();
}
if (URI.isUri(key)) {
return (_d2 = (_c2 = this._byResource.get(key)) === null || _c2 === void 0 ? void 0 : _c2.values()) !== null && _d2 !== void 0 ? _d2 : Iterable.empty();
}
return Iterable.map(Iterable.concat(...this._byOwner.values()), (map) => map[1]);
}
};
MarkerStats = class {
constructor(service) {
this.errors = 0;
this.infos = 0;
this.warnings = 0;
this.unknowns = 0;
this._data = new ResourceMap();
this._service = service;
this._subscription = service.onMarkerChanged(this._update, this);
}
dispose() {
this._subscription.dispose();
}
_update(resources) {
for (const resource of resources) {
const oldStats = this._data.get(resource);
if (oldStats) {
this._substract(oldStats);
}
const newStats = this._resourceStats(resource);
this._add(newStats);
this._data.set(resource, newStats);
}
}
_resourceStats(resource) {
const result = { errors: 0, warnings: 0, infos: 0, unknowns: 0 };
if (unsupportedSchemas.has(resource.scheme)) {
return result;
}
for (const { severity } of this._service.read({ resource })) {
if (severity === MarkerSeverity2.Error) {
result.errors += 1;
} else if (severity === MarkerSeverity2.Warning) {
result.warnings += 1;
} else if (severity === MarkerSeverity2.Info) {
result.infos += 1;
} else {
result.unknowns += 1;
}
}
return result;
}
_substract(op) {
this.errors -= op.errors;
this.warnings -= op.warnings;
this.infos -= op.infos;
this.unknowns -= op.unknowns;
}
_add(op) {
this.errors += op.errors;
this.warnings += op.warnings;
this.infos += op.infos;
this.unknowns += op.unknowns;
}
};
MarkerService = class _MarkerService {
constructor() {
this._onMarkerChanged = new DebounceEmitter({
delay: 0,
merge: _MarkerService._merge
});
this.onMarkerChanged = this._onMarkerChanged.event;
this._data = new DoubleResourceMap();
this._stats = new MarkerStats(this);
}
dispose() {
this._stats.dispose();
this._onMarkerChanged.dispose();
}
remove(owner, resources) {
for (const resource of resources || []) {
this.changeOne(owner, resource, []);
}
}
changeOne(owner, resource, markerData) {
if (isFalsyOrEmpty(markerData)) {
const removed = this._data.delete(resource, owner);
if (removed) {
this._onMarkerChanged.fire([resource]);
}
} else {
const markers = [];
for (const data of markerData) {
const marker = _MarkerService._toMarker(owner, resource, data);
if (marker) {
markers.push(marker);
}
}
this._data.set(resource, owner, markers);
this._onMarkerChanged.fire([resource]);
}
}
static _toMarker(owner, resource, data) {
let { code, severity, message, source, startLineNumber, startColumn, endLineNumber, endColumn, relatedInformation, tags } = data;
if (!message) {
return void 0;
}
startLineNumber = startLineNumber > 0 ? startLineNumber : 1;
startColumn = startColumn > 0 ? startColumn : 1;
endLineNumber = endLineNumber >= startLineNumber ? endLineNumber : startLineNumber;
endColumn = endColumn > 0 ? endColumn : startColumn;
return {
resource,
owner,
code,
severity,
message,
source,
startLineNumber,
startColumn,
endLineNumber,
endColumn,
relatedInformation,
tags
};
}
changeAll(owner, data) {
const changes = [];
const existing = this._data.values(owner);
if (existing) {
for (const data2 of existing) {
const first2 = Iterable.first(data2);
if (first2) {
changes.push(first2.resource);
this._data.delete(first2.resource, owner);
}
}
}
if (isNonEmptyArray(data)) {
const groups = new ResourceMap();
for (const { resource, marker: markerData } of data) {
const marker = _MarkerService._toMarker(owner, resource, markerData);
if (!marker) {
continue;
}
const array2 = groups.get(resource);
if (!array2) {
groups.set(resource, [marker]);
changes.push(resource);
} else {
array2.push(marker);
}
}
for (const [resource, value] of groups) {
this._data.set(resource, owner, value);
}
}
if (changes.length > 0) {
this._onMarkerChanged.fire(changes);
}
}
read(filter = /* @__PURE__ */ Object.create(null)) {
let { owner, resource, severities, take } = filter;
if (!take || take < 0) {
take = -1;
}
if (owner && resource) {
const data = this._data.get(resource, owner);
if (!data) {
return [];
} else {
const result = [];
for (const marker of data) {
if (_MarkerService._accept(marker, severities)) {
const newLen = result.push(marker);
if (take > 0 && newLen === take) {
break;
}
}
}
return result;
}
} else if (!owner && !resource) {
const result = [];
for (const markers of this._data.values()) {
for (const data of markers) {
if (_MarkerService._accept(data, severities)) {
const newLen = result.push(data);
if (take > 0 && newLen === take) {
return result;
}
}
}
}
return result;
} else {
const iterable = this._data.values(resource !== null && resource !== void 0 ? resource : owner);
const result = [];
for (const markers of iterable) {
for (const data of markers) {
if (_MarkerService._accept(data, severities)) {
const newLen = result.push(data);
if (take > 0 && newLen === take) {
return result;
}
}
}
}
return result;
}
}
static _accept(marker, severities) {
return severities === void 0 || (severities & marker.severity) === marker.severity;
}
// --- event debounce logic
static _merge(all) {
const set = new ResourceMap();
for (const array2 of all) {
for (const item of array2) {
set.set(item, true);
}
}
return Array.from(set.keys());
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/configuration/common/configurations.js
var DefaultConfiguration;
var init_configurations = __esm({
"node_modules/monaco-editor/esm/vs/platform/configuration/common/configurations.js"() {
init_lifecycle();
init_configurationModels();
init_configurationRegistry();
init_platform2();
DefaultConfiguration = class extends Disposable {
get configurationModel() {
return this._configurationModel;
}
constructor(logService) {
super();
this.logService = logService;
this._configurationModel = ConfigurationModel.createEmptyModel(this.logService);
}
reload() {
this.resetConfigurationModel();
return this.configurationModel;
}
getConfigurationDefaultOverrides() {
return {};
}
resetConfigurationModel() {
this._configurationModel = ConfigurationModel.createEmptyModel(this.logService);
const properties = Registry.as(Extensions4.Configuration).getConfigurationProperties();
this.updateConfigurationModel(Object.keys(properties), properties);
}
updateConfigurationModel(properties, configurationProperties) {
const configurationDefaultsOverrides = this.getConfigurationDefaultOverrides();
for (const key of properties) {
const defaultOverrideValue = configurationDefaultsOverrides[key];
const propertySchema = configurationProperties[key];
if (defaultOverrideValue !== void 0) {
this._configurationModel.addValue(key, defaultOverrideValue);
} else if (propertySchema) {
this._configurationModel.addValue(key, propertySchema.default);
} else {
this._configurationModel.removeValue(key);
}
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js
var IAccessibilitySignalService, AcknowledgeDocCommentsToken, Sound, SoundSource, AccessibilitySignal;
var init_accessibilitySignalService = __esm({
"node_modules/monaco-editor/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js"() {
init_nls();
init_instantiation();
IAccessibilitySignalService = createDecorator("accessibilitySignalService");
AcknowledgeDocCommentsToken = Symbol("AcknowledgeDocCommentsToken");
Sound = class _Sound {
static register(options2) {
const sound = new _Sound(options2.fileName);
return sound;
}
constructor(fileName) {
this.fileName = fileName;
}
};
Sound.error = Sound.register({ fileName: "error.mp3" });
Sound.warning = Sound.register({ fileName: "warning.mp3" });
Sound.success = Sound.register({ fileName: "success.mp3" });
Sound.foldedArea = Sound.register({ fileName: "foldedAreas.mp3" });
Sound.break = Sound.register({ fileName: "break.mp3" });
Sound.quickFixes = Sound.register({ fileName: "quickFixes.mp3" });
Sound.taskCompleted = Sound.register({ fileName: "taskCompleted.mp3" });
Sound.taskFailed = Sound.register({ fileName: "taskFailed.mp3" });
Sound.terminalBell = Sound.register({ fileName: "terminalBell.mp3" });
Sound.diffLineInserted = Sound.register({ fileName: "diffLineInserted.mp3" });
Sound.diffLineDeleted = Sound.register({ fileName: "diffLineDeleted.mp3" });
Sound.diffLineModified = Sound.register({ fileName: "diffLineModified.mp3" });
Sound.chatRequestSent = Sound.register({ fileName: "chatRequestSent.mp3" });
Sound.chatResponseReceived1 = Sound.register({ fileName: "chatResponseReceived1.mp3" });
Sound.chatResponseReceived2 = Sound.register({ fileName: "chatResponseReceived2.mp3" });
Sound.chatResponseReceived3 = Sound.register({ fileName: "chatResponseReceived3.mp3" });
Sound.chatResponseReceived4 = Sound.register({ fileName: "chatResponseReceived4.mp3" });
Sound.clear = Sound.register({ fileName: "clear.mp3" });
Sound.save = Sound.register({ fileName: "save.mp3" });
Sound.format = Sound.register({ fileName: "format.mp3" });
Sound.voiceRecordingStarted = Sound.register({ fileName: "voiceRecordingStarted.mp3" });
Sound.voiceRecordingStopped = Sound.register({ fileName: "voiceRecordingStopped.mp3" });
Sound.progress = Sound.register({ fileName: "progress.mp3" });
SoundSource = class {
constructor(randomOneOf) {
this.randomOneOf = randomOneOf;
}
};
AccessibilitySignal = class _AccessibilitySignal {
constructor(sound, name, legacySoundSettingsKey, settingsKey, legacyAnnouncementSettingsKey, announcementMessage, delaySettingsKey) {
this.sound = sound;
this.name = name;
this.legacySoundSettingsKey = legacySoundSettingsKey;
this.settingsKey = settingsKey;
this.legacyAnnouncementSettingsKey = legacyAnnouncementSettingsKey;
this.announcementMessage = announcementMessage;
this.delaySettingsKey = delaySettingsKey;
}
static register(options2) {
const soundSource = new SoundSource("randomOneOf" in options2.sound ? options2.sound.randomOneOf : [options2.sound]);
const signal = new _AccessibilitySignal(soundSource, options2.name, options2.legacySoundSettingsKey, options2.settingsKey, options2.legacyAnnouncementSettingsKey, options2.announcementMessage, options2.delaySettingsKey);
_AccessibilitySignal._signals.add(signal);
return signal;
}
};
AccessibilitySignal._signals = /* @__PURE__ */ new Set();
AccessibilitySignal.errorAtPosition = AccessibilitySignal.register({
name: localize("accessibilitySignals.positionHasError.name", "Error at Position"),
sound: Sound.error,
announcementMessage: localize("accessibility.signals.positionHasError", "Error"),
settingsKey: "accessibility.signals.positionHasError",
delaySettingsKey: "accessibility.signalOptions.delays.errorAtPosition"
});
AccessibilitySignal.warningAtPosition = AccessibilitySignal.register({
name: localize("accessibilitySignals.positionHasWarning.name", "Warning at Position"),
sound: Sound.warning,
announcementMessage: localize("accessibility.signals.positionHasWarning", "Warning"),
settingsKey: "accessibility.signals.positionHasWarning",
delaySettingsKey: "accessibility.signalOptions.delays.warningAtPosition"
});
AccessibilitySignal.errorOnLine = AccessibilitySignal.register({
name: localize("accessibilitySignals.lineHasError.name", "Error on Line"),
sound: Sound.error,
legacySoundSettingsKey: "audioCues.lineHasError",
legacyAnnouncementSettingsKey: "accessibility.alert.error",
announcementMessage: localize("accessibility.signals.lineHasError", "Error on Line"),
settingsKey: "accessibility.signals.lineHasError"
});
AccessibilitySignal.warningOnLine = AccessibilitySignal.register({
name: localize("accessibilitySignals.lineHasWarning.name", "Warning on Line"),
sound: Sound.warning,
legacySoundSettingsKey: "audioCues.lineHasWarning",
legacyAnnouncementSettingsKey: "accessibility.alert.warning",
announcementMessage: localize("accessibility.signals.lineHasWarning", "Warning on Line"),
settingsKey: "accessibility.signals.lineHasWarning"
});
AccessibilitySignal.foldedArea = AccessibilitySignal.register({
name: localize("accessibilitySignals.lineHasFoldedArea.name", "Folded Area on Line"),
sound: Sound.foldedArea,
legacySoundSettingsKey: "audioCues.lineHasFoldedArea",
legacyAnnouncementSettingsKey: "accessibility.alert.foldedArea",
announcementMessage: localize("accessibility.signals.lineHasFoldedArea", "Folded"),
settingsKey: "accessibility.signals.lineHasFoldedArea"
});
AccessibilitySignal.break = AccessibilitySignal.register({
name: localize("accessibilitySignals.lineHasBreakpoint.name", "Breakpoint on Line"),
sound: Sound.break,
legacySoundSettingsKey: "audioCues.lineHasBreakpoint",
legacyAnnouncementSettingsKey: "accessibility.alert.breakpoint",
announcementMessage: localize("accessibility.signals.lineHasBreakpoint", "Breakpoint"),
settingsKey: "accessibility.signals.lineHasBreakpoint"
});
AccessibilitySignal.inlineSuggestion = AccessibilitySignal.register({
name: localize("accessibilitySignals.lineHasInlineSuggestion.name", "Inline Suggestion on Line"),
sound: Sound.quickFixes,
legacySoundSettingsKey: "audioCues.lineHasInlineSuggestion",
settingsKey: "accessibility.signals.lineHasInlineSuggestion"
});
AccessibilitySignal.terminalQuickFix = AccessibilitySignal.register({
name: localize("accessibilitySignals.terminalQuickFix.name", "Terminal Quick Fix"),
sound: Sound.quickFixes,
legacySoundSettingsKey: "audioCues.terminalQuickFix",
legacyAnnouncementSettingsKey: "accessibility.alert.terminalQuickFix",
announcementMessage: localize("accessibility.signals.terminalQuickFix", "Quick Fix"),
settingsKey: "accessibility.signals.terminalQuickFix"
});
AccessibilitySignal.onDebugBreak = AccessibilitySignal.register({
name: localize("accessibilitySignals.onDebugBreak.name", "Debugger Stopped on Breakpoint"),
sound: Sound.break,
legacySoundSettingsKey: "audioCues.onDebugBreak",
legacyAnnouncementSettingsKey: "accessibility.alert.onDebugBreak",
announcementMessage: localize("accessibility.signals.onDebugBreak", "Breakpoint"),
settingsKey: "accessibility.signals.onDebugBreak"
});
AccessibilitySignal.noInlayHints = AccessibilitySignal.register({
name: localize("accessibilitySignals.noInlayHints", "No Inlay Hints on Line"),
sound: Sound.error,
legacySoundSettingsKey: "audioCues.noInlayHints",
legacyAnnouncementSettingsKey: "accessibility.alert.noInlayHints",
announcementMessage: localize("accessibility.signals.noInlayHints", "No Inlay Hints"),
settingsKey: "accessibility.signals.noInlayHints"
});
AccessibilitySignal.taskCompleted = AccessibilitySignal.register({
name: localize("accessibilitySignals.taskCompleted", "Task Completed"),
sound: Sound.taskCompleted,
legacySoundSettingsKey: "audioCues.taskCompleted",
legacyAnnouncementSettingsKey: "accessibility.alert.taskCompleted",
announcementMessage: localize("accessibility.signals.taskCompleted", "Task Completed"),
settingsKey: "accessibility.signals.taskCompleted"
});
AccessibilitySignal.taskFailed = AccessibilitySignal.register({
name: localize("accessibilitySignals.taskFailed", "Task Failed"),
sound: Sound.taskFailed,
legacySoundSettingsKey: "audioCues.taskFailed",
legacyAnnouncementSettingsKey: "accessibility.alert.taskFailed",
announcementMessage: localize("accessibility.signals.taskFailed", "Task Failed"),
settingsKey: "accessibility.signals.taskFailed"
});
AccessibilitySignal.terminalCommandFailed = AccessibilitySignal.register({
name: localize("accessibilitySignals.terminalCommandFailed", "Terminal Command Failed"),
sound: Sound.error,
legacySoundSettingsKey: "audioCues.terminalCommandFailed",
legacyAnnouncementSettingsKey: "accessibility.alert.terminalCommandFailed",
announcementMessage: localize("accessibility.signals.terminalCommandFailed", "Command Failed"),
settingsKey: "accessibility.signals.terminalCommandFailed"
});
AccessibilitySignal.terminalCommandSucceeded = AccessibilitySignal.register({
name: localize("accessibilitySignals.terminalCommandSucceeded", "Terminal Command Succeeded"),
sound: Sound.success,
announcementMessage: localize("accessibility.signals.terminalCommandSucceeded", "Command Succeeded"),
settingsKey: "accessibility.signals.terminalCommandSucceeded"
});
AccessibilitySignal.terminalBell = AccessibilitySignal.register({
name: localize("accessibilitySignals.terminalBell", "Terminal Bell"),
sound: Sound.terminalBell,
legacySoundSettingsKey: "audioCues.terminalBell",
legacyAnnouncementSettingsKey: "accessibility.alert.terminalBell",
announcementMessage: localize("accessibility.signals.terminalBell", "Terminal Bell"),
settingsKey: "accessibility.signals.terminalBell"
});
AccessibilitySignal.notebookCellCompleted = AccessibilitySignal.register({
name: localize("accessibilitySignals.notebookCellCompleted", "Notebook Cell Completed"),
sound: Sound.taskCompleted,
legacySoundSettingsKey: "audioCues.notebookCellCompleted",
legacyAnnouncementSettingsKey: "accessibility.alert.notebookCellCompleted",
announcementMessage: localize("accessibility.signals.notebookCellCompleted", "Notebook Cell Completed"),
settingsKey: "accessibility.signals.notebookCellCompleted"
});
AccessibilitySignal.notebookCellFailed = AccessibilitySignal.register({
name: localize("accessibilitySignals.notebookCellFailed", "Notebook Cell Failed"),
sound: Sound.taskFailed,
legacySoundSettingsKey: "audioCues.notebookCellFailed",
legacyAnnouncementSettingsKey: "accessibility.alert.notebookCellFailed",
announcementMessage: localize("accessibility.signals.notebookCellFailed", "Notebook Cell Failed"),
settingsKey: "accessibility.signals.notebookCellFailed"
});
AccessibilitySignal.diffLineInserted = AccessibilitySignal.register({
name: localize("accessibilitySignals.diffLineInserted", "Diff Line Inserted"),
sound: Sound.diffLineInserted,
legacySoundSettingsKey: "audioCues.diffLineInserted",
settingsKey: "accessibility.signals.diffLineInserted"
});
AccessibilitySignal.diffLineDeleted = AccessibilitySignal.register({
name: localize("accessibilitySignals.diffLineDeleted", "Diff Line Deleted"),
sound: Sound.diffLineDeleted,
legacySoundSettingsKey: "audioCues.diffLineDeleted",
settingsKey: "accessibility.signals.diffLineDeleted"
});
AccessibilitySignal.diffLineModified = AccessibilitySignal.register({
name: localize("accessibilitySignals.diffLineModified", "Diff Line Modified"),
sound: Sound.diffLineModified,
legacySoundSettingsKey: "audioCues.diffLineModified",
settingsKey: "accessibility.signals.diffLineModified"
});
AccessibilitySignal.chatRequestSent = AccessibilitySignal.register({
name: localize("accessibilitySignals.chatRequestSent", "Chat Request Sent"),
sound: Sound.chatRequestSent,
legacySoundSettingsKey: "audioCues.chatRequestSent",
legacyAnnouncementSettingsKey: "accessibility.alert.chatRequestSent",
announcementMessage: localize("accessibility.signals.chatRequestSent", "Chat Request Sent"),
settingsKey: "accessibility.signals.chatRequestSent"
});
AccessibilitySignal.chatResponseReceived = AccessibilitySignal.register({
name: localize("accessibilitySignals.chatResponseReceived", "Chat Response Received"),
legacySoundSettingsKey: "audioCues.chatResponseReceived",
sound: {
randomOneOf: [
Sound.chatResponseReceived1,
Sound.chatResponseReceived2,
Sound.chatResponseReceived3,
Sound.chatResponseReceived4
]
},
settingsKey: "accessibility.signals.chatResponseReceived"
});
AccessibilitySignal.progress = AccessibilitySignal.register({
name: localize("accessibilitySignals.progress", "Progress"),
sound: Sound.progress,
legacySoundSettingsKey: "audioCues.chatResponsePending",
legacyAnnouncementSettingsKey: "accessibility.alert.progress",
announcementMessage: localize("accessibility.signals.progress", "Progress"),
settingsKey: "accessibility.signals.progress"
});
AccessibilitySignal.clear = AccessibilitySignal.register({
name: localize("accessibilitySignals.clear", "Clear"),
sound: Sound.clear,
legacySoundSettingsKey: "audioCues.clear",
legacyAnnouncementSettingsKey: "accessibility.alert.clear",
announcementMessage: localize("accessibility.signals.clear", "Clear"),
settingsKey: "accessibility.signals.clear"
});
AccessibilitySignal.save = AccessibilitySignal.register({
name: localize("accessibilitySignals.save", "Save"),
sound: Sound.save,
legacySoundSettingsKey: "audioCues.save",
legacyAnnouncementSettingsKey: "accessibility.alert.save",
announcementMessage: localize("accessibility.signals.save", "Save"),
settingsKey: "accessibility.signals.save"
});
AccessibilitySignal.format = AccessibilitySignal.register({
name: localize("accessibilitySignals.format", "Format"),
sound: Sound.format,
legacySoundSettingsKey: "audioCues.format",
legacyAnnouncementSettingsKey: "accessibility.alert.format",
announcementMessage: localize("accessibility.signals.format", "Format"),
settingsKey: "accessibility.signals.format"
});
AccessibilitySignal.voiceRecordingStarted = AccessibilitySignal.register({
name: localize("accessibilitySignals.voiceRecordingStarted", "Voice Recording Started"),
sound: Sound.voiceRecordingStarted,
legacySoundSettingsKey: "audioCues.voiceRecordingStarted",
settingsKey: "accessibility.signals.voiceRecordingStarted"
});
AccessibilitySignal.voiceRecordingStopped = AccessibilitySignal.register({
name: localize("accessibilitySignals.voiceRecordingStopped", "Voice Recording Stopped"),
sound: Sound.voiceRecordingStopped,
legacySoundSettingsKey: "audioCues.voiceRecordingStopped",
settingsKey: "accessibility.signals.voiceRecordingStopped"
});
}
});
// node_modules/monaco-editor/esm/vs/platform/log/common/logService.js
var LogService;
var init_logService = __esm({
"node_modules/monaco-editor/esm/vs/platform/log/common/logService.js"() {
init_lifecycle();
init_log();
LogService = class extends Disposable {
constructor(primaryLogger, otherLoggers = []) {
super();
this.logger = new MultiplexLogger([primaryLogger, ...otherLoggers]);
this._register(primaryLogger.onDidChangeLogLevel((level) => this.setLevel(level)));
}
get onDidChangeLogLevel() {
return this.logger.onDidChangeLogLevel;
}
setLevel(level) {
this.logger.setLevel(level);
}
getLevel() {
return this.logger.getLevel();
}
trace(message, ...args) {
this.logger.trace(message, ...args);
}
debug(message, ...args) {
this.logger.debug(message, ...args);
}
info(message, ...args) {
this.logger.info(message, ...args);
}
warn(message, ...args) {
this.logger.warn(message, ...args);
}
error(message, ...args) {
this.logger.error(message, ...args);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/editorFeatures.js
function registerEditorFeature(ctor) {
editorFeatures.push(ctor);
}
function getEditorFeatures() {
return editorFeatures.slice(0);
}
var editorFeatures;
var init_editorFeatures = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/editorFeatures.js"() {
editorFeatures = [];
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js
function isConfigurationOverrides(thing) {
return thing && typeof thing === "object" && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === "string") && (!thing.resource || thing.resource instanceof URI);
}
function updateConfigurationService(configurationService, source, isDiffEditor2) {
if (!source) {
return;
}
if (!(configurationService instanceof StandaloneConfigurationService)) {
return;
}
const toUpdate = [];
Object.keys(source).forEach((key) => {
if (isEditorConfigurationKey(key)) {
toUpdate.push([`editor.${key}`, source[key]]);
}
if (isDiffEditor2 && isDiffEditorConfigurationKey(key)) {
toUpdate.push([`diffEditor.${key}`, source[key]]);
}
});
if (toUpdate.length > 0) {
configurationService.updateValues(toUpdate);
}
}
var __decorate47, __param41, SimpleModel, StandaloneTextModelService, StandaloneEditorProgressService, StandaloneProgressService, StandaloneEnvironmentService, StandaloneDialogService, StandaloneNotificationService, StandaloneCommandService, StandaloneKeybindingService, DomNodeListeners, StandaloneConfigurationService, StandaloneResourceConfigurationService, StandaloneResourcePropertiesService, StandaloneTelemetryService, StandaloneWorkspaceContextService, StandaloneBulkEditService, StandaloneUriLabelService, StandaloneContextViewService, StandaloneWorkspaceTrustManagementService, StandaloneLanguageService, StandaloneLogService, StandaloneContextMenuService, StandaloneAccessbilitySignalService, StandaloneServices;
var init_standaloneServices = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js"() {
init_languageConfigurationRegistry();
init_standaloneCodeEditorService();
init_standaloneLayoutService();
init_undoRedoService();
init_languageFeatureDebounce();
init_semanticTokensStylingService();
init_languageFeaturesService();
init_hoverService();
init_strings();
init_dom();
init_keyboardEvent();
init_event();
init_keybindings();
init_lifecycle();
init_platform();
init_severity();
init_uri();
init_bulkEditService();
init_editorConfigurationSchema();
init_editOperation();
init_position();
init_range();
init_model();
init_resolverService();
init_textResourceConfiguration();
init_commands();
init_configuration();
init_configurationModels();
init_contextkey();
init_dialogs();
init_instantiation();
init_abstractKeybindingService();
init_keybinding();
init_keybindingResolver();
init_keybindingsRegistry();
init_resolvedKeybindingItem();
init_usLayoutResolvedKeybinding();
init_label();
init_notification();
init_progress();
init_telemetry();
init_workspace();
init_layoutService();
init_standaloneStrings();
init_resources();
init_codeEditorService();
init_log();
init_workspaceTrust();
init_contextView();
init_contextViewService();
init_languageService();
init_contextMenuService();
init_extensions();
init_openerService();
init_editorWorker();
init_editorWorkerService();
init_language();
init_markerDecorationsService();
init_markerDecorations();
init_modelService();
init_standaloneQuickInputService();
init_standaloneThemeService();
init_standaloneTheme();
init_accessibilityService();
init_accessibility();
init_actions2();
init_menuService();
init_clipboardService();
init_clipboardService2();
init_contextKeyService();
init_descriptors();
init_instantiationService();
init_serviceCollection();
init_listService();
init_markers();
init_markerService();
init_opener();
init_quickInput();
init_storage2();
init_configurations();
init_accessibilitySignalService();
init_logService();
init_editorFeatures();
init_errors();
init_environment();
init_window();
init_map();
__decorate47 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param41 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
SimpleModel = class {
constructor(model) {
this.disposed = false;
this.model = model;
this._onWillDispose = new Emitter();
}
get textEditorModel() {
return this.model;
}
dispose() {
this.disposed = true;
this._onWillDispose.fire();
}
};
StandaloneTextModelService = class StandaloneTextModelService2 {
constructor(modelService) {
this.modelService = modelService;
}
createModelReference(resource) {
const model = this.modelService.getModel(resource);
if (!model) {
return Promise.reject(new Error(`Model not found`));
}
return Promise.resolve(new ImmortalReference(new SimpleModel(model)));
}
};
StandaloneTextModelService = __decorate47([
__param41(0, IModelService)
], StandaloneTextModelService);
StandaloneEditorProgressService = class _StandaloneEditorProgressService {
show() {
return _StandaloneEditorProgressService.NULL_PROGRESS_RUNNER;
}
showWhile(promise, delay) {
return __async(this, null, function* () {
yield promise;
});
}
};
StandaloneEditorProgressService.NULL_PROGRESS_RUNNER = {
done: () => {
},
total: () => {
},
worked: () => {
}
};
StandaloneProgressService = class {
withProgress(_options, task, onDidCancel) {
return task({
report: () => {
}
});
}
};
StandaloneEnvironmentService = class {
constructor() {
this.isExtensionDevelopment = false;
this.isBuilt = false;
}
};
StandaloneDialogService = class {
confirm(confirmation) {
return __async(this, null, function* () {
const confirmed = this.doConfirm(confirmation.message, confirmation.detail);
return {
confirmed,
checkboxChecked: false
// unsupported
};
});
}
doConfirm(message, detail) {
let messageText = message;
if (detail) {
messageText = messageText + "\n\n" + detail;
}
return mainWindow.confirm(messageText);
}
prompt(prompt) {
return __async(this, null, function* () {
var _a10, _b4;
let result = void 0;
const confirmed = this.doConfirm(prompt.message, prompt.detail);
if (confirmed) {
const promptButtons = [...(_a10 = prompt.buttons) !== null && _a10 !== void 0 ? _a10 : []];
if (prompt.cancelButton && typeof prompt.cancelButton !== "string" && typeof prompt.cancelButton !== "boolean") {
promptButtons.push(prompt.cancelButton);
}
result = yield (_b4 = promptButtons[0]) === null || _b4 === void 0 ? void 0 : _b4.run({ checkboxChecked: false });
}
return { result };
});
}
error(message, detail) {
return __async(this, null, function* () {
yield this.prompt({ type: severity_default.Error, message, detail });
});
}
};
StandaloneNotificationService = class _StandaloneNotificationService {
info(message) {
return this.notify({ severity: severity_default.Info, message });
}
warn(message) {
return this.notify({ severity: severity_default.Warning, message });
}
error(error) {
return this.notify({ severity: severity_default.Error, message: error });
}
notify(notification) {
switch (notification.severity) {
case severity_default.Error:
console.error(notification.message);
break;
case severity_default.Warning:
console.warn(notification.message);
break;
default:
console.log(notification.message);
break;
}
return _StandaloneNotificationService.NO_OP;
}
prompt(severity, message, choices, options2) {
return _StandaloneNotificationService.NO_OP;
}
status(message, options2) {
return Disposable.None;
}
};
StandaloneNotificationService.NO_OP = new NoOpNotification();
StandaloneCommandService = class StandaloneCommandService2 {
constructor(instantiationService) {
this._onWillExecuteCommand = new Emitter();
this._onDidExecuteCommand = new Emitter();
this.onDidExecuteCommand = this._onDidExecuteCommand.event;
this._instantiationService = instantiationService;
}
executeCommand(id, ...args) {
const command = CommandsRegistry.getCommand(id);
if (!command) {
return Promise.reject(new Error(`command '${id}' not found`));
}
try {
this._onWillExecuteCommand.fire({ commandId: id, args });
const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);
this._onDidExecuteCommand.fire({ commandId: id, args });
return Promise.resolve(result);
} catch (err) {
return Promise.reject(err);
}
}
};
StandaloneCommandService = __decorate47([
__param41(0, IInstantiationService)
], StandaloneCommandService);
StandaloneKeybindingService = class StandaloneKeybindingService2 extends AbstractKeybindingService {
constructor(contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService) {
super(contextKeyService, commandService, telemetryService, notificationService, logService);
this._cachedResolver = null;
this._dynamicKeybindings = [];
this._domNodeListeners = [];
const addContainer = (domNode) => {
const disposables = new DisposableStore();
disposables.add(addDisposableListener(domNode, EventType.KEY_DOWN, (e) => {
const keyEvent = new StandardKeyboardEvent(e);
const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
if (shouldPreventDefault) {
keyEvent.preventDefault();
keyEvent.stopPropagation();
}
}));
disposables.add(addDisposableListener(domNode, EventType.KEY_UP, (e) => {
const keyEvent = new StandardKeyboardEvent(e);
const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
if (shouldPreventDefault) {
keyEvent.preventDefault();
}
}));
this._domNodeListeners.push(new DomNodeListeners(domNode, disposables));
};
const removeContainer = (domNode) => {
for (let i = 0; i < this._domNodeListeners.length; i++) {
const domNodeListeners = this._domNodeListeners[i];
if (domNodeListeners.domNode === domNode) {
this._domNodeListeners.splice(i, 1);
domNodeListeners.dispose();
}
}
};
const addCodeEditor = (codeEditor) => {
if (codeEditor.getOption(
61
/* EditorOption.inDiffEditor */
)) {
return;
}
addContainer(codeEditor.getContainerDomNode());
};
const removeCodeEditor = (codeEditor) => {
if (codeEditor.getOption(
61
/* EditorOption.inDiffEditor */
)) {
return;
}
removeContainer(codeEditor.getContainerDomNode());
};
this._register(codeEditorService.onCodeEditorAdd(addCodeEditor));
this._register(codeEditorService.onCodeEditorRemove(removeCodeEditor));
codeEditorService.listCodeEditors().forEach(addCodeEditor);
const addDiffEditor = (diffEditor) => {
addContainer(diffEditor.getContainerDomNode());
};
const removeDiffEditor = (diffEditor) => {
removeContainer(diffEditor.getContainerDomNode());
};
this._register(codeEditorService.onDiffEditorAdd(addDiffEditor));
this._register(codeEditorService.onDiffEditorRemove(removeDiffEditor));
codeEditorService.listDiffEditors().forEach(addDiffEditor);
}
addDynamicKeybinding(command, keybinding, handler, when) {
return combinedDisposable(CommandsRegistry.registerCommand(command, handler), this.addDynamicKeybindings([{
keybinding,
command,
when
}]));
}
addDynamicKeybindings(rules) {
const entries2 = rules.map((rule) => {
var _a10;
const keybinding = decodeKeybinding(rule.keybinding, OS);
return {
keybinding,
command: (_a10 = rule.command) !== null && _a10 !== void 0 ? _a10 : null,
commandArgs: rule.commandArgs,
when: rule.when,
weight1: 1e3,
weight2: 0,
extensionId: null,
isBuiltinExtension: false
};
});
this._dynamicKeybindings = this._dynamicKeybindings.concat(entries2);
this.updateResolver();
return toDisposable(() => {
for (let i = 0; i < this._dynamicKeybindings.length; i++) {
if (this._dynamicKeybindings[i] === entries2[0]) {
this._dynamicKeybindings.splice(i, entries2.length);
this.updateResolver();
return;
}
}
});
}
updateResolver() {
this._cachedResolver = null;
this._onDidUpdateKeybindings.fire();
}
_getResolver() {
if (!this._cachedResolver) {
const defaults = this._toNormalizedKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
const overrides = this._toNormalizedKeybindingItems(this._dynamicKeybindings, false);
this._cachedResolver = new KeybindingResolver(defaults, overrides, (str) => this._log(str));
}
return this._cachedResolver;
}
_documentHasFocus() {
return mainWindow.document.hasFocus();
}
_toNormalizedKeybindingItems(items, isDefault) {
const result = [];
let resultLen = 0;
for (const item of items) {
const when = item.when || void 0;
const keybinding = item.keybinding;
if (!keybinding) {
result[resultLen++] = new ResolvedKeybindingItem(void 0, item.command, item.commandArgs, when, isDefault, null, false);
} else {
const resolvedKeybindings = USLayoutResolvedKeybinding.resolveKeybinding(keybinding, OS);
for (const resolvedKeybinding of resolvedKeybindings) {
result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault, null, false);
}
}
}
return result;
}
resolveKeyboardEvent(keyboardEvent) {
const chord = new KeyCodeChord(keyboardEvent.ctrlKey, keyboardEvent.shiftKey, keyboardEvent.altKey, keyboardEvent.metaKey, keyboardEvent.keyCode);
return new USLayoutResolvedKeybinding([chord], OS);
}
};
StandaloneKeybindingService = __decorate47([
__param41(0, IContextKeyService),
__param41(1, ICommandService),
__param41(2, ITelemetryService),
__param41(3, INotificationService),
__param41(4, ILogService),
__param41(5, ICodeEditorService)
], StandaloneKeybindingService);
DomNodeListeners = class extends Disposable {
constructor(domNode, disposables) {
super();
this.domNode = domNode;
this._register(disposables);
}
};
StandaloneConfigurationService = class StandaloneConfigurationService2 {
constructor(logService) {
this.logService = logService;
this._onDidChangeConfiguration = new Emitter();
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
const defaultConfiguration = new DefaultConfiguration(logService);
this._configuration = new Configuration(defaultConfiguration.reload(), ConfigurationModel.createEmptyModel(logService), ConfigurationModel.createEmptyModel(logService), ConfigurationModel.createEmptyModel(logService), ConfigurationModel.createEmptyModel(logService), ConfigurationModel.createEmptyModel(logService), new ResourceMap(), ConfigurationModel.createEmptyModel(logService), new ResourceMap(), logService);
defaultConfiguration.dispose();
}
getValue(arg1, arg2) {
const section = typeof arg1 === "string" ? arg1 : void 0;
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
return this._configuration.getValue(section, overrides, void 0);
}
updateValues(values2) {
const previous = { data: this._configuration.toData() };
const changedKeys = [];
for (const entry of values2) {
const [key, value] = entry;
if (this.getValue(key) === value) {
continue;
}
this._configuration.updateValue(key, value);
changedKeys.push(key);
}
if (changedKeys.length > 0) {
const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration, void 0, this.logService);
configurationChangeEvent.source = 8;
this._onDidChangeConfiguration.fire(configurationChangeEvent);
}
return Promise.resolve();
}
updateValue(key, value, arg3, arg4) {
return this.updateValues([[key, value]]);
}
inspect(key, options2 = {}) {
return this._configuration.inspect(key, options2, void 0);
}
};
StandaloneConfigurationService = __decorate47([
__param41(0, ILogService)
], StandaloneConfigurationService);
StandaloneResourceConfigurationService = class StandaloneResourceConfigurationService2 {
constructor(configurationService, modelService, languageService) {
this.configurationService = configurationService;
this.modelService = modelService;
this.languageService = languageService;
this._onDidChangeConfiguration = new Emitter();
this.configurationService.onDidChangeConfiguration((e) => {
this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: (resource, configuration) => e.affectsConfiguration(configuration) });
});
}
getValue(resource, arg2, arg3) {
const position = Position.isIPosition(arg2) ? arg2 : null;
const section = position ? typeof arg3 === "string" ? arg3 : void 0 : typeof arg2 === "string" ? arg2 : void 0;
const language82 = resource ? this.getLanguage(resource, position) : void 0;
if (typeof section === "undefined") {
return this.configurationService.getValue({
resource,
overrideIdentifier: language82
});
}
return this.configurationService.getValue(section, {
resource,
overrideIdentifier: language82
});
}
getLanguage(resource, position) {
const model = this.modelService.getModel(resource);
if (model) {
return position ? model.getLanguageIdAtPosition(position.lineNumber, position.column) : model.getLanguageId();
}
return this.languageService.guessLanguageIdByFilepathOrFirstLine(resource);
}
};
StandaloneResourceConfigurationService = __decorate47([
__param41(0, IConfigurationService),
__param41(1, IModelService),
__param41(2, ILanguageService)
], StandaloneResourceConfigurationService);
StandaloneResourcePropertiesService = class StandaloneResourcePropertiesService2 {
constructor(configurationService) {
this.configurationService = configurationService;
}
getEOL(resource, language82) {
const eol = this.configurationService.getValue("files.eol", { overrideIdentifier: language82, resource });
if (eol && typeof eol === "string" && eol !== "auto") {
return eol;
}
return isLinux || isMacintosh ? "\n" : "\r\n";
}
};
StandaloneResourcePropertiesService = __decorate47([
__param41(0, IConfigurationService)
], StandaloneResourcePropertiesService);
StandaloneTelemetryService = class {
publicLog2() {
}
};
StandaloneWorkspaceContextService = class _StandaloneWorkspaceContextService {
constructor() {
const resource = URI.from({ scheme: _StandaloneWorkspaceContextService.SCHEME, authority: "model", path: "/" });
this.workspace = { id: STANDALONE_EDITOR_WORKSPACE_ID, folders: [new WorkspaceFolder({ uri: resource, name: "", index: 0 })] };
}
getWorkspace() {
return this.workspace;
}
getWorkspaceFolder(resource) {
return resource && resource.scheme === _StandaloneWorkspaceContextService.SCHEME ? this.workspace.folders[0] : null;
}
};
StandaloneWorkspaceContextService.SCHEME = "inmemory";
StandaloneBulkEditService = class StandaloneBulkEditService2 {
constructor(_modelService) {
this._modelService = _modelService;
}
hasPreviewHandler() {
return false;
}
apply(editsIn, _options) {
return __async(this, null, function* () {
const edits = Array.isArray(editsIn) ? editsIn : ResourceEdit.convert(editsIn);
const textEdits = /* @__PURE__ */ new Map();
for (const edit of edits) {
if (!(edit instanceof ResourceTextEdit)) {
throw new Error("bad edit - only text edits are supported");
}
const model = this._modelService.getModel(edit.resource);
if (!model) {
throw new Error("bad edit - model not found");
}
if (typeof edit.versionId === "number" && model.getVersionId() !== edit.versionId) {
throw new Error("bad state - model changed in the meantime");
}
let array2 = textEdits.get(model);
if (!array2) {
array2 = [];
textEdits.set(model, array2);
}
array2.push(EditOperation.replaceMove(Range.lift(edit.textEdit.range), edit.textEdit.text));
}
let totalEdits = 0;
let totalFiles = 0;
for (const [model, edits2] of textEdits) {
model.pushStackElement();
model.pushEditOperations([], edits2, () => []);
model.pushStackElement();
totalFiles += 1;
totalEdits += edits2.length;
}
return {
ariaSummary: format(StandaloneServicesNLS.bulkEditServiceSummary, totalEdits, totalFiles),
isApplied: totalEdits > 0
};
});
}
};
StandaloneBulkEditService = __decorate47([
__param41(0, IModelService)
], StandaloneBulkEditService);
StandaloneUriLabelService = class {
getUriLabel(resource, options2) {
if (resource.scheme === "file") {
return resource.fsPath;
}
return resource.path;
}
getUriBasenameLabel(resource) {
return basename2(resource);
}
};
StandaloneContextViewService = class StandaloneContextViewService2 extends ContextViewService {
constructor(layoutService, _codeEditorService) {
super(layoutService);
this._codeEditorService = _codeEditorService;
}
showContextView(delegate, container, shadowRoot) {
if (!container) {
const codeEditor = this._codeEditorService.getFocusedCodeEditor() || this._codeEditorService.getActiveCodeEditor();
if (codeEditor) {
container = codeEditor.getContainerDomNode();
}
}
return super.showContextView(delegate, container, shadowRoot);
}
};
StandaloneContextViewService = __decorate47([
__param41(0, ILayoutService),
__param41(1, ICodeEditorService)
], StandaloneContextViewService);
StandaloneWorkspaceTrustManagementService = class {
constructor() {
this._neverEmitter = new Emitter();
this.onDidChangeTrust = this._neverEmitter.event;
}
isWorkspaceTrusted() {
return true;
}
};
StandaloneLanguageService = class extends LanguageService {
constructor() {
super();
}
};
StandaloneLogService = class extends LogService {
constructor() {
super(new ConsoleLogger());
}
};
StandaloneContextMenuService = class StandaloneContextMenuService2 extends ContextMenuService {
constructor(telemetryService, notificationService, contextViewService, keybindingService, menuService, contextKeyService) {
super(telemetryService, notificationService, contextViewService, keybindingService, menuService, contextKeyService);
this.configure({ blockMouse: false });
}
};
StandaloneContextMenuService = __decorate47([
__param41(0, ITelemetryService),
__param41(1, INotificationService),
__param41(2, IContextViewService),
__param41(3, IKeybindingService),
__param41(4, IMenuService),
__param41(5, IContextKeyService)
], StandaloneContextMenuService);
StandaloneAccessbilitySignalService = class {
playSignal(cue, options2) {
return __async(this, null, function* () {
});
}
};
registerSingleton(
ILogService,
StandaloneLogService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IConfigurationService,
StandaloneConfigurationService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ITextResourceConfigurationService,
StandaloneResourceConfigurationService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ITextResourcePropertiesService,
StandaloneResourcePropertiesService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IWorkspaceContextService,
StandaloneWorkspaceContextService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ILabelService,
StandaloneUriLabelService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ITelemetryService,
StandaloneTelemetryService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IDialogService,
StandaloneDialogService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IEnvironmentService,
StandaloneEnvironmentService,
0
/* InstantiationType.Eager */
);
registerSingleton(
INotificationService,
StandaloneNotificationService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IMarkerService,
MarkerService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ILanguageService,
StandaloneLanguageService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IStandaloneThemeService,
StandaloneThemeService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IModelService,
ModelService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IMarkerDecorationsService,
MarkerDecorationsService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IContextKeyService,
ContextKeyService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IProgressService,
StandaloneProgressService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IEditorProgressService,
StandaloneEditorProgressService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IStorageService,
InMemoryStorageService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IEditorWorkerService,
EditorWorkerService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IBulkEditService,
StandaloneBulkEditService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IWorkspaceTrustManagementService,
StandaloneWorkspaceTrustManagementService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ITextModelService,
StandaloneTextModelService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IAccessibilityService,
AccessibilityService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IListService,
ListService,
0
/* InstantiationType.Eager */
);
registerSingleton(
ICommandService,
StandaloneCommandService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IKeybindingService,
StandaloneKeybindingService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IQuickInputService,
StandaloneQuickInputService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IContextViewService,
StandaloneContextViewService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IOpenerService,
OpenerService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IClipboardService,
BrowserClipboardService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IContextMenuService,
StandaloneContextMenuService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IMenuService,
MenuService,
0
/* InstantiationType.Eager */
);
registerSingleton(
IAccessibilitySignalService,
StandaloneAccessbilitySignalService,
0
/* InstantiationType.Eager */
);
(function(StandaloneServices2) {
const serviceCollection = new ServiceCollection();
for (const [id, descriptor] of getSingletonServiceDescriptors()) {
serviceCollection.set(id, descriptor);
}
const instantiationService = new InstantiationService(serviceCollection, true);
serviceCollection.set(IInstantiationService, instantiationService);
function get(serviceId) {
if (!initialized2) {
initialize3({});
}
const r = serviceCollection.get(serviceId);
if (!r) {
throw new Error("Missing service " + serviceId);
}
if (r instanceof SyncDescriptor) {
return instantiationService.invokeFunction((accessor) => accessor.get(serviceId));
} else {
return r;
}
}
StandaloneServices2.get = get;
let initialized2 = false;
const onDidInitialize = new Emitter();
function initialize3(overrides) {
if (initialized2) {
return instantiationService;
}
initialized2 = true;
for (const [id, descriptor] of getSingletonServiceDescriptors()) {
if (!serviceCollection.get(id)) {
serviceCollection.set(id, descriptor);
}
}
for (const serviceId in overrides) {
if (overrides.hasOwnProperty(serviceId)) {
const serviceIdentifier = createDecorator(serviceId);
const r = serviceCollection.get(serviceIdentifier);
if (r instanceof SyncDescriptor) {
serviceCollection.set(serviceIdentifier, overrides[serviceId]);
}
}
}
const editorFeatures2 = getEditorFeatures();
for (const feature of editorFeatures2) {
try {
instantiationService.createInstance(feature);
} catch (err) {
onUnexpectedError(err);
}
}
onDidInitialize.fire();
return instantiationService;
}
StandaloneServices2.initialize = initialize3;
function withServices(callback) {
if (initialized2) {
return callback();
}
const disposable = new DisposableStore();
const listener = disposable.add(onDidInitialize.event(() => {
listener.dispose();
disposable.add(callback());
}));
return disposable;
}
StandaloneServices2.withServices = withServices;
})(StandaloneServices || (StandaloneServices = {}));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/style.css
var init_style = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/style.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/stableEditorScroll.js
var StableEditorScrollState;
var init_stableEditorScroll = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/stableEditorScroll.js"() {
StableEditorScrollState = class _StableEditorScrollState {
static capture(editor2) {
if (editor2.getScrollTop() === 0 || editor2.hasPendingScrollAnimation()) {
return new _StableEditorScrollState(editor2.getScrollTop(), editor2.getContentHeight(), null, 0, null);
}
let visiblePosition = null;
let visiblePositionScrollDelta = 0;
const visibleRanges = editor2.getVisibleRanges();
if (visibleRanges.length > 0) {
visiblePosition = visibleRanges[0].getStartPosition();
const visiblePositionScrollTop = editor2.getTopForPosition(visiblePosition.lineNumber, visiblePosition.column);
visiblePositionScrollDelta = editor2.getScrollTop() - visiblePositionScrollTop;
}
return new _StableEditorScrollState(editor2.getScrollTop(), editor2.getContentHeight(), visiblePosition, visiblePositionScrollDelta, editor2.getPosition());
}
constructor(_initialScrollTop, _initialContentHeight, _visiblePosition, _visiblePositionScrollDelta, _cursorPosition) {
this._initialScrollTop = _initialScrollTop;
this._initialContentHeight = _initialContentHeight;
this._visiblePosition = _visiblePosition;
this._visiblePositionScrollDelta = _visiblePositionScrollDelta;
this._cursorPosition = _cursorPosition;
}
restore(editor2) {
if (this._initialContentHeight === editor2.getContentHeight() && this._initialScrollTop === editor2.getScrollTop()) {
return;
}
if (this._visiblePosition) {
const visiblePositionScrollTop = editor2.getTopForPosition(this._visiblePosition.lineNumber, this._visiblePosition.column);
editor2.setScrollTop(visiblePositionScrollTop + this._visiblePositionScrollDelta);
}
}
restoreRelativeVerticalPositionOfCursor(editor2) {
if (this._initialContentHeight === editor2.getContentHeight() && this._initialScrollTop === editor2.getScrollTop()) {
return;
}
const currentCursorPosition = editor2.getPosition();
if (!this._cursorPosition || !currentCursorPosition) {
return;
}
const offset = editor2.getTopForLineNumber(currentCursorPosition.lineNumber) - editor2.getTopForLineNumber(this._cursorPosition.lineNumber);
editor2.setScrollTop(
editor2.getScrollTop() + offset,
1
/* ScrollType.Immediate */
);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/common/hotReload.js
function isHotReloadEnabled() {
return env && !!env["VSCODE_DEV"];
}
function registerHotReloadHandler(handler) {
if (!isHotReloadEnabled()) {
return { dispose() {
} };
} else {
const handlers = registerGlobalHotReloadHandler();
handlers.add(handler);
return {
dispose() {
handlers.delete(handler);
}
};
}
}
function registerGlobalHotReloadHandler() {
if (!hotReloadHandlers) {
hotReloadHandlers = /* @__PURE__ */ new Set();
}
const g = globalThis;
if (!g.$hotReload_applyNewExports) {
g.$hotReload_applyNewExports = (args) => {
const args2 = __spreadValues({ config: { mode: void 0 } }, args);
for (const h2 of hotReloadHandlers) {
const result = h2(args2);
if (result) {
return result;
}
}
return void 0;
};
}
return hotReloadHandlers;
}
var hotReloadHandlers;
var init_hotReload = __esm({
"node_modules/monaco-editor/esm/vs/base/common/hotReload.js"() {
init_process();
hotReloadHandlers = void 0;
if (isHotReloadEnabled()) {
registerHotReloadHandler(({ oldExports, newSrc, config }) => {
if (config.mode !== "patch-prototype") {
return void 0;
}
return (newExports) => {
var _a10, _b4;
for (const key in newExports) {
const exportedItem = newExports[key];
console.log(`[hot-reload] Patching prototype methods of '${key}'`, { exportedItem });
if (typeof exportedItem === "function" && exportedItem.prototype) {
const oldExportedItem = oldExports[key];
if (oldExportedItem) {
for (const prop of Object.getOwnPropertyNames(exportedItem.prototype)) {
const descriptor = Object.getOwnPropertyDescriptor(exportedItem.prototype, prop);
const oldDescriptor = Object.getOwnPropertyDescriptor(oldExportedItem.prototype, prop);
if (((_a10 = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === null || _a10 === void 0 ? void 0 : _a10.toString()) !== ((_b4 = oldDescriptor === null || oldDescriptor === void 0 ? void 0 : oldDescriptor.value) === null || _b4 === void 0 ? void 0 : _b4.toString())) {
console.log(`[hot-reload] Patching prototype method '${key}.${prop}'`);
}
Object.defineProperty(oldExportedItem.prototype, prop, descriptor);
}
newExports[key] = oldExportedItem;
}
}
}
return true;
};
});
}
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils.js
function joinCombine(arr1, arr2, keySelector, combine) {
if (arr1.length === 0) {
return arr2;
}
if (arr2.length === 0) {
return arr1;
}
const result = [];
let i = 0;
let j = 0;
while (i < arr1.length && j < arr2.length) {
const val1 = arr1[i];
const val2 = arr2[j];
const key1 = keySelector(val1);
const key2 = keySelector(val2);
if (key1 < key2) {
result.push(val1);
i++;
} else if (key1 > key2) {
result.push(val2);
j++;
} else {
result.push(combine(val1, val2));
i++;
j++;
}
}
while (i < arr1.length) {
result.push(arr1[i]);
i++;
}
while (j < arr2.length) {
result.push(arr2[j]);
j++;
}
return result;
}
function applyObservableDecorations(editor2, decorations) {
const d = new DisposableStore();
const decorationsCollection = editor2.createDecorationsCollection();
d.add(autorunOpts({ debugName: () => `Apply decorations from ${decorations.debugName}` }, (reader) => {
const d2 = decorations.read(reader);
decorationsCollection.set(d2);
}));
d.add({
dispose: () => {
decorationsCollection.clear();
}
});
return d;
}
function appendRemoveOnDispose(parent, child) {
parent.appendChild(child);
return toDisposable(() => {
parent.removeChild(child);
});
}
function prependRemoveOnDispose(parent, child) {
parent.prepend(child);
return toDisposable(() => {
parent.removeChild(child);
});
}
function animatedObservable(targetWindow, base, store) {
let targetVal = base.get();
let startVal = targetVal;
let curVal = targetVal;
const result = observableValue("animatedValue", targetVal);
let animationStartMs = -1;
const durationMs = 300;
let animationFrame = void 0;
store.add(autorunHandleChanges({
createEmptyChangeSummary: () => ({ animate: false }),
handleChange: (ctx, s) => {
if (ctx.didChange(base)) {
s.animate = s.animate || ctx.change;
}
return true;
}
}, (reader, s) => {
if (animationFrame !== void 0) {
targetWindow.cancelAnimationFrame(animationFrame);
animationFrame = void 0;
}
startVal = curVal;
targetVal = base.read(reader);
animationStartMs = Date.now() - (s.animate ? 0 : durationMs);
update();
}));
function update() {
const passedMs = Date.now() - animationStartMs;
curVal = Math.floor(easeOutExpo(passedMs, startVal, targetVal - startVal, durationMs));
if (passedMs < durationMs) {
animationFrame = targetWindow.requestAnimationFrame(update);
} else {
curVal = targetVal;
}
result.set(curVal, void 0);
}
return result;
}
function easeOutExpo(t4, b, c, d) {
return t4 === d ? b + c : c * (-Math.pow(2, -10 * t4 / d) + 1) + b;
}
function applyStyle(domNode, style) {
return autorun((reader) => {
for (let [key, val] of Object.entries(style)) {
if (val && typeof val === "object" && "read" in val) {
val = val.read(reader);
}
if (typeof val === "number") {
val = `${val}px`;
}
key = key.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
domNode.style[key] = val;
}
});
}
function readHotReloadableExport(value, reader) {
observeHotReloadableExports([value], reader);
return value;
}
function observeHotReloadableExports(values2, reader) {
if (isHotReloadEnabled()) {
const o = observableSignalFromEvent("reload", (event) => registerHotReloadHandler(({ oldExports }) => {
if (![...Object.values(oldExports)].some((v) => values2.includes(v))) {
return void 0;
}
return (_newExports) => {
event(void 0);
return true;
};
}));
o.read(reader);
}
}
function applyViewZones(editor2, viewZones, setIsUpdating, zoneIds) {
const store = new DisposableStore();
const lastViewZoneIds = [];
store.add(autorunWithStore((reader, store2) => {
const curViewZones = viewZones.read(reader);
const viewZonIdsPerViewZone = /* @__PURE__ */ new Map();
const viewZoneIdPerOnChangeObservable = /* @__PURE__ */ new Map();
if (setIsUpdating) {
setIsUpdating(true);
}
editor2.changeViewZones((a3) => {
for (const id of lastViewZoneIds) {
a3.removeZone(id);
zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.delete(id);
}
lastViewZoneIds.length = 0;
for (const z of curViewZones) {
const id = a3.addZone(z);
if (z.setZoneId) {
z.setZoneId(id);
}
lastViewZoneIds.push(id);
zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.add(id);
viewZonIdsPerViewZone.set(z, id);
}
});
if (setIsUpdating) {
setIsUpdating(false);
}
store2.add(autorunHandleChanges({
createEmptyChangeSummary() {
return { zoneIds: [] };
},
handleChange(context, changeSummary) {
const id = viewZoneIdPerOnChangeObservable.get(context.changedObservable);
if (id !== void 0) {
changeSummary.zoneIds.push(id);
}
return true;
}
}, (reader2, changeSummary) => {
for (const vz of curViewZones) {
if (vz.onChange) {
viewZoneIdPerOnChangeObservable.set(vz.onChange, viewZonIdsPerViewZone.get(vz));
vz.onChange.read(reader2);
}
}
if (setIsUpdating) {
setIsUpdating(true);
}
editor2.changeViewZones((a3) => {
for (const id of changeSummary.zoneIds) {
a3.layoutZone(id);
}
});
if (setIsUpdating) {
setIsUpdating(false);
}
}));
}));
store.add({
dispose() {
if (setIsUpdating) {
setIsUpdating(true);
}
editor2.changeViewZones((a3) => {
for (const id of lastViewZoneIds) {
a3.removeZone(id);
}
});
zoneIds === null || zoneIds === void 0 ? void 0 : zoneIds.clear();
if (setIsUpdating) {
setIsUpdating(false);
}
}
});
return store;
}
function translatePosition(posInOriginal, mappings) {
const mapping = findLast(mappings, (m) => m.original.startLineNumber <= posInOriginal.lineNumber);
if (!mapping) {
return Range.fromPositions(posInOriginal);
}
if (mapping.original.endLineNumberExclusive <= posInOriginal.lineNumber) {
const newLineNumber = posInOriginal.lineNumber - mapping.original.endLineNumberExclusive + mapping.modified.endLineNumberExclusive;
return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));
}
if (!mapping.innerChanges) {
return Range.fromPositions(new Position(mapping.modified.startLineNumber, 1));
}
const innerMapping = findLast(mapping.innerChanges, (m) => m.originalRange.getStartPosition().isBeforeOrEqual(posInOriginal));
if (!innerMapping) {
const newLineNumber = posInOriginal.lineNumber - mapping.original.startLineNumber + mapping.modified.startLineNumber;
return Range.fromPositions(new Position(newLineNumber, posInOriginal.column));
}
if (innerMapping.originalRange.containsPosition(posInOriginal)) {
return innerMapping.modifiedRange;
} else {
const l = lengthBetweenPositions(innerMapping.originalRange.getEndPosition(), posInOriginal);
return Range.fromPositions(l.addToPosition(innerMapping.modifiedRange.getEndPosition()));
}
}
function lengthBetweenPositions(position1, position2) {
if (position1.lineNumber === position2.lineNumber) {
return new TextLength(0, position2.column - position1.column);
} else {
return new TextLength(position2.lineNumber - position1.lineNumber, position2.column - 1);
}
}
function filterWithPrevious(arr, filter) {
let prev;
return arr.filter((cur) => {
const result = filter(cur, prev);
prev = cur;
return result;
});
}
var ObservableElementSizeObserver, ViewZoneOverlayWidget, PlaceholderViewZone, ManagedOverlayWidget, DisposableCancellationTokenSource;
var init_utils4 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils.js"() {
init_arraysFind();
init_cancellation();
init_hotReload();
init_lifecycle();
init_observable();
init_elementSizeObserver();
init_position();
init_range();
init_textLength();
ObservableElementSizeObserver = class extends Disposable {
get width() {
return this._width;
}
get height() {
return this._height;
}
get automaticLayout() {
return this._automaticLayout;
}
constructor(element, dimension) {
super();
this._automaticLayout = false;
this.elementSizeObserver = this._register(new ElementSizeObserver(element, dimension));
this._width = observableValue(this, this.elementSizeObserver.getWidth());
this._height = observableValue(this, this.elementSizeObserver.getHeight());
this._register(this.elementSizeObserver.onDidChange((e) => transaction((tx) => {
this._width.set(this.elementSizeObserver.getWidth(), tx);
this._height.set(this.elementSizeObserver.getHeight(), tx);
})));
}
observe(dimension) {
this.elementSizeObserver.observe(dimension);
}
setAutomaticLayout(automaticLayout) {
this._automaticLayout = automaticLayout;
if (automaticLayout) {
this.elementSizeObserver.startObserving();
} else {
this.elementSizeObserver.stopObserving();
}
}
};
ViewZoneOverlayWidget = class extends Disposable {
constructor(editor2, viewZone, htmlElement) {
super();
this._register(new ManagedOverlayWidget(editor2, htmlElement));
this._register(applyStyle(htmlElement, {
height: viewZone.actualHeight,
top: viewZone.actualTop
}));
}
};
PlaceholderViewZone = class {
get afterLineNumber() {
return this._afterLineNumber.get();
}
constructor(_afterLineNumber, heightInPx) {
this._afterLineNumber = _afterLineNumber;
this.heightInPx = heightInPx;
this.domNode = document.createElement("div");
this._actualTop = observableValue(this, void 0);
this._actualHeight = observableValue(this, void 0);
this.actualTop = this._actualTop;
this.actualHeight = this._actualHeight;
this.showInHiddenAreas = true;
this.onChange = this._afterLineNumber;
this.onDomNodeTop = (top) => {
this._actualTop.set(top, void 0);
};
this.onComputedHeight = (height) => {
this._actualHeight.set(height, void 0);
};
}
};
ManagedOverlayWidget = class _ManagedOverlayWidget {
constructor(_editor, _domElement) {
this._editor = _editor;
this._domElement = _domElement;
this._overlayWidgetId = `managedOverlayWidget-${_ManagedOverlayWidget._counter++}`;
this._overlayWidget = {
getId: () => this._overlayWidgetId,
getDomNode: () => this._domElement,
getPosition: () => null
};
this._editor.addOverlayWidget(this._overlayWidget);
}
dispose() {
this._editor.removeOverlayWidget(this._overlayWidget);
}
};
ManagedOverlayWidget._counter = 0;
DisposableCancellationTokenSource = class extends CancellationTokenSource {
dispose() {
super.dispose(true);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.css
var init_accessibleDiffViewer = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js
function computeViewElementGroups(diffs, originalLineCount, modifiedLineCount) {
const result = [];
for (const g of groupAdjacentBy(diffs, (a3, b) => b.modified.startLineNumber - a3.modified.endLineNumberExclusive < 2 * viewElementGroupLineMargin)) {
const viewElements = [];
viewElements.push(new HeaderViewElement());
const origFullRange = new LineRange(Math.max(1, g[0].original.startLineNumber - viewElementGroupLineMargin), Math.min(g[g.length - 1].original.endLineNumberExclusive + viewElementGroupLineMargin, originalLineCount + 1));
const modifiedFullRange = new LineRange(Math.max(1, g[0].modified.startLineNumber - viewElementGroupLineMargin), Math.min(g[g.length - 1].modified.endLineNumberExclusive + viewElementGroupLineMargin, modifiedLineCount + 1));
forEachAdjacent(g, (a3, b) => {
const origRange = new LineRange(a3 ? a3.original.endLineNumberExclusive : origFullRange.startLineNumber, b ? b.original.startLineNumber : origFullRange.endLineNumberExclusive);
const modifiedRange2 = new LineRange(a3 ? a3.modified.endLineNumberExclusive : modifiedFullRange.startLineNumber, b ? b.modified.startLineNumber : modifiedFullRange.endLineNumberExclusive);
origRange.forEach((origLineNumber) => {
viewElements.push(new UnchangedLineViewElement(origLineNumber, modifiedRange2.startLineNumber + (origLineNumber - origRange.startLineNumber)));
});
if (b) {
b.original.forEach((origLineNumber) => {
viewElements.push(new DeletedLineViewElement(b, origLineNumber));
});
b.modified.forEach((modifiedLineNumber) => {
viewElements.push(new AddedLineViewElement(b, modifiedLineNumber));
});
}
});
const modifiedRange = g[0].modified.join(g[g.length - 1].modified);
const originalRange = g[0].original.join(g[g.length - 1].original);
result.push(new ViewElementGroup(new LineRangeMapping(modifiedRange, originalRange), viewElements));
}
return result;
}
var __decorate48, __param42, accessibleDiffViewerInsertIcon, accessibleDiffViewerRemoveIcon, accessibleDiffViewerCloseIcon, AccessibleDiffViewer, ViewModel2, viewElementGroupLineMargin, LineType, ViewElementGroup, HeaderViewElement, DeletedLineViewElement, AddedLineViewElement, UnchangedLineViewElement, View3, AccessibleDiffViewerModelFromEditors;
var init_accessibleDiffViewer2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js"() {
init_dom();
init_trustedTypes();
init_actionbar2();
init_scrollableElement();
init_actions();
init_arrays();
init_codicons();
init_lifecycle();
init_observable();
init_themables();
init_domFontInfo();
init_utils4();
init_editorOptions();
init_lineRange();
init_offsetRange();
init_position();
init_range();
init_rangeMapping();
init_language();
init_lineTokens();
init_viewLineRenderer();
init_viewModel();
init_nls();
init_accessibilitySignalService();
init_instantiation();
init_iconRegistry();
init_accessibleDiffViewer();
__decorate48 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param42 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
accessibleDiffViewerInsertIcon = registerIcon("diff-review-insert", Codicon.add, localize("accessibleDiffViewerInsertIcon", "Icon for 'Insert' in accessible diff viewer."));
accessibleDiffViewerRemoveIcon = registerIcon("diff-review-remove", Codicon.remove, localize("accessibleDiffViewerRemoveIcon", "Icon for 'Remove' in accessible diff viewer."));
accessibleDiffViewerCloseIcon = registerIcon("diff-review-close", Codicon.close, localize("accessibleDiffViewerCloseIcon", "Icon for 'Close' in accessible diff viewer."));
AccessibleDiffViewer = class AccessibleDiffViewer2 extends Disposable {
constructor(_parentNode, _visible, _setVisible, _canClose, _width, _height, _diffs, _models, _instantiationService) {
super();
this._parentNode = _parentNode;
this._visible = _visible;
this._setVisible = _setVisible;
this._canClose = _canClose;
this._width = _width;
this._height = _height;
this._diffs = _diffs;
this._models = _models;
this._instantiationService = _instantiationService;
this._state = derivedWithStore(this, (reader, store) => {
const visible = this._visible.read(reader);
this._parentNode.style.visibility = visible ? "visible" : "hidden";
if (!visible) {
return null;
}
const model = store.add(this._instantiationService.createInstance(ViewModel2, this._diffs, this._models, this._setVisible, this._canClose));
const view = store.add(this._instantiationService.createInstance(View3, this._parentNode, model, this._width, this._height, this._models));
return { model, view };
}).recomputeInitiallyAndOnChange(this._store);
}
next() {
transaction((tx) => {
const isVisible = this._visible.get();
this._setVisible(true, tx);
if (isVisible) {
this._state.get().model.nextGroup(tx);
}
});
}
prev() {
transaction((tx) => {
this._setVisible(true, tx);
this._state.get().model.previousGroup(tx);
});
}
close() {
transaction((tx) => {
this._setVisible(false, tx);
});
}
};
AccessibleDiffViewer._ttPolicy = createTrustedTypesPolicy("diffReview", { createHTML: (value) => value });
AccessibleDiffViewer = __decorate48([
__param42(8, IInstantiationService)
], AccessibleDiffViewer);
ViewModel2 = class ViewModel3 extends Disposable {
constructor(_diffs, _models, _setVisible, canClose, _accessibilitySignalService) {
super();
this._diffs = _diffs;
this._models = _models;
this._setVisible = _setVisible;
this.canClose = canClose;
this._accessibilitySignalService = _accessibilitySignalService;
this._groups = observableValue(this, []);
this._currentGroupIdx = observableValue(this, 0);
this._currentElementIdx = observableValue(this, 0);
this.groups = this._groups;
this.currentGroup = this._currentGroupIdx.map((idx, r) => this._groups.read(r)[idx]);
this.currentGroupIndex = this._currentGroupIdx;
this.currentElement = this._currentElementIdx.map((idx, r) => {
var _a10;
return (_a10 = this.currentGroup.read(r)) === null || _a10 === void 0 ? void 0 : _a10.lines[idx];
});
this._register(autorun((reader) => {
const diffs = this._diffs.read(reader);
if (!diffs) {
this._groups.set([], void 0);
return;
}
const groups = computeViewElementGroups(diffs, this._models.getOriginalModel().getLineCount(), this._models.getModifiedModel().getLineCount());
transaction((tx) => {
const p = this._models.getModifiedPosition();
if (p) {
const nextGroup = groups.findIndex((g) => (p === null || p === void 0 ? void 0 : p.lineNumber) < g.range.modified.endLineNumberExclusive);
if (nextGroup !== -1) {
this._currentGroupIdx.set(nextGroup, tx);
}
}
this._groups.set(groups, tx);
});
}));
this._register(autorun((reader) => {
const currentViewItem = this.currentElement.read(reader);
if ((currentViewItem === null || currentViewItem === void 0 ? void 0 : currentViewItem.type) === LineType.Deleted) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineDeleted, { source: "accessibleDiffViewer.currentElementChanged" });
} else if ((currentViewItem === null || currentViewItem === void 0 ? void 0 : currentViewItem.type) === LineType.Added) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineInserted, { source: "accessibleDiffViewer.currentElementChanged" });
}
}));
this._register(autorun((reader) => {
var _a10;
const currentViewItem = this.currentElement.read(reader);
if (currentViewItem && currentViewItem.type !== LineType.Header) {
const lineNumber = (_a10 = currentViewItem.modifiedLineNumber) !== null && _a10 !== void 0 ? _a10 : currentViewItem.diff.modified.startLineNumber;
this._models.modifiedSetSelection(Range.fromPositions(new Position(lineNumber, 1)));
}
}));
}
_goToGroupDelta(delta, tx) {
const groups = this.groups.get();
if (!groups || groups.length <= 1) {
return;
}
subtransaction(tx, (tx2) => {
this._currentGroupIdx.set(OffsetRange.ofLength(groups.length).clipCyclic(this._currentGroupIdx.get() + delta), tx2);
this._currentElementIdx.set(0, tx2);
});
}
nextGroup(tx) {
this._goToGroupDelta(1, tx);
}
previousGroup(tx) {
this._goToGroupDelta(-1, tx);
}
_goToLineDelta(delta) {
const group = this.currentGroup.get();
if (!group || group.lines.length <= 1) {
return;
}
transaction((tx) => {
this._currentElementIdx.set(OffsetRange.ofLength(group.lines.length).clip(this._currentElementIdx.get() + delta), tx);
});
}
goToNextLine() {
this._goToLineDelta(1);
}
goToPreviousLine() {
this._goToLineDelta(-1);
}
goToLine(line) {
const group = this.currentGroup.get();
if (!group) {
return;
}
const idx = group.lines.indexOf(line);
if (idx === -1) {
return;
}
transaction((tx) => {
this._currentElementIdx.set(idx, tx);
});
}
revealCurrentElementInEditor() {
if (!this.canClose.get()) {
return;
}
this._setVisible(false, void 0);
const curElem = this.currentElement.get();
if (curElem) {
if (curElem.type === LineType.Deleted) {
this._models.originalReveal(Range.fromPositions(new Position(curElem.originalLineNumber, 1)));
} else {
this._models.modifiedReveal(curElem.type !== LineType.Header ? Range.fromPositions(new Position(curElem.modifiedLineNumber, 1)) : void 0);
}
}
}
close() {
if (!this.canClose.get()) {
return;
}
this._setVisible(false, void 0);
this._models.modifiedFocus();
}
};
ViewModel2 = __decorate48([
__param42(4, IAccessibilitySignalService)
], ViewModel2);
viewElementGroupLineMargin = 3;
(function(LineType2) {
LineType2[LineType2["Header"] = 0] = "Header";
LineType2[LineType2["Unchanged"] = 1] = "Unchanged";
LineType2[LineType2["Deleted"] = 2] = "Deleted";
LineType2[LineType2["Added"] = 3] = "Added";
})(LineType || (LineType = {}));
ViewElementGroup = class {
constructor(range2, lines) {
this.range = range2;
this.lines = lines;
}
};
HeaderViewElement = class {
constructor() {
this.type = LineType.Header;
}
};
DeletedLineViewElement = class {
constructor(diff, originalLineNumber) {
this.diff = diff;
this.originalLineNumber = originalLineNumber;
this.type = LineType.Deleted;
this.modifiedLineNumber = void 0;
}
};
AddedLineViewElement = class {
constructor(diff, modifiedLineNumber) {
this.diff = diff;
this.modifiedLineNumber = modifiedLineNumber;
this.type = LineType.Added;
this.originalLineNumber = void 0;
}
};
UnchangedLineViewElement = class {
constructor(originalLineNumber, modifiedLineNumber) {
this.originalLineNumber = originalLineNumber;
this.modifiedLineNumber = modifiedLineNumber;
this.type = LineType.Unchanged;
}
};
View3 = class View4 extends Disposable {
constructor(_element, _model, _width, _height, _models, _languageService) {
super();
this._element = _element;
this._model = _model;
this._width = _width;
this._height = _height;
this._models = _models;
this._languageService = _languageService;
this.domNode = this._element;
this.domNode.className = "monaco-component diff-review monaco-editor-background";
const actionBarContainer = document.createElement("div");
actionBarContainer.className = "diff-review-actions";
this._actionBar = this._register(new ActionBar(actionBarContainer));
this._register(autorun((reader) => {
this._actionBar.clear();
if (this._model.canClose.read(reader)) {
this._actionBar.push(new Action("diffreview.close", localize("label.close", "Close"), "close-diff-review " + ThemeIcon.asClassName(accessibleDiffViewerCloseIcon), true, () => __async(this, null, function* () {
return _model.close();
})), { label: false, icon: true });
}
}));
this._content = document.createElement("div");
this._content.className = "diff-review-content";
this._content.setAttribute("role", "code");
this._scrollbar = this._register(new DomScrollableElement(this._content, {}));
reset(this.domNode, this._scrollbar.getDomNode(), actionBarContainer);
this._register(autorun((r) => {
this._height.read(r);
this._width.read(r);
this._scrollbar.scanDomNode();
}));
this._register(toDisposable(() => {
reset(this.domNode);
}));
this._register(applyStyle(this.domNode, { width: this._width, height: this._height }));
this._register(applyStyle(this._content, { width: this._width, height: this._height }));
this._register(autorunWithStore((reader, store) => {
this._model.currentGroup.read(reader);
this._render(store);
}));
this._register(addStandardDisposableListener(this.domNode, "keydown", (e) => {
if (e.equals(
18
/* KeyCode.DownArrow */
) || e.equals(
2048 | 18
/* KeyCode.DownArrow */
) || e.equals(
512 | 18
/* KeyCode.DownArrow */
)) {
e.preventDefault();
this._model.goToNextLine();
}
if (e.equals(
16
/* KeyCode.UpArrow */
) || e.equals(
2048 | 16
/* KeyCode.UpArrow */
) || e.equals(
512 | 16
/* KeyCode.UpArrow */
)) {
e.preventDefault();
this._model.goToPreviousLine();
}
if (e.equals(
9
/* KeyCode.Escape */
) || e.equals(
2048 | 9
/* KeyCode.Escape */
) || e.equals(
512 | 9
/* KeyCode.Escape */
) || e.equals(
1024 | 9
/* KeyCode.Escape */
)) {
e.preventDefault();
this._model.close();
}
if (e.equals(
10
/* KeyCode.Space */
) || e.equals(
3
/* KeyCode.Enter */
)) {
e.preventDefault();
this._model.revealCurrentElementInEditor();
}
}));
}
_render(store) {
const originalOptions = this._models.getOriginalOptions();
const modifiedOptions = this._models.getModifiedOptions();
const container = document.createElement("div");
container.className = "diff-review-table";
container.setAttribute("role", "list");
container.setAttribute("aria-label", localize("ariaLabel", "Accessible Diff Viewer. Use arrow up and down to navigate."));
applyFontInfo(container, modifiedOptions.get(
50
/* EditorOption.fontInfo */
));
reset(this._content, container);
const originalModel = this._models.getOriginalModel();
const modifiedModel = this._models.getModifiedModel();
if (!originalModel || !modifiedModel) {
return;
}
const originalModelOpts = originalModel.getOptions();
const modifiedModelOpts = modifiedModel.getOptions();
const lineHeight = modifiedOptions.get(
67
/* EditorOption.lineHeight */
);
const group = this._model.currentGroup.get();
for (const viewItem of (group === null || group === void 0 ? void 0 : group.lines) || []) {
if (!group) {
break;
}
let row;
if (viewItem.type === LineType.Header) {
const header = document.createElement("div");
header.className = "diff-review-row";
header.setAttribute("role", "listitem");
const r = group.range;
const diffIndex = this._model.currentGroupIndex.get();
const diffsLength = this._model.groups.get().length;
const getAriaLines = (lines) => lines === 0 ? localize("no_lines_changed", "no lines changed") : lines === 1 ? localize("one_line_changed", "1 line changed") : localize("more_lines_changed", "{0} lines changed", lines);
const originalChangedLinesCntAria = getAriaLines(r.original.length);
const modifiedChangedLinesCntAria = getAriaLines(r.modified.length);
header.setAttribute("aria-label", localize({
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}", diffIndex + 1, diffsLength, r.original.startLineNumber, originalChangedLinesCntAria, r.modified.startLineNumber, modifiedChangedLinesCntAria));
const cell = document.createElement("div");
cell.className = "diff-review-cell diff-review-summary";
cell.appendChild(document.createTextNode(`${diffIndex + 1}/${diffsLength}: @@ -${r.original.startLineNumber},${r.original.length} +${r.modified.startLineNumber},${r.modified.length} @@`));
header.appendChild(cell);
row = header;
} else {
row = this._createRow(viewItem, lineHeight, this._width.get(), originalOptions, originalModel, originalModelOpts, modifiedOptions, modifiedModel, modifiedModelOpts);
}
container.appendChild(row);
const isSelectedObs = derived((reader) => (
/** @description isSelected */
this._model.currentElement.read(reader) === viewItem
));
store.add(autorun((reader) => {
const isSelected = isSelectedObs.read(reader);
row.tabIndex = isSelected ? 0 : -1;
if (isSelected) {
row.focus();
}
}));
store.add(addDisposableListener(row, "focus", () => {
this._model.goToLine(viewItem);
}));
}
this._scrollbar.scanDomNode();
}
_createRow(item, lineHeight, width2, originalOptions, originalModel, originalModelOpts, modifiedOptions, modifiedModel, modifiedModelOpts) {
const originalLayoutInfo = originalOptions.get(
145
/* EditorOption.layoutInfo */
);
const originalLineNumbersWidth = originalLayoutInfo.glyphMarginWidth + originalLayoutInfo.lineNumbersWidth;
const modifiedLayoutInfo = modifiedOptions.get(
145
/* EditorOption.layoutInfo */
);
const modifiedLineNumbersWidth = 10 + modifiedLayoutInfo.glyphMarginWidth + modifiedLayoutInfo.lineNumbersWidth;
let rowClassName = "diff-review-row";
let lineNumbersExtraClassName = "";
const spacerClassName = "diff-review-spacer";
let spacerIcon = null;
switch (item.type) {
case LineType.Added:
rowClassName = "diff-review-row line-insert";
lineNumbersExtraClassName = " char-insert";
spacerIcon = accessibleDiffViewerInsertIcon;
break;
case LineType.Deleted:
rowClassName = "diff-review-row line-delete";
lineNumbersExtraClassName = " char-delete";
spacerIcon = accessibleDiffViewerRemoveIcon;
break;
}
const row = document.createElement("div");
row.style.minWidth = width2 + "px";
row.className = rowClassName;
row.setAttribute("role", "listitem");
row.ariaLevel = "";
const cell = document.createElement("div");
cell.className = "diff-review-cell";
cell.style.height = `${lineHeight}px`;
row.appendChild(cell);
const originalLineNumber = document.createElement("span");
originalLineNumber.style.width = originalLineNumbersWidth + "px";
originalLineNumber.style.minWidth = originalLineNumbersWidth + "px";
originalLineNumber.className = "diff-review-line-number" + lineNumbersExtraClassName;
if (item.originalLineNumber !== void 0) {
originalLineNumber.appendChild(document.createTextNode(String(item.originalLineNumber)));
} else {
originalLineNumber.innerText = "\xA0";
}
cell.appendChild(originalLineNumber);
const modifiedLineNumber = document.createElement("span");
modifiedLineNumber.style.width = modifiedLineNumbersWidth + "px";
modifiedLineNumber.style.minWidth = modifiedLineNumbersWidth + "px";
modifiedLineNumber.style.paddingRight = "10px";
modifiedLineNumber.className = "diff-review-line-number" + lineNumbersExtraClassName;
if (item.modifiedLineNumber !== void 0) {
modifiedLineNumber.appendChild(document.createTextNode(String(item.modifiedLineNumber)));
} else {
modifiedLineNumber.innerText = "\xA0";
}
cell.appendChild(modifiedLineNumber);
const spacer = document.createElement("span");
spacer.className = spacerClassName;
if (spacerIcon) {
const spacerCodicon = document.createElement("span");
spacerCodicon.className = ThemeIcon.asClassName(spacerIcon);
spacerCodicon.innerText = "\xA0\xA0";
spacer.appendChild(spacerCodicon);
} else {
spacer.innerText = "\xA0\xA0";
}
cell.appendChild(spacer);
let lineContent;
if (item.modifiedLineNumber !== void 0) {
let html2 = this._getLineHtml(modifiedModel, modifiedOptions, modifiedModelOpts.tabSize, item.modifiedLineNumber, this._languageService.languageIdCodec);
if (AccessibleDiffViewer._ttPolicy) {
html2 = AccessibleDiffViewer._ttPolicy.createHTML(html2);
}
cell.insertAdjacentHTML("beforeend", html2);
lineContent = modifiedModel.getLineContent(item.modifiedLineNumber);
} else {
let html2 = this._getLineHtml(originalModel, originalOptions, originalModelOpts.tabSize, item.originalLineNumber, this._languageService.languageIdCodec);
if (AccessibleDiffViewer._ttPolicy) {
html2 = AccessibleDiffViewer._ttPolicy.createHTML(html2);
}
cell.insertAdjacentHTML("beforeend", html2);
lineContent = originalModel.getLineContent(item.originalLineNumber);
}
if (lineContent.length === 0) {
lineContent = localize("blankLine", "blank");
}
let ariaLabel = "";
switch (item.type) {
case LineType.Unchanged:
if (item.originalLineNumber === item.modifiedLineNumber) {
ariaLabel = localize({ key: "unchangedLine", comment: ["The placeholders are contents of the line and should not be translated."] }, "{0} unchanged line {1}", lineContent, item.originalLineNumber);
} else {
ariaLabel = localize("equalLine", "{0} original line {1} modified line {2}", lineContent, item.originalLineNumber, item.modifiedLineNumber);
}
break;
case LineType.Added:
ariaLabel = localize("insertLine", "+ {0} modified line {1}", lineContent, item.modifiedLineNumber);
break;
case LineType.Deleted:
ariaLabel = localize("deleteLine", "- {0} original line {1}", lineContent, item.originalLineNumber);
break;
}
row.setAttribute("aria-label", ariaLabel);
return row;
}
_getLineHtml(model, options2, tabSize, lineNumber, languageIdCodec) {
const lineContent = model.getLineContent(lineNumber);
const fontInfo = options2.get(
50
/* EditorOption.fontInfo */
);
const lineTokens = LineTokens.createEmpty(lineContent, languageIdCodec);
const isBasicASCII2 = ViewLineRenderingData.isBasicASCII(lineContent, model.mightContainNonBasicASCII());
const containsRTL2 = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII2, model.mightContainRTL());
const r = renderViewLine2(new RenderLineInput(fontInfo.isMonospace && !options2.get(
33
/* EditorOption.disableMonospaceOptimizations */
), fontInfo.canUseHalfwidthRightwardsArrow, lineContent, false, isBasicASCII2, containsRTL2, 0, lineTokens, [], tabSize, 0, fontInfo.spaceWidth, fontInfo.middotWidth, fontInfo.wsmiddotWidth, options2.get(
117
/* EditorOption.stopRenderingLineAfter */
), options2.get(
99
/* EditorOption.renderWhitespace */
), options2.get(
94
/* EditorOption.renderControlCharacters */
), options2.get(
51
/* EditorOption.fontLigatures */
) !== EditorFontLigatures.OFF, null));
return r.html;
}
};
View3 = __decorate48([
__param42(5, ILanguageService)
], View3);
AccessibleDiffViewerModelFromEditors = class {
constructor(editors) {
this.editors = editors;
}
getOriginalModel() {
return this.editors.original.getModel();
}
getOriginalOptions() {
return this.editors.original.getOptions();
}
originalReveal(range2) {
this.editors.original.revealRange(range2);
this.editors.original.setSelection(range2);
this.editors.original.focus();
}
getModifiedModel() {
return this.editors.modified.getModel();
}
getModifiedOptions() {
return this.editors.modified.getOptions();
}
modifiedReveal(range2) {
if (range2) {
this.editors.modified.revealRange(range2);
this.editors.modified.setSelection(range2);
}
this.editors.modified.focus();
}
modifiedSetSelection(range2) {
this.editors.modified.setSelection(range2);
}
modifiedFocus() {
this.editors.modified.focus();
}
getModifiedPosition() {
var _a10;
return (_a10 = this.editors.modified.getPosition()) !== null && _a10 !== void 0 ? _a10 : void 0;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js
var MovedBlocksLinesFeature, LinesLayout2, MovedBlockOverlayWidget;
var init_movedBlocksLinesFeature = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js"() {
init_dom();
init_actionbar2();
init_actions();
init_arrays();
init_arraysFind();
init_codicons();
init_lifecycle();
init_observable();
init_themables();
init_utils4();
init_offsetRange();
init_nls();
MovedBlocksLinesFeature = class _MovedBlocksLinesFeature extends Disposable {
constructor(_rootElement, _diffModel, _originalEditorLayoutInfo, _modifiedEditorLayoutInfo, _editors) {
super();
this._rootElement = _rootElement;
this._diffModel = _diffModel;
this._originalEditorLayoutInfo = _originalEditorLayoutInfo;
this._modifiedEditorLayoutInfo = _modifiedEditorLayoutInfo;
this._editors = _editors;
this._originalScrollTop = observableFromEvent(this._editors.original.onDidScrollChange, () => this._editors.original.getScrollTop());
this._modifiedScrollTop = observableFromEvent(this._editors.modified.onDidScrollChange, () => this._editors.modified.getScrollTop());
this._viewZonesChanged = observableSignalFromEvent("onDidChangeViewZones", this._editors.modified.onDidChangeViewZones);
this.width = observableValue(this, 0);
this._modifiedViewZonesChangedSignal = observableSignalFromEvent("modified.onDidChangeViewZones", this._editors.modified.onDidChangeViewZones);
this._originalViewZonesChangedSignal = observableSignalFromEvent("original.onDidChangeViewZones", this._editors.original.onDidChangeViewZones);
this._state = derivedWithStore(this, (reader, store) => {
var _a10;
this._element.replaceChildren();
const model = this._diffModel.read(reader);
const moves = (_a10 = model === null || model === void 0 ? void 0 : model.diff.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.movedTexts;
if (!moves || moves.length === 0) {
this.width.set(0, void 0);
return;
}
this._viewZonesChanged.read(reader);
const infoOrig = this._originalEditorLayoutInfo.read(reader);
const infoMod = this._modifiedEditorLayoutInfo.read(reader);
if (!infoOrig || !infoMod) {
this.width.set(0, void 0);
return;
}
this._modifiedViewZonesChangedSignal.read(reader);
this._originalViewZonesChangedSignal.read(reader);
const lines = moves.map((move) => {
function computeLineStart(range2, editor2) {
const t1 = editor2.getTopForLineNumber(range2.startLineNumber, true);
const t22 = editor2.getTopForLineNumber(range2.endLineNumberExclusive, true);
return (t1 + t22) / 2;
}
const start = computeLineStart(move.lineRangeMapping.original, this._editors.original);
const startOffset = this._originalScrollTop.read(reader);
const end = computeLineStart(move.lineRangeMapping.modified, this._editors.modified);
const endOffset = this._modifiedScrollTop.read(reader);
const from = start - startOffset;
const to = end - endOffset;
const top = Math.min(start, end);
const bottom = Math.max(start, end);
return { range: new OffsetRange(top, bottom), from, to, fromWithoutScroll: start, toWithoutScroll: end, move };
});
lines.sort(tieBreakComparators(compareBy((l) => l.fromWithoutScroll > l.toWithoutScroll, booleanComparator), compareBy((l) => l.fromWithoutScroll > l.toWithoutScroll ? l.fromWithoutScroll : -l.toWithoutScroll, numberComparator)));
const layout2 = LinesLayout2.compute(lines.map((l) => l.range));
const padding = 10;
const lineAreaLeft = infoOrig.verticalScrollbarWidth;
const lineAreaWidth = (layout2.getTrackCount() - 1) * 10 + padding * 2;
const width2 = lineAreaLeft + lineAreaWidth + (infoMod.contentLeft - _MovedBlocksLinesFeature.movedCodeBlockPadding);
let idx = 0;
for (const line of lines) {
const track = layout2.getTrack(idx);
const verticalY = lineAreaLeft + padding + track * 10;
const arrowHeight = 15;
const arrowWidth = 15;
const right = width2;
const rectWidth = infoMod.glyphMarginWidth + infoMod.lineNumbersWidth;
const rectHeight = 18;
const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.classList.add("arrow-rectangle");
rect.setAttribute("x", `${right - rectWidth}`);
rect.setAttribute("y", `${line.to - rectHeight / 2}`);
rect.setAttribute("width", `${rectWidth}`);
rect.setAttribute("height", `${rectHeight}`);
this._element.appendChild(rect);
const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
path.setAttribute("d", `M ${0} ${line.from} L ${verticalY} ${line.from} L ${verticalY} ${line.to} L ${right - arrowWidth} ${line.to}`);
path.setAttribute("fill", "none");
g.appendChild(path);
const arrowRight = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
arrowRight.classList.add("arrow");
store.add(autorun((reader2) => {
path.classList.toggle("currentMove", line.move === model.activeMovedText.read(reader2));
arrowRight.classList.toggle("currentMove", line.move === model.activeMovedText.read(reader2));
}));
arrowRight.setAttribute("points", `${right - arrowWidth},${line.to - arrowHeight / 2} ${right},${line.to} ${right - arrowWidth},${line.to + arrowHeight / 2}`);
g.appendChild(arrowRight);
this._element.appendChild(g);
idx++;
}
this.width.set(lineAreaWidth, 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(toDisposable(() => this._element.remove()));
this._register(autorun((reader) => {
const info = this._originalEditorLayoutInfo.read(reader);
const info2 = this._modifiedEditorLayoutInfo.read(reader);
if (!info || !info2) {
return;
}
this._element.style.left = `${info.width - info.verticalScrollbarWidth}px`;
this._element.style.height = `${info.height}px`;
this._element.style.width = `${info.verticalScrollbarWidth + info.contentLeft - _MovedBlocksLinesFeature.movedCodeBlockPadding + this.width.read(reader)}px`;
}));
this._register(recomputeInitiallyAndOnChange(this._state));
const movedBlockViewZones = derived((reader) => {
const model = this._diffModel.read(reader);
const d = model === null || model === void 0 ? void 0 : model.diff.read(reader);
if (!d) {
return [];
}
return d.movedTexts.map((move) => ({
move,
original: new PlaceholderViewZone(constObservable(move.lineRangeMapping.original.startLineNumber - 1), 18),
modified: new PlaceholderViewZone(constObservable(move.lineRangeMapping.modified.startLineNumber - 1), 18)
}));
});
this._register(applyViewZones(this._editors.original, movedBlockViewZones.map((zones) => (
/** @description movedBlockViewZones.original */
zones.map((z) => z.original)
))));
this._register(applyViewZones(this._editors.modified, movedBlockViewZones.map((zones) => (
/** @description movedBlockViewZones.modified */
zones.map((z) => z.modified)
))));
this._register(autorunWithStore((reader, store) => {
const blocks = movedBlockViewZones.read(reader);
for (const b of blocks) {
store.add(new MovedBlockOverlayWidget(this._editors.original, b.original, b.move, "original", this._diffModel.get()));
store.add(new MovedBlockOverlayWidget(this._editors.modified, b.modified, b.move, "modified", this._diffModel.get()));
}
}));
const originalHasFocus = observableSignalFromEvent("original.onDidFocusEditorWidget", (e) => this._editors.original.onDidFocusEditorWidget(() => setTimeout(() => e(void 0), 0)));
const modifiedHasFocus = observableSignalFromEvent("modified.onDidFocusEditorWidget", (e) => this._editors.modified.onDidFocusEditorWidget(() => setTimeout(() => e(void 0), 0)));
let lastChangedEditor = "modified";
this._register(autorunHandleChanges({
createEmptyChangeSummary: () => void 0,
handleChange: (ctx, summary) => {
if (ctx.didChange(originalHasFocus)) {
lastChangedEditor = "original";
}
if (ctx.didChange(modifiedHasFocus)) {
lastChangedEditor = "modified";
}
return true;
}
}, (reader) => {
originalHasFocus.read(reader);
modifiedHasFocus.read(reader);
const m = this._diffModel.read(reader);
if (!m) {
return;
}
const diff = m.diff.read(reader);
let movedText = void 0;
if (diff && lastChangedEditor === "original") {
const originalPos = this._editors.originalCursor.read(reader);
if (originalPos) {
movedText = diff.movedTexts.find((m2) => m2.lineRangeMapping.original.contains(originalPos.lineNumber));
}
}
if (diff && lastChangedEditor === "modified") {
const modifiedPos = this._editors.modifiedCursor.read(reader);
if (modifiedPos) {
movedText = diff.movedTexts.find((m2) => m2.lineRangeMapping.modified.contains(modifiedPos.lineNumber));
}
}
if (movedText !== m.movedTextToCompare.get()) {
m.movedTextToCompare.set(void 0, void 0);
}
m.setActiveMovedText(movedText);
}));
}
};
MovedBlocksLinesFeature.movedCodeBlockPadding = 4;
LinesLayout2 = class _LinesLayout {
static compute(lines) {
const setsPerTrack = [];
const trackPerLineIdx = [];
for (const line of lines) {
let trackIdx = setsPerTrack.findIndex((set) => !set.intersectsStrict(line));
if (trackIdx === -1) {
const maxTrackCount = 6;
if (setsPerTrack.length >= maxTrackCount) {
trackIdx = findMaxIdx(setsPerTrack, compareBy((set) => set.intersectWithRangeLength(line), numberComparator));
} else {
trackIdx = setsPerTrack.length;
setsPerTrack.push(new OffsetRangeSet());
}
}
setsPerTrack[trackIdx].addRange(line);
trackPerLineIdx.push(trackIdx);
}
return new _LinesLayout(setsPerTrack.length, trackPerLineIdx);
}
constructor(_trackCount, trackPerLineIdx) {
this._trackCount = _trackCount;
this.trackPerLineIdx = trackPerLineIdx;
}
getTrack(lineIdx) {
return this.trackPerLineIdx[lineIdx];
}
getTrackCount() {
return this._trackCount;
}
};
MovedBlockOverlayWidget = class extends ViewZoneOverlayWidget {
constructor(_editor, _viewZone, _move, _kind, _diffModel) {
const root = h("div.diff-hidden-lines-widget");
super(_editor, _viewZone, root.root);
this._editor = _editor;
this._move = _move;
this._kind = _kind;
this._diffModel = _diffModel;
this._nodes = h("div.diff-moved-code-block", { style: { marginRight: "4px" } }, [
h("div.text-content@textContent"),
h("div.action-bar@actionBar")
]);
root.root.appendChild(this._nodes.root);
const editorLayout = observableFromEvent(this._editor.onDidLayoutChange, () => this._editor.getLayoutInfo());
this._register(applyStyle(this._nodes.root, {
paddingRight: editorLayout.map((l) => l.verticalScrollbarWidth)
}));
let text2;
if (_move.changes.length > 0) {
text2 = this._kind === "original" ? localize("codeMovedToWithChanges", "Code moved with changes to line {0}-{1}", this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize("codeMovedFromWithChanges", "Code moved with changes from line {0}-{1}", this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
} else {
text2 = this._kind === "original" ? localize("codeMovedTo", "Code moved to line {0}-{1}", this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize("codeMovedFrom", "Code moved from line {0}-{1}", this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
}
const actionBar = this._register(new ActionBar(this._nodes.actionBar, {
highlightToggledItems: true
}));
const caption = new Action("", text2, "", false);
actionBar.push(caption, { icon: false, label: true });
const actionCompare = new Action("", "Compare", ThemeIcon.asClassName(Codicon.compareChanges), true, () => {
this._editor.focus();
this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get() === _move ? void 0 : this._move, void 0);
});
this._register(autorun((reader) => {
const isActive = this._diffModel.movedTextToCompare.read(reader) === _move;
actionCompare.checked = isActive;
}));
actionBar.push(actionCompare, { icon: false, label: true });
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js
var diffMoveBorder, diffMoveBorderActive, diffEditorUnchangedRegionShadow, diffInsertIcon, diffRemoveIcon, diffLineAddDecorationBackgroundWithIndicator, diffLineDeleteDecorationBackgroundWithIndicator, diffLineAddDecorationBackground, diffLineDeleteDecorationBackground, diffAddDecoration, diffWholeLineAddDecoration, diffAddDecorationEmpty, diffDeleteDecoration, diffWholeLineDeleteDecoration, diffDeleteDecorationEmpty;
var init_registrations_contribution = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js"() {
init_codicons();
init_themables();
init_textModel();
init_nls();
init_colorRegistry();
init_iconRegistry();
diffMoveBorder = registerColor("diffEditor.move.border", { dark: "#8b8b8b9c", light: "#8b8b8b9c", hcDark: "#8b8b8b9c", hcLight: "#8b8b8b9c" }, localize("diffEditor.move.border", "The border color for text that got moved in the diff editor."));
diffMoveBorderActive = registerColor("diffEditor.moveActive.border", { dark: "#FFA500", light: "#FFA500", hcDark: "#FFA500", hcLight: "#FFA500" }, localize("diffEditor.moveActive.border", "The active border color for text that got moved in the diff editor."));
diffEditorUnchangedRegionShadow = registerColor("diffEditor.unchangedRegionShadow", { dark: "#000000", light: "#737373BF", hcDark: "#000000", hcLight: "#737373BF" }, localize("diffEditor.unchangedRegionShadow", "The color of the shadow around unchanged region widgets."));
diffInsertIcon = registerIcon("diff-insert", Codicon.add, localize("diffInsertIcon", "Line decoration for inserts in the diff editor."));
diffRemoveIcon = registerIcon("diff-remove", Codicon.remove, localize("diffRemoveIcon", "Line decoration for removals in the diff editor."));
diffLineAddDecorationBackgroundWithIndicator = ModelDecorationOptions.register({
className: "line-insert",
description: "line-insert",
isWholeLine: true,
linesDecorationsClassName: "insert-sign " + ThemeIcon.asClassName(diffInsertIcon),
marginClassName: "gutter-insert"
});
diffLineDeleteDecorationBackgroundWithIndicator = ModelDecorationOptions.register({
className: "line-delete",
description: "line-delete",
isWholeLine: true,
linesDecorationsClassName: "delete-sign " + ThemeIcon.asClassName(diffRemoveIcon),
marginClassName: "gutter-delete"
});
diffLineAddDecorationBackground = ModelDecorationOptions.register({
className: "line-insert",
description: "line-insert",
isWholeLine: true,
marginClassName: "gutter-insert"
});
diffLineDeleteDecorationBackground = ModelDecorationOptions.register({
className: "line-delete",
description: "line-delete",
isWholeLine: true,
marginClassName: "gutter-delete"
});
diffAddDecoration = ModelDecorationOptions.register({
className: "char-insert",
description: "char-insert",
shouldFillLineOnLineBreak: true
});
diffWholeLineAddDecoration = ModelDecorationOptions.register({
className: "char-insert",
description: "char-insert",
isWholeLine: true
});
diffAddDecorationEmpty = ModelDecorationOptions.register({
className: "char-insert diff-range-empty",
description: "char-insert diff-range-empty"
});
diffDeleteDecoration = ModelDecorationOptions.register({
className: "char-delete",
description: "char-delete",
shouldFillLineOnLineBreak: true
});
diffWholeLineDeleteDecoration = ModelDecorationOptions.register({
className: "char-delete",
description: "char-delete",
isWholeLine: true
});
diffDeleteDecorationEmpty = ModelDecorationOptions.register({
className: "char-delete diff-range-empty",
description: "char-delete diff-range-empty"
});
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorDecorations.js
var DiffEditorDecorations;
var init_diffEditorDecorations = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorDecorations.js"() {
init_lifecycle();
init_observable();
init_movedBlocksLinesFeature();
init_registrations_contribution();
init_utils4();
DiffEditorDecorations = class extends Disposable {
constructor(_editors, _diffModel, _options, widget) {
super();
this._editors = _editors;
this._diffModel = _diffModel;
this._options = _options;
this._decorations = derived(this, (reader) => {
var _a10;
const diff = (_a10 = this._diffModel.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.diff.read(reader);
if (!diff) {
return null;
}
const movedTextToCompare = this._diffModel.read(reader).movedTextToCompare.read(reader);
const renderIndicators = this._options.renderIndicators.read(reader);
const showEmptyDecorations = this._options.showEmptyDecorations.read(reader);
const originalDecorations = [];
const modifiedDecorations = [];
if (!movedTextToCompare) {
for (const m of diff.mappings) {
if (!m.lineRangeMapping.original.isEmpty) {
originalDecorations.push({ range: m.lineRangeMapping.original.toInclusiveRange(), options: renderIndicators ? diffLineDeleteDecorationBackgroundWithIndicator : diffLineDeleteDecorationBackground });
}
if (!m.lineRangeMapping.modified.isEmpty) {
modifiedDecorations.push({ range: m.lineRangeMapping.modified.toInclusiveRange(), options: renderIndicators ? diffLineAddDecorationBackgroundWithIndicator : diffLineAddDecorationBackground });
}
if (m.lineRangeMapping.modified.isEmpty || m.lineRangeMapping.original.isEmpty) {
if (!m.lineRangeMapping.original.isEmpty) {
originalDecorations.push({ range: m.lineRangeMapping.original.toInclusiveRange(), options: diffWholeLineDeleteDecoration });
}
if (!m.lineRangeMapping.modified.isEmpty) {
modifiedDecorations.push({ range: m.lineRangeMapping.modified.toInclusiveRange(), options: diffWholeLineAddDecoration });
}
} else {
for (const i of m.lineRangeMapping.innerChanges || []) {
if (m.lineRangeMapping.original.contains(i.originalRange.startLineNumber)) {
originalDecorations.push({ range: i.originalRange, options: i.originalRange.isEmpty() && showEmptyDecorations ? diffDeleteDecorationEmpty : diffDeleteDecoration });
}
if (m.lineRangeMapping.modified.contains(i.modifiedRange.startLineNumber)) {
modifiedDecorations.push({ range: i.modifiedRange, options: i.modifiedRange.isEmpty() && showEmptyDecorations ? diffAddDecorationEmpty : diffAddDecoration });
}
}
}
}
}
if (movedTextToCompare) {
for (const m of movedTextToCompare.changes) {
const fullRangeOriginal = m.original.toInclusiveRange();
if (fullRangeOriginal) {
originalDecorations.push({ range: fullRangeOriginal, options: renderIndicators ? diffLineDeleteDecorationBackgroundWithIndicator : diffLineDeleteDecorationBackground });
}
const fullRangeModified = m.modified.toInclusiveRange();
if (fullRangeModified) {
modifiedDecorations.push({ range: fullRangeModified, options: renderIndicators ? diffLineAddDecorationBackgroundWithIndicator : diffLineAddDecorationBackground });
}
for (const i of m.innerChanges || []) {
originalDecorations.push({ range: i.originalRange, options: diffDeleteDecoration });
modifiedDecorations.push({ range: i.modifiedRange, options: diffAddDecoration });
}
}
}
const activeMovedText = this._diffModel.read(reader).activeMovedText.read(reader);
for (const m of diff.movedTexts) {
originalDecorations.push({
range: m.lineRangeMapping.original.toInclusiveRange(),
options: {
description: "moved",
blockClassName: "movedOriginal" + (m === activeMovedText ? " currentMove" : ""),
blockPadding: [MovedBlocksLinesFeature.movedCodeBlockPadding, 0, MovedBlocksLinesFeature.movedCodeBlockPadding, MovedBlocksLinesFeature.movedCodeBlockPadding]
}
});
modifiedDecorations.push({
range: m.lineRangeMapping.modified.toInclusiveRange(),
options: {
description: "moved",
blockClassName: "movedModified" + (m === activeMovedText ? " currentMove" : ""),
blockPadding: [4, 0, 4, 4]
}
});
}
return { originalDecorations, modifiedDecorations };
});
this._register(applyObservableDecorations(this._editors.original, this._decorations.map((d) => (d === null || d === void 0 ? void 0 : d.originalDecorations) || [])));
this._register(applyObservableDecorations(this._editors.modified, this._decorations.map((d) => (d === null || d === void 0 ? void 0 : d.modifiedDecorations) || [])));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorSash.js
var SashLayout, DiffEditorSash;
var init_diffEditorSash = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorSash.js"() {
init_sash2();
init_lifecycle();
init_observable();
init_derived();
SashLayout = class {
resetSash() {
this._sashRatio.set(void 0, void 0);
}
constructor(_options, dimensions) {
this._options = _options;
this.dimensions = dimensions;
this.sashLeft = derivedWithSetter(this, (reader) => {
var _a10;
const ratio = (_a10 = this._sashRatio.read(reader)) !== null && _a10 !== void 0 ? _a10 : this._options.splitViewDefaultRatio.read(reader);
return this._computeSashLeft(ratio, reader);
}, (value, tx) => {
const contentWidth = this.dimensions.width.get();
this._sashRatio.set(value / contentWidth, tx);
});
this._sashRatio = observableValue(this, void 0);
}
/** @pure */
_computeSashLeft(desiredRatio, reader) {
const contentWidth = this.dimensions.width.read(reader);
const midPoint = Math.floor(this._options.splitViewDefaultRatio.read(reader) * contentWidth);
const sashLeft = this._options.enableSplitViewResizing.read(reader) ? Math.floor(desiredRatio * contentWidth) : midPoint;
const MINIMUM_EDITOR_WIDTH = 100;
if (contentWidth <= MINIMUM_EDITOR_WIDTH * 2) {
return midPoint;
}
if (sashLeft < MINIMUM_EDITOR_WIDTH) {
return MINIMUM_EDITOR_WIDTH;
}
if (sashLeft > contentWidth - MINIMUM_EDITOR_WIDTH) {
return contentWidth - MINIMUM_EDITOR_WIDTH;
}
return sashLeft;
}
};
DiffEditorSash = class extends Disposable {
constructor(_domNode, _dimensions, _enabled, _boundarySashes, sashLeft, _resetSash) {
super();
this._domNode = _domNode;
this._dimensions = _dimensions;
this._enabled = _enabled;
this._boundarySashes = _boundarySashes;
this.sashLeft = sashLeft;
this._resetSash = _resetSash;
this._sash = this._register(new Sash(this._domNode, {
getVerticalSashTop: (_sash) => 0,
getVerticalSashLeft: (_sash) => this.sashLeft.get(),
getVerticalSashHeight: (_sash) => this._dimensions.height.get()
}, {
orientation: 0
/* Orientation.VERTICAL */
}));
this._startSashPosition = void 0;
this._register(this._sash.onDidStart(() => {
this._startSashPosition = this.sashLeft.get();
}));
this._register(this._sash.onDidChange((e) => {
this.sashLeft.set(this._startSashPosition + (e.currentX - e.startX), void 0);
}));
this._register(this._sash.onDidEnd(() => this._sash.layout()));
this._register(this._sash.onDidReset(() => this._resetSash()));
this._register(autorun((reader) => {
const sashes = this._boundarySashes.read(reader);
if (sashes) {
this._sash.orthogonalEndSash = sashes.bottom;
}
}));
this._register(autorun((reader) => {
const enabled = this._enabled.read(reader);
this._sash.state = enabled ? 3 : 0;
this.sashLeft.read(reader);
this._dimensions.height.read(reader);
this._sash.layout();
}));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js
var __decorate49, __param43, WorkerBasedDocumentDiffProvider_1, IDiffProviderFactoryService, WorkerBasedDiffProviderFactoryService, WorkerBasedDocumentDiffProvider;
var init_diffProviderFactoryService = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js"() {
init_extensions();
init_instantiation();
init_event();
init_stopwatch();
init_lineRange();
init_rangeMapping();
init_editorWorker();
init_telemetry();
__decorate49 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param43 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
IDiffProviderFactoryService = createDecorator("diffProviderFactoryService");
WorkerBasedDiffProviderFactoryService = class WorkerBasedDiffProviderFactoryService2 {
constructor(instantiationService) {
this.instantiationService = instantiationService;
}
createDiffProvider(options2) {
return this.instantiationService.createInstance(WorkerBasedDocumentDiffProvider, options2);
}
};
WorkerBasedDiffProviderFactoryService = __decorate49([
__param43(0, IInstantiationService)
], WorkerBasedDiffProviderFactoryService);
registerSingleton(
IDiffProviderFactoryService,
WorkerBasedDiffProviderFactoryService,
1
/* InstantiationType.Delayed */
);
WorkerBasedDocumentDiffProvider = WorkerBasedDocumentDiffProvider_1 = class WorkerBasedDocumentDiffProvider2 {
constructor(options2, editorWorkerService, telemetryService) {
this.editorWorkerService = editorWorkerService;
this.telemetryService = telemetryService;
this.onDidChangeEventEmitter = new Emitter();
this.onDidChange = this.onDidChangeEventEmitter.event;
this.diffAlgorithm = "advanced";
this.diffAlgorithmOnDidChangeSubscription = void 0;
this.setOptions(options2);
}
dispose() {
var _a10;
(_a10 = this.diffAlgorithmOnDidChangeSubscription) === null || _a10 === void 0 ? void 0 : _a10.dispose();
}
computeDiff(original, modified, options2, cancellationToken) {
return __async(this, null, function* () {
var _a10, _b4;
if (typeof this.diffAlgorithm !== "string") {
return this.diffAlgorithm.computeDiff(original, modified, options2, cancellationToken);
}
if (original.isDisposed() || modified.isDisposed()) {
return {
changes: [],
identical: true,
quitEarly: false,
moves: []
};
}
if (original.getLineCount() === 1 && original.getLineMaxColumn(1) === 1) {
if (modified.getLineCount() === 1 && modified.getLineMaxColumn(1) === 1) {
return {
changes: [],
identical: true,
quitEarly: false,
moves: []
};
}
return {
changes: [
new DetailedLineRangeMapping(new LineRange(1, 2), new LineRange(1, modified.getLineCount() + 1), [
new RangeMapping(original.getFullModelRange(), modified.getFullModelRange())
])
],
identical: false,
quitEarly: false,
moves: []
};
}
const uriKey = JSON.stringify([original.uri.toString(), modified.uri.toString()]);
const context = JSON.stringify([original.id, modified.id, original.getAlternativeVersionId(), modified.getAlternativeVersionId(), JSON.stringify(options2)]);
const c = WorkerBasedDocumentDiffProvider_1.diffCache.get(uriKey);
if (c && c.context === context) {
return c.result;
}
const sw = StopWatch.create();
const result = yield this.editorWorkerService.computeDiff(original.uri, modified.uri, options2, this.diffAlgorithm);
const timeMs = sw.elapsed();
this.telemetryService.publicLog2("diffEditor.computeDiff", {
timeMs,
timedOut: (_a10 = result === null || result === void 0 ? void 0 : result.quitEarly) !== null && _a10 !== void 0 ? _a10 : true,
detectedMoves: options2.computeMoves ? (_b4 = result === null || result === void 0 ? void 0 : result.moves.length) !== null && _b4 !== void 0 ? _b4 : 0 : -1
});
if (cancellationToken.isCancellationRequested) {
return {
changes: [],
identical: false,
quitEarly: true,
moves: []
};
}
if (!result) {
throw new Error("no diff result available");
}
if (WorkerBasedDocumentDiffProvider_1.diffCache.size > 10) {
WorkerBasedDocumentDiffProvider_1.diffCache.delete(WorkerBasedDocumentDiffProvider_1.diffCache.keys().next().value);
}
WorkerBasedDocumentDiffProvider_1.diffCache.set(uriKey, { result, context });
return result;
});
}
setOptions(newOptions) {
var _a10;
let didChange = false;
if (newOptions.diffAlgorithm) {
if (this.diffAlgorithm !== newOptions.diffAlgorithm) {
(_a10 = this.diffAlgorithmOnDidChangeSubscription) === null || _a10 === void 0 ? void 0 : _a10.dispose();
this.diffAlgorithmOnDidChangeSubscription = void 0;
this.diffAlgorithm = newOptions.diffAlgorithm;
if (typeof newOptions.diffAlgorithm !== "string") {
this.diffAlgorithmOnDidChangeSubscription = newOptions.diffAlgorithm.onDidChange(() => this.onDidChangeEventEmitter.fire());
}
didChange = true;
}
}
if (didChange) {
this.onDidChangeEventEmitter.fire();
}
}
};
WorkerBasedDocumentDiffProvider.diffCache = /* @__PURE__ */ new Map();
WorkerBasedDocumentDiffProvider = WorkerBasedDocumentDiffProvider_1 = __decorate49([
__param43(1, IEditorWorkerService),
__param43(2, ITelemetryService)
], WorkerBasedDocumentDiffProvider);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js
function normalizeDocumentDiff(diff, original, modified) {
return {
changes: diff.changes.map((c) => new DetailedLineRangeMapping(c.original, c.modified, c.innerChanges ? c.innerChanges.map((i) => normalizeRangeMapping(i, original, modified)) : void 0)),
moves: diff.moves,
identical: diff.identical,
quitEarly: diff.quitEarly
};
}
function normalizeRangeMapping(rangeMapping, original, modified) {
let originalRange = rangeMapping.originalRange;
let modifiedRange = rangeMapping.modifiedRange;
if ((originalRange.endColumn !== 1 || modifiedRange.endColumn !== 1) && originalRange.endColumn === original.getLineMaxColumn(originalRange.endLineNumber) && modifiedRange.endColumn === modified.getLineMaxColumn(modifiedRange.endLineNumber) && originalRange.endLineNumber < original.getLineCount() && modifiedRange.endLineNumber < modified.getLineCount()) {
originalRange = originalRange.setEndPosition(originalRange.endLineNumber + 1, 1);
modifiedRange = modifiedRange.setEndPosition(modifiedRange.endLineNumber + 1, 1);
}
return new RangeMapping(originalRange, modifiedRange);
}
function applyOriginalEdits(diff, textEdits, originalTextModel, modifiedTextModel) {
return void 0;
}
function applyModifiedEdits(diff, textEdits, originalTextModel, modifiedTextModel) {
return void 0;
}
var __decorate50, __param44, DiffEditorViewModel, DiffState, DiffMapping, UnchangedRegion;
var init_diffEditorViewModel = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js"() {
init_async();
init_cancellation();
init_lifecycle();
init_observable();
init_diffProviderFactoryService();
init_utils4();
init_lineRange();
init_defaultLinesDiffComputer();
init_rangeMapping();
init_beforeEditPositionMapper();
init_combineTextEditInfos();
init_heuristicSequenceOptimizations();
init_types();
init_arrays();
init_assert();
__decorate50 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param44 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DiffEditorViewModel = class DiffEditorViewModel2 extends Disposable {
setActiveMovedText(movedText) {
this._activeMovedText.set(movedText, void 0);
}
constructor(model, _options, _diffProviderFactoryService) {
super();
this.model = model;
this._options = _options;
this._diffProviderFactoryService = _diffProviderFactoryService;
this._isDiffUpToDate = observableValue(this, false);
this.isDiffUpToDate = this._isDiffUpToDate;
this._diff = observableValue(this, void 0);
this.diff = this._diff;
this._unchangedRegions = observableValue(this, void 0);
this.unchangedRegions = derived(this, (r) => {
var _a10, _b4;
if (this._options.hideUnchangedRegions.read(r)) {
return (_b4 = (_a10 = this._unchangedRegions.read(r)) === null || _a10 === void 0 ? void 0 : _a10.regions) !== null && _b4 !== void 0 ? _b4 : [];
} else {
transaction((tx) => {
var _a11;
for (const r2 of ((_a11 = this._unchangedRegions.get()) === null || _a11 === void 0 ? void 0 : _a11.regions) || []) {
r2.collapseAll(tx);
}
});
return [];
}
});
this.movedTextToCompare = observableValue(this, void 0);
this._activeMovedText = observableValue(this, void 0);
this._hoveredMovedText = observableValue(this, void 0);
this.activeMovedText = derived(this, (r) => {
var _a10, _b4;
return (_b4 = (_a10 = this.movedTextToCompare.read(r)) !== null && _a10 !== void 0 ? _a10 : this._hoveredMovedText.read(r)) !== null && _b4 !== void 0 ? _b4 : this._activeMovedText.read(r);
});
this._cancellationTokenSource = new CancellationTokenSource();
this._diffProvider = derived(this, (reader) => {
const diffProvider = this._diffProviderFactoryService.createDiffProvider({
diffAlgorithm: this._options.diffAlgorithm.read(reader)
});
const onChangeSignal = observableSignalFromEvent("onDidChange", diffProvider.onDidChange);
return {
diffProvider,
onChangeSignal
};
});
this._register(toDisposable(() => this._cancellationTokenSource.cancel()));
const contentChangedSignal = observableSignal("contentChangedSignal");
const debouncer = this._register(new RunOnceScheduler(() => contentChangedSignal.trigger(void 0), 200));
this._register(autorun((reader) => {
const lastUnchangedRegions = this._unchangedRegions.read(reader);
if (!lastUnchangedRegions || lastUnchangedRegions.regions.some((r) => r.isDragged.read(reader))) {
return;
}
const lastUnchangedRegionsOrigRanges = lastUnchangedRegions.originalDecorationIds.map((id) => model.original.getDecorationRange(id)).map((r) => r ? LineRange.fromRangeInclusive(r) : void 0);
const lastUnchangedRegionsModRanges = lastUnchangedRegions.modifiedDecorationIds.map((id) => model.modified.getDecorationRange(id)).map((r) => r ? LineRange.fromRangeInclusive(r) : void 0);
const updatedLastUnchangedRegions = lastUnchangedRegions.regions.map((r, idx) => !lastUnchangedRegionsOrigRanges[idx] || !lastUnchangedRegionsModRanges[idx] ? void 0 : new UnchangedRegion(lastUnchangedRegionsOrigRanges[idx].startLineNumber, lastUnchangedRegionsModRanges[idx].startLineNumber, lastUnchangedRegionsOrigRanges[idx].length, r.visibleLineCountTop.read(reader), r.visibleLineCountBottom.read(reader))).filter(isDefined);
const newRanges = [];
let didChange = false;
for (const touching of groupAdjacentBy(updatedLastUnchangedRegions, (a3, b) => a3.getHiddenModifiedRange(reader).endLineNumberExclusive === b.getHiddenModifiedRange(reader).startLineNumber)) {
if (touching.length > 1) {
didChange = true;
const sumLineCount = touching.reduce((sum, r2) => sum + r2.lineCount, 0);
const r = new UnchangedRegion(touching[0].originalLineNumber, touching[0].modifiedLineNumber, sumLineCount, touching[0].visibleLineCountTop.get(), touching[touching.length - 1].visibleLineCountBottom.get());
newRanges.push(r);
} else {
newRanges.push(touching[0]);
}
}
if (didChange) {
const originalDecorationIds = model.original.deltaDecorations(lastUnchangedRegions.originalDecorationIds, newRanges.map((r) => ({ range: r.originalUnchangedRange.toInclusiveRange(), options: { description: "unchanged" } })));
const modifiedDecorationIds = model.modified.deltaDecorations(lastUnchangedRegions.modifiedDecorationIds, newRanges.map((r) => ({ range: r.modifiedUnchangedRange.toInclusiveRange(), options: { description: "unchanged" } })));
transaction((tx) => {
this._unchangedRegions.set({
regions: newRanges,
originalDecorationIds,
modifiedDecorationIds
}, tx);
});
}
}));
const updateUnchangedRegions = (result, tx, reader) => {
const newUnchangedRegions = UnchangedRegion.fromDiffs(result.changes, model.original.getLineCount(), model.modified.getLineCount(), this._options.hideUnchangedRegionsMinimumLineCount.read(reader), this._options.hideUnchangedRegionsContextLineCount.read(reader));
let visibleRegions = void 0;
const lastUnchangedRegions = this._unchangedRegions.get();
if (lastUnchangedRegions) {
const lastUnchangedRegionsOrigRanges = lastUnchangedRegions.originalDecorationIds.map((id) => model.original.getDecorationRange(id)).map((r) => r ? LineRange.fromRangeInclusive(r) : void 0);
const lastUnchangedRegionsModRanges = lastUnchangedRegions.modifiedDecorationIds.map((id) => model.modified.getDecorationRange(id)).map((r) => r ? LineRange.fromRangeInclusive(r) : void 0);
const updatedLastUnchangedRegions = filterWithPrevious(lastUnchangedRegions.regions.map((r, idx) => {
if (!lastUnchangedRegionsOrigRanges[idx] || !lastUnchangedRegionsModRanges[idx]) {
return void 0;
}
const length = lastUnchangedRegionsOrigRanges[idx].length;
return new UnchangedRegion(
lastUnchangedRegionsOrigRanges[idx].startLineNumber,
lastUnchangedRegionsModRanges[idx].startLineNumber,
length,
// The visible area can shrink by edits -> we have to account for this
Math.min(r.visibleLineCountTop.get(), length),
Math.min(r.visibleLineCountBottom.get(), length - r.visibleLineCountTop.get())
);
}).filter(isDefined), (cur, prev) => !prev || cur.modifiedLineNumber >= prev.modifiedLineNumber + prev.lineCount && cur.originalLineNumber >= prev.originalLineNumber + prev.lineCount);
let hiddenRegions = updatedLastUnchangedRegions.map((r) => new LineRangeMapping(r.getHiddenOriginalRange(reader), r.getHiddenModifiedRange(reader)));
hiddenRegions = LineRangeMapping.clip(hiddenRegions, LineRange.ofLength(1, model.original.getLineCount()), LineRange.ofLength(1, model.modified.getLineCount()));
visibleRegions = LineRangeMapping.inverse(hiddenRegions, model.original.getLineCount(), model.modified.getLineCount());
}
const newUnchangedRegions2 = [];
if (visibleRegions) {
for (const r of newUnchangedRegions) {
const intersecting = visibleRegions.filter((f3) => f3.original.intersectsStrict(r.originalUnchangedRange) && f3.modified.intersectsStrict(r.modifiedUnchangedRange));
newUnchangedRegions2.push(...r.setVisibleRanges(intersecting, tx));
}
} else {
newUnchangedRegions2.push(...newUnchangedRegions);
}
const originalDecorationIds = model.original.deltaDecorations((lastUnchangedRegions === null || lastUnchangedRegions === void 0 ? void 0 : lastUnchangedRegions.originalDecorationIds) || [], newUnchangedRegions2.map((r) => ({ range: r.originalUnchangedRange.toInclusiveRange(), options: { description: "unchanged" } })));
const modifiedDecorationIds = model.modified.deltaDecorations((lastUnchangedRegions === null || lastUnchangedRegions === void 0 ? void 0 : lastUnchangedRegions.modifiedDecorationIds) || [], newUnchangedRegions2.map((r) => ({ range: r.modifiedUnchangedRange.toInclusiveRange(), options: { description: "unchanged" } })));
this._unchangedRegions.set({
regions: newUnchangedRegions2,
originalDecorationIds,
modifiedDecorationIds
}, tx);
};
this._register(model.modified.onDidChangeContent((e) => {
const diff = this._diff.get();
if (diff) {
const textEdits = TextEditInfo.fromModelContentChanges(e.changes);
const result = applyModifiedEdits(this._lastDiff, textEdits, model.original, model.modified);
if (result) {
this._lastDiff = result;
transaction((tx) => {
this._diff.set(DiffState.fromDiffResult(this._lastDiff), tx);
updateUnchangedRegions(result, tx);
const currentSyncedMovedText = this.movedTextToCompare.get();
this.movedTextToCompare.set(currentSyncedMovedText ? this._lastDiff.moves.find((m) => m.lineRangeMapping.modified.intersect(currentSyncedMovedText.lineRangeMapping.modified)) : void 0, tx);
});
}
}
this._isDiffUpToDate.set(false, void 0);
debouncer.schedule();
}));
this._register(model.original.onDidChangeContent((e) => {
const diff = this._diff.get();
if (diff) {
const textEdits = TextEditInfo.fromModelContentChanges(e.changes);
const result = applyOriginalEdits(this._lastDiff, textEdits, model.original, model.modified);
if (result) {
this._lastDiff = result;
transaction((tx) => {
this._diff.set(DiffState.fromDiffResult(this._lastDiff), tx);
updateUnchangedRegions(result, tx);
const currentSyncedMovedText = this.movedTextToCompare.get();
this.movedTextToCompare.set(currentSyncedMovedText ? this._lastDiff.moves.find((m) => m.lineRangeMapping.modified.intersect(currentSyncedMovedText.lineRangeMapping.modified)) : void 0, tx);
});
}
}
this._isDiffUpToDate.set(false, void 0);
debouncer.schedule();
}));
this._register(autorunWithStore((reader, store) => __async(this, null, function* () {
var _a10, _b4;
this._options.hideUnchangedRegionsMinimumLineCount.read(reader);
this._options.hideUnchangedRegionsContextLineCount.read(reader);
debouncer.cancel();
contentChangedSignal.read(reader);
const documentDiffProvider = this._diffProvider.read(reader);
documentDiffProvider.onChangeSignal.read(reader);
readHotReloadableExport(DefaultLinesDiffComputer, reader);
readHotReloadableExport(optimizeSequenceDiffs, reader);
this._isDiffUpToDate.set(false, void 0);
let originalTextEditInfos = [];
store.add(model.original.onDidChangeContent((e) => {
const edits = TextEditInfo.fromModelContentChanges(e.changes);
originalTextEditInfos = combineTextEditInfos(originalTextEditInfos, edits);
}));
let modifiedTextEditInfos = [];
store.add(model.modified.onDidChangeContent((e) => {
const edits = TextEditInfo.fromModelContentChanges(e.changes);
modifiedTextEditInfos = combineTextEditInfos(modifiedTextEditInfos, edits);
}));
let result = yield documentDiffProvider.diffProvider.computeDiff(model.original, model.modified, {
ignoreTrimWhitespace: this._options.ignoreTrimWhitespace.read(reader),
maxComputationTimeMs: this._options.maxComputationTimeMs.read(reader),
computeMoves: this._options.showMoves.read(reader)
}, this._cancellationTokenSource.token);
if (this._cancellationTokenSource.token.isCancellationRequested) {
return;
}
if (model.original.isDisposed() || model.modified.isDisposed()) {
return;
}
result = normalizeDocumentDiff(result, model.original, model.modified);
result = (_a10 = applyOriginalEdits(result, originalTextEditInfos, model.original, model.modified)) !== null && _a10 !== void 0 ? _a10 : result;
result = (_b4 = applyModifiedEdits(result, modifiedTextEditInfos, model.original, model.modified)) !== null && _b4 !== void 0 ? _b4 : result;
transaction((tx) => {
updateUnchangedRegions(result, tx);
this._lastDiff = result;
const state = DiffState.fromDiffResult(result);
this._diff.set(state, tx);
this._isDiffUpToDate.set(true, tx);
const currentSyncedMovedText = this.movedTextToCompare.get();
this.movedTextToCompare.set(currentSyncedMovedText ? this._lastDiff.moves.find((m) => m.lineRangeMapping.modified.intersect(currentSyncedMovedText.lineRangeMapping.modified)) : void 0, tx);
});
})));
}
ensureModifiedLineIsVisible(lineNumber, preference, tx) {
var _a10, _b4;
if (((_a10 = this.diff.get()) === null || _a10 === void 0 ? void 0 : _a10.mappings.length) === 0) {
return;
}
const unchangedRegions = ((_b4 = this._unchangedRegions.get()) === null || _b4 === void 0 ? void 0 : _b4.regions) || [];
for (const r of unchangedRegions) {
if (r.getHiddenModifiedRange(void 0).contains(lineNumber)) {
r.showModifiedLine(lineNumber, preference, tx);
return;
}
}
}
ensureOriginalLineIsVisible(lineNumber, preference, tx) {
var _a10, _b4;
if (((_a10 = this.diff.get()) === null || _a10 === void 0 ? void 0 : _a10.mappings.length) === 0) {
return;
}
const unchangedRegions = ((_b4 = this._unchangedRegions.get()) === null || _b4 === void 0 ? void 0 : _b4.regions) || [];
for (const r of unchangedRegions) {
if (r.getHiddenOriginalRange(void 0).contains(lineNumber)) {
r.showOriginalLine(lineNumber, preference, tx);
return;
}
}
}
waitForDiff() {
return __async(this, null, function* () {
yield waitForState(this.isDiffUpToDate, (s) => s);
});
}
serializeState() {
const regions = this._unchangedRegions.get();
return {
collapsedRegions: regions === null || regions === void 0 ? void 0 : regions.regions.map((r) => ({ range: r.getHiddenModifiedRange(void 0).serialize() }))
};
}
restoreSerializedState(state) {
var _a10;
const ranges = (_a10 = state.collapsedRegions) === null || _a10 === void 0 ? void 0 : _a10.map((r) => LineRange.deserialize(r.range));
const regions = this._unchangedRegions.get();
if (!regions || !ranges) {
return;
}
transaction((tx) => {
for (const r of regions.regions) {
for (const range2 of ranges) {
if (r.modifiedUnchangedRange.intersect(range2)) {
r.setHiddenModifiedRange(range2, tx);
break;
}
}
}
});
}
};
DiffEditorViewModel = __decorate50([
__param44(2, IDiffProviderFactoryService)
], DiffEditorViewModel);
DiffState = class _DiffState {
static fromDiffResult(result) {
return new _DiffState(result.changes.map((c) => new DiffMapping(c)), result.moves || [], result.identical, result.quitEarly);
}
constructor(mappings, movedTexts, identical, quitEarly) {
this.mappings = mappings;
this.movedTexts = movedTexts;
this.identical = identical;
this.quitEarly = quitEarly;
}
};
DiffMapping = class {
constructor(lineRangeMapping) {
this.lineRangeMapping = lineRangeMapping;
}
};
UnchangedRegion = class _UnchangedRegion {
static fromDiffs(changes, originalLineCount, modifiedLineCount, minHiddenLineCount, minContext) {
const inversedMappings = DetailedLineRangeMapping.inverse(changes, originalLineCount, modifiedLineCount);
const result = [];
for (const mapping of inversedMappings) {
let origStart = mapping.original.startLineNumber;
let modStart = mapping.modified.startLineNumber;
let length = mapping.original.length;
const atStart = origStart === 1 && modStart === 1;
const atEnd = origStart + length === originalLineCount + 1 && modStart + length === modifiedLineCount + 1;
if ((atStart || atEnd) && length >= minContext + minHiddenLineCount) {
if (atStart && !atEnd) {
length -= minContext;
}
if (atEnd && !atStart) {
origStart += minContext;
modStart += minContext;
length -= minContext;
}
result.push(new _UnchangedRegion(origStart, modStart, length, 0, 0));
} else if (length >= minContext * 2 + minHiddenLineCount) {
origStart += minContext;
modStart += minContext;
length -= minContext * 2;
result.push(new _UnchangedRegion(origStart, modStart, length, 0, 0));
}
}
return result;
}
get originalUnchangedRange() {
return LineRange.ofLength(this.originalLineNumber, this.lineCount);
}
get modifiedUnchangedRange() {
return LineRange.ofLength(this.modifiedLineNumber, this.lineCount);
}
constructor(originalLineNumber, modifiedLineNumber, lineCount, visibleLineCountTop, visibleLineCountBottom) {
this.originalLineNumber = originalLineNumber;
this.modifiedLineNumber = modifiedLineNumber;
this.lineCount = lineCount;
this._visibleLineCountTop = observableValue(this, 0);
this.visibleLineCountTop = this._visibleLineCountTop;
this._visibleLineCountBottom = observableValue(this, 0);
this.visibleLineCountBottom = this._visibleLineCountBottom;
this._shouldHideControls = derived(this, (reader) => (
/** @description isVisible */
this.visibleLineCountTop.read(reader) + this.visibleLineCountBottom.read(reader) === this.lineCount && !this.isDragged.read(reader)
));
this.isDragged = observableValue(this, void 0);
const visibleLineCountTop2 = Math.max(Math.min(visibleLineCountTop, this.lineCount), 0);
const visibleLineCountBottom2 = Math.max(Math.min(visibleLineCountBottom, this.lineCount - visibleLineCountTop), 0);
softAssert(visibleLineCountTop === visibleLineCountTop2);
softAssert(visibleLineCountBottom === visibleLineCountBottom2);
this._visibleLineCountTop.set(visibleLineCountTop2, void 0);
this._visibleLineCountBottom.set(visibleLineCountBottom2, void 0);
}
setVisibleRanges(visibleRanges, tx) {
const result = [];
const hiddenModified = new LineRangeSet(visibleRanges.map((r) => r.modified)).subtractFrom(this.modifiedUnchangedRange);
let originalStartLineNumber = this.originalLineNumber;
let modifiedStartLineNumber = this.modifiedLineNumber;
const modifiedEndLineNumberEx = this.modifiedLineNumber + this.lineCount;
if (hiddenModified.ranges.length === 0) {
this.showAll(tx);
result.push(this);
} else {
let i = 0;
for (const r of hiddenModified.ranges) {
const isLast = i === hiddenModified.ranges.length - 1;
i++;
const length = (isLast ? modifiedEndLineNumberEx : r.endLineNumberExclusive) - modifiedStartLineNumber;
const newR = new _UnchangedRegion(originalStartLineNumber, modifiedStartLineNumber, length, 0, 0);
newR.setHiddenModifiedRange(r, tx);
result.push(newR);
originalStartLineNumber = newR.originalUnchangedRange.endLineNumberExclusive;
modifiedStartLineNumber = newR.modifiedUnchangedRange.endLineNumberExclusive;
}
}
return result;
}
shouldHideControls(reader) {
return this._shouldHideControls.read(reader);
}
getHiddenOriginalRange(reader) {
return LineRange.ofLength(this.originalLineNumber + this._visibleLineCountTop.read(reader), this.lineCount - this._visibleLineCountTop.read(reader) - this._visibleLineCountBottom.read(reader));
}
getHiddenModifiedRange(reader) {
return LineRange.ofLength(this.modifiedLineNumber + this._visibleLineCountTop.read(reader), this.lineCount - this._visibleLineCountTop.read(reader) - this._visibleLineCountBottom.read(reader));
}
setHiddenModifiedRange(range2, tx) {
const visibleLineCountTop = range2.startLineNumber - this.modifiedLineNumber;
const visibleLineCountBottom = this.modifiedLineNumber + this.lineCount - range2.endLineNumberExclusive;
this.setState(visibleLineCountTop, visibleLineCountBottom, tx);
}
getMaxVisibleLineCountTop() {
return this.lineCount - this._visibleLineCountBottom.get();
}
getMaxVisibleLineCountBottom() {
return this.lineCount - this._visibleLineCountTop.get();
}
showMoreAbove(count = 10, tx) {
const maxVisibleLineCountTop = this.getMaxVisibleLineCountTop();
this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get() + count, maxVisibleLineCountTop), tx);
}
showMoreBelow(count = 10, tx) {
const maxVisibleLineCountBottom = this.lineCount - this._visibleLineCountTop.get();
this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get() + count, maxVisibleLineCountBottom), tx);
}
showAll(tx) {
this._visibleLineCountBottom.set(this.lineCount - this._visibleLineCountTop.get(), tx);
}
showModifiedLine(lineNumber, preference, tx) {
const top = lineNumber + 1 - (this.modifiedLineNumber + this._visibleLineCountTop.get());
const bottom = this.modifiedLineNumber - this._visibleLineCountBottom.get() + this.lineCount - lineNumber;
if (preference === 0 && top < bottom || preference === 1) {
this._visibleLineCountTop.set(this._visibleLineCountTop.get() + top, tx);
} else {
this._visibleLineCountBottom.set(this._visibleLineCountBottom.get() + bottom, tx);
}
}
showOriginalLine(lineNumber, preference, tx) {
const top = lineNumber - this.originalLineNumber;
const bottom = this.originalLineNumber + this.lineCount - lineNumber;
if (preference === 0 && top < bottom || preference === 1) {
this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get() + bottom - top, this.getMaxVisibleLineCountTop()), tx);
} else {
this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get() + top - bottom, this.getMaxVisibleLineCountBottom()), tx);
}
}
collapseAll(tx) {
this._visibleLineCountTop.set(0, tx);
this._visibleLineCountBottom.set(0, tx);
}
setState(visibleLineCountTop, visibleLineCountBottom, tx) {
visibleLineCountTop = Math.max(Math.min(visibleLineCountTop, this.lineCount), 0);
visibleLineCountBottom = Math.max(Math.min(visibleLineCountBottom, this.lineCount - visibleLineCountTop), 0);
this._visibleLineCountTop.set(visibleLineCountTop, tx);
this._visibleLineCountBottom.set(visibleLineCountBottom, tx);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js
var InlineDiffDeletedCodeMargin;
var init_inlineDiffDeletedCodeMargin = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js"() {
init_dom();
init_actions();
init_codicons();
init_lifecycle();
init_platform();
init_themables();
init_nls();
InlineDiffDeletedCodeMargin = class extends Disposable {
get visibility() {
return this._visibility;
}
set visibility(_visibility) {
if (this._visibility !== _visibility) {
this._visibility = _visibility;
this._diffActions.style.visibility = _visibility ? "visible" : "hidden";
}
}
constructor(_getViewZoneId, _marginDomNode, _modifiedEditor, _diff, _editor, _viewLineCounts, _originalTextModel, _contextMenuService, _clipboardService) {
super();
this._getViewZoneId = _getViewZoneId;
this._marginDomNode = _marginDomNode;
this._modifiedEditor = _modifiedEditor;
this._diff = _diff;
this._editor = _editor;
this._viewLineCounts = _viewLineCounts;
this._originalTextModel = _originalTextModel;
this._contextMenuService = _contextMenuService;
this._clipboardService = _clipboardService;
this._visibility = false;
this._marginDomNode.style.zIndex = "10";
this._diffActions = document.createElement("div");
this._diffActions.className = ThemeIcon.asClassName(Codicon.lightBulb) + " lightbulb-glyph";
this._diffActions.style.position = "absolute";
const lineHeight = this._modifiedEditor.getOption(
67
/* EditorOption.lineHeight */
);
this._diffActions.style.right = "0px";
this._diffActions.style.visibility = "hidden";
this._diffActions.style.height = `${lineHeight}px`;
this._diffActions.style.lineHeight = `${lineHeight}px`;
this._marginDomNode.appendChild(this._diffActions);
let currentLineNumberOffset = 0;
const useShadowDOM = _modifiedEditor.getOption(
127
/* EditorOption.useShadowDOM */
) && !isIOS;
const showContextMenu = (x, y) => {
var _a10;
this._contextMenuService.showContextMenu({
domForShadowRoot: useShadowDOM ? (_a10 = _modifiedEditor.getDomNode()) !== null && _a10 !== void 0 ? _a10 : void 0 : void 0,
getAnchor: () => ({ x, y }),
getActions: () => {
const actions = [];
const isDeletion = _diff.modified.isEmpty;
actions.push(new Action("diff.clipboard.copyDeletedContent", isDeletion ? _diff.original.length > 1 ? localize("diff.clipboard.copyDeletedLinesContent.label", "Copy deleted lines") : localize("diff.clipboard.copyDeletedLinesContent.single.label", "Copy deleted line") : _diff.original.length > 1 ? localize("diff.clipboard.copyChangedLinesContent.label", "Copy changed lines") : localize("diff.clipboard.copyChangedLinesContent.single.label", "Copy changed line"), void 0, true, () => __async(this, null, function* () {
const originalText = this._originalTextModel.getValueInRange(_diff.original.toExclusiveRange());
yield this._clipboardService.writeText(originalText);
})));
if (_diff.original.length > 1) {
actions.push(new Action("diff.clipboard.copyDeletedLineContent", isDeletion ? localize("diff.clipboard.copyDeletedLineContent.label", "Copy deleted line ({0})", _diff.original.startLineNumber + currentLineNumberOffset) : localize("diff.clipboard.copyChangedLineContent.label", "Copy changed line ({0})", _diff.original.startLineNumber + currentLineNumberOffset), void 0, true, () => __async(this, null, function* () {
let lineContent = this._originalTextModel.getLineContent(_diff.original.startLineNumber + currentLineNumberOffset);
if (lineContent === "") {
const eof = this._originalTextModel.getEndOfLineSequence();
lineContent = eof === 0 ? "\n" : "\r\n";
}
yield this._clipboardService.writeText(lineContent);
})));
}
const readOnly = _modifiedEditor.getOption(
91
/* EditorOption.readOnly */
);
if (!readOnly) {
actions.push(new Action("diff.inline.revertChange", localize("diff.inline.revertChange.label", "Revert this change"), void 0, true, () => __async(this, null, function* () {
this._editor.revert(this._diff);
})));
}
return actions;
},
autoSelectFirstItem: true
});
};
this._register(addStandardDisposableListener(this._diffActions, "mousedown", (e) => {
if (!e.leftButton) {
return;
}
const { top, height } = getDomNodePagePosition(this._diffActions);
const pad = Math.floor(lineHeight / 3);
e.preventDefault();
showContextMenu(e.posx, top + height + pad);
}));
this._register(_modifiedEditor.onMouseMove((e) => {
if ((e.target.type === 8 || e.target.type === 5) && e.target.detail.viewZoneId === this._getViewZoneId()) {
currentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight);
this.visibility = true;
} else {
this.visibility = false;
}
}));
this._register(_modifiedEditor.onMouseDown((e) => {
if (!e.event.leftButton) {
return;
}
if (e.target.type === 8 || e.target.type === 5) {
const viewZoneId = e.target.detail.viewZoneId;
if (viewZoneId === this._getViewZoneId()) {
e.event.preventDefault();
currentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight);
showContextMenu(e.event.posx, e.event.posy + lineHeight);
}
}
}));
}
_updateLightBulbPosition(marginDomNode, y, lineHeight) {
const { top } = getDomNodePagePosition(marginDomNode);
const offset = y - top;
const lineNumberOffset = Math.floor(offset / lineHeight);
const newTop = lineNumberOffset * lineHeight;
this._diffActions.style.top = `${newTop}px`;
if (this._viewLineCounts) {
let acc = 0;
for (let i = 0; i < this._viewLineCounts.length; i++) {
acc += this._viewLineCounts[i];
if (lineNumberOffset < acc) {
return i;
}
}
}
return lineNumberOffset;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js
function renderLines(source, options2, decorations, domNode) {
applyFontInfo(domNode, options2.fontInfo);
const hasCharChanges = decorations.length > 0;
const sb = new StringBuilder(1e4);
let maxCharsPerLine = 0;
let renderedLineCount = 0;
const viewLineCounts = [];
for (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {
const lineNumber = lineIndex + 1;
const lineTokens = source.lineTokens[lineIndex];
const lineBreakData = source.lineBreakData[lineIndex];
const actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, Number.MAX_SAFE_INTEGER);
if (lineBreakData) {
let lastBreakOffset = 0;
for (const breakOffset of lineBreakData.breakOffsets) {
const viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);
maxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(renderedLineCount, viewLineTokens, LineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset), hasCharChanges, source.mightContainNonBasicASCII, source.mightContainRTL, options2, sb));
renderedLineCount++;
lastBreakOffset = breakOffset;
}
viewLineCounts.push(lineBreakData.breakOffsets.length);
} else {
viewLineCounts.push(1);
maxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(renderedLineCount, lineTokens, actualDecorations, hasCharChanges, source.mightContainNonBasicASCII, source.mightContainRTL, options2, sb));
renderedLineCount++;
}
}
maxCharsPerLine += options2.scrollBeyondLastColumn;
const html2 = sb.build();
const trustedhtml = ttPolicy4 ? ttPolicy4.createHTML(html2) : html2;
domNode.innerHTML = trustedhtml;
const minWidthInPx = maxCharsPerLine * options2.typicalHalfwidthCharacterWidth;
return {
heightInLines: renderedLineCount,
minWidthInPx,
viewLineCounts
};
}
function renderOriginalLine(viewLineIdx, lineTokens, decorations, hasCharChanges, mightContainNonBasicASCII, mightContainRTL, options2, sb) {
sb.appendString('');
const lineContent = lineTokens.getLineContent();
const isBasicASCII2 = ViewLineRenderingData.isBasicASCII(lineContent, mightContainNonBasicASCII);
const containsRTL2 = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII2, mightContainRTL);
const output = renderViewLine(new RenderLineInput(
options2.fontInfo.isMonospace && !options2.disableMonospaceOptimizations,
options2.fontInfo.canUseHalfwidthRightwardsArrow,
lineContent,
false,
isBasicASCII2,
containsRTL2,
0,
lineTokens,
decorations,
options2.tabSize,
0,
options2.fontInfo.spaceWidth,
options2.fontInfo.middotWidth,
options2.fontInfo.wsmiddotWidth,
options2.stopRenderingLineAfter,
options2.renderWhitespace,
options2.renderControlCharacters,
options2.fontLigatures !== EditorFontLigatures.OFF,
null
// Send no selections, original line cannot be selected
), sb);
sb.appendString("
");
return output.characterMapping.getHorizontalOffset(output.characterMapping.length);
}
var ttPolicy4, LineSource, RenderOptions;
var init_renderLines = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js"() {
init_trustedTypes();
init_domFontInfo();
init_editorOptions();
init_stringBuilder();
init_lineDecorations();
init_viewLineRenderer();
init_viewModel();
ttPolicy4 = createTrustedTypesPolicy("diffEditorWidget", { createHTML: (value) => value });
LineSource = class {
constructor(lineTokens, lineBreakData, mightContainNonBasicASCII, mightContainRTL) {
this.lineTokens = lineTokens;
this.lineBreakData = lineBreakData;
this.mightContainNonBasicASCII = mightContainNonBasicASCII;
this.mightContainRTL = mightContainRTL;
}
};
RenderOptions = class _RenderOptions {
static fromEditor(editor2) {
var _a10;
const modifiedEditorOptions = editor2.getOptions();
const fontInfo = modifiedEditorOptions.get(
50
/* EditorOption.fontInfo */
);
const layoutInfo = modifiedEditorOptions.get(
145
/* EditorOption.layoutInfo */
);
return new _RenderOptions(((_a10 = editor2.getModel()) === null || _a10 === void 0 ? void 0 : _a10.getOptions().tabSize) || 0, fontInfo, modifiedEditorOptions.get(
33
/* EditorOption.disableMonospaceOptimizations */
), fontInfo.typicalHalfwidthCharacterWidth, modifiedEditorOptions.get(
104
/* EditorOption.scrollBeyondLastColumn */
), modifiedEditorOptions.get(
67
/* EditorOption.lineHeight */
), layoutInfo.decorationsWidth, modifiedEditorOptions.get(
117
/* EditorOption.stopRenderingLineAfter */
), modifiedEditorOptions.get(
99
/* EditorOption.renderWhitespace */
), modifiedEditorOptions.get(
94
/* EditorOption.renderControlCharacters */
), modifiedEditorOptions.get(
51
/* EditorOption.fontLigatures */
));
}
constructor(tabSize, fontInfo, disableMonospaceOptimizations, typicalHalfwidthCharacterWidth, scrollBeyondLastColumn, lineHeight, lineDecorationsWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures) {
this.tabSize = tabSize;
this.fontInfo = fontInfo;
this.disableMonospaceOptimizations = disableMonospaceOptimizations;
this.typicalHalfwidthCharacterWidth = typicalHalfwidthCharacterWidth;
this.scrollBeyondLastColumn = scrollBeyondLastColumn;
this.lineHeight = lineHeight;
this.lineDecorationsWidth = lineDecorationsWidth;
this.stopRenderingLineAfter = stopRenderingLineAfter;
this.renderWhitespace = renderWhitespace;
this.renderControlCharacters = renderControlCharacters;
this.fontLigatures = fontLigatures;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js
function computeRangeAlignment(originalEditor, modifiedEditor, diffs, originalEditorAlignmentViewZones, modifiedEditorAlignmentViewZones, innerHunkAlignment) {
const originalLineHeightOverrides = new ArrayQueue(getAdditionalLineHeights(originalEditor, originalEditorAlignmentViewZones));
const modifiedLineHeightOverrides = new ArrayQueue(getAdditionalLineHeights(modifiedEditor, modifiedEditorAlignmentViewZones));
const origLineHeight = originalEditor.getOption(
67
/* EditorOption.lineHeight */
);
const modLineHeight = modifiedEditor.getOption(
67
/* EditorOption.lineHeight */
);
const result = [];
let lastOriginalLineNumber = 0;
let lastModifiedLineNumber = 0;
function handleAlignmentsOutsideOfDiffs(untilOriginalLineNumberExclusive, untilModifiedLineNumberExclusive) {
while (true) {
let origNext = originalLineHeightOverrides.peek();
let modNext = modifiedLineHeightOverrides.peek();
if (origNext && origNext.lineNumber >= untilOriginalLineNumberExclusive) {
origNext = void 0;
}
if (modNext && modNext.lineNumber >= untilModifiedLineNumberExclusive) {
modNext = void 0;
}
if (!origNext && !modNext) {
break;
}
const distOrig = origNext ? origNext.lineNumber - lastOriginalLineNumber : Number.MAX_VALUE;
const distNext = modNext ? modNext.lineNumber - lastModifiedLineNumber : Number.MAX_VALUE;
if (distOrig < distNext) {
originalLineHeightOverrides.dequeue();
modNext = {
lineNumber: origNext.lineNumber - lastOriginalLineNumber + lastModifiedLineNumber,
heightInPx: 0
};
} else if (distOrig > distNext) {
modifiedLineHeightOverrides.dequeue();
origNext = {
lineNumber: modNext.lineNumber - lastModifiedLineNumber + lastOriginalLineNumber,
heightInPx: 0
};
} else {
originalLineHeightOverrides.dequeue();
modifiedLineHeightOverrides.dequeue();
}
result.push({
originalRange: LineRange.ofLength(origNext.lineNumber, 1),
modifiedRange: LineRange.ofLength(modNext.lineNumber, 1),
originalHeightInPx: origLineHeight + origNext.heightInPx,
modifiedHeightInPx: modLineHeight + modNext.heightInPx,
diff: void 0
});
}
}
for (const m of diffs) {
let emitAlignment = function(origLineNumberExclusive, modLineNumberExclusive) {
var _a10, _b4, _c2, _d2;
if (origLineNumberExclusive < lastOrigLineNumber || modLineNumberExclusive < lastModLineNumber) {
return;
}
if (first2) {
first2 = false;
} else if (origLineNumberExclusive === lastOrigLineNumber || modLineNumberExclusive === lastModLineNumber) {
return;
}
const originalRange = new LineRange(lastOrigLineNumber, origLineNumberExclusive);
const modifiedRange = new LineRange(lastModLineNumber, modLineNumberExclusive);
if (originalRange.isEmpty && modifiedRange.isEmpty) {
return;
}
const originalAdditionalHeight = (_b4 = (_a10 = originalLineHeightOverrides.takeWhile((v) => v.lineNumber < origLineNumberExclusive)) === null || _a10 === void 0 ? void 0 : _a10.reduce((p, c2) => p + c2.heightInPx, 0)) !== null && _b4 !== void 0 ? _b4 : 0;
const modifiedAdditionalHeight = (_d2 = (_c2 = modifiedLineHeightOverrides.takeWhile((v) => v.lineNumber < modLineNumberExclusive)) === null || _c2 === void 0 ? void 0 : _c2.reduce((p, c2) => p + c2.heightInPx, 0)) !== null && _d2 !== void 0 ? _d2 : 0;
result.push({
originalRange,
modifiedRange,
originalHeightInPx: originalRange.length * origLineHeight + originalAdditionalHeight,
modifiedHeightInPx: modifiedRange.length * modLineHeight + modifiedAdditionalHeight,
diff: m.lineRangeMapping
});
lastOrigLineNumber = origLineNumberExclusive;
lastModLineNumber = modLineNumberExclusive;
};
const c = m.lineRangeMapping;
handleAlignmentsOutsideOfDiffs(c.original.startLineNumber, c.modified.startLineNumber);
let first2 = true;
let lastModLineNumber = c.modified.startLineNumber;
let lastOrigLineNumber = c.original.startLineNumber;
if (innerHunkAlignment) {
for (const i of c.innerChanges || []) {
if (i.originalRange.startColumn > 1 && i.modifiedRange.startColumn > 1) {
emitAlignment(i.originalRange.startLineNumber, i.modifiedRange.startLineNumber);
}
const originalModel = originalEditor.getModel();
const maxColumn = i.originalRange.endLineNumber <= originalModel.getLineCount() ? originalModel.getLineMaxColumn(i.originalRange.endLineNumber) : Number.MAX_SAFE_INTEGER;
if (i.originalRange.endColumn < maxColumn) {
emitAlignment(i.originalRange.endLineNumber, i.modifiedRange.endLineNumber);
}
}
}
emitAlignment(c.original.endLineNumberExclusive, c.modified.endLineNumberExclusive);
lastOriginalLineNumber = c.original.endLineNumberExclusive;
lastModifiedLineNumber = c.modified.endLineNumberExclusive;
}
handleAlignmentsOutsideOfDiffs(Number.MAX_VALUE, Number.MAX_VALUE);
return result;
}
function getAdditionalLineHeights(editor2, viewZonesToIgnore) {
const viewZoneHeights = [];
const wrappingZoneHeights = [];
const hasWrapping = editor2.getOption(
146
/* EditorOption.wrappingInfo */
).wrappingColumn !== -1;
const coordinatesConverter = editor2._getViewModel().coordinatesConverter;
const editorLineHeight = editor2.getOption(
67
/* EditorOption.lineHeight */
);
if (hasWrapping) {
for (let i = 1; i <= editor2.getModel().getLineCount(); i++) {
const lineCount = coordinatesConverter.getModelLineViewLineCount(i);
if (lineCount > 1) {
wrappingZoneHeights.push({ lineNumber: i, heightInPx: editorLineHeight * (lineCount - 1) });
}
}
}
for (const w of editor2.getWhitespaces()) {
if (viewZonesToIgnore.has(w.id)) {
continue;
}
const modelLineNumber = w.afterLineNumber === 0 ? 0 : coordinatesConverter.convertViewPositionToModelPosition(new Position(w.afterLineNumber, 1)).lineNumber;
viewZoneHeights.push({ lineNumber: modelLineNumber, heightInPx: w.height });
}
const result = joinCombine(viewZoneHeights, wrappingZoneHeights, (v) => v.lineNumber, (v1, v2) => ({ lineNumber: v1.lineNumber, heightInPx: v1.heightInPx + v2.heightInPx }));
return result;
}
var __decorate51, __param45, DiffEditorViewZones;
var init_diffEditorViewZones = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js"() {
init_dom();
init_arrays();
init_async();
init_codicons();
init_lifecycle();
init_observable();
init_themables();
init_types();
init_domFontInfo();
init_registrations_contribution();
init_diffEditorViewModel();
init_inlineDiffDeletedCodeMargin();
init_renderLines();
init_utils4();
init_lineRange();
init_position();
init_viewModel();
init_clipboardService2();
init_contextView();
__decorate51 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param45 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DiffEditorViewZones = class DiffEditorViewZones2 extends Disposable {
constructor(_targetWindow, _editors, _diffModel, _options, _diffEditorWidget, _canIgnoreViewZoneUpdateEvent, _origViewZonesToIgnore, _modViewZonesToIgnore, _clipboardService, _contextMenuService) {
super();
this._targetWindow = _targetWindow;
this._editors = _editors;
this._diffModel = _diffModel;
this._options = _options;
this._diffEditorWidget = _diffEditorWidget;
this._canIgnoreViewZoneUpdateEvent = _canIgnoreViewZoneUpdateEvent;
this._origViewZonesToIgnore = _origViewZonesToIgnore;
this._modViewZonesToIgnore = _modViewZonesToIgnore;
this._clipboardService = _clipboardService;
this._contextMenuService = _contextMenuService;
this._originalTopPadding = observableValue(this, 0);
this._originalScrollOffset = observableValue(this, 0);
this._originalScrollOffsetAnimated = animatedObservable(this._targetWindow, this._originalScrollOffset, this._store);
this._modifiedTopPadding = observableValue(this, 0);
this._modifiedScrollOffset = observableValue(this, 0);
this._modifiedScrollOffsetAnimated = animatedObservable(this._targetWindow, this._modifiedScrollOffset, this._store);
const state = observableValue("invalidateAlignmentsState", 0);
const updateImmediately = this._register(new RunOnceScheduler(() => {
state.set(state.get() + 1, void 0);
}, 0));
this._register(this._editors.original.onDidChangeViewZones((_args) => {
if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
}
}));
this._register(this._editors.modified.onDidChangeViewZones((_args) => {
if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
}
}));
this._register(this._editors.original.onDidChangeConfiguration((args) => {
if (args.hasChanged(
146
/* EditorOption.wrappingInfo */
) || args.hasChanged(
67
/* EditorOption.lineHeight */
)) {
updateImmediately.schedule();
}
}));
this._register(this._editors.modified.onDidChangeConfiguration((args) => {
if (args.hasChanged(
146
/* EditorOption.wrappingInfo */
) || args.hasChanged(
67
/* EditorOption.lineHeight */
)) {
updateImmediately.schedule();
}
}));
const originalModelTokenizationCompleted = this._diffModel.map((m) => m ? observableFromEvent(
m.model.original.onDidChangeTokens,
() => m.model.original.tokenization.backgroundTokenizationState === 2
/* BackgroundTokenizationState.Completed */
) : void 0).map((m, reader) => m === null || m === void 0 ? void 0 : m.read(reader));
const alignments = derived((reader) => {
const diffModel = this._diffModel.read(reader);
const diff = diffModel === null || diffModel === void 0 ? void 0 : diffModel.diff.read(reader);
if (!diffModel || !diff) {
return null;
}
state.read(reader);
const renderSideBySide = this._options.renderSideBySide.read(reader);
const innerHunkAlignment = renderSideBySide;
return computeRangeAlignment(this._editors.original, this._editors.modified, diff.mappings, this._origViewZonesToIgnore, this._modViewZonesToIgnore, innerHunkAlignment);
});
const alignmentsSyncedMovedText = derived((reader) => {
var _a10;
const syncedMovedText = (_a10 = this._diffModel.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.movedTextToCompare.read(reader);
if (!syncedMovedText) {
return null;
}
state.read(reader);
const mappings = syncedMovedText.changes.map((c) => new DiffMapping(c));
return computeRangeAlignment(this._editors.original, this._editors.modified, mappings, this._origViewZonesToIgnore, this._modViewZonesToIgnore, true);
});
function createFakeLinesDiv() {
const r = document.createElement("div");
r.className = "diagonal-fill";
return r;
}
const alignmentViewZonesDisposables = this._register(new DisposableStore());
this.viewZones = derivedWithStore(this, (reader, store) => {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2;
alignmentViewZonesDisposables.clear();
const alignmentsVal = alignments.read(reader) || [];
const origViewZones = [];
const modViewZones = [];
const modifiedTopPaddingVal = this._modifiedTopPadding.read(reader);
if (modifiedTopPaddingVal > 0) {
modViewZones.push({
afterLineNumber: 0,
domNode: document.createElement("div"),
heightInPx: modifiedTopPaddingVal,
showInHiddenAreas: true,
suppressMouseDown: true
});
}
const originalTopPaddingVal = this._originalTopPadding.read(reader);
if (originalTopPaddingVal > 0) {
origViewZones.push({
afterLineNumber: 0,
domNode: document.createElement("div"),
heightInPx: originalTopPaddingVal,
showInHiddenAreas: true,
suppressMouseDown: true
});
}
const renderSideBySide = this._options.renderSideBySide.read(reader);
const deletedCodeLineBreaksComputer = !renderSideBySide ? (_a10 = this._editors.modified._getViewModel()) === null || _a10 === void 0 ? void 0 : _a10.createLineBreaksComputer() : void 0;
if (deletedCodeLineBreaksComputer) {
const originalModel = this._editors.original.getModel();
for (const a3 of alignmentsVal) {
if (a3.diff) {
for (let i = a3.originalRange.startLineNumber; i < a3.originalRange.endLineNumberExclusive; i++) {
if (i > originalModel.getLineCount()) {
return { orig: origViewZones, mod: modViewZones };
}
deletedCodeLineBreaksComputer === null || deletedCodeLineBreaksComputer === void 0 ? void 0 : deletedCodeLineBreaksComputer.addRequest(originalModel.getLineContent(i), null, null);
}
}
}
}
const lineBreakData = (_b4 = deletedCodeLineBreaksComputer === null || deletedCodeLineBreaksComputer === void 0 ? void 0 : deletedCodeLineBreaksComputer.finalize()) !== null && _b4 !== void 0 ? _b4 : [];
let lineBreakDataIdx = 0;
const modLineHeight = this._editors.modified.getOption(
67
/* EditorOption.lineHeight */
);
const syncedMovedText = (_c2 = this._diffModel.read(reader)) === null || _c2 === void 0 ? void 0 : _c2.movedTextToCompare.read(reader);
const mightContainNonBasicASCII = (_e2 = (_d2 = this._editors.original.getModel()) === null || _d2 === void 0 ? void 0 : _d2.mightContainNonBasicASCII()) !== null && _e2 !== void 0 ? _e2 : false;
const mightContainRTL = (_g2 = (_f3 = this._editors.original.getModel()) === null || _f3 === void 0 ? void 0 : _f3.mightContainRTL()) !== null && _g2 !== void 0 ? _g2 : false;
const renderOptions = RenderOptions.fromEditor(this._editors.modified);
for (const a3 of alignmentsVal) {
if (a3.diff && !renderSideBySide) {
if (!a3.originalRange.isEmpty) {
originalModelTokenizationCompleted.read(reader);
const deletedCodeDomNode = document.createElement("div");
deletedCodeDomNode.classList.add("view-lines", "line-delete", "monaco-mouse-cursor-text");
const originalModel = this._editors.original.getModel();
if (a3.originalRange.endLineNumberExclusive - 1 > originalModel.getLineCount()) {
return { orig: origViewZones, mod: modViewZones };
}
const source = new LineSource(a3.originalRange.mapToLineArray((l) => originalModel.tokenization.getLineTokens(l)), a3.originalRange.mapToLineArray((_) => lineBreakData[lineBreakDataIdx++]), mightContainNonBasicASCII, mightContainRTL);
const decorations = [];
for (const i of a3.diff.innerChanges || []) {
decorations.push(new InlineDecoration(
i.originalRange.delta(-(a3.diff.original.startLineNumber - 1)),
diffDeleteDecoration.className,
0
/* InlineDecorationType.Regular */
));
}
const result = renderLines(source, renderOptions, decorations, deletedCodeDomNode);
const marginDomNode2 = document.createElement("div");
marginDomNode2.className = "inline-deleted-margin-view-zone";
applyFontInfo(marginDomNode2, renderOptions.fontInfo);
if (this._options.renderIndicators.read(reader)) {
for (let i = 0; i < result.heightInLines; i++) {
const marginElement = document.createElement("div");
marginElement.className = `delete-sign ${ThemeIcon.asClassName(diffRemoveIcon)}`;
marginElement.setAttribute("style", `position:absolute;top:${i * modLineHeight}px;width:${renderOptions.lineDecorationsWidth}px;height:${modLineHeight}px;right:0;`);
marginDomNode2.appendChild(marginElement);
}
}
let zoneId = void 0;
alignmentViewZonesDisposables.add(new InlineDiffDeletedCodeMargin(() => assertIsDefined(zoneId), marginDomNode2, this._editors.modified, a3.diff, this._diffEditorWidget, result.viewLineCounts, this._editors.original.getModel(), this._contextMenuService, this._clipboardService));
for (let i = 0; i < result.viewLineCounts.length; i++) {
const count = result.viewLineCounts[i];
if (count > 1) {
origViewZones.push({
afterLineNumber: a3.originalRange.startLineNumber + i,
domNode: createFakeLinesDiv(),
heightInPx: (count - 1) * modLineHeight,
showInHiddenAreas: true,
suppressMouseDown: true
});
}
}
modViewZones.push({
afterLineNumber: a3.modifiedRange.startLineNumber - 1,
domNode: deletedCodeDomNode,
heightInPx: result.heightInLines * modLineHeight,
minWidthInPx: result.minWidthInPx,
marginDomNode: marginDomNode2,
setZoneId(id) {
zoneId = id;
},
showInHiddenAreas: true,
suppressMouseDown: true
});
}
const marginDomNode = document.createElement("div");
marginDomNode.className = "gutter-delete";
origViewZones.push({
afterLineNumber: a3.originalRange.endLineNumberExclusive - 1,
domNode: createFakeLinesDiv(),
heightInPx: a3.modifiedHeightInPx,
marginDomNode,
showInHiddenAreas: true,
suppressMouseDown: true
});
} else {
const delta = a3.modifiedHeightInPx - a3.originalHeightInPx;
if (delta > 0) {
if (syncedMovedText === null || syncedMovedText === void 0 ? void 0 : syncedMovedText.lineRangeMapping.original.delta(-1).deltaLength(2).contains(a3.originalRange.endLineNumberExclusive - 1)) {
continue;
}
origViewZones.push({
afterLineNumber: a3.originalRange.endLineNumberExclusive - 1,
domNode: createFakeLinesDiv(),
heightInPx: delta,
showInHiddenAreas: true,
suppressMouseDown: true
});
} else {
let createViewZoneMarginArrow = function() {
const arrow = document.createElement("div");
arrow.className = "arrow-revert-change " + ThemeIcon.asClassName(Codicon.arrowRight);
store.add(addDisposableListener(arrow, "mousedown", (e) => e.stopPropagation()));
store.add(addDisposableListener(arrow, "click", (e) => {
e.stopPropagation();
_diffEditorWidget.revert(a3.diff);
}));
return $("div", {}, arrow);
};
if (syncedMovedText === null || syncedMovedText === void 0 ? void 0 : syncedMovedText.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(a3.modifiedRange.endLineNumberExclusive - 1)) {
continue;
}
let marginDomNode = void 0;
if (a3.diff && a3.diff.modified.isEmpty && this._options.shouldRenderOldRevertArrows.read(reader)) {
marginDomNode = createViewZoneMarginArrow();
}
modViewZones.push({
afterLineNumber: a3.modifiedRange.endLineNumberExclusive - 1,
domNode: createFakeLinesDiv(),
heightInPx: -delta,
marginDomNode,
showInHiddenAreas: true,
suppressMouseDown: true
});
}
}
}
for (const a3 of (_h2 = alignmentsSyncedMovedText.read(reader)) !== null && _h2 !== void 0 ? _h2 : []) {
if (!(syncedMovedText === null || syncedMovedText === void 0 ? void 0 : syncedMovedText.lineRangeMapping.original.intersect(a3.originalRange)) || !(syncedMovedText === null || syncedMovedText === void 0 ? void 0 : syncedMovedText.lineRangeMapping.modified.intersect(a3.modifiedRange))) {
continue;
}
const delta = a3.modifiedHeightInPx - a3.originalHeightInPx;
if (delta > 0) {
origViewZones.push({
afterLineNumber: a3.originalRange.endLineNumberExclusive - 1,
domNode: createFakeLinesDiv(),
heightInPx: delta,
showInHiddenAreas: true,
suppressMouseDown: true
});
} else {
modViewZones.push({
afterLineNumber: a3.modifiedRange.endLineNumberExclusive - 1,
domNode: createFakeLinesDiv(),
heightInPx: -delta,
showInHiddenAreas: true,
suppressMouseDown: true
});
}
}
return { orig: origViewZones, mod: modViewZones };
});
let ignoreChange = false;
this._register(this._editors.original.onDidScrollChange((e) => {
if (e.scrollLeftChanged && !ignoreChange) {
ignoreChange = true;
this._editors.modified.setScrollLeft(e.scrollLeft);
ignoreChange = false;
}
}));
this._register(this._editors.modified.onDidScrollChange((e) => {
if (e.scrollLeftChanged && !ignoreChange) {
ignoreChange = true;
this._editors.original.setScrollLeft(e.scrollLeft);
ignoreChange = false;
}
}));
this._originalScrollTop = observableFromEvent(this._editors.original.onDidScrollChange, () => (
/** @description original.getScrollTop */
this._editors.original.getScrollTop()
));
this._modifiedScrollTop = observableFromEvent(this._editors.modified.onDidScrollChange, () => (
/** @description modified.getScrollTop */
this._editors.modified.getScrollTop()
));
this._register(autorun((reader) => {
const newScrollTopModified = this._originalScrollTop.read(reader) - (this._originalScrollOffsetAnimated.get() - this._modifiedScrollOffsetAnimated.read(reader)) - (this._originalTopPadding.get() - this._modifiedTopPadding.read(reader));
if (newScrollTopModified !== this._editors.modified.getScrollTop()) {
this._editors.modified.setScrollTop(
newScrollTopModified,
1
/* ScrollType.Immediate */
);
}
}));
this._register(autorun((reader) => {
const newScrollTopOriginal = this._modifiedScrollTop.read(reader) - (this._modifiedScrollOffsetAnimated.get() - this._originalScrollOffsetAnimated.read(reader)) - (this._modifiedTopPadding.get() - this._originalTopPadding.read(reader));
if (newScrollTopOriginal !== this._editors.original.getScrollTop()) {
this._editors.original.setScrollTop(
newScrollTopOriginal,
1
/* ScrollType.Immediate */
);
}
}));
this._register(autorun((reader) => {
var _a10;
const m = (_a10 = this._diffModel.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.movedTextToCompare.read(reader);
let deltaOrigToMod = 0;
if (m) {
const trueTopOriginal = this._editors.original.getTopForLineNumber(m.lineRangeMapping.original.startLineNumber, true) - this._originalTopPadding.get();
const trueTopModified = this._editors.modified.getTopForLineNumber(m.lineRangeMapping.modified.startLineNumber, true) - this._modifiedTopPadding.get();
deltaOrigToMod = trueTopModified - trueTopOriginal;
}
if (deltaOrigToMod > 0) {
this._modifiedTopPadding.set(0, void 0);
this._originalTopPadding.set(deltaOrigToMod, void 0);
} else if (deltaOrigToMod < 0) {
this._modifiedTopPadding.set(-deltaOrigToMod, void 0);
this._originalTopPadding.set(0, void 0);
} else {
setTimeout(() => {
this._modifiedTopPadding.set(0, void 0);
this._originalTopPadding.set(0, void 0);
}, 400);
}
if (this._editors.modified.hasTextFocus()) {
this._originalScrollOffset.set(this._modifiedScrollOffset.get() - deltaOrigToMod, void 0, true);
} else {
this._modifiedScrollOffset.set(this._originalScrollOffset.get() + deltaOrigToMod, void 0, true);
}
}));
}
};
DiffEditorViewZones = __decorate51([
__param45(8, IClipboardService),
__param45(9, IContextMenuService)
], DiffEditorViewZones);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils/editorGutter.js
var EditorGutter, ManagedGutterItemView;
var init_editorGutter = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/utils/editorGutter.js"() {
init_dom();
init_lifecycle();
init_observable();
init_lineRange();
init_offsetRange();
EditorGutter = class extends Disposable {
constructor(_editor, _domNode, itemProvider) {
super();
this._editor = _editor;
this._domNode = _domNode;
this.itemProvider = itemProvider;
this.scrollTop = observableFromEvent(this._editor.onDidScrollChange, (e) => (
/** @description editor.onDidScrollChange */
this._editor.getScrollTop()
));
this.isScrollTopZero = this.scrollTop.map((scrollTop) => (
/** @description isScrollTopZero */
scrollTop === 0
));
this.modelAttached = observableFromEvent(this._editor.onDidChangeModel, (e) => (
/** @description editor.onDidChangeModel */
this._editor.hasModel()
));
this.editorOnDidChangeViewZones = observableSignalFromEvent("onDidChangeViewZones", this._editor.onDidChangeViewZones);
this.editorOnDidContentSizeChange = observableSignalFromEvent("onDidContentSizeChange", this._editor.onDidContentSizeChange);
this.domNodeSizeChanged = observableSignal("domNodeSizeChanged");
this.views = /* @__PURE__ */ new Map();
this._domNode.className = "gutter monaco-editor";
const scrollDecoration = this._domNode.appendChild(h("div.scroll-decoration", { role: "presentation", ariaHidden: "true", style: { width: "100%" } }).root);
const o = new ResizeObserver(() => {
transaction((tx) => {
this.domNodeSizeChanged.trigger(tx);
});
});
o.observe(this._domNode);
this._register(toDisposable(() => o.disconnect()));
this._register(autorun((reader) => {
scrollDecoration.className = this.isScrollTopZero.read(reader) ? "" : "scroll-decoration";
}));
this._register(autorun((reader) => (
/** @description EditorGutter.Render */
this.render(reader)
)));
}
dispose() {
super.dispose();
reset(this._domNode);
}
render(reader) {
if (!this.modelAttached.read(reader)) {
return;
}
this.domNodeSizeChanged.read(reader);
this.editorOnDidChangeViewZones.read(reader);
this.editorOnDidContentSizeChange.read(reader);
const scrollTop = this.scrollTop.read(reader);
const visibleRanges = this._editor.getVisibleRanges();
const unusedIds = new Set(this.views.keys());
const viewRange = OffsetRange.ofStartAndLength(0, this._domNode.clientHeight);
if (!viewRange.isEmpty) {
for (const visibleRange of visibleRanges) {
const visibleRange2 = new LineRange(visibleRange.startLineNumber, visibleRange.endLineNumber + 1);
const gutterItems = this.itemProvider.getIntersectingGutterItems(visibleRange2, reader);
transaction((tx) => {
for (const gutterItem of gutterItems) {
if (!gutterItem.range.intersect(visibleRange2)) {
continue;
}
unusedIds.delete(gutterItem.id);
let view = this.views.get(gutterItem.id);
if (!view) {
const viewDomNode = document.createElement("div");
this._domNode.appendChild(viewDomNode);
const gutterItemObs = observableValue("item", gutterItem);
const itemView = this.itemProvider.createView(gutterItemObs, viewDomNode);
view = new ManagedGutterItemView(gutterItemObs, itemView, viewDomNode);
this.views.set(gutterItem.id, view);
} else {
view.item.set(gutterItem, tx);
}
const top = gutterItem.range.startLineNumber <= this._editor.getModel().getLineCount() ? this._editor.getTopForLineNumber(gutterItem.range.startLineNumber, true) - scrollTop : this._editor.getBottomForLineNumber(gutterItem.range.startLineNumber - 1, false) - scrollTop;
const bottom = gutterItem.range.isEmpty ? top : this._editor.getBottomForLineNumber(gutterItem.range.endLineNumberExclusive - 1, true) - scrollTop;
const height = bottom - top;
view.domNode.style.top = `${top}px`;
view.domNode.style.height = `${height}px`;
view.gutterItemView.layout(OffsetRange.ofStartAndLength(top, height), viewRange);
}
});
}
}
for (const id of unusedIds) {
const view = this.views.get(id);
view.gutterItemView.dispose();
this._domNode.removeChild(view.domNode);
this.views.delete(id);
}
}
};
ManagedGutterItemView = class {
constructor(item, gutterItemView, domNode) {
this.item = item;
this.gutterItemView = gutterItemView;
this.domNode = domNode;
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/utils.js
var ActionRunnerWithContext;
var init_utils5 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/utils.js"() {
init_actions();
ActionRunnerWithContext = class extends ActionRunner {
constructor(_getContext) {
super();
this._getContext = _getContext;
}
runAction(action, _context) {
const ctx = this._getContext();
return super.runAction(action, ctx);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/common/model/textModelText.js
var TextModelText;
var init_textModelText = __esm({
"node_modules/monaco-editor/esm/vs/editor/common/model/textModelText.js"() {
init_textEdit();
init_textLength();
TextModelText = class extends AbstractText {
constructor(_textModel) {
super();
this._textModel = _textModel;
}
getValueOfRange(range2) {
return this._textModel.getValueInRange(range2);
}
get length() {
const lastLineNumber = this._textModel.getLineCount();
const lastLineLen = this._textModel.getLineLength(lastLineNumber);
return new TextLength(lastLineNumber - 1, lastLineLen);
}
};
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.css
var init_toolbar = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.css"() {
}
});
// node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js
var ToolBar, ToggleMenuAction;
var init_toolbar2 = __esm({
"node_modules/monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js"() {
init_actionbar2();
init_dropdownActionViewItem();
init_actions();
init_codicons();
init_themables();
init_event();
init_lifecycle();
init_toolbar();
init_nls();
init_hoverDelegateFactory();
ToolBar = class extends Disposable {
constructor(container, contextMenuProvider, options2 = {
orientation: 0
/* ActionsOrientation.HORIZONTAL */
}) {
var _a10;
super();
this.submenuActionViewItems = [];
this.hasSecondaryActions = false;
this._onDidChangeDropdownVisibility = this._register(new EventMultiplexer());
this.onDidChangeDropdownVisibility = this._onDidChangeDropdownVisibility.event;
this.disposables = this._register(new DisposableStore());
options2.hoverDelegate = (_a10 = options2.hoverDelegate) !== null && _a10 !== void 0 ? _a10 : this._register(createInstantHoverDelegate());
this.options = options2;
this.lookupKeybindings = typeof this.options.getKeyBinding === "function";
this.toggleMenuAction = this._register(new ToggleMenuAction(() => {
var _a11;
return (_a11 = this.toggleMenuActionViewItem) === null || _a11 === void 0 ? void 0 : _a11.show();
}, options2.toggleMenuTitle));
this.element = document.createElement("div");
this.element.className = "monaco-toolbar";
container.appendChild(this.element);
this.actionBar = this._register(new ActionBar(this.element, {
orientation: options2.orientation,
ariaLabel: options2.ariaLabel,
actionRunner: options2.actionRunner,
allowContextMenu: options2.allowContextMenu,
highlightToggledItems: options2.highlightToggledItems,
hoverDelegate: options2.hoverDelegate,
actionViewItemProvider: (action, viewItemOptions) => {
var _a11;
if (action.id === ToggleMenuAction.ID) {
this.toggleMenuActionViewItem = new DropdownMenuActionViewItem(action, action.menuActions, contextMenuProvider, {
actionViewItemProvider: this.options.actionViewItemProvider,
actionRunner: this.actionRunner,
keybindingProvider: this.options.getKeyBinding,
classNames: ThemeIcon.asClassNameArray((_a11 = options2.moreIcon) !== null && _a11 !== void 0 ? _a11 : Codicon.toolBarMore),
anchorAlignmentProvider: this.options.anchorAlignmentProvider,
menuAsChild: !!this.options.renderDropdownAsChildElement,
skipTelemetry: this.options.skipTelemetry,
isMenu: true,
hoverDelegate: this.options.hoverDelegate
});
this.toggleMenuActionViewItem.setActionContext(this.actionBar.context);
this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility));
return this.toggleMenuActionViewItem;
}
if (options2.actionViewItemProvider) {
const result = options2.actionViewItemProvider(action, viewItemOptions);
if (result) {
return result;
}
}
if (action instanceof SubmenuAction) {
const result = new DropdownMenuActionViewItem(action, action.actions, contextMenuProvider, {
actionViewItemProvider: this.options.actionViewItemProvider,
actionRunner: this.actionRunner,
keybindingProvider: this.options.getKeyBinding,
classNames: action.class,
anchorAlignmentProvider: this.options.anchorAlignmentProvider,
menuAsChild: !!this.options.renderDropdownAsChildElement,
skipTelemetry: this.options.skipTelemetry,
hoverDelegate: this.options.hoverDelegate
});
result.setActionContext(this.actionBar.context);
this.submenuActionViewItems.push(result);
this.disposables.add(this._onDidChangeDropdownVisibility.add(result.onDidChangeVisibility));
return result;
}
return void 0;
}
}));
}
set actionRunner(actionRunner) {
this.actionBar.actionRunner = actionRunner;
}
get actionRunner() {
return this.actionBar.actionRunner;
}
getElement() {
return this.element;
}
getItemAction(indexOrElement) {
return this.actionBar.getAction(indexOrElement);
}
setActions(primaryActions, secondaryActions) {
this.clear();
const primaryActionsToSet = primaryActions ? primaryActions.slice(0) : [];
this.hasSecondaryActions = !!(secondaryActions && secondaryActions.length > 0);
if (this.hasSecondaryActions && secondaryActions) {
this.toggleMenuAction.menuActions = secondaryActions.slice(0);
primaryActionsToSet.push(this.toggleMenuAction);
}
primaryActionsToSet.forEach((action) => {
this.actionBar.push(action, { icon: true, label: false, keybinding: this.getKeybindingLabel(action) });
});
}
getKeybindingLabel(action) {
var _a10, _b4, _c2;
const key = this.lookupKeybindings ? (_b4 = (_a10 = this.options).getKeyBinding) === null || _b4 === void 0 ? void 0 : _b4.call(_a10, action) : void 0;
return (_c2 = key === null || key === void 0 ? void 0 : key.getLabel()) !== null && _c2 !== void 0 ? _c2 : void 0;
}
clear() {
this.submenuActionViewItems = [];
this.disposables.clear();
this.actionBar.clear();
}
dispose() {
this.clear();
this.disposables.dispose();
super.dispose();
}
};
ToggleMenuAction = class _ToggleMenuAction extends Action {
constructor(toggleDropdownMenu, title) {
title = title || localize("moreActions", "More Actions...");
super(_ToggleMenuAction.ID, title, void 0, true);
this._menuActions = [];
this.toggleDropdownMenu = toggleDropdownMenu;
}
run() {
return __async(this, null, function* () {
this.toggleDropdownMenu();
});
}
get menuActions() {
return this._menuActions;
}
set menuActions(actions) {
this._menuActions = actions;
}
};
ToggleMenuAction.ID = "toolbar.toggle.more";
}
});
// node_modules/monaco-editor/esm/vs/platform/actions/browser/toolbar.js
var __decorate52, __param46, WorkbenchToolBar, MenuWorkbenchToolBar;
var init_toolbar3 = __esm({
"node_modules/monaco-editor/esm/vs/platform/actions/browser/toolbar.js"() {
init_dom();
init_mouseEvent();
init_toolbar2();
init_actions();
init_arrays();
init_collections();
init_errors();
init_event();
init_iterator();
init_lifecycle();
init_nls();
init_menuEntryActionViewItem2();
init_actions2();
init_menuService();
init_commands();
init_contextkey();
init_contextView();
init_keybinding();
init_telemetry();
__decorate52 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param46 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
WorkbenchToolBar = class WorkbenchToolBar2 extends ToolBar {
constructor(container, _options, _menuService, _contextKeyService, _contextMenuService, _keybindingService, _commandService, telemetryService) {
super(container, _contextMenuService, __spreadProps(__spreadValues({
// defaults
getKeyBinding: (action) => {
var _a10;
return (_a10 = _keybindingService.lookupKeybinding(action.id)) !== null && _a10 !== void 0 ? _a10 : void 0;
}
}, _options), {
// mandatory (overide options)
allowContextMenu: true,
skipTelemetry: typeof (_options === null || _options === void 0 ? void 0 : _options.telemetrySource) === "string"
}));
this._options = _options;
this._menuService = _menuService;
this._contextKeyService = _contextKeyService;
this._contextMenuService = _contextMenuService;
this._keybindingService = _keybindingService;
this._commandService = _commandService;
this._sessionDisposables = this._store.add(new DisposableStore());
const telemetrySource = _options === null || _options === void 0 ? void 0 : _options.telemetrySource;
if (telemetrySource) {
this._store.add(this.actionBar.onDidRun((e) => telemetryService.publicLog2("workbenchActionExecuted", { id: e.action.id, from: telemetrySource })));
}
}
setActions(_primary, _secondary = [], menuIds) {
var _a10, _b4, _c2;
this._sessionDisposables.clear();
const primary = _primary.slice();
const secondary = _secondary.slice();
const toggleActions = [];
let toggleActionsCheckedCount = 0;
const extraSecondary = [];
let someAreHidden = false;
if (((_a10 = this._options) === null || _a10 === void 0 ? void 0 : _a10.hiddenItemStrategy) !== -1) {
for (let i = 0; i < primary.length; i++) {
const action = primary[i];
if (!(action instanceof MenuItemAction) && !(action instanceof SubmenuItemAction)) {
continue;
}
if (!action.hideActions) {
continue;
}
toggleActions.push(action.hideActions.toggle);
if (action.hideActions.toggle.checked) {
toggleActionsCheckedCount++;
}
if (action.hideActions.isHidden) {
someAreHidden = true;
primary[i] = void 0;
if (((_b4 = this._options) === null || _b4 === void 0 ? void 0 : _b4.hiddenItemStrategy) !== 0) {
extraSecondary[i] = action;
}
}
}
}
if (((_c2 = this._options) === null || _c2 === void 0 ? void 0 : _c2.overflowBehavior) !== void 0) {
const exemptedIds = intersection(new Set(this._options.overflowBehavior.exempted), Iterable.map(primary, (a3) => a3 === null || a3 === void 0 ? void 0 : a3.id));
const maxItems = this._options.overflowBehavior.maxItems - exemptedIds.size;
let count = 0;
for (let i = 0; i < primary.length; i++) {
const action = primary[i];
if (!action) {
continue;
}
count++;
if (exemptedIds.has(action.id)) {
continue;
}
if (count >= maxItems) {
primary[i] = void 0;
extraSecondary[i] = action;
}
}
}
coalesceInPlace(primary);
coalesceInPlace(extraSecondary);
super.setActions(primary, Separator.join(extraSecondary, secondary));
if (toggleActions.length > 0 || primary.length > 0) {
this._sessionDisposables.add(addDisposableListener(this.getElement(), "contextmenu", (e) => {
var _a11, _b5, _c3, _d2, _e2;
const event = new StandardMouseEvent(getWindow(this.getElement()), e);
const action = this.getItemAction(event.target);
if (!action) {
return;
}
event.preventDefault();
event.stopPropagation();
const primaryActions = [];
if (action instanceof MenuItemAction && action.menuKeybinding) {
primaryActions.push(action.menuKeybinding);
} else if (!(action instanceof SubmenuItemAction || action instanceof ToggleMenuAction)) {
primaryActions.push(createConfigureKeybindingAction(action.id, void 0, this._commandService, this._keybindingService));
}
if (toggleActions.length > 0) {
let noHide = false;
if (toggleActionsCheckedCount === 1 && ((_a11 = this._options) === null || _a11 === void 0 ? void 0 : _a11.hiddenItemStrategy) === 0) {
noHide = true;
for (let i = 0; i < toggleActions.length; i++) {
if (toggleActions[i].checked) {
toggleActions[i] = toAction({
id: action.id,
label: action.label,
checked: true,
enabled: false,
run() {
}
});
break;
}
}
}
if (!noHide && (action instanceof MenuItemAction || action instanceof SubmenuItemAction)) {
if (!action.hideActions) {
return;
}
primaryActions.push(action.hideActions.hide);
} else {
primaryActions.push(toAction({
id: "label",
label: localize("hide", "Hide"),
enabled: false,
run() {
}
}));
}
}
const actions = Separator.join(primaryActions, toggleActions);
if (((_b5 = this._options) === null || _b5 === void 0 ? void 0 : _b5.resetMenu) && !menuIds) {
menuIds = [this._options.resetMenu];
}
if (someAreHidden && menuIds) {
actions.push(new Separator());
actions.push(toAction({
id: "resetThisMenu",
label: localize("resetThisMenu", "Reset Menu"),
run: () => this._menuService.resetHiddenStates(menuIds)
}));
}
if (actions.length === 0) {
return;
}
this._contextMenuService.showContextMenu({
getAnchor: () => event,
getActions: () => actions,
// add context menu actions (iff appicable)
menuId: (_c3 = this._options) === null || _c3 === void 0 ? void 0 : _c3.contextMenu,
menuActionOptions: __spreadValues({ renderShortTitle: true }, (_d2 = this._options) === null || _d2 === void 0 ? void 0 : _d2.menuOptions),
skipTelemetry: typeof ((_e2 = this._options) === null || _e2 === void 0 ? void 0 : _e2.telemetrySource) === "string",
contextKeyService: this._contextKeyService
});
}));
}
}
};
WorkbenchToolBar = __decorate52([
__param46(2, IMenuService),
__param46(3, IContextKeyService),
__param46(4, IContextMenuService),
__param46(5, IKeybindingService),
__param46(6, ICommandService),
__param46(7, ITelemetryService)
], WorkbenchToolBar);
MenuWorkbenchToolBar = class MenuWorkbenchToolBar2 extends WorkbenchToolBar {
constructor(container, menuId, options2, menuService, contextKeyService, contextMenuService, keybindingService, commandService, telemetryService) {
super(container, __spreadValues({ resetMenu: menuId }, options2), menuService, contextKeyService, contextMenuService, keybindingService, commandService, telemetryService);
this._onDidChangeMenuItems = this._store.add(new Emitter());
this.onDidChangeMenuItems = this._onDidChangeMenuItems.event;
const menu = this._store.add(menuService.createMenu(menuId, contextKeyService, { emitEventsForSubmenuChanges: true }));
const updateToolbar = () => {
var _a10, _b4, _c2;
const primary = [];
const secondary = [];
createAndFillInActionBarActions(menu, options2 === null || options2 === void 0 ? void 0 : options2.menuOptions, { primary, secondary }, (_a10 = options2 === null || options2 === void 0 ? void 0 : options2.toolbarOptions) === null || _a10 === void 0 ? void 0 : _a10.primaryGroup, (_b4 = options2 === null || options2 === void 0 ? void 0 : options2.toolbarOptions) === null || _b4 === void 0 ? void 0 : _b4.shouldInlineSubmenu, (_c2 = options2 === null || options2 === void 0 ? void 0 : options2.toolbarOptions) === null || _c2 === void 0 ? void 0 : _c2.useSeparatorsInPrimaryActions);
container.classList.toggle("has-no-actions", primary.length === 0 && secondary.length === 0);
super.setActions(primary, secondary);
};
this._store.add(menu.onDidChange(() => {
updateToolbar();
this._onDidChangeMenuItems.fire(this);
}));
updateToolbar();
}
/**
* @deprecated The WorkbenchToolBar does not support this method because it works with menus.
*/
setActions() {
throw new BugIndicatingError("This toolbar is populated from a menu.");
}
};
MenuWorkbenchToolBar = __decorate52([
__param46(3, IMenuService),
__param46(4, IContextKeyService),
__param46(5, IContextMenuService),
__param46(6, IKeybindingService),
__param46(7, ICommandService),
__param46(8, ITelemetryService)
], MenuWorkbenchToolBar);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js
var __decorate53, __param47, emptyArr2, width, DiffEditorGutter, DiffGutterItem, DiffToolBar;
var init_gutterFeature = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js"() {
init_dom();
init_lifecycle();
init_observable();
init_derived();
init_diffEditorSash();
init_utils4();
init_editorGutter();
init_utils5();
init_lineRange();
init_offsetRange();
init_range();
init_textEdit();
init_rangeMapping();
init_textModelText();
init_toolbar3();
init_actions2();
init_contextkey();
init_hover();
init_instantiation();
__decorate53 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param47 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
emptyArr2 = [];
width = 35;
DiffEditorGutter = class DiffEditorGutter2 extends Disposable {
constructor(diffEditorRoot, _diffModel, _editors, _options, _sashLayout, _boundarySashes, _instantiationService, _contextKeyService, _menuService) {
super();
this._diffModel = _diffModel;
this._editors = _editors;
this._options = _options;
this._sashLayout = _sashLayout;
this._boundarySashes = _boundarySashes;
this._instantiationService = _instantiationService;
this._contextKeyService = _contextKeyService;
this._menuService = _menuService;
this._menu = this._register(this._menuService.createMenu(MenuId.DiffEditorHunkToolbar, this._contextKeyService));
this._actions = observableFromEvent(this._menu.onDidChange, () => this._menu.getActions());
this._hasActions = this._actions.map((a3) => a3.length > 0);
this._showSash = derived(this, (reader) => this._options.renderSideBySide.read(reader) && this._hasActions.read(reader));
this.width = derived(this, (reader) => this._hasActions.read(reader) ? width : 0);
this.elements = h("div.gutter@gutter", { style: { position: "absolute", height: "100%", width: width + "px" } }, []);
this._currentDiff = derived(this, (reader) => {
var _a10;
const model = this._diffModel.read(reader);
if (!model) {
return void 0;
}
const mappings = (_a10 = model.diff.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.mappings;
const cursorPosition = this._editors.modifiedCursor.read(reader);
if (!cursorPosition) {
return void 0;
}
return mappings === null || mappings === void 0 ? void 0 : mappings.find((m) => m.lineRangeMapping.modified.contains(cursorPosition.lineNumber));
});
this._selectedDiffs = derived(this, (reader) => {
const model = this._diffModel.read(reader);
const diff = model === null || model === void 0 ? void 0 : model.diff.read(reader);
if (!diff) {
return emptyArr2;
}
const selections = this._editors.modifiedSelections.read(reader);
if (selections.every((s) => s.isEmpty())) {
return emptyArr2;
}
const selectedLineNumbers = new LineRangeSet(selections.map((s) => LineRange.fromRangeInclusive(s)));
const selectedMappings = diff.mappings.filter((m) => m.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified));
const result = selectedMappings.map((mapping) => ({
mapping,
rangeMappings: mapping.lineRangeMapping.innerChanges.filter((c) => selections.some((s) => Range.areIntersecting(c.modifiedRange, s)))
}));
if (result.length === 0 || result.every((r) => r.rangeMappings.length === 0)) {
return emptyArr2;
}
return result;
});
this._register(prependRemoveOnDispose(diffEditorRoot, this.elements.root));
this._register(addDisposableListener(this.elements.root, "click", () => {
this._editors.modified.focus();
}));
this._register(applyStyle(this.elements.root, { display: this._hasActions.map((a3) => a3 ? "block" : "none") }));
derivedDisposable(this, (reader) => {
const showSash = this._showSash.read(reader);
return !showSash ? void 0 : new DiffEditorSash(diffEditorRoot, this._sashLayout.dimensions, this._options.enableSplitViewResizing, this._boundarySashes, derivedWithSetter(this, (reader2) => this._sashLayout.sashLeft.read(reader2) - width, (v, tx) => this._sashLayout.sashLeft.set(v + width, tx)), () => this._sashLayout.resetSash());
}).recomputeInitiallyAndOnChange(this._store);
this._register(new EditorGutter(this._editors.modified, this.elements.root, {
getIntersectingGutterItems: (range2, reader) => {
const model = this._diffModel.read(reader);
if (!model) {
return [];
}
const diffs = model.diff.read(reader);
if (!diffs) {
return [];
}
const selection = this._selectedDiffs.read(reader);
if (selection.length > 0) {
const m = DetailedLineRangeMapping.fromRangeMappings(selection.flatMap((s) => s.rangeMappings));
return [
new DiffGutterItem(m, true, MenuId.DiffEditorSelectionToolbar, void 0, model.model.original.uri, model.model.modified.uri)
];
}
const currentDiff = this._currentDiff.read(reader);
return diffs.mappings.map((m) => new DiffGutterItem(m.lineRangeMapping.withInnerChangesFromLineRanges(), m.lineRangeMapping === (currentDiff === null || currentDiff === void 0 ? void 0 : currentDiff.lineRangeMapping), MenuId.DiffEditorHunkToolbar, void 0, model.model.original.uri, model.model.modified.uri));
},
createView: (item, target) => {
return this._instantiationService.createInstance(DiffToolBar, item, target, this);
}
}));
this._register(addDisposableListener(this.elements.gutter, EventType.MOUSE_WHEEL, (e) => {
if (this._editors.modified.getOption(
103
/* EditorOption.scrollbar */
).handleMouseWheel) {
this._editors.modified.delegateScrollFromMouseWheelEvent(e);
}
}, { passive: false }));
}
computeStagedValue(mapping) {
var _a10;
const c = (_a10 = mapping.innerChanges) !== null && _a10 !== void 0 ? _a10 : [];
const modified = new TextModelText(this._editors.modifiedModel.get());
const original = new TextModelText(this._editors.original.getModel());
const edit = new TextEdit(c.map((c2) => c2.toTextEdit(modified)));
const value = edit.apply(original);
return value;
}
layout(left) {
this.elements.gutter.style.left = left + "px";
}
};
DiffEditorGutter = __decorate53([
__param47(6, IInstantiationService),
__param47(7, IContextKeyService),
__param47(8, IMenuService)
], DiffEditorGutter);
DiffGutterItem = class {
constructor(mapping, showAlways, menuId, rangeOverride, originalUri, modifiedUri) {
this.mapping = mapping;
this.showAlways = showAlways;
this.menuId = menuId;
this.rangeOverride = rangeOverride;
this.originalUri = originalUri;
this.modifiedUri = modifiedUri;
}
get id() {
return this.mapping.modified.toString();
}
get range() {
var _a10;
return (_a10 = this.rangeOverride) !== null && _a10 !== void 0 ? _a10 : this.mapping.modified;
}
};
DiffToolBar = class DiffToolBar2 extends Disposable {
constructor(_item, target, gutter, instantiationService) {
super();
this._item = _item;
this._elements = h("div.gutterItem", { style: { height: "20px", width: "34px" } }, [
h("div.background@background", {}, []),
h("div.buttons@buttons", {}, [])
]);
this._showAlways = this._item.map(this, (item) => item.showAlways);
this._menuId = this._item.map(this, (item) => item.menuId);
this._isSmall = observableValue(this, false);
this._lastItemRange = void 0;
this._lastViewRange = void 0;
const hoverDelegate = this._register(instantiationService.createInstance(WorkbenchHoverDelegate, "element", true, { position: {
hoverPosition: 1
/* HoverPosition.RIGHT */
} }));
this._register(appendRemoveOnDispose(target, this._elements.root));
this._register(autorun((reader) => {
const showAlways = this._showAlways.read(reader);
this._elements.root.classList.toggle("noTransition", true);
this._elements.root.classList.toggle("showAlways", showAlways);
setTimeout(() => {
this._elements.root.classList.toggle("noTransition", false);
}, 0);
}));
this._register(autorunWithStore((reader, store) => {
this._elements.buttons.replaceChildren();
const i = store.add(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.buttons, this._menuId.read(reader), {
orientation: 1,
hoverDelegate,
toolbarOptions: {
primaryGroup: (g) => g.startsWith("primary")
},
overflowBehavior: { maxItems: this._isSmall.read(reader) ? 1 : 3 },
hiddenItemStrategy: 0,
actionRunner: new ActionRunnerWithContext(() => {
const item = this._item.get();
const mapping = item.mapping;
return {
mapping,
originalWithModifiedChanges: gutter.computeStagedValue(mapping),
originalUri: item.originalUri,
modifiedUri: item.modifiedUri
};
}),
menuOptions: {
shouldForwardArgs: true
}
}));
store.add(i.onDidChangeMenuItems(() => {
if (this._lastItemRange) {
this.layout(this._lastItemRange, this._lastViewRange);
}
}));
}));
}
layout(itemRange, viewRange) {
this._lastItemRange = itemRange;
this._lastViewRange = viewRange;
let itemHeight = this._elements.buttons.clientHeight;
this._isSmall.set(this._item.get().mapping.original.startLineNumber === 1 && itemRange.length < 30, void 0);
itemHeight = this._elements.buttons.clientHeight;
const middleHeight = itemRange.length / 2 - itemHeight / 2;
const margin = itemHeight;
let effectiveCheckboxTop = itemRange.start + middleHeight;
const preferredViewPortRange = OffsetRange.tryCreate(margin, viewRange.endExclusive - margin - itemHeight);
const preferredParentRange = OffsetRange.tryCreate(itemRange.start + margin, itemRange.endExclusive - itemHeight - margin);
if (preferredParentRange && preferredViewPortRange && preferredParentRange.start < preferredParentRange.endExclusive) {
effectiveCheckboxTop = preferredViewPortRange.clip(effectiveCheckboxTop);
effectiveCheckboxTop = preferredParentRange.clip(effectiveCheckboxTop);
}
this._elements.buttons.style.top = `${effectiveCheckboxTop - itemRange.start}px`;
}
};
DiffToolBar = __decorate53([
__param47(3, IInstantiationService)
], DiffToolBar);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js
var __decorate54, __param48, HideUnchangedRegionsFeature_1, HideUnchangedRegionsFeature, CollapsedCodeOverlayWidget;
var init_hideUnchangedRegionsFeature = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js"() {
init_dom();
init_iconLabels();
init_codicons();
init_htmlContent();
init_lifecycle();
init_observable();
init_derived();
init_themables();
init_types();
init_utils4();
init_lineRange();
init_position();
init_range();
init_languages();
init_nls();
init_instantiation();
__decorate54 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param48 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
HideUnchangedRegionsFeature = HideUnchangedRegionsFeature_1 = class HideUnchangedRegionsFeature2 extends Disposable {
static setBreadcrumbsSourceFactory(factory) {
this._breadcrumbsSourceFactory.set(factory, void 0);
}
get isUpdatingHiddenAreas() {
return this._isUpdatingHiddenAreas;
}
constructor(_editors, _diffModel, _options, _instantiationService) {
super();
this._editors = _editors;
this._diffModel = _diffModel;
this._options = _options;
this._instantiationService = _instantiationService;
this._modifiedOutlineSource = derivedDisposable(this, (reader) => {
const m = this._editors.modifiedModel.read(reader);
const factory = HideUnchangedRegionsFeature_1._breadcrumbsSourceFactory.read(reader);
return !m || !factory ? void 0 : factory(m, this._instantiationService);
});
this._isUpdatingHiddenAreas = false;
this._register(this._editors.original.onDidChangeCursorPosition((e) => {
if (e.reason === 1) {
return;
}
const m = this._diffModel.get();
transaction((tx) => {
for (const s of this._editors.original.getSelections() || []) {
m === null || m === void 0 ? void 0 : m.ensureOriginalLineIsVisible(s.getStartPosition().lineNumber, 0, tx);
m === null || m === void 0 ? void 0 : m.ensureOriginalLineIsVisible(s.getEndPosition().lineNumber, 0, tx);
}
});
}));
this._register(this._editors.modified.onDidChangeCursorPosition((e) => {
if (e.reason === 1) {
return;
}
const m = this._diffModel.get();
transaction((tx) => {
for (const s of this._editors.modified.getSelections() || []) {
m === null || m === void 0 ? void 0 : m.ensureModifiedLineIsVisible(s.getStartPosition().lineNumber, 0, tx);
m === null || m === void 0 ? void 0 : m.ensureModifiedLineIsVisible(s.getEndPosition().lineNumber, 0, tx);
}
});
}));
const unchangedRegions = this._diffModel.map((m, reader) => {
var _a10, _b4;
const regions = (_a10 = m === null || m === void 0 ? void 0 : m.unchangedRegions.read(reader)) !== null && _a10 !== void 0 ? _a10 : [];
if (regions.length === 1 && regions[0].modifiedLineNumber === 1 && regions[0].lineCount === ((_b4 = this._editors.modifiedModel.read(reader)) === null || _b4 === void 0 ? void 0 : _b4.getLineCount())) {
return [];
}
return regions;
});
this.viewZones = derivedWithStore(this, (reader, store) => {
const modifiedOutlineSource = this._modifiedOutlineSource.read(reader);
if (!modifiedOutlineSource) {
return { origViewZones: [], modViewZones: [] };
}
const origViewZones = [];
const modViewZones = [];
const sideBySide = this._options.renderSideBySide.read(reader);
const curUnchangedRegions = unchangedRegions.read(reader);
for (const r of curUnchangedRegions) {
if (r.shouldHideControls(reader)) {
continue;
}
{
const d = derived(this, (reader2) => (
/** @description hiddenOriginalRangeStart */
r.getHiddenOriginalRange(reader2).startLineNumber - 1
));
const origVz = new PlaceholderViewZone(d, 24);
origViewZones.push(origVz);
store.add(new CollapsedCodeOverlayWidget(this._editors.original, origVz, r, r.originalUnchangedRange, !sideBySide, modifiedOutlineSource, (l) => this._diffModel.get().ensureModifiedLineIsVisible(l, 2, void 0), this._options));
}
{
const d = derived(this, (reader2) => (
/** @description hiddenModifiedRangeStart */
r.getHiddenModifiedRange(reader2).startLineNumber - 1
));
const modViewZone = new PlaceholderViewZone(d, 24);
modViewZones.push(modViewZone);
store.add(new CollapsedCodeOverlayWidget(this._editors.modified, modViewZone, r, r.modifiedUnchangedRange, false, modifiedOutlineSource, (l) => this._diffModel.get().ensureModifiedLineIsVisible(l, 2, void 0), this._options));
}
}
return { origViewZones, modViewZones };
});
const unchangedLinesDecoration = {
description: "unchanged lines",
className: "diff-unchanged-lines",
isWholeLine: true
};
const unchangedLinesDecorationShow = {
description: "Fold Unchanged",
glyphMarginHoverMessage: new MarkdownString(void 0, { isTrusted: true, supportThemeIcons: true }).appendMarkdown(localize("foldUnchanged", "Fold Unchanged Region")),
glyphMarginClassName: "fold-unchanged " + ThemeIcon.asClassName(Codicon.fold),
zIndex: 10001
};
this._register(applyObservableDecorations(this._editors.original, derived(this, (reader) => {
const curUnchangedRegions = unchangedRegions.read(reader);
const result = curUnchangedRegions.map((r) => ({
range: r.originalUnchangedRange.toInclusiveRange(),
options: unchangedLinesDecoration
}));
for (const r of curUnchangedRegions) {
if (r.shouldHideControls(reader)) {
result.push({
range: Range.fromPositions(new Position(r.originalLineNumber, 1)),
options: unchangedLinesDecorationShow
});
}
}
return result;
})));
this._register(applyObservableDecorations(this._editors.modified, derived(this, (reader) => {
const curUnchangedRegions = unchangedRegions.read(reader);
const result = curUnchangedRegions.map((r) => ({
range: r.modifiedUnchangedRange.toInclusiveRange(),
options: unchangedLinesDecoration
}));
for (const r of curUnchangedRegions) {
if (r.shouldHideControls(reader)) {
result.push({
range: LineRange.ofLength(r.modifiedLineNumber, 1).toInclusiveRange(),
options: unchangedLinesDecorationShow
});
}
}
return result;
})));
this._register(autorun((reader) => {
const curUnchangedRegions = unchangedRegions.read(reader);
this._isUpdatingHiddenAreas = true;
try {
this._editors.original.setHiddenAreas(curUnchangedRegions.map((r) => r.getHiddenOriginalRange(reader).toInclusiveRange()).filter(isDefined));
this._editors.modified.setHiddenAreas(curUnchangedRegions.map((r) => r.getHiddenModifiedRange(reader).toInclusiveRange()).filter(isDefined));
} finally {
this._isUpdatingHiddenAreas = false;
}
}));
this._register(this._editors.modified.onMouseUp((event) => {
var _a10;
if (!event.event.rightButton && event.target.position && ((_a10 = event.target.element) === null || _a10 === void 0 ? void 0 : _a10.className.includes("fold-unchanged"))) {
const lineNumber = event.target.position.lineNumber;
const model = this._diffModel.get();
if (!model) {
return;
}
const region = model.unchangedRegions.get().find((r) => r.modifiedUnchangedRange.includes(lineNumber));
if (!region) {
return;
}
region.collapseAll(void 0);
event.event.stopPropagation();
event.event.preventDefault();
}
}));
this._register(this._editors.original.onMouseUp((event) => {
var _a10;
if (!event.event.rightButton && event.target.position && ((_a10 = event.target.element) === null || _a10 === void 0 ? void 0 : _a10.className.includes("fold-unchanged"))) {
const lineNumber = event.target.position.lineNumber;
const model = this._diffModel.get();
if (!model) {
return;
}
const region = model.unchangedRegions.get().find((r) => r.originalUnchangedRange.includes(lineNumber));
if (!region) {
return;
}
region.collapseAll(void 0);
event.event.stopPropagation();
event.event.preventDefault();
}
}));
}
};
HideUnchangedRegionsFeature._breadcrumbsSourceFactory = observableValue("breadcrumbsSourceFactory", void 0);
HideUnchangedRegionsFeature = HideUnchangedRegionsFeature_1 = __decorate54([
__param48(3, IInstantiationService)
], HideUnchangedRegionsFeature);
CollapsedCodeOverlayWidget = class extends ViewZoneOverlayWidget {
constructor(_editor, _viewZone, _unchangedRegion, _unchangedRegionRange, _hide, _modifiedOutlineSource, _revealModifiedHiddenLine, _options) {
const root = h("div.diff-hidden-lines-widget");
super(_editor, _viewZone, root.root);
this._editor = _editor;
this._unchangedRegion = _unchangedRegion;
this._unchangedRegionRange = _unchangedRegionRange;
this._hide = _hide;
this._modifiedOutlineSource = _modifiedOutlineSource;
this._revealModifiedHiddenLine = _revealModifiedHiddenLine;
this._options = _options;
this._nodes = h("div.diff-hidden-lines", [
h("div.top@top", { title: localize("diff.hiddenLines.top", "Click or drag to show more above") }),
h("div.center@content", { style: { display: "flex" } }, [
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(void 0);
} }, ...renderLabelWithIcons("$(unfold)"))]),
h("div@others", { style: { display: "flex", justifyContent: "center", alignItems: "center" } })
]),
h("div.bottom@bottom", { title: localize("diff.bottom", "Click or drag to show more below"), role: "button" })
]);
root.root.appendChild(this._nodes.root);
const layoutInfo = observableFromEvent(this._editor.onDidLayoutChange, () => this._editor.getLayoutInfo());
if (!this._hide) {
this._register(applyStyle(this._nodes.first, { width: layoutInfo.map((l) => l.contentLeft) }));
} else {
reset(this._nodes.first);
}
this._register(autorun((reader) => {
const isFullyRevealed = this._unchangedRegion.visibleLineCountTop.read(reader) + this._unchangedRegion.visibleLineCountBottom.read(reader) === this._unchangedRegion.lineCount;
this._nodes.bottom.classList.toggle("canMoveTop", !isFullyRevealed);
this._nodes.bottom.classList.toggle("canMoveBottom", this._unchangedRegion.visibleLineCountBottom.read(reader) > 0);
this._nodes.top.classList.toggle("canMoveTop", this._unchangedRegion.visibleLineCountTop.read(reader) > 0);
this._nodes.top.classList.toggle("canMoveBottom", !isFullyRevealed);
const isDragged = this._unchangedRegion.isDragged.read(reader);
const domNode = this._editor.getDomNode();
if (domNode) {
domNode.classList.toggle("draggingUnchangedRegion", !!isDragged);
if (isDragged === "top") {
domNode.classList.toggle("canMoveTop", this._unchangedRegion.visibleLineCountTop.read(reader) > 0);
domNode.classList.toggle("canMoveBottom", !isFullyRevealed);
} else if (isDragged === "bottom") {
domNode.classList.toggle("canMoveTop", !isFullyRevealed);
domNode.classList.toggle("canMoveBottom", this._unchangedRegion.visibleLineCountBottom.read(reader) > 0);
} else {
domNode.classList.toggle("canMoveTop", false);
domNode.classList.toggle("canMoveBottom", false);
}
}
}));
const editor2 = this._editor;
this._register(addDisposableListener(this._nodes.top, "mousedown", (e) => {
if (e.button !== 0) {
return;
}
this._nodes.top.classList.toggle("dragging", true);
this._nodes.root.classList.toggle("dragging", true);
e.preventDefault();
const startTop = e.clientY;
let didMove = false;
const cur = this._unchangedRegion.visibleLineCountTop.get();
this._unchangedRegion.isDragged.set("top", void 0);
const window2 = getWindow(this._nodes.top);
const mouseMoveListener = addDisposableListener(window2, "mousemove", (e2) => {
const currentTop = e2.clientY;
const delta = currentTop - startTop;
didMove = didMove || Math.abs(delta) > 2;
const lineDelta = Math.round(delta / editor2.getOption(
67
/* EditorOption.lineHeight */
));
const newVal = Math.max(0, Math.min(cur + lineDelta, this._unchangedRegion.getMaxVisibleLineCountTop()));
this._unchangedRegion.visibleLineCountTop.set(newVal, void 0);
});
const mouseUpListener = addDisposableListener(window2, "mouseup", (e2) => {
if (!didMove) {
this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(), void 0);
}
this._nodes.top.classList.toggle("dragging", false);
this._nodes.root.classList.toggle("dragging", false);
this._unchangedRegion.isDragged.set(void 0, void 0);
mouseMoveListener.dispose();
mouseUpListener.dispose();
});
}));
this._register(addDisposableListener(this._nodes.bottom, "mousedown", (e) => {
if (e.button !== 0) {
return;
}
this._nodes.bottom.classList.toggle("dragging", true);
this._nodes.root.classList.toggle("dragging", true);
e.preventDefault();
const startTop = e.clientY;
let didMove = false;
const cur = this._unchangedRegion.visibleLineCountBottom.get();
this._unchangedRegion.isDragged.set("bottom", void 0);
const window2 = getWindow(this._nodes.bottom);
const mouseMoveListener = addDisposableListener(window2, "mousemove", (e2) => {
const currentTop = e2.clientY;
const delta = currentTop - startTop;
didMove = didMove || Math.abs(delta) > 2;
const lineDelta = Math.round(delta / editor2.getOption(
67
/* EditorOption.lineHeight */
));
const newVal = Math.max(0, Math.min(cur - lineDelta, this._unchangedRegion.getMaxVisibleLineCountBottom()));
const top = this._unchangedRegionRange.endLineNumberExclusive > editor2.getModel().getLineCount() ? editor2.getContentHeight() : editor2.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);
this._unchangedRegion.visibleLineCountBottom.set(newVal, void 0);
const top2 = this._unchangedRegionRange.endLineNumberExclusive > editor2.getModel().getLineCount() ? editor2.getContentHeight() : editor2.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);
editor2.setScrollTop(editor2.getScrollTop() + (top2 - top));
});
const mouseUpListener = addDisposableListener(window2, "mouseup", (e2) => {
this._unchangedRegion.isDragged.set(void 0, void 0);
if (!didMove) {
const top = editor2.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);
this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(), void 0);
const top2 = editor2.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);
editor2.setScrollTop(editor2.getScrollTop() + (top2 - top));
}
this._nodes.bottom.classList.toggle("dragging", false);
this._nodes.root.classList.toggle("dragging", false);
mouseMoveListener.dispose();
mouseUpListener.dispose();
});
}));
this._register(autorun((reader) => {
const children = [];
if (!this._hide) {
const lineCount = _unchangedRegion.getHiddenModifiedRange(reader).length;
const linesHiddenText = localize("hiddenLines", "{0} hidden lines", lineCount);
const span = $("span", { title: localize("diff.hiddenLines.expandAll", "Double click to unfold") }, linesHiddenText);
span.addEventListener("dblclick", (e) => {
if (e.button !== 0) {
return;
}
e.preventDefault();
this._unchangedRegion.showAll(void 0);
});
children.push(span);
const range2 = this._unchangedRegion.getHiddenModifiedRange(reader);
const items = this._modifiedOutlineSource.getBreadcrumbItems(range2, reader);
if (items.length > 0) {
children.push($("span", void 0, "\xA0\xA0|\xA0\xA0"));
for (let i = 0; i < items.length; i++) {
const item = items[i];
const icon = SymbolKinds.toIcon(item.kind);
const divItem = h("div.breadcrumb-item", {
style: { display: "flex", alignItems: "center" }
}, [
renderIcon(icon),
"\xA0",
item.name,
...i === items.length - 1 ? [] : [renderIcon(Codicon.chevronRight)]
]).root;
children.push(divItem);
divItem.onclick = () => {
this._revealModifiedHiddenLine(item.startLineNumber);
};
}
}
}
reset(this._nodes.others, ...children);
}));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js
var __decorate55, __param49, OverviewRulerFeature_1, OverviewRulerFeature;
var init_overviewRulerFeature = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js"() {
init_dom();
init_fastDomNode();
init_scrollbarState();
init_lifecycle();
init_observable();
init_utils4();
init_position();
init_overviewZoneManager();
init_colorRegistry();
init_themeService();
__decorate55 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param49 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
OverviewRulerFeature = OverviewRulerFeature_1 = class OverviewRulerFeature2 extends Disposable {
constructor(_editors, _rootElement, _diffModel, _rootWidth, _rootHeight, _modifiedEditorLayoutInfo, _themeService) {
super();
this._editors = _editors;
this._rootElement = _rootElement;
this._diffModel = _diffModel;
this._rootWidth = _rootWidth;
this._rootHeight = _rootHeight;
this._modifiedEditorLayoutInfo = _modifiedEditorLayoutInfo;
this._themeService = _themeService;
this.width = OverviewRulerFeature_1.ENTIRE_DIFF_OVERVIEW_WIDTH;
const currentColorTheme = observableFromEvent(this._themeService.onDidColorThemeChange, () => this._themeService.getColorTheme());
const currentColors = derived((reader) => {
const theme = currentColorTheme.read(reader);
const insertColor = theme.getColor(diffOverviewRulerInserted) || (theme.getColor(diffInserted) || defaultInsertColor).transparent(2);
const removeColor = theme.getColor(diffOverviewRulerRemoved) || (theme.getColor(diffRemoved) || defaultRemoveColor).transparent(2);
return { insertColor, removeColor };
});
const viewportDomElement = createFastDomNode(document.createElement("div"));
viewportDomElement.setClassName("diffViewport");
viewportDomElement.setPosition("absolute");
const diffOverviewRoot = h("div.diffOverview", {
style: { position: "absolute", top: "0px", width: OverviewRulerFeature_1.ENTIRE_DIFF_OVERVIEW_WIDTH + "px" }
}).root;
this._register(appendRemoveOnDispose(diffOverviewRoot, viewportDomElement.domNode));
this._register(addStandardDisposableListener(diffOverviewRoot, EventType.POINTER_DOWN, (e) => {
this._editors.modified.delegateVerticalScrollbarPointerDown(e);
}));
this._register(addDisposableListener(diffOverviewRoot, EventType.MOUSE_WHEEL, (e) => {
this._editors.modified.delegateScrollFromMouseWheelEvent(e);
}, { passive: false }));
this._register(appendRemoveOnDispose(this._rootElement, diffOverviewRoot));
this._register(autorunWithStore((reader, store) => {
const m = this._diffModel.read(reader);
const originalOverviewRuler = this._editors.original.createOverviewRuler("original diffOverviewRuler");
if (originalOverviewRuler) {
store.add(originalOverviewRuler);
store.add(appendRemoveOnDispose(diffOverviewRoot, originalOverviewRuler.getDomNode()));
}
const modifiedOverviewRuler = this._editors.modified.createOverviewRuler("modified diffOverviewRuler");
if (modifiedOverviewRuler) {
store.add(modifiedOverviewRuler);
store.add(appendRemoveOnDispose(diffOverviewRoot, modifiedOverviewRuler.getDomNode()));
}
if (!originalOverviewRuler || !modifiedOverviewRuler) {
return;
}
const origViewZonesChanged = observableSignalFromEvent("viewZoneChanged", this._editors.original.onDidChangeViewZones);
const modViewZonesChanged = observableSignalFromEvent("viewZoneChanged", this._editors.modified.onDidChangeViewZones);
const origHiddenRangesChanged = observableSignalFromEvent("hiddenRangesChanged", this._editors.original.onDidChangeHiddenAreas);
const modHiddenRangesChanged = observableSignalFromEvent("hiddenRangesChanged", this._editors.modified.onDidChangeHiddenAreas);
store.add(autorun((reader2) => {
var _a10;
origViewZonesChanged.read(reader2);
modViewZonesChanged.read(reader2);
origHiddenRangesChanged.read(reader2);
modHiddenRangesChanged.read(reader2);
const colors2 = currentColors.read(reader2);
const diff = (_a10 = m === null || m === void 0 ? void 0 : m.diff.read(reader2)) === null || _a10 === void 0 ? void 0 : _a10.mappings;
function createZones(ranges, color, editor2) {
const vm = editor2._getViewModel();
if (!vm) {
return [];
}
return ranges.filter((d) => d.length > 0).map((r) => {
const start = vm.coordinatesConverter.convertModelPositionToViewPosition(new Position(r.startLineNumber, 1));
const end = vm.coordinatesConverter.convertModelPositionToViewPosition(new Position(r.endLineNumberExclusive, 1));
const lineCount = end.lineNumber - start.lineNumber;
return new OverviewRulerZone(start.lineNumber, end.lineNumber, lineCount, color.toString());
});
}
const originalZones = createZones((diff || []).map((d) => d.lineRangeMapping.original), colors2.removeColor, this._editors.original);
const modifiedZones = createZones((diff || []).map((d) => d.lineRangeMapping.modified), colors2.insertColor, this._editors.modified);
originalOverviewRuler === null || originalOverviewRuler === void 0 ? void 0 : originalOverviewRuler.setZones(originalZones);
modifiedOverviewRuler === null || modifiedOverviewRuler === void 0 ? void 0 : modifiedOverviewRuler.setZones(modifiedZones);
}));
store.add(autorun((reader2) => {
const height = this._rootHeight.read(reader2);
const width2 = this._rootWidth.read(reader2);
const layoutInfo = this._modifiedEditorLayoutInfo.read(reader2);
if (layoutInfo) {
const freeSpace = OverviewRulerFeature_1.ENTIRE_DIFF_OVERVIEW_WIDTH - 2 * OverviewRulerFeature_1.ONE_OVERVIEW_WIDTH;
originalOverviewRuler.setLayout({
top: 0,
height,
right: freeSpace + OverviewRulerFeature_1.ONE_OVERVIEW_WIDTH,
width: OverviewRulerFeature_1.ONE_OVERVIEW_WIDTH
});
modifiedOverviewRuler.setLayout({
top: 0,
height,
right: 0,
width: OverviewRulerFeature_1.ONE_OVERVIEW_WIDTH
});
const scrollTop = this._editors.modifiedScrollTop.read(reader2);
const scrollHeight = this._editors.modifiedScrollHeight.read(reader2);
const scrollBarOptions = this._editors.modified.getOption(
103
/* EditorOption.scrollbar */
);
const state = new ScrollbarState(scrollBarOptions.verticalHasArrows ? scrollBarOptions.arrowSize : 0, scrollBarOptions.verticalScrollbarSize, 0, layoutInfo.height, scrollHeight, scrollTop);
viewportDomElement.setTop(state.getSliderPosition());
viewportDomElement.setHeight(state.getSliderSize());
} else {
viewportDomElement.setTop(0);
viewportDomElement.setHeight(0);
}
diffOverviewRoot.style.height = height + "px";
diffOverviewRoot.style.left = width2 - OverviewRulerFeature_1.ENTIRE_DIFF_OVERVIEW_WIDTH + "px";
viewportDomElement.setWidth(OverviewRulerFeature_1.ENTIRE_DIFF_OVERVIEW_WIDTH);
}));
}));
}
};
OverviewRulerFeature.ONE_OVERVIEW_WIDTH = 15;
OverviewRulerFeature.ENTIRE_DIFF_OVERVIEW_WIDTH = OverviewRulerFeature_1.ONE_OVERVIEW_WIDTH * 2;
OverviewRulerFeature = OverviewRulerFeature_1 = __decorate55([
__param49(6, IThemeService)
], OverviewRulerFeature);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js
var emptyArr3, RevertButtonsFeature, RevertButton;
var init_revertButtonsFeature = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js"() {
init_dom();
init_iconLabels();
init_codicons();
init_lifecycle();
init_observable();
init_lineRange();
init_range();
init_rangeMapping();
init_model2();
init_nls();
emptyArr3 = [];
RevertButtonsFeature = class extends Disposable {
constructor(_editors, _diffModel, _options, _widget) {
super();
this._editors = _editors;
this._diffModel = _diffModel;
this._options = _options;
this._widget = _widget;
this._selectedDiffs = derived(this, (reader) => {
const model = this._diffModel.read(reader);
const diff = model === null || model === void 0 ? void 0 : model.diff.read(reader);
if (!diff) {
return emptyArr3;
}
const selections = this._editors.modifiedSelections.read(reader);
if (selections.every((s) => s.isEmpty())) {
return emptyArr3;
}
const selectedLineNumbers = new LineRangeSet(selections.map((s) => LineRange.fromRangeInclusive(s)));
const selectedMappings = diff.mappings.filter((m) => m.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified));
const result = selectedMappings.map((mapping) => ({
mapping,
rangeMappings: mapping.lineRangeMapping.innerChanges.filter((c) => selections.some((s) => Range.areIntersecting(c.modifiedRange, s)))
}));
if (result.length === 0 || result.every((r) => r.rangeMappings.length === 0)) {
return emptyArr3;
}
return result;
});
this._register(autorunWithStore((reader, store) => {
if (!this._options.shouldRenderOldRevertArrows.read(reader)) {
return;
}
const model = this._diffModel.read(reader);
const diff = model === null || model === void 0 ? void 0 : model.diff.read(reader);
if (!model || !diff) {
return;
}
if (model.movedTextToCompare.read(reader)) {
return;
}
const glyphWidgetsModified = [];
const selectedDiffs = this._selectedDiffs.read(reader);
const selectedDiffsSet = new Set(selectedDiffs.map((d) => d.mapping));
if (selectedDiffs.length > 0) {
const selections = this._editors.modifiedSelections.read(reader);
const btn = store.add(new RevertButton(selections[selections.length - 1].positionLineNumber, this._widget, selectedDiffs.flatMap((d) => d.rangeMappings), true));
this._editors.modified.addGlyphMarginWidget(btn);
glyphWidgetsModified.push(btn);
}
for (const m of diff.mappings) {
if (selectedDiffsSet.has(m)) {
continue;
}
if (!m.lineRangeMapping.modified.isEmpty && m.lineRangeMapping.innerChanges) {
const btn = store.add(new RevertButton(m.lineRangeMapping.modified.startLineNumber, this._widget, m.lineRangeMapping, false));
this._editors.modified.addGlyphMarginWidget(btn);
glyphWidgetsModified.push(btn);
}
}
store.add(toDisposable(() => {
for (const w of glyphWidgetsModified) {
this._editors.modified.removeGlyphMarginWidget(w);
}
}));
}));
}
};
RevertButton = class _RevertButton extends Disposable {
getId() {
return this._id;
}
constructor(_lineNumber, _widget, _diffs, _revertSelection) {
super();
this._lineNumber = _lineNumber;
this._widget = _widget;
this._diffs = _diffs;
this._revertSelection = _revertSelection;
this._id = `revertButton${_RevertButton.counter++}`;
this._domNode = h("div.revertButton", {
title: this._revertSelection ? localize("revertSelectedChanges", "Revert Selected Changes") : localize("revertChange", "Revert Change")
}, [renderIcon(Codicon.arrowRight)]).root;
this._register(addDisposableListener(this._domNode, EventType.MOUSE_DOWN, (e) => {
if (e.button !== 2) {
e.stopPropagation();
e.preventDefault();
}
}));
this._register(addDisposableListener(this._domNode, EventType.MOUSE_UP, (e) => {
e.stopPropagation();
e.preventDefault();
}));
this._register(addDisposableListener(this._domNode, EventType.CLICK, (e) => {
if (this._diffs instanceof LineRangeMapping) {
this._widget.revert(this._diffs);
} else {
this._widget.revertRangeMappings(this._diffs);
}
e.stopPropagation();
e.preventDefault();
}));
}
/**
* Get the dom node of the glyph widget.
*/
getDomNode() {
return this._domNode;
}
/**
* Get the placement of the glyph widget.
*/
getPosition() {
return {
lane: GlyphMarginLane2.Right,
range: {
startColumn: 1,
startLineNumber: this._lineNumber,
endColumn: 1,
endLineNumber: this._lineNumber
},
zIndex: 10001
};
}
};
RevertButton.counter = 0;
}
});
// node_modules/monaco-editor/esm/vs/platform/observable/common/platformObservableUtils.js
function bindContextKey(key, service, computeValue) {
const boundKey = key.bindTo(service);
return autorunOpts({ debugName: () => `Set Context Key "${key.key}"` }, (reader) => {
boundKey.set(computeValue(reader));
});
}
var init_platformObservableUtils = __esm({
"node_modules/monaco-editor/esm/vs/platform/observable/common/platformObservableUtils.js"() {
init_observable();
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/observableUtilities.js
function obsCodeEditor(editor2) {
return ObservableCodeEditor.get(editor2);
}
var ObservableCodeEditor;
var init_observableUtilities = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/observableUtilities.js"() {
init_observable();
ObservableCodeEditor = class _ObservableCodeEditor {
/**
* Make sure that editor is not disposed yet!
*/
static get(editor2) {
let result = _ObservableCodeEditor._map.get(editor2);
if (!result) {
result = new _ObservableCodeEditor(editor2);
_ObservableCodeEditor._map.set(editor2, result);
const d = editor2.onDidDispose(() => {
_ObservableCodeEditor._map.delete(editor2);
d.dispose();
});
}
return result;
}
constructor(editor2) {
this.editor = editor2;
this.model = observableFromEvent(this.editor.onDidChangeModel, () => this.editor.getModel());
}
};
ObservableCodeEditor._map = /* @__PURE__ */ new Map();
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js
var __decorate56, __param50, DiffEditorEditors;
var init_diffEditorEditors = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js"() {
init_event();
init_lifecycle();
init_observable();
init_observableUtilities();
init_overviewRulerFeature();
init_editorOptions();
init_position();
init_nls();
init_instantiation();
init_keybinding();
__decorate56 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param50 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DiffEditorEditors = class DiffEditorEditors2 extends Disposable {
get onDidContentSizeChange() {
return this._onDidContentSizeChange.event;
}
constructor(originalEditorElement, modifiedEditorElement, _options, _argCodeEditorWidgetOptions, _createInnerEditor, _instantiationService, _keybindingService) {
super();
this.originalEditorElement = originalEditorElement;
this.modifiedEditorElement = modifiedEditorElement;
this._options = _options;
this._argCodeEditorWidgetOptions = _argCodeEditorWidgetOptions;
this._createInnerEditor = _createInnerEditor;
this._instantiationService = _instantiationService;
this._keybindingService = _keybindingService;
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 Emitter());
this.modifiedScrollTop = observableFromEvent(this.modified.onDidScrollChange, () => (
/** @description modified.getScrollTop */
this.modified.getScrollTop()
));
this.modifiedScrollHeight = observableFromEvent(this.modified.onDidScrollChange, () => (
/** @description modified.getScrollHeight */
this.modified.getScrollHeight()
));
this.modifiedModel = obsCodeEditor(this.modified).model;
this.modifiedSelections = observableFromEvent(this.modified.onDidChangeCursorSelection, () => {
var _a10;
return (_a10 = this.modified.getSelections()) !== null && _a10 !== void 0 ? _a10 : [];
});
this.modifiedCursor = derivedOpts({ owner: this, equalsFn: Position.equals }, (reader) => {
var _a10, _b4;
return (_b4 = (_a10 = this.modifiedSelections.read(reader)[0]) === null || _a10 === void 0 ? void 0 : _a10.getPosition()) !== null && _b4 !== void 0 ? _b4 : new Position(1, 1);
});
this.originalCursor = observableFromEvent(this.original.onDidChangeCursorPosition, () => {
var _a10;
return (_a10 = this.original.getPosition()) !== null && _a10 !== void 0 ? _a10 : new Position(1, 1);
});
this._argCodeEditorWidgetOptions = null;
this._register(autorunHandleChanges({
createEmptyChangeSummary: () => ({}),
handleChange: (ctx, changeSummary) => {
if (ctx.didChange(_options.editorOptions)) {
Object.assign(changeSummary, ctx.change.changedOptions);
}
return true;
}
}, (reader, changeSummary) => {
_options.editorOptions.read(reader);
this._options.renderSideBySide.read(reader);
this.modified.updateOptions(this._adjustOptionsForRightHandSide(reader, changeSummary));
this.original.updateOptions(this._adjustOptionsForLeftHandSide(reader, changeSummary));
}));
}
_createLeftHandSideEditor(options2, codeEditorWidgetOptions) {
const leftHandSideOptions = this._adjustOptionsForLeftHandSide(void 0, options2);
const editor2 = this._constructInnerEditor(this._instantiationService, this.originalEditorElement, leftHandSideOptions, codeEditorWidgetOptions);
editor2.setContextValue("isInDiffLeftEditor", true);
return editor2;
}
_createRightHandSideEditor(options2, codeEditorWidgetOptions) {
const rightHandSideOptions = this._adjustOptionsForRightHandSide(void 0, options2);
const editor2 = this._constructInnerEditor(this._instantiationService, this.modifiedEditorElement, rightHandSideOptions, codeEditorWidgetOptions);
editor2.setContextValue("isInDiffRightEditor", true);
return editor2;
}
_constructInnerEditor(instantiationService, container, options2, editorWidgetOptions) {
const editor2 = this._createInnerEditor(instantiationService, container, options2, editorWidgetOptions);
this._register(editor2.onDidContentSizeChange((e) => {
const width2 = this.original.getContentWidth() + this.modified.getContentWidth() + OverviewRulerFeature.ENTIRE_DIFF_OVERVIEW_WIDTH;
const height = Math.max(this.modified.getContentHeight(), this.original.getContentHeight());
this._onDidContentSizeChange.fire({
contentHeight: height,
contentWidth: width2,
contentHeightChanged: e.contentHeightChanged,
contentWidthChanged: e.contentWidthChanged
});
}));
return editor2;
}
_adjustOptionsForLeftHandSide(_reader, changedOptions) {
const result = this._adjustOptionsForSubEditor(changedOptions);
if (!this._options.renderSideBySide.get()) {
result.wordWrapOverride1 = "off";
result.wordWrapOverride2 = "off";
result.stickyScroll = { enabled: false };
result.unicodeHighlight = { nonBasicASCII: false, ambiguousCharacters: false, invisibleCharacters: false };
} else {
result.unicodeHighlight = this._options.editorOptions.get().unicodeHighlight || {};
result.wordWrapOverride1 = this._options.diffWordWrap.get();
}
result.glyphMargin = this._options.renderSideBySide.get();
if (changedOptions.originalAriaLabel) {
result.ariaLabel = changedOptions.originalAriaLabel;
}
result.ariaLabel = this._updateAriaLabel(result.ariaLabel);
result.readOnly = !this._options.originalEditable.get();
result.dropIntoEditor = { enabled: !result.readOnly };
result.extraEditorClassName = "original-in-monaco-diff-editor";
return result;
}
_adjustOptionsForRightHandSide(reader, changedOptions) {
const result = this._adjustOptionsForSubEditor(changedOptions);
if (changedOptions.modifiedAriaLabel) {
result.ariaLabel = changedOptions.modifiedAriaLabel;
}
result.ariaLabel = this._updateAriaLabel(result.ariaLabel);
result.wordWrapOverride1 = this._options.diffWordWrap.get();
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + OverviewRulerFeature.ENTIRE_DIFF_OVERVIEW_WIDTH;
result.scrollbar.verticalHasArrows = false;
result.extraEditorClassName = "modified-in-monaco-diff-editor";
return result;
}
_adjustOptionsForSubEditor(options2) {
const clonedOptions = __spreadProps(__spreadValues({}, options2), {
dimension: {
height: 0,
width: 0
}
});
clonedOptions.inDiffEditor = true;
clonedOptions.automaticLayout = false;
clonedOptions.scrollbar = __spreadValues({}, clonedOptions.scrollbar || {});
clonedOptions.folding = false;
clonedOptions.codeLens = this._options.diffCodeLens.get();
clonedOptions.fixedOverflowWidgets = true;
clonedOptions.minimap = __spreadValues({}, clonedOptions.minimap || {});
clonedOptions.minimap.enabled = false;
if (this._options.hideUnchangedRegions.get()) {
clonedOptions.stickyScroll = { enabled: false };
} else {
clonedOptions.stickyScroll = this._options.editorOptions.get().stickyScroll;
}
return clonedOptions;
}
_updateAriaLabel(ariaLabel) {
var _a10;
if (!ariaLabel) {
ariaLabel = "";
}
const ariaNavigationTip = localize("diff-aria-navigation-tip", " use {0} to open the accessibility help.", (_a10 = this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")) === null || _a10 === void 0 ? void 0 : _a10.getAriaLabel());
if (this._options.accessibilityVerbose.get()) {
return ariaLabel + ariaNavigationTip;
} else if (ariaLabel) {
return ariaLabel.replaceAll(ariaNavigationTip, "");
}
return "";
}
};
DiffEditorEditors = __decorate56([
__param50(5, IInstantiationService),
__param50(6, IKeybindingService)
], DiffEditorEditors);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js
var DelegatingEditor;
var init_delegatingEditorImpl = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js"() {
init_event();
init_lifecycle();
DelegatingEditor = class _DelegatingEditor extends Disposable {
constructor() {
super(...arguments);
this._id = ++_DelegatingEditor.idCounter;
this._onDidDispose = this._register(new Emitter());
this.onDidDispose = this._onDidDispose.event;
}
getId() {
return this.getEditorType() + ":v2:" + this._id;
}
// #region editorBrowser.IDiffEditor: Delegating to modified Editor
getVisibleColumnFromPosition(position) {
return this._targetEditor.getVisibleColumnFromPosition(position);
}
getPosition() {
return this._targetEditor.getPosition();
}
setPosition(position, source = "api") {
this._targetEditor.setPosition(position, source);
}
revealLine(lineNumber, scrollType = 0) {
this._targetEditor.revealLine(lineNumber, scrollType);
}
revealLineInCenter(lineNumber, scrollType = 0) {
this._targetEditor.revealLineInCenter(lineNumber, scrollType);
}
revealLineInCenterIfOutsideViewport(lineNumber, scrollType = 0) {
this._targetEditor.revealLineInCenterIfOutsideViewport(lineNumber, scrollType);
}
revealLineNearTop(lineNumber, scrollType = 0) {
this._targetEditor.revealLineNearTop(lineNumber, scrollType);
}
revealPosition(position, scrollType = 0) {
this._targetEditor.revealPosition(position, scrollType);
}
revealPositionInCenter(position, scrollType = 0) {
this._targetEditor.revealPositionInCenter(position, scrollType);
}
revealPositionInCenterIfOutsideViewport(position, scrollType = 0) {
this._targetEditor.revealPositionInCenterIfOutsideViewport(position, scrollType);
}
revealPositionNearTop(position, scrollType = 0) {
this._targetEditor.revealPositionNearTop(position, scrollType);
}
getSelection() {
return this._targetEditor.getSelection();
}
getSelections() {
return this._targetEditor.getSelections();
}
setSelection(something, source = "api") {
this._targetEditor.setSelection(something, source);
}
setSelections(ranges, source = "api") {
this._targetEditor.setSelections(ranges, source);
}
revealLines(startLineNumber, endLineNumber, scrollType = 0) {
this._targetEditor.revealLines(startLineNumber, endLineNumber, scrollType);
}
revealLinesInCenter(startLineNumber, endLineNumber, scrollType = 0) {
this._targetEditor.revealLinesInCenter(startLineNumber, endLineNumber, scrollType);
}
revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType = 0) {
this._targetEditor.revealLinesInCenterIfOutsideViewport(startLineNumber, endLineNumber, scrollType);
}
revealLinesNearTop(startLineNumber, endLineNumber, scrollType = 0) {
this._targetEditor.revealLinesNearTop(startLineNumber, endLineNumber, scrollType);
}
revealRange(range2, scrollType = 0, revealVerticalInCenter = false, revealHorizontal = true) {
this._targetEditor.revealRange(range2, scrollType, revealVerticalInCenter, revealHorizontal);
}
revealRangeInCenter(range2, scrollType = 0) {
this._targetEditor.revealRangeInCenter(range2, scrollType);
}
revealRangeInCenterIfOutsideViewport(range2, scrollType = 0) {
this._targetEditor.revealRangeInCenterIfOutsideViewport(range2, scrollType);
}
revealRangeNearTop(range2, scrollType = 0) {
this._targetEditor.revealRangeNearTop(range2, scrollType);
}
revealRangeNearTopIfOutsideViewport(range2, scrollType = 0) {
this._targetEditor.revealRangeNearTopIfOutsideViewport(range2, scrollType);
}
revealRangeAtTop(range2, scrollType = 0) {
this._targetEditor.revealRangeAtTop(range2, scrollType);
}
getSupportedActions() {
return this._targetEditor.getSupportedActions();
}
focus() {
this._targetEditor.focus();
}
trigger(source, handlerId, payload) {
this._targetEditor.trigger(source, handlerId, payload);
}
createDecorationsCollection(decorations) {
return this._targetEditor.createDecorationsCollection(decorations);
}
changeDecorations(callback) {
return this._targetEditor.changeDecorations(callback);
}
};
DelegatingEditor.idCounter = 0;
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js
function validateDiffEditorOptions(options2, defaults) {
var _a10, _b4, _c2, _d2, _e2, _f3, _g2, _h2;
return {
enableSplitViewResizing: boolean(options2.enableSplitViewResizing, defaults.enableSplitViewResizing),
splitViewDefaultRatio: clampedFloat(options2.splitViewDefaultRatio, 0.5, 0.1, 0.9),
renderSideBySide: boolean(options2.renderSideBySide, defaults.renderSideBySide),
renderMarginRevertIcon: boolean(options2.renderMarginRevertIcon, defaults.renderMarginRevertIcon),
maxComputationTime: clampedInt(
options2.maxComputationTime,
defaults.maxComputationTime,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
),
maxFileSize: clampedInt(
options2.maxFileSize,
defaults.maxFileSize,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
),
ignoreTrimWhitespace: boolean(options2.ignoreTrimWhitespace, defaults.ignoreTrimWhitespace),
renderIndicators: boolean(options2.renderIndicators, defaults.renderIndicators),
originalEditable: boolean(options2.originalEditable, defaults.originalEditable),
diffCodeLens: boolean(options2.diffCodeLens, defaults.diffCodeLens),
renderOverviewRuler: boolean(options2.renderOverviewRuler, defaults.renderOverviewRuler),
diffWordWrap: stringSet(options2.diffWordWrap, defaults.diffWordWrap, ["off", "on", "inherit"]),
diffAlgorithm: stringSet(options2.diffAlgorithm, defaults.diffAlgorithm, ["legacy", "advanced"], { "smart": "legacy", "experimental": "advanced" }),
accessibilityVerbose: boolean(options2.accessibilityVerbose, defaults.accessibilityVerbose),
experimental: {
showMoves: boolean((_a10 = options2.experimental) === null || _a10 === void 0 ? void 0 : _a10.showMoves, defaults.experimental.showMoves),
showEmptyDecorations: boolean((_b4 = options2.experimental) === null || _b4 === void 0 ? void 0 : _b4.showEmptyDecorations, defaults.experimental.showEmptyDecorations)
},
hideUnchangedRegions: {
enabled: boolean((_d2 = (_c2 = options2.hideUnchangedRegions) === null || _c2 === void 0 ? void 0 : _c2.enabled) !== null && _d2 !== void 0 ? _d2 : (_e2 = options2.experimental) === null || _e2 === void 0 ? void 0 : _e2.collapseUnchangedRegions, defaults.hideUnchangedRegions.enabled),
contextLineCount: clampedInt(
(_f3 = options2.hideUnchangedRegions) === null || _f3 === void 0 ? void 0 : _f3.contextLineCount,
defaults.hideUnchangedRegions.contextLineCount,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
),
minimumLineCount: clampedInt(
(_g2 = options2.hideUnchangedRegions) === null || _g2 === void 0 ? void 0 : _g2.minimumLineCount,
defaults.hideUnchangedRegions.minimumLineCount,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
),
revealLineCount: clampedInt(
(_h2 = options2.hideUnchangedRegions) === null || _h2 === void 0 ? void 0 : _h2.revealLineCount,
defaults.hideUnchangedRegions.revealLineCount,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
)
},
isInEmbeddedEditor: boolean(options2.isInEmbeddedEditor, defaults.isInEmbeddedEditor),
onlyShowAccessibleDiffViewer: boolean(options2.onlyShowAccessibleDiffViewer, defaults.onlyShowAccessibleDiffViewer),
renderSideBySideInlineBreakpoint: clampedInt(
options2.renderSideBySideInlineBreakpoint,
defaults.renderSideBySideInlineBreakpoint,
0,
1073741824
/* Constants.MAX_SAFE_SMALL_INTEGER */
),
useInlineViewWhenSpaceIsLimited: boolean(options2.useInlineViewWhenSpaceIsLimited, defaults.useInlineViewWhenSpaceIsLimited),
renderGutterMenu: boolean(options2.renderGutterMenu, defaults.renderGutterMenu)
};
}
var __decorate57, __param51, DiffEditorOptions;
var init_diffEditorOptions = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js"() {
init_observable();
init_diffEditor();
init_editorOptions();
init_accessibility();
__decorate57 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param51 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DiffEditorOptions = class DiffEditorOptions2 {
get editorOptions() {
return this._options;
}
constructor(options2, _accessibilityService) {
this._accessibilityService = _accessibilityService;
this._diffEditorWidth = observableValue(this, 0);
this._screenReaderMode = observableFromEvent(this._accessibilityService.onDidChangeScreenReaderOptimized, () => this._accessibilityService.isScreenReaderOptimized());
this.couldShowInlineViewBecauseOfSize = derived(this, (reader) => this._options.read(reader).renderSideBySide && this._diffEditorWidth.read(reader) <= this._options.read(reader).renderSideBySideInlineBreakpoint);
this.renderOverviewRuler = derived(this, (reader) => this._options.read(reader).renderOverviewRuler);
this.renderSideBySide = derived(this, (reader) => this._options.read(reader).renderSideBySide && !(this._options.read(reader).useInlineViewWhenSpaceIsLimited && this.couldShowInlineViewBecauseOfSize.read(reader) && !this._screenReaderMode.read(reader)));
this.readOnly = derived(this, (reader) => this._options.read(reader).readOnly);
this.shouldRenderOldRevertArrows = derived(this, (reader) => {
if (!this._options.read(reader).renderMarginRevertIcon) {
return false;
}
if (!this.renderSideBySide.read(reader)) {
return false;
}
if (this.readOnly.read(reader)) {
return false;
}
if (this.shouldRenderGutterMenu.read(reader)) {
return false;
}
return true;
});
this.shouldRenderGutterMenu = derived(this, (reader) => this._options.read(reader).renderGutterMenu);
this.renderIndicators = derived(this, (reader) => this._options.read(reader).renderIndicators);
this.enableSplitViewResizing = derived(this, (reader) => this._options.read(reader).enableSplitViewResizing);
this.splitViewDefaultRatio = derived(this, (reader) => this._options.read(reader).splitViewDefaultRatio);
this.ignoreTrimWhitespace = derived(this, (reader) => this._options.read(reader).ignoreTrimWhitespace);
this.maxComputationTimeMs = derived(this, (reader) => this._options.read(reader).maxComputationTime);
this.showMoves = derived(this, (reader) => this._options.read(reader).experimental.showMoves && this.renderSideBySide.read(reader));
this.isInEmbeddedEditor = derived(this, (reader) => this._options.read(reader).isInEmbeddedEditor);
this.diffWordWrap = derived(this, (reader) => this._options.read(reader).diffWordWrap);
this.originalEditable = derived(this, (reader) => this._options.read(reader).originalEditable);
this.diffCodeLens = derived(this, (reader) => this._options.read(reader).diffCodeLens);
this.accessibilityVerbose = derived(this, (reader) => this._options.read(reader).accessibilityVerbose);
this.diffAlgorithm = derived(this, (reader) => this._options.read(reader).diffAlgorithm);
this.showEmptyDecorations = derived(this, (reader) => this._options.read(reader).experimental.showEmptyDecorations);
this.onlyShowAccessibleDiffViewer = derived(this, (reader) => this._options.read(reader).onlyShowAccessibleDiffViewer);
this.hideUnchangedRegions = derived(this, (reader) => this._options.read(reader).hideUnchangedRegions.enabled);
this.hideUnchangedRegionsRevealLineCount = derived(this, (reader) => this._options.read(reader).hideUnchangedRegions.revealLineCount);
this.hideUnchangedRegionsContextLineCount = derived(this, (reader) => this._options.read(reader).hideUnchangedRegions.contextLineCount);
this.hideUnchangedRegionsMinimumLineCount = derived(this, (reader) => this._options.read(reader).hideUnchangedRegions.minimumLineCount);
const optionsCopy = __spreadValues(__spreadValues({}, options2), validateDiffEditorOptions(options2, diffEditorDefaultOptions));
this._options = observableValue(this, optionsCopy);
}
updateOptions(changedOptions) {
const newDiffEditorOptions = validateDiffEditorOptions(changedOptions, this._options.get());
const newOptions = __spreadValues(__spreadValues(__spreadValues({}, this._options.get()), changedOptions), newDiffEditorOptions);
this._options.set(newOptions, void 0, { changedOptions });
}
setWidth(width2) {
this._diffEditorWidth.set(width2, void 0);
}
};
DiffEditorOptions = __decorate57([
__param51(1, IAccessibilityService)
], DiffEditorOptions);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js
function toLineChanges(state) {
return state.mappings.map((x) => {
const m = x.lineRangeMapping;
let originalStartLineNumber;
let originalEndLineNumber;
let modifiedStartLineNumber;
let modifiedEndLineNumber;
let innerChanges = m.innerChanges;
if (m.original.isEmpty) {
originalStartLineNumber = m.original.startLineNumber - 1;
originalEndLineNumber = 0;
innerChanges = void 0;
} else {
originalStartLineNumber = m.original.startLineNumber;
originalEndLineNumber = m.original.endLineNumberExclusive - 1;
}
if (m.modified.isEmpty) {
modifiedStartLineNumber = m.modified.startLineNumber - 1;
modifiedEndLineNumber = 0;
innerChanges = void 0;
} else {
modifiedStartLineNumber = m.modified.startLineNumber;
modifiedEndLineNumber = m.modified.endLineNumberExclusive - 1;
}
return {
originalStartLineNumber,
originalEndLineNumber,
modifiedStartLineNumber,
modifiedEndLineNumber,
charChanges: innerChanges === null || innerChanges === void 0 ? void 0 : innerChanges.map((m2) => ({
originalStartLineNumber: m2.originalRange.startLineNumber,
originalStartColumn: m2.originalRange.startColumn,
originalEndLineNumber: m2.originalRange.endLineNumber,
originalEndColumn: m2.originalRange.endColumn,
modifiedStartLineNumber: m2.modifiedRange.startLineNumber,
modifiedStartColumn: m2.modifiedRange.startColumn,
modifiedEndLineNumber: m2.modifiedRange.endLineNumber,
modifiedEndColumn: m2.modifiedRange.endColumn
}))
};
});
}
var __decorate58, __param52, DiffEditorWidget;
var init_diffEditorWidget = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js"() {
init_dom();
init_arraysFind();
init_errors();
init_event();
init_lifecycle();
init_observable();
init_derived();
init_style();
init_editorExtensions();
init_codeEditorService();
init_stableEditorScroll();
init_codeEditorWidget();
init_accessibleDiffViewer2();
init_diffEditorDecorations();
init_diffEditorSash();
init_diffEditorViewZones();
init_gutterFeature();
init_hideUnchangedRegionsFeature();
init_movedBlocksLinesFeature();
init_overviewRulerFeature();
init_revertButtonsFeature();
init_utils4();
init_platformObservableUtils();
init_position();
init_range();
init_editorCommon();
init_editorContextKeys();
init_accessibilitySignalService();
init_contextkey();
init_instantiation();
init_serviceCollection();
init_progress();
init_diffEditorEditors();
init_delegatingEditorImpl();
init_diffEditorOptions();
init_diffEditorViewModel();
__decorate58 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param52 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
DiffEditorWidget = class DiffEditorWidget2 extends DelegatingEditor {
get onDidContentSizeChange() {
return this._editors.onDidContentSizeChange;
}
constructor(_domElement, options2, codeEditorWidgetOptions, _parentContextKeyService, _parentInstantiationService, codeEditorService, _accessibilitySignalService, _editorProgressService) {
var _a10;
super();
this._domElement = _domElement;
this._parentContextKeyService = _parentContextKeyService;
this._parentInstantiationService = _parentInstantiationService;
this._accessibilitySignalService = _accessibilitySignalService;
this._editorProgressService = _editorProgressService;
this.elements = h("div.monaco-diff-editor.side-by-side", { style: { position: "relative", height: "100%" } }, [
h("div.editor.original@original", { style: { position: "absolute", height: "100%" } }),
h("div.editor.modified@modified", { style: { position: "absolute", height: "100%" } }),
h("div.accessibleDiffViewer@accessibleDiffViewer", { style: { position: "absolute", height: "100%" } })
]);
this._diffModel = observableValue(this, void 0);
this._shouldDisposeDiffModel = false;
this.onDidChangeModel = Event.fromObservableLight(this._diffModel);
this._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._domElement));
this._instantiationService = this._register(this._parentInstantiationService.createChild(new ServiceCollection([IContextKeyService, this._contextKeyService])));
this._boundarySashes = observableValue(this, void 0);
this._accessibleDiffViewerShouldBeVisible = observableValue(this, false);
this._accessibleDiffViewerVisible = derived(this, (reader) => this._options.onlyShowAccessibleDiffViewer.read(reader) ? true : this._accessibleDiffViewerShouldBeVisible.read(reader));
this._movedBlocksLinesPart = observableValue(this, void 0);
this._layoutInfo = derived(this, (reader) => {
var _a11, _b4, _c2, _d2, _e2;
const fullWidth = this._rootSizeObserver.width.read(reader);
const fullHeight = this._rootSizeObserver.height.read(reader);
if (this._rootSizeObserver.automaticLayout) {
this.elements.root.style.height = "100%";
} else {
this.elements.root.style.height = fullHeight + "px";
}
const sash = this._sash.read(reader);
const gutter = this._gutter.read(reader);
const gutterWidth = (_a11 = gutter === null || gutter === void 0 ? void 0 : gutter.width.read(reader)) !== null && _a11 !== void 0 ? _a11 : 0;
const overviewRulerPartWidth = (_c2 = (_b4 = this._overviewRulerPart.read(reader)) === null || _b4 === void 0 ? void 0 : _b4.width) !== null && _c2 !== void 0 ? _c2 : 0;
let originalLeft, originalWidth, modifiedLeft, modifiedWidth, gutterLeft;
const sideBySide = !!sash;
if (sideBySide) {
const sashLeft = sash.sashLeft.read(reader);
const movedBlocksLinesWidth = (_e2 = (_d2 = this._movedBlocksLinesPart.read(reader)) === null || _d2 === void 0 ? void 0 : _d2.width.read(reader)) !== null && _e2 !== void 0 ? _e2 : 0;
originalLeft = 0;
originalWidth = sashLeft - gutterWidth - movedBlocksLinesWidth;
gutterLeft = sashLeft - gutterWidth;
modifiedLeft = sashLeft;
modifiedWidth = fullWidth - modifiedLeft - overviewRulerPartWidth;
} else {
gutterLeft = 0;
originalLeft = gutterWidth;
originalWidth = Math.max(5, this._editors.original.getLayoutInfo().decorationsLeft);
modifiedLeft = gutterWidth + originalWidth;
modifiedWidth = fullWidth - modifiedLeft - overviewRulerPartWidth;
}
this.elements.original.style.left = originalLeft + "px";
this.elements.original.style.width = originalWidth + "px";
this._editors.original.layout({ width: originalWidth, height: fullHeight }, true);
gutter === null || gutter === void 0 ? void 0 : gutter.layout(gutterLeft);
this.elements.modified.style.left = modifiedLeft + "px";
this.elements.modified.style.width = modifiedWidth + "px";
this._editors.modified.layout({ width: modifiedWidth, height: fullHeight }, true);
return {
modifiedEditor: this._editors.modified.getLayoutInfo(),
originalEditor: this._editors.original.getLayoutInfo()
};
});
this._diffValue = this._diffModel.map((m, r) => m === null || m === void 0 ? void 0 : m.diff.read(r));
this.onDidUpdateDiff = Event.fromObservableLight(this._diffValue);
codeEditorService.willCreateDiffEditor();
this._contextKeyService.createKey("isInDiffEditor", true);
this._domElement.appendChild(this.elements.root);
this._register(toDisposable(() => this._domElement.removeChild(this.elements.root)));
this._rootSizeObserver = this._register(new ObservableElementSizeObserver(this.elements.root, options2.dimension));
this._rootSizeObserver.setAutomaticLayout((_a10 = options2.automaticLayout) !== null && _a10 !== void 0 ? _a10 : false);
this._options = this._instantiationService.createInstance(DiffEditorOptions, options2);
this._register(autorun((reader) => {
this._options.setWidth(this._rootSizeObserver.width.read(reader));
}));
this._contextKeyService.createKey(EditorContextKeys.isEmbeddedDiffEditor.key, false);
this._register(bindContextKey(EditorContextKeys.isEmbeddedDiffEditor, this._contextKeyService, (reader) => this._options.isInEmbeddedEditor.read(reader)));
this._register(bindContextKey(EditorContextKeys.comparingMovedCode, this._contextKeyService, (reader) => {
var _a11;
return !!((_a11 = this._diffModel.read(reader)) === null || _a11 === void 0 ? void 0 : _a11.movedTextToCompare.read(reader));
}));
this._register(bindContextKey(EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached, this._contextKeyService, (reader) => this._options.couldShowInlineViewBecauseOfSize.read(reader)));
this._register(bindContextKey(EditorContextKeys.diffEditorInlineMode, this._contextKeyService, (reader) => !this._options.renderSideBySide.read(reader)));
this._register(bindContextKey(EditorContextKeys.hasChanges, this._contextKeyService, (reader) => {
var _a11, _b4, _c2;
return ((_c2 = (_b4 = (_a11 = this._diffModel.read(reader)) === null || _a11 === void 0 ? void 0 : _a11.diff.read(reader)) === null || _b4 === void 0 ? void 0 : _b4.mappings.length) !== null && _c2 !== void 0 ? _c2 : 0) > 0;
}));
this._editors = this._register(this._instantiationService.createInstance(DiffEditorEditors, this.elements.original, this.elements.modified, this._options, codeEditorWidgetOptions, (i, c, o, o2) => this._createInnerEditor(i, c, o, o2)));
this._register(bindContextKey(EditorContextKeys.diffEditorOriginalWritable, this._contextKeyService, (reader) => this._options.originalEditable.read(reader)));
this._register(bindContextKey(EditorContextKeys.diffEditorModifiedWritable, this._contextKeyService, (reader) => !this._options.readOnly.read(reader)));
this._register(bindContextKey(EditorContextKeys.diffEditorOriginalUri, this._contextKeyService, (reader) => {
var _a11, _b4;
return (_b4 = (_a11 = this._diffModel.read(reader)) === null || _a11 === void 0 ? void 0 : _a11.model.original.uri.toString()) !== null && _b4 !== void 0 ? _b4 : "";
}));
this._register(bindContextKey(EditorContextKeys.diffEditorModifiedUri, this._contextKeyService, (reader) => {
var _a11, _b4;
return (_b4 = (_a11 = this._diffModel.read(reader)) === null || _a11 === void 0 ? void 0 : _a11.model.modified.uri.toString()) !== null && _b4 !== void 0 ? _b4 : "";
}));
this._overviewRulerPart = derivedDisposable(this, (reader) => !this._options.renderOverviewRuler.read(reader) ? void 0 : this._instantiationService.createInstance(readHotReloadableExport(OverviewRulerFeature, reader), this._editors, this.elements.root, this._diffModel, this._rootSizeObserver.width, this._rootSizeObserver.height, this._layoutInfo.map((i) => i.modifiedEditor))).recomputeInitiallyAndOnChange(this._store);
const dimensions = {
height: this._rootSizeObserver.height,
width: this._rootSizeObserver.width.map((w, reader) => {
var _a11, _b4;
return w - ((_b4 = (_a11 = this._overviewRulerPart.read(reader)) === null || _a11 === void 0 ? void 0 : _a11.width) !== null && _b4 !== void 0 ? _b4 : 0);
})
};
this._sashLayout = new SashLayout(this._options, dimensions);
this._sash = derivedDisposable(this, (reader) => {
const showSash = this._options.renderSideBySide.read(reader);
this.elements.root.classList.toggle("side-by-side", showSash);
return !showSash ? void 0 : new DiffEditorSash(this.elements.root, dimensions, this._options.enableSplitViewResizing, this._boundarySashes, this._sashLayout.sashLeft, () => this._sashLayout.resetSash());
}).recomputeInitiallyAndOnChange(this._store);
const unchangedRangesFeature = derivedDisposable(this, (reader) => (
/** @description UnchangedRangesFeature */
this._instantiationService.createInstance(readHotReloadableExport(HideUnchangedRegionsFeature, reader), this._editors, this._diffModel, this._options)
)).recomputeInitiallyAndOnChange(this._store);
derivedDisposable(this, (reader) => (
/** @description DiffEditorDecorations */
this._instantiationService.createInstance(readHotReloadableExport(DiffEditorDecorations, reader), this._editors, this._diffModel, this._options, this)
)).recomputeInitiallyAndOnChange(this._store);
const origViewZoneIdsToIgnore = /* @__PURE__ */ new Set();
const modViewZoneIdsToIgnore = /* @__PURE__ */ new Set();
let isUpdatingViewZones = false;
const viewZoneManager = derivedDisposable(this, (reader) => (
/** @description ViewZoneManager */
this._instantiationService.createInstance(readHotReloadableExport(DiffEditorViewZones, reader), getWindow(this._domElement), this._editors, this._diffModel, this._options, this, () => isUpdatingViewZones || unchangedRangesFeature.get().isUpdatingHiddenAreas, origViewZoneIdsToIgnore, modViewZoneIdsToIgnore)
)).recomputeInitiallyAndOnChange(this._store);
const originalViewZones = derived(this, (reader) => {
const orig = viewZoneManager.read(reader).viewZones.read(reader).orig;
const orig2 = unchangedRangesFeature.read(reader).viewZones.read(reader).origViewZones;
return orig.concat(orig2);
});
const modifiedViewZones = derived(this, (reader) => {
const mod = viewZoneManager.read(reader).viewZones.read(reader).mod;
const mod2 = unchangedRangesFeature.read(reader).viewZones.read(reader).modViewZones;
return mod.concat(mod2);
});
this._register(applyViewZones(this._editors.original, originalViewZones, (isUpdatingOrigViewZones) => {
isUpdatingViewZones = isUpdatingOrigViewZones;
}, origViewZoneIdsToIgnore));
let scrollState;
this._register(applyViewZones(this._editors.modified, modifiedViewZones, (isUpdatingModViewZones) => {
isUpdatingViewZones = isUpdatingModViewZones;
if (isUpdatingViewZones) {
scrollState = StableEditorScrollState.capture(this._editors.modified);
} else {
scrollState === null || scrollState === void 0 ? void 0 : scrollState.restore(this._editors.modified);
scrollState = void 0;
}
}, modViewZoneIdsToIgnore));
this._accessibleDiffViewer = derivedDisposable(this, (reader) => this._instantiationService.createInstance(readHotReloadableExport(AccessibleDiffViewer, reader), this.elements.accessibleDiffViewer, this._accessibleDiffViewerVisible, (visible, tx) => this._accessibleDiffViewerShouldBeVisible.set(visible, tx), this._options.onlyShowAccessibleDiffViewer.map((v) => !v), this._rootSizeObserver.width, this._rootSizeObserver.height, this._diffModel.map((m, r) => {
var _a11;
return (_a11 = m === null || m === void 0 ? void 0 : m.diff.read(r)) === null || _a11 === void 0 ? void 0 : _a11.mappings.map((m2) => m2.lineRangeMapping);
}), new AccessibleDiffViewerModelFromEditors(this._editors))).recomputeInitiallyAndOnChange(this._store);
const visibility = this._accessibleDiffViewerVisible.map((v) => v ? "hidden" : "visible");
this._register(applyStyle(this.elements.modified, { visibility }));
this._register(applyStyle(this.elements.original, { visibility }));
this._createDiffEditorContributions();
codeEditorService.addDiffEditor(this);
this._gutter = derivedDisposable(this, (reader) => {
return this._options.shouldRenderGutterMenu.read(reader) ? this._instantiationService.createInstance(readHotReloadableExport(DiffEditorGutter, reader), this.elements.root, this._diffModel, this._editors, this._options, this._sashLayout, this._boundarySashes) : void 0;
});
this._register(recomputeInitiallyAndOnChange(this._layoutInfo));
derivedDisposable(this, (reader) => (
/** @description MovedBlocksLinesPart */
new (readHotReloadableExport(MovedBlocksLinesFeature, reader))(this.elements.root, this._diffModel, this._layoutInfo.map((i) => i.originalEditor), this._layoutInfo.map((i) => i.modifiedEditor), this._editors)
)).recomputeInitiallyAndOnChange(this._store, (value) => {
this._movedBlocksLinesPart.set(value, void 0);
});
this._register(Event.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition, (e) => this._handleCursorPositionChange(e, true)));
this._register(Event.runAndSubscribe(this._editors.original.onDidChangeCursorPosition, (e) => this._handleCursorPositionChange(e, false)));
const isInitializingDiff = this._diffModel.map(this, (m, reader) => {
if (!m) {
return void 0;
}
return m.diff.read(reader) === void 0 && !m.isDiffUpToDate.read(reader);
});
this._register(autorunWithStore((reader, store) => {
if (isInitializingDiff.read(reader) === true) {
const r = this._editorProgressService.show(true, 1e3);
store.add(toDisposable(() => r.done()));
}
}));
this._register(toDisposable(() => {
var _a11;
if (this._shouldDisposeDiffModel) {
(_a11 = this._diffModel.get()) === null || _a11 === void 0 ? void 0 : _a11.dispose();
}
}));
this._register(autorunWithStore((reader, store) => {
store.add(new (readHotReloadableExport(RevertButtonsFeature, reader))(this._editors, this._diffModel, this._options, this));
}));
}
_createInnerEditor(instantiationService, container, options2, editorWidgetOptions) {
const editor2 = instantiationService.createInstance(CodeEditorWidget, container, options2, editorWidgetOptions);
return editor2;
}
_createDiffEditorContributions() {
const contributions = EditorExtensionsRegistry.getDiffEditorContributions();
for (const desc of contributions) {
try {
this._register(this._instantiationService.createInstance(desc.ctor, this));
} catch (err) {
onUnexpectedError(err);
}
}
}
get _targetEditor() {
return this._editors.modified;
}
getEditorType() {
return EditorType.IDiffEditor;
}
layout(dimension) {
this._rootSizeObserver.observe(dimension);
}
hasTextFocus() {
return this._editors.original.hasTextFocus() || this._editors.modified.hasTextFocus();
}
saveViewState() {
var _a10;
const originalViewState = this._editors.original.saveViewState();
const modifiedViewState = this._editors.modified.saveViewState();
return {
original: originalViewState,
modified: modifiedViewState,
modelState: (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.serializeState()
};
}
restoreViewState(s) {
var _a10;
if (s && s.original && s.modified) {
const diffEditorState = s;
this._editors.original.restoreViewState(diffEditorState.original);
this._editors.modified.restoreViewState(diffEditorState.modified);
if (diffEditorState.modelState) {
(_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.restoreSerializedState(diffEditorState.modelState);
}
}
}
handleInitialized() {
this._editors.original.handleInitialized();
this._editors.modified.handleInitialized();
}
createViewModel(model) {
return this._instantiationService.createInstance(DiffEditorViewModel, model, this._options);
}
getModel() {
var _a10, _b4;
return (_b4 = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.model) !== null && _b4 !== void 0 ? _b4 : null;
}
setModel(model, tx) {
if (!model && this._diffModel.get()) {
this._accessibleDiffViewer.get().close();
}
const vm = model ? "model" in model ? { model, shouldDispose: false } : { model: this.createViewModel(model), shouldDispose: true } : void 0;
if (this._diffModel.get() !== (vm === null || vm === void 0 ? void 0 : vm.model)) {
subtransaction(tx, (tx2) => {
var _a10;
observableFromEvent.batchEventsGlobally(tx2, () => {
this._editors.original.setModel(vm ? vm.model.model.original : null);
this._editors.modified.setModel(vm ? vm.model.model.modified : null);
});
const prevValue = this._diffModel.get();
const shouldDispose = this._shouldDisposeDiffModel;
this._shouldDisposeDiffModel = (_a10 = vm === null || vm === void 0 ? void 0 : vm.shouldDispose) !== null && _a10 !== void 0 ? _a10 : false;
this._diffModel.set(vm === null || vm === void 0 ? void 0 : vm.model, tx2);
if (shouldDispose) {
prevValue === null || prevValue === void 0 ? void 0 : prevValue.dispose();
}
});
}
}
/**
* @param changedOptions Only has values for top-level options that have actually changed.
*/
updateOptions(changedOptions) {
this._options.updateOptions(changedOptions);
}
getContainerDomNode() {
return this._domElement;
}
getOriginalEditor() {
return this._editors.original;
}
getModifiedEditor() {
return this._editors.modified;
}
/**
* @deprecated Use `this.getDiffComputationResult().changes2` instead.
*/
getLineChanges() {
var _a10;
const diffState = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.diff.get();
if (!diffState) {
return null;
}
return toLineChanges(diffState);
}
revert(diff) {
const model = this._diffModel.get();
if (!model || !model.isDiffUpToDate.get()) {
return;
}
this._editors.modified.executeEdits("diffEditor", [
{
range: diff.modified.toExclusiveRange(),
text: model.model.original.getValueInRange(diff.original.toExclusiveRange())
}
]);
}
revertRangeMappings(diffs) {
const model = this._diffModel.get();
if (!model || !model.isDiffUpToDate.get()) {
return;
}
const changes = diffs.map((c) => ({
range: c.modifiedRange,
text: model.model.original.getValueInRange(c.originalRange)
}));
this._editors.modified.executeEdits("diffEditor", changes);
}
_goTo(diff) {
this._editors.modified.setPosition(new Position(diff.lineRangeMapping.modified.startLineNumber, 1));
this._editors.modified.revealRangeInCenter(diff.lineRangeMapping.modified.toExclusiveRange());
}
goToDiff(target) {
var _a10, _b4, _c2, _d2;
const diffs = (_b4 = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.diff.get()) === null || _b4 === void 0 ? void 0 : _b4.mappings;
if (!diffs || diffs.length === 0) {
return;
}
const curLineNumber = this._editors.modified.getPosition().lineNumber;
let diff;
if (target === "next") {
diff = (_c2 = diffs.find((d) => d.lineRangeMapping.modified.startLineNumber > curLineNumber)) !== null && _c2 !== void 0 ? _c2 : diffs[0];
} else {
diff = (_d2 = findLast(diffs, (d) => d.lineRangeMapping.modified.startLineNumber < curLineNumber)) !== null && _d2 !== void 0 ? _d2 : diffs[diffs.length - 1];
}
this._goTo(diff);
if (diff.lineRangeMapping.modified.isEmpty) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineDeleted, { source: "diffEditor.goToDiff" });
} else if (diff.lineRangeMapping.original.isEmpty) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineInserted, { source: "diffEditor.goToDiff" });
} else if (diff) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineModified, { source: "diffEditor.goToDiff" });
}
}
revealFirstDiff() {
const diffModel = this._diffModel.get();
if (!diffModel) {
return;
}
this.waitForDiff().then(() => {
var _a10;
const diffs = (_a10 = diffModel.diff.get()) === null || _a10 === void 0 ? void 0 : _a10.mappings;
if (!diffs || diffs.length === 0) {
return;
}
this._goTo(diffs[0]);
});
}
accessibleDiffViewerNext() {
this._accessibleDiffViewer.get().next();
}
accessibleDiffViewerPrev() {
this._accessibleDiffViewer.get().prev();
}
waitForDiff() {
return __async(this, null, function* () {
const diffModel = this._diffModel.get();
if (!diffModel) {
return;
}
yield diffModel.waitForDiff();
});
}
mapToOtherSide() {
var _a10, _b4;
const isModifiedFocus = this._editors.modified.hasWidgetFocus();
const source = isModifiedFocus ? this._editors.modified : this._editors.original;
const destination = isModifiedFocus ? this._editors.original : this._editors.modified;
let destinationSelection;
const sourceSelection = source.getSelection();
if (sourceSelection) {
const mappings = (_b4 = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.diff.get()) === null || _b4 === void 0 ? void 0 : _b4.mappings.map((m) => isModifiedFocus ? m.lineRangeMapping.flip() : m.lineRangeMapping);
if (mappings) {
const newRange1 = translatePosition(sourceSelection.getStartPosition(), mappings);
const newRange2 = translatePosition(sourceSelection.getEndPosition(), mappings);
destinationSelection = Range.plusRange(newRange1, newRange2);
}
}
return { destination, destinationSelection };
}
switchSide() {
const { destination, destinationSelection } = this.mapToOtherSide();
destination.focus();
if (destinationSelection) {
destination.setSelection(destinationSelection);
}
}
exitCompareMove() {
const model = this._diffModel.get();
if (!model) {
return;
}
model.movedTextToCompare.set(void 0, void 0);
}
collapseAllUnchangedRegions() {
var _a10;
const unchangedRegions = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.unchangedRegions.get();
if (!unchangedRegions) {
return;
}
transaction((tx) => {
for (const region of unchangedRegions) {
region.collapseAll(tx);
}
});
}
showAllUnchangedRegions() {
var _a10;
const unchangedRegions = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.unchangedRegions.get();
if (!unchangedRegions) {
return;
}
transaction((tx) => {
for (const region of unchangedRegions) {
region.showAll(tx);
}
});
}
_handleCursorPositionChange(e, isModifiedEditor) {
var _a10, _b4;
if ((e === null || e === void 0 ? void 0 : e.reason) === 3) {
const diff = (_b4 = (_a10 = this._diffModel.get()) === null || _a10 === void 0 ? void 0 : _a10.diff.get()) === null || _b4 === void 0 ? void 0 : _b4.mappings.find((m) => isModifiedEditor ? m.lineRangeMapping.modified.contains(e.position.lineNumber) : m.lineRangeMapping.original.contains(e.position.lineNumber));
if (diff === null || diff === void 0 ? void 0 : diff.lineRangeMapping.modified.isEmpty) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineDeleted, { source: "diffEditor.cursorPositionChanged" });
} else if (diff === null || diff === void 0 ? void 0 : diff.lineRangeMapping.original.isEmpty) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineInserted, { source: "diffEditor.cursorPositionChanged" });
} else if (diff) {
this._accessibilitySignalService.playSignal(AccessibilitySignal.diffLineModified, { source: "diffEditor.cursorPositionChanged" });
}
}
}
};
DiffEditorWidget = __decorate58([
__param52(3, IContextKeyService),
__param52(4, IInstantiationService),
__param52(5, ICodeEditorService),
__param52(6, IAccessibilitySignalService),
__param52(7, IEditorProgressService)
], DiffEditorWidget);
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js
function createAriaDomNode(parent) {
if (!parent) {
if (ariaDomNodeCreated) {
return;
}
ariaDomNodeCreated = true;
}
setARIAContainer(parent || mainWindow.document.body);
}
function createTextModel(modelService, languageService, value, languageId, uri) {
value = value || "";
if (!languageId) {
const firstLF = value.indexOf("\n");
let firstLine = value;
if (firstLF !== -1) {
firstLine = value.substring(0, firstLF);
}
return doCreateModel(modelService, value, languageService.createByFilepathOrFirstLine(uri || null, firstLine), uri);
}
return doCreateModel(modelService, value, languageService.createById(languageId), uri);
}
function doCreateModel(modelService, value, languageSelection, uri) {
return modelService.createModel(value, languageSelection, uri);
}
var __decorate59, __param53, LAST_GENERATED_COMMAND_ID, ariaDomNodeCreated, StandaloneCodeEditor, StandaloneEditor, StandaloneDiffEditor2;
var init_standaloneCodeEditor = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js"() {
init_aria2();
init_lifecycle();
init_codeEditorService();
init_codeEditorWidget();
init_editorAction();
init_standaloneServices();
init_standaloneTheme();
init_actions2();
init_commands();
init_configuration();
init_contextkey();
init_contextView();
init_instantiation();
init_keybinding();
init_notification();
init_themeService();
init_accessibility();
init_standaloneStrings();
init_clipboardService2();
init_progress();
init_model();
init_language();
init_standaloneCodeEditorService();
init_modesRegistry();
init_languageConfigurationRegistry();
init_languageFeatures();
init_diffEditorWidget();
init_accessibilitySignalService();
init_window();
init_hoverDelegateFactory();
init_hover();
init_hoverDelegate2();
__decorate59 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param53 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
LAST_GENERATED_COMMAND_ID = 0;
ariaDomNodeCreated = false;
StandaloneCodeEditor = class StandaloneCodeEditor2 extends CodeEditorWidget {
constructor(domElement, _options, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService) {
const options2 = __spreadValues({}, _options);
options2.ariaLabel = options2.ariaLabel || StandaloneCodeEditorNLS.editorViewAccessibleLabel;
options2.ariaLabel = options2.ariaLabel + ";" + StandaloneCodeEditorNLS.accessibilityHelpMessage;
super(domElement, options2, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = keybindingService;
} else {
this._standaloneKeybindingService = null;
}
createAriaDomNode(options2.ariaContainerElement);
setHoverDelegateFactory((placement, enableInstantHover) => instantiationService.createInstance(WorkbenchHoverDelegate, placement, enableInstantHover, {}));
setBaseLayerHoverDelegate(hoverService);
}
addCommand(keybinding, handler, context) {
if (!this._standaloneKeybindingService) {
console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService");
return null;
}
const commandId = "DYNAMIC_" + ++LAST_GENERATED_COMMAND_ID;
const whenExpression = ContextKeyExpr.deserialize(context);
this._standaloneKeybindingService.addDynamicKeybinding(commandId, keybinding, handler, whenExpression);
return commandId;
}
createContextKey(key, defaultValue) {
return this._contextKeyService.createKey(key, defaultValue);
}
addAction(_descriptor) {
if (typeof _descriptor.id !== "string" || typeof _descriptor.label !== "string" || typeof _descriptor.run !== "function") {
throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");
}
if (!this._standaloneKeybindingService) {
console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");
return Disposable.None;
}
const id = _descriptor.id;
const label = _descriptor.label;
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals("editorId", this.getId()), ContextKeyExpr.deserialize(_descriptor.precondition));
const keybindings = _descriptor.keybindings;
const keybindingsWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(_descriptor.keybindingContext));
const contextMenuGroupId = _descriptor.contextMenuGroupId || null;
const contextMenuOrder = _descriptor.contextMenuOrder || 0;
const run = (_accessor, ...args) => {
return Promise.resolve(_descriptor.run(this, ...args));
};
const toDispose = new DisposableStore();
const uniqueId = this.getId() + ":" + id;
toDispose.add(CommandsRegistry.registerCommand(uniqueId, run));
if (contextMenuGroupId) {
const menuItem = {
command: {
id: uniqueId,
title: label
},
when: precondition,
group: contextMenuGroupId,
order: contextMenuOrder
};
toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));
}
if (Array.isArray(keybindings)) {
for (const kb of keybindings) {
toDispose.add(this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen));
}
}
const internalAction = new InternalEditorAction(uniqueId, label, label, void 0, precondition, (...args) => Promise.resolve(_descriptor.run(this, ...args)), this._contextKeyService);
this._actions.set(id, internalAction);
toDispose.add(toDisposable(() => {
this._actions.delete(id);
}));
return toDispose;
}
_triggerCommand(handlerId, payload) {
if (this._codeEditorService instanceof StandaloneCodeEditorService) {
try {
this._codeEditorService.setActiveCodeEditor(this);
super._triggerCommand(handlerId, payload);
} finally {
this._codeEditorService.setActiveCodeEditor(null);
}
} else {
super._triggerCommand(handlerId, payload);
}
}
};
StandaloneCodeEditor = __decorate59([
__param53(2, IInstantiationService),
__param53(3, ICodeEditorService),
__param53(4, ICommandService),
__param53(5, IContextKeyService),
__param53(6, IHoverService),
__param53(7, IKeybindingService),
__param53(8, IThemeService),
__param53(9, INotificationService),
__param53(10, IAccessibilityService),
__param53(11, ILanguageConfigurationService),
__param53(12, ILanguageFeaturesService)
], StandaloneCodeEditor);
StandaloneEditor = class StandaloneEditor2 extends StandaloneCodeEditor {
constructor(domElement, _options, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, configurationService, accessibilityService, modelService, languageService, languageConfigurationService, languageFeaturesService) {
const options2 = __spreadValues({}, _options);
updateConfigurationService(configurationService, options2, false);
const themeDomRegistration = themeService.registerEditorContainer(domElement);
if (typeof options2.theme === "string") {
themeService.setTheme(options2.theme);
}
if (typeof options2.autoDetectHighContrast !== "undefined") {
themeService.setAutoDetectHighContrast(Boolean(options2.autoDetectHighContrast));
}
const _model = options2.model;
delete options2.model;
super(domElement, options2, instantiationService, codeEditorService, commandService, contextKeyService, hoverService, keybindingService, themeService, notificationService, accessibilityService, languageConfigurationService, languageFeaturesService);
this._configurationService = configurationService;
this._standaloneThemeService = themeService;
this._register(themeDomRegistration);
let model;
if (typeof _model === "undefined") {
const languageId = languageService.getLanguageIdByMimeType(options2.language) || options2.language || PLAINTEXT_LANGUAGE_ID;
model = createTextModel(modelService, languageService, options2.value || "", languageId, void 0);
this._ownsModel = true;
} else {
model = _model;
this._ownsModel = false;
}
this._attachModel(model);
if (model) {
const e = {
oldModelUrl: null,
newModelUrl: model.uri
};
this._onDidChangeModel.fire(e);
}
}
dispose() {
super.dispose();
}
updateOptions(newOptions) {
updateConfigurationService(this._configurationService, newOptions, false);
if (typeof newOptions.theme === "string") {
this._standaloneThemeService.setTheme(newOptions.theme);
}
if (typeof newOptions.autoDetectHighContrast !== "undefined") {
this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));
}
super.updateOptions(newOptions);
}
_postDetachModelCleanup(detachedModel) {
super._postDetachModelCleanup(detachedModel);
if (detachedModel && this._ownsModel) {
detachedModel.dispose();
this._ownsModel = false;
}
}
};
StandaloneEditor = __decorate59([
__param53(2, IInstantiationService),
__param53(3, ICodeEditorService),
__param53(4, ICommandService),
__param53(5, IContextKeyService),
__param53(6, IHoverService),
__param53(7, IKeybindingService),
__param53(8, IStandaloneThemeService),
__param53(9, INotificationService),
__param53(10, IConfigurationService),
__param53(11, IAccessibilityService),
__param53(12, IModelService),
__param53(13, ILanguageService),
__param53(14, ILanguageConfigurationService),
__param53(15, ILanguageFeaturesService)
], StandaloneEditor);
StandaloneDiffEditor2 = class StandaloneDiffEditor22 extends DiffEditorWidget {
constructor(domElement, _options, instantiationService, contextKeyService, codeEditorService, themeService, notificationService, configurationService, contextMenuService, editorProgressService, clipboardService, accessibilitySignalService) {
const options2 = __spreadValues({}, _options);
updateConfigurationService(configurationService, options2, true);
const themeDomRegistration = themeService.registerEditorContainer(domElement);
if (typeof options2.theme === "string") {
themeService.setTheme(options2.theme);
}
if (typeof options2.autoDetectHighContrast !== "undefined") {
themeService.setAutoDetectHighContrast(Boolean(options2.autoDetectHighContrast));
}
super(domElement, options2, {}, contextKeyService, instantiationService, codeEditorService, accessibilitySignalService, editorProgressService);
this._configurationService = configurationService;
this._standaloneThemeService = themeService;
this._register(themeDomRegistration);
}
dispose() {
super.dispose();
}
updateOptions(newOptions) {
updateConfigurationService(this._configurationService, newOptions, true);
if (typeof newOptions.theme === "string") {
this._standaloneThemeService.setTheme(newOptions.theme);
}
if (typeof newOptions.autoDetectHighContrast !== "undefined") {
this._standaloneThemeService.setAutoDetectHighContrast(Boolean(newOptions.autoDetectHighContrast));
}
super.updateOptions(newOptions);
}
_createInnerEditor(instantiationService, container, options2) {
return instantiationService.createInstance(StandaloneCodeEditor, container, options2);
}
getOriginalEditor() {
return super.getOriginalEditor();
}
getModifiedEditor() {
return super.getModifiedEditor();
}
addCommand(keybinding, handler, context) {
return this.getModifiedEditor().addCommand(keybinding, handler, context);
}
createContextKey(key, defaultValue) {
return this.getModifiedEditor().createContextKey(key, defaultValue);
}
addAction(descriptor) {
return this.getModifiedEditor().addAction(descriptor);
}
};
StandaloneDiffEditor2 = __decorate59([
__param53(2, IInstantiationService),
__param53(3, IContextKeyService),
__param53(4, ICodeEditorService),
__param53(5, IStandaloneThemeService),
__param53(6, INotificationService),
__param53(7, IConfigurationService),
__param53(8, IContextMenuService),
__param53(9, IEditorProgressService),
__param53(10, IClipboardService),
__param53(11, IAccessibilitySignalService)
], StandaloneDiffEditor2);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/style.css
var init_style2 = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/style.css"() {
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js
function isFocused(editor2) {
return observableFromEvent((h2) => {
const store = new DisposableStore();
store.add(editor2.onDidFocusEditorWidget(() => h2(true)));
store.add(editor2.onDidBlurEditorWidget(() => h2(false)));
return store;
}, () => editor2.hasTextFocus());
}
var __decorate60, __param54, TemplateData, DiffEditorItemTemplate;
var init_diffEditorItemTemplate = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js"() {
init_dom();
init_button2();
init_codicons();
init_lifecycle();
init_observable();
init_base();
init_diffEditorWidget();
init_toolbar3();
init_actions2();
init_instantiation();
init_utils5();
init_menuEntryActionViewItem2();
__decorate60 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param54 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
TemplateData = class {
constructor(viewModel, deltaScrollVertical) {
this.viewModel = viewModel;
this.deltaScrollVertical = deltaScrollVertical;
}
getId() {
return this.viewModel;
}
};
DiffEditorItemTemplate = class DiffEditorItemTemplate2 extends Disposable {
constructor(_container, _overflowWidgetsDomNode, _workbenchUIElementFactory, _instantiationService) {
super();
this._container = _container;
this._overflowWidgetsDomNode = _overflowWidgetsDomNode;
this._workbenchUIElementFactory = _workbenchUIElementFactory;
this._instantiationService = _instantiationService;
this._viewModel = observableValue(this, void 0);
this._collapsed = derived(this, (reader) => {
var _a10;
return (_a10 = this._viewModel.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.collapsed.read(reader);
});
this._editorContentHeight = observableValue(this, 500);
this.contentHeight = derived(this, (reader) => {
const h2 = this._collapsed.read(reader) ? 0 : this._editorContentHeight.read(reader);
return h2 + this._outerEditorHeight;
});
this._modifiedContentWidth = observableValue(this, 0);
this._modifiedWidth = observableValue(this, 0);
this._originalContentWidth = observableValue(this, 0);
this._originalWidth = observableValue(this, 0);
this.maxScroll = derived(this, (reader) => {
const scroll1 = this._modifiedContentWidth.read(reader) - this._modifiedWidth.read(reader);
const scroll2 = this._originalContentWidth.read(reader) - this._originalWidth.read(reader);
if (scroll1 > scroll2) {
return { maxScroll: scroll1, width: this._modifiedWidth.read(reader) };
} else {
return { maxScroll: scroll2, width: this._originalWidth.read(reader) };
}
});
this._elements = h("div.multiDiffEntry", [
h("div.header@header", [
h("div.header-content", [
h("div.collapse-button@collapseButton"),
h("div.file-path", [
h("div.title.modified.show-file-icons@primaryPath", []),
h("div.status.deleted@status", ["R"]),
h("div.title.original.show-file-icons@secondaryPath", [])
]),
h("div.actions@actions")
])
]),
h("div.editorParent", [
h("div.editorContainer@editor")
])
]);
this.editor = this._register(this._instantiationService.createInstance(DiffEditorWidget, this._elements.editor, {
overflowWidgetsDomNode: this._overflowWidgetsDomNode
}, {}));
this.isModifedFocused = isFocused(this.editor.getModifiedEditor());
this.isOriginalFocused = isFocused(this.editor.getOriginalEditor());
this.isFocused = derived(this, (reader) => this.isModifedFocused.read(reader) || this.isOriginalFocused.read(reader));
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 DisposableStore();
this._headerHeight = 40;
this._lastScrollTop = -1;
this._isSettingScrollTop = false;
const btn = new Button(this._elements.collapseButton, {});
this._register(autorun((reader) => {
btn.element.className = "";
btn.icon = this._collapsed.read(reader) ? Codicon.chevronRight : Codicon.chevronDown;
}));
this._register(btn.onDidClick(() => {
var _a10;
(_a10 = this._viewModel.get()) === null || _a10 === void 0 ? void 0 : _a10.collapsed.set(!this._collapsed.get(), void 0);
}));
this._register(autorun((reader) => {
this._elements.editor.style.display = this._collapsed.read(reader) ? "none" : "block";
}));
this._register(this.editor.getModifiedEditor().onDidLayoutChange((e) => {
const width2 = this.editor.getModifiedEditor().getLayoutInfo().contentWidth;
this._modifiedWidth.set(width2, void 0);
}));
this._register(this.editor.getOriginalEditor().onDidLayoutChange((e) => {
const width2 = this.editor.getOriginalEditor().getLayoutInfo().contentWidth;
this._originalWidth.set(width2, void 0);
}));
this._register(this.editor.onDidContentSizeChange((e) => {
globalTransaction((tx) => {
this._editorContentHeight.set(e.contentHeight, tx);
this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(), tx);
this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(), tx);
});
}));
this._register(this.editor.getOriginalEditor().onDidScrollChange((e) => {
if (this._isSettingScrollTop) {
return;
}
if (!e.scrollTopChanged || !this._data) {
return;
}
const delta = e.scrollTop - this._lastScrollTop;
this._data.deltaScrollVertical(delta);
}));
this._register(autorun((reader) => {
var _a10;
const isActive = (_a10 = this._viewModel.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.isActive.read(reader);
this._elements.root.classList.toggle("active", isActive);
}));
this._container.appendChild(this._elements.root);
this._outerEditorHeight = this._headerHeight;
this._register(this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.actions, MenuId.MultiDiffEditorFileToolbar, {
actionRunner: this._register(new ActionRunnerWithContext(() => {
var _a10;
return (_a10 = this._viewModel.get()) === null || _a10 === void 0 ? void 0 : _a10.modifiedUri;
})),
menuOptions: {
shouldForwardArgs: true
},
toolbarOptions: { primaryGroup: (g) => g.startsWith("navigation") },
actionViewItemProvider: (action, options2) => createActionViewItem(_instantiationService, action, options2)
}));
}
setScrollLeft(left) {
if (this._modifiedContentWidth.get() - this._modifiedWidth.get() > this._originalContentWidth.get() - this._originalWidth.get()) {
this.editor.getModifiedEditor().setScrollLeft(left);
} else {
this.editor.getOriginalEditor().setScrollLeft(left);
}
}
setData(data) {
this._data = data;
function updateOptions(options2) {
return __spreadProps(__spreadValues({}, options2), {
scrollBeyondLastLine: false,
hideUnchangedRegions: {
enabled: true
},
scrollbar: {
vertical: "hidden",
horizontal: "hidden",
handleMouseWheel: false,
useShadows: false
},
renderOverviewRuler: false,
fixedOverflowWidgets: true,
overviewRulerBorder: false
});
}
const value = data.viewModel.entry.value;
if (value.onOptionsDidChange) {
this._dataStore.add(value.onOptionsDidChange(() => {
var _a10;
this.editor.updateOptions(updateOptions((_a10 = value.options) !== null && _a10 !== void 0 ? _a10 : {}));
}));
}
globalTransaction((tx) => {
var _a10, _b4, _c2, _d2;
(_a10 = this._resourceLabel) === null || _a10 === void 0 ? void 0 : _a10.setUri((_b4 = data.viewModel.modifiedUri) !== null && _b4 !== void 0 ? _b4 : data.viewModel.originalUri, { strikethrough: data.viewModel.modifiedUri === void 0 });
let isRenamed = false;
let isDeleted = false;
let isAdded = false;
let flag = "";
if (data.viewModel.modifiedUri && data.viewModel.originalUri && data.viewModel.modifiedUri.path !== data.viewModel.originalUri.path) {
flag = "R";
isRenamed = true;
} else if (!data.viewModel.modifiedUri) {
flag = "D";
isDeleted = true;
} else if (!data.viewModel.originalUri) {
flag = "A";
isAdded = true;
}
this._elements.status.classList.toggle("renamed", isRenamed);
this._elements.status.classList.toggle("deleted", isDeleted);
this._elements.status.classList.toggle("added", isAdded);
this._elements.status.innerText = flag;
(_c2 = this._resourceLabel2) === null || _c2 === void 0 ? void 0 : _c2.setUri(isRenamed ? data.viewModel.originalUri : void 0, { strikethrough: true });
this._dataStore.clear();
this._viewModel.set(data.viewModel, tx);
this.editor.setModel(data.viewModel.diffEditorViewModel, tx);
this.editor.updateOptions(updateOptions((_d2 = value.options) !== null && _d2 !== void 0 ? _d2 : {}));
});
}
render(verticalRange, width2, editorScroll, viewPort) {
this._elements.root.style.visibility = "visible";
this._elements.root.style.top = `${verticalRange.start}px`;
this._elements.root.style.height = `${verticalRange.length}px`;
this._elements.root.style.width = `${width2}px`;
this._elements.root.style.position = "absolute";
const maxDelta = verticalRange.length - this._headerHeight;
const delta = Math.max(0, Math.min(viewPort.start - verticalRange.start, maxDelta));
this._elements.header.style.transform = `translateY(${delta}px)`;
globalTransaction((tx) => {
this.editor.layout({
width: width2 - 2 * 8 - 2 * 1,
height: verticalRange.length - this._outerEditorHeight
});
});
try {
this._isSettingScrollTop = true;
this._lastScrollTop = editorScroll;
this.editor.getOriginalEditor().setScrollTop(editorScroll);
} finally {
this._isSettingScrollTop = false;
}
this._elements.header.classList.toggle("shadow", delta > 0 || editorScroll > 0);
this._elements.header.classList.toggle("collapsed", delta === maxDelta);
}
hide() {
this._elements.root.style.top = `-100000px`;
this._elements.root.style.visibility = "hidden";
}
};
DiffEditorItemTemplate = __decorate60([
__param54(3, IInstantiationService)
], DiffEditorItemTemplate);
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/objectPool.js
var ObjectPool;
var init_objectPool = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/objectPool.js"() {
ObjectPool = class {
constructor(_create) {
this._create = _create;
this._unused = /* @__PURE__ */ new Set();
this._used = /* @__PURE__ */ new Set();
this._itemData = /* @__PURE__ */ new Map();
}
getUnusedObj(data) {
var _a10;
let obj;
if (this._unused.size === 0) {
obj = this._create(data);
this._itemData.set(obj, data);
} else {
const values2 = [...this._unused.values()];
obj = (_a10 = values2.find((obj2) => this._itemData.get(obj2).getId() === data.getId())) !== null && _a10 !== void 0 ? _a10 : values2[0];
this._unused.delete(obj);
this._itemData.set(obj, data);
obj.setData(data);
}
this._used.add(obj);
return {
object: obj,
dispose: () => {
this._used.delete(obj);
if (this._unused.size > 5) {
obj.dispose();
} else {
this._unused.add(obj);
}
}
};
}
dispose() {
for (const obj of this._used) {
obj.dispose();
}
for (const obj of this._unused) {
obj.dispose();
}
this._used.clear();
this._unused.clear();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js
var __decorate61, __param55, MultiDiffEditorWidgetImpl, VirtualizedViewItem;
var init_multiDiffEditorWidgetImpl = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js"() {
init_dom();
init_scrollableElement();
init_arrays();
init_arraysFind();
init_errors();
init_lifecycle();
init_observable();
init_base();
init_scrollable();
init_style2();
init_utils4();
init_offsetRange();
init_selection();
init_editorContextKeys();
init_contextkey();
init_instantiation();
init_serviceCollection();
init_diffEditorItemTemplate();
init_objectPool();
init_nls();
__decorate61 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param55 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl2 extends Disposable {
constructor(_element, _dimension, _viewModel, _workbenchUIElementFactory, _parentContextKeyService, _parentInstantiationService) {
super();
this._element = _element;
this._dimension = _dimension;
this._viewModel = _viewModel;
this._workbenchUIElementFactory = _workbenchUIElementFactory;
this._parentContextKeyService = _parentContextKeyService;
this._parentInstantiationService = _parentInstantiationService;
this._scrollableElements = h("div.scrollContent", [
h("div@content", {
style: {
overflow: "hidden"
}
}),
h("div.monaco-editor@overflowWidgetsDomNode", {})
]);
this._scrollable = this._register(new Scrollable({
forceIntegerValues: false,
scheduleAtNextAnimationFrame: (cb) => scheduleAtNextAnimationFrame(getWindow(this._element), cb),
smoothScrollDuration: 100
}));
this._scrollableElement = this._register(new SmoothScrollableElement(this._scrollableElements.root, {
vertical: 1,
horizontal: 1,
useShadows: false
}, this._scrollable));
this._elements = h("div.monaco-component.multiDiffEditor", {}, [
h("div", {}, [this._scrollableElement.getDomNode()]),
h("div.placeholder@placeholder", {}, [h("div", [localize("noChangedFiles", "No Changed Files")])])
]);
this._sizeObserver = this._register(new ObservableElementSizeObserver(this._element, void 0));
this._objectPool = this._register(new ObjectPool((data) => {
const template = this._instantiationService.createInstance(DiffEditorItemTemplate, this._scrollableElements.content, this._scrollableElements.overflowWidgetsDomNode, this._workbenchUIElementFactory);
template.setData(data);
return template;
}));
this.scrollTop = observableFromEvent(this._scrollableElement.onScroll, () => (
/** @description scrollTop */
this._scrollableElement.getScrollPosition().scrollTop
));
this.scrollLeft = observableFromEvent(this._scrollableElement.onScroll, () => (
/** @description scrollLeft */
this._scrollableElement.getScrollPosition().scrollLeft
));
this._viewItemsInfo = derivedWithStore(this, (reader, store) => {
const vm = this._viewModel.read(reader);
if (!vm) {
return { items: [], getItem: (_d2) => {
throw new BugIndicatingError();
} };
}
const viewModels = vm.items.read(reader);
const map = /* @__PURE__ */ new Map();
const items = viewModels.map((d) => {
var _a10;
const item = store.add(new VirtualizedViewItem(d, this._objectPool, this.scrollLeft, (delta) => {
this._scrollableElement.setScrollPosition({ scrollTop: this._scrollableElement.getScrollPosition().scrollTop + delta });
}));
const data = (_a10 = this._lastDocStates) === null || _a10 === void 0 ? void 0 : _a10[item.getKey()];
if (data) {
transaction((tx) => {
item.setViewState(data, tx);
});
}
map.set(d, item);
return item;
});
return { items, getItem: (d) => map.get(d) };
});
this._viewItems = this._viewItemsInfo.map(this, (items) => items.items);
this._spaceBetweenPx = 0;
this._totalHeight = this._viewItems.map(this, (items, reader) => items.reduce((r, i) => r + i.contentHeight.read(reader) + this._spaceBetweenPx, 0));
this._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._element));
this._instantiationService = this._register(this._parentInstantiationService.createChild(new ServiceCollection([IContextKeyService, this._contextKeyService])));
this._lastDocStates = {};
this._contextKeyService.createKey(EditorContextKeys.inMultiDiffEditor.key, true);
this._register(autorunWithStore((reader, store) => {
const viewModel = this._viewModel.read(reader);
if (viewModel && viewModel.contextKeys) {
for (const [key, value] of Object.entries(viewModel.contextKeys)) {
const contextKey = this._contextKeyService.createKey(key, void 0);
contextKey.set(value);
store.add(toDisposable(() => contextKey.reset()));
}
}
}));
const ctxAllCollapsed = this._parentContextKeyService.createKey(EditorContextKeys.multiDiffEditorAllCollapsed.key, false);
this._register(autorun((reader) => {
const viewModel = this._viewModel.read(reader);
if (viewModel) {
const allCollapsed = viewModel.items.read(reader).every((item) => item.collapsed.read(reader));
ctxAllCollapsed.set(allCollapsed);
}
}));
this._register(autorun((reader) => {
const dimension = this._dimension.read(reader);
this._sizeObserver.observe(dimension);
}));
this._register(autorun((reader) => {
const items = this._viewItems.read(reader);
this._elements.placeholder.classList.toggle("visible", items.length === 0);
}));
this._scrollableElements.content.style.position = "relative";
this._register(autorun((reader) => {
const height = this._sizeObserver.height.read(reader);
this._scrollableElements.root.style.height = `${height}px`;
const totalHeight = this._totalHeight.read(reader);
this._scrollableElements.content.style.height = `${totalHeight}px`;
const width2 = this._sizeObserver.width.read(reader);
let scrollWidth = width2;
const viewItems = this._viewItems.read(reader);
const max = findFirstMax(viewItems, compareBy((i) => i.maxScroll.read(reader).maxScroll, numberComparator));
if (max) {
const maxScroll = max.maxScroll.read(reader);
scrollWidth = width2 + maxScroll.maxScroll;
}
this._scrollableElement.setScrollDimensions({
width: width2,
height,
scrollHeight: totalHeight,
scrollWidth
});
}));
_element.replaceChildren(this._elements.root);
this._register(toDisposable(() => {
_element.replaceChildren();
}));
this._register(this._register(autorun((reader) => {
globalTransaction((tx) => {
this.render(reader);
});
})));
}
render(reader) {
const scrollTop = this.scrollTop.read(reader);
let contentScrollOffsetToScrollOffset = 0;
let itemHeightSumBefore = 0;
let itemContentHeightSumBefore = 0;
const viewPortHeight = this._sizeObserver.height.read(reader);
const contentViewPort = OffsetRange.ofStartAndLength(scrollTop, viewPortHeight);
const width2 = this._sizeObserver.width.read(reader);
for (const v of this._viewItems.read(reader)) {
const itemContentHeight = v.contentHeight.read(reader);
const itemHeight = Math.min(itemContentHeight, viewPortHeight);
const itemRange = OffsetRange.ofStartAndLength(itemHeightSumBefore, itemHeight);
const itemContentRange = OffsetRange.ofStartAndLength(itemContentHeightSumBefore, itemContentHeight);
if (itemContentRange.isBefore(contentViewPort)) {
contentScrollOffsetToScrollOffset -= itemContentHeight - itemHeight;
v.hide();
} else if (itemContentRange.isAfter(contentViewPort)) {
v.hide();
} else {
const scroll = Math.max(0, Math.min(contentViewPort.start - itemContentRange.start, itemContentHeight - itemHeight));
contentScrollOffsetToScrollOffset -= scroll;
const viewPort = OffsetRange.ofStartAndLength(scrollTop + contentScrollOffsetToScrollOffset, viewPortHeight);
v.render(itemRange, scroll, width2, viewPort);
}
itemHeightSumBefore += itemHeight + this._spaceBetweenPx;
itemContentHeightSumBefore += itemContentHeight + this._spaceBetweenPx;
}
this._scrollableElements.content.style.transform = `translateY(${-(scrollTop + contentScrollOffsetToScrollOffset)}px)`;
}
};
MultiDiffEditorWidgetImpl = __decorate61([
__param55(4, IContextKeyService),
__param55(5, IInstantiationService)
], MultiDiffEditorWidgetImpl);
VirtualizedViewItem = class extends Disposable {
constructor(viewModel, _objectPool, _scrollLeft, _deltaScrollVertical) {
super();
this.viewModel = viewModel;
this._objectPool = _objectPool;
this._scrollLeft = _scrollLeft;
this._deltaScrollVertical = _deltaScrollVertical;
this._templateRef = this._register(disposableObservableValue(this, void 0));
this.contentHeight = derived(this, (reader) => {
var _a10, _b4, _c2;
return (_c2 = (_b4 = (_a10 = this._templateRef.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.object.contentHeight) === null || _b4 === void 0 ? void 0 : _b4.read(reader)) !== null && _c2 !== void 0 ? _c2 : this.viewModel.lastTemplateData.read(reader).contentHeight;
});
this.maxScroll = derived(this, (reader) => {
var _a10, _b4;
return (_b4 = (_a10 = this._templateRef.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.object.maxScroll.read(reader)) !== null && _b4 !== void 0 ? _b4 : { maxScroll: 0, scrollWidth: 0 };
});
this.template = derived(this, (reader) => {
var _a10;
return (_a10 = this._templateRef.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.object;
});
this._isHidden = observableValue(this, false);
this._isFocused = derived(this, (reader) => {
var _a10, _b4;
return (_b4 = (_a10 = this.template.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.isFocused.read(reader)) !== null && _b4 !== void 0 ? _b4 : false;
});
this.viewModel.setIsFocused(this._isFocused, void 0);
this._register(autorun((reader) => {
var _a10;
const scrollLeft = this._scrollLeft.read(reader);
(_a10 = this._templateRef.read(reader)) === null || _a10 === void 0 ? void 0 : _a10.object.setScrollLeft(scrollLeft);
}));
this._register(autorun((reader) => {
const ref = this._templateRef.read(reader);
if (!ref) {
return;
}
const isHidden = this._isHidden.read(reader);
if (!isHidden) {
return;
}
const isFocused2 = ref.object.isFocused.read(reader);
if (isFocused2) {
return;
}
this._clear();
}));
}
dispose() {
this._clear();
super.dispose();
}
toString() {
var _a10;
return `VirtualViewItem(${(_a10 = this.viewModel.entry.value.modified) === null || _a10 === void 0 ? void 0 : _a10.uri.toString()})`;
}
getKey() {
return this.viewModel.getKey();
}
setViewState(viewState, tx) {
var _a10;
this.viewModel.collapsed.set(viewState.collapsed, tx);
this._updateTemplateData(tx);
const data = this.viewModel.lastTemplateData.get();
const selections = (_a10 = viewState.selections) === null || _a10 === void 0 ? void 0 : _a10.map(Selection.liftSelection);
this.viewModel.lastTemplateData.set(__spreadProps(__spreadValues({}, data), {
selections
}), tx);
const ref = this._templateRef.get();
if (ref) {
if (selections) {
ref.object.editor.setSelections(selections);
}
}
}
_updateTemplateData(tx) {
var _a10;
const ref = this._templateRef.get();
if (!ref) {
return;
}
this.viewModel.lastTemplateData.set({
contentHeight: ref.object.contentHeight.get(),
selections: (_a10 = ref.object.editor.getSelections()) !== null && _a10 !== void 0 ? _a10 : void 0
}, tx);
}
_clear() {
const ref = this._templateRef.get();
if (!ref) {
return;
}
transaction((tx) => {
this._updateTemplateData(tx);
ref.object.hide();
this._templateRef.set(void 0, tx);
});
}
hide() {
this._isHidden.set(true, void 0);
}
render(verticalSpace, offset, width2, viewPort) {
this._isHidden.set(false, void 0);
let ref = this._templateRef.get();
if (!ref) {
ref = this._objectPool.getUnusedObj(new TemplateData(this.viewModel, this._deltaScrollVertical));
this._templateRef.set(ref, void 0);
const selections = this.viewModel.lastTemplateData.get().selections;
if (selections) {
ref.object.editor.setSelections(selections);
}
}
ref.object.render(verticalSpace, width2, offset, viewPort);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/colors.js
var multiDiffEditorHeaderBackground, multiDiffEditorBackground, multiDiffEditorBorder;
var init_colors = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/colors.js"() {
init_nls();
init_colorRegistry();
multiDiffEditorHeaderBackground = registerColor("multiDiffEditor.headerBackground", { dark: "#262626", light: "tab.inactiveBackground", hcDark: "tab.inactiveBackground", hcLight: "tab.inactiveBackground" }, localize("multiDiffEditor.headerBackground", "The background color of the diff editor's header"));
multiDiffEditorBackground = registerColor("multiDiffEditor.background", { dark: "editorBackground", light: "editorBackground", hcDark: "editorBackground", hcLight: "editorBackground" }, localize("multiDiffEditor.background", "The background color of the multi file diff editor"));
multiDiffEditorBorder = registerColor("multiDiffEditor.border", { dark: "sideBarSectionHeader.border", light: "#cccccc", hcDark: "sideBarSectionHeader.border", hcLight: "#cccccc" }, localize("multiDiffEditor.border", "The border color of the multi file diff editor"));
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget.js
var __decorate62, __param56, MultiDiffEditorWidget;
var init_multiDiffEditorWidget = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidget.js"() {
init_lifecycle();
init_observable();
init_utils4();
init_multiDiffEditorWidgetImpl();
init_instantiation();
init_colors();
init_diffEditorItemTemplate();
__decorate62 = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param56 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
MultiDiffEditorWidget = class MultiDiffEditorWidget2 extends Disposable {
constructor(_element, _workbenchUIElementFactory, _instantiationService) {
super();
this._element = _element;
this._workbenchUIElementFactory = _workbenchUIElementFactory;
this._instantiationService = _instantiationService;
this._dimension = observableValue(this, void 0);
this._viewModel = observableValue(this, void 0);
this._widgetImpl = derivedWithStore(this, (reader, store) => {
readHotReloadableExport(DiffEditorItemTemplate, reader);
return store.add(this._instantiationService.createInstance(readHotReloadableExport(MultiDiffEditorWidgetImpl, reader), this._element, this._dimension, this._viewModel, this._workbenchUIElementFactory));
});
this._register(recomputeInitiallyAndOnChange(this._widgetImpl));
}
};
MultiDiffEditorWidget = __decorate62([
__param56(2, IInstantiationService)
], MultiDiffEditorWidget);
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js
function create2(domElement, options2, override) {
const instantiationService = StandaloneServices.initialize(override || {});
return instantiationService.createInstance(StandaloneEditor, domElement, options2);
}
function onDidCreateEditor(listener) {
const codeEditorService = StandaloneServices.get(ICodeEditorService);
return codeEditorService.onCodeEditorAdd((editor2) => {
listener(editor2);
});
}
function onDidCreateDiffEditor(listener) {
const codeEditorService = StandaloneServices.get(ICodeEditorService);
return codeEditorService.onDiffEditorAdd((editor2) => {
listener(editor2);
});
}
function getEditors() {
const codeEditorService = StandaloneServices.get(ICodeEditorService);
return codeEditorService.listCodeEditors();
}
function getDiffEditors() {
const codeEditorService = StandaloneServices.get(ICodeEditorService);
return codeEditorService.listDiffEditors();
}
function createDiffEditor(domElement, options2, override) {
const instantiationService = StandaloneServices.initialize(override || {});
return instantiationService.createInstance(StandaloneDiffEditor2, domElement, options2);
}
function createMultiFileDiffEditor(domElement, override) {
const instantiationService = StandaloneServices.initialize(override || {});
return new MultiDiffEditorWidget(domElement, {}, instantiationService);
}
function addCommand(descriptor) {
if (typeof descriptor.id !== "string" || typeof descriptor.run !== "function") {
throw new Error("Invalid command descriptor, `id` and `run` are required properties!");
}
return CommandsRegistry.registerCommand(descriptor.id, descriptor.run);
}
function addEditorAction(descriptor) {
if (typeof descriptor.id !== "string" || typeof descriptor.label !== "string" || typeof descriptor.run !== "function") {
throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");
}
const precondition = ContextKeyExpr.deserialize(descriptor.precondition);
const run = (accessor, ...args) => {
return EditorCommand.runEditorCommand(accessor, args, precondition, (accessor2, editor2, args2) => Promise.resolve(descriptor.run(editor2, ...args2)));
};
const toDispose = new DisposableStore();
toDispose.add(CommandsRegistry.registerCommand(descriptor.id, run));
if (descriptor.contextMenuGroupId) {
const menuItem = {
command: {
id: descriptor.id,
title: descriptor.label
},
when: precondition,
group: descriptor.contextMenuGroupId,
order: descriptor.contextMenuOrder || 0
};
toDispose.add(MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem));
}
if (Array.isArray(descriptor.keybindings)) {
const keybindingService = StandaloneServices.get(IKeybindingService);
if (!(keybindingService instanceof StandaloneKeybindingService)) {
console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");
} else {
const keybindingsWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(descriptor.keybindingContext));
toDispose.add(keybindingService.addDynamicKeybindings(descriptor.keybindings.map((keybinding) => {
return {
keybinding,
command: descriptor.id,
when: keybindingsWhen
};
})));
}
}
return toDispose;
}
function addKeybindingRule(rule) {
return addKeybindingRules([rule]);
}
function addKeybindingRules(rules) {
const keybindingService = StandaloneServices.get(IKeybindingService);
if (!(keybindingService instanceof StandaloneKeybindingService)) {
console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");
return Disposable.None;
}
return keybindingService.addDynamicKeybindings(rules.map((rule) => {
return {
keybinding: rule.keybinding,
command: rule.command,
commandArgs: rule.commandArgs,
when: ContextKeyExpr.deserialize(rule.when)
};
}));
}
function createModel(value, language82, uri) {
const languageService = StandaloneServices.get(ILanguageService);
const languageId = languageService.getLanguageIdByMimeType(language82) || language82;
return createTextModel(StandaloneServices.get(IModelService), languageService, value, languageId, uri);
}
function setModelLanguage(model, mimeTypeOrLanguageId) {
const languageService = StandaloneServices.get(ILanguageService);
const languageId = languageService.getLanguageIdByMimeType(mimeTypeOrLanguageId) || mimeTypeOrLanguageId || PLAINTEXT_LANGUAGE_ID;
model.setLanguage(languageService.createById(languageId));
}
function setModelMarkers(model, owner, markers) {
if (model) {
const markerService = StandaloneServices.get(IMarkerService);
markerService.changeOne(owner, model.uri, markers);
}
}
function removeAllMarkers(owner) {
const markerService = StandaloneServices.get(IMarkerService);
markerService.changeAll(owner, []);
}
function getModelMarkers(filter) {
const markerService = StandaloneServices.get(IMarkerService);
return markerService.read(filter);
}
function onDidChangeMarkers(listener) {
const markerService = StandaloneServices.get(IMarkerService);
return markerService.onMarkerChanged(listener);
}
function getModel(uri) {
const modelService = StandaloneServices.get(IModelService);
return modelService.getModel(uri);
}
function getModels() {
const modelService = StandaloneServices.get(IModelService);
return modelService.getModels();
}
function onDidCreateModel(listener) {
const modelService = StandaloneServices.get(IModelService);
return modelService.onModelAdded(listener);
}
function onWillDisposeModel(listener) {
const modelService = StandaloneServices.get(IModelService);
return modelService.onModelRemoved(listener);
}
function onDidChangeModelLanguage(listener) {
const modelService = StandaloneServices.get(IModelService);
return modelService.onModelLanguageChanged((e) => {
listener({
model: e.model,
oldLanguage: e.oldLanguageId
});
});
}
function createWebWorker2(opts) {
return createWebWorker(StandaloneServices.get(IModelService), StandaloneServices.get(ILanguageConfigurationService), opts);
}
function colorizeElement(domNode, options2) {
const languageService = StandaloneServices.get(ILanguageService);
const themeService = StandaloneServices.get(IStandaloneThemeService);
return Colorizer.colorizeElement(themeService, languageService, domNode, options2).then(() => {
themeService.registerEditorContainer(domNode);
});
}
function colorize(text2, languageId, options2) {
const languageService = StandaloneServices.get(ILanguageService);
const themeService = StandaloneServices.get(IStandaloneThemeService);
themeService.registerEditorContainer(mainWindow.document.body);
return Colorizer.colorize(languageService, text2, languageId, options2);
}
function colorizeModelLine(model, lineNumber, tabSize = 4) {
const themeService = StandaloneServices.get(IStandaloneThemeService);
themeService.registerEditorContainer(mainWindow.document.body);
return Colorizer.colorizeModelLine(model, lineNumber, tabSize);
}
function getSafeTokenizationSupport(language82) {
const tokenizationSupport = TokenizationRegistry2.get(language82);
if (tokenizationSupport) {
return tokenizationSupport;
}
return {
getInitialState: () => NullState,
tokenize: (line, hasEOL, state) => nullTokenize(language82, state)
};
}
function tokenize(text2, languageId) {
TokenizationRegistry2.getOrCreate(languageId);
const tokenizationSupport = getSafeTokenizationSupport(languageId);
const lines = splitLines(text2);
const result = [];
let state = tokenizationSupport.getInitialState();
for (let i = 0, len = lines.length; i < len; i++) {
const line = lines[i];
const tokenizationResult = tokenizationSupport.tokenize(line, true, state);
result[i] = tokenizationResult.tokens;
state = tokenizationResult.endState;
}
return result;
}
function defineTheme(themeName, themeData) {
const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);
standaloneThemeService.defineTheme(themeName, themeData);
}
function setTheme(themeName) {
const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);
standaloneThemeService.setTheme(themeName);
}
function remeasureFonts() {
FontMeasurements.clearAllFontInfos();
}
function registerCommand3(id, handler) {
return CommandsRegistry.registerCommand({ id, handler });
}
function registerLinkOpener(opener) {
const openerService = StandaloneServices.get(IOpenerService);
return openerService.registerOpener({
open(resource) {
return __async(this, null, function* () {
if (typeof resource === "string") {
resource = URI.parse(resource);
}
return opener.open(resource);
});
}
});
}
function registerEditorOpener(opener) {
const codeEditorService = StandaloneServices.get(ICodeEditorService);
return codeEditorService.registerCodeEditorOpenHandler((input, source, sideBySide) => __async(this, null, function* () {
var _a10;
if (!source) {
return null;
}
const selection = (_a10 = input.options) === null || _a10 === void 0 ? void 0 : _a10.selection;
let selectionOrPosition;
if (selection && typeof selection.endLineNumber === "number" && typeof selection.endColumn === "number") {
selectionOrPosition = selection;
} else if (selection) {
selectionOrPosition = { lineNumber: selection.startLineNumber, column: selection.startColumn };
}
if (yield opener.openCodeEditor(source, input.resource, selectionOrPosition)) {
return source;
}
return null;
}));
}
function createMonacoEditorAPI() {
return {
// methods
create: create2,
getEditors,
getDiffEditors,
onDidCreateEditor,
onDidCreateDiffEditor,
createDiffEditor,
addCommand,
addEditorAction,
addKeybindingRule,
addKeybindingRules,
createModel,
setModelLanguage,
setModelMarkers,
getModelMarkers,
removeAllMarkers,
onDidChangeMarkers,
getModels,
getModel,
onDidCreateModel,
onWillDisposeModel,
onDidChangeModelLanguage,
createWebWorker: createWebWorker2,
colorizeElement,
colorize,
colorizeModelLine,
tokenize,
defineTheme,
setTheme,
remeasureFonts,
registerCommand: registerCommand3,
registerLinkOpener,
registerEditorOpener,
// enums
AccessibilitySupport,
ContentWidgetPositionPreference,
CursorChangeReason,
DefaultEndOfLine,
EditorAutoIndentStrategy,
EditorOption,
EndOfLinePreference,
EndOfLineSequence,
MinimapPosition,
MinimapSectionHeaderStyle,
MouseTargetType,
OverlayWidgetPositionPreference,
OverviewRulerLane,
GlyphMarginLane,
RenderLineNumbersType,
RenderMinimap,
ScrollbarVisibility,
ScrollType,
TextEditorCursorBlinkingStyle,
TextEditorCursorStyle: TextEditorCursorStyle2,
TrackedRangeStickiness,
WrappingIndent,
InjectedTextCursorStops,
PositionAffinity,
ShowLightbulbIconMode: ShowLightbulbIconMode2,
// classes
ConfigurationChangedEvent,
BareFontInfo,
FontInfo,
TextModelResolvedOptions,
FindMatch,
ApplyUpdateResult,
EditorZoom,
createMultiFileDiffEditor,
// vars
EditorType,
EditorOptions
};
}
var init_standaloneEditor = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js"() {
init_window();
init_lifecycle();
init_strings();
init_uri();
init_standalone_tokens();
init_fontMeasurements();
init_editorExtensions();
init_codeEditorService();
init_webWorker();
init_editorOptions();
init_editorZoom();
init_fontInfo();
init_editorCommon();
init_languages();
init_language();
init_languageConfigurationRegistry();
init_modesRegistry();
init_nullTokenize();
init_model2();
init_model();
init_standaloneEnums();
init_colorizer();
init_standaloneCodeEditor();
init_standaloneServices();
init_standaloneTheme();
init_actions2();
init_commands();
init_contextkey();
init_keybinding();
init_markers();
init_opener();
init_multiDiffEditorWidget();
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCompile.js
function isArrayOf(elemType, obj) {
if (!obj) {
return false;
}
if (!Array.isArray(obj)) {
return false;
}
for (const el of obj) {
if (!elemType(el)) {
return false;
}
}
return true;
}
function bool(prop, defValue) {
if (typeof prop === "boolean") {
return prop;
}
return defValue;
}
function string(prop, defValue) {
if (typeof prop === "string") {
return prop;
}
return defValue;
}
function arrayToHash(array2) {
const result = {};
for (const e of array2) {
result[e] = true;
}
return result;
}
function createKeywordMatcher(arr, caseInsensitive = false) {
if (caseInsensitive) {
arr = arr.map(function(x) {
return x.toLowerCase();
});
}
const hash2 = arrayToHash(arr);
if (caseInsensitive) {
return function(word) {
return hash2[word.toLowerCase()] !== void 0 && hash2.hasOwnProperty(word.toLowerCase());
};
} else {
return function(word) {
return hash2[word] !== void 0 && hash2.hasOwnProperty(word);
};
}
}
function compileRegExp(lexer2, str, handleSn) {
str = str.replace(/@@/g, ``);
let n = 0;
let hadExpansion;
do {
hadExpansion = false;
str = str.replace(/@(\w+)/g, function(s, attr) {
hadExpansion = true;
let sub = "";
if (typeof lexer2[attr] === "string") {
sub = lexer2[attr];
} else if (lexer2[attr] && lexer2[attr] instanceof RegExp) {
sub = lexer2[attr].source;
} else {
if (lexer2[attr] === void 0) {
throw createError(lexer2, "language definition does not contain attribute '" + attr + "', used at: " + str);
} else {
throw createError(lexer2, "attribute reference '" + attr + "' must be a string, used at: " + str);
}
}
return empty(sub) ? "" : "(?:" + sub + ")";
});
n++;
} while (hadExpansion && n < 5);
str = str.replace(/\x01/g, "@");
const flags = (lexer2.ignoreCase ? "i" : "") + (lexer2.unicode ? "u" : "");
if (handleSn) {
const match2 = str.match(/\$[sS](\d\d?)/g);
if (match2) {
let lastState = null;
let lastRegEx = null;
return (state) => {
if (lastRegEx && lastState === state) {
return lastRegEx;
}
lastState = state;
lastRegEx = new RegExp(substituteMatchesRe(lexer2, str, state), flags);
return lastRegEx;
};
}
}
return new RegExp(str, flags);
}
function selectScrutinee(id, matches2, state, num) {
if (num < 0) {
return id;
}
if (num < matches2.length) {
return matches2[num];
}
if (num >= 100) {
num = num - 100;
const parts = state.split(".");
parts.unshift(state);
if (num < parts.length) {
return parts[num];
}
}
return null;
}
function createGuard(lexer2, ruleName, tkey, val) {
let scrut = -1;
let oppat = tkey;
let matches2 = tkey.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);
if (matches2) {
if (matches2[3]) {
scrut = parseInt(matches2[3]);
if (matches2[2]) {
scrut = scrut + 100;
}
}
oppat = matches2[4];
}
let op = "~";
let pat = oppat;
if (!oppat || oppat.length === 0) {
op = "!=";
pat = "";
} else if (/^\w*$/.test(pat)) {
op = "==";
} else {
matches2 = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);
if (matches2) {
op = matches2[1];
pat = matches2[2];
}
}
let tester;
if ((op === "~" || op === "!~") && /^(\w|\|)*$/.test(pat)) {
const inWords = createKeywordMatcher(pat.split("|"), lexer2.ignoreCase);
tester = function(s) {
return op === "~" ? inWords(s) : !inWords(s);
};
} else if (op === "@" || op === "!@") {
const words = lexer2[pat];
if (!words) {
throw createError(lexer2, "the @ match target '" + pat + "' is not defined, in rule: " + ruleName);
}
if (!isArrayOf(function(elem) {
return typeof elem === "string";
}, words)) {
throw createError(lexer2, "the @ match target '" + pat + "' must be an array of strings, in rule: " + ruleName);
}
const inWords = createKeywordMatcher(words, lexer2.ignoreCase);
tester = function(s) {
return op === "@" ? inWords(s) : !inWords(s);
};
} else if (op === "~" || op === "!~") {
if (pat.indexOf("$") < 0) {
const re = compileRegExp(lexer2, "^" + pat + "$", false);
tester = function(s) {
return op === "~" ? re.test(s) : !re.test(s);
};
} else {
tester = function(s, id, matches3, state) {
const re = compileRegExp(lexer2, "^" + substituteMatches(lexer2, pat, id, matches3, state) + "$", false);
return re.test(s);
};
}
} else {
if (pat.indexOf("$") < 0) {
const patx = fixCase(lexer2, pat);
tester = function(s) {
return op === "==" ? s === patx : s !== patx;
};
} else {
const patx = fixCase(lexer2, pat);
tester = function(s, id, matches3, state, eos) {
const patexp = substituteMatches(lexer2, patx, id, matches3, state);
return op === "==" ? s === patexp : s !== patexp;
};
}
}
if (scrut === -1) {
return {
name: tkey,
value: val,
test: function(id, matches3, state, eos) {
return tester(id, id, matches3, state, eos);
}
};
} else {
return {
name: tkey,
value: val,
test: function(id, matches3, state, eos) {
const scrutinee = selectScrutinee(id, matches3, state, scrut);
return tester(!scrutinee ? "" : scrutinee, id, matches3, state, eos);
}
};
}
}
function compileAction(lexer2, ruleName, action) {
if (!action) {
return { token: "" };
} else if (typeof action === "string") {
return action;
} else if (action.token || action.token === "") {
if (typeof action.token !== "string") {
throw createError(lexer2, "a 'token' attribute must be of type string, in rule: " + ruleName);
} else {
const newAction = { token: action.token };
if (action.token.indexOf("$") >= 0) {
newAction.tokenSubst = true;
}
if (typeof action.bracket === "string") {
if (action.bracket === "@open") {
newAction.bracket = 1;
} else if (action.bracket === "@close") {
newAction.bracket = -1;
} else {
throw createError(lexer2, "a 'bracket' attribute must be either '@open' or '@close', in rule: " + ruleName);
}
}
if (action.next) {
if (typeof action.next !== "string") {
throw createError(lexer2, "the next state must be a string value in rule: " + ruleName);
} else {
let next = action.next;
if (!/^(@pop|@push|@popall)$/.test(next)) {
if (next[0] === "@") {
next = next.substr(1);
}
if (next.indexOf("$") < 0) {
if (!stateExists(lexer2, substituteMatches(lexer2, next, "", [], ""))) {
throw createError(lexer2, "the next state '" + action.next + "' is not defined in rule: " + ruleName);
}
}
}
newAction.next = next;
}
}
if (typeof action.goBack === "number") {
newAction.goBack = action.goBack;
}
if (typeof action.switchTo === "string") {
newAction.switchTo = action.switchTo;
}
if (typeof action.log === "string") {
newAction.log = action.log;
}
if (typeof action.nextEmbedded === "string") {
newAction.nextEmbedded = action.nextEmbedded;
lexer2.usesEmbedded = true;
}
return newAction;
}
} else if (Array.isArray(action)) {
const results = [];
for (let i = 0, len = action.length; i < len; i++) {
results[i] = compileAction(lexer2, ruleName, action[i]);
}
return { group: results };
} else if (action.cases) {
const cases = [];
for (const tkey in action.cases) {
if (action.cases.hasOwnProperty(tkey)) {
const val = compileAction(lexer2, ruleName, action.cases[tkey]);
if (tkey === "@default" || tkey === "@" || tkey === "") {
cases.push({ test: void 0, value: val, name: tkey });
} else if (tkey === "@eos") {
cases.push({ test: function(id, matches2, state, eos) {
return eos;
}, value: val, name: tkey });
} else {
cases.push(createGuard(lexer2, ruleName, tkey, val));
}
}
}
const def = lexer2.defaultToken;
return {
test: function(id, matches2, state, eos) {
for (const _case of cases) {
const didmatch = !_case.test || _case.test(id, matches2, state, eos);
if (didmatch) {
return _case.value;
}
}
return def;
}
};
} else {
throw createError(lexer2, "an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: " + ruleName);
}
}
function compile(languageId, json) {
if (!json || typeof json !== "object") {
throw new Error("Monarch: expecting a language definition object");
}
const lexer2 = {};
lexer2.languageId = languageId;
lexer2.includeLF = bool(json.includeLF, false);
lexer2.noThrow = false;
lexer2.maxStack = 100;
lexer2.start = typeof json.start === "string" ? json.start : null;
lexer2.ignoreCase = bool(json.ignoreCase, false);
lexer2.unicode = bool(json.unicode, false);
lexer2.tokenPostfix = string(json.tokenPostfix, "." + lexer2.languageId);
lexer2.defaultToken = string(json.defaultToken, "source");
lexer2.usesEmbedded = false;
const lexerMin = json;
lexerMin.languageId = languageId;
lexerMin.includeLF = lexer2.includeLF;
lexerMin.ignoreCase = lexer2.ignoreCase;
lexerMin.unicode = lexer2.unicode;
lexerMin.noThrow = lexer2.noThrow;
lexerMin.usesEmbedded = lexer2.usesEmbedded;
lexerMin.stateNames = json.tokenizer;
lexerMin.defaultToken = lexer2.defaultToken;
function addRules(state, newrules, rules) {
for (const rule of rules) {
let include = rule.include;
if (include) {
if (typeof include !== "string") {
throw createError(lexer2, "an 'include' attribute must be a string at: " + state);
}
if (include[0] === "@") {
include = include.substr(1);
}
if (!json.tokenizer[include]) {
throw createError(lexer2, "include target '" + include + "' is not defined at: " + state);
}
addRules(state + "." + include, newrules, json.tokenizer[include]);
} else {
const newrule = new Rule(state);
if (Array.isArray(rule) && rule.length >= 1 && rule.length <= 3) {
newrule.setRegex(lexerMin, rule[0]);
if (rule.length >= 3) {
if (typeof rule[1] === "string") {
newrule.setAction(lexerMin, { token: rule[1], next: rule[2] });
} else if (typeof rule[1] === "object") {
const rule1 = rule[1];
rule1.next = rule[2];
newrule.setAction(lexerMin, rule1);
} else {
throw createError(lexer2, "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: " + state);
}
} else {
newrule.setAction(lexerMin, rule[1]);
}
} else {
if (!rule.regex) {
throw createError(lexer2, "a rule must either be an array, or an object with a 'regex' or 'include' field at: " + state);
}
if (rule.name) {
if (typeof rule.name === "string") {
newrule.name = rule.name;
}
}
if (rule.matchOnlyAtStart) {
newrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart, false);
}
newrule.setRegex(lexerMin, rule.regex);
newrule.setAction(lexerMin, rule.action);
}
newrules.push(newrule);
}
}
}
if (!json.tokenizer || typeof json.tokenizer !== "object") {
throw createError(lexer2, "a language definition must define the 'tokenizer' attribute as an object");
}
lexer2.tokenizer = [];
for (const key in json.tokenizer) {
if (json.tokenizer.hasOwnProperty(key)) {
if (!lexer2.start) {
lexer2.start = key;
}
const rules = json.tokenizer[key];
lexer2.tokenizer[key] = new Array();
addRules("tokenizer." + key, lexer2.tokenizer[key], rules);
}
}
lexer2.usesEmbedded = lexerMin.usesEmbedded;
if (json.brackets) {
if (!Array.isArray(json.brackets)) {
throw createError(lexer2, "the 'brackets' attribute must be defined as an array");
}
} else {
json.brackets = [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
];
}
const brackets = [];
for (const el of json.brackets) {
let desc = el;
if (desc && Array.isArray(desc) && desc.length === 3) {
desc = { token: desc[2], open: desc[0], close: desc[1] };
}
if (desc.open === desc.close) {
throw createError(lexer2, "open and close brackets in a 'brackets' attribute must be different: " + desc.open + "\n hint: use the 'bracket' attribute if matching on equal brackets is required.");
}
if (typeof desc.open === "string" && typeof desc.token === "string" && typeof desc.close === "string") {
brackets.push({
token: desc.token + lexer2.tokenPostfix,
open: fixCase(lexer2, desc.open),
close: fixCase(lexer2, desc.close)
});
} else {
throw createError(lexer2, "every element in the 'brackets' array must be a '{open,close,token}' object or array");
}
}
lexer2.brackets = brackets;
lexer2.noThrow = true;
return lexer2;
}
var Rule;
var init_monarchCompile = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCompile.js"() {
init_monarchCommon();
Rule = class {
constructor(name) {
this.regex = new RegExp("");
this.action = { token: "" };
this.matchOnlyAtLineStart = false;
this.name = "";
this.name = name;
}
setRegex(lexer2, re) {
let sregex;
if (typeof re === "string") {
sregex = re;
} else if (re instanceof RegExp) {
sregex = re.source;
} else {
throw createError(lexer2, "rules must start with a match string or regular expression: " + this.name);
}
this.matchOnlyAtLineStart = sregex.length > 0 && sregex[0] === "^";
this.name = this.name + ": " + sregex;
this.regex = compileRegExp(lexer2, "^(?:" + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ")", true);
}
setAction(lexer2, act) {
this.action = compileAction(lexer2, this.name, act);
}
resolveRegex(state) {
if (this.regex instanceof RegExp) {
return this.regex;
} else {
return this.regex(state);
}
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLanguages.js
function register3(language82) {
ModesRegistry.registerLanguage(language82);
}
function getLanguages() {
let result = [];
result = result.concat(ModesRegistry.getLanguages());
return result;
}
function getEncodedLanguageId(languageId) {
const languageService = StandaloneServices.get(ILanguageService);
return languageService.languageIdCodec.encodeLanguageId(languageId);
}
function onLanguage(languageId, callback) {
return StandaloneServices.withServices(() => {
const languageService = StandaloneServices.get(ILanguageService);
const disposable = languageService.onDidRequestRichLanguageFeatures((encounteredLanguageId) => {
if (encounteredLanguageId === languageId) {
disposable.dispose();
callback();
}
});
return disposable;
});
}
function onLanguageEncountered(languageId, callback) {
return StandaloneServices.withServices(() => {
const languageService = StandaloneServices.get(ILanguageService);
const disposable = languageService.onDidRequestBasicLanguageFeatures((encounteredLanguageId) => {
if (encounteredLanguageId === languageId) {
disposable.dispose();
callback();
}
});
return disposable;
});
}
function setLanguageConfiguration(languageId, configuration) {
const languageService = StandaloneServices.get(ILanguageService);
if (!languageService.isRegisteredLanguageId(languageId)) {
throw new Error(`Cannot set configuration for unknown language ${languageId}`);
}
const languageConfigurationService = StandaloneServices.get(ILanguageConfigurationService);
return languageConfigurationService.register(languageId, configuration, 100);
}
function isATokensProvider(provider) {
return typeof provider.getInitialState === "function";
}
function isEncodedTokensProvider(provider) {
return "tokenizeEncoded" in provider;
}
function isThenable2(obj) {
return obj && typeof obj.then === "function";
}
function setColorMap(colorMap) {
const standaloneThemeService = StandaloneServices.get(IStandaloneThemeService);
if (colorMap) {
const result = [null];
for (let i = 1, len = colorMap.length; i < len; i++) {
result[i] = Color.fromHex(colorMap[i]);
}
standaloneThemeService.setColorMapOverride(result);
} else {
standaloneThemeService.setColorMapOverride(null);
}
}
function createTokenizationSupportAdapter(languageId, provider) {
if (isEncodedTokensProvider(provider)) {
return new EncodedTokenizationSupportAdapter(languageId, provider);
} else {
return new TokenizationSupportAdapter(languageId, provider, StandaloneServices.get(ILanguageService), StandaloneServices.get(IStandaloneThemeService));
}
}
function registerTokensProviderFactory(languageId, factory) {
const adaptedFactory = new LazyTokenizationSupport(() => __async(this, null, function* () {
const result = yield Promise.resolve(factory.create());
if (!result) {
return null;
}
if (isATokensProvider(result)) {
return createTokenizationSupportAdapter(languageId, result);
}
return new MonarchTokenizer(StandaloneServices.get(ILanguageService), StandaloneServices.get(IStandaloneThemeService), languageId, compile(languageId, result), StandaloneServices.get(IConfigurationService));
}));
return TokenizationRegistry2.registerFactory(languageId, adaptedFactory);
}
function setTokensProvider(languageId, provider) {
const languageService = StandaloneServices.get(ILanguageService);
if (!languageService.isRegisteredLanguageId(languageId)) {
throw new Error(`Cannot set tokens provider for unknown language ${languageId}`);
}
if (isThenable2(provider)) {
return registerTokensProviderFactory(languageId, { create: () => provider });
}
return TokenizationRegistry2.register(languageId, createTokenizationSupportAdapter(languageId, provider));
}
function setMonarchTokensProvider(languageId, languageDef) {
const create4 = (languageDef2) => {
return new MonarchTokenizer(StandaloneServices.get(ILanguageService), StandaloneServices.get(IStandaloneThemeService), languageId, compile(languageId, languageDef2), StandaloneServices.get(IConfigurationService));
};
if (isThenable2(languageDef)) {
return registerTokensProviderFactory(languageId, { create: () => languageDef });
}
return TokenizationRegistry2.register(languageId, create4(languageDef));
}
function registerReferenceProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.referenceProvider.register(languageSelector, provider);
}
function registerRenameProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.renameProvider.register(languageSelector, provider);
}
function registerNewSymbolNameProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.newSymbolNamesProvider.register(languageSelector, provider);
}
function registerSignatureHelpProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.signatureHelpProvider.register(languageSelector, provider);
}
function registerHoverProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.hoverProvider.register(languageSelector, {
provideHover: (model, position, token, context) => __async(this, null, function* () {
const word = model.getWordAtPosition(position);
return Promise.resolve(provider.provideHover(model, position, token, context)).then((value) => {
if (!value) {
return void 0;
}
if (!value.range && word) {
value.range = new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
}
if (!value.range) {
value.range = new Range(position.lineNumber, position.column, position.lineNumber, position.column);
}
return value;
});
})
});
}
function registerDocumentSymbolProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentSymbolProvider.register(languageSelector, provider);
}
function registerDocumentHighlightProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentHighlightProvider.register(languageSelector, provider);
}
function registerLinkedEditingRangeProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.linkedEditingRangeProvider.register(languageSelector, provider);
}
function registerDefinitionProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.definitionProvider.register(languageSelector, provider);
}
function registerImplementationProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.implementationProvider.register(languageSelector, provider);
}
function registerTypeDefinitionProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.typeDefinitionProvider.register(languageSelector, provider);
}
function registerCodeLensProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.codeLensProvider.register(languageSelector, provider);
}
function registerCodeActionProvider(languageSelector, provider, metadata) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.codeActionProvider.register(languageSelector, {
providedCodeActionKinds: metadata === null || metadata === void 0 ? void 0 : metadata.providedCodeActionKinds,
documentation: metadata === null || metadata === void 0 ? void 0 : metadata.documentation,
provideCodeActions: (model, range2, context, token) => {
const markerService = StandaloneServices.get(IMarkerService);
const markers = markerService.read({ resource: model.uri }).filter((m) => {
return Range.areIntersectingOrTouching(m, range2);
});
return provider.provideCodeActions(model, range2, { markers, only: context.only, trigger: context.trigger }, token);
},
resolveCodeAction: provider.resolveCodeAction
});
}
function registerDocumentFormattingEditProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentFormattingEditProvider.register(languageSelector, provider);
}
function registerDocumentRangeFormattingEditProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentRangeFormattingEditProvider.register(languageSelector, provider);
}
function registerOnTypeFormattingEditProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.onTypeFormattingEditProvider.register(languageSelector, provider);
}
function registerLinkProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.linkProvider.register(languageSelector, provider);
}
function registerCompletionItemProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.completionProvider.register(languageSelector, provider);
}
function registerColorProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.colorProvider.register(languageSelector, provider);
}
function registerFoldingRangeProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.foldingRangeProvider.register(languageSelector, provider);
}
function registerDeclarationProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.declarationProvider.register(languageSelector, provider);
}
function registerSelectionRangeProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.selectionRangeProvider.register(languageSelector, provider);
}
function registerDocumentSemanticTokensProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentSemanticTokensProvider.register(languageSelector, provider);
}
function registerDocumentRangeSemanticTokensProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.documentRangeSemanticTokensProvider.register(languageSelector, provider);
}
function registerInlineCompletionsProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.inlineCompletionsProvider.register(languageSelector, provider);
}
function registerInlineEditProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.inlineEditProvider.register(languageSelector, provider);
}
function registerInlayHintsProvider(languageSelector, provider) {
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
return languageFeaturesService.inlayHintsProvider.register(languageSelector, provider);
}
function createMonacoLanguagesAPI() {
return {
register: register3,
getLanguages,
onLanguage,
onLanguageEncountered,
getEncodedLanguageId,
// provider methods
setLanguageConfiguration,
setColorMap,
registerTokensProviderFactory,
setTokensProvider,
setMonarchTokensProvider,
registerReferenceProvider,
registerRenameProvider,
registerNewSymbolNameProvider,
registerCompletionItemProvider,
registerSignatureHelpProvider,
registerHoverProvider,
registerDocumentSymbolProvider,
registerDocumentHighlightProvider,
registerLinkedEditingRangeProvider,
registerDefinitionProvider,
registerImplementationProvider,
registerTypeDefinitionProvider,
registerCodeLensProvider,
registerCodeActionProvider,
registerDocumentFormattingEditProvider,
registerDocumentRangeFormattingEditProvider,
registerOnTypeFormattingEditProvider,
registerLinkProvider,
registerColorProvider,
registerFoldingRangeProvider,
registerDeclarationProvider,
registerSelectionRangeProvider,
registerDocumentSemanticTokensProvider,
registerDocumentRangeSemanticTokensProvider,
registerInlineCompletionsProvider,
registerInlineEditProvider,
registerInlayHintsProvider,
// enums
DocumentHighlightKind: DocumentHighlightKind2,
CompletionItemKind,
CompletionItemTag,
CompletionItemInsertTextRule,
SymbolKind,
SymbolTag,
IndentAction,
CompletionTriggerKind,
SignatureHelpTriggerKind: SignatureHelpTriggerKind2,
InlayHintKind: InlayHintKind2,
InlineCompletionTriggerKind: InlineCompletionTriggerKind2,
InlineEditTriggerKind: InlineEditTriggerKind2,
CodeActionTriggerType,
NewSymbolNameTag: NewSymbolNameTag2,
NewSymbolNameTriggerKind: NewSymbolNameTriggerKind2,
PartialAcceptTriggerKind,
HoverVerbosityAction: HoverVerbosityAction2,
// classes
FoldingRangeKind,
SelectedSuggestionInfo
};
}
var EncodedTokenizationSupportAdapter, TokenizationSupportAdapter;
var init_standaloneLanguages = __esm({
"node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLanguages.js"() {
init_color();
init_range();
init_languages();
init_language();
init_languageConfigurationRegistry();
init_modesRegistry();
init_languageFeatures();
init_standaloneEnums();
init_standaloneServices();
init_monarchCompile();
init_monarchLexer();
init_standaloneTheme();
init_configuration();
init_markers();
EncodedTokenizationSupportAdapter = class {
constructor(languageId, actual) {
this._languageId = languageId;
this._actual = actual;
}
dispose() {
}
getInitialState() {
return this._actual.getInitialState();
}
tokenize(line, hasEOL, state) {
if (typeof this._actual.tokenize === "function") {
return TokenizationSupportAdapter.adaptTokenize(this._languageId, this._actual, line, state);
}
throw new Error("Not supported!");
}
tokenizeEncoded(line, hasEOL, state) {
const result = this._actual.tokenizeEncoded(line, state);
return new EncodedTokenizationResult(result.tokens, result.endState);
}
};
TokenizationSupportAdapter = class _TokenizationSupportAdapter {
constructor(_languageId, _actual, _languageService, _standaloneThemeService) {
this._languageId = _languageId;
this._actual = _actual;
this._languageService = _languageService;
this._standaloneThemeService = _standaloneThemeService;
}
dispose() {
}
getInitialState() {
return this._actual.getInitialState();
}
static _toClassicTokens(tokens, language82) {
const result = [];
let previousStartIndex = 0;
for (let i = 0, len = tokens.length; i < len; i++) {
const t4 = tokens[i];
let startIndex = t4.startIndex;
if (i === 0) {
startIndex = 0;
} else if (startIndex < previousStartIndex) {
startIndex = previousStartIndex;
}
result[i] = new Token(startIndex, t4.scopes, language82);
previousStartIndex = startIndex;
}
return result;
}
static adaptTokenize(language82, actual, line, state) {
const actualResult = actual.tokenize(line, state);
const tokens = _TokenizationSupportAdapter._toClassicTokens(actualResult.tokens, language82);
let endState;
if (actualResult.endState.equals(state)) {
endState = state;
} else {
endState = actualResult.endState;
}
return new TokenizationResult(tokens, endState);
}
tokenize(line, hasEOL, state) {
return _TokenizationSupportAdapter.adaptTokenize(this._languageId, this._actual, line, state);
}
_toBinaryTokens(languageIdCodec, tokens) {
const languageId = languageIdCodec.encodeLanguageId(this._languageId);
const tokenTheme = this._standaloneThemeService.getColorTheme().tokenTheme;
const result = [];
let resultLen = 0;
let previousStartIndex = 0;
for (let i = 0, len = tokens.length; i < len; i++) {
const t4 = tokens[i];
const metadata = tokenTheme.match(languageId, t4.scopes) | 1024;
if (resultLen > 0 && result[resultLen - 1] === metadata) {
continue;
}
let startIndex = t4.startIndex;
if (i === 0) {
startIndex = 0;
} else if (startIndex < previousStartIndex) {
startIndex = previousStartIndex;
}
result[resultLen++] = startIndex;
result[resultLen++] = metadata;
previousStartIndex = startIndex;
}
const actualResult = new Uint32Array(resultLen);
for (let i = 0; i < resultLen; i++) {
actualResult[i] = result[i];
}
return actualResult;
}
tokenizeEncoded(line, hasEOL, state) {
const actualResult = this._actual.tokenize(line, state);
const tokens = this._toBinaryTokens(this._languageService.languageIdCodec, actualResult.tokens);
let endState;
if (actualResult.endState.equals(state)) {
endState = state;
} else {
endState = actualResult.endState;
}
return new EncodedTokenizationResult(tokens, endState);
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js
var IEditorCancellationTokens, ctxCancellableOperation, EditorKeybindingCancellationTokenSource;
var init_keybindingCancellation = __esm({
"node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js"() {
init_editorExtensions();
init_contextkey();
init_cancellation();
init_linkedList();
init_instantiation();
init_extensions();
init_nls();
IEditorCancellationTokens = createDecorator("IEditorCancelService");
ctxCancellableOperation = new RawContextKey("cancellableOperation", false, localize("cancellableOperation", "Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));
registerSingleton(
IEditorCancellationTokens,
class {
constructor() {
this._tokens = /* @__PURE__ */ new WeakMap();
}
add(editor2, cts) {
let data = this._tokens.get(editor2);
if (!data) {
data = editor2.invokeWithinContext((accessor) => {
const key = ctxCancellableOperation.bindTo(accessor.get(IContextKeyService));
const tokens = new LinkedList();
return { key, tokens };
});
this._tokens.set(editor2, data);
}
let removeFn;
data.key.set(true);
removeFn = data.tokens.push(cts);
return () => {
if (removeFn) {
removeFn();
data.key.set(!data.tokens.isEmpty());
removeFn = void 0;
}
};
}
cancel(editor2) {
const data = this._tokens.get(editor2);
if (!data) {
return;
}
const cts = data.tokens.pop();
if (cts) {
cts.cancel();
data.key.set(!data.tokens.isEmpty());
}
}
},
1
/* InstantiationType.Delayed */
);
EditorKeybindingCancellationTokenSource = class extends CancellationTokenSource {
constructor(editor2, parent) {
super(parent);
this.editor = editor2;
this._unregister = editor2.invokeWithinContext((accessor) => accessor.get(IEditorCancellationTokens).add(editor2, this));
}
dispose() {
this._unregister();
super.dispose();
}
};
registerEditorCommand(new class extends EditorCommand {
constructor() {
super({
id: "editor.cancelOperation",
kbOpts: {
weight: 100,
primary: 9
/* KeyCode.Escape */
},
precondition: ctxCancellableOperation
});
}
runEditorCommand(accessor, editor2) {
accessor.get(IEditorCancellationTokens).cancel(editor2);
}
}());
}
});
// node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/editorState.js
var EditorState, EditorStateCancellationTokenSource, TextModelCancellationTokenSource;
var init_editorState = __esm({
"node_modules/monaco-editor/esm/vs/editor/contrib/editorState/browser/editorState.js"() {
init_strings();
init_range();
init_cancellation();
init_lifecycle();
init_keybindingCancellation();
EditorState = class _EditorState {
constructor(editor2, flags) {
this.flags = flags;
if ((this.flags & 1) !== 0) {
const model = editor2.getModel();
this.modelVersionId = model ? format("{0}#{1}", model.uri.toString(), model.getVersionId()) : null;
} else {
this.modelVersionId = null;
}
if ((this.flags & 4) !== 0) {
this.position = editor2.getPosition();
} else {
this.position = null;
}
if ((this.flags & 2) !== 0) {
this.selection = editor2.getSelection();
} else {
this.selection = null;
}
if ((this.flags & 8) !== 0) {
this.scrollLeft = editor2.getScrollLeft();
this.scrollTop = editor2.getScrollTop();
} else {
this.scrollLeft = -1;
this.scrollTop = -1;
}
}
_equals(other) {
if (!(other instanceof _EditorState)) {
return false;
}
const state = other;
if (this.modelVersionId !== state.modelVersionId) {
return false;
}
if (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {
return false;
}
if (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {
return false;
}
if (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {
return false;
}
return true;
}
validate(editor2) {
return this._equals(new _EditorState(editor2, this.flags));
}
};
EditorStateCancellationTokenSource = class extends EditorKeybindingCancellationTokenSource {
constructor(editor2, flags, range2, parent) {
super(editor2, parent);
this._listener = new DisposableStore();
if (flags & 4) {
this._listener.add(editor2.onDidChangeCursorPosition((e) => {
if (!range2 || !Range.containsPosition(range2, e.position)) {
this.cancel();
}
}));
}
if (flags & 2) {
this._listener.add(editor2.onDidChangeCursorSelection((e) => {
if (!range2 || !Range.containsRange(range2, e.selection)) {
this.cancel();
}
}));
}
if (flags & 8) {
this._listener.add(editor2.onDidScrollChange((_) => this.cancel()));
}
if (flags & 1) {
this._listener.add(editor2.onDidChangeModel((_) => this.cancel()));
this._listener.add(editor2.onDidChangeModelContent((_) => this.cancel()));
}
}
dispose() {
this._listener.dispose();
super.dispose();
}
};
TextModelCancellationTokenSource = class extends CancellationTokenSource {
constructor(model, parent) {
super(parent);
this._listener = model.onDidChangeContent(() => this.cancel());
}
dispose() {
this._listener.dispose();
super.dispose();
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/browser/editorBrowser.js
function isCodeEditor(thing) {
if (thing && typeof thing.getEditorType === "function") {
return thing.getEditorType() === EditorType.ICodeEditor;
} else {
return false;
}
}
function isDiffEditor(thing) {
if (thing && typeof thing.getEditorType === "function") {
return thing.getEditorType() === EditorType.IDiffEditor;
} else {
return false;
}
}
function isCompositeEditor(thing) {
return !!thing && typeof thing === "object" && typeof thing.onDidChangeActiveEditor === "function";
}
function getCodeEditor(thing) {
if (isCodeEditor(thing)) {
return thing;
}
if (isDiffEditor(thing)) {
return thing.getModifiedEditor();
}
if (isCompositeEditor(thing) && isCodeEditor(thing.activeCodeEditor)) {
return thing.activeCodeEditor;
}
return null;
}
var init_editorBrowser = __esm({
"node_modules/monaco-editor/esm/vs/editor/browser/editorBrowser.js"() {
init_editorCommon();
}
});
// node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/formattingEdit.js
var FormattingEdit;
var init_formattingEdit = __esm({
"node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/formattingEdit.js"() {
init_editOperation();
init_range();
init_stableEditorScroll();
FormattingEdit = class _FormattingEdit {
static _handleEolEdits(editor2, edits) {
let newEol = void 0;
const singleEdits = [];
for (const edit of edits) {
if (typeof edit.eol === "number") {
newEol = edit.eol;
}
if (edit.range && typeof edit.text === "string") {
singleEdits.push(edit);
}
}
if (typeof newEol === "number") {
if (editor2.hasModel()) {
editor2.getModel().pushEOL(newEol);
}
}
return singleEdits;
}
static _isFullModelReplaceEdit(editor2, edit) {
if (!editor2.hasModel()) {
return false;
}
const model = editor2.getModel();
const editRange = model.validateRange(edit.range);
const fullModelRange = model.getFullModelRange();
return fullModelRange.equalsRange(editRange);
}
static execute(editor2, _edits, addUndoStops) {
if (addUndoStops) {
editor2.pushUndoStop();
}
const scrollState = StableEditorScrollState.capture(editor2);
const edits = _FormattingEdit._handleEolEdits(editor2, _edits);
if (edits.length === 1 && _FormattingEdit._isFullModelReplaceEdit(editor2, edits[0])) {
editor2.executeEdits("formatEditsCommand", edits.map((edit) => EditOperation.replace(Range.lift(edit.range), edit.text)));
} else {
editor2.executeEdits("formatEditsCommand", edits.map((edit) => EditOperation.replaceMove(Range.lift(edit.range), edit.text)));
}
if (addUndoStops) {
editor2.pushUndoStop();
}
scrollState.restoreRelativeVerticalPositionOfCursor(editor2);
}
};
}
});
// node_modules/monaco-editor/esm/vs/platform/extensions/common/extensions.js
var ExtensionIdentifier, ExtensionIdentifierSet;
var init_extensions2 = __esm({
"node_modules/monaco-editor/esm/vs/platform/extensions/common/extensions.js"() {
ExtensionIdentifier = class {
constructor(value) {
this.value = value;
this._lower = value.toLowerCase();
}
/**
* Gives the value by which to index (for equality).
*/
static toKey(id) {
if (typeof id === "string") {
return id.toLowerCase();
}
return id._lower;
}
};
ExtensionIdentifierSet = class {
constructor(iterable) {
this._set = /* @__PURE__ */ new Set();
if (iterable) {
for (const value of iterable) {
this.add(value);
}
}
}
add(id) {
this._set.add(ExtensionIdentifier.toKey(id));
}
has(id) {
return this._set.has(ExtensionIdentifier.toKey(id));
}
};
}
});
// node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/format.js
function getRealAndSyntheticDocumentFormattersOrdered(documentFormattingEditProvider, documentRangeFormattingEditProvider, model) {
const result = [];
const seen = new ExtensionIdentifierSet();
const docFormatter = documentFormattingEditProvider.ordered(model);
for (const formatter of docFormatter) {
result.push(formatter);
if (formatter.extensionId) {
seen.add(formatter.extensionId);
}
}
const rangeFormatter = documentRangeFormattingEditProvider.ordered(model);
for (const formatter of rangeFormatter) {
if (formatter.extensionId) {
if (seen.has(formatter.extensionId)) {
continue;
}
seen.add(formatter.extensionId);
}
result.push({
displayName: formatter.displayName,
extensionId: formatter.extensionId,
provideDocumentFormattingEdits(model2, options2, token) {
return formatter.provideDocumentRangeFormattingEdits(model2, model2.getFullModelRange(), options2, token);
}
});
}
return result;
}
function formatDocumentRangesWithSelectedProvider(accessor, editorOrModel, rangeOrRanges, mode, progress, token, userGesture) {
return __async(this, null, function* () {
const instaService = accessor.get(IInstantiationService);
const { documentRangeFormattingEditProvider: documentRangeFormattingEditProviderRegistry } = accessor.get(ILanguageFeaturesService);
const model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;
const provider = documentRangeFormattingEditProviderRegistry.ordered(model);
const selected = yield FormattingConflicts.select(
provider,
model,
mode,
2
/* FormattingKind.Selection */
);
if (selected) {
progress.report(selected);
yield instaService.invokeFunction(formatDocumentRangesWithProvider, selected, editorOrModel, rangeOrRanges, token, userGesture);
}
});
}
function formatDocumentRangesWithProvider(accessor, provider, editorOrModel, rangeOrRanges, token, userGesture) {
return __async(this, null, function* () {
var _a10, _b4;
const workerService = accessor.get(IEditorWorkerService);
const logService = accessor.get(ILogService);
const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
let model;
let cts;
if (isCodeEditor(editorOrModel)) {
model = editorOrModel.getModel();
cts = new EditorStateCancellationTokenSource(editorOrModel, 1 | 4, void 0, token);
} else {
model = editorOrModel;
cts = new TextModelCancellationTokenSource(editorOrModel, token);
}
const ranges = [];
let len = 0;
for (const range2 of asArray(rangeOrRanges).sort(Range.compareRangesUsingStarts)) {
if (len > 0 && Range.areIntersectingOrTouching(ranges[len - 1], range2)) {
ranges[len - 1] = Range.fromPositions(ranges[len - 1].getStartPosition(), range2.getEndPosition());
} else {
len = ranges.push(range2);
}
}
const computeEdits = (range2) => __async(this, null, function* () {
var _a11, _b5;
logService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, (_a11 = provider.extensionId) === null || _a11 === void 0 ? void 0 : _a11.value, range2);
const result = (yield provider.provideDocumentRangeFormattingEdits(model, range2, model.getFormattingOptions(), cts.token)) || [];
logService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, (_b5 = provider.extensionId) === null || _b5 === void 0 ? void 0 : _b5.value, result);
return result;
});
const hasIntersectingEdit = (a3, b) => {
if (!a3.length || !b.length) {
return false;
}
const mergedA = a3.reduce((acc, val) => {
return Range.plusRange(acc, val.range);
}, a3[0].range);
if (!b.some((x) => {
return Range.intersectRanges(mergedA, x.range);
})) {
return false;
}
for (const edit of a3) {
for (const otherEdit of b) {
if (Range.intersectRanges(edit.range, otherEdit.range)) {
return true;
}
}
}
return false;
};
const allEdits = [];
const rawEditsList = [];
try {
if (typeof provider.provideDocumentRangesFormattingEdits === "function") {
logService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, (_a10 = provider.extensionId) === null || _a10 === void 0 ? void 0 : _a10.value, ranges);
const result = (yield provider.provideDocumentRangesFormattingEdits(model, ranges, model.getFormattingOptions(), cts.token)) || [];
logService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, (_b4 = provider.extensionId) === null || _b4 === void 0 ? void 0 : _b4.value, result);
rawEditsList.push(result);
} else {
for (const range2 of ranges) {
if (cts.token.isCancellationRequested) {
return true;
}
rawEditsList.push(yield computeEdits(range2));
}
for (let i = 0; i < ranges.length; ++i) {
for (let j = i + 1; j < ranges.length; ++j) {
if (cts.token.isCancellationRequested) {
return true;
}
if (hasIntersectingEdit(rawEditsList[i], rawEditsList[j])) {
const mergedRange = Range.plusRange(ranges[i], ranges[j]);
const edits = yield computeEdits(mergedRange);
ranges.splice(j, 1);
ranges.splice(i, 1);
ranges.push(mergedRange);
rawEditsList.splice(j, 1);
rawEditsList.splice(i, 1);
rawEditsList.push(edits);
i = 0;
j = 0;
}
}
}
}
for (const rawEdits of rawEditsList) {
if (cts.token.isCancellationRequested) {
return true;
}
const minimalEdits = yield workerService.computeMoreMinimalEdits(model.uri, rawEdits);
if (minimalEdits) {
allEdits.push(...minimalEdits);
}
}
} finally {
cts.dispose();
}
if (allEdits.length === 0) {
return false;
}
if (isCodeEditor(editorOrModel)) {
FormattingEdit.execute(editorOrModel, allEdits, true);
editorOrModel.revealPositionInCenterIfOutsideViewport(
editorOrModel.getPosition(),
1
/* ScrollType.Immediate */
);
} else {
const [{ range: range2 }] = allEdits;
const initialSelection = new Selection(range2.startLineNumber, range2.startColumn, range2.endLineNumber, range2.endColumn);
model.pushEditOperations([initialSelection], allEdits.map((edit) => {
return {
text: edit.text,
range: Range.lift(edit.range),
forceMoveMarkers: true
};
}), (undoEdits) => {
for (const { range: range3 } of undoEdits) {
if (Range.areIntersectingOrTouching(range3, initialSelection)) {
return [new Selection(range3.startLineNumber, range3.startColumn, range3.endLineNumber, range3.endColumn)];
}
}
return null;
});
}
accessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });
return true;
});
}
function formatDocumentWithSelectedProvider(accessor, editorOrModel, mode, progress, token, userGesture) {
return __async(this, null, function* () {
const instaService = accessor.get(IInstantiationService);
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
const model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;
const provider = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);
const selected = yield FormattingConflicts.select(
provider,
model,
mode,
1
/* FormattingKind.File */
);
if (selected) {
progress.report(selected);
yield instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token, userGesture);
}
});
}
function formatDocumentWithProvider(accessor, provider, editorOrModel, mode, token, userGesture) {
return __async(this, null, function* () {
const workerService = accessor.get(IEditorWorkerService);
const accessibilitySignalService = accessor.get(IAccessibilitySignalService);
let model;
let cts;
if (isCodeEditor(editorOrModel)) {
model = editorOrModel.getModel();
cts = new EditorStateCancellationTokenSource(editorOrModel, 1 | 4, void 0, token);
} else {
model = editorOrModel;
cts = new TextModelCancellationTokenSource(editorOrModel, token);
}
let edits;
try {
const rawEdits = yield provider.provideDocumentFormattingEdits(model, model.getFormattingOptions(), cts.token);
edits = yield workerService.computeMoreMinimalEdits(model.uri, rawEdits);
if (cts.token.isCancellationRequested) {
return true;
}
} finally {
cts.dispose();
}
if (!edits || edits.length === 0) {
return false;
}
if (isCodeEditor(editorOrModel)) {
FormattingEdit.execute(
editorOrModel,
edits,
mode !== 2
/* FormattingMode.Silent */
);
if (mode !== 2) {
editorOrModel.revealPositionInCenterIfOutsideViewport(
editorOrModel.getPosition(),
1
/* ScrollType.Immediate */
);
}
} else {
const [{ range: range2 }] = edits;
const initialSelection = new Selection(range2.startLineNumber, range2.startColumn, range2.endLineNumber, range2.endColumn);
model.pushEditOperations([initialSelection], edits.map((edit) => {
return {
text: edit.text,
range: Range.lift(edit.range),
forceMoveMarkers: true
};
}), (undoEdits) => {
for (const { range: range3 } of undoEdits) {
if (Range.areIntersectingOrTouching(range3, initialSelection)) {
return [new Selection(range3.startLineNumber, range3.startColumn, range3.endLineNumber, range3.endColumn)];
}
}
return null;
});
}
accessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });
return true;
});
}
function getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, model, range2, options2, token) {
return __async(this, null, function* () {
const providers = languageFeaturesService.documentRangeFormattingEditProvider.ordered(model);
for (const provider of providers) {
const rawEdits = yield Promise.resolve(provider.provideDocumentRangeFormattingEdits(model, range2, options2, token)).catch(onUnexpectedExternalError);
if (isNonEmptyArray(rawEdits)) {
return yield workerService.computeMoreMinimalEdits(model.uri, rawEdits);
}
}
return void 0;
});
}
function getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, model, options2, token) {
return __async(this, null, function* () {
const providers = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);
for (const provider of providers) {
const rawEdits = yield Promise.resolve(provider.provideDocumentFormattingEdits(model, options2, token)).catch(onUnexpectedExternalError);
if (isNonEmptyArray(rawEdits)) {
return yield workerService.computeMoreMinimalEdits(model.uri, rawEdits);
}
}
return void 0;
});
}
function getOnTypeFormattingEdits(workerService, languageFeaturesService, model, position, ch, options2, token) {
const providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);
if (providers.length === 0) {
return Promise.resolve(void 0);
}
if (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {
return Promise.resolve(void 0);
}
return Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options2, token)).catch(onUnexpectedExternalError).then((edits) => {
return workerService.computeMoreMinimalEdits(model.uri, edits);
});
}
var FormattingConflicts;
var init_format = __esm({
"node_modules/monaco-editor/esm/vs/editor/contrib/format/browser/format.js"() {
init_arrays();
init_cancellation();
init_errors();
init_iterator();
init_linkedList();
init_types();
init_uri();
init_editorState();
init_editorBrowser();
init_position();
init_range();
init_selection();
init_editorWorker();
init_resolverService();
init_formattingEdit();
init_commands();
init_extensions2();
init_instantiation();
init_languageFeatures();
init_log();
init_accessibilitySignalService();
FormattingConflicts = class _FormattingConflicts {
static setFormatterSelector(selector) {
const remove = _FormattingConflicts._selectors.unshift(selector);
return { dispose: remove };
}
static select(formatter, document2, mode, kind) {
return __async(this, null, function* () {
if (formatter.length === 0) {
return void 0;
}
const selector = Iterable.first(_FormattingConflicts._selectors);
if (selector) {
return yield selector(formatter, document2, mode, kind);
}
return void 0;
});
}
};
FormattingConflicts._selectors = new LinkedList();
CommandsRegistry.registerCommand("_executeFormatRangeProvider", function(accessor, ...args) {
return __async(this, null, function* () {
const [resource, range2, options2] = args;
assertType(URI.isUri(resource));
assertType(Range.isIRange(range2));
const resolverService = accessor.get(ITextModelService);
const workerService = accessor.get(IEditorWorkerService);
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
const reference = yield resolverService.createModelReference(resource);
try {
return getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, Range.lift(range2), options2, CancellationToken.None);
} finally {
reference.dispose();
}
});
});
CommandsRegistry.registerCommand("_executeFormatDocumentProvider", function(accessor, ...args) {
return __async(this, null, function* () {
const [resource, options2] = args;
assertType(URI.isUri(resource));
const resolverService = accessor.get(ITextModelService);
const workerService = accessor.get(IEditorWorkerService);
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
const reference = yield resolverService.createModelReference(resource);
try {
return getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, options2, CancellationToken.None);
} finally {
reference.dispose();
}
});
});
CommandsRegistry.registerCommand("_executeFormatOnTypeProvider", function(accessor, ...args) {
return __async(this, null, function* () {
const [resource, position, ch, options2] = args;
assertType(URI.isUri(resource));
assertType(Position.isIPosition(position));
assertType(typeof ch === "string");
const resolverService = accessor.get(ITextModelService);
const workerService = accessor.get(IEditorWorkerService);
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
const reference = yield resolverService.createModelReference(resource);
try {
return getOnTypeFormattingEdits(workerService, languageFeaturesService, reference.object.textEditorModel, Position.lift(position), ch, options2, CancellationToken.None);
} finally {
reference.dispose();
}
});
});
}
});
// node_modules/monaco-editor/esm/vs/editor/editor.api.js
var editor_api_exports = {};
__export(editor_api_exports, {
CancellationTokenSource: () => CancellationTokenSource2,
Emitter: () => Emitter2,
KeyCode: () => KeyCode2,
KeyMod: () => KeyMod2,
MarkerSeverity: () => MarkerSeverity3,
MarkerTag: () => MarkerTag2,
Position: () => Position2,
Range: () => Range3,
Selection: () => Selection2,
SelectionDirection: () => SelectionDirection2,
Token: () => Token3,
Uri: () => Uri2,
editor: () => editor,
languages: () => languages
});
var api, CancellationTokenSource2, Emitter2, KeyCode2, KeyMod2, Position2, Range3, Selection2, SelectionDirection2, MarkerSeverity3, MarkerTag2, Uri2, Token3, editor, languages, monacoEnvironment;
var init_editor_api = __esm({
"node_modules/monaco-editor/esm/vs/editor/editor.api.js"() {
init_editorOptions();
init_editorBaseApi();
init_standaloneEditor();
init_standaloneLanguages();
init_format();
EditorOptions.wrappingIndent.defaultValue = 0;
EditorOptions.glyphMargin.defaultValue = false;
EditorOptions.autoIndent.defaultValue = 3;
EditorOptions.overviewRulerLanes.defaultValue = 2;
FormattingConflicts.setFormatterSelector((formatter, document2, mode) => Promise.resolve(formatter[0]));
api = createMonacoBaseAPI();
api.editor = createMonacoEditorAPI();
api.languages = createMonacoLanguagesAPI();
CancellationTokenSource2 = api.CancellationTokenSource;
Emitter2 = api.Emitter;
KeyCode2 = api.KeyCode;
KeyMod2 = api.KeyMod;
Position2 = api.Position;
Range3 = api.Range;
Selection2 = api.Selection;
SelectionDirection2 = api.SelectionDirection;
MarkerSeverity3 = api.MarkerSeverity;
MarkerTag2 = api.MarkerTag;
Uri2 = api.Uri;
Token3 = api.Token;
editor = api.editor;
languages = api.languages;
monacoEnvironment = globalThis.MonacoEnvironment;
if ((monacoEnvironment === null || monacoEnvironment === void 0 ? void 0 : monacoEnvironment.globalAPI) || typeof define === "function" && define.amd) {
globalThis.monaco = api;
}
if (typeof globalThis.require !== "undefined" && 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"
]
});
}
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.js
var abap_exports = {};
__export(abap_exports, {
conf: () => conf,
language: () => language2
});
var conf, language2;
var init_abap = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/abap/abap.js"() {
conf = {
comments: {
lineComment: "*"
},
brackets: [
["[", "]"],
["(", ")"]
]
};
language2 = {
defaultToken: "invalid",
ignoreCase: true,
tokenPostfix: ".abap",
keywords: [
"abap-source",
"abbreviated",
"abstract",
"accept",
"accepting",
"according",
"activation",
"actual",
"add",
"add-corresponding",
"adjacent",
"after",
"alias",
"aliases",
"align",
"all",
"allocate",
"alpha",
"analysis",
"analyzer",
"and",
// also an operator
"append",
"appendage",
"appending",
"application",
"archive",
"area",
"arithmetic",
"as",
"ascending",
"aspect",
"assert",
"assign",
"assigned",
"assigning",
"association",
"asynchronous",
"at",
"attributes",
"authority",
"authority-check",
"avg",
"back",
"background",
"backup",
"backward",
"badi",
"base",
"before",
"begin",
"between",
// also an operator
"big",
"binary",
"bintohex",
"bit",
"black",
"blank",
"blanks",
"blob",
"block",
"blocks",
"blue",
"bound",
"boundaries",
"bounds",
"boxed",
"break-point",
"buffer",
"by",
"bypassing",
"byte",
"byte-order",
"call",
"calling",
"case",
"cast",
"casting",
"catch",
"center",
"centered",
"chain",
"chain-input",
"chain-request",
"change",
"changing",
"channels",
"character",
"char-to-hex",
"check",
"checkbox",
"ci_",
"circular",
"class",
"class-coding",
"class-data",
"class-events",
"class-methods",
"class-pool",
"cleanup",
"clear",
"client",
"clob",
"clock",
"close",
"coalesce",
"code",
"coding",
"col_background",
"col_group",
"col_heading",
"col_key",
"col_negative",
"col_normal",
"col_positive",
"col_total",
"collect",
"color",
"column",
"columns",
"comment",
"comments",
"commit",
"common",
"communication",
"comparing",
"component",
"components",
"compression",
"compute",
"concat",
"concat_with_space",
"concatenate",
"cond",
"condense",
// also a built-in
"condition",
"connect",
"connection",
"constants",
"context",
"contexts",
"continue",
"control",
"controls",
"conv",
"conversion",
"convert",
"copies",
"copy",
"corresponding",
"country",
"cover",
"cpi",
"create",
"creating",
"critical",
"currency",
"currency_conversion",
"current",
"cursor",
"cursor-selection",
"customer",
"customer-function",
"dangerous",
"data",
"database",
"datainfo",
"dataset",
"date",
"dats_add_days",
"dats_add_months",
"dats_days_between",
"dats_is_valid",
"daylight",
"dd/mm/yy",
"dd/mm/yyyy",
"ddmmyy",
"deallocate",
"decimal_shift",
"decimals",
"declarations",
"deep",
"default",
"deferred",
"define",
"defining",
"definition",
"delete",
"deleting",
"demand",
"department",
"descending",
"describe",
"destination",
"detail",
"dialog",
"directory",
"disconnect",
"display",
"display-mode",
"distinct",
"divide",
"divide-corresponding",
"division",
"do",
"dummy",
"duplicate",
"duplicates",
"duration",
"during",
"dynamic",
"dynpro",
"edit",
"editor-call",
"else",
"elseif",
"empty",
"enabled",
"enabling",
"encoding",
"end",
"endat",
"endcase",
"endcatch",
"endchain",
"endclass",
"enddo",
"endenhancement",
"end-enhancement-section",
"endexec",
"endform",
"endfunction",
"endian",
"endif",
"ending",
"endinterface",
"end-lines",
"endloop",
"endmethod",
"endmodule",
"end-of-definition",
"end-of-editing",
"end-of-file",
"end-of-page",
"end-of-selection",
"endon",
"endprovide",
"endselect",
"end-test-injection",
"end-test-seam",
"endtry",
"endwhile",
"endwith",
"engineering",
"enhancement",
"enhancement-point",
"enhancements",
"enhancement-section",
"entries",
"entry",
"enum",
"environment",
"equiv",
// also an operator
"errormessage",
"errors",
"escaping",
"event",
"events",
"exact",
"except",
"exception",
"exceptions",
"exception-table",
"exclude",
"excluding",
"exec",
"execute",
"exists",
"exit",
"exit-command",
"expand",
"expanding",
"expiration",
"explicit",
"exponent",
"export",
"exporting",
"extend",
"extended",
"extension",
"extract",
"fail",
"fetch",
"field",
"field-groups",
"fields",
"field-symbol",
"field-symbols",
"file",
"filter",
"filters",
"filter-table",
"final",
"find",
// also a built-in
"first",
"first-line",
"fixed-point",
"fkeq",
"fkge",
"flush",
"font",
"for",
"form",
"format",
"forward",
"found",
"frame",
"frames",
"free",
"friends",
"from",
"function",
"functionality",
"function-pool",
"further",
"gaps",
"generate",
"get",
"giving",
"gkeq",
"gkge",
"global",
"grant",
"green",
"group",
"groups",
"handle",
"handler",
"harmless",
"hashed",
// also a table type
"having",
"hdb",
"header",
"headers",
"heading",
"head-lines",
"help-id",
"help-request",
"hextobin",
"hide",
"high",
"hint",
"hold",
"hotspot",
"icon",
"id",
"identification",
"identifier",
"ids",
"if",
"ignore",
"ignoring",
"immediately",
"implementation",
"implementations",
"implemented",
"implicit",
"import",
"importing",
"in",
// also an operator
"inactive",
"incl",
"include",
"includes",
"including",
"increment",
"index",
// also a table type
"index-line",
"infotypes",
"inheriting",
"init",
"initial",
"initialization",
"inner",
"inout",
"input",
"insert",
// also a built-in
"instance",
"instances",
"instr",
"intensified",
"interface",
"interface-pool",
"interfaces",
"internal",
"intervals",
"into",
"inverse",
"inverted-date",
"is",
"iso",
"job",
"join",
"keep",
"keeping",
"kernel",
"key",
"keys",
"keywords",
"kind",
"language",
"last",
"late",
"layout",
"leading",
"leave",
"left",
"left-justified",
"leftplus",
"leftspace",
"legacy",
"length",
"let",
"level",
"levels",
"like",
"line",
"lines",
// also a built-in
"line-count",
"linefeed",
"line-selection",
"line-size",
"list",
"listbox",
"list-processing",
"little",
"llang",
"load",
"load-of-program",
"lob",
"local",
"locale",
"locator",
"logfile",
"logical",
"log-point",
"long",
"loop",
"low",
"lower",
"lpad",
"lpi",
"ltrim",
"mail",
"main",
"major-id",
"mapping",
"margin",
"mark",
"mask",
"match",
// also a built-in
"matchcode",
"max",
"maximum",
"medium",
"members",
"memory",
"mesh",
"message",
"message-id",
"messages",
"messaging",
"method",
"methods",
"min",
"minimum",
"minor-id",
"mm/dd/yy",
"mm/dd/yyyy",
"mmddyy",
"mode",
"modif",
"modifier",
"modify",
"module",
"move",
"move-corresponding",
"multiply",
"multiply-corresponding",
"name",
"nametab",
"native",
"nested",
"nesting",
"new",
"new-line",
"new-page",
"new-section",
"next",
"no",
"no-display",
"no-extension",
"no-gap",
"no-gaps",
"no-grouping",
"no-heading",
"no-scrolling",
"no-sign",
"no-title",
"no-topofpage",
"no-zero",
"node",
"nodes",
"non-unicode",
"non-unique",
"not",
// also an operator
"null",
"number",
"object",
// also a data type
"objects",
"obligatory",
"occurrence",
"occurrences",
"occurs",
"of",
"off",
"offset",
"ole",
"on",
"only",
"open",
"option",
"optional",
"options",
"or",
// also an operator
"order",
"other",
"others",
"out",
"outer",
"output",
"output-length",
"overflow",
"overlay",
"pack",
"package",
"pad",
"padding",
"page",
"pages",
"parameter",
"parameters",
"parameter-table",
"part",
"partially",
"pattern",
"percentage",
"perform",
"performing",
"person",
"pf1",
"pf10",
"pf11",
"pf12",
"pf13",
"pf14",
"pf15",
"pf2",
"pf3",
"pf4",
"pf5",
"pf6",
"pf7",
"pf8",
"pf9",
"pf-status",
"pink",
"places",
"pool",
"pos_high",
"pos_low",
"position",
"pragmas",
"precompiled",
"preferred",
"preserving",
"primary",
"print",
"print-control",
"priority",
"private",
"procedure",
"process",
"program",
"property",
"protected",
"provide",
"public",
"push",
"pushbutton",
"put",
"queue-only",
"quickinfo",
"radiobutton",
"raise",
"raising",
"range",
"ranges",
"read",
"reader",
"read-only",
"receive",
"received",
"receiver",
"receiving",
"red",
"redefinition",
"reduce",
"reduced",
"ref",
"reference",
"refresh",
"regex",
"reject",
"remote",
"renaming",
"replace",
// also a built-in
"replacement",
"replacing",
"report",
"request",
"requested",
"reserve",
"reset",
"resolution",
"respecting",
"responsible",
"result",
"results",
"resumable",
"resume",
"retry",
"return",
"returncode",
"returning",
"returns",
"right",
"right-justified",
"rightplus",
"rightspace",
"risk",
"rmc_communication_failure",
"rmc_invalid_status",
"rmc_system_failure",
"role",
"rollback",
"rows",
"rpad",
"rtrim",
"run",
"sap",
"sap-spool",
"saving",
"scale_preserving",
"scale_preserving_scientific",
"scan",
"scientific",
"scientific_with_leading_zero",
"scroll",
"scroll-boundary",
"scrolling",
"search",
"secondary",
"seconds",
"section",
"select",
"selection",
"selections",
"selection-screen",
"selection-set",
"selection-sets",
"selection-table",
"select-options",
"send",
"separate",
"separated",
"set",
"shared",
"shift",
"short",
"shortdump-id",
"sign_as_postfix",
"single",
"size",
"skip",
"skipping",
"smart",
"some",
"sort",
"sortable",
"sorted",
// also a table type
"source",
"specified",
"split",
"spool",
"spots",
"sql",
"sqlscript",
"stable",
"stamp",
"standard",
// also a table type
"starting",
"start-of-editing",
"start-of-selection",
"state",
"statement",
"statements",
"static",
"statics",
"statusinfo",
"step-loop",
"stop",
"structure",
"structures",
"style",
"subkey",
"submatches",
"submit",
"subroutine",
"subscreen",
"subtract",
"subtract-corresponding",
"suffix",
"sum",
"summary",
"summing",
"supplied",
"supply",
"suppress",
"switch",
"switchstates",
"symbol",
"syncpoints",
"syntax",
"syntax-check",
"syntax-trace",
"system-call",
"system-exceptions",
"system-exit",
"tab",
"tabbed",
"table",
"tables",
"tableview",
"tabstrip",
"target",
"task",
"tasks",
"test",
"testing",
"test-injection",
"test-seam",
"text",
"textpool",
"then",
"throw",
"time",
"times",
"timestamp",
"timezone",
"tims_is_valid",
"title",
"titlebar",
"title-lines",
"to",
"tokenization",
"tokens",
"top-lines",
"top-of-page",
"trace-file",
"trace-table",
"trailing",
"transaction",
"transfer",
"transformation",
"translate",
// also a built-in
"transporting",
"trmac",
"truncate",
"truncation",
"try",
"tstmp_add_seconds",
"tstmp_current_utctimestamp",
"tstmp_is_valid",
"tstmp_seconds_between",
"type",
"type-pool",
"type-pools",
"types",
"uline",
"unassign",
"under",
"unicode",
"union",
"unique",
"unit_conversion",
"unix",
"unpack",
"until",
"unwind",
"up",
"update",
"upper",
"user",
"user-command",
"using",
"utf-8",
"valid",
"value",
"value-request",
"values",
"vary",
"varying",
"verification-message",
"version",
"via",
"view",
"visible",
"wait",
"warning",
"when",
"whenever",
"where",
"while",
"width",
"window",
"windows",
"with",
"with-heading",
"without",
"with-title",
"word",
"work",
"write",
"writer",
"xml",
"xsd",
"yellow",
"yes",
"yymmdd",
"zero",
"zone",
// since 7.55:
"abap_system_timezone",
"abap_user_timezone",
"access",
"action",
"adabas",
"adjust_numbers",
"allow_precision_loss",
"allowed",
"amdp",
"applicationuser",
"as_geo_json",
"as400",
"associations",
"balance",
"behavior",
"breakup",
"bulk",
"cds",
"cds_client",
"check_before_save",
"child",
"clients",
"corr",
"corr_spearman",
"cross",
"cycles",
"datn_add_days",
"datn_add_months",
"datn_days_between",
"dats_from_datn",
"dats_tims_to_tstmp",
"dats_to_datn",
"db2",
"db6",
"ddl",
"dense_rank",
"depth",
"deterministic",
"discarding",
"entities",
"entity",
"error",
"failed",
"finalize",
"first_value",
"fltp_to_dec",
"following",
"fractional",
"full",
"graph",
"grouping",
"hierarchy",
"hierarchy_ancestors",
"hierarchy_ancestors_aggregate",
"hierarchy_descendants",
"hierarchy_descendants_aggregate",
"hierarchy_siblings",
"incremental",
"indicators",
"lag",
"last_value",
"lead",
"leaves",
"like_regexpr",
"link",
"locale_sap",
"lock",
"locks",
"many",
"mapped",
"matched",
"measures",
"median",
"mssqlnt",
"multiple",
"nodetype",
"ntile",
"nulls",
"occurrences_regexpr",
"one",
"operations",
"oracle",
"orphans",
"over",
"parent",
"parents",
"partition",
"pcre",
"period",
"pfcg_mapping",
"preceding",
"privileged",
"product",
"projection",
"rank",
"redirected",
"replace_regexpr",
"reported",
"response",
"responses",
"root",
"row",
"row_number",
"sap_system_date",
"save",
"schema",
"session",
"sets",
"shortdump",
"siblings",
"spantree",
"start",
"stddev",
"string_agg",
"subtotal",
"sybase",
"tims_from_timn",
"tims_to_timn",
"to_blob",
"to_clob",
"total",
"trace-entry",
"tstmp_to_dats",
"tstmp_to_dst",
"tstmp_to_tims",
"tstmpl_from_utcl",
"tstmpl_to_utcl",
"unbounded",
"utcl_add_seconds",
"utcl_current",
"utcl_seconds_between",
"uuid",
"var",
"verbatim"
],
//
// Built-in Functions
//
// Functions that are also statements have been moved to keywords
//
builtinFunctions: [
"abs",
"acos",
"asin",
"atan",
"bit-set",
"boolc",
"boolx",
"ceil",
"char_off",
"charlen",
"cmax",
"cmin",
"concat_lines_of",
// 'condense', // moved to keywords
"contains",
"contains_any_not_of",
"contains_any_of",
"cos",
"cosh",
"count",
"count_any_not_of",
"count_any_of",
"dbmaxlen",
"distance",
"escape",
"exp",
// 'find', // moved to keywords
"find_any_not_of",
"find_any_of",
"find_end",
"floor",
"frac",
"from_mixed",
// 'insert', // moved to keywords
"ipow",
"line_exists",
"line_index",
// 'lines', // moved to keywords
"log",
"log10",
// 'match', // moved to keywords
"matches",
"nmax",
"nmin",
"numofchar",
"repeat",
// 'replace', // moved to keywords
"rescale",
"reverse",
"round",
"segment",
"shift_left",
"shift_right",
"sign",
"sin",
"sinh",
"sqrt",
"strlen",
"substring",
"substring_after",
"substring_before",
"substring_from",
"substring_to",
"tan",
"tanh",
"to_lower",
"to_mixed",
"to_upper",
// 'translate', // moved to keywords
"trunc",
"utclong_add",
// since 7.54
"utclong_current",
// since 7.54
"utclong_diff",
// since 7.54
"xsdbool",
"xstrlen"
],
//
// Data Types
//
// Data types that are also part of statements have been moved to keywords
//
typeKeywords: [
// built-in abap types
"b",
"c",
"d",
"decfloat16",
"decfloat34",
"f",
"i",
"int8",
// since 7.54
"n",
"p",
"s",
"string",
"t",
"utclong",
// since 7.54
"x",
"xstring",
// generic data types
"any",
"clike",
"csequence",
"decfloat",
// 'object', // moved to keywords
"numeric",
"simple",
"xsequence",
// ddic/sql data types
"accp",
"char",
"clnt",
"cuky",
"curr",
"datn",
// since 7.55
"dats",
"d16d",
// since 7.55
"d16n",
// since 7.55
"d16r",
// since 7.55
"d34d",
// since 7.55
"d34n",
// since 7.55
"d34r",
// since 7.55
"dec",
"df16_dec",
"df16_raw",
"df34_dec",
"df34_raw",
"fltp",
"geom_ewkb",
// since 7.55
"int1",
"int2",
"int4",
"lang",
"lchr",
"lraw",
"numc",
"quan",
"raw",
"rawstring",
"sstring",
"timn",
// since 7.55
"tims",
"unit",
"utcl",
// since 7.55
// ddic data types (obsolete)
"df16_scl",
"df34_scl",
"prec",
"varc",
// special data types and constants
"abap_bool",
"abap_false",
"abap_true",
"abap_undefined",
"me",
"screen",
"space",
"super",
"sy",
"syst",
"table_line",
// obsolete data object
"*sys*"
],
builtinMethods: ["class_constructor", "constructor"],
derivedTypes: [
"%CID",
"%CID_REF",
"%CONTROL",
"%DATA",
"%ELEMENT",
"%FAIL",
"%KEY",
"%MSG",
"%PARAM",
"%PID",
"%PID_ASSOC",
"%PID_PARENT",
"%_HINTS"
],
cdsLanguage: [
"@AbapAnnotation",
"@AbapCatalog",
"@AccessControl",
"@API",
"@ClientDependent",
"@ClientHandling",
"@CompatibilityContract",
"@DataAging",
"@EndUserText",
"@Environment",
"@LanguageDependency",
"@MappingRole",
"@Metadata",
"@MetadataExtension",
"@ObjectModel",
"@Scope",
"@Semantics",
"$EXTENSION",
"$SELF"
],
selectors: ["->", "->*", "=>", "~", "~*"],
//
// Operators
//
// Operators that can be part of statements have been moved to keywords
//
operators: [
// arithmetic operators
" +",
" -",
"/",
"*",
"**",
"div",
"mod",
// assignment operators
"=",
"#",
"@",
"+=",
"-=",
"*=",
"/=",
"**=",
"&&=",
// casting operator
"?=",
// concat operators
"&",
"&&",
// bit operators
"bit-and",
"bit-not",
"bit-or",
"bit-xor",
"m",
"o",
"z",
// boolean operators
// 'and', // moved to keywords
// 'equiv', // moved to keywords
// 'not', // moved to keywords
// 'or', // moved to keywords
// comparison operators
"<",
" >",
// todo: separate from -> and =>
"<=",
">=",
"<>",
"><",
// obsolete
"=<",
// obsolete
"=>",
// obsolete
// 'between', // moved to keywords
"bt",
"byte-ca",
"byte-cn",
"byte-co",
"byte-cs",
"byte-na",
"byte-ns",
"ca",
"cn",
"co",
"cp",
"cs",
"eq",
// obsolete
"ge",
// obsolete
"gt",
// obsolete
// 'in', // moved to keywords
"le",
// obsolete
"lt",
// obsolete
"na",
"nb",
"ne",
// obsolete
"np",
"ns",
// cds
"*/",
"*:",
"--",
"/*",
"//"
],
symbols: /[=>))*/,
// exclude '->' selector
{
cases: {
"@typeKeywords": "type",
"@keywords": "keyword",
"@cdsLanguage": "annotation",
"@derivedTypes": "type",
"@builtinFunctions": "type",
"@builtinMethods": "type",
"@operators": "key",
"@default": "identifier"
}
}
],
[/<[\w]+>/, "identifier"],
// field symbols
[/##[\w|_]+/, "comment"],
// pragmas
{ include: "@whitespace" },
[/[:,.]/, "delimiter"],
[/[{}()\[\]]/, "@brackets"],
[
/@symbols/,
{
cases: {
"@selectors": "tag",
"@operators": "key",
"@default": ""
}
}
],
[/'/, { token: "string", bracket: "@open", next: "@stringquote" }],
[/`/, { token: "string", bracket: "@open", next: "@stringping" }],
[/\|/, { token: "string", bracket: "@open", next: "@stringtemplate" }],
[/\d+/, "number"]
],
stringtemplate: [
[/[^\\\|]+/, "string"],
[/\\\|/, "string"],
[/\|/, { token: "string", bracket: "@close", next: "@pop" }]
],
stringping: [
[/[^\\`]+/, "string"],
[/`/, { token: "string", bracket: "@close", next: "@pop" }]
],
stringquote: [
[/[^\\']+/, "string"],
[/'/, { token: "string", bracket: "@close", next: "@pop" }]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/^\*.*$/, "comment"],
[/\".*$/, "comment"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.js
var apex_exports = {};
__export(apex_exports, {
conf: () => conf2,
language: () => language3
});
var conf2, keywords, uppercaseFirstLetter, keywordsWithCaseVariations, language3;
var init_apex = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/apex/apex.js"() {
conf2 = {
// the default separators except `@$`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))")
}
}
};
keywords = [
"abstract",
"activate",
"and",
"any",
"array",
"as",
"asc",
"assert",
"autonomous",
"begin",
"bigdecimal",
"blob",
"boolean",
"break",
"bulk",
"by",
"case",
"cast",
"catch",
"char",
"class",
"collect",
"commit",
"const",
"continue",
"convertcurrency",
"decimal",
"default",
"delete",
"desc",
"do",
"double",
"else",
"end",
"enum",
"exception",
"exit",
"export",
"extends",
"false",
"final",
"finally",
"float",
"for",
"from",
"future",
"get",
"global",
"goto",
"group",
"having",
"hint",
"if",
"implements",
"import",
"in",
"inner",
"insert",
"instanceof",
"int",
"interface",
"into",
"join",
"last_90_days",
"last_month",
"last_n_days",
"last_week",
"like",
"limit",
"list",
"long",
"loop",
"map",
"merge",
"native",
"new",
"next_90_days",
"next_month",
"next_n_days",
"next_week",
"not",
"null",
"nulls",
"number",
"object",
"of",
"on",
"or",
"outer",
"override",
"package",
"parallel",
"pragma",
"private",
"protected",
"public",
"retrieve",
"return",
"returning",
"rollback",
"savepoint",
"search",
"select",
"set",
"short",
"sort",
"stat",
"static",
"strictfp",
"super",
"switch",
"synchronized",
"system",
"testmethod",
"then",
"this",
"this_month",
"this_week",
"throw",
"throws",
"today",
"tolabel",
"tomorrow",
"transaction",
"transient",
"trigger",
"true",
"try",
"type",
"undelete",
"update",
"upsert",
"using",
"virtual",
"void",
"volatile",
"webservice",
"when",
"where",
"while",
"yesterday"
];
uppercaseFirstLetter = (lowercase) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1);
keywordsWithCaseVariations = [];
keywords.forEach((lowercase) => {
keywordsWithCaseVariations.push(lowercase);
keywordsWithCaseVariations.push(lowercase.toUpperCase());
keywordsWithCaseVariations.push(uppercaseFirstLetter(lowercase));
});
language3 = {
defaultToken: "",
tokenPostfix: ".apex",
keywords: keywordsWithCaseVariations,
operators: [
"=",
">",
"<",
"!",
"~",
"?",
":",
"==",
"<=",
">=",
"!=",
"&&",
"||",
"++",
"--",
"+",
"-",
"*",
"/",
"&",
"|",
"^",
"%",
"<<",
">>",
">>>",
"+=",
"-=",
"*=",
"/=",
"&=",
"|=",
"^=",
"%=",
"<<=",
">>=",
">>>="
],
// we include these common regular expressions
symbols: /[=>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// @ annotations.
[/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, "number.float"],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, "number.float"],
[/(@digits)[fFdD]/, "number.float"],
[/(@digits)[lL]?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", '@string."'],
[/'/, "string", "@string.'"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@apexdoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
apexdoc: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"']+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[
/["']/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.js
var azcli_exports = {};
__export(azcli_exports, {
conf: () => conf3,
language: () => language4
});
var conf3, language4;
var init_azcli = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/azcli/azcli.js"() {
conf3 = {
comments: {
lineComment: "#"
}
};
language4 = {
defaultToken: "keyword",
ignoreCase: true,
tokenPostfix: ".azcli",
str: /[^#\s]/,
tokenizer: {
root: [
{ include: "@comment" },
[
/\s-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": { token: "key.identifier", next: "@type" }
}
}
],
[
/^-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": { token: "key.identifier", next: "@type" }
}
}
]
],
type: [
{ include: "@comment" },
[
/-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": "key.identifier"
}
}
],
[
/@str+\s*/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
]
],
comment: [
[
/#.*$/,
{
cases: {
"@eos": { token: "comment", next: "@popall" }
}
}
]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.js
var bat_exports = {};
__export(bat_exports, {
conf: () => conf4,
language: () => language5
});
var conf4, language5;
var init_bat = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/bat/bat.js"() {
conf4 = {
comments: {
lineComment: "REM"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
surroundingPairs: [
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
folding: {
markers: {
start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"),
end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion")
}
}
};
language5 = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".bat",
brackets: [
{ token: "delimiter.bracket", open: "{", close: "}" },
{ token: "delimiter.parenthesis", open: "(", close: ")" },
{ token: "delimiter.square", open: "[", close: "]" }
],
keywords: /call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/,
// we include these common regular expressions
symbols: /[=> conf5,
language: () => language6
});
var bounded, identifierStart, identifierContinue, identifier, keywords2, namedLiterals, nonCommentWs, numericLiteral, conf5, language6;
var init_bicep = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/bicep/bicep.js"() {
bounded = (text2) => `\\b${text2}\\b`;
identifierStart = "[_a-zA-Z]";
identifierContinue = "[_a-zA-Z0-9]";
identifier = bounded(`${identifierStart}${identifierContinue}*`);
keywords2 = [
"targetScope",
"resource",
"module",
"param",
"var",
"output",
"for",
"in",
"if",
"existing"
];
namedLiterals = ["true", "false", "null"];
nonCommentWs = `[ \\t\\r\\n]`;
numericLiteral = `[0-9]+`;
conf5 = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'" },
{ open: "'''", close: "'''" }
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: "'''", close: "'''", notIn: ["string", "comment"] }
],
autoCloseBefore: ":.,=}])' \n ",
indentationRules: {
increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"),
decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$")
}
};
language6 = {
defaultToken: "",
tokenPostfix: ".bicep",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
symbols: /[=> conf6,
language: () => language7
});
var conf6, language7;
var init_cameligo = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/cameligo/cameligo.js"() {
conf6 = {
comments: {
lineComment: "//",
blockComment: ["(*", "*)"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' },
{ open: "(*", close: "*)" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' },
{ open: "(*", close: "*)" }
]
};
language7 = {
defaultToken: "",
tokenPostfix: ".cameligo",
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
keywords: [
"abs",
"assert",
"block",
"Bytes",
"case",
"Crypto",
"Current",
"else",
"failwith",
"false",
"for",
"fun",
"if",
"in",
"let",
"let%entry",
"let%init",
"List",
"list",
"Map",
"map",
"match",
"match%nat",
"mod",
"not",
"operation",
"Operation",
"of",
"record",
"Set",
"set",
"sender",
"skip",
"source",
"String",
"then",
"to",
"true",
"type",
"with"
],
typeKeywords: ["int", "unit", "string", "tz", "nat", "bool"],
operators: [
"=",
">",
"<",
"<=",
">=",
"<>",
":",
":=",
"and",
"mod",
"or",
"+",
"-",
"*",
"/",
"@",
"&",
"^",
"%",
"->",
"<-",
"&&",
"||"
],
// we include these common regular expressions
symbols: /[=><:@\^&|+\-*\/\^%]+/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-zA-Z_][\w]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/\$[0-9a-fA-F]{1,16}/, "number.hex"],
[/\d+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/'/, "string.invalid"],
[/\#\d+/, "string"]
],
/* */
comment: [
[/[^\(\*]+/, "comment"],
//[/\(\*/, 'comment', '@push' ], // nested comment not allowed :-(
[/\*\)/, "comment", "@pop"],
[/\(\*/, "comment"]
],
string: [
[/[^\\']+/, "string"],
[/\\./, "string.escape.invalid"],
[/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
],
whitespace: [
[/[ \t\r\n]+/, "white"],
[/\(\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.js
var clojure_exports = {};
__export(clojure_exports, {
conf: () => conf7,
language: () => language8
});
var conf7, language8;
var init_clojure = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/clojure/clojure.js"() {
conf7 = {
comments: {
lineComment: ";;"
},
brackets: [
["[", "]"],
["(", ")"],
["{", "}"]
],
autoClosingPairs: [
{ open: "[", close: "]" },
{ open: '"', close: '"' },
{ open: "(", close: ")" },
{ open: "{", close: "}" }
],
surroundingPairs: [
{ open: "[", close: "]" },
{ open: '"', close: '"' },
{ open: "(", close: ")" },
{ open: "{", close: "}" }
]
};
language8 = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".clj",
brackets: [
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "{", close: "}", token: "delimiter.curly" }
],
constants: ["true", "false", "nil"],
// delimiters: /[\\\[\]\s"#'(),;@^`{}~]|$/,
numbers: /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/,
characters: /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/,
escapes: /^\\(?:["'\\bfnrt]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/
// simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/
// qualified-symbol := ((<.>)*>)?
qualifiedSymbols: /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/,
specialForms: [
".",
"catch",
"def",
"do",
"if",
"monitor-enter",
"monitor-exit",
"new",
"quote",
"recur",
"set!",
"throw",
"try",
"var"
],
coreSymbols: [
"*",
"*'",
"*1",
"*2",
"*3",
"*agent*",
"*allow-unresolved-vars*",
"*assert*",
"*clojure-version*",
"*command-line-args*",
"*compile-files*",
"*compile-path*",
"*compiler-options*",
"*data-readers*",
"*default-data-reader-fn*",
"*e",
"*err*",
"*file*",
"*flush-on-newline*",
"*fn-loader*",
"*in*",
"*math-context*",
"*ns*",
"*out*",
"*print-dup*",
"*print-length*",
"*print-level*",
"*print-meta*",
"*print-namespace-maps*",
"*print-readably*",
"*read-eval*",
"*reader-resolver*",
"*source-path*",
"*suppress-read*",
"*unchecked-math*",
"*use-context-classloader*",
"*verbose-defrecords*",
"*warn-on-reflection*",
"+",
"+'",
"-",
"-'",
"->",
"->>",
"->ArrayChunk",
"->Eduction",
"->Vec",
"->VecNode",
"->VecSeq",
"-cache-protocol-fn",
"-reset-methods",
"..",
"/",
"<",
"<=",
"=",
"==",
">",
">=",
"EMPTY-NODE",
"Inst",
"StackTraceElement->vec",
"Throwable->map",
"accessor",
"aclone",
"add-classpath",
"add-watch",
"agent",
"agent-error",
"agent-errors",
"aget",
"alength",
"alias",
"all-ns",
"alter",
"alter-meta!",
"alter-var-root",
"amap",
"ancestors",
"and",
"any?",
"apply",
"areduce",
"array-map",
"as->",
"aset",
"aset-boolean",
"aset-byte",
"aset-char",
"aset-double",
"aset-float",
"aset-int",
"aset-long",
"aset-short",
"assert",
"assoc",
"assoc!",
"assoc-in",
"associative?",
"atom",
"await",
"await-for",
"await1",
"bases",
"bean",
"bigdec",
"bigint",
"biginteger",
"binding",
"bit-and",
"bit-and-not",
"bit-clear",
"bit-flip",
"bit-not",
"bit-or",
"bit-set",
"bit-shift-left",
"bit-shift-right",
"bit-test",
"bit-xor",
"boolean",
"boolean-array",
"boolean?",
"booleans",
"bound-fn",
"bound-fn*",
"bound?",
"bounded-count",
"butlast",
"byte",
"byte-array",
"bytes",
"bytes?",
"case",
"cast",
"cat",
"char",
"char-array",
"char-escape-string",
"char-name-string",
"char?",
"chars",
"chunk",
"chunk-append",
"chunk-buffer",
"chunk-cons",
"chunk-first",
"chunk-next",
"chunk-rest",
"chunked-seq?",
"class",
"class?",
"clear-agent-errors",
"clojure-version",
"coll?",
"comment",
"commute",
"comp",
"comparator",
"compare",
"compare-and-set!",
"compile",
"complement",
"completing",
"concat",
"cond",
"cond->",
"cond->>",
"condp",
"conj",
"conj!",
"cons",
"constantly",
"construct-proxy",
"contains?",
"count",
"counted?",
"create-ns",
"create-struct",
"cycle",
"dec",
"dec'",
"decimal?",
"declare",
"dedupe",
"default-data-readers",
"definline",
"definterface",
"defmacro",
"defmethod",
"defmulti",
"defn",
"defn-",
"defonce",
"defprotocol",
"defrecord",
"defstruct",
"deftype",
"delay",
"delay?",
"deliver",
"denominator",
"deref",
"derive",
"descendants",
"destructure",
"disj",
"disj!",
"dissoc",
"dissoc!",
"distinct",
"distinct?",
"doall",
"dorun",
"doseq",
"dosync",
"dotimes",
"doto",
"double",
"double-array",
"double?",
"doubles",
"drop",
"drop-last",
"drop-while",
"eduction",
"empty",
"empty?",
"ensure",
"ensure-reduced",
"enumeration-seq",
"error-handler",
"error-mode",
"eval",
"even?",
"every-pred",
"every?",
"ex-data",
"ex-info",
"extend",
"extend-protocol",
"extend-type",
"extenders",
"extends?",
"false?",
"ffirst",
"file-seq",
"filter",
"filterv",
"find",
"find-keyword",
"find-ns",
"find-protocol-impl",
"find-protocol-method",
"find-var",
"first",
"flatten",
"float",
"float-array",
"float?",
"floats",
"flush",
"fn",
"fn?",
"fnext",
"fnil",
"for",
"force",
"format",
"frequencies",
"future",
"future-call",
"future-cancel",
"future-cancelled?",
"future-done?",
"future?",
"gen-class",
"gen-interface",
"gensym",
"get",
"get-in",
"get-method",
"get-proxy-class",
"get-thread-bindings",
"get-validator",
"group-by",
"halt-when",
"hash",
"hash-combine",
"hash-map",
"hash-ordered-coll",
"hash-set",
"hash-unordered-coll",
"ident?",
"identical?",
"identity",
"if-let",
"if-not",
"if-some",
"ifn?",
"import",
"in-ns",
"inc",
"inc'",
"indexed?",
"init-proxy",
"inst-ms",
"inst-ms*",
"inst?",
"instance?",
"int",
"int-array",
"int?",
"integer?",
"interleave",
"intern",
"interpose",
"into",
"into-array",
"ints",
"io!",
"isa?",
"iterate",
"iterator-seq",
"juxt",
"keep",
"keep-indexed",
"key",
"keys",
"keyword",
"keyword?",
"last",
"lazy-cat",
"lazy-seq",
"let",
"letfn",
"line-seq",
"list",
"list*",
"list?",
"load",
"load-file",
"load-reader",
"load-string",
"loaded-libs",
"locking",
"long",
"long-array",
"longs",
"loop",
"macroexpand",
"macroexpand-1",
"make-array",
"make-hierarchy",
"map",
"map-entry?",
"map-indexed",
"map?",
"mapcat",
"mapv",
"max",
"max-key",
"memfn",
"memoize",
"merge",
"merge-with",
"meta",
"method-sig",
"methods",
"min",
"min-key",
"mix-collection-hash",
"mod",
"munge",
"name",
"namespace",
"namespace-munge",
"nat-int?",
"neg-int?",
"neg?",
"newline",
"next",
"nfirst",
"nil?",
"nnext",
"not",
"not-any?",
"not-empty",
"not-every?",
"not=",
"ns",
"ns-aliases",
"ns-imports",
"ns-interns",
"ns-map",
"ns-name",
"ns-publics",
"ns-refers",
"ns-resolve",
"ns-unalias",
"ns-unmap",
"nth",
"nthnext",
"nthrest",
"num",
"number?",
"numerator",
"object-array",
"odd?",
"or",
"parents",
"partial",
"partition",
"partition-all",
"partition-by",
"pcalls",
"peek",
"persistent!",
"pmap",
"pop",
"pop!",
"pop-thread-bindings",
"pos-int?",
"pos?",
"pr",
"pr-str",
"prefer-method",
"prefers",
"primitives-classnames",
"print",
"print-ctor",
"print-dup",
"print-method",
"print-simple",
"print-str",
"printf",
"println",
"println-str",
"prn",
"prn-str",
"promise",
"proxy",
"proxy-call-with-super",
"proxy-mappings",
"proxy-name",
"proxy-super",
"push-thread-bindings",
"pvalues",
"qualified-ident?",
"qualified-keyword?",
"qualified-symbol?",
"quot",
"rand",
"rand-int",
"rand-nth",
"random-sample",
"range",
"ratio?",
"rational?",
"rationalize",
"re-find",
"re-groups",
"re-matcher",
"re-matches",
"re-pattern",
"re-seq",
"read",
"read-line",
"read-string",
"reader-conditional",
"reader-conditional?",
"realized?",
"record?",
"reduce",
"reduce-kv",
"reduced",
"reduced?",
"reductions",
"ref",
"ref-history-count",
"ref-max-history",
"ref-min-history",
"ref-set",
"refer",
"refer-clojure",
"reify",
"release-pending-sends",
"rem",
"remove",
"remove-all-methods",
"remove-method",
"remove-ns",
"remove-watch",
"repeat",
"repeatedly",
"replace",
"replicate",
"require",
"reset!",
"reset-meta!",
"reset-vals!",
"resolve",
"rest",
"restart-agent",
"resultset-seq",
"reverse",
"reversible?",
"rseq",
"rsubseq",
"run!",
"satisfies?",
"second",
"select-keys",
"send",
"send-off",
"send-via",
"seq",
"seq?",
"seqable?",
"seque",
"sequence",
"sequential?",
"set",
"set-agent-send-executor!",
"set-agent-send-off-executor!",
"set-error-handler!",
"set-error-mode!",
"set-validator!",
"set?",
"short",
"short-array",
"shorts",
"shuffle",
"shutdown-agents",
"simple-ident?",
"simple-keyword?",
"simple-symbol?",
"slurp",
"some",
"some->",
"some->>",
"some-fn",
"some?",
"sort",
"sort-by",
"sorted-map",
"sorted-map-by",
"sorted-set",
"sorted-set-by",
"sorted?",
"special-symbol?",
"spit",
"split-at",
"split-with",
"str",
"string?",
"struct",
"struct-map",
"subs",
"subseq",
"subvec",
"supers",
"swap!",
"swap-vals!",
"symbol",
"symbol?",
"sync",
"tagged-literal",
"tagged-literal?",
"take",
"take-last",
"take-nth",
"take-while",
"test",
"the-ns",
"thread-bound?",
"time",
"to-array",
"to-array-2d",
"trampoline",
"transduce",
"transient",
"tree-seq",
"true?",
"type",
"unchecked-add",
"unchecked-add-int",
"unchecked-byte",
"unchecked-char",
"unchecked-dec",
"unchecked-dec-int",
"unchecked-divide-int",
"unchecked-double",
"unchecked-float",
"unchecked-inc",
"unchecked-inc-int",
"unchecked-int",
"unchecked-long",
"unchecked-multiply",
"unchecked-multiply-int",
"unchecked-negate",
"unchecked-negate-int",
"unchecked-remainder-int",
"unchecked-short",
"unchecked-subtract",
"unchecked-subtract-int",
"underive",
"unquote",
"unquote-splicing",
"unreduced",
"unsigned-bit-shift-right",
"update",
"update-in",
"update-proxy",
"uri?",
"use",
"uuid?",
"val",
"vals",
"var-get",
"var-set",
"var?",
"vary-meta",
"vec",
"vector",
"vector-of",
"vector?",
"volatile!",
"volatile?",
"vreset!",
"vswap!",
"when",
"when-first",
"when-let",
"when-not",
"when-some",
"while",
"with-bindings",
"with-bindings*",
"with-in-str",
"with-loading-context",
"with-local-vars",
"with-meta",
"with-open",
"with-out-str",
"with-precision",
"with-redefs",
"with-redefs-fn",
"xml-seq",
"zero?",
"zipmap"
],
tokenizer: {
root: [
// whitespaces and comments
{ include: "@whitespace" },
// numbers
[/@numbers/, "number"],
// characters
[/@characters/, "string"],
// strings
{ include: "@string" },
// brackets
[/[()\[\]{}]/, "@brackets"],
// regular expressions
[/\/#"(?:\.|(?:")|[^"\n])*"\/g/, "regexp"],
// reader macro characters
[/[#'@^`~]/, "meta"],
// symbols
[
/@qualifiedSymbols/,
{
cases: {
"^:.+$": "constant",
// Clojure keywords (e.g., `:foo/bar`)
"@specialForms": "keyword",
"@coreSymbols": "keyword",
"@constants": "constant",
"@default": "identifier"
}
}
]
],
whitespace: [
[/[\s,]+/, "white"],
[/;.*$/, "comment"],
[/\(comment\b/, "comment", "@comment"]
],
comment: [
[/\(/, "comment", "@push"],
[/\)/, "comment", "@pop"],
[/[^()]/, "comment"]
],
string: [[/"/, "string", "@multiLineString"]],
multiLineString: [
[/"/, "string", "@popall"],
[/@escapes/, "string.escape"],
[/./, "string"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.js
var coffee_exports = {};
__export(coffee_exports, {
conf: () => conf8,
language: () => language9
});
var conf8, language9;
var init_coffee = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/coffee/coffee.js"() {
conf8 = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
blockComment: ["###", "###"],
lineComment: "#"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};
language9 = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".coffee",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,
keywords: [
"and",
"or",
"is",
"isnt",
"not",
"on",
"yes",
"@",
"no",
"off",
"true",
"false",
"null",
"this",
"new",
"delete",
"typeof",
"in",
"instanceof",
"return",
"throw",
"break",
"continue",
"debugger",
"if",
"else",
"switch",
"for",
"while",
"do",
"try",
"catch",
"finally",
"class",
"extends",
"super",
"undefined",
"then",
"unless",
"until",
"loop",
"of",
"by",
"when"
],
// we include these common regular expressions
symbols: /[=> conf9,
language: () => language10
});
var conf9, language10;
var init_cpp = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/cpp/cpp.js"() {
conf9 = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "[", close: "]" },
{ open: "{", close: "}" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*#pragma\\s+region\\b"),
end: new RegExp("^\\s*#pragma\\s+endregion\\b")
}
}
};
language10 = {
defaultToken: "",
tokenPostfix: ".cpp",
brackets: [
{ token: "delimiter.curly", open: "{", close: "}" },
{ token: "delimiter.parenthesis", open: "(", close: ")" },
{ token: "delimiter.square", open: "[", close: "]" },
{ token: "delimiter.angle", open: "<", close: ">" }
],
keywords: [
"abstract",
"amp",
"array",
"auto",
"bool",
"break",
"case",
"catch",
"char",
"class",
"const",
"constexpr",
"const_cast",
"continue",
"cpu",
"decltype",
"default",
"delegate",
"delete",
"do",
"double",
"dynamic_cast",
"each",
"else",
"enum",
"event",
"explicit",
"export",
"extern",
"false",
"final",
"finally",
"float",
"for",
"friend",
"gcnew",
"generic",
"goto",
"if",
"in",
"initonly",
"inline",
"int",
"interface",
"interior_ptr",
"internal",
"literal",
"long",
"mutable",
"namespace",
"new",
"noexcept",
"nullptr",
"__nullptr",
"operator",
"override",
"partial",
"pascal",
"pin_ptr",
"private",
"property",
"protected",
"public",
"ref",
"register",
"reinterpret_cast",
"restrict",
"return",
"safe_cast",
"sealed",
"short",
"signed",
"sizeof",
"static",
"static_assert",
"static_cast",
"struct",
"switch",
"template",
"this",
"thread_local",
"throw",
"tile_static",
"true",
"try",
"typedef",
"typeid",
"typename",
"union",
"unsigned",
"using",
"virtual",
"void",
"volatile",
"wchar_t",
"where",
"while",
"_asm",
// reserved word with one underscores
"_based",
"_cdecl",
"_declspec",
"_fastcall",
"_if_exists",
"_if_not_exists",
"_inline",
"_multiple_inheritance",
"_pascal",
"_single_inheritance",
"_stdcall",
"_virtual_inheritance",
"_w64",
"__abstract",
// reserved word with two underscores
"__alignof",
"__asm",
"__assume",
"__based",
"__box",
"__builtin_alignof",
"__cdecl",
"__clrcall",
"__declspec",
"__delegate",
"__event",
"__except",
"__fastcall",
"__finally",
"__forceinline",
"__gc",
"__hook",
"__identifier",
"__if_exists",
"__if_not_exists",
"__inline",
"__int128",
"__int16",
"__int32",
"__int64",
"__int8",
"__interface",
"__leave",
"__m128",
"__m128d",
"__m128i",
"__m256",
"__m256d",
"__m256i",
"__m512",
"__m512d",
"__m512i",
"__m64",
"__multiple_inheritance",
"__newslot",
"__nogc",
"__noop",
"__nounwind",
"__novtordisp",
"__pascal",
"__pin",
"__pragma",
"__property",
"__ptr32",
"__ptr64",
"__raise",
"__restrict",
"__resume",
"__sealed",
"__single_inheritance",
"__stdcall",
"__super",
"__thiscall",
"__try",
"__try_cast",
"__typeof",
"__unaligned",
"__unhook",
"__uuidof",
"__value",
"__virtual_inheritance",
"__w64",
"__wchar_t"
],
operators: [
"=",
">",
"<",
"!",
"~",
"?",
":",
"==",
"<=",
">=",
"!=",
"&&",
"||",
"++",
"--",
"+",
"-",
"*",
"/",
"&",
"|",
"^",
"%",
"<<",
">>",
"+=",
"-=",
"*=",
"/=",
"&=",
"|=",
"^=",
"%=",
"<<=",
">>="
],
// we include these common regular expressions
symbols: /[=>\[\]]/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/, "number.hex"],
[/0[0-7']*[0-7](@integersuffix)/, "number.octal"],
[/0[bB][0-1']*[0-1](@integersuffix)/, "number.binary"],
[/\d[\d']*\d(@integersuffix)/, "number"],
[/\d(@integersuffix)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*\\$/, "comment", "@linecomment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//For use with continuous line comments
linecomment: [
[/.*[^\\]$/, "comment", "@pop"],
[/[^]+/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
doccomment: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
raw: [
[/[^)]+/, "string.raw"],
[/\)$S2\"/, { token: "string.raw.end", next: "@pop" }],
[/\)/, "string.raw"]
],
annotation: [
{ include: "@whitespace" },
[/using|alignas/, "keyword"],
[/[a-zA-Z0-9_]+/, "annotation"],
[/[,:]/, "delimiter"],
[/[()]/, "@brackets"],
[/\]\s*\]/, { token: "annotation", next: "@pop" }]
],
include: [
[
/(\s*)(<)([^<>]*)(>)/,
[
"",
"keyword.directive.include.begin",
"string.include.identifier",
{ token: "keyword.directive.include.end", next: "@pop" }
]
],
[
/(\s*)(")([^"]*)(")/,
[
"",
"keyword.directive.include.begin",
"string.include.identifier",
{ token: "keyword.directive.include.end", next: "@pop" }
]
]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.js
var csharp_exports = {};
__export(csharp_exports, {
conf: () => conf10,
language: () => language11
});
var conf10, language11;
var init_csharp = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/csharp/csharp.js"() {
conf10 = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};
language11 = {
defaultToken: "",
tokenPostfix: ".cs",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
keywords: [
"extern",
"alias",
"using",
"bool",
"decimal",
"sbyte",
"byte",
"short",
"ushort",
"int",
"uint",
"long",
"ulong",
"char",
"float",
"double",
"object",
"dynamic",
"string",
"assembly",
"is",
"as",
"ref",
"out",
"this",
"base",
"new",
"typeof",
"void",
"checked",
"unchecked",
"default",
"delegate",
"var",
"const",
"if",
"else",
"switch",
"case",
"while",
"do",
"for",
"foreach",
"in",
"break",
"continue",
"goto",
"return",
"throw",
"try",
"catch",
"finally",
"lock",
"yield",
"from",
"let",
"where",
"join",
"on",
"equals",
"into",
"orderby",
"ascending",
"descending",
"select",
"group",
"by",
"namespace",
"partial",
"class",
"field",
"event",
"method",
"param",
"public",
"protected",
"internal",
"private",
"abstract",
"sealed",
"static",
"struct",
"readonly",
"volatile",
"virtual",
"override",
"params",
"get",
"set",
"add",
"remove",
"operator",
"true",
"false",
"implicit",
"explicit",
"interface",
"enum",
"null",
"async",
"await",
"fixed",
"sizeof",
"stackalloc",
"unsafe",
"nameof",
"when"
],
namespaceFollows: ["namespace", "using"],
parenFollows: ["if", "for", "while", "switch", "foreach", "using", "catch", "when"],
operators: [
"=",
"??",
"||",
"&&",
"|",
"^",
"&",
"==",
"!=",
"<=",
">=",
"<<",
"+",
"-",
"*",
"/",
"%",
"!",
"~",
"++",
"--",
"+=",
"-=",
"*=",
"/=",
"%=",
"&=",
"|=",
"^=",
"<<=",
">>=",
">>",
"=>"
],
symbols: /[=>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?[fFdD]?/, "number.float"],
[/0[xX][0-9a-fA-F_]+/, "number.hex"],
[/0[bB][01_]+/, "number.hex"],
// binary: use same theme style as hex
[/[0-9_]+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, { token: "string.quote", next: "@string" }],
[/\$\@"/, { token: "string.quote", next: "@litinterpstring" }],
[/\@"/, { token: "string.quote", next: "@litstring" }],
[/\$"/, { token: "string.quote", next: "@interpolatedstring" }],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
qualified: [
[
/[a-zA-Z_][\w]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
[/\./, "delimiter"],
["", "", "@pop"]
],
namespace: [
{ include: "@whitespace" },
[/[A-Z]\w*/, "namespace"],
[/[\.=]/, "delimiter"],
["", "", "@pop"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // no nested comments :-(
["\\*/", "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, { token: "string.quote", next: "@pop" }]
],
litstring: [
[/[^"]+/, "string"],
[/""/, "string.escape"],
[/"/, { token: "string.quote", next: "@pop" }]
],
litinterpstring: [
[/[^"{]+/, "string"],
[/""/, "string.escape"],
[/{{/, "string.escape"],
[/}}/, "string.escape"],
[/{/, { token: "string.quote", next: "root.litinterpstring" }],
[/"/, { token: "string.quote", next: "@pop" }]
],
interpolatedstring: [
[/[^\\"{]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/{{/, "string.escape"],
[/}}/, "string.escape"],
[/{/, { token: "string.quote", next: "root.interpolatedstring" }],
[/"/, { token: "string.quote", next: "@pop" }]
],
whitespace: [
[/^[ \t\v\f]*#((r)|(load))(?=\s)/, "directive.csx"],
[/^[ \t\v\f]*#\w.*$/, "namespace.cpp"],
[/[ \t\v\f\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.js
var csp_exports = {};
__export(csp_exports, {
conf: () => conf11,
language: () => language12
});
var conf11, language12;
var init_csp = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/csp/csp.js"() {
conf11 = {
brackets: [],
autoClosingPairs: [],
surroundingPairs: []
};
language12 = {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
keywords: [],
typeKeywords: [],
tokenPostfix: ".csp",
operators: [],
symbols: /[=> conf12,
language: () => language13
});
var conf12, language13;
var init_css = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/css/css.js"() {
conf12 = {
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
comments: {
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}", notIn: ["string", "comment"] },
{ open: "[", close: "]", notIn: ["string", "comment"] },
{ open: "(", close: ")", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] },
{ open: "'", close: "'", notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};
language13 = {
defaultToken: "",
tokenPostfix: ".css",
ws: "[ \n\r\f]*",
// whitespaces (referenced in several rules)
identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
brackets: [
{ open: "{", close: "}", token: "delimiter.bracket" },
{ open: "[", close: "]", token: "delimiter.bracket" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
tokenizer: {
root: [{ include: "@selector" }],
selector: [
{ include: "@comments" },
{ include: "@import" },
{ include: "@strings" },
[
"[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)",
{ token: "keyword", next: "@keyframedeclaration" }
],
["[@](page|content|font-face|-moz-document)", { token: "keyword" }],
["[@](charset|namespace)", { token: "keyword", next: "@declarationbody" }],
[
"(url-prefix)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
[
"(url)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
{ include: "@selectorname" },
["[\\*]", "tag"],
// selector symbols
["[>\\+,]", "delimiter"],
// selector operators
["\\[", { token: "delimiter.bracket", next: "@selectorattribute" }],
["{", { token: "delimiter.bracket", next: "@selectorbody" }]
],
selectorbody: [
{ include: "@comments" },
["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))", "attribute.name", "@rulevalue"],
// rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon
["}", { token: "delimiter.bracket", next: "@pop" }]
],
selectorname: [
["(\\.|#(?=[^{])|%|(@identifier)|:)+", "tag"]
// selector (.foo, div, ...)
],
selectorattribute: [{ include: "@term" }, ["]", { token: "delimiter.bracket", next: "@pop" }]],
term: [
{ include: "@comments" },
[
"(url-prefix)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
[
"(url)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
{ include: "@functioninvocation" },
{ include: "@numbers" },
{ include: "@name" },
{ include: "@strings" },
["([<>=\\+\\-\\*\\/\\^\\|\\~,])", "delimiter"],
[",", "delimiter"]
],
rulevalue: [
{ include: "@comments" },
{ include: "@strings" },
{ include: "@term" },
["!important", "keyword"],
[";", "delimiter", "@pop"],
["(?=})", { token: "", next: "@pop" }]
// missing semicolon
],
warndebug: [["[@](warn|debug)", { token: "keyword", next: "@declarationbody" }]],
import: [["[@](import)", { token: "keyword", next: "@declarationbody" }]],
urldeclaration: [
{ include: "@strings" },
["[^)\r\n]+", "string"],
["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
],
parenthizedterm: [
{ include: "@term" },
["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
],
declarationbody: [
{ include: "@term" },
[";", "delimiter", "@pop"],
["(?=})", { token: "", next: "@pop" }]
// missing semicolon
],
comments: [
["\\/\\*", "comment", "@comment"],
["\\/\\/+.*", "comment"]
],
comment: [
["\\*\\/", "comment", "@pop"],
[/[^*/]+/, "comment"],
[/./, "comment"]
],
name: [["@identifier", "attribute.value"]],
numbers: [
["-?(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "attribute.value.number", next: "@units" }],
["#[0-9a-fA-F_]+(?!\\w)", "attribute.value.hex"]
],
units: [
[
"(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?",
"attribute.value.unit",
"@pop"
]
],
keyframedeclaration: [
["@identifier", "attribute.value"],
["{", { token: "delimiter.bracket", switchTo: "@keyframebody" }]
],
keyframebody: [
{ include: "@term" },
["{", { token: "delimiter.bracket", next: "@selectorbody" }],
["}", { token: "delimiter.bracket", next: "@pop" }]
],
functioninvocation: [
["@identifier\\(", { token: "attribute.value", next: "@functionarguments" }]
],
functionarguments: [
["\\$@identifier@ws:", "attribute.name"],
["[,]", "delimiter"],
{ include: "@term" },
["\\)", { token: "attribute.value", next: "@pop" }]
],
strings: [
['~?"', { token: "string", next: "@stringenddoublequote" }],
["~?'", { token: "string", next: "@stringendquote" }]
],
stringenddoublequote: [
["\\\\.", "string"],
['"', { token: "string", next: "@pop" }],
[/[^\\"]+/, "string"],
[".", "string"]
],
stringendquote: [
["\\\\.", "string"],
["'", { token: "string", next: "@pop" }],
[/[^\\']+/, "string"],
[".", "string"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.js
var cypher_exports = {};
__export(cypher_exports, {
conf: () => conf13,
language: () => language14
});
var conf13, language14;
var init_cypher = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/cypher/cypher.js"() {
conf13 = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "`", close: "`" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "`", close: "`" }
]
};
language14 = {
defaultToken: "",
tokenPostfix: `.cypher`,
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.bracket" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
keywords: [
"ALL",
"AND",
"AS",
"ASC",
"ASCENDING",
"BY",
"CALL",
"CASE",
"CONTAINS",
"CREATE",
"DELETE",
"DESC",
"DESCENDING",
"DETACH",
"DISTINCT",
"ELSE",
"END",
"ENDS",
"EXISTS",
"IN",
"IS",
"LIMIT",
"MANDATORY",
"MATCH",
"MERGE",
"NOT",
"ON",
"ON",
"OPTIONAL",
"OR",
"ORDER",
"REMOVE",
"RETURN",
"SET",
"SKIP",
"STARTS",
"THEN",
"UNION",
"UNWIND",
"WHEN",
"WHERE",
"WITH",
"XOR",
"YIELD"
],
builtinLiterals: ["true", "TRUE", "false", "FALSE", "null", "NULL"],
builtinFunctions: [
"abs",
"acos",
"asin",
"atan",
"atan2",
"avg",
"ceil",
"coalesce",
"collect",
"cos",
"cot",
"count",
"degrees",
"e",
"endNode",
"exists",
"exp",
"floor",
"head",
"id",
"keys",
"labels",
"last",
"left",
"length",
"log",
"log10",
"lTrim",
"max",
"min",
"nodes",
"percentileCont",
"percentileDisc",
"pi",
"properties",
"radians",
"rand",
"range",
"relationships",
"replace",
"reverse",
"right",
"round",
"rTrim",
"sign",
"sin",
"size",
"split",
"sqrt",
"startNode",
"stDev",
"stDevP",
"substring",
"sum",
"tail",
"tan",
"timestamp",
"toBoolean",
"toFloat",
"toInteger",
"toLower",
"toString",
"toUpper",
"trim",
"type"
],
operators: [
// Math operators
"+",
"-",
"*",
"/",
"%",
"^",
// Comparison operators
"=",
"<>",
"<",
">",
"<=",
">=",
// Pattern operators
"->",
"<-",
"-->",
"<--"
],
escapes: /\\(?:[tbnrf\\"'`]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+/,
octaldigits: /[0-7]+/,
hexdigits: /[0-9a-fA-F]+/,
tokenizer: {
root: [[/[{}[\]()]/, "@brackets"], { include: "common" }],
common: [
{ include: "@whitespace" },
{ include: "@numbers" },
{ include: "@strings" },
// Cypher labels on nodes/relationships, e.g. (n:NodeLabel)-[e:RelationshipLabel]
[/:[a-zA-Z_][\w]*/, "type.identifier"],
[
/[a-zA-Z_][\w]*(?=\()/,
{
cases: {
"@builtinFunctions": "predefined.function"
}
}
],
[
/[a-zA-Z_$][\w$]*/,
{
cases: {
"@keywords": "keyword",
"@builtinLiterals": "predefined.literal",
"@default": "identifier"
}
}
],
[/`/, "identifier.escape", "@identifierBacktick"],
// delimiter and operator after number because of `.\d` floats and `:` in labels
[/[;,.:|]/, "delimiter"],
[
/[<>=%+\-*/^]+/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
]
],
numbers: [
[/-?(@digits)[eE](-?(@digits))?/, "number.float"],
[/-?(@digits)?\.(@digits)([eE]-?(@digits))?/, "number.float"],
[/-?0x(@hexdigits)/, "number.hex"],
[/-?0(@octaldigits)/, "number.octal"],
[/-?(@digits)/, "number"]
],
strings: [
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@stringDouble"],
[/'/, "string", "@stringSingle"]
],
whitespace: [
[/[ \t\r\n]+/, "white"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/\/\/.*/, "comment"],
[/[^/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[/*]/, "comment"]
],
stringDouble: [
[/[^\\"]+/, "string"],
[/@escapes/, "string"],
[/\\./, "string.invalid"],
[/"/, "string", "@pop"]
],
stringSingle: [
[/[^\\']+/, "string"],
[/@escapes/, "string"],
[/\\./, "string.invalid"],
[/'/, "string", "@pop"]
],
identifierBacktick: [
[/[^\\`]+/, "identifier.escape"],
[/@escapes/, "identifier.escape"],
[/\\./, "identifier.escape.invalid"],
[/`/, "identifier.escape", "@pop"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.js
var dart_exports = {};
__export(dart_exports, {
conf: () => conf14,
language: () => language15
});
var conf14, language15;
var init_dart = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/dart/dart.js"() {
conf14 = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "`", close: "`", notIn: ["string", "comment"] },
{ open: "/**", close: " */", notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "`", close: "`" }
],
folding: {
markers: {
start: /^\s*\s*#?region\b/,
end: /^\s*\s*#?endregion\b/
}
}
};
language15 = {
defaultToken: "invalid",
tokenPostfix: ".dart",
keywords: [
"abstract",
"dynamic",
"implements",
"show",
"as",
"else",
"import",
"static",
"assert",
"enum",
"in",
"super",
"async",
"export",
"interface",
"switch",
"await",
"extends",
"is",
"sync",
"break",
"external",
"library",
"this",
"case",
"factory",
"mixin",
"throw",
"catch",
"false",
"new",
"true",
"class",
"final",
"null",
"try",
"const",
"finally",
"on",
"typedef",
"continue",
"for",
"operator",
"var",
"covariant",
"Function",
"part",
"void",
"default",
"get",
"rethrow",
"while",
"deferred",
"hide",
"return",
"with",
"do",
"if",
"set",
"yield"
],
typeKeywords: ["int", "double", "String", "bool"],
operators: [
"+",
"-",
"*",
"/",
"~/",
"%",
"++",
"--",
"==",
"!=",
">",
"<",
">=",
"<=",
"=",
"-=",
"/=",
"%=",
">>=",
"^=",
"+=",
"*=",
"~/=",
"<<=",
"&=",
"!=",
"||",
"&&",
"&",
"|",
"^",
"~",
"<<",
">>",
"!",
">>>",
"??",
"?",
":",
"|="
],
// we include these common regular expressions
symbols: /[=>](?!@symbols)/, "@brackets"],
[/!(?=([^=]|$))/, "delimiter"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
[/0[xX](@hexdigits)n?/, "number.hex"],
[/0[oO]?(@octaldigits)n?/, "number.octal"],
[/0[bB](@binarydigits)n?/, "number.binary"],
[/(@digits)n?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@string_double"],
[/'/, "string", "@string_single"]
// [/[a-zA-Z]+/, "variable"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/\/.*$/, "comment.doc"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
jsdoc: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
// We match regular expression quite precisely
regexp: [
[
/(\{)(\d+(?:,\d*)?)(\})/,
["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
],
[
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
],
[/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
[/[()]/, "regexp.escape.control"],
[/@regexpctl/, "regexp.escape.control"],
[/[^\\\/]/, "regexp"],
[/@regexpesc/, "regexp.escape"],
[/\\\./, "regexp.invalid"],
[/(\/)([gimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
],
regexrange: [
[/-/, "regexp.escape.control"],
[/\^/, "regexp.invalid"],
[/@regexpesc/, "regexp.escape"],
[/[^\]]/, "regexp"],
[
/\]/,
{
token: "regexp.escape.control",
next: "@pop",
bracket: "@close"
}
]
],
string_double: [
[/[^\\"\$]+/, "string"],
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"],
[/\$\w+/, "identifier"]
],
string_single: [
[/[^\\'\$]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/'/, "string", "@pop"],
[/\$\w+/, "identifier"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.js
var dockerfile_exports = {};
__export(dockerfile_exports, {
conf: () => conf15,
language: () => language16
});
var conf15, language16;
var init_dockerfile = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/dockerfile/dockerfile.js"() {
conf15 = {
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
]
};
language16 = {
defaultToken: "",
tokenPostfix: ".dockerfile",
variable: /\${?[\w]+}?/,
tokenizer: {
root: [
{ include: "@whitespace" },
{ include: "@comment" },
[/(ONBUILD)(\s+)/, ["keyword", ""]],
[/(ENV)(\s+)([\w]+)/, ["keyword", "", { token: "variable", next: "@arguments" }]],
[
/(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ARG|VOLUME|LABEL|USER|WORKDIR|COPY|CMD|STOPSIGNAL|SHELL|HEALTHCHECK|ENTRYPOINT)/,
{ token: "keyword", next: "@arguments" }
]
],
arguments: [
{ include: "@whitespace" },
{ include: "@strings" },
[
/(@variable)/,
{
cases: {
"@eos": { token: "variable", next: "@popall" },
"@default": "variable"
}
}
],
[
/\\/,
{
cases: {
"@eos": "",
"@default": ""
}
}
],
[
/./,
{
cases: {
"@eos": { token: "", next: "@popall" },
"@default": ""
}
}
]
],
// Deal with white space, including comments
whitespace: [
[
/\s+/,
{
cases: {
"@eos": { token: "", next: "@popall" },
"@default": ""
}
}
]
],
comment: [[/(^#.*$)/, "comment", "@popall"]],
// Recognize strings, including those broken across lines with \ (but not without)
strings: [
[/\\'$/, "", "@popall"],
// \' leaves @arguments at eol
[/\\'/, ""],
// \' is not a string
[/'$/, "string", "@popall"],
[/'/, "string", "@stringBody"],
[/"$/, "string", "@popall"],
[/"/, "string", "@dblStringBody"]
],
stringBody: [
[
/[^\\\$']/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
],
[/\\./, "string.escape"],
[/'$/, "string", "@popall"],
[/'/, "string", "@pop"],
[/(@variable)/, "variable"],
[/\\$/, "string"],
[/$/, "string", "@popall"]
],
dblStringBody: [
[
/[^\\\$"]/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
],
[/\\./, "string.escape"],
[/"$/, "string", "@popall"],
[/"/, "string", "@pop"],
[/(@variable)/, "variable"],
[/\\$/, "string"],
[/$/, "string", "@popall"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js
var ecl_exports = {};
__export(ecl_exports, {
conf: () => conf16,
language: () => language17
});
var conf16, language17;
var init_ecl = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/ecl/ecl.js"() {
conf16 = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
]
};
language17 = {
defaultToken: "",
tokenPostfix: ".ecl",
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
pounds: [
"append",
"break",
"declare",
"demangle",
"end",
"for",
"getdatatype",
"if",
"inmodule",
"loop",
"mangle",
"onwarning",
"option",
"set",
"stored",
"uniquename"
].join("|"),
keywords: [
"__compressed__",
"after",
"all",
"and",
"any",
"as",
"atmost",
"before",
"beginc",
"best",
"between",
"case",
"cluster",
"compressed",
"compression",
"const",
"counter",
"csv",
"default",
"descend",
"embed",
"encoding",
"encrypt",
"end",
"endc",
"endembed",
"endmacro",
"enum",
"escape",
"except",
"exclusive",
"expire",
"export",
"extend",
"fail",
"few",
"fileposition",
"first",
"flat",
"forward",
"from",
"full",
"function",
"functionmacro",
"group",
"grouped",
"heading",
"hole",
"ifblock",
"import",
"in",
"inner",
"interface",
"internal",
"joined",
"keep",
"keyed",
"last",
"left",
"limit",
"linkcounted",
"literal",
"little_endian",
"load",
"local",
"locale",
"lookup",
"lzw",
"macro",
"many",
"maxcount",
"maxlength",
"min skew",
"module",
"mofn",
"multiple",
"named",
"namespace",
"nocase",
"noroot",
"noscan",
"nosort",
"not",
"noxpath",
"of",
"onfail",
"only",
"opt",
"or",
"outer",
"overwrite",
"packed",
"partition",
"penalty",
"physicallength",
"pipe",
"prefetch",
"quote",
"record",
"repeat",
"retry",
"return",
"right",
"right1",
"right2",
"rows",
"rowset",
"scan",
"scope",
"self",
"separator",
"service",
"shared",
"skew",
"skip",
"smart",
"soapaction",
"sql",
"stable",
"store",
"terminator",
"thor",
"threshold",
"timelimit",
"timeout",
"token",
"transform",
"trim",
"type",
"unicodeorder",
"unordered",
"unsorted",
"unstable",
"update",
"use",
"validate",
"virtual",
"whole",
"width",
"wild",
"within",
"wnotrim",
"xml",
"xpath"
],
functions: [
"abs",
"acos",
"aggregate",
"allnodes",
"apply",
"ascii",
"asin",
"assert",
"asstring",
"atan",
"atan2",
"ave",
"build",
"buildindex",
"case",
"catch",
"choose",
"choosen",
"choosesets",
"clustersize",
"combine",
"correlation",
"cos",
"cosh",
"count",
"covariance",
"cron",
"dataset",
"dedup",
"define",
"denormalize",
"dictionary",
"distribute",
"distributed",
"distribution",
"ebcdic",
"enth",
"error",
"evaluate",
"event",
"eventextra",
"eventname",
"exists",
"exp",
"fail",
"failcode",
"failmessage",
"fetch",
"fromunicode",
"fromxml",
"getenv",
"getisvalid",
"global",
"graph",
"group",
"hash",
"hash32",
"hash64",
"hashcrc",
"hashmd5",
"having",
"httpcall",
"httpheader",
"if",
"iff",
"index",
"intformat",
"isvalid",
"iterate",
"join",
"keydiff",
"keypatch",
"keyunicode",
"length",
"library",
"limit",
"ln",
"loadxml",
"local",
"log",
"loop",
"map",
"matched",
"matchlength",
"matchposition",
"matchtext",
"matchunicode",
"max",
"merge",
"mergejoin",
"min",
"nofold",
"nolocal",
"nonempty",
"normalize",
"nothor",
"notify",
"output",
"parallel",
"parse",
"pipe",
"power",
"preload",
"process",
"project",
"pull",
"random",
"range",
"rank",
"ranked",
"realformat",
"recordof",
"regexfind",
"regexreplace",
"regroup",
"rejected",
"rollup",
"round",
"roundup",
"row",
"rowdiff",
"sample",
"sequential",
"set",
"sin",
"sinh",
"sizeof",
"soapcall",
"sort",
"sorted",
"sqrt",
"stepped",
"stored",
"sum",
"table",
"tan",
"tanh",
"thisnode",
"topn",
"tounicode",
"toxml",
"transfer",
"transform",
"trim",
"truncate",
"typeof",
"ungroup",
"unicodeorder",
"variance",
"wait",
"which",
"workunit",
"xmldecode",
"xmlencode",
"xmltext",
"xmlunicode"
],
typesint: ["integer", "unsigned"].join("|"),
typesnum: ["data", "qstring", "string", "unicode", "utf8", "varstring", "varunicode"],
typesone: [
"ascii",
"big_endian",
"boolean",
"data",
"decimal",
"ebcdic",
"grouped",
"integer",
"linkcounted",
"pattern",
"qstring",
"real",
"record",
"rule",
"set of",
"streamed",
"string",
"token",
"udecimal",
"unicode",
"unsigned",
"utf8",
"varstring",
"varunicode"
].join("|"),
operators: ["+", "-", "/", ":=", "<", "<>", "=", ">", "\\", "and", "in", "not", "or"],
symbols: /[=>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F_]+/, "number.hex"],
[/0[bB][01]+/, "number.hex"],
// binary: use same theme style as hex
[/[0-9_]+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\v\f\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\']+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/'/, "string", "@pop"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
var elixir_exports = {};
__export(elixir_exports, {
conf: () => conf17,
language: () => language18
});
var conf17, language18;
var init_elixir = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js"() {
conf17 = {
comments: {
lineComment: "#"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
],
autoClosingPairs: [
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["comment"] },
{ open: '"""', close: '"""' },
{ open: "`", close: "`", notIn: ["string", "comment"] },
{ open: "(", close: ")" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "<<", close: ">>" }
],
indentationRules: {
increaseIndentPattern: /^\s*(after|else|catch|rescue|fn|[^#]*(do|<\-|\->|\{|\[|\=))\s*$/,
decreaseIndentPattern: /^\s*((\}|\])\s*$|(after|else|catch|rescue|end)\b)/
}
};
language18 = {
defaultToken: "source",
tokenPostfix: ".elixir",
brackets: [
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "<<", close: ">>", token: "delimiter.angle.special" }
],
// Below are lists/regexps to which we reference later.
declarationKeywords: [
"def",
"defp",
"defn",
"defnp",
"defguard",
"defguardp",
"defmacro",
"defmacrop",
"defdelegate",
"defcallback",
"defmacrocallback",
"defmodule",
"defprotocol",
"defexception",
"defimpl",
"defstruct"
],
operatorKeywords: ["and", "in", "not", "or", "when"],
namespaceKeywords: ["alias", "import", "require", "use"],
otherKeywords: [
"after",
"case",
"catch",
"cond",
"do",
"else",
"end",
"fn",
"for",
"if",
"quote",
"raise",
"receive",
"rescue",
"super",
"throw",
"try",
"unless",
"unquote_splicing",
"unquote",
"with"
],
constants: ["true", "false", "nil"],
nameBuiltin: ["__MODULE__", "__DIR__", "__ENV__", "__CALLER__", "__STACKTRACE__"],
// Matches any of the operator names:
// <<< >>> ||| &&& ^^^ ~~~ === !== ~>> <~> |~> <|> == != <= >= && || \\ <> ++ -- |> =~ -> <- ~> <~ :: .. = < > + - * / | . ^ & !
operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\+\+?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)?|\|~>|\|>|\|{1,3}|~>>?|~~~|::/,
// See https://hexdocs.pm/elixir/syntax-reference.html#variables
variableName: /[a-z_][a-zA-Z0-9_]*[?!]?/,
// See https://hexdocs.pm/elixir/syntax-reference.html#atoms
atomName: /[a-zA-Z_][a-zA-Z0-9_@]*[?!]?|@specialAtomName|@operator/,
specialAtomName: /\.\.\.|<<>>|%\{\}|%|\{\}/,
aliasPart: /[A-Z][a-zA-Z0-9_]*/,
moduleName: /@aliasPart(?:\.@aliasPart)*/,
// Sigil pairs are: """ """, ''' ''', " ", ' ', / /, | |, < >, { }, [ ], ( )
sigilSymmetricDelimiter: /"""|'''|"|'|\/|\|/,
sigilStartDelimiter: /@sigilSymmetricDelimiter|<|\{|\[|\(/,
sigilEndDelimiter: /@sigilSymmetricDelimiter|>|\}|\]|\)/,
sigilModifiers: /[a-zA-Z0-9]*/,
decimal: /\d(?:_?\d)*/,
hex: /[0-9a-fA-F](_?[0-9a-fA-F])*/,
octal: /[0-7](_?[0-7])*/,
binary: /[01](_?[01])*/,
// See https://hexdocs.pm/elixir/master/String.html#module-escape-characters
escape: /\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}|\\./,
// The keys below correspond to tokenizer states.
// We start from the root state and match against its rules
// until we explicitly transition into another state.
// The `include` simply brings in all operations from the given state
// and is useful for improving readability.
tokenizer: {
root: [
{ include: "@whitespace" },
{ include: "@comments" },
// Keywords start as either an identifier or a string,
// but end with a : so it's important to match this first.
{ include: "@keywordsShorthand" },
{ include: "@numbers" },
{ include: "@identifiers" },
{ include: "@strings" },
{ include: "@atoms" },
{ include: "@sigils" },
{ include: "@attributes" },
{ include: "@symbols" }
],
// Whitespace
whitespace: [[/\s+/, "white"]],
// Comments
comments: [[/(#)(.*)/, ["comment.punctuation", "comment"]]],
// Keyword list shorthand
keywordsShorthand: [
[/(@atomName)(:)(\s+)/, ["constant", "constant.punctuation", "white"]],
// Use positive look-ahead to ensure the string is followed by :
// and should be considered a keyword.
[
/"(?=([^"]|#\{.*?\}|\\")*":)/,
{ token: "constant.delimiter", next: "@doubleQuotedStringKeyword" }
],
[
/'(?=([^']|#\{.*?\}|\\')*':)/,
{ token: "constant.delimiter", next: "@singleQuotedStringKeyword" }
]
],
doubleQuotedStringKeyword: [
[/":/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
singleQuotedStringKeyword: [
[/':/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
// Numbers
numbers: [
[/0b@binary/, "number.binary"],
[/0o@octal/, "number.octal"],
[/0x@hex/, "number.hex"],
[/@decimal\.@decimal([eE]-?@decimal)?/, "number.float"],
[/@decimal/, "number"]
],
// Identifiers
identifiers: [
// Tokenize identifier name in function-like definitions.
// Note: given `def a + b, do: nil`, `a` is not a function name,
// so we use negative look-ahead to ensure there's no operator.
[
/\b(defp?|defnp?|defmacrop?|defguardp?|defdelegate)(\s+)(@variableName)(?!\s+@operator)/,
[
"keyword.declaration",
"white",
{
cases: {
unquote: "keyword",
"@default": "function"
}
}
]
],
// Tokenize function calls
[
// In-scope call - an identifier followed by ( or .(
/(@variableName)(?=\s*\.?\s*\()/,
{
cases: {
// Tokenize as keyword in cases like `if(..., do: ..., else: ...)`
"@declarationKeywords": "keyword.declaration",
"@namespaceKeywords": "keyword",
"@otherKeywords": "keyword",
"@default": "function.call"
}
}
],
[
// Referencing function in a module
/(@moduleName)(\s*)(\.)(\s*)(@variableName)/,
["type.identifier", "white", "operator", "white", "function.call"]
],
[
// Referencing function in an Erlang module
/(:)(@atomName)(\s*)(\.)(\s*)(@variableName)/,
["constant.punctuation", "constant", "white", "operator", "white", "function.call"]
],
[
// Piping into a function (tokenized separately as it may not have parentheses)
/(\|>)(\s*)(@variableName)/,
[
"operator",
"white",
{
cases: {
"@otherKeywords": "keyword",
"@default": "function.call"
}
}
]
],
[
// Function reference passed to another function
/(&)(\s*)(@variableName)/,
["operator", "white", "function.call"]
],
// Language keywords, builtins, constants and variables
[
/@variableName/,
{
cases: {
"@declarationKeywords": "keyword.declaration",
"@operatorKeywords": "keyword.operator",
"@namespaceKeywords": "keyword",
"@otherKeywords": "keyword",
"@constants": "constant.language",
"@nameBuiltin": "variable.language",
"_.*": "comment.unused",
"@default": "identifier"
}
}
],
// Module names
[/@moduleName/, "type.identifier"]
],
// Strings
strings: [
[/"""/, { token: "string.delimiter", next: "@doubleQuotedHeredoc" }],
[/'''/, { token: "string.delimiter", next: "@singleQuotedHeredoc" }],
[/"/, { token: "string.delimiter", next: "@doubleQuotedString" }],
[/'/, { token: "string.delimiter", next: "@singleQuotedString" }]
],
doubleQuotedHeredoc: [
[/"""/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
singleQuotedHeredoc: [
[/'''/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
doubleQuotedString: [
[/"/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
singleQuotedString: [
[/'/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
// Atoms
atoms: [
[/(:)(@atomName)/, ["constant.punctuation", "constant"]],
[/:"/, { token: "constant.delimiter", next: "@doubleQuotedStringAtom" }],
[/:'/, { token: "constant.delimiter", next: "@singleQuotedStringAtom" }]
],
doubleQuotedStringAtom: [
[/"/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
singleQuotedStringAtom: [
[/'/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
// Sigils
// See https://elixir-lang.org/getting-started/sigils.html
// Sigils allow for typing values using their textual representation.
// All sigils start with ~ followed by a letter or
// multi-letter uppercase starting at Elixir v1.15.0, indicating sigil type
// and then a delimiter pair enclosing the textual representation.
// Optional modifiers are allowed after the closing delimiter.
// For instance a regular expressions can be written as:
// ~r/foo|bar/ ~r{foo|bar} ~r/foo|bar/g
//
// In general lowercase sigils allow for interpolation
// and escaped characters, whereas uppercase sigils don't
//
// During tokenization we want to distinguish some
// specific sigil types, namely string and regexp,
// so that they cen be themed separately.
//
// To reasonably handle all those combinations we leverage
// dot-separated states, so if we transition to @sigilStart.interpol.s.{.}
// then "sigilStart.interpol.s" state will match and also all
// the individual dot-separated parameters can be accessed.
sigils: [
[/~[a-z]@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.interpol" }],
[/~([A-Z]+)@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.noInterpol" }]
],
sigil: [
[/~([a-z]|[A-Z]+)\{/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.{.}" }],
[/~([a-z]|[A-Z]+)\[/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.[.]" }],
[/~([a-z]|[A-Z]+)\(/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.(.)" }],
[/~([a-z]|[A-Z]+)\, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.<.>" }],
[
/~([a-z]|[A-Z]+)(@sigilSymmetricDelimiter)/,
{ token: "@rematch", switchTo: "@sigilStart.$S2.$1.$2.$2" }
]
],
// The definitions below expect states to be of the form:
//
// sigilStart....
// sigilContinue....
//
// The sigilStart state is used only to properly classify the token (as string/regex/sigil)
// and immediately switches to the sigilContinue sate, which handles the actual content
// and waits for the corresponding end delimiter.
"sigilStart.interpol.s": [
[
/~s@sigilStartDelimiter/,
{
token: "string.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol.s": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "string.delimiter", next: "@pop" },
"@default": "string"
}
}
],
{ include: "@stringContentInterpol" }
],
"sigilStart.noInterpol.S": [
[
/~S@sigilStartDelimiter/,
{
token: "string.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol.S": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "string"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "string.delimiter", next: "@pop" },
"@default": "string"
}
}
],
{ include: "@stringContent" }
],
"sigilStart.interpol.r": [
[
/~r@sigilStartDelimiter/,
{
token: "regexp.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol.r": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "regexp.delimiter", next: "@pop" },
"@default": "regexp"
}
}
],
{ include: "@regexpContentInterpol" }
],
"sigilStart.noInterpol.R": [
[
/~R@sigilStartDelimiter/,
{
token: "regexp.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol.R": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "regexp"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "regexp.delimiter", next: "@pop" },
"@default": "regexp"
}
}
],
{ include: "@regexpContent" }
],
// Fallback to the generic sigil by default
"sigilStart.interpol": [
[
/~([a-z]|[A-Z]+)@sigilStartDelimiter/,
{
token: "sigil.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "sigil.delimiter", next: "@pop" },
"@default": "sigil"
}
}
],
{ include: "@sigilContentInterpol" }
],
"sigilStart.noInterpol": [
[
/~([a-z]|[A-Z]+)@sigilStartDelimiter/,
{
token: "sigil.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "sigil"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "sigil.delimiter", next: "@pop" },
"@default": "sigil"
}
}
],
{ include: "@sigilContent" }
],
// Attributes
attributes: [
// Module @doc* attributes - tokenized as comments
[
/\@(module|type)?doc (~[sS])?"""/,
{
token: "comment.block.documentation",
next: "@doubleQuotedHeredocDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?'''/,
{
token: "comment.block.documentation",
next: "@singleQuotedHeredocDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?"/,
{
token: "comment.block.documentation",
next: "@doubleQuotedStringDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?'/,
{
token: "comment.block.documentation",
next: "@singleQuotedStringDocstring"
}
],
[/\@(module|type)?doc false/, "comment.block.documentation"],
// Module attributes
[/\@(@variableName)/, "variable"]
],
doubleQuotedHeredocDocstring: [
[/"""/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
singleQuotedHeredocDocstring: [
[/'''/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
doubleQuotedStringDocstring: [
[/"/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
singleQuotedStringDocstring: [
[/'/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
// Operators, punctuation, brackets
symbols: [
// Code point operator (either with regular character ?a or an escaped one ?\n)
[/\?(\\.|[^\\\s])/, "number.constant"],
// Anonymous function arguments
[/&\d+/, "operator"],
// Bitshift operators (must go before delimiters, so that << >> don't match first)
[/<<<|>>>/, "operator"],
// Delimiter pairs
[/[()\[\]\{\}]|<<|>>/, "@brackets"],
// Triple dot is a valid name (must go before operators, so that .. doesn't match instead)
[/\.\.\./, "identifier"],
// Punctuation => (must go before operators, so it's not tokenized as = then >)
[/=>/, "punctuation"],
// Operators
[/@operator/, "operator"],
// Punctuation
[/[:;,.%]/, "punctuation"]
],
// Generic helpers
stringContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@stringContent" }
],
stringContent: [[/./, "string"]],
stringConstantContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@stringConstantContent" }
],
stringConstantContent: [[/./, "constant"]],
regexpContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@regexpContent" }
],
regexpContent: [
// # may be a regular regexp char, so we use a heuristic
// assuming a # surrounded by whitespace is actually a comment.
[/(\s)(#)(\s.*)$/, ["white", "comment.punctuation", "comment"]],
[/./, "regexp"]
],
sigilContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@sigilContent" }
],
sigilContent: [[/./, "sigil"]],
docstringContent: [[/./, "comment.block.documentation"]],
escapeChar: [[/@escape/, "constant.character.escape"]],
interpolation: [[/#{/, { token: "delimiter.bracket.embed", next: "@interpolationContinue" }]],
interpolationContinue: [
[/}/, { token: "delimiter.bracket.embed", next: "@pop" }],
// Interpolation brackets may contain arbitrary code,
// so we simply match against all the root rules,
// until we reach interpolation end (the above matches).
{ include: "@root" }
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.js
var flow9_exports = {};
__export(flow9_exports, {
conf: () => conf18,
language: () => language19
});
var conf18, language19;
var init_flow9 = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/flow9/flow9.js"() {
conf18 = {
comments: {
blockComment: ["/*", "*/"],
lineComment: "//"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}", notIn: ["string"] },
{ open: "[", close: "]", notIn: ["string"] },
{ open: "(", close: ")", notIn: ["string"] },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "'", close: "'", notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
]
};
language19 = {
defaultToken: "",
tokenPostfix: ".flow",
keywords: [
"import",
"require",
"export",
"forbid",
"native",
"if",
"else",
"cast",
"unsafe",
"switch",
"default"
],
types: [
"io",
"mutable",
"bool",
"int",
"double",
"string",
"flow",
"void",
"ref",
"true",
"false",
"with"
],
operators: [
"=",
">",
"<",
"<=",
">=",
"==",
"!",
"!=",
":=",
"::=",
"&&",
"||",
"+",
"-",
"*",
"/",
"@",
"&",
"%",
":",
"->",
"\\",
"$",
"??",
"^"
],
symbols: /[@$=>](?!@symbols)/, "delimiter"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
[/"/, "string", "@string"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.js
var fsharp_exports = {};
__export(fsharp_exports, {
conf: () => conf19,
language: () => language20
});
var conf19, language20;
var init_fsharp = __esm({
"node_modules/monaco-editor/esm/vs/basic-languages/fsharp/fsharp.js"() {
conf19 = {
comments: {
lineComment: "//",
blockComment: ["(*", "*)"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"),
end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)")
}
}
};
language20 = {
defaultToken: "",
tokenPostfix: ".fs",
keywords: [
"abstract",
"and",
"atomic",
"as",
"assert",
"asr",
"base",
"begin",
"break",
"checked",
"component",
"const",
"constraint",
"constructor",
"continue",
"class",
"default",
"delegate",
"do",
"done",
"downcast",
"downto",
"elif",
"else",
"end",
"exception",
"eager",
"event",
"external",
"extern",
"false",
"finally",
"for",
"fun",
"function",
"fixed",
"functor",
"global",
"if",
"in",
"include",
"inherit",
"inline",
"interface",
"internal",
"land",
"lor",
"lsl",
"lsr",
"lxor",
"lazy",
"let",
"match",
"member",
"mod",
"module",
"mutable",
"namespace",
"method",
"mixin",
"new",
"not",
"null",
"of",
"open",
"or",
"object",
"override",
"private",
"parallel",
"process",
"protected",
"pure",
"public",
"rec",
"return",
"static",
"sealed",
"struct",
"sig",
"then",
"to",
"true",
"tailcall",
"trait",
"try",
"type",
"upcast",
"use",
"val",
"void",
"virtual",
"volatile",
"when",
"while",
"with",
"yield"
],
// we include these common regular expressions
symbols: /[=>].
[/\[<.*>\]/, "annotation"],
// Preprocessor directive
[/^#(if|else|endif)/, "keyword"],
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[/@symbols/, "delimiter"],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/0x[0-9a-fA-F]+LF/, "number.float"],
[/0x[0-9a-fA-F]+(@integersuffix)/, "number.hex"],
[/0b[0-1]+(@integersuffix)/, "number.bin"],
[/\d+(@integersuffix)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"""/, "string", '@string."""'],
[/"/, "string", '@string."'],
// literal string
[/\@"/, { token: "string.quote", next: "@litstring" }],
// characters
[/'[^\\']'B?/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\(\*(?!\))/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^*(]+/, "comment"],
[/\*\)/, "comment", "@pop"],
[/\*/, "comment"],
[/\(\*\)/, "comment"],
[/\(/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[
/("""|"B?)/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
]
],
litstring: [
[/[^"]+/, "string"],
[/""/, "string.escape"],
[/"/, { token: "string.quote", next: "@pop" }]
]
}
};
}
});
// node_modules/monaco-editor/esm/vs/basic-languages/freemarker2/freemarker2.js
var freemarker2_exports = {};
__export(freemarker2_exports, {
TagAngleInterpolationBracket: () => TagAngleInterpolationBracket,
TagAngleInterpolationDollar: () => TagAngleInterpolationDollar,
TagAutoInterpolationBracket: () => TagAutoInterpolationBracket,
TagAutoInterpolationDollar: () => TagAutoInterpolationDollar,
TagBracketInterpolationBracket: () => TagBracketInterpolationBracket,
TagBracketInterpolationDollar: () => TagBracketInterpolationDollar
});
function createLangConfiguration(ts2) {
return {
brackets: [
["<", ">"],
["[", "]"],
["(", ")"],
["{", "}"]
],
comments: {
blockComment: [`${ts2.open}--`, `--${ts2.close}`]
},
autoCloseBefore: "\n\r }]),.:;=",
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "'", close: "'", notIn: ["string"] }
],
surroundingPairs: [
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp(
`${ts2.open}#(?:${BLOCK_ELEMENTS.join("|")})([^/${ts2.close}]*(?!/)${ts2.close})[^${ts2.open}]*$`
),
end: new RegExp(`${ts2.open}/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`)
}
},
onEnterRules: [
{
beforeText: new RegExp(
`${ts2.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts2.close}]*(?!/)${ts2.close})[^${ts2.open}]*$`
),
afterText: new RegExp(`^${ts2.open}/#([a-zA-Z_]+)[\\r\\n\\t ]*${ts2.close}$`),
action: {
indentAction: monaco_editor_core_exports2.languages.IndentAction.IndentOutdent
}
},
{
beforeText: new RegExp(
`${ts2.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts2.close}]*(?!/)${ts2.close})[^${ts2.open}]*$`
),
action: { indentAction: monaco_editor_core_exports2.languages.IndentAction.Indent }
}
]
};
}
function createLangConfigurationAuto() {
return {
// Cannot set block comment delimiter in auto mode...
// It depends on the content and the cursor position of the file...
brackets: [
["<", ">"],
["[", "]"],
["(", ")"],
["{", "}"]
],
autoCloseBefore: "\n\r }]),.:;=",
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "'", close: "'", notIn: ["string"] }
],
surroundingPairs: [
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp(`[<\\[]#(?:${BLOCK_ELEMENTS.join("|")})([^/>\\]]*(?!/)[>\\]])[^<\\[]*$`),
end: new RegExp(`[<\\[]/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`)
}
},
onEnterRules: [
{
beforeText: new RegExp(
`[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
),
afterText: new RegExp(`^[<\\[]/#([a-zA-Z_]+)[\\r\\n\\t ]*[>\\]]$`),
action: {
indentAction: monaco_editor_core_exports2.languages.IndentAction.IndentOutdent
}
},
{
beforeText: new RegExp(
`[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
),
action: { indentAction: monaco_editor_core_exports2.languages.IndentAction.Indent }
}
]
};
}
function createMonarchLanguage(ts2, is) {
const id = `_${ts2.id}_${is.id}`;
const s = (name) => name.replace(/__id__/g, id);
const r = (regexp) => {
const source = regexp.source.replace(/__id__/g, id);
return new RegExp(source, regexp.flags);
};
return {
// Settings
unicode: true,
includeLF: false,
start: s("default__id__"),
ignoreCase: false,
defaultToken: "invalid",
tokenPostfix: `.freemarker2`,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
// Dynamic RegExp
[s("open__id__")]: new RegExp(ts2.open),
[s("close__id__")]: new RegExp(ts2.close),
[s("iOpen1__id__")]: new RegExp(is.open1),
[s("iOpen2__id__")]: new RegExp(is.open2),
[s("iClose__id__")]: new RegExp(is.close),
// <#START_TAG : "<" | "<#" | "[#">
// <#END_TAG : "" | "#" | "[/#">
[s("startTag__id__")]: r(/(@open__id__)(#)/),
[s("endTag__id__")]: r(/(@open__id__)(\/#)/),
[s("startOrEndTag__id__")]: r(/(@open__id__)(\/?#)/),
// <#CLOSE_TAG1 : ()* (">" | "]")>
[s("closeTag1__id__")]: r(/((?:@blank)*)(@close__id__)/),
// <#CLOSE_TAG2 : ()* ("/")? (">" | "]")>
[s("closeTag2__id__")]: r(/((?:@blank)*\/?)(@close__id__)/),
// Static RegExp
// <#BLANK : " " | "\t" | "\n" | "\r">
blank: /[ \t\n\r]/,
//
//
//
//
//
keywords: ["false", "true", "in", "as", "using"],
// Directive names that cannot have an expression parameters and cannot be self-closing
// E.g. <#if id==2> ... #if>
directiveStartCloseTag1: /attempt|recover|sep|auto[eE]sc|no(?:autoe|AutoE)sc|compress|default|no[eE]scape|comment|no[pP]arse/,
// Directive names that cannot have an expression parameter and can be self-closing
// E.g. <#if> ... <#else> ... #if>
// E.g. <#if> ... <#else />#if>
directiveStartCloseTag2: /else|break|continue|return|stop|flush|t|lt|rt|nt|nested|recurse|fallback|ftl/,
// Directive names that can have an expression parameter and cannot be self-closing
// E.g. <#if id==2> ... #if>
directiveStartBlank: /if|else[iI]f|list|for[eE]ach|switch|case|assign|global|local|include|import|function|macro|transform|visit|stop|return|call|setting|output[fF]ormat|nested|recurse|escape|ftl|items/,
// Directive names that can have an end tag
// E.g. #if>
directiveEndCloseTag1: /if|list|items|sep|recover|attempt|for[eE]ach|local|global|assign|function|macro|output[fF]ormat|auto[eE]sc|no(?:autoe|AutoE)sc|compress|transform|switch|escape|no[eE]scape/,
// <#ESCAPED_CHAR :
// "\\"
// (
// ("n" | "t" | "r" | "f" | "b" | "g" | "l" | "a" | "\\" | "'" | "\"" | "{" | "=")
// |
// ("x" ["0"-"9", "A"-"F", "a"-"f"])
// )
// >
// Note: While the JavaCC tokenizer rule only specifies one hex digit,
// FreeMarker actually interprets up to 4 hex digits.
escapedChar: /\\(?:[ntrfbgla\\'"\{=]|(?:x[0-9A-Fa-f]{1,4}))/,
// <#ASCII_DIGIT: ["0" - "9"]>
asciiDigit: /[0-9]/,
//
integer: /[0-9]+/,
// <#NON_ESCAPED_ID_START_CHAR:
// [
// // This was generated on JDK 1.8.0_20 Win64 with src/main/misc/identifierChars/IdentifierCharGenerator.java
// ...
// ]
nonEscapedIdStartChar: /[\$@-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u1FFF\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\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-\u3006\u3031-\u3035\u303B-\u303C\u3040-\u318F\u31A0-\u31BA\u31F0-\u31FF\u3300-\u337F\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\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]/,
// <#ESCAPED_ID_CHAR: "\\" ("-" | "." | ":" | "#")>
escapedIdChar: /\\[\-\.:#]/,
// <#ID_START_CHAR: |>
idStartChar: /(?:@nonEscapedIdStartChar)|(?:@escapedIdChar)/,
// (|)*>
id: /(?:@idStartChar)(?:(?:@idStartChar)|(?:@asciiDigit))*/,
// Certain keywords / operators are allowed to index hashes
//
// Expression DotVariable(Expression exp) :
// {
// Token t;
// }
// {
//
// (
// t = | t = | t =
// |
// (
// t =
// |
// t =
// |
// t =
// |
// t =
// |
// t =
// |
// t =
// |
// t =
// |
// t =
// |
// t =
// )
// {
// if (!Character.isLetter(t.image.charAt(0))) {
// throw new ParseException(t.image + " is not a valid identifier.", template, t);
// }
// }
// )
// {
// notListLiteral(exp, "hash");
// notStringLiteral(exp, "hash");
// notBooleanLiteral(exp, "hash");
// Dot dot = new Dot(exp, t.image);
// dot.setLocation(template, exp, t);
// return dot;
// }
// }
specialHashKeys: /\*\*|\*|false|true|in|as|using/,
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// " | "->">
namedSymbols: /<=|>=|\\lte|\\lt|<|\\gte|\\gt|>|&&|\\and|->|->|==|!=|\+=|-=|\*=|\/=|%=|\+\+|--|<=|&&|\|\||:|\.\.\.|\.\.\*|\.\.<|\.\.!|\?\?|=|<|\+|-|\*|\/|%|\||\.\.|\?|!|&|\.|,|;/,
arrows: ["->", "->"],
delimiters: [";", ":", ",", "."],
stringOperators: ["lte", "lt", "gte", "gt"],
noParseTags: ["noparse", "noParse", "comment"],
tokenizer: {
// Parser states
// Plain text
[s("default__id__")]: [
{ include: s("@directive_token__id__") },
{ include: s("@interpolation_and_text_token__id__") }
],
// A FreeMarker expression inside a directive, e.g. <#if 2<3>
[s("fmExpression__id__.directive")]: [
{ include: s("@blank_and_expression_comment_token__id__") },
{ include: s("@directive_end_token__id__") },
{ include: s("@expression_token__id__") }
],
// A FreeMarker expression inside an interpolation, e.g. ${2+3}
[s("fmExpression__id__.interpolation")]: [
{ include: s("@blank_and_expression_comment_token__id__") },
{ include: s("@expression_token__id__") },
{ include: s("@greater_operators_token__id__") }
],
// In an expression and inside a not-yet closed parenthesis / bracket
[s("inParen__id__.plain")]: [
{ include: s("@blank_and_expression_comment_token__id__") },
{ include: s("@directive_end_token__id__") },
{ include: s("@expression_token__id__") }
],
[s("inParen__id__.gt")]: [
{ include: s("@blank_and_expression_comment_token__id__") },
{ include: s("@expression_token__id__") },
{ include: s("@greater_operators_token__id__") }
],
// Expression for the unified call, e.g. <@createMacro() ... >
[s("noSpaceExpression__id__")]: [
{ include: s("@no_space_expression_end_token__id__") },
{ include: s("@directive_end_token__id__") },
{ include: s("@expression_token__id__") }
],
// For the function of a unified call. Special case for when the
// expression is a simple identifier.
// <@join [1,2] ",">
// <@null!join [1,2] ",">
[s("unifiedCall__id__")]: [{ include: s("@unified_call_token__id__") }],
// For singly and doubly quoted string (that may contain interpolations)
[s("singleString__id__")]: [{ include: s("@string_single_token__id__") }],
[s("doubleString__id__")]: [{ include: s("@string_double_token__id__") }],
// For singly and doubly quoted string (that may not contain interpolations)
[s("rawSingleString__id__")]: [{ include: s("@string_single_raw_token__id__") }],
[s("rawDoubleString__id__")]: [{ include: s("@string_double_raw_token__id__") }],
// For a comment in an expression
// ${ 1 + <#-- comment --> 2}
[s("expressionComment__id__")]: [{ include: s("@expression_comment_token__id__") }],
// For <#noparse> ... #noparse>
// For <#noParse> ... #noParse>
// For <#comment> ... #comment>
[s("noParse__id__")]: [{ include: s("@no_parse_token__id__") }],
// For <#-- ... -->
[s("terseComment__id__")]: [{ include: s("@terse_comment_token__id__") }],
// Common rules
[s("directive_token__id__")]: [
// "attempt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "recover" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "sep" >
// "auto" ("e"|"E") "sc" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
// }
// "no" ("autoe"|"AutoE") "sc" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
// }
// "compress" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "default" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "no" ("e" | "E") "scape" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
// }
//
// "comment" > {
// handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); noparseTag = "comment";
// }
// "no" ("p" | "P") "arse" > {
// int tagNamingConvention = getTagNamingConvention(matchedToken, 2);
// handleTagSyntaxAndSwitch(matchedToken, tagNamingConvention, NO_PARSE);
// noparseTag = tagNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION ? "noParse" : "noparse";
// }
[
r(/(?:@startTag__id__)(@directiveStartCloseTag1)(?:@closeTag1__id__)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{
cases: {
"@noParseTags": { token: "tag", next: s("@noParse__id__.$3") },
"@default": { token: "tag" }
}
},
{ token: "delimiter.directive" },
{ token: "@brackets.directive" }
]
],
// "else" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "break" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "continue" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "return" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "stop" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "flush" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "t" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "lt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "rt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "nt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "nested" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "recurse" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "fallback" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// " | "]")> { ftlHeader(matchedToken); }
[
r(/(?:@startTag__id__)(@directiveStartCloseTag2)(?:@closeTag2__id__)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag" },
{ token: "delimiter.directive" },
{ token: "@brackets.directive" }
]
],
// "if" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "else" ("i" | "I") "f" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), FM_EXPRESSION);
// }
// "list" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "for" ("e" | "E") "ach" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), FM_EXPRESSION);
// }
// "switch" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "case" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "assign" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "global" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "local" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// <_INCLUDE : "include" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "import" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "function" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "macro" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "transform" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "visit" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "stop" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "return" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "call" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "setting" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "output" ("f"|"F") "ormat" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), FM_EXPRESSION);
// }
// "nested" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "recurse" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
// "escape" > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
//
// Note: FreeMarker grammar appears to treat the FTL header as a special case,
// in order to remove new lines after the header (?), but since we only need
// to tokenize for highlighting, we can include this directive here.
// > { ftlHeader(matchedToken); }
//
// Note: FreeMarker grammar appears to treat the items directive as a special case for
// the AST parsing process, but since we only need to tokenize, we can include this
// directive here.
// "items" ()+ > { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
[
r(/(?:@startTag__id__)(@directiveStartBlank)(@blank)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag" },
{ token: "", next: s("@fmExpression__id__.directive") }
]
],
// "if" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "list" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "sep" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "recover" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "attempt" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "for" ("e" | "E") "ach" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), DEFAULT);
// }
// "local" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "global" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "assign" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "function" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "macro" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "output" ("f" | "F") "ormat" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), DEFAULT);
// }
// "auto" ("e" | "E") "sc" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
// }
// "no" ("autoe"|"AutoE") "sc" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
// }
// "compress" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "transform" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "switch" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "escape" > { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
// "no" ("e" | "E") "scape" > {
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
// }
[
r(/(?:@endTag__id__)(@directiveEndCloseTag1)(?:@closeTag1__id__)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag" },
{ token: "delimiter.directive" },
{ token: "@brackets.directive" }
]
],
// { unifiedCall(matchedToken); }
[
r(/(@open__id__)(@)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive", next: s("@unifiedCall__id__") }
]
],
// ) (".")*)? > { unifiedCallEnd(matchedToken); }
[
r(/(@open__id__)(\/@)((?:(?:@id)(?:\.(?:@id))*)?)(?:@closeTag1__id__)/),
[
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag" },
{ token: "delimiter.directive" },
{ token: "@brackets.directive" }
]
],
// { noparseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); }
[
r(/(@open__id__)#--/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : { token: "comment", next: s("@terseComment__id__") }
],
//
[
r(/(?:@startOrEndTag__id__)([a-zA-Z_]+)/),
ts2.id === "auto" ? {
cases: {
"$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
"$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
}
} : [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag.invalid", next: s("@fmExpression__id__.directive") }
]
]
],
// TOKEN :
[s("interpolation_and_text_token__id__")]: [
// { startInterpolation(matchedToken); }
// { startInterpolation(matchedToken); }
[
r(/(@iOpen1__id__)(@iOpen2__id__)/),
[
{ token: is.id === "bracket" ? "@brackets.interpolation" : "delimiter.interpolation" },
{
token: is.id === "bracket" ? "delimiter.interpolation" : "@brackets.interpolation",
next: s("@fmExpression__id__.interpolation")
}
]
],
// // to handle a lone dollar sign or "<" or "# or <@ with whitespace after"
//
//
[/[\$#<\[\{]|(?:@blank)+|[^\$<#\[\{\n\r\t ]+/, { token: "source" }]
],
// )*
// "\""
// )
// |
// (
// "'"
// ((~["'", "\\"]) | )*
// "'"
// )
// >
[s("string_single_token__id__")]: [
[/[^'\\]/, { token: "string" }],
[/@escapedChar/, { token: "string.escape" }],
[/'/, { token: "string", next: "@pop" }]
],
[s("string_double_token__id__")]: [
[/[^"\\]/, { token: "string" }],
[/@escapedChar/, { token: "string.escape" }],
[/"/, { token: "string", next: "@pop" }]
],
//
[s("string_single_raw_token__id__")]: [
[/[^']+/, { token: "string.raw" }],
[/'/, { token: "string.raw", next: "@pop" }]
],
[s("string_double_raw_token__id__")]: [
[/[^"]+/, { token: "string.raw" }],
[/"/, { token: "string.raw", next: "@pop" }]
],
// TOKEN :
[s("expression_token__id__")]: [
// Strings
[
/(r?)(['"])/,
{
cases: {
"r'": [
{ token: "keyword" },
{ token: "string.raw", next: s("@rawSingleString__id__") }
],
'r"': [
{ token: "keyword" },
{ token: "string.raw", next: s("@rawDoubleString__id__") }
],
"'": [{ token: "source" }, { token: "string", next: s("@singleString__id__") }],
'"': [{ token: "source" }, { token: "string", next: s("@doubleString__id__") }]
}
}
],
// Numbers
//
// "." >
[
/(?:@integer)(?:\.(?:@integer))?/,
{
cases: {
"(?:@integer)": { token: "number" },
"@default": { token: "number.float" }
}
}
],
// Special hash keys that must not be treated as identifiers
// after a period, e.g. a.** is accessing the key "**" of a
[
/(\.)(@blank*)(@specialHashKeys)/,
[{ token: "delimiter" }, { token: "" }, { token: "identifier" }]
],
// Symbols / operators
[
/(?:@namedSymbols)/,
{
cases: {
"@arrows": { token: "meta.arrow" },
"@delimiters": { token: "delimiter" },
"@default": { token: "operators" }
}
}
],
// Identifiers
[
/@id/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@stringOperators": { token: "operators" },
"@default": { token: "identifier" }
}
}
],
//
//
//
//
//
//
[
/[\[\]\(\)\{\}]/,
{
cases: {
"\\[": {
cases: {
"$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") },
"@default": { token: "@brackets", next: s("@inParen__id__.plain") }
}
},
"\\]": {
cases: __spreadProps(__spreadValues(__spreadValues({}, is.id === "bracket" ? {
"$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" }
} : {}), ts2.id === "bracket" ? {
"$S2==directive": { token: "@brackets.directive", next: "@popall" }
} : {}), {
// Ignore mismatched paren
[s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
"@default": { token: "@brackets" }
})
},
"\\(": { token: "@brackets", next: s("@inParen__id__.gt") },
"\\)": {
cases: {
[s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
"@default": { token: "@brackets" }
}
},
"\\{": {
cases: {
"$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") },
"@default": { token: "@brackets", next: s("@inParen__id__.plain") }
}
},
"\\}": {
cases: __spreadProps(__spreadValues({}, is.id === "bracket" ? {} : {
"$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" }
}), {
// Ignore mismatched paren
[s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
"@default": { token: "@brackets" }
})
}
}
}
],
//
[/\$\{/, { token: "delimiter.invalid" }]
],
// SKIP :
[s("blank_and_expression_comment_token__id__")]: [
// < ( " " | "\t" | "\n" | "\r" )+ >
[/(?:@blank)+/, { token: "" }],
// < ("<" | "[") ("#" | "!") "--"> : EXPRESSION_COMMENT
[/[<\[][#!]--/, { token: "comment", next: s("@expressionComment__id__") }]
],
// TOKEN :
[s("directive_end_token__id__")]: [
// ">
// {
// if (inFTLHeader) {
// eatNewline();
// inFTLHeader = false;
// }
// if (squBracTagSyntax || postInterpolationLexState != -1 /* We are in an interpolation */) {
// matchedToken.kind = NATURAL_GT;
// } else {
// SwitchTo(DEFAULT);
// }
// }
// This cannot happen while in auto mode, since this applies only to an
// fmExpression inside a directive. But once we encounter the start of a
// directive, we can establish the tag syntax mode.
[
/>/,
ts2.id === "bracket" ? { token: "operators" } : { token: "@brackets.directive", next: "@popall" }
],
// " | "/]">
// It is a syntax error to end a tag with the wrong close token
// Let's indicate that to the user by not closing the tag
[
r(/(\/)(@close__id__)/),
[{ token: "delimiter.directive" }, { token: "@brackets.directive", next: "@popall" }]
]
],
// TOKEN :
[s("greater_operators_token__id__")]: [
// ">
[/>/, { token: "operators" }],
// =">
[/>=/, { token: "operators" }]
],
// TOKEN :
[s("no_space_expression_end_token__id__")]: [
// : FM_EXPRESSION
[/(?:@blank)+/, { token: "", switchTo: s("@fmExpression__id__.directive") }]
],
[s("unified_call_token__id__")]: [
// Special case for a call where the expression is just an ID
// +
[
/(@id)((?:@blank)+)/,
[{ token: "tag" }, { token: "", next: s("@fmExpression__id__.directive") }]
],
[
r(/(@id)(\/?)(@close__id__)/),
[
{ token: "tag" },
{ token: "delimiter.directive" },
{ token: "@brackets.directive", next: "@popall" }
]
],
[/./, { token: "@rematch", next: s("@noSpaceExpression__id__") }]
],
// TOKEN :
[s("no_parse_token__id__")]: [
// " | "]")
// >
[
r(/(@open__id__)(\/#?)([a-zA-Z]+)((?:@blank)*)(@close__id__)/),
{
cases: {
"$S2==$3": [
{ token: "@brackets.directive" },
{ token: "delimiter.directive" },
{ token: "tag" },
{ token: "" },
{ token: "@brackets.directive", next: "@popall" }
],
"$S2==comment": [
{ token: "comment" },
{ token: "comment" },
{ token: "comment" },
{ token: "comment" },
{ token: "comment" }
],
"@default": [
{ token: "source" },
{ token: "source" },
{ token: "source" },
{ token: "source" },
{ token: "source" }
]
}
}
],
//
//