data-center-components
Version:
1,560 lines (1,535 loc) • 8.94 MB
JavaScript
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 9191:
/***/ (function(module, __unused_webpack___webpack_exports__, __webpack_require__) {
"use strict";
// UNUSED EXPORTS: create
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function _toPrimitive(input, hint) {
if (_typeof(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (_typeof(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
var es_array_push = __webpack_require__(7658);
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.flags.js
var es_regexp_flags = __webpack_require__(2087);
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Avoid circular dependency on EventEmitter by implementing a subset of the interface.
class ErrorHandler {
constructor() {
this.listeners = [];
this.unexpectedErrorHandler = function (e) {
setTimeout(() => {
if (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);
}
}
const errorHandler = new ErrorHandler();
function onUnexpectedError(e) {
// ignore errors from cancelled promises
if (!isCancellationError(e)) {
errorHandler.onUnexpectedError(e);
}
return undefined;
}
function onUnexpectedExternalError(e) {
// ignore errors from cancelled promises
if (!isCancellationError(e)) {
errorHandler.onUnexpectedExternalError(e);
}
return undefined;
}
function transformErrorForSerialization(error) {
if (error instanceof Error) {
let {
name,
message
} = error;
const stack = error.stacktrace || error.stack;
return {
$isError: true,
name,
message,
stack
};
}
// return as is
return error;
}
const canceledName = 'Canceled';
/**
* Checks if the given error is a promise in canceled state
*/
function isCancellationError(error) {
if (error instanceof CancellationError) {
return true;
}
return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
// !!!IMPORTANT!!!
// Do NOT change this class because it is also used as an API-type.
class CancellationError extends Error {
constructor() {
super(canceledName);
this.name = this.message;
}
}
/**
* @deprecated use {@link CancellationError `new CancellationError()`} instead
*/
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');
}
}
class NotSupportedError extends Error {
constructor(message) {
super('NotSupported');
if (message) {
this.message = message;
}
}
}
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/functional.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function once(fn) {
const _this = this;
let didCall = false;
let result;
return function () {
if (didCall) {
return result;
}
didCall = true;
result = fn.apply(_this, arguments);
return result;
};
}
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/iterator.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Iterable;
(function (Iterable) {
function is(thing) {
return thing && typeof thing === 'object' && typeof thing[Symbol.iterator] === 'function';
}
Iterable.is = is;
const _empty = Object.freeze([]);
function empty() {
return _empty;
}
Iterable.empty = empty;
function* single(element) {
yield element;
}
Iterable.single = single;
function from(iterable) {
return iterable || _empty;
}
Iterable.from = from;
function isEmpty(iterable) {
return !iterable || iterable[Symbol.iterator]().next().done === true;
}
Iterable.isEmpty = isEmpty;
function first(iterable) {
return iterable[Symbol.iterator]().next().value;
}
Iterable.first = first;
function some(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
return true;
}
}
return false;
}
Iterable.some = some;
function find(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
return element;
}
}
return undefined;
}
Iterable.find = find;
function* filter(iterable, predicate) {
for (const element of iterable) {
if (predicate(element)) {
yield element;
}
}
}
Iterable.filter = filter;
function* map(iterable, fn) {
let index = 0;
for (const element of iterable) {
yield fn(element, index++);
}
}
Iterable.map = map;
function* concat(...iterables) {
for (const iterable of iterables) {
for (const element of iterable) {
yield element;
}
}
}
Iterable.concat = concat;
function* concatNested(iterables) {
for (const iterable of iterables) {
for (const element of iterable) {
yield element;
}
}
}
Iterable.concatNested = concatNested;
function reduce(iterable, reducer, initialValue) {
let value = initialValue;
for (const element of iterable) {
value = reducer(value, element);
}
return value;
}
Iterable.reduce = reduce;
/**
* Returns an iterable slice of the array, with the same semantics as `array.slice()`.
*/
function* slice(arr, from, to = arr.length) {
if (from < 0) {
from += arr.length;
}
if (to < 0) {
to += arr.length;
} else if (to > arr.length) {
to = arr.length;
}
for (; from < to; from++) {
yield arr[from];
}
}
Iterable.slice = slice;
/**
* Consumes `atMost` elements from iterable and returns the consumed elements,
* and an iterable for the rest of the elements.
*/
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, Iterable.empty()];
}
consumed.push(next.value);
}
return [consumed, {
[Symbol.iterator]() {
return iterator;
}
}];
}
Iterable.consume = consume;
/**
* Returns whether the iterables are the same length and all items are
* equal using the comparator function.
*/
function equals(a, b, comparator = (at, bt) => at === bt) {
const ai = a[Symbol.iterator]();
const bi = b[Symbol.iterator]();
while (true) {
const an = ai.next();
const bn = bi.next();
if (an.done !== bn.done) {
return false;
} else if (an.done) {
return true;
} else if (!comparator(an.value, bn.value)) {
return false;
}
}
}
Iterable.equals = equals;
})(Iterable || (Iterable = {}));
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Enables logging of potentially leaked disposables.
*
* A disposable is considered leaked if it is not disposed or not registered as the child of
* another disposable. This tracking is very simple an only works for classes that either
* extend Disposable or use a DisposableStore. This means there are a lot of false positives.
*/
const TRACK_DISPOSABLES = false;
let disposableTracker = null;
function setDisposableTracker(tracker) {
disposableTracker = tracker;
}
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);
}
}, 3000);
}
setParent(child, parent) {
if (child && child !== lifecycle_Disposable.None) {
try {
child[__is_disposable_tracked__] = true;
} catch (_a) {
// noop
}
}
}
markAsDisposed(disposable) {
if (disposable && disposable !== lifecycle_Disposable.None) {
try {
disposable[__is_disposable_tracked__] = true;
} catch (_a) {
// noop
}
}
}
markAsSingleton(disposable) {}
}());
}
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);
}
}
/**
* Indicates that the given object is a singleton which does not need to be disposed.
*/
function markAsSingleton(singleton) {
disposableTracker === null || disposableTracker === void 0 ? void 0 : disposableTracker.markAsSingleton(singleton);
return singleton;
}
class MultiDisposeError extends Error {
constructor(errors) {
super(`Encountered errors while disposing of store. Errors: [${errors.join(', ')}]`);
this.errors = errors;
}
}
function isDisposable(thing) {
return typeof thing.dispose === 'function' && thing.dispose.length === 0;
}
function dispose(arg) {
if (Iterable.is(arg)) {
let 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 MultiDisposeError(errors);
}
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 self = trackDisposable({
dispose: once(() => {
markAsDisposed(self);
fn();
})
});
return self;
}
class DisposableStore {
constructor() {
this._toDispose = 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();
}
/**
* Returns `true` if this object has been disposed
*/
get isDisposed() {
return this._isDisposed;
}
/**
* Dispose of all registered disposables but do not mark this object as disposed.
*/
clear() {
try {
dispose(this._toDispose.values());
} finally {
this._toDispose.clear();
}
}
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;
}
}
DisposableStore.DISABLE_DISPOSED_WARNING = false;
class lifecycle_Disposable {
constructor() {
this._store = new DisposableStore();
trackDisposable(this);
setParentOfDisposable(this._store, this);
}
dispose() {
markAsDisposed(this);
this._store.dispose();
}
_register(o) {
if (o === this) {
throw new Error('Cannot register a disposable on itself!');
}
return this._store.add(o);
}
}
lifecycle_Disposable.None = Object.freeze({
dispose() {}
});
/**
* Manages the lifecycle of a disposable value that may be changed.
*
* This ensures that when the disposable value is changed, the previously held disposable is disposed of. You can
* also register a `MutableDisposable` on a `Disposable` to ensure it is automatically cleaned up.
*/
class MutableDisposable {
constructor() {
this._isDisposed = false;
trackDisposable(this);
}
get value() {
return this._isDisposed ? undefined : this._value;
}
set value(value) {
var _a;
if (this._isDisposed || value === this._value) {
return;
}
(_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();
if (value) {
setParentOfDisposable(value, this);
}
this._value = value;
}
clear() {
this.value = undefined;
}
dispose() {
var _a;
this._isDisposed = true;
markAsDisposed(this);
(_a = this._value) === null || _a === void 0 ? void 0 : _a.dispose();
this._value = undefined;
}
/**
* Clears the value, but does not dispose it.
* The old value is returned.
*/
clearAndLeak() {
const oldValue = this._value;
this._value = undefined;
if (oldValue) {
setParentOfDisposable(oldValue, null);
}
return oldValue;
}
}
/**
* A safe disposable can be `unset` so that a leaked reference (listener)
* can be cut-off.
*/
class SafeDisposable {
constructor() {
this.dispose = () => {};
this.unset = () => {};
this.isset = () => false;
trackDisposable(this);
}
set(fn) {
let callback = fn;
this.unset = () => callback = undefined;
this.isset = () => callback !== undefined;
this.dispose = () => {
if (callback) {
callback();
callback = undefined;
markAsDisposed(this);
}
};
return this;
}
}
class ImmortalReference {
constructor(object) {
this.object = object;
}
dispose() {}
}
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/linkedList.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
class Node {
constructor(element) {
this.element = element;
this.next = Node.Undefined;
this.prev = Node.Undefined;
}
}
Node.Undefined = new Node(undefined);
class linkedList_LinkedList {
constructor() {
this._first = Node.Undefined;
this._last = Node.Undefined;
this._size = 0;
}
get size() {
return this._size;
}
isEmpty() {
return this._first === Node.Undefined;
}
clear() {
let node = this._first;
while (node !== Node.Undefined) {
const next = node.next;
node.prev = Node.Undefined;
node.next = Node.Undefined;
node = next;
}
this._first = Node.Undefined;
this._last = Node.Undefined;
this._size = 0;
}
unshift(element) {
return this._insert(element, false);
}
push(element) {
return this._insert(element, true);
}
_insert(element, atTheEnd) {
const newNode = new Node(element);
if (this._first === Node.Undefined) {
this._first = newNode;
this._last = newNode;
} else if (atTheEnd) {
// push
const oldLast = this._last;
this._last = newNode;
newNode.prev = oldLast;
oldLast.next = newNode;
} else {
// unshift
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 === Node.Undefined) {
return undefined;
} else {
const res = this._first.element;
this._remove(this._first);
return res;
}
}
pop() {
if (this._last === Node.Undefined) {
return undefined;
} else {
const res = this._last.element;
this._remove(this._last);
return res;
}
}
_remove(node) {
if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {
// middle
const anchor = node.prev;
anchor.next = node.next;
node.next.prev = anchor;
} else if (node.prev === Node.Undefined && node.next === Node.Undefined) {
// only node
this._first = Node.Undefined;
this._last = Node.Undefined;
} else if (node.next === Node.Undefined) {
// last
this._last = this._last.prev;
this._last.next = Node.Undefined;
} else if (node.prev === Node.Undefined) {
// first
this._first = this._first.next;
this._first.prev = Node.Undefined;
}
// done
this._size -= 1;
}
*[Symbol.iterator]() {
let node = this._first;
while (node !== Node.Undefined) {
yield node.element;
node = node.next;
}
}
}
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var _a;
const LANGUAGE_DEFAULT = 'en';
let _isWindows = false;
let _isMacintosh = false;
let _isLinux = false;
let _isLinuxSnap = false;
let _isNative = false;
let _isWeb = false;
let _isElectron = false;
let _isIOS = false;
let _isCI = false;
let _locale = undefined;
let _language = (/* unused pure expression or super */ null && (LANGUAGE_DEFAULT));
let _translationsConfigFile = (/* unused pure expression or super */ null && (undefined));
let _userAgent = undefined;
const platform_globals = typeof self === 'object' ? self : typeof __webpack_require__.g === 'object' ? __webpack_require__.g : {};
let nodeProcess = undefined;
if (typeof platform_globals.vscode !== 'undefined' && typeof platform_globals.vscode.process !== 'undefined') {
// Native environment (sandboxed)
nodeProcess = platform_globals.vscode.process;
} else if (typeof process !== 'undefined') {
// Native environment (non-sandboxed)
nodeProcess = process;
}
const isElectronProcess = typeof ((_a = nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.versions) === null || _a === void 0 ? void 0 : _a.electron) === 'string';
const isElectronRenderer = isElectronProcess && (nodeProcess === null || nodeProcess === void 0 ? void 0 : nodeProcess.type) === 'renderer';
// Web environment
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;
_isWeb = true;
_locale = navigator.language;
_language = _locale;
}
// Native environment
else 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;
// VSCode's default language is 'en'
_language = resolved ? resolved : LANGUAGE_DEFAULT;
_translationsConfigFile = nlsConfig._translationsConfigFile;
} catch (e) {}
}
_isNative = true;
}
// Unknown environment
else {
console.error('Unable to resolve platform.');
}
let _platform = 0 /* Web */;
if (_isMacintosh) {
_platform = 1 /* Mac */;
} else if (_isWindows) {
_platform = 3 /* Windows */;
} else if (_isLinux) {
_platform = 2 /* Linux */;
}
const isWindows = _isWindows;
const isMacintosh = _isMacintosh;
const isLinux = (/* unused pure expression or super */ null && (_isLinux));
const isNative = (/* unused pure expression or super */ null && (_isNative));
const platform_isWeb = (/* unused pure expression or super */ null && (_isWeb));
const isWebWorker = _isWeb && typeof platform_globals.importScripts === 'function';
const isIOS = (/* unused pure expression or super */ null && (_isIOS));
const userAgent = _userAgent;
/**
* The language used for the user interface. The format of
* the string is all lower case (e.g. zh-tw for Traditional
* Chinese)
*/
const language = (/* unused pure expression or super */ null && (_language));
/**
* See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.
*
* Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay
* that browsers set when the nesting level is > 5.
*/
const setTimeout0 = (() => {
if (typeof platform_globals.postMessage === 'function' && !platform_globals.importScripts) {
let pending = [];
platform_globals.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: callback
});
platform_globals.postMessage({
vscodeScheduleAsyncWork: myId
}, '*');
};
}
return callback => setTimeout(callback);
})();
const OS = _isMacintosh || _isIOS ? 2 /* Macintosh */ : _isWindows ? 1 /* Windows */ : 3 /* Linux */;
let _isLittleEndian = true;
let _isLittleEndianComputed = false;
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;
}
const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);
const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);
const isSafari = !!(!isChrome && userAgent && userAgent.indexOf('Safari') >= 0);
const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);
const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/stopwatch.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const hasPerformanceNow = platform_globals.performance && typeof platform_globals.performance.now === 'function';
class StopWatch {
constructor(highResolution) {
this._highResolution = hasPerformanceNow && highResolution;
this._startTime = this._now();
this._stopTime = -1;
}
static create(highResolution = true) {
return new StopWatch(highResolution);
}
stop() {
this._stopTime = this._now();
}
elapsed() {
if (this._stopTime !== -1) {
return this._stopTime - this._startTime;
}
return this._now() - this._startTime;
}
_now() {
return this._highResolution ? platform_globals.performance.now() : Date.now();
}
}
;// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
// -----------------------------------------------------------------------------------------------------------------------
// Uncomment the next line to print warnings whenever an emitter with listeners is disposed. That is a sign of code smell.
// -----------------------------------------------------------------------------------------------------------------------
let _enableDisposeWithListenerWarning = false;
// _enableDisposeWithListenerWarning = Boolean("TRUE"); // causes a linter warning so that it cannot be pushed
// -----------------------------------------------------------------------------------------------------------------------
// Uncomment the next line to print warnings whenever a snapshotted event is used repeatedly without cleanup.
// See https://github.com/microsoft/vscode/issues/142851
// -----------------------------------------------------------------------------------------------------------------------
let _enableSnapshotPotentialLeakWarning = false;
var Event;
(function (Event) {
Event.None = () => lifecycle_Disposable.None;
function _addLeakageTraceLogic(options) {
if (_enableSnapshotPotentialLeakWarning) {
const {
onListenerDidAdd: origListenerDidAdd
} = options;
const stack = Stacktrace.create();
let count = 0;
options.onListenerDidAdd = () => {
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();
};
}
}
/**
* Given an event, returns another event which only fires once.
*/
function once(event) {
return (listener, thisArgs = null, disposables) => {
// we need this, in case the event fires during the listener call
let didFire = false;
let result;
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;
};
}
Event.once = once;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function map(event, map, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event(i => listener.call(thisArgs, map(i)), null, disposables), disposable);
}
Event.map = map;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function forEach(event, each, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event(i => {
each(i);
listener.call(thisArgs, i);
}, null, disposables), disposable);
}
Event.forEach = forEach;
function filter(event, filter, disposable) {
return snapshot((listener, thisArgs = null, disposables) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables), disposable);
}
Event.filter = filter;
/**
* Given an event, returns the same event but typed as `Event<void>`.
*/
function signal(event) {
return event;
}
Event.signal = signal;
function any(...events) {
return (listener, thisArgs = null, disposables) => combinedDisposable(...events.map(event => event(e => listener.call(thisArgs, e), null, disposables)));
}
Event.any = any;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function reduce(event, merge, initial, disposable) {
let output = initial;
return map(event, e => {
output = merge(output, e);
return output;
}, disposable);
}
Event.reduce = reduce;
function snapshot(event, disposable) {
let listener;
const options = {
onFirstListenerAdd() {
listener = event(emitter.fire, emitter);
},
onLastListenerRemove() {
listener.dispose();
}
};
if (!disposable) {
_addLeakageTraceLogic(options);
}
const emitter = new Emitter(options);
if (disposable) {
disposable.add(emitter);
}
return emitter.event;
}
function debounce(event, merge, delay = 100, leading = false, leakWarningThreshold, disposable) {
let subscription;
let output = undefined;
let handle = undefined;
let numDebouncedCalls = 0;
const options = {
leakWarningThreshold,
onFirstListenerAdd() {
subscription = event(cur => {
numDebouncedCalls++;
output = merge(output, cur);
if (leading && !handle) {
emitter.fire(output);
output = undefined;
}
clearTimeout(handle);
handle = setTimeout(() => {
const _output = output;
output = undefined;
handle = undefined;
if (!leading || numDebouncedCalls > 1) {
emitter.fire(_output);
}
numDebouncedCalls = 0;
}, delay);
});
},
onLastListenerRemove() {
subscription.dispose();
}
};
if (!disposable) {
_addLeakageTraceLogic(options);
}
const emitter = new Emitter(options);
if (disposable) {
disposable.add(emitter);
}
return emitter.event;
}
Event.debounce = debounce;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function latch(event, equals = (a, b) => a === b, disposable) {
let firstCall = true;
let cache;
return filter(event, value => {
const shouldEmit = firstCall || !equals(value, cache);
firstCall = false;
cache = value;
return shouldEmit;
}, disposable);
}
Event.latch = latch;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function split(event, isT, disposable) {
return [Event.filter(event, isT, disposable), Event.filter(event, e => !isT(e), disposable)];
}
Event.split = split;
/**
* *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
* event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
* returned event causes this utility to leak a listener on the original event.
*/
function buffer(event, flushAfterTimeout = false, _buffer = []) {
let buffer = _buffer.slice();
let listener = event(e => {
if (buffer) {
buffer.push(e);
} else {
emitter.fire(e);
}
});
const flush = () => {
if (buffer) {
buffer.forEach(e => emitter.fire(e));
}
buffer = null;
};
const emitter = new Emitter({
onFirstListenerAdd() {
if (!listener) {
listener = event(e => emitter.fire(e));
}
},
onFirstListenerDidAdd() {
if (buffer) {
if (flushAfterTimeout) {
setTimeout(flush);
} else {
flush();
}
}
},
onLastListenerRemove() {
if (listener) {
listener.dispose();
}
listener = null;
}
});
return emitter.event;
}
Event.buffer = buffer;
class ChainableEvent {
constructor(event) {
this.event = event;
}
map(fn) {
return new ChainableEvent(map(this.event, fn));
}
forEach(fn) {
return new ChainableEvent(forEach(this.event, fn));
}
filter(fn) {
return new ChainableEvent(filter(this.event, fn));
}
reduce(merge, initial) {
return new ChainableEvent(reduce(this.event, merge, initial));
}
latch() {
return new ChainableEvent(latch(this.event));
}
debounce(merge, delay = 100, leading = false, leakWarningThreshold) {
return new ChainableEvent(debounce(this.event, merge, delay, leading, leakWarningThreshold));
}
on(listener, thisArgs, disposables) {
return this.event(listener, thisArgs, disposables);
}
once(listener, thisArgs, disposables) {
return once(this.event)(listener, thisArgs, disposables);
}
}
/**
* @deprecated DO NOT use, this leaks memory
*/
function chain(event) {
return new ChainableEvent(event);
}
Event.chain = chain;
function fromNodeEventEmitter(emitter, eventName, map = id => id) {
const fn = (...args) => result.fire(map(...args));
const onFirstListenerAdd = () => emitter.on(eventName, fn);
const onLastListenerRemove = () => emitter.removeListener(eventName, fn);
const result = new Emitter({
onFirstListenerAdd,
onLastListenerRemove
});
return result.event;
}
Event.fromNodeEventEmitter = fromNodeEventEmitter;
function fromDOMEventEmitter(emitter, eventName, map = id => id) {
const fn = (...args) => result.fire(map(...args));
const onFirstListenerAdd = () => emitter.addEventListener(eventName, fn);
const onLastListenerRemove = () => emitter.removeEventListener(eventName, fn);
const result = new Emitter({
onFirstListenerAdd,
onLastListenerRemove
});
return result.event;
}
Event.fromDOMEventEmitter = fromDOMEventEmitter;
function toPromise(event) {
return new Promise(resolve => once(event)(resolve));
}
Event.toPromise = toPromise;
function runAndSubscribe(event, handler) {
handler(undefined);
return event(e => handler(e));
}
Event.runAndSubscribe = runAndSubscribe;
function runAndSubscribeWithStore(event, handler) {
let store = null;
function run(e) {
store === null || store === void 0 ? void 0 : store.dispose();
store = new DisposableStore();
handler(e, store);
}
run(undefined);
const disposable = event(e => run(e));
return toDisposable(() => {
disposable.dispose();
store === null || store === void 0 ? void 0 : store.dispose();
});
}
Event.runAndSubscribeWithStore = runAndSubscribeWithStore;
})(Event || (Event = {}));
class EventProfiling {
constructor(name) {
this._listenerCount = 0;
this._invocationCount = 0;
this._elapsedOverall = 0;
this._name = `${name}_${EventProfiling._idPool++}`;
}
start(listenerCount) {
this._stopWatch = new StopWatch(true);
this._listenerCount = listenerCount;
}
stop() {
if (this._stopWatch) {
const elapsed = this._stopWatch.elapsed();
this._elapsedOverall += elapsed;
this._invocationCount += 1;
console.info(`did FIRE ${this._name}: elapsed_ms: ${elapsed.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`);
this._stopWatch = undefined;
}
}
}
EventProfiling._idPool = 0;
let _globalLeakWarningThreshold = -1;
class LeakageMonitor {
constructor(customThreshold, name = Math.random().toString(18).slice(2, 5)) {
this.customThreshold = customThreshold;
this.name = name;
this._warnCountdown = 0;
}
dispose() {
if (this._stacks) {
this._stacks.clear();
}
}
check(stack, listenerCount) {
let threshold = _globalLeakWarningThreshold;
if (typeof this.customThreshold === 'number') {
threshold = this.customThreshold;
}
if (threshold <= 0 || listenerCount < threshold) {
return undefined;
}
if (!this._stacks) {
this._stacks = new Map();
}
const count = this._stacks.get(stack.value) || 0;
this._stacks.set(stack.value, count + 1);
this._warnCountdown -= 1;
if (this._warnCountdown <= 0) {
// only warn on first exceed and then every time the limit
// is exceeded by 50% again
this._warnCountdown = threshold * 0.5;
// find most frequent listener and print warning
let topStack;
let topCount = 0;
for (const [stack, count] of this._stacks) {
if (!topStack || topCount < count) {
topStack = stack;
topCount = count;
}
}
console.warn(`[${this.name}] potential listener LEAK detected, having ${listenerCount} listeners already. MOST frequent listener (${topCount}):`);
console.warn(topStack);
}
return () => {
const count = this._stacks.get(stack.value) || 0;
this._stacks.set(stack.value, count - 1);
};
}
}
class Stacktrace {
constructor(value) {
this.value = value;
}
static create() {
var _a;
return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');
}
print() {
console.warn(this.value.split('\n').slice(2).join('\n'));
}
}
class Listener {
constructor(callback, callbackThis, stack) {
this.callback = callback;
this.callbackThis = callbackThis;
this.stack = stack;
this.subscription = new SafeDisposable();
}
invoke(e) {
this.callback.call(this.callbackThis, e);
}
}
/**
* The Emitter can be used to expose an Event to the public
* to fire it from the insides.
* Sample:
class Document {
private readonly _onDidChange = new Emitter<(value:string)=>any>();
public onDidChange = this._onDidChange.event;
// getter-style
// get onDidChange(): Event<(value:string)=>any> {
// return this._onDidChange.event;
// }
private _doIt() {
//...
this._onDidChange.fire(value);
}
}
*/
class Emitter {
constructor(options) {
var _a;
this._disposed = false;
this._options = options;
this._leakageMon = _globalLeakWarningThreshold > 0 ? new LeakageMonitor(this._options && this._options.leakWarningThreshold) : undefined;
this._perfMon = ((_a = this._options) === null || _a === void 0 ? void 0 : _a._profName) ? new EventProfiling(this._options._profName) : undefined;
}
dispose() {
var _a, _b, _c, _d;
if (!this._disposed) {
this._disposed = true;
// It is bad to have listeners at the time of disposing an emitter, it is worst to have listeners keep the emitter
// alive via the reference that's embedded in their disposables. Therefore we loop over all remaining listeners and
// unset their subscriptions/disposables. Looping and blaming remaining listeners is done on next tick because the
// the following programming pattern is very popular:
//
// const someModel = this._disposables.add(new ModelObject()); // (1) create and register model
// this._disposables.add(someModel.onDidChange(() => { ... }); // (2) subscribe and register model-event listener
// ...later...
// this._disposables.dispose(); disposes (1) then (2): don't warn after (1) but after the "overall dispose" is done
if (this._listeners) {
if (_enableDisposeWithListenerWarning) {
const listeners = Array.from(this._listeners);
queueMicrotask(() => {
var _a;
for (const listener of listeners) {
if (listener.subscription.isset()) {
listener.subscription.unset();
(_a = listener.stack) === null || _a === void 0 ? void 0 : _a.print();
}
}
});
}
this._listeners.clear();
}
(_a = this._deliveryQueue) === null || _a === void 0 ? void 0 : _a.clear();
(_c = (_b = this._options) === null || _b === void 0 ? void 0 : _b.onLastListenerRemove) === null || _c === void 0 ? void 0 : _c.call(_b);
(_d = this._leakageMon) === null || _d === void 0 ? void 0 : _d.dispose();
}
}
/**
* For the public to allow to subscribe
* to events from this Emitter
*/
get event() {
if (!this._event) {
this._event = (callback, thisArgs, disposables) => {
var _a, _b, _c;
if (!this._listeners) {
this._listeners = new linkedList_LinkedList();
}
const firstListener = this._listeners.isEmpty();
if (firstListener && ((_a = this._options) === null || _a === void 0 ? void 0 : _a.onFirstListenerAdd)) {
this._options.onFirstListenerAdd(this);
}
let removeMonitor;
let stack;
if (this._leakageMon && this._listeners.size >= 30) {
// check and record this emitter for potential leakage
stack = Stacktrace.create();
removeMonitor = this._leakageMon.check(stack, this._listeners.size + 1);
}
if (_enableDisposeWithListenerWarning) {
stack = stack !== null && stack !== void 0 ? stack : Stacktrace.create();
}
const listener = new Listener(callback, thisArgs, stack);
const removeListener = this._listeners.push(listener);
if (firstListener && ((_b = this._options) === null || _b === void 0 ? void 0 : _b.onFirstListenerDidAdd)) {
this._options.onFirstListenerDidAdd(this);
}
if ((_c = this._options) === null || _c === void 0 ? void 0 : _c.onListenerDidAdd) {
this._options.onListenerDidAdd(this, callback, thisArgs);
}
const result = listener.subscription.set(() => {
if (removeMonitor) {
removeMonitor();
}
if (!this._disposed) {
removeListener();
if (this._options && this._options.onLastListenerRemove) {
const hasListeners = this._listeners && !this._listeners.isEmpty();
if (!hasListeners) {
this._options.onLastListenerRemove(this);
}
}
}
});
if (disposables instanceof DisposableStore) {
disposables.add(result);
} else if (Array.isArray(disposables)) {
disposables.push(result);
}
return result;
};
}
return this._event;
}
/**
* To be kept private to fire an event to
* subscribers
*/
fire(event) {
var _a, _b;
if (this._listeners) {
// put all [listener,event]-pairs into delivery queue
// then emit all event. an inner/nested event might be
// the driver of this
if (!this._deliveryQueue) {
this._deliveryQueue = new linkedList_LinkedList();
}
for (let listener of this._listeners) {
this._deliveryQueue.push([listener, event]);
}
// start/stop performance insight collection
(_a = this._perfMon) === null || _a === void 0 ? void 0 : _a.start(this._deliveryQueue.size);
while (this._deliveryQueue.size > 0) {
const [listener, event] = this._deliveryQueue.shift();
try {
listener.invoke(event);
} catch (e) {
onUnexpectedError(e);
}
}
(_b = this._perfMon) === null || _b === void 0 ? void 0 : _b.stop();
}
}
}
class PauseableEmitter extends (/* unused pure expression or super */ null && (Emitter)) {
constructor(options) {
super(options);
this._isPaused = 0;
this._eventQueue = new LinkedList();
this._mergeFn = options === null || options === void 0 ? void 0 : options.merge;
}
pause() {
this._isPaused++;
}
resume() {
if (this._isPaused !== 0 && --this._isPaused === 0) {
if (this._mergeFn) {
// use the merge function to create a single composite
// event. make a copy in case firing pauses this emitter
const events = Array.from(this._eventQueue);
this._eventQueue.clear();
super.fire(this._mergeFn(events));
} else {
// no merging, fire each event individually and test
// that this emitter isn't paused halfway through
while (!this._isPaused && this._eventQueue.size !== 0) {
super.fire(this._eventQueue.shift());
}
}
}
}
fire(event) {
if (this._listeners) {
if (this._isPaused !== 0) {
this._eventQueue.push(event);
} else {
super.fire(event);
}
}
}
}
class DebounceEmitter extends (/* unused pure expression or super */ null && (PauseableEmitter)) {
constructor(options) {
var _a;
super(options);
this._delay = (_a = options.delay) !== null && _a !== void 0 ? _a : 100;
}
fire(event) {
if (!this._handle) {
this.pause();
this._handle = setTimeout(() => {
this._handle = undefined;
this.resume();
}, this._delay);
}
super.fire(event);
}
}
/**
* The EventBufferer is useful in situations in which you want
* to delay firing your events during some code.
* You can wrap that code and be sure that the event will not
* be fired during that wrap.
*
* ```
* const emitter: Emitter;
* const delayer = new EventDelayer();
* const delayedEvent = delayer.wrapEvent(emitter.event);
*
* delayedEvent(console.log);
*
* delayer.bufferEvents(() => {
* emitter.fire(); // event will not be fired yet
* });
*
* // event will only be fired at this point
* ```
*/
class EventBufferer {
constructor() {
this.buffers = [];
}
wrapEvent(event) {
return (listener, thisArgs, disposables) => {
return event(i => {
const buffer = this.buffers[this.buffers.length - 1];
if (buffer) {
buffer.push(() => listener.call(thisArgs, i));
} else {