module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // object to store loaded chunks
/******/ // "0" means "already loaded"
/******/ var installedChunks = {
/******/ 0: 0
/******/ };
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
/******/ var promises = [];
/******/
/******/
/******/ // require() chunk loading for javascript
/******/
/******/ // "0" is the signal for "already loaded"
/******/ if(installedChunks[chunkId] !== 0) {
/******/ var chunk = require("./" + ({}[chunkId]||chunkId) + "." + {"1":"5192e944","2":"bb4583ed","3":"36d3628e"}[chunkId] + ".js");
/******/ var moreModules = chunk.modules, chunkIds = chunk.ids;
/******/ for(var moduleId in moreModules) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ for(var i = 0; i < chunkIds.length; i++)
/******/ installedChunks[chunkIds[i]] = 0;
/******/ }
/******/ return Promise.all(promises);
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/ // uncaught error handler for webpack runtime
/******/ __webpack_require__.oe = function(err) {
/******/ process.nextTick(function() {
/******/ throw err; // catch this error by using import().catch()
/******/ });
/******/ };
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 763);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export MDXContext */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MDXProvider; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createElement; });
/* unused harmony export useMDXComponents */
/* unused harmony export withMDXComponents */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
var isFunction = function isFunction(obj) {
return typeof obj === 'function';
};
var MDXContext = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext({});
var withMDXComponents = function withMDXComponents(Component) {
return function (props) {
var allComponents = useMDXComponents(props.components);
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Component, _extends({}, props, {
components: allComponents
}));
};
};
var useMDXComponents = function useMDXComponents(components) {
var contextComponents = react__WEBPACK_IMPORTED_MODULE_0___default.a.useContext(MDXContext);
var allComponents = contextComponents;
if (components) {
allComponents = isFunction(components) ? components(contextComponents) : _objectSpread2({}, contextComponents, {}, components);
}
return allComponents;
};
var MDXProvider = function MDXProvider(props) {
var allComponents = useMDXComponents(props.components);
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(MDXContext.Provider, {
value: allComponents
}, props.children);
};
var TYPE_PROP_NAME = 'mdxType';
var DEFAULTS = {
inlineCode: 'code',
wrapper: function wrapper(_ref) {
var children = _ref.children;
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, {}, children);
}
};
var MDXCreateElement = Object(react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])(function (props, ref) {
var propComponents = props.components,
mdxType = props.mdxType,
originalType = props.originalType,
parentName = props.parentName,
etc = _objectWithoutProperties(props, ["components", "mdxType", "originalType", "parentName"]);
var components = useMDXComponents(propComponents);
var type = mdxType;
var Component = components["".concat(parentName, ".").concat(type)] || components[type] || DEFAULTS[type] || originalType;
if (propComponents) {
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Component, _objectSpread2({
ref: ref
}, etc, {
components: propComponents
}));
}
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Component, _objectSpread2({
ref: ref
}, etc));
});
MDXCreateElement.displayName = 'MDXCreateElement';
function createElement (type, props) {
var args = arguments;
var mdxType = props && props.mdxType;
if (typeof type === 'string' || mdxType) {
var argsLength = args.length;
var createElementArgArray = new Array(argsLength);
createElementArgArray[0] = MDXCreateElement;
var newProps = {};
for (var key in props) {
if (hasOwnProperty.call(props, key)) {
newProps[key] = props[key];
}
}
newProps.originalType = type;
newProps[TYPE_PROP_NAME] = typeof type === 'string' ? type : mdxType;
createElementArgArray[1] = newProps;
for (var i = 2; i < argsLength; i++) {
createElementArgArray[i] = args[i];
}
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement.apply(null, createElementArgArray);
}
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement.apply(null, args);
}
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return localize; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function _format(message, args) {
var result;
if (args.length === 0) {
result = message;
}
else {
result = message.replace(/\{(\d+)\}/g, function (match, rest) {
var index = rest[0];
return typeof args[index] !== 'undefined' ? args[index] : match;
});
}
return result;
}
function localize(data, message) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
return _format(message, args);
}
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return clearNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return removeNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return isInDOM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return hasClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return addClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return addClasses; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return removeClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return removeClasses; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return toggleClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return addDisposableListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return addStandardDisposableListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return addStandardDisposableGenericMouseDownListner; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return addDisposableGenericMouseDownListner; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return addDisposableGenericMouseUpListner; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return addDisposableNonBubblingMouseOutListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return addDisposableNonBubblingPointerOutListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return runAtThisOrScheduleAtNextAnimationFrame; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return scheduleAtNextAnimationFrame; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return addDisposableThrottledListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getComputedStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return getClientArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Dimension; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return getTopLeftOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return getDomNodePagePosition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return StandardWindow; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return getTotalWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return getContentWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return getContentHeight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return getTotalHeight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return isAncestor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return findParentWithClass; });
/* unused harmony export isShadowRoot */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return isInShadowDOM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return getShadowRoot; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return createStyleSheet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return createCSSRule; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return removeCSSRulesContainingSelector; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return isHTMLElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return EventType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return EventHelper; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return saveParentsScrollTop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return restoreParentsScrollTop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return trackFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return append; });
/* unused harmony export Namespace */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return $; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return show; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return hide; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return removeTabIndexAndUpdateFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return getElementsByTagName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return computeScreenAwareSize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return windowOpenNoOpener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return animate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return asDomUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return asCSSUrl; });
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var _event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34);
/* harmony import */ var _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(53);
/* harmony import */ var _mouseEvent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(46);
/* harmony import */ var _common_async_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(20);
/* harmony import */ var _common_errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16);
/* harmony import */ var _common_event_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(17);
/* harmony import */ var _common_arrays_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(18);
/* harmony import */ var _common_network_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(37);
/* harmony import */ var _canIUse_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(120);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function clearNode(node) {
while (node.firstChild) {
node.removeChild(node.firstChild);
}
}
function removeNode(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function isInDOM(node) {
while (node) {
if (node === document.body) {
return true;
}
node = node.parentNode || node.host;
}
return false;
}
var _manualClassList = new /** @class */ (function () {
function class_1() {
this._lastStart = -1;
this._lastEnd = -1;
}
class_1.prototype._findClassName = function (node, className) {
var classes = node.className;
if (!classes) {
this._lastStart = -1;
return;
}
className = className.trim();
var classesLen = classes.length, classLen = className.length;
if (classLen === 0) {
this._lastStart = -1;
return;
}
if (classesLen < classLen) {
this._lastStart = -1;
return;
}
if (classes === className) {
this._lastStart = 0;
this._lastEnd = classesLen;
return;
}
var idx = -1, idxEnd;
while ((idx = classes.indexOf(className, idx + 1)) >= 0) {
idxEnd = idx + classLen;
// a class that is followed by another class
if ((idx === 0 || classes.charCodeAt(idx - 1) === 32 /* Space */) && classes.charCodeAt(idxEnd) === 32 /* Space */) {
this._lastStart = idx;
this._lastEnd = idxEnd + 1;
return;
}
// last class
if (idx > 0 && classes.charCodeAt(idx - 1) === 32 /* Space */ && idxEnd === classesLen) {
this._lastStart = idx - 1;
this._lastEnd = idxEnd;
return;
}
// equal - duplicate of cmp above
if (idx === 0 && idxEnd === classesLen) {
this._lastStart = 0;
this._lastEnd = idxEnd;
return;
}
}
this._lastStart = -1;
};
class_1.prototype.hasClass = function (node, className) {
this._findClassName(node, className);
return this._lastStart !== -1;
};
class_1.prototype.addClasses = function (node) {
var _this = this;
var classNames = [];
for (var _i = 1; _i < arguments.length; _i++) {
classNames[_i - 1] = arguments[_i];
}
classNames.forEach(function (nameValue) { return nameValue.split(' ').forEach(function (name) { return _this.addClass(node, name); }); });
};
class_1.prototype.addClass = function (node, className) {
if (!node.className) { // doesn't have it for sure
node.className = className;
}
else {
this._findClassName(node, className); // see if it's already there
if (this._lastStart === -1) {
node.className = node.className + ' ' + className;
}
}
};
class_1.prototype.removeClass = function (node, className) {
this._findClassName(node, className);
if (this._lastStart === -1) {
return; // Prevent styles invalidation if not necessary
}
else {
node.className = node.className.substring(0, this._lastStart) + node.className.substring(this._lastEnd);
}
};
class_1.prototype.removeClasses = function (node) {
var _this = this;
var classNames = [];
for (var _i = 1; _i < arguments.length; _i++) {
classNames[_i - 1] = arguments[_i];
}
classNames.forEach(function (nameValue) { return nameValue.split(' ').forEach(function (name) { return _this.removeClass(node, name); }); });
};
class_1.prototype.toggleClass = function (node, className, shouldHaveIt) {
this._findClassName(node, className);
if (this._lastStart !== -1 && (shouldHaveIt === undefined || !shouldHaveIt)) {
this.removeClass(node, className);
}
if (this._lastStart === -1 && (shouldHaveIt === undefined || shouldHaveIt)) {
this.addClass(node, className);
}
};
return class_1;
}());
var _nativeClassList = new /** @class */ (function () {
function class_2() {
}
class_2.prototype.hasClass = function (node, className) {
return Boolean(className) && node.classList && node.classList.contains(className);
};
class_2.prototype.addClasses = function (node) {
var _this = this;
var classNames = [];
for (var _i = 1; _i < arguments.length; _i++) {
classNames[_i - 1] = arguments[_i];
}
classNames.forEach(function (nameValue) { return nameValue.split(' ').forEach(function (name) { return _this.addClass(node, name); }); });
};
class_2.prototype.addClass = function (node, className) {
if (className && node.classList) {
node.classList.add(className);
}
};
class_2.prototype.removeClass = function (node, className) {
if (className && node.classList) {
node.classList.remove(className);
}
};
class_2.prototype.removeClasses = function (node) {
var _this = this;
var classNames = [];
for (var _i = 1; _i < arguments.length; _i++) {
classNames[_i - 1] = arguments[_i];
}
classNames.forEach(function (nameValue) { return nameValue.split(' ').forEach(function (name) { return _this.removeClass(node, name); }); });
};
class_2.prototype.toggleClass = function (node, className, shouldHaveIt) {
if (node.classList) {
node.classList.toggle(className, shouldHaveIt);
}
};
return class_2;
}());
// In IE11 there is only partial support for `classList` which makes us keep our
// custom implementation. Otherwise use the native implementation, see: http://caniuse.com/#search=classlist
var _classList = _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isIE */ "i"] ? _manualClassList : _nativeClassList;
var hasClass = _classList.hasClass.bind(_classList);
var addClass = _classList.addClass.bind(_classList);
var addClasses = _classList.addClasses.bind(_classList);
var removeClass = _classList.removeClass.bind(_classList);
var removeClasses = _classList.removeClasses.bind(_classList);
var toggleClass = _classList.toggleClass.bind(_classList);
var DomListener = /** @class */ (function () {
function DomListener(node, type, handler, options) {
this._node = node;
this._type = type;
this._handler = handler;
this._options = (options || false);
this._node.addEventListener(this._type, this._handler, this._options);
}
DomListener.prototype.dispose = function () {
if (!this._handler) {
// Already disposed
return;
}
this._node.removeEventListener(this._type, this._handler, this._options);
// Prevent leakers from holding on to the dom or handler func
this._node = null;
this._handler = null;
};
return DomListener;
}());
function addDisposableListener(node, type, handler, useCaptureOrOptions) {
return new DomListener(node, type, handler, useCaptureOrOptions);
}
function _wrapAsStandardMouseEvent(handler) {
return function (e) {
return handler(new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_3__[/* StandardMouseEvent */ "b"](e));
};
}
function _wrapAsStandardKeyboardEvent(handler) {
return function (e) {
return handler(new _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_2__[/* StandardKeyboardEvent */ "a"](e));
};
}
var addStandardDisposableListener = function addStandardDisposableListener(node, type, handler, useCapture) {
var wrapHandler = handler;
if (type === 'click' || type === 'mousedown') {
wrapHandler = _wrapAsStandardMouseEvent(handler);
}
else if (type === 'keydown' || type === 'keypress' || type === 'keyup') {
wrapHandler = _wrapAsStandardKeyboardEvent(handler);
}
return addDisposableListener(node, type, wrapHandler, useCapture);
};
var addStandardDisposableGenericMouseDownListner = function addStandardDisposableListener(node, handler, useCapture) {
var wrapHandler = _wrapAsStandardMouseEvent(handler);
return addDisposableGenericMouseDownListner(node, wrapHandler, useCapture);
};
function addDisposableGenericMouseDownListner(node, handler, useCapture) {
return addDisposableListener(node, _common_platform_js__WEBPACK_IMPORTED_MODULE_8__[/* isIOS */ "c"] && _canIUse_js__WEBPACK_IMPORTED_MODULE_11__[/* BrowserFeatures */ "a"].pointerEvents ? EventType.POINTER_DOWN : EventType.MOUSE_DOWN, handler, useCapture);
}
function addDisposableGenericMouseUpListner(node, handler, useCapture) {
return addDisposableListener(node, _common_platform_js__WEBPACK_IMPORTED_MODULE_8__[/* isIOS */ "c"] && _canIUse_js__WEBPACK_IMPORTED_MODULE_11__[/* BrowserFeatures */ "a"].pointerEvents ? EventType.POINTER_UP : EventType.MOUSE_UP, handler, useCapture);
}
function addDisposableNonBubblingMouseOutListener(node, handler) {
return addDisposableListener(node, 'mouseout', function (e) {
// Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
var toElement = (e.relatedTarget);
while (toElement && toElement !== node) {
toElement = toElement.parentNode;
}
if (toElement === node) {
return;
}
handler(e);
});
}
function addDisposableNonBubblingPointerOutListener(node, handler) {
return addDisposableListener(node, 'pointerout', function (e) {
// Mouse out bubbles, so this is an attempt to ignore faux mouse outs coming from children elements
var toElement = (e.relatedTarget);
while (toElement && toElement !== node) {
toElement = toElement.parentNode;
}
if (toElement === node) {
return;
}
handler(e);
});
}
var _animationFrame = null;
function doRequestAnimationFrame(callback) {
if (!_animationFrame) {
var emulatedRequestAnimationFrame = function (callback) {
return setTimeout(function () { return callback(new Date().getTime()); }, 0);
};
_animationFrame = (self.requestAnimationFrame
|| self.msRequestAnimationFrame
|| self.webkitRequestAnimationFrame
|| self.mozRequestAnimationFrame
|| self.oRequestAnimationFrame
|| emulatedRequestAnimationFrame);
}
return _animationFrame.call(self, callback);
}
/**
* Schedule a callback to be run at the next animation frame.
* This allows multiple parties to register callbacks that should run at the next animation frame.
* If currently in an animation frame, `runner` will be executed immediately.
* @return token that can be used to cancel the scheduled runner (only if `runner` was not executed immediately).
*/
var runAtThisOrScheduleAtNextAnimationFrame;
/**
* Schedule a callback to be run at the next animation frame.
* This allows multiple parties to register callbacks that should run at the next animation frame.
* If currently in an animation frame, `runner` will be executed at the next animation frame.
* @return token that can be used to cancel the scheduled runner.
*/
var scheduleAtNextAnimationFrame;
var AnimationFrameQueueItem = /** @class */ (function () {
function AnimationFrameQueueItem(runner, priority) {
if (priority === void 0) { priority = 0; }
this._runner = runner;
this.priority = priority;
this._canceled = false;
}
AnimationFrameQueueItem.prototype.dispose = function () {
this._canceled = true;
};
AnimationFrameQueueItem.prototype.execute = function () {
if (this._canceled) {
return;
}
try {
this._runner();
}
catch (e) {
Object(_common_errors_js__WEBPACK_IMPORTED_MODULE_5__[/* onUnexpectedError */ "e"])(e);
}
};
// Sort by priority (largest to lowest)
AnimationFrameQueueItem.sort = function (a, b) {
return b.priority - a.priority;
};
return AnimationFrameQueueItem;
}());
(function () {
/**
* The runners scheduled at the next animation frame
*/
var NEXT_QUEUE = [];
/**
* The runners scheduled at the current animation frame
*/
var CURRENT_QUEUE = null;
/**
* A flag to keep track if the native requestAnimationFrame was already called
*/
var animFrameRequested = false;
/**
* A flag to indicate if currently handling a native requestAnimationFrame callback
*/
var inAnimationFrameRunner = false;
var animationFrameRunner = function () {
animFrameRequested = false;
CURRENT_QUEUE = NEXT_QUEUE;
NEXT_QUEUE = [];
inAnimationFrameRunner = true;
while (CURRENT_QUEUE.length > 0) {
CURRENT_QUEUE.sort(AnimationFrameQueueItem.sort);
var top_1 = CURRENT_QUEUE.shift();
top_1.execute();
}
inAnimationFrameRunner = false;
};
scheduleAtNextAnimationFrame = function (runner, priority) {
if (priority === void 0) { priority = 0; }
var item = new AnimationFrameQueueItem(runner, priority);
NEXT_QUEUE.push(item);
if (!animFrameRequested) {
animFrameRequested = true;
doRequestAnimationFrame(animationFrameRunner);
}
return item;
};
runAtThisOrScheduleAtNextAnimationFrame = function (runner, priority) {
if (inAnimationFrameRunner) {
var item = new AnimationFrameQueueItem(runner, priority);
CURRENT_QUEUE.push(item);
return item;
}
else {
return scheduleAtNextAnimationFrame(runner, priority);
}
};
})();
var MINIMUM_TIME_MS = 16;
var DEFAULT_EVENT_MERGER = function (lastEvent, currentEvent) {
return currentEvent;
};
var TimeoutThrottledDomListener = /** @class */ (function (_super) {
__extends(TimeoutThrottledDomListener, _super);
function TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs) {
if (eventMerger === void 0) { eventMerger = DEFAULT_EVENT_MERGER; }
if (minimumTimeMs === void 0) { minimumTimeMs = MINIMUM_TIME_MS; }
var _this = _super.call(this) || this;
var lastEvent = null;
var lastHandlerTime = 0;
var timeout = _this._register(new _common_async_js__WEBPACK_IMPORTED_MODULE_4__[/* TimeoutTimer */ "e"]());
var invokeHandler = function () {
lastHandlerTime = (new Date()).getTime();
handler(lastEvent);
lastEvent = null;
};
_this._register(addDisposableListener(node, type, function (e) {
lastEvent = eventMerger(lastEvent, e);
var elapsedTime = (new Date()).getTime() - lastHandlerTime;
if (elapsedTime >= minimumTimeMs) {
timeout.cancel();
invokeHandler();
}
else {
timeout.setIfNotSet(invokeHandler, minimumTimeMs - elapsedTime);
}
}));
return _this;
}
return TimeoutThrottledDomListener;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_7__[/* Disposable */ "a"]));
function addDisposableThrottledListener(node, type, handler, eventMerger, minimumTimeMs) {
return new TimeoutThrottledDomListener(node, type, handler, eventMerger, minimumTimeMs);
}
function getComputedStyle(el) {
return document.defaultView.getComputedStyle(el, null);
}
function getClientArea(element) {
// Try with DOM clientWidth / clientHeight
if (element !== document.body) {
return new Dimension(element.clientWidth, element.clientHeight);
}
// If visual view port exits and it's on mobile, it should be used instead of window innerWidth / innerHeight, or document.body.clientWidth / document.body.clientHeight
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_8__[/* isIOS */ "c"] && window.visualViewport) {
var width = window.visualViewport.width;
var height = window.visualViewport.height - (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isStandalone */ "l"]
// in PWA mode, the visual viewport always includes the safe-area-inset-bottom (which is for the home indicator)
// even when you are using the onscreen monitor, the visual viewport will include the area between system statusbar and the onscreen keyboard
// plus the area between onscreen keyboard and the bottom bezel, which is 20px on iOS.
? (20 + 4) // + 4px for body margin
: 0);
return new Dimension(width, height);
}
// Try innerWidth / innerHeight
if (window.innerWidth && window.innerHeight) {
return new Dimension(window.innerWidth, window.innerHeight);
}
// Try with document.body.clientWidth / document.body.clientHeight
if (document.body && document.body.clientWidth && document.body.clientHeight) {
return new Dimension(document.body.clientWidth, document.body.clientHeight);
}
// Try with document.documentElement.clientWidth / document.documentElement.clientHeight
if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight) {
return new Dimension(document.documentElement.clientWidth, document.documentElement.clientHeight);
}
throw new Error('Unable to figure out browser width and height');
}
var SizeUtils = /** @class */ (function () {
function SizeUtils() {
}
// Adapted from WinJS
// Converts a CSS positioning string for the specified element to pixels.
SizeUtils.convertToPixels = function (element, value) {
return parseFloat(value) || 0;
};
SizeUtils.getDimension = function (element, cssPropertyName, jsPropertyName) {
var computedStyle = getComputedStyle(element);
var value = '0';
if (computedStyle) {
if (computedStyle.getPropertyValue) {
value = computedStyle.getPropertyValue(cssPropertyName);
}
else {
// IE8
value = computedStyle.getAttribute(jsPropertyName);
}
}
return SizeUtils.convertToPixels(element, value);
};
SizeUtils.getBorderLeftWidth = function (element) {
return SizeUtils.getDimension(element, 'border-left-width', 'borderLeftWidth');
};
SizeUtils.getBorderRightWidth = function (element) {
return SizeUtils.getDimension(element, 'border-right-width', 'borderRightWidth');
};
SizeUtils.getBorderTopWidth = function (element) {
return SizeUtils.getDimension(element, 'border-top-width', 'borderTopWidth');
};
SizeUtils.getBorderBottomWidth = function (element) {
return SizeUtils.getDimension(element, 'border-bottom-width', 'borderBottomWidth');
};
SizeUtils.getPaddingLeft = function (element) {
return SizeUtils.getDimension(element, 'padding-left', 'paddingLeft');
};
SizeUtils.getPaddingRight = function (element) {
return SizeUtils.getDimension(element, 'padding-right', 'paddingRight');
};
SizeUtils.getPaddingTop = function (element) {
return SizeUtils.getDimension(element, 'padding-top', 'paddingTop');
};
SizeUtils.getPaddingBottom = function (element) {
return SizeUtils.getDimension(element, 'padding-bottom', 'paddingBottom');
};
SizeUtils.getMarginLeft = function (element) {
return SizeUtils.getDimension(element, 'margin-left', 'marginLeft');
};
SizeUtils.getMarginTop = function (element) {
return SizeUtils.getDimension(element, 'margin-top', 'marginTop');
};
SizeUtils.getMarginRight = function (element) {
return SizeUtils.getDimension(element, 'margin-right', 'marginRight');
};
SizeUtils.getMarginBottom = function (element) {
return SizeUtils.getDimension(element, 'margin-bottom', 'marginBottom');
};
return SizeUtils;
}());
// ----------------------------------------------------------------------------------------
// Position & Dimension
var Dimension = /** @class */ (function () {
function Dimension(width, height) {
this.width = width;
this.height = height;
}
return Dimension;
}());
function getTopLeftOffset(element) {
// Adapted from WinJS.Utilities.getPosition
// and added borders to the mix
var offsetParent = element.offsetParent;
var top = element.offsetTop;
var left = element.offsetLeft;
while ((element = element.parentNode) !== null
&& element !== document.body
&& element !== document.documentElement) {
top -= element.scrollTop;
var 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: left,
top: top
};
}
/**
* Returns the position of a dom node relative to the entire page.
*/
function getDomNodePagePosition(domNode) {
var bb = domNode.getBoundingClientRect();
return {
left: bb.left + StandardWindow.scrollX,
top: bb.top + StandardWindow.scrollY,
width: bb.width,
height: bb.height
};
}
var StandardWindow = new /** @class */ (function () {
function class_3() {
}
Object.defineProperty(class_3.prototype, "scrollX", {
get: function () {
if (typeof window.scrollX === 'number') {
// modern browsers
return window.scrollX;
}
else {
return document.body.scrollLeft + document.documentElement.scrollLeft;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(class_3.prototype, "scrollY", {
get: function () {
if (typeof window.scrollY === 'number') {
// modern browsers
return window.scrollY;
}
else {
return document.body.scrollTop + document.documentElement.scrollTop;
}
},
enumerable: true,
configurable: true
});
return class_3;
}());
// Adapted from WinJS
// Gets the width of the element, including margins.
function getTotalWidth(element) {
var margin = SizeUtils.getMarginLeft(element) + SizeUtils.getMarginRight(element);
return element.offsetWidth + margin;
}
function getContentWidth(element) {
var border = SizeUtils.getBorderLeftWidth(element) + SizeUtils.getBorderRightWidth(element);
var padding = SizeUtils.getPaddingLeft(element) + SizeUtils.getPaddingRight(element);
return element.offsetWidth - border - padding;
}
// Adapted from WinJS
// Gets the height of the content of the specified element. The content height does not include borders or padding.
function getContentHeight(element) {
var border = SizeUtils.getBorderTopWidth(element) + SizeUtils.getBorderBottomWidth(element);
var padding = SizeUtils.getPaddingTop(element) + SizeUtils.getPaddingBottom(element);
return element.offsetHeight - border - padding;
}
// Adapted from WinJS
// Gets the height of the element, including its margins.
function getTotalHeight(element) {
var margin = SizeUtils.getMarginTop(element) + SizeUtils.getMarginBottom(element);
return element.offsetHeight + margin;
}
// ----------------------------------------------------------------------------------------
function isAncestor(testChild, testAncestor) {
while (testChild) {
if (testChild === testAncestor) {
return true;
}
testChild = testChild.parentNode;
}
return false;
}
function findParentWithClass(node, clazz, stopAtClazzOrNode) {
while (node && node.nodeType === node.ELEMENT_NODE) {
if (hasClass(node, clazz)) {
return node;
}
if (stopAtClazzOrNode) {
if (typeof stopAtClazzOrNode === 'string') {
if (hasClass(node, stopAtClazzOrNode)) {
return null;
}
}
else {
if (node === stopAtClazzOrNode) {
return null;
}
}
}
node = node.parentNode;
}
return null;
}
function isShadowRoot(node) {
return (node && !!node.host && !!node.mode);
}
function isInShadowDOM(domNode) {
return !!getShadowRoot(domNode);
}
function getShadowRoot(domNode) {
while (domNode.parentNode) {
if (domNode === document.body) {
// reached the body
return null;
}
domNode = domNode.parentNode;
}
return isShadowRoot(domNode) ? domNode : null;
}
function createStyleSheet(container) {
if (container === void 0) { container = document.getElementsByTagName('head')[0]; }
var style = document.createElement('style');
style.type = 'text/css';
style.media = 'screen';
container.appendChild(style);
return style;
}
var _sharedStyleSheet = null;
function getSharedStyleSheet() {
if (!_sharedStyleSheet) {
_sharedStyleSheet = createStyleSheet();
}
return _sharedStyleSheet;
}
function getDynamicStyleSheetRules(style) {
if (style && style.sheet && style.sheet.rules) {
// Chrome, IE
return style.sheet.rules;
}
if (style && style.sheet && style.sheet.cssRules) {
// FF
return style.sheet.cssRules;
}
return [];
}
function createCSSRule(selector, cssText, style) {
if (style === void 0) { style = getSharedStyleSheet(); }
if (!style || !cssText) {
return;
}
style.sheet.insertRule(selector + '{' + cssText + '}', 0);
}
function removeCSSRulesContainingSelector(ruleName, style) {
if (style === void 0) { style = getSharedStyleSheet(); }
if (!style) {
return;
}
var rules = getDynamicStyleSheetRules(style);
var toDelete = [];
for (var i = 0; i < rules.length; i++) {
var rule = rules[i];
if (rule.selectorText.indexOf(ruleName) !== -1) {
toDelete.push(i);
}
}
for (var i = toDelete.length - 1; i >= 0; i--) {
style.sheet.deleteRule(toDelete[i]);
}
}
function isHTMLElement(o) {
if (typeof HTMLElement === 'object') {
return o instanceof HTMLElement;
}
return o && typeof o === 'object' && o.nodeType === 1 && typeof o.nodeName === 'string';
}
var EventType = {
// Mouse
CLICK: 'click',
DBLCLICK: 'dblclick',
MOUSE_UP: 'mouseup',
MOUSE_DOWN: 'mousedown',
MOUSE_OVER: 'mouseover',
MOUSE_MOVE: 'mousemove',
MOUSE_OUT: 'mouseout',
MOUSE_ENTER: 'mouseenter',
MOUSE_LEAVE: 'mouseleave',
POINTER_UP: 'pointerup',
POINTER_DOWN: 'pointerdown',
POINTER_MOVE: 'pointermove',
CONTEXT_MENU: 'contextmenu',
WHEEL: 'wheel',
// Keyboard
KEY_DOWN: 'keydown',
KEY_PRESS: 'keypress',
KEY_UP: 'keyup',
// HTML Document
LOAD: 'load',
BEFORE_UNLOAD: 'beforeunload',
UNLOAD: 'unload',
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: _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isWebKit */ "m"] ? 'webkitAnimationStart' : 'animationstart',
ANIMATION_END: _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isWebKit */ "m"] ? 'webkitAnimationEnd' : 'animationend',
ANIMATION_ITERATION: _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isWebKit */ "m"] ? 'webkitAnimationIteration' : 'animationiteration'
};
var EventHelper = {
stop: function (e, cancelBubble) {
if (e.preventDefault) {
e.preventDefault();
}
else {
// IE8
e.returnValue = false;
}
if (cancelBubble) {
if (e.stopPropagation) {
e.stopPropagation();
}
else {
// IE8
e.cancelBubble = true;
}
}
}
};
function saveParentsScrollTop(node) {
var r = [];
for (var i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
r[i] = node.scrollTop;
node = node.parentNode;
}
return r;
}
function restoreParentsScrollTop(node, state) {
for (var i = 0; node && node.nodeType === node.ELEMENT_NODE; i++) {
if (node.scrollTop !== state[i]) {
node.scrollTop = state[i];
}
node = node.parentNode;
}
}
var FocusTracker = /** @class */ (function (_super) {
__extends(FocusTracker, _super);
function FocusTracker(element) {
var _this = _super.call(this) || this;
_this._onDidFocus = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_6__[/* Emitter */ "a"]());
_this.onDidFocus = _this._onDidFocus.event;
_this._onDidBlur = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_6__[/* Emitter */ "a"]());
_this.onDidBlur = _this._onDidBlur.event;
var hasFocus = isAncestor(document.activeElement, element);
var loosingFocus = false;
var onFocus = function () {
loosingFocus = false;
if (!hasFocus) {
hasFocus = true;
_this._onDidFocus.fire();
}
};
var onBlur = function () {
if (hasFocus) {
loosingFocus = true;
window.setTimeout(function () {
if (loosingFocus) {
loosingFocus = false;
hasFocus = false;
_this._onDidBlur.fire();
}
}, 0);
}
};
_this._refreshStateHandler = function () {
var currentNodeHasFocus = isAncestor(document.activeElement, element);
if (currentNodeHasFocus !== hasFocus) {
if (hasFocus) {
onBlur();
}
else {
onFocus();
}
}
};
_this._register(Object(_event_js__WEBPACK_IMPORTED_MODULE_1__[/* domEvent */ "a"])(element, EventType.FOCUS, true)(onFocus));
_this._register(Object(_event_js__WEBPACK_IMPORTED_MODULE_1__[/* domEvent */ "a"])(element, EventType.BLUR, true)(onBlur));
return _this;
}
return FocusTracker;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_7__[/* Disposable */ "a"]));
function trackFocus(element) {
return new FocusTracker(element);
}
function append(parent) {
var children = [];
for (var _i = 1; _i < arguments.length; _i++) {
children[_i - 1] = arguments[_i];
}
children.forEach(function (child) { return parent.appendChild(child); });
return children[children.length - 1];
}
var SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((.([\w\-]+))*)/;
var Namespace;
(function (Namespace) {
Namespace["HTML"] = "http://www.w3.org/1999/xhtml";
Namespace["SVG"] = "http://www.w3.org/2000/svg";
})(Namespace || (Namespace = {}));
function _$(namespace, description, attrs) {
var children = [];
for (var _i = 3; _i < arguments.length; _i++) {
children[_i - 3] = arguments[_i];
}
var match = SELECTOR_REGEX.exec(description);
if (!match) {
throw new Error('Bad use of emmet');
}
attrs = __assign({}, (attrs || {}));
var tagName = match[1] || 'div';
var result;
if (namespace !== Namespace.HTML) {
result = document.createElementNS(namespace, tagName);
}
else {
result = document.createElement(tagName);
}
if (match[3]) {
result.id = match[3];
}
if (match[4]) {
result.className = match[4].replace(/\./g, ' ').trim();
}
Object.keys(attrs).forEach(function (name) {
var value = attrs[name];
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);
}
});
Object(_common_arrays_js__WEBPACK_IMPORTED_MODULE_9__[/* coalesce */ "d"])(children)
.forEach(function (child) {
if (child instanceof Node) {
result.appendChild(child);
}
else {
result.appendChild(document.createTextNode(child));
}
});
return result;
}
function $(description, attrs) {
var children = [];
for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments[_i];
}
return _$.apply(void 0, __spreadArrays([Namespace.HTML, description, attrs], children));
}
$.SVG = function (description, attrs) {
var children = [];
for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments[_i];
}
return _$.apply(void 0, __spreadArrays([Namespace.SVG, description, attrs], children));
};
function show() {
var elements = [];
for (var _i = 0; _i < arguments.length; _i++) {
elements[_i] = arguments[_i];
}
for (var _a = 0, elements_1 = elements; _a < elements_1.length; _a++) {
var element = elements_1[_a];
element.style.display = '';
element.removeAttribute('aria-hidden');
}
}
function hide() {
var elements = [];
for (var _i = 0; _i < arguments.length; _i++) {
elements[_i] = arguments[_i];
}
for (var _a = 0, elements_2 = elements; _a < elements_2.length; _a++) {
var element = elements_2[_a];
element.style.display = 'none';
element.setAttribute('aria-hidden', 'true');
}
}
function findParentWithAttribute(node, attribute) {
while (node && node.nodeType === node.ELEMENT_NODE) {
if (node instanceof HTMLElement && node.hasAttribute(attribute)) {
return node;
}
node = node.parentNode;
}
return null;
}
function removeTabIndexAndUpdateFocus(node) {
if (!node || !node.hasAttribute('tabIndex')) {
return;
}
// If we are the currently focused element and tabIndex is removed,
// standard DOM behavior is to move focus to the element. We
// typically never want that, rather put focus to the closest element
// in the hierarchy of the parent DOM nodes.
if (document.activeElement === node) {
var parentFocusable = findParentWithAttribute(node.parentElement, 'tabIndex');
if (parentFocusable) {
parentFocusable.focus();
}
}
node.removeAttribute('tabindex');
}
function getElementsByTagName(tag) {
return Array.prototype.slice.call(document.getElementsByTagName(tag), 0);
}
/**
* Find a value usable for a dom node size such that the likelihood that it would be
* displayed with constant screen pixels size is as high as possible.
*
* e.g. We would desire for the cursors to be 2px (CSS px) wide. Under a devicePixelRatio
* of 1.25, the cursor will be 2.5 screen pixels wide. Depending on how the dom node aligns/"snaps"
* with the screen pixels, it will sometimes be rendered with 2 screen pixels, and sometimes with 3 screen pixels.
*/
function computeScreenAwareSize(cssPx) {
var screenPx = window.devicePixelRatio * cssPx;
return Math.max(1, Math.floor(screenPx)) / window.devicePixelRatio;
}
/**
* See https://github.com/Microsoft/monaco-editor/issues/601
* To protect against malicious code in the linked site, particularly phishing attempts,
* the window.opener should be set to null to prevent the linked site from having access
* to change the location of the current page.
* See https://mathiasbynens.github.io/rel-noopener/
*/
function windowOpenNoOpener(url) {
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_8__[/* isNative */ "f"] || _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isEdgeWebView */ "g"]) {
// In VSCode, window.open() always returns null...
// The same is true for a WebView (see https://github.com/Microsoft/monaco-editor/issues/628)
window.open(url);
}
else {
var newTab = window.open();
if (newTab) {
newTab.opener = null;
newTab.location.href = url;
}
}
}
function animate(fn) {
var step = function () {
fn();
stepDisposable = scheduleAtNextAnimationFrame(step);
};
var stepDisposable = scheduleAtNextAnimationFrame(step);
return Object(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_7__[/* toDisposable */ "h"])(function () { return stepDisposable.dispose(); });
}
_common_network_js__WEBPACK_IMPORTED_MODULE_10__[/* RemoteAuthorities */ "a"].setPreferredWebSchema(/^https:/.test(window.location.href) ? 'https' : 'http');
function asDomUri(uri) {
if (!uri) {
return uri;
}
if (_common_network_js__WEBPACK_IMPORTED_MODULE_10__[/* Schemas */ "b"].vscodeRemote === uri.scheme) {
return _common_network_js__WEBPACK_IMPORTED_MODULE_10__[/* RemoteAuthorities */ "a"].rewrite(uri);
}
return uri;
}
/**
* returns url('...')
*/
function asCSSUrl(uri) {
if (!uri) {
return "url('')";
}
return "url('" + asDomUri(uri).toString(true).replace(/'/g, '%27') + "')";
}
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(377);
} else {}
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isDisposable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return dispose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return combinedDisposable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return toDisposable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DisposableStore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Disposable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return MutableDisposable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ImmortalReference; });
/**
* 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.
*/
var TRACK_DISPOSABLES = false;
var __is_disposable_tracked__ = '__is_disposable_tracked__';
function markTracked(x) {
if (!TRACK_DISPOSABLES) {
return;
}
if (x && x !== Disposable.None) {
try {
x[__is_disposable_tracked__] = true;
}
catch (_a) {
// noop
}
}
}
function trackDisposable(x) {
if (!TRACK_DISPOSABLES) {
return x;
}
var stack = new Error('Potentially leaked disposable').stack;
setTimeout(function () {
if (!x[__is_disposable_tracked__]) {
console.log(stack);
}
}, 3000);
return x;
}
function isDisposable(thing) {
return typeof thing.dispose === 'function'
&& thing.dispose.length === 0;
}
function dispose(disposables) {
if (Array.isArray(disposables)) {
disposables.forEach(function (d) {
if (d) {
markTracked(d);
d.dispose();
}
});
return [];
}
else if (disposables) {
markTracked(disposables);
disposables.dispose();
return disposables;
}
else {
return undefined;
}
}
function combinedDisposable() {
var disposables = [];
for (var _i = 0; _i < arguments.length; _i++) {
disposables[_i] = arguments[_i];
}
disposables.forEach(markTracked);
return trackDisposable({ dispose: function () { return dispose(disposables); } });
}
function toDisposable(fn) {
var self = trackDisposable({
dispose: function () {
markTracked(self);
fn();
}
});
return self;
}
var DisposableStore = /** @class */ (function () {
function DisposableStore() {
this._toDispose = new Set();
this._isDisposed = false;
}
/**
* Dispose of all registered disposables and mark this object as disposed.
*
* Any future disposables added to this object will be disposed of on `add`.
*/
DisposableStore.prototype.dispose = function () {
if (this._isDisposed) {
return;
}
markTracked(this);
this._isDisposed = true;
this.clear();
};
/**
* Dispose of all registered disposables but do not mark this object as disposed.
*/
DisposableStore.prototype.clear = function () {
this._toDispose.forEach(function (item) { return item.dispose(); });
this._toDispose.clear();
};
DisposableStore.prototype.add = function (t) {
if (!t) {
return t;
}
if (t === this) {
throw new Error('Cannot register a disposable on itself!');
}
markTracked(t);
if (this._isDisposed) {
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(t);
}
return t;
};
return DisposableStore;
}());
var Disposable = /** @class */ (function () {
function Disposable() {
this._store = new DisposableStore();
trackDisposable(this);
}
Disposable.prototype.dispose = function () {
markTracked(this);
this._store.dispose();
};
Disposable.prototype._register = function (t) {
if (t === this) {
throw new Error('Cannot register a disposable on itself!');
}
return this._store.add(t);
};
Disposable.None = Object.freeze({ dispose: function () { } });
return Disposable;
}());
/**
* 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.
*/
var MutableDisposable = /** @class */ (function () {
function MutableDisposable() {
this._isDisposed = false;
trackDisposable(this);
}
Object.defineProperty(MutableDisposable.prototype, "value", {
get: function () {
return this._isDisposed ? undefined : this._value;
},
set: function (value) {
if (this._isDisposed || value === this._value) {
return;
}
if (this._value) {
this._value.dispose();
}
if (value) {
markTracked(value);
}
this._value = value;
},
enumerable: true,
configurable: true
});
MutableDisposable.prototype.clear = function () {
this.value = undefined;
};
MutableDisposable.prototype.dispose = function () {
this._isDisposed = true;
markTracked(this);
if (this._value) {
this._value.dispose();
}
this._value = undefined;
};
return MutableDisposable;
}());
var ImmortalReference = /** @class */ (function () {
function ImmortalReference(object) {
this.object = object;
}
ImmortalReference.prototype.dispose = function () { };
return ImmortalReference;
}());
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Range; });
/* harmony import */ var _position_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
*/
var Range = /** @class */ (function () {
function Range(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.
*/
Range.prototype.isEmpty = function () {
return Range.isEmpty(this);
};
/**
* Test if `range` is empty.
*/
Range.isEmpty = function (range) {
return (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn);
};
/**
* Test if position is in this range. If the position is at the edges, will return true.
*/
Range.prototype.containsPosition = function (position) {
return Range.containsPosition(this, position);
};
/**
* Test if `position` is in `range`. If the position is at the edges, will return true.
*/
Range.containsPosition = function (range, position) {
if (position.lineNumber < range.startLineNumber || position.lineNumber > range.endLineNumber) {
return false;
}
if (position.lineNumber === range.startLineNumber && position.column < range.startColumn) {
return false;
}
if (position.lineNumber === range.endLineNumber && position.column > range.endColumn) {
return false;
}
return true;
};
/**
* Test if range is in this range. If the range is equal to this range, will return true.
*/
Range.prototype.containsRange = function (range) {
return Range.containsRange(this, range);
};
/**
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/
Range.containsRange = function (range, otherRange) {
if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
return false;
}
if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
return false;
}
if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn < range.startColumn) {
return false;
}
if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn > range.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.
*/
Range.prototype.strictContainsRange = function (range) {
return Range.strictContainsRange(this, range);
};
/**
* Test if `otherRange` is strinctly in `range` (must start after, and end before). If the ranges are equal, will return false.
*/
Range.strictContainsRange = function (range, otherRange) {
if (otherRange.startLineNumber < range.startLineNumber || otherRange.endLineNumber < range.startLineNumber) {
return false;
}
if (otherRange.startLineNumber > range.endLineNumber || otherRange.endLineNumber > range.endLineNumber) {
return false;
}
if (otherRange.startLineNumber === range.startLineNumber && otherRange.startColumn <= range.startColumn) {
return false;
}
if (otherRange.endLineNumber === range.endLineNumber && otherRange.endColumn >= range.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.
*/
Range.prototype.plusRange = function (range) {
return Range.plusRange(this, range);
};
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
Range.plusRange = function (a, b) {
var startLineNumber;
var startColumn;
var endLineNumber;
var endColumn;
if (b.startLineNumber < a.startLineNumber) {
startLineNumber = b.startLineNumber;
startColumn = b.startColumn;
}
else if (b.startLineNumber === a.startLineNumber) {
startLineNumber = b.startLineNumber;
startColumn = Math.min(b.startColumn, a.startColumn);
}
else {
startLineNumber = a.startLineNumber;
startColumn = a.startColumn;
}
if (b.endLineNumber > a.endLineNumber) {
endLineNumber = b.endLineNumber;
endColumn = b.endColumn;
}
else if (b.endLineNumber === a.endLineNumber) {
endLineNumber = b.endLineNumber;
endColumn = Math.max(b.endColumn, a.endColumn);
}
else {
endLineNumber = a.endLineNumber;
endColumn = a.endColumn;
}
return new Range(startLineNumber, startColumn, endLineNumber, endColumn);
};
/**
* A intersection of the two ranges.
*/
Range.prototype.intersectRanges = function (range) {
return Range.intersectRanges(this, range);
};
/**
* A intersection of the two ranges.
*/
Range.intersectRanges = function (a, b) {
var resultStartLineNumber = a.startLineNumber;
var resultStartColumn = a.startColumn;
var resultEndLineNumber = a.endLineNumber;
var resultEndColumn = a.endColumn;
var otherStartLineNumber = b.startLineNumber;
var otherStartColumn = b.startColumn;
var otherEndLineNumber = b.endLineNumber;
var 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);
}
// Check if selection is now empty
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.
*/
Range.prototype.equalsRange = function (other) {
return Range.equalsRange(this, other);
};
/**
* Test if range `a` equals `b`.
*/
Range.equalsRange = function (a, b) {
return (!!a &&
!!b &&
a.startLineNumber === b.startLineNumber &&
a.startColumn === b.startColumn &&
a.endLineNumber === b.endLineNumber &&
a.endColumn === b.endColumn);
};
/**
* Return the end position (which will be after or equal to the start position)
*/
Range.prototype.getEndPosition = function () {
return new _position_js__WEBPACK_IMPORTED_MODULE_0__[/* Position */ "a"](this.endLineNumber, this.endColumn);
};
/**
* Return the start position (which will be before or equal to the end position)
*/
Range.prototype.getStartPosition = function () {
return new _position_js__WEBPACK_IMPORTED_MODULE_0__[/* Position */ "a"](this.startLineNumber, this.startColumn);
};
/**
* Transform to a user presentable string representation.
*/
Range.prototype.toString = function () {
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.
*/
Range.prototype.setEndPosition = function (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.
*/
Range.prototype.setStartPosition = function (startLineNumber, startColumn) {
return new Range(startLineNumber, startColumn, this.endLineNumber, this.endColumn);
};
/**
* Create a new empty range using this range's start position.
*/
Range.prototype.collapseToStart = function () {
return Range.collapseToStart(this);
};
/**
* Create a new empty range using this range's start position.
*/
Range.collapseToStart = function (range) {
return new Range(range.startLineNumber, range.startColumn, range.startLineNumber, range.startColumn);
};
// ---
Range.fromPositions = function (start, end) {
if (end === void 0) { end = start; }
return new Range(start.lineNumber, start.column, end.lineNumber, end.column);
};
Range.lift = function (range) {
if (!range) {
return null;
}
return new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
};
/**
* Test if `obj` is an `IRange`.
*/
Range.isIRange = function (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.
*/
Range.areIntersectingOrTouching = function (a, b) {
// Check if `a` is before `b`
if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn < b.startColumn)) {
return false;
}
// Check if `b` is before `a`
if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn < a.startColumn)) {
return false;
}
// These ranges must intersect
return true;
};
/**
* Test if the two ranges are intersecting. If the ranges are touching it returns true.
*/
Range.areIntersecting = function (a, b) {
// Check if `a` is before `b`
if (a.endLineNumber < b.startLineNumber || (a.endLineNumber === b.startLineNumber && a.endColumn <= b.startColumn)) {
return false;
}
// Check if `b` is before `a`
if (b.endLineNumber < a.startLineNumber || (b.endLineNumber === a.startLineNumber && b.endColumn <= a.startColumn)) {
return false;
}
// These ranges must intersect
return true;
};
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the startPosition and then on the endPosition
*/
Range.compareRangesUsingStarts = function (a, b) {
if (a && b) {
var aStartLineNumber = a.startLineNumber | 0;
var bStartLineNumber = b.startLineNumber | 0;
if (aStartLineNumber === bStartLineNumber) {
var aStartColumn = a.startColumn | 0;
var bStartColumn = b.startColumn | 0;
if (aStartColumn === bStartColumn) {
var aEndLineNumber = a.endLineNumber | 0;
var bEndLineNumber = b.endLineNumber | 0;
if (aEndLineNumber === bEndLineNumber) {
var aEndColumn = a.endColumn | 0;
var bEndColumn = b.endColumn | 0;
return aEndColumn - bEndColumn;
}
return aEndLineNumber - bEndLineNumber;
}
return aStartColumn - bStartColumn;
}
return aStartLineNumber - bStartLineNumber;
}
var aExists = (a ? 1 : 0);
var 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
*/
Range.compareRangesUsingEnds = function (a, b) {
if (a.endLineNumber === b.endLineNumber) {
if (a.endColumn === b.endColumn) {
if (a.startLineNumber === b.startLineNumber) {
return a.startColumn - b.startColumn;
}
return a.startLineNumber - b.startLineNumber;
}
return a.endColumn - b.endColumn;
}
return a.endLineNumber - b.endLineNumber;
};
/**
* Test if the range spans multiple lines.
*/
Range.spansMultipleLines = function (range) {
return range.endLineNumber > range.startLineNumber;
};
return Range;
}());
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Extensions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tb", function() { return registerColor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return foreground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return errorForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return focusBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return contrastBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return activeContrastBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ec", function() { return textLinkForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dc", function() { return textCodeBlockBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hc", function() { return widgetShadow; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return inputBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return inputForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return inputBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return inputActiveOptionBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return inputActiveOptionBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fb", function() { return inputValidationInfoBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hb", function() { return inputValidationInfoForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gb", function() { return inputValidationInfoBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ib", function() { return inputValidationWarningBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kb", function() { return inputValidationWarningForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jb", function() { return inputValidationWarningBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cb", function() { return inputValidationErrorBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "eb", function() { return inputValidationErrorForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "db", function() { return inputValidationErrorBorder; });
/* unused harmony export selectBackground */
/* unused harmony export selectForeground */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Ob", function() { return pickerGroupForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Nb", function() { return pickerGroupBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return badgeBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return badgeForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Vb", function() { return scrollbarShadow; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xb", function() { return scrollbarSliderBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Yb", function() { return scrollbarSliderHoverBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Wb", function() { return scrollbarSliderActiveBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sb", function() { return progressBarBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return editorErrorForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return editorErrorBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return editorWarningForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return editorWarningBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return editorInfoForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return editorInfoBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return editorHintForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return editorHintBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return editorBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return editorForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return editorWidgetBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return editorWidgetForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return editorWidgetBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return editorWidgetResizeBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return editorSelectionBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return editorSelectionForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return editorInactiveSelection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return editorSelectionHighlight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return editorSelectionHighlightBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return editorFindMatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return editorFindMatchHighlight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return editorFindRangeHighlight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return editorFindMatchBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return editorFindMatchHighlightBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return editorFindRangeHighlightBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return editorHoverHighlight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return editorHoverBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return editorHoverForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return editorHoverBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return editorHoverStatusBarBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return editorActiveLinkForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return editorLightBulbForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return editorLightBulbAutoFixForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return defaultInsertColor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return defaultRemoveColor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return diffInserted; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return diffRemoved; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return diffInsertedOutline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return diffRemovedOutline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return diffBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rb", function() { return listFocusBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sb", function() { return listFocusForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lb", function() { return listActiveSelectionBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mb", function() { return listActiveSelectionForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "xb", function() { return listInactiveSelectionBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yb", function() { return listInactiveSelectionForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wb", function() { return listInactiveFocusBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ub", function() { return listHoverBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vb", function() { return listHoverForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nb", function() { return listDropBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tb", function() { return listHighlightForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ob", function() { return listFilterWidgetBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "qb", function() { return listFilterWidgetOutline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pb", function() { return listFilterWidgetNoMatchesOutline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "gc", function() { return treeIndentGuidesStroke; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Ab", function() { return menuBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Bb", function() { return menuForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zb", function() { return menuBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Eb", function() { return menuSelectionForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Cb", function() { return menuSelectionBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Db", function() { return menuSelectionBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fb", function() { return menuSeparatorBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bc", function() { return snippetTabstopHighlightBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cc", function() { return snippetTabstopHighlightBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Zb", function() { return snippetFinalTabstopHighlightBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ac", function() { return snippetFinalTabstopHighlightBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lb", function() { return overviewRulerFindMatchForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Mb", function() { return overviewRulerSelectionHighlightForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hb", function() { return minimapFindMatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Ib", function() { return minimapSelection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Gb", function() { return minimapError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Jb", function() { return minimapWarning; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pb", function() { return problemsErrorIconForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Rb", function() { return problemsWarningIconForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Qb", function() { return problemsInfoIconForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return darken; });
/* unused harmony export lighten */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fc", function() { return transparent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Kb", function() { return oneOf; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Ub", function() { return resolveColorValue; });
/* unused harmony export workbenchColorsSchemaId */
/* harmony import */ var _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57);
/* harmony import */ var _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
/* harmony import */ var _jsonschemas_common_jsonContributionRegistry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(233);
/* harmony import */ var _base_common_async_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(20);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// color registry
var Extensions = {
ColorContribution: 'base.contributions.colors'
};
var ColorRegistry = /** @class */ (function () {
function ColorRegistry() {
this._onDidChangeSchema = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_2__[/* Emitter */ "a"]();
this.onDidChangeSchema = this._onDidChangeSchema.event;
this.colorSchema = { type: 'object', properties: {} };
this.colorReferenceSchema = { type: 'string', enum: [], enumDescriptions: [] };
this.colorsById = {};
}
ColorRegistry.prototype.registerColor = function (id, defaults, description, needsTransparency, deprecationMessage) {
if (needsTransparency === void 0) { needsTransparency = false; }
var colorContribution = { id: id, description: description, defaults: defaults, needsTransparency: needsTransparency, deprecationMessage: deprecationMessage };
this.colorsById[id] = colorContribution;
var propertySchema = { type: 'string', description: description, format: 'color-hex', defaultSnippets: [{ body: '${1:#ff0000}' }] };
if (deprecationMessage) {
propertySchema.deprecationMessage = deprecationMessage;
}
this.colorSchema.properties[id] = propertySchema;
this.colorReferenceSchema.enum.push(id);
this.colorReferenceSchema.enumDescriptions.push(description);
this._onDidChangeSchema.fire();
return id;
};
ColorRegistry.prototype.resolveDefaultColor = function (id, theme) {
var colorDesc = this.colorsById[id];
if (colorDesc && colorDesc.defaults) {
var colorValue = colorDesc.defaults[theme.type];
return resolveColorValue(colorValue, theme);
}
return undefined;
};
ColorRegistry.prototype.getColorSchema = function () {
return this.colorSchema;
};
ColorRegistry.prototype.toString = function () {
var _this = this;
var sorter = function (a, b) {
var cat1 = a.indexOf('.') === -1 ? 0 : 1;
var cat2 = b.indexOf('.') === -1 ? 0 : 1;
if (cat1 !== cat2) {
return cat1 - cat2;
}
return a.localeCompare(b);
};
return Object.keys(this.colorsById).sort(sorter).map(function (k) { return "- `" + k + "`: " + _this.colorsById[k].description; }).join('\n');
};
return ColorRegistry;
}());
var colorRegistry = new ColorRegistry();
_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* Registry */ "a"].add(Extensions.ColorContribution, colorRegistry);
function registerColor(id, defaults, description, needsTransparency, deprecationMessage) {
return colorRegistry.registerColor(id, defaults, description, needsTransparency, deprecationMessage);
}
// ----- base colors
var foreground = registerColor('foreground', { dark: '#CCCCCC', light: '#616161', hc: '#FFFFFF' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('foreground', "Overall foreground color. This color is only used if not overridden by a component."));
var errorForeground = registerColor('errorForeground', { dark: '#F48771', light: '#A1260D', hc: '#F48771' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('errorForeground', "Overall foreground color for error messages. This color is only used if not overridden by a component."));
var focusBorder = registerColor('focusBorder', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#0E639C').transparent(0.8), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#007ACC').transparent(0.4), hc: '#F38518' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('focusBorder', "Overall border color for focused elements. This color is only used if not overridden by a component."));
var contrastBorder = registerColor('contrastBorder', { light: null, dark: null, hc: '#6FC3DF' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('contrastBorder', "An extra border around elements to separate them from others for greater contrast."));
var activeContrastBorder = registerColor('contrastActiveBorder', { light: null, dark: null, hc: focusBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('activeContrastBorder', "An extra border around active elements to separate them from others for greater contrast."));
var textLinkForeground = registerColor('textLink.foreground', { light: '#006AB1', dark: '#3794FF', hc: '#3794FF' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('textLinkForeground', "Foreground color for links in text."));
var textCodeBlockBackground = registerColor('textCodeBlock.background', { light: '#dcdcdc66', dark: '#0a0a0a66', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('textCodeBlockBackground', "Background color for code blocks in text."));
// ----- widgets
var widgetShadow = registerColor('widget.shadow', { dark: '#000000', light: '#A8A8A8', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('widgetShadow', 'Shadow color of widgets such as find/replace inside the editor.'));
var inputBackground = registerColor('input.background', { dark: '#3C3C3C', light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputBoxBackground', "Input box background."));
var inputForeground = registerColor('input.foreground', { dark: foreground, light: foreground, hc: foreground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputBoxForeground', "Input box foreground."));
var inputBorder = registerColor('input.border', { dark: null, light: null, hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputBoxBorder', "Input box border."));
var inputActiveOptionBorder = registerColor('inputOption.activeBorder', { dark: '#007ACC00', light: '#007ACC00', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputBoxActiveOptionBorder', "Border color of activated options in input fields."));
var inputActiveOptionBackground = registerColor('inputOption.activeBackground', { dark: transparent(focusBorder, 0.5), light: transparent(focusBorder, 0.3), hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputOption.activeBackground', "Background color of activated options in input fields."));
var inputValidationInfoBackground = registerColor('inputValidation.infoBackground', { dark: '#063B49', light: '#D6ECF2', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationInfoBackground', "Input validation background color for information severity."));
var inputValidationInfoForeground = registerColor('inputValidation.infoForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationInfoForeground', "Input validation foreground color for information severity."));
var inputValidationInfoBorder = registerColor('inputValidation.infoBorder', { dark: '#007acc', light: '#007acc', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationInfoBorder', "Input validation border color for information severity."));
var inputValidationWarningBackground = registerColor('inputValidation.warningBackground', { dark: '#352A05', light: '#F6F5D2', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationWarningBackground', "Input validation background color for warning severity."));
var inputValidationWarningForeground = registerColor('inputValidation.warningForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationWarningForeground', "Input validation foreground color for warning severity."));
var inputValidationWarningBorder = registerColor('inputValidation.warningBorder', { dark: '#B89500', light: '#B89500', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationWarningBorder', "Input validation border color for warning severity."));
var inputValidationErrorBackground = registerColor('inputValidation.errorBackground', { dark: '#5A1D1D', light: '#F2DEDE', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationErrorBackground', "Input validation background color for error severity."));
var inputValidationErrorForeground = registerColor('inputValidation.errorForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationErrorForeground', "Input validation foreground color for error severity."));
var inputValidationErrorBorder = registerColor('inputValidation.errorBorder', { dark: '#BE1100', light: '#BE1100', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('inputValidationErrorBorder', "Input validation border color for error severity."));
var selectBackground = registerColor('dropdown.background', { dark: '#3C3C3C', light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('dropdownBackground', "Dropdown background."));
var selectForeground = registerColor('dropdown.foreground', { dark: '#F0F0F0', light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('dropdownForeground', "Dropdown foreground."));
var pickerGroupForeground = registerColor('pickerGroup.foreground', { dark: '#3794FF', light: '#0066BF', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('pickerGroupForeground', "Quick picker color for grouping labels."));
var pickerGroupBorder = registerColor('pickerGroup.border', { dark: '#3F3F46', light: '#CCCEDB', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('pickerGroupBorder', "Quick picker color for grouping borders."));
var badgeBackground = registerColor('badge.background', { dark: '#4D4D4D', light: '#C4C4C4', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('badgeBackground', "Badge background color. Badges are small information labels, e.g. for search results count."));
var badgeForeground = registerColor('badge.foreground', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white, light: '#333', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('badgeForeground', "Badge foreground color. Badges are small information labels, e.g. for search results count."));
var scrollbarShadow = registerColor('scrollbar.shadow', { dark: '#000000', light: '#DDDDDD', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('scrollbarShadow', "Scrollbar shadow to indicate that the view is scrolled."));
var scrollbarSliderBackground = registerColor('scrollbarSlider.background', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#797979').transparent(0.4), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#646464').transparent(0.4), hc: transparent(contrastBorder, 0.6) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('scrollbarSliderBackground', "Scrollbar slider background color."));
var scrollbarSliderHoverBackground = registerColor('scrollbarSlider.hoverBackground', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#646464').transparent(0.7), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#646464').transparent(0.7), hc: transparent(contrastBorder, 0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('scrollbarSliderHoverBackground', "Scrollbar slider background color when hovering."));
var scrollbarSliderActiveBackground = registerColor('scrollbarSlider.activeBackground', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#BFBFBF').transparent(0.4), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#000000').transparent(0.6), hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('scrollbarSliderActiveBackground', "Scrollbar slider background color when clicked on."));
var progressBarBackground = registerColor('progressBar.background', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#0E70C0'), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#0E70C0'), hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('progressBarBackground', "Background color of the progress bar that can show for long running operations."));
var editorErrorForeground = registerColor('editorError.foreground', { dark: '#F48771', light: '#E51400', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorError.foreground', 'Foreground color of error squigglies in the editor.'));
var editorErrorBorder = registerColor('editorError.border', { dark: null, light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#E47777').transparent(0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('errorBorder', 'Border color of error boxes in the editor.'));
var editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#CCA700', light: '#E9A700', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorWarning.foreground', 'Foreground color of warning squigglies in the editor.'));
var editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#FFCC00').transparent(0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('warningBorder', 'Border color of warning boxes in the editor.'));
var editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#75BEFF', light: '#75BEFF', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));
var editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#75BEFF').transparent(0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('infoBorder', 'Border color of info boxes in the editor.'));
var editorHintForeground = registerColor('editorHint.foreground', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorHint.foreground', 'Foreground color of hint squigglies in the editor.'));
var editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#eeeeee').transparent(0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('hintBorder', 'Border color of hint boxes in the editor.'));
/**
* Editor background color.
* Because of bug https://monacotools.visualstudio.com/DefaultCollection/Monaco/_workitems/edit/13254
* we are *not* using the color white (or #ffffff, rgba(255,255,255)) but something very close to white.
*/
var editorBackground = registerColor('editor.background', { light: '#fffffe', dark: '#1E1E1E', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorBackground', "Editor background color."));
/**
* Editor foreground color.
*/
var editorForeground = registerColor('editor.foreground', { light: '#333333', dark: '#BBBBBB', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorForeground', "Editor default foreground color."));
/**
* Editor widgets
*/
var editorWidgetBackground = registerColor('editorWidget.background', { dark: '#252526', light: '#F3F3F3', hc: '#0C141F' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorWidgetBackground', 'Background color of editor widgets, such as find/replace.'));
var editorWidgetForeground = registerColor('editorWidget.foreground', { dark: foreground, light: foreground, hc: foreground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorWidgetForeground', 'Foreground color of editor widgets, such as find/replace.'));
var editorWidgetBorder = registerColor('editorWidget.border', { dark: '#454545', light: '#C8C8C8', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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.'));
var editorWidgetResizeBorder = registerColor('editorWidget.resizeBorder', { light: null, dark: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
/**
* Editor selection colors.
*/
var editorSelectionBackground = registerColor('editor.selectionBackground', { light: '#ADD6FF', dark: '#264F78', hc: '#f3f518' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorSelectionBackground', "Color of the editor selection."));
var editorSelectionForeground = registerColor('editor.selectionForeground', { light: null, dark: null, hc: '#000000' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorSelectionForeground', "Color of the selected text for high contrast."));
var editorInactiveSelection = registerColor('editor.inactiveSelectionBackground', { light: transparent(editorSelectionBackground, 0.5), dark: transparent(editorSelectionBackground, 0.5), hc: transparent(editorSelectionBackground, 0.5) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorInactiveSelection', "Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."), true);
var editorSelectionHighlight = registerColor('editor.selectionHighlightBackground', { light: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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);
var editorSelectionHighlightBorder = registerColor('editor.selectionHighlightBorder', { light: null, dark: null, hc: activeContrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorSelectionHighlightBorder', "Border color for regions with the same content as the selection."));
/**
* Editor find match colors.
*/
var editorFindMatch = registerColor('editor.findMatchBackground', { light: '#A8AC94', dark: '#515C6A', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorFindMatch', "Color of the current search match."));
var editorFindMatchHighlight = registerColor('editor.findMatchHighlightBackground', { light: '#EA5C0055', dark: '#EA5C0055', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('findMatchHighlight', "Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."), true);
var editorFindRangeHighlight = registerColor('editor.findRangeHighlightBackground', { dark: '#3a3d4166', light: '#b4b4b44d', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('findRangeHighlight', "Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."), true);
var editorFindMatchBorder = registerColor('editor.findMatchBorder', { light: null, dark: null, hc: activeContrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorFindMatchBorder', "Border color of the current search match."));
var editorFindMatchHighlightBorder = registerColor('editor.findMatchHighlightBorder', { light: null, dark: null, hc: activeContrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('findMatchHighlightBorder', "Border color of the other search matches."));
var editorFindRangeHighlightBorder = registerColor('editor.findRangeHighlightBorder', { dark: null, light: null, hc: transparent(activeContrastBorder, 0.4) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('findRangeHighlightBorder', "Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."), true);
/**
* Editor hover
*/
var editorHoverHighlight = registerColor('editor.hoverHighlightBackground', { light: '#ADD6FF26', dark: '#264f7840', hc: '#ADD6FF26' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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);
var editorHoverBackground = registerColor('editorHoverWidget.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hc: editorWidgetBackground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('hoverBackground', 'Background color of the editor hover.'));
var editorHoverForeground = registerColor('editorHoverWidget.foreground', { light: editorWidgetForeground, dark: editorWidgetForeground, hc: editorWidgetForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('hoverForeground', 'Foreground color of the editor hover.'));
var editorHoverBorder = registerColor('editorHoverWidget.border', { light: editorWidgetBorder, dark: editorWidgetBorder, hc: editorWidgetBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('hoverBorder', 'Border color of the editor hover.'));
var editorHoverStatusBarBackground = registerColor('editorHoverWidget.statusBarBackground', { dark: lighten(editorHoverBackground, 0.2), light: darken(editorHoverBackground, 0.05), hc: editorWidgetBackground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('statusBarBackground', "Background color of the editor hover status bar."));
/**
* Editor link colors
*/
var editorActiveLinkForeground = registerColor('editorLink.activeForeground', { dark: '#4E94CE', light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].blue, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].cyan }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('activeLinkForeground', 'Color of active links.'));
/**
* Editor lighbulb icon colors
*/
var editorLightBulbForeground = registerColor('editorLightBulb.foreground', { dark: '#FFCC00', light: '#DDB100', hc: '#FFCC00' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorLightBulbForeground', "The color used for the lightbulb actions icon."));
var editorLightBulbAutoFixForeground = registerColor('editorLightBulbAutoFix.foreground', { dark: '#75BEFF', light: '#007ACC', hc: '#75BEFF' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('editorLightBulbAutoFixForeground', "The color used for the lightbulb auto fix actions icon."));
/**
* Diff Editor Colors
*/
var defaultInsertColor = new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](155, 185, 85, 0.2));
var defaultRemoveColor = new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 0, 0, 0.2));
var diffInserted = registerColor('diffEditor.insertedTextBackground', { dark: defaultInsertColor, light: defaultInsertColor, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('diffEditorInserted', 'Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations.'), true);
var diffRemoved = registerColor('diffEditor.removedTextBackground', { dark: defaultRemoveColor, light: defaultRemoveColor, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('diffEditorRemoved', 'Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations.'), true);
var diffInsertedOutline = registerColor('diffEditor.insertedTextBorder', { dark: null, light: null, hc: '#33ff2eff' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('diffEditorInsertedOutline', 'Outline color for the text that got inserted.'));
var diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hc: '#FF008F' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('diffEditorRemovedOutline', 'Outline color for text that got removed.'));
var diffBorder = registerColor('diffEditor.border', { dark: null, light: null, hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('diffEditorBorder', 'Border color between the two text editors.'));
/**
* List and tree colors
*/
var listFocusBackground = registerColor('list.focusBackground', { dark: '#062F4A', light: '#D6EBFF', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listFocusForeground = registerColor('list.focusForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listActiveSelectionBackground = registerColor('list.activeSelectionBackground', { dark: '#094771', light: '#0074E8', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listActiveSelectionForeground = registerColor('list.activeSelectionForeground', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white, light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#37373D', light: '#E4E6F1', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listInactiveSelectionForeground = registerColor('list.inactiveSelectionForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('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."));
var listHoverBackground = registerColor('list.hoverBackground', { dark: '#2A2D2E', light: '#F0F0F0', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listHoverBackground', "List/Tree background when hovering over items using the mouse."));
var listHoverForeground = registerColor('list.hoverForeground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listHoverForeground', "List/Tree foreground when hovering over items using the mouse."));
var listDropBackground = registerColor('list.dropBackground', { dark: listFocusBackground, light: listFocusBackground, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listDropBackground', "List/Tree drag and drop background when moving items around using the mouse."));
var listHighlightForeground = registerColor('list.highlightForeground', { dark: '#0097fb', light: '#0066BF', hc: focusBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('highlight', 'List/Tree foreground color of the match highlights when searching inside the list/tree.'));
var listFilterWidgetBackground = registerColor('listFilterWidget.background', { light: '#efc1ad', dark: '#653723', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listFilterWidgetBackground', 'Background color of the type filter widget in lists and trees.'));
var listFilterWidgetOutline = registerColor('listFilterWidget.outline', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].transparent, light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].transparent, hc: '#f38518' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listFilterWidgetOutline', 'Outline color of the type filter widget in lists and trees.'));
var listFilterWidgetNoMatchesOutline = registerColor('listFilterWidget.noMatchesOutline', { dark: '#BE1100', light: '#BE1100', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('listFilterWidgetNoMatchesOutline', 'Outline color of the type filter widget in lists and trees, when there are no matches.'));
var treeIndentGuidesStroke = registerColor('tree.indentGuidesStroke', { dark: '#585858', light: '#a9a9a9', hc: '#a9a9a9' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('treeIndentGuidesStroke', "Tree stroke color for the indentation guides."));
/**
* Menu colors
*/
var menuBorder = registerColor('menu.border', { dark: null, light: null, hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuBorder', "Border color of menus."));
var menuForeground = registerColor('menu.foreground', { dark: selectForeground, light: foreground, hc: selectForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuForeground', "Foreground color of menu items."));
var menuBackground = registerColor('menu.background', { dark: selectBackground, light: selectBackground, hc: selectBackground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuBackground', "Background color of menu items."));
var menuSelectionForeground = registerColor('menu.selectionForeground', { dark: listActiveSelectionForeground, light: listActiveSelectionForeground, hc: listActiveSelectionForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuSelectionForeground', "Foreground color of the selected menu item in menus."));
var menuSelectionBackground = registerColor('menu.selectionBackground', { dark: listActiveSelectionBackground, light: listActiveSelectionBackground, hc: listActiveSelectionBackground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuSelectionBackground', "Background color of the selected menu item in menus."));
var menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuSelectionBorder', "Border color of the selected menu item in menus."));
var menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('menuSeparatorBackground', "Color of a separator menu item in menus."));
/**
* Snippet placeholder colors
*/
var snippetTabstopHighlightBackground = registerColor('editor.snippetTabstopHighlightBackground', { dark: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](124, 124, 124, 0.3)), light: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](10, 50, 100, 0.2)), hc: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](124, 124, 124, 0.3)) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('snippetTabstopHighlightBackground', "Highlight background color of a snippet tabstop."));
var snippetTabstopHighlightBorder = registerColor('editor.snippetTabstopHighlightBorder', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('snippetTabstopHighlightBorder', "Highlight border color of a snippet tabstop."));
var snippetFinalTabstopHighlightBackground = registerColor('editor.snippetFinalTabstopHighlightBackground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('snippetFinalTabstopHighlightBackground', "Highlight background color of the final tabstop of a snippet."));
var snippetFinalTabstopHighlightBorder = registerColor('editor.snippetFinalTabstopHighlightBorder', { dark: '#525252', light: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](10, 50, 100, 0.5)), hc: '#525252' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('snippetFinalTabstopHighlightBorder', "Highlight border color of the final stabstop of a snippet."));
var overviewRulerFindMatchForeground = registerColor('editorOverviewRuler.findMatchForeground', { dark: '#d186167e', light: '#d186167e', hc: '#AB5A00' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('overviewRulerFindMatchForeground', 'Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations.'), true);
var overviewRulerSelectionHighlightForeground = registerColor('editorOverviewRuler.selectionHighlightForeground', { dark: '#A0A0A0CC', light: '#A0A0A0CC', hc: '#A0A0A0CC' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('overviewRulerSelectionHighlightForeground', 'Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations.'), true);
var minimapFindMatch = registerColor('minimap.findMatchHighlight', { light: '#d18616', dark: '#d18616', hc: '#AB5A00' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('minimapFindMatchHighlight', 'Minimap marker color for find matches.'), true);
var minimapSelection = registerColor('minimap.selectionHighlight', { light: '#ADD6FF', dark: '#264F78', hc: '#ffffff' }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('minimapSelectionHighlight', 'Minimap marker color for the editor selection.'), true);
var minimapError = registerColor('minimap.errorHighlight', { dark: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 18, 18, 0.7)), light: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 18, 18, 0.7)), hc: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 50, 50, 1)) }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('minimapError', 'Minimap marker color for errors.'));
var minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningBorder }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('overviewRuleWarning', 'Minimap marker color for warnings.'));
var problemsErrorIconForeground = registerColor('problemsErrorIcon.foreground', { dark: editorErrorForeground, light: editorErrorForeground, hc: editorErrorForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('problemsErrorIconForeground', "The color used for the problems error icon."));
var problemsWarningIconForeground = registerColor('problemsWarningIcon.foreground', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('problemsWarningIconForeground', "The color used for the problems warning icon."));
var problemsInfoIconForeground = registerColor('problemsInfoIcon.foreground', { dark: editorInfoForeground, light: editorInfoForeground, hc: editorInfoForeground }, _nls_js__WEBPACK_IMPORTED_MODULE_3__[/* localize */ "a"]('problemsInfoIconForeground', "The color used for the problems info icon."));
// ----- color functions
function darken(colorValue, factor) {
return function (theme) {
var color = resolveColorValue(colorValue, theme);
if (color) {
return color.darken(factor);
}
return undefined;
};
}
function lighten(colorValue, factor) {
return function (theme) {
var color = resolveColorValue(colorValue, theme);
if (color) {
return color.lighten(factor);
}
return undefined;
};
}
function transparent(colorValue, factor) {
return function (theme) {
var color = resolveColorValue(colorValue, theme);
if (color) {
return color.transparent(factor);
}
return undefined;
};
}
function oneOf() {
var colorValues = [];
for (var _i = 0; _i < arguments.length; _i++) {
colorValues[_i] = arguments[_i];
}
return function (theme) {
for (var _i = 0, colorValues_1 = colorValues; _i < colorValues_1.length; _i++) {
var colorValue = colorValues_1[_i];
var color = resolveColorValue(colorValue, theme);
if (color) {
return color;
}
}
return undefined;
};
}
function lessProminent(colorValue, backgroundColorValue, factor, transparency) {
return function (theme) {
var from = resolveColorValue(colorValue, theme);
if (from) {
var backgroundColor = resolveColorValue(backgroundColorValue, theme);
if (backgroundColor) {
if (from.isDarkerThan(backgroundColor)) {
return _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].getLighterColor(from, backgroundColor, factor).transparent(transparency);
}
return _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].getDarkerColor(from, backgroundColor, factor).transparent(transparency);
}
return from.transparent(factor * transparency);
}
return undefined;
};
}
// ----- implementation
/**
* @param colorValue Resolve a color value in the context of a theme
*/
function resolveColorValue(colorValue, theme) {
if (colorValue === null) {
return undefined;
}
else if (typeof colorValue === 'string') {
if (colorValue[0] === '#') {
return _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex(colorValue);
}
return theme.getColor(colorValue);
}
else if (colorValue instanceof _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"]) {
return colorValue;
}
else if (typeof colorValue === 'function') {
return colorValue(theme);
}
return undefined;
}
var workbenchColorsSchemaId = 'vscode://schemas/workbench-colors';
var schemaRegistry = _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* Registry */ "a"].as(_jsonschemas_common_jsonContributionRegistry_js__WEBPACK_IMPORTED_MODULE_4__[/* Extensions */ "a"].JSONContribution);
schemaRegistry.registerSchema(workbenchColorsSchemaId, colorRegistry.getColorSchema());
var delayer = new _base_common_async_js__WEBPACK_IMPORTED_MODULE_5__[/* RunOnceScheduler */ "d"](function () { return schemaRegistry.notifySchemaChanged(workbenchColorsSchemaId); }, 200);
colorRegistry.onDidChangeSchema(function () {
if (!delayer.isScheduled()) {
delayer.schedule();
}
});
// setTimeout(_ => console.log(colorRegistry.toString()), 5000);
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Command; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return EditorCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return EditorAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return registerLanguageCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return registerDefaultLanguageCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return registerModelAndPositionCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return registerModelCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return registerEditorCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return registerEditorAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return registerInstantiatedEditorAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return registerEditorContribution; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return EditorExtensionsRegistry; });
/* harmony import */ var _base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
/* harmony import */ var _base_common_uri_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27);
/* harmony import */ var _services_codeEditorService_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36);
/* harmony import */ var _common_core_position_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
/* harmony import */ var _common_services_modelService_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58);
/* harmony import */ var _common_services_resolverService_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(102);
/* harmony import */ var _platform_actions_common_actions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(68);
/* harmony import */ var _platform_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(28);
/* harmony import */ var _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(13);
/* harmony import */ var _platform_keybinding_common_keybindingsRegistry_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(88);
/* harmony import */ var _platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(57);
/* harmony import */ var _platform_telemetry_common_telemetry_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(127);
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(21);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Command = /** @class */ (function () {
function Command(opts) {
this.id = opts.id;
this.precondition = opts.precondition;
this._kbOpts = opts.kbOpts;
this._menuOpts = opts.menuOpts;
this._description = opts.description;
}
Command.prototype.register = function () {
var _this = this;
if (Array.isArray(this._menuOpts)) {
this._menuOpts.forEach(this._registerMenuItem, this);
}
else if (this._menuOpts) {
this._registerMenuItem(this._menuOpts);
}
if (this._kbOpts) {
var kbWhen = this._kbOpts.kbExpr;
if (this.precondition) {
if (kbWhen) {
kbWhen = _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_8__[/* ContextKeyExpr */ "a"].and(kbWhen, this.precondition);
}
else {
kbWhen = this.precondition;
}
}
_platform_keybinding_common_keybindingsRegistry_js__WEBPACK_IMPORTED_MODULE_9__[/* KeybindingsRegistry */ "a"].registerCommandAndKeybindingRule({
id: this.id,
handler: function (accessor, args) { return _this.runCommand(accessor, args); },
weight: this._kbOpts.weight,
when: kbWhen,
primary: this._kbOpts.primary,
secondary: this._kbOpts.secondary,
win: this._kbOpts.win,
linux: this._kbOpts.linux,
mac: this._kbOpts.mac,
description: this._description
});
}
else {
_platform_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_7__[/* CommandsRegistry */ "a"].registerCommand({
id: this.id,
handler: function (accessor, args) { return _this.runCommand(accessor, args); },
description: this._description
});
}
};
Command.prototype._registerMenuItem = function (item) {
_platform_actions_common_actions_js__WEBPACK_IMPORTED_MODULE_6__[/* MenuRegistry */ "c"].appendMenuItem(item.menuId, {
group: item.group,
command: {
id: this.id,
title: item.title,
},
when: item.when,
order: item.order
});
};
return Command;
}());
var EditorCommand = /** @class */ (function (_super) {
__extends(EditorCommand, _super);
function EditorCommand() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Create a command class that is bound to a certain editor contribution.
*/
EditorCommand.bindToContribution = function (controllerGetter) {
return /** @class */ (function (_super) {
__extends(EditorControllerCommandImpl, _super);
function EditorControllerCommandImpl(opts) {
var _this = _super.call(this, opts) || this;
_this._callback = opts.handler;
return _this;
}
EditorControllerCommandImpl.prototype.runEditorCommand = function (accessor, editor, args) {
var controller = controllerGetter(editor);
if (controller) {
this._callback(controllerGetter(editor), args);
}
};
return EditorControllerCommandImpl;
}(EditorCommand));
};
EditorCommand.prototype.runCommand = function (accessor, args) {
var _this = this;
var codeEditorService = accessor.get(_services_codeEditorService_js__WEBPACK_IMPORTED_MODULE_2__[/* ICodeEditorService */ "a"]);
// Find the editor with text focus or active
var editor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();
if (!editor) {
// well, at least we tried...
return;
}
return editor.invokeWithinContext(function (editorAccessor) {
var kbService = editorAccessor.get(_platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_8__[/* IContextKeyService */ "c"]);
if (!kbService.contextMatchesRules(Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_12__[/* withNullAsUndefined */ "n"])(_this.precondition))) {
// precondition does not hold
return;
}
return _this.runEditorCommand(editorAccessor, editor, args);
});
};
return EditorCommand;
}(Command));
var EditorAction = /** @class */ (function (_super) {
__extends(EditorAction, _super);
function EditorAction(opts) {
var _this = _super.call(this, EditorAction.convertOptions(opts)) || this;
_this.label = opts.label;
_this.alias = opts.alias;
return _this;
}
EditorAction.convertOptions = function (opts) {
var 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 = 7 /* EditorContext */;
}
if (!item.title) {
item.title = opts.label;
}
item.when = _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_8__[/* ContextKeyExpr */ "a"].and(opts.precondition, item.when);
return item;
}
if (Array.isArray(opts.contextMenuOpts)) {
menuOpts.push.apply(menuOpts, opts.contextMenuOpts.map(withDefaults));
}
else if (opts.contextMenuOpts) {
menuOpts.push(withDefaults(opts.contextMenuOpts));
}
opts.menuOpts = menuOpts;
return opts;
};
EditorAction.prototype.runEditorCommand = function (accessor, editor, args) {
this.reportTelemetry(accessor, editor);
return this.run(accessor, editor, args || {});
};
EditorAction.prototype.reportTelemetry = function (accessor, editor) {
accessor.get(_platform_telemetry_common_telemetry_js__WEBPACK_IMPORTED_MODULE_11__[/* ITelemetryService */ "a"]).publicLog2('editorActionInvoked', { name: this.label, id: this.id });
};
return EditorAction;
}(EditorCommand));
//#endregion EditorAction
// --- Registration of commands and actions
function registerLanguageCommand(id, handler) {
_platform_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_7__[/* CommandsRegistry */ "a"].registerCommand(id, function (accessor, args) { return handler(accessor, args || {}); });
}
function registerDefaultLanguageCommand(id, handler) {
registerLanguageCommand(id, function (accessor, args) {
var resource = args.resource, position = args.position;
if (!(resource instanceof _base_common_uri_js__WEBPACK_IMPORTED_MODULE_1__[/* URI */ "a"])) {
throw Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* illegalArgument */ "b"])('resource');
}
if (!_common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].isIPosition(position)) {
throw Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* illegalArgument */ "b"])('position');
}
var model = accessor.get(_common_services_modelService_js__WEBPACK_IMPORTED_MODULE_4__[/* IModelService */ "a"]).getModel(resource);
if (model) {
var editorPosition = _common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].lift(position);
return handler(model, editorPosition, args);
}
return accessor.get(_common_services_resolverService_js__WEBPACK_IMPORTED_MODULE_5__[/* ITextModelService */ "a"]).createModelReference(resource).then(function (reference) {
return new Promise(function (resolve, reject) {
try {
var result = handler(reference.object.textEditorModel, _common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].lift(position), args);
resolve(result);
}
catch (err) {
reject(err);
}
}).finally(function () {
reference.dispose();
});
});
});
}
function registerModelAndPositionCommand(id, handler) {
_platform_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_7__[/* CommandsRegistry */ "a"].registerCommand(id, function (accessor) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var resource = args[0], position = args[1];
Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_12__[/* assertType */ "a"])(_base_common_uri_js__WEBPACK_IMPORTED_MODULE_1__[/* URI */ "a"].isUri(resource));
Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_12__[/* assertType */ "a"])(_common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].isIPosition(position));
var model = accessor.get(_common_services_modelService_js__WEBPACK_IMPORTED_MODULE_4__[/* IModelService */ "a"]).getModel(resource);
if (model) {
var editorPosition = _common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].lift(position);
return handler(model, editorPosition, args.slice(2));
}
return accessor.get(_common_services_resolverService_js__WEBPACK_IMPORTED_MODULE_5__[/* ITextModelService */ "a"]).createModelReference(resource).then(function (reference) {
return new Promise(function (resolve, reject) {
try {
var result = handler(reference.object.textEditorModel, _common_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].lift(position), args.slice(2));
resolve(result);
}
catch (err) {
reject(err);
}
}).finally(function () {
reference.dispose();
});
});
});
}
function registerModelCommand(id, handler) {
_platform_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_7__[/* CommandsRegistry */ "a"].registerCommand(id, function (accessor) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var resource = args[0];
Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_12__[/* assertType */ "a"])(_base_common_uri_js__WEBPACK_IMPORTED_MODULE_1__[/* URI */ "a"].isUri(resource));
var model = accessor.get(_common_services_modelService_js__WEBPACK_IMPORTED_MODULE_4__[/* IModelService */ "a"]).getModel(resource);
if (model) {
return handler(model, args.slice(1));
}
return accessor.get(_common_services_resolverService_js__WEBPACK_IMPORTED_MODULE_5__[/* ITextModelService */ "a"]).createModelReference(resource).then(function (reference) {
return new Promise(function (resolve, reject) {
try {
var result = handler(reference.object.textEditorModel, args.slice(1));
resolve(result);
}
catch (err) {
reject(err);
}
}).finally(function () {
reference.dispose();
});
});
});
}
function registerEditorCommand(editorCommand) {
EditorContributionRegistry.INSTANCE.registerEditorCommand(editorCommand);
return editorCommand;
}
function registerEditorAction(ctor) {
EditorContributionRegistry.INSTANCE.registerEditorAction(new ctor());
}
function registerInstantiatedEditorAction(editorAction) {
EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);
}
function registerEditorContribution(id, ctor) {
EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor);
}
var EditorExtensionsRegistry;
(function (EditorExtensionsRegistry) {
function getEditorCommand(commandId) {
return EditorContributionRegistry.INSTANCE.getEditorCommand(commandId);
}
EditorExtensionsRegistry.getEditorCommand = getEditorCommand;
function getEditorActions() {
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
EditorExtensionsRegistry.getEditorActions = getEditorActions;
function getEditorContributions() {
return EditorContributionRegistry.INSTANCE.getEditorContributions();
}
EditorExtensionsRegistry.getEditorContributions = getEditorContributions;
function getSomeEditorContributions(ids) {
return EditorContributionRegistry.INSTANCE.getEditorContributions().filter(function (c) { return ids.indexOf(c.id) >= 0; });
}
EditorExtensionsRegistry.getSomeEditorContributions = getSomeEditorContributions;
function getDiffEditorContributions() {
return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();
}
EditorExtensionsRegistry.getDiffEditorContributions = getDiffEditorContributions;
})(EditorExtensionsRegistry || (EditorExtensionsRegistry = {}));
// Editor extension points
var Extensions = {
EditorCommonContributions: 'editor.contributions'
};
var EditorContributionRegistry = /** @class */ (function () {
function EditorContributionRegistry() {
this.editorContributions = [];
this.diffEditorContributions = [];
this.editorActions = [];
this.editorCommands = Object.create(null);
}
EditorContributionRegistry.prototype.registerEditorContribution = function (id, ctor) {
this.editorContributions.push({ id: id, ctor: ctor });
};
EditorContributionRegistry.prototype.getEditorContributions = function () {
return this.editorContributions.slice(0);
};
EditorContributionRegistry.prototype.getDiffEditorContributions = function () {
return this.diffEditorContributions.slice(0);
};
EditorContributionRegistry.prototype.registerEditorAction = function (action) {
action.register();
this.editorActions.push(action);
};
EditorContributionRegistry.prototype.getEditorActions = function () {
return this.editorActions.slice(0);
};
EditorContributionRegistry.prototype.registerEditorCommand = function (editorCommand) {
editorCommand.register();
this.editorCommands[editorCommand.id] = editorCommand;
};
EditorContributionRegistry.prototype.getEditorCommand = function (commandId) {
return (this.editorCommands[commandId] || null);
};
EditorContributionRegistry.INSTANCE = new EditorContributionRegistry();
return EditorContributionRegistry;
}());
_platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_10__[/* Registry */ "a"].add(Extensions.EditorCommonContributions, EditorContributionRegistry.INSTANCE);
/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Event; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Emitter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return PauseableEmitter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return EventMultiplexer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return EventBufferer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return Relay; });
/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
/* harmony import */ var _functional_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(141);
/* harmony import */ var _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _linkedList_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Event;
(function (Event) {
Event.None = function () { return _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"].None; };
/**
* Given an event, returns another event which only fires once.
*/
function once(event) {
return function (listener, thisArgs, disposables) {
if (thisArgs === void 0) { thisArgs = null; }
// we need this, in case the event fires during the listener call
var didFire = false;
var result;
result = event(function (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;
/**
* Given an event and a `map` function, returns another event which maps each element
* through the mapping function.
*/
function map(event, map) {
return snapshot(function (listener, thisArgs, disposables) {
if (thisArgs === void 0) { thisArgs = null; }
return event(function (i) { return listener.call(thisArgs, map(i)); }, null, disposables);
});
}
Event.map = map;
/**
* Given an event and an `each` function, returns another identical event and calls
* the `each` function per each element.
*/
function forEach(event, each) {
return snapshot(function (listener, thisArgs, disposables) {
if (thisArgs === void 0) { thisArgs = null; }
return event(function (i) { each(i); listener.call(thisArgs, i); }, null, disposables);
});
}
Event.forEach = forEach;
function filter(event, filter) {
return snapshot(function (listener, thisArgs, disposables) {
if (thisArgs === void 0) { thisArgs = null; }
return event(function (e) { return filter(e) && listener.call(thisArgs, e); }, null, disposables);
});
}
Event.filter = filter;
/**
* Given an event, returns the same event but typed as `Event`.
*/
function signal(event) {
return event;
}
Event.signal = signal;
/**
* Given a collection of events, returns a single event which emits
* whenever any of the provided events emit.
*/
function any() {
var events = [];
for (var _i = 0; _i < arguments.length; _i++) {
events[_i] = arguments[_i];
}
return function (listener, thisArgs, disposables) {
if (thisArgs === void 0) { thisArgs = null; }
return _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* combinedDisposable */ "e"].apply(void 0, events.map(function (event) { return event(function (e) { return listener.call(thisArgs, e); }, null, disposables); }));
};
}
Event.any = any;
/**
* Given an event and a `merge` function, returns another event which maps each element
* and the cumulative result through the `merge` function. Similar to `map`, but with memory.
*/
function reduce(event, merge, initial) {
var output = initial;
return map(event, function (e) {
output = merge(output, e);
return output;
});
}
Event.reduce = reduce;
/**
* Given a chain of event processing functions (filter, map, etc), each
* function will be invoked per event & per listener. Snapshotting an event
* chain allows each function to be invoked just once per event.
*/
function snapshot(event) {
var listener;
var emitter = new Emitter({
onFirstListenerAdd: function () {
listener = event(emitter.fire, emitter);
},
onLastListenerRemove: function () {
listener.dispose();
}
});
return emitter.event;
}
Event.snapshot = snapshot;
function debounce(event, merge, delay, leading, leakWarningThreshold) {
if (delay === void 0) { delay = 100; }
if (leading === void 0) { leading = false; }
var subscription;
var output = undefined;
var handle = undefined;
var numDebouncedCalls = 0;
var emitter = new Emitter({
leakWarningThreshold: leakWarningThreshold,
onFirstListenerAdd: function () {
subscription = event(function (cur) {
numDebouncedCalls++;
output = merge(output, cur);
if (leading && !handle) {
emitter.fire(output);
output = undefined;
}
clearTimeout(handle);
handle = setTimeout(function () {
var _output = output;
output = undefined;
handle = undefined;
if (!leading || numDebouncedCalls > 1) {
emitter.fire(_output);
}
numDebouncedCalls = 0;
}, delay);
});
},
onLastListenerRemove: function () {
subscription.dispose();
}
});
return emitter.event;
}
Event.debounce = debounce;
/**
* Given an event, it returns another event which fires only once and as soon as
* the input event emits. The event data is the number of millis it took for the
* event to fire.
*/
function stopwatch(event) {
var start = new Date().getTime();
return map(once(event), function (_) { return new Date().getTime() - start; });
}
Event.stopwatch = stopwatch;
/**
* Given an event, it returns another event which fires only when the event
* element changes.
*/
function latch(event) {
var firstCall = true;
var cache;
return filter(event, function (value) {
var shouldEmit = firstCall || value !== cache;
firstCall = false;
cache = value;
return shouldEmit;
});
}
Event.latch = latch;
/**
* Buffers the provided event until a first listener comes
* along, at which point fire all the events at once and
* pipe the event from then on.
*
* ```typescript
* const emitter = new Emitter();
* const event = emitter.event;
* const bufferedEvent = buffer(event);
*
* emitter.fire(1);
* emitter.fire(2);
* emitter.fire(3);
* // nothing...
*
* const listener = bufferedEvent(num => console.log(num));
* // 1, 2, 3
*
* emitter.fire(4);
* // 4
* ```
*/
function buffer(event, nextTick, _buffer) {
if (nextTick === void 0) { nextTick = false; }
if (_buffer === void 0) { _buffer = []; }
var buffer = _buffer.slice();
var listener = event(function (e) {
if (buffer) {
buffer.push(e);
}
else {
emitter.fire(e);
}
});
var flush = function () {
if (buffer) {
buffer.forEach(function (e) { return emitter.fire(e); });
}
buffer = null;
};
var emitter = new Emitter({
onFirstListenerAdd: function () {
if (!listener) {
listener = event(function (e) { return emitter.fire(e); });
}
},
onFirstListenerDidAdd: function () {
if (buffer) {
if (nextTick) {
setTimeout(flush);
}
else {
flush();
}
}
},
onLastListenerRemove: function () {
if (listener) {
listener.dispose();
}
listener = null;
}
});
return emitter.event;
}
Event.buffer = buffer;
var ChainableEvent = /** @class */ (function () {
function ChainableEvent(event) {
this.event = event;
}
ChainableEvent.prototype.map = function (fn) {
return new ChainableEvent(map(this.event, fn));
};
ChainableEvent.prototype.forEach = function (fn) {
return new ChainableEvent(forEach(this.event, fn));
};
ChainableEvent.prototype.filter = function (fn) {
return new ChainableEvent(filter(this.event, fn));
};
ChainableEvent.prototype.reduce = function (merge, initial) {
return new ChainableEvent(reduce(this.event, merge, initial));
};
ChainableEvent.prototype.latch = function () {
return new ChainableEvent(latch(this.event));
};
ChainableEvent.prototype.debounce = function (merge, delay, leading, leakWarningThreshold) {
if (delay === void 0) { delay = 100; }
if (leading === void 0) { leading = false; }
return new ChainableEvent(debounce(this.event, merge, delay, leading, leakWarningThreshold));
};
ChainableEvent.prototype.on = function (listener, thisArgs, disposables) {
return this.event(listener, thisArgs, disposables);
};
ChainableEvent.prototype.once = function (listener, thisArgs, disposables) {
return once(this.event)(listener, thisArgs, disposables);
};
return ChainableEvent;
}());
function chain(event) {
return new ChainableEvent(event);
}
Event.chain = chain;
function fromNodeEventEmitter(emitter, eventName, map) {
if (map === void 0) { map = function (id) { return id; }; }
var fn = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return result.fire(map.apply(void 0, args));
};
var onFirstListenerAdd = function () { return emitter.on(eventName, fn); };
var onLastListenerRemove = function () { return emitter.removeListener(eventName, fn); };
var result = new Emitter({ onFirstListenerAdd: onFirstListenerAdd, onLastListenerRemove: onLastListenerRemove });
return result.event;
}
Event.fromNodeEventEmitter = fromNodeEventEmitter;
function fromDOMEventEmitter(emitter, eventName, map) {
if (map === void 0) { map = function (id) { return id; }; }
var fn = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return result.fire(map.apply(void 0, args));
};
var onFirstListenerAdd = function () { return emitter.addEventListener(eventName, fn); };
var onLastListenerRemove = function () { return emitter.removeEventListener(eventName, fn); };
var result = new Emitter({ onFirstListenerAdd: onFirstListenerAdd, onLastListenerRemove: onLastListenerRemove });
return result.event;
}
Event.fromDOMEventEmitter = fromDOMEventEmitter;
function fromPromise(promise) {
var emitter = new Emitter();
var shouldEmit = false;
promise
.then(undefined, function () { return null; })
.then(function () {
if (!shouldEmit) {
setTimeout(function () { return emitter.fire(undefined); }, 0);
}
else {
emitter.fire(undefined);
}
});
shouldEmit = true;
return emitter.event;
}
Event.fromPromise = fromPromise;
function toPromise(event) {
return new Promise(function (c) { return once(event)(c); });
}
Event.toPromise = toPromise;
})(Event || (Event = {}));
var _globalLeakWarningThreshold = -1;
var LeakageMonitor = /** @class */ (function () {
function LeakageMonitor(customThreshold, name) {
if (name === void 0) { name = Math.random().toString(18).slice(2, 5); }
this.customThreshold = customThreshold;
this.name = name;
this._warnCountdown = 0;
}
LeakageMonitor.prototype.dispose = function () {
if (this._stacks) {
this._stacks.clear();
}
};
LeakageMonitor.prototype.check = function (listenerCount) {
var _this = this;
var threshold = _globalLeakWarningThreshold;
if (typeof this.customThreshold === 'number') {
threshold = this.customThreshold;
}
if (threshold <= 0 || listenerCount < threshold) {
return undefined;
}
if (!this._stacks) {
this._stacks = new Map();
}
var stack = new Error().stack.split('\n').slice(3).join('\n');
var count = (this._stacks.get(stack) || 0);
this._stacks.set(stack, 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
var topStack_1;
var topCount_1 = 0;
this._stacks.forEach(function (count, stack) {
if (!topStack_1 || topCount_1 < count) {
topStack_1 = stack;
topCount_1 = count;
}
});
console.warn("[" + this.name + "] potential listener LEAK detected, having " + listenerCount + " listeners already. MOST frequent listener (" + topCount_1 + "):");
console.warn(topStack_1);
}
return function () {
var count = (_this._stacks.get(stack) || 0);
_this._stacks.set(stack, count - 1);
};
};
return LeakageMonitor;
}());
/**
* 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);
}
}
*/
var Emitter = /** @class */ (function () {
function Emitter(options) {
this._disposed = false;
this._options = options;
this._leakageMon = _globalLeakWarningThreshold > 0
? new LeakageMonitor(this._options && this._options.leakWarningThreshold)
: undefined;
}
Object.defineProperty(Emitter.prototype, "event", {
/**
* For the public to allow to subscribe
* to events from this Emitter
*/
get: function () {
var _this = this;
if (!this._event) {
this._event = function (listener, thisArgs, disposables) {
if (!_this._listeners) {
_this._listeners = new _linkedList_js__WEBPACK_IMPORTED_MODULE_3__[/* LinkedList */ "a"]();
}
var firstListener = _this._listeners.isEmpty();
if (firstListener && _this._options && _this._options.onFirstListenerAdd) {
_this._options.onFirstListenerAdd(_this);
}
var remove = _this._listeners.push(!thisArgs ? listener : [listener, thisArgs]);
if (firstListener && _this._options && _this._options.onFirstListenerDidAdd) {
_this._options.onFirstListenerDidAdd(_this);
}
if (_this._options && _this._options.onListenerDidAdd) {
_this._options.onListenerDidAdd(_this, listener, thisArgs);
}
// check and record this emitter for potential leakage
var removeMonitor;
if (_this._leakageMon) {
removeMonitor = _this._leakageMon.check(_this._listeners.size);
}
var result;
result = {
dispose: function () {
if (removeMonitor) {
removeMonitor();
}
result.dispose = Emitter._noop;
if (!_this._disposed) {
remove();
if (_this._options && _this._options.onLastListenerRemove) {
var hasListeners = (_this._listeners && !_this._listeners.isEmpty());
if (!hasListeners) {
_this._options.onLastListenerRemove(_this);
}
}
}
}
};
if (disposables instanceof _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* DisposableStore */ "b"]) {
disposables.add(result);
}
else if (Array.isArray(disposables)) {
disposables.push(result);
}
return result;
};
}
return this._event;
},
enumerable: true,
configurable: true
});
/**
* To be kept private to fire an event to
* subscribers
*/
Emitter.prototype.fire = function (event) {
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_js__WEBPACK_IMPORTED_MODULE_3__[/* LinkedList */ "a"]();
}
for (var iter = this._listeners.iterator(), e = iter.next(); !e.done; e = iter.next()) {
this._deliveryQueue.push([e.value, event]);
}
while (this._deliveryQueue.size > 0) {
var _a = this._deliveryQueue.shift(), listener = _a[0], event_1 = _a[1];
try {
if (typeof listener === 'function') {
listener.call(undefined, event_1);
}
else {
listener[0].call(listener[1], event_1);
}
}
catch (e) {
Object(_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* onUnexpectedError */ "e"])(e);
}
}
}
};
Emitter.prototype.dispose = function () {
if (this._listeners) {
this._listeners.clear();
}
if (this._deliveryQueue) {
this._deliveryQueue.clear();
}
if (this._leakageMon) {
this._leakageMon.dispose();
}
this._disposed = true;
};
Emitter._noop = function () { };
return Emitter;
}());
var PauseableEmitter = /** @class */ (function (_super) {
__extends(PauseableEmitter, _super);
function PauseableEmitter(options) {
var _this = _super.call(this, options) || this;
_this._isPaused = 0;
_this._eventQueue = new _linkedList_js__WEBPACK_IMPORTED_MODULE_3__[/* LinkedList */ "a"]();
_this._mergeFn = options && options.merge;
return _this;
}
PauseableEmitter.prototype.pause = function () {
this._isPaused++;
};
PauseableEmitter.prototype.resume = function () {
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
var events = this._eventQueue.toArray();
this._eventQueue.clear();
_super.prototype.fire.call(this, 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.prototype.fire.call(this, this._eventQueue.shift());
}
}
}
};
PauseableEmitter.prototype.fire = function (event) {
if (this._listeners) {
if (this._isPaused !== 0) {
this._eventQueue.push(event);
}
else {
_super.prototype.fire.call(this, event);
}
}
};
return PauseableEmitter;
}(Emitter));
var EventMultiplexer = /** @class */ (function () {
function EventMultiplexer() {
var _this = this;
this.hasListeners = false;
this.events = [];
this.emitter = new Emitter({
onFirstListenerAdd: function () { return _this.onFirstListenerAdd(); },
onLastListenerRemove: function () { return _this.onLastListenerRemove(); }
});
}
Object.defineProperty(EventMultiplexer.prototype, "event", {
get: function () {
return this.emitter.event;
},
enumerable: true,
configurable: true
});
EventMultiplexer.prototype.add = function (event) {
var _this = this;
var e = { event: event, listener: null };
this.events.push(e);
if (this.hasListeners) {
this.hook(e);
}
var dispose = function () {
if (_this.hasListeners) {
_this.unhook(e);
}
var idx = _this.events.indexOf(e);
_this.events.splice(idx, 1);
};
return Object(_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* toDisposable */ "h"])(Object(_functional_js__WEBPACK_IMPORTED_MODULE_1__[/* once */ "a"])(dispose));
};
EventMultiplexer.prototype.onFirstListenerAdd = function () {
var _this = this;
this.hasListeners = true;
this.events.forEach(function (e) { return _this.hook(e); });
};
EventMultiplexer.prototype.onLastListenerRemove = function () {
var _this = this;
this.hasListeners = false;
this.events.forEach(function (e) { return _this.unhook(e); });
};
EventMultiplexer.prototype.hook = function (e) {
var _this = this;
e.listener = e.event(function (r) { return _this.emitter.fire(r); });
};
EventMultiplexer.prototype.unhook = function (e) {
if (e.listener) {
e.listener.dispose();
}
e.listener = null;
};
EventMultiplexer.prototype.dispose = function () {
this.emitter.dispose();
};
return EventMultiplexer;
}());
/**
* 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
* ```
*/
var EventBufferer = /** @class */ (function () {
function EventBufferer() {
this.buffers = [];
}
EventBufferer.prototype.wrapEvent = function (event) {
var _this = this;
return function (listener, thisArgs, disposables) {
return event(function (i) {
var buffer = _this.buffers[_this.buffers.length - 1];
if (buffer) {
buffer.push(function () { return listener.call(thisArgs, i); });
}
else {
listener.call(thisArgs, i);
}
}, undefined, disposables);
};
};
EventBufferer.prototype.bufferEvents = function (fn) {
var buffer = [];
this.buffers.push(buffer);
var r = fn();
this.buffers.pop();
buffer.forEach(function (flush) { return flush(); });
return r;
};
return EventBufferer;
}());
/**
* A Relay is an event forwarder which functions as a replugabble event pipe.
* Once created, you can connect an input event to it and it will simply forward
* events from that input event through its own `event` property. The `input`
* can be changed at any point in time.
*/
var Relay = /** @class */ (function () {
function Relay() {
var _this = this;
this.listening = false;
this.inputEvent = Event.None;
this.inputEventListener = _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"].None;
this.emitter = new Emitter({
onFirstListenerDidAdd: function () {
_this.listening = true;
_this.inputEventListener = _this.inputEvent(_this.emitter.fire, _this.emitter);
},
onLastListenerRemove: function () {
_this.listening = false;
_this.inputEventListener.dispose();
}
});
this.event = this.emitter.event;
}
Object.defineProperty(Relay.prototype, "input", {
set: function (event) {
this.inputEvent = event;
if (this.listening) {
this.inputEventListener.dispose();
this.inputEventListener = event(this.emitter.fire, this.emitter);
}
},
enumerable: true,
configurable: true
});
Relay.prototype.dispose = function () {
this.inputEventListener.dispose();
this.emitter.dispose();
};
return Relay;
}());
/***/ }),
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EditorContextKeys; });
/* harmony import */ var _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var EditorContextKeys;
(function (EditorContextKeys) {
EditorContextKeys.editorSimpleInput = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorSimpleInput', false);
/**
* A context key that is set when the editor's text has focus (cursor is blinking).
*/
EditorContextKeys.editorTextFocus = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorTextFocus', false);
/**
* A context key that is set when the editor's text or an editor's widget has focus.
*/
EditorContextKeys.focus = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorFocus', false);
/**
* A context key that is set when any editor input has focus (regular editor, repl input...).
*/
EditorContextKeys.textInputFocus = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('textInputFocus', false);
EditorContextKeys.readOnly = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorReadonly', false);
EditorContextKeys.writable = EditorContextKeys.readOnly.toNegated();
EditorContextKeys.hasNonEmptySelection = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasSelection', false);
EditorContextKeys.hasOnlyEmptySelection = EditorContextKeys.hasNonEmptySelection.toNegated();
EditorContextKeys.hasMultipleSelections = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasMultipleSelections', false);
EditorContextKeys.hasSingleSelection = EditorContextKeys.hasMultipleSelections.toNegated();
EditorContextKeys.tabMovesFocus = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorTabMovesFocus', false);
EditorContextKeys.tabDoesNotMoveFocus = EditorContextKeys.tabMovesFocus.toNegated();
EditorContextKeys.isInEmbeddedEditor = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('isInEmbeddedEditor', false);
EditorContextKeys.canUndo = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('canUndo', false);
EditorContextKeys.canRedo = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('canRedo', false);
// -- mode context keys
EditorContextKeys.languageId = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorLangId', '');
EditorContextKeys.hasCompletionItemProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasCompletionItemProvider', false);
EditorContextKeys.hasCodeActionsProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasCodeActionsProvider', false);
EditorContextKeys.hasCodeLensProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasCodeLensProvider', false);
EditorContextKeys.hasDefinitionProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDefinitionProvider', false);
EditorContextKeys.hasDeclarationProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDeclarationProvider', false);
EditorContextKeys.hasImplementationProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasImplementationProvider', false);
EditorContextKeys.hasTypeDefinitionProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasTypeDefinitionProvider', false);
EditorContextKeys.hasHoverProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasHoverProvider', false);
EditorContextKeys.hasDocumentHighlightProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDocumentHighlightProvider', false);
EditorContextKeys.hasDocumentSymbolProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDocumentSymbolProvider', false);
EditorContextKeys.hasReferenceProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasReferenceProvider', false);
EditorContextKeys.hasRenameProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasRenameProvider', false);
EditorContextKeys.hasSignatureHelpProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasSignatureHelpProvider', false);
// -- mode context keys: formatting
EditorContextKeys.hasDocumentFormattingProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDocumentFormattingProvider', false);
EditorContextKeys.hasDocumentSelectionFormattingProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasDocumentSelectionFormattingProvider', false);
EditorContextKeys.hasMultipleDocumentFormattingProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasMultipleDocumentFormattingProvider', false);
EditorContextKeys.hasMultipleDocumentSelectionFormattingProvider = new _platform_contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_0__[/* RawContextKey */ "d"]('editorHasMultipleDocumentSelectionFormattingProvider', false);
})(EditorContextKeys || (EditorContextKeys = {}));
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return isFalsyOrWhitespace; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return pad; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return format; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return escape; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return escapeRegExpCharacters; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return trim; });
/* unused harmony export ltrim */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return rtrim; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return convertSimple2RegExpPattern; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return startsWith; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return endsWith; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return createRegExp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return regExpLeadsToEndlessLoop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return regExpFlags; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return firstNonWhitespaceIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getLeadingWhitespace; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return lastNonWhitespaceIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return compare; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return compareIgnoreCase; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return isLowerAsciiLetter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isUpperAsciiLetter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return equalsIgnoreCase; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return startsWithIgnoreCase; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return commonPrefixLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return commonSuffixLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return isHighSurrogate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return isLowSurrogate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return getNextCodePoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return nextCharLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return prevCharLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return containsRTL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return containsEmoji; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return isBasicASCII; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return containsFullWidthCharacter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return isFullWidthCharacter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return isEmojiImprecise; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UTF8_BOM_CHARACTER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return startsWithUTF8BOM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return safeBtoa; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return repeat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return containsUppercaseCharacter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return singleLetterHash; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return getGraphemeBreakType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return breakBetweenGraphemeBreakType; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function isFalsyOrWhitespace(str) {
if (!str || typeof str !== 'string') {
return true;
}
return str.trim().length === 0;
}
/**
* @returns the provided number with the given number of preceding zeros.
*/
function pad(n, l, char) {
if (char === void 0) { char = '0'; }
var str = '' + n;
var r = [str];
for (var i = str.length; i < l; i++) {
r.push(char);
}
return r.reverse().join('');
}
var _formatRegexp = /{(\d+)}/g;
/**
* Helper to produce a string with a variable number of arguments. Insert variable segments
* into the string using the {n} notation where N is the index of the argument following the string.
* @param value string to which formatting is applied
* @param args replacements for {n}-entries
*/
function format(value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
if (args.length === 0) {
return value;
}
return value.replace(_formatRegexp, function (match, group) {
var idx = parseInt(group, 10);
return isNaN(idx) || idx < 0 || idx >= args.length ?
match :
args[idx];
});
}
/**
* Converts HTML characters inside the string to use entities instead. Makes the string safe from
* being used e.g. in HTMLElement.innerHTML.
*/
function escape(html) {
return html.replace(/[<>&]/g, function (match) {
switch (match) {
case '<': return '<';
case '>': return '>';
case '&': return '&';
default: return match;
}
});
}
/**
* Escapes regular expression characters in a given string
*/
function escapeRegExpCharacters(value) {
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&');
}
/**
* Removes all occurrences of needle from the beginning and end of haystack.
* @param haystack string to trim
* @param needle the thing to trim (default is a blank)
*/
function trim(haystack, needle) {
if (needle === void 0) { needle = ' '; }
var trimmed = ltrim(haystack, needle);
return rtrim(trimmed, needle);
}
/**
* Removes all occurrences of needle from the beginning of haystack.
* @param haystack string to trim
* @param needle the thing to trim
*/
function ltrim(haystack, needle) {
if (!haystack || !needle) {
return haystack;
}
var needleLen = needle.length;
if (needleLen === 0 || haystack.length === 0) {
return haystack;
}
var offset = 0;
while (haystack.indexOf(needle, offset) === offset) {
offset = offset + needleLen;
}
return haystack.substring(offset);
}
/**
* Removes all occurrences of needle from the end of haystack.
* @param haystack string to trim
* @param needle the thing to trim
*/
function rtrim(haystack, needle) {
if (!haystack || !needle) {
return haystack;
}
var needleLen = needle.length, haystackLen = haystack.length;
if (needleLen === 0 || haystackLen === 0) {
return haystack;
}
var 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, '.*');
}
/**
* Determines if haystack starts with needle.
*/
function startsWith(haystack, needle) {
if (haystack.length < needle.length) {
return false;
}
if (haystack === needle) {
return true;
}
for (var i = 0; i < needle.length; i++) {
if (haystack[i] !== needle[i]) {
return false;
}
}
return true;
}
/**
* Determines if haystack ends with needle.
*/
function endsWith(haystack, needle) {
var diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.indexOf(needle, diff) === diff;
}
else if (diff === 0) {
return haystack === needle;
}
else {
return false;
}
}
function createRegExp(searchString, isRegex, options) {
if (options === void 0) { options = {}; }
if (!searchString) {
throw new Error('Cannot create regex from empty string');
}
if (!isRegex) {
searchString = escapeRegExpCharacters(searchString);
}
if (options.wholeWord) {
if (!/\B/.test(searchString.charAt(0))) {
searchString = '\\b' + searchString;
}
if (!/\B/.test(searchString.charAt(searchString.length - 1))) {
searchString = searchString + '\\b';
}
}
var modifiers = '';
if (options.global) {
modifiers += 'g';
}
if (!options.matchCase) {
modifiers += 'i';
}
if (options.multiline) {
modifiers += 'm';
}
if (options.unicode) {
modifiers += 'u';
}
return new RegExp(searchString, modifiers);
}
function regExpLeadsToEndlessLoop(regexp) {
// Exit early if it's one of these special cases which are meant to match
// against an empty string
if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\s*$') {
return false;
}
// We check against an empty string. If the regular expression doesn't advance
// (e.g. ends in an endless loop) it will match an empty string.
var match = regexp.exec('');
return !!(match && regexp.lastIndex === 0);
}
function regExpFlags(regexp) {
return (regexp.global ? 'g' : '')
+ (regexp.ignoreCase ? 'i' : '')
+ (regexp.multiline ? 'm' : '')
+ (regexp.unicode ? 'u' : '');
}
/**
* Returns first index of the string that is not whitespace.
* If string is empty or contains only whitespaces, returns -1
*/
function firstNonWhitespaceIndex(str) {
for (var i = 0, len = str.length; i < len; i++) {
var chCode = str.charCodeAt(i);
if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {
return i;
}
}
return -1;
}
/**
* Returns the leading whitespace of the string.
* If the string contains only whitespaces, returns entire string
*/
function getLeadingWhitespace(str, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = str.length; }
for (var i = start; i < end; i++) {
var chCode = str.charCodeAt(i);
if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {
return str.substring(start, i);
}
}
return str.substring(start, end);
}
/**
* Returns last index of the string that is not whitespace.
* If string is empty or contains only whitespaces, returns -1
*/
function lastNonWhitespaceIndex(str, startIndex) {
if (startIndex === void 0) { startIndex = str.length - 1; }
for (var i = startIndex; i >= 0; i--) {
var chCode = str.charCodeAt(i);
if (chCode !== 32 /* Space */ && chCode !== 9 /* Tab */) {
return i;
}
}
return -1;
}
function compare(a, b) {
if (a < b) {
return -1;
}
else if (a > b) {
return 1;
}
else {
return 0;
}
}
function compareIgnoreCase(a, b) {
var len = Math.min(a.length, b.length);
for (var i = 0; i < len; i++) {
var codeA = a.charCodeAt(i);
var codeB = b.charCodeAt(i);
if (codeA === codeB) {
// equal
continue;
}
if (isUpperAsciiLetter(codeA)) {
codeA += 32;
}
if (isUpperAsciiLetter(codeB)) {
codeB += 32;
}
var diff = codeA - codeB;
if (diff === 0) {
// equal -> ignoreCase
continue;
}
else if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {
//
return diff;
}
else {
return compare(a.toLowerCase(), b.toLowerCase());
}
}
if (a.length < b.length) {
return -1;
}
else if (a.length > b.length) {
return 1;
}
else {
return 0;
}
}
function isLowerAsciiLetter(code) {
return code >= 97 /* a */ && code <= 122 /* z */;
}
function isUpperAsciiLetter(code) {
return code >= 65 /* A */ && code <= 90 /* Z */;
}
function isAsciiLetter(code) {
return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);
}
function equalsIgnoreCase(a, b) {
return a.length === b.length && doEqualsIgnoreCase(a, b);
}
function doEqualsIgnoreCase(a, b, stopAt) {
if (stopAt === void 0) { stopAt = a.length; }
for (var i = 0; i < stopAt; i++) {
var codeA = a.charCodeAt(i);
var codeB = b.charCodeAt(i);
if (codeA === codeB) {
continue;
}
// a-z A-Z
if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {
var diff = Math.abs(codeA - codeB);
if (diff !== 0 && diff !== 32) {
return false;
}
}
// Any other charcode
else {
if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {
return false;
}
}
}
return true;
}
function startsWithIgnoreCase(str, candidate) {
var candidateLength = candidate.length;
if (candidate.length > str.length) {
return false;
}
return doEqualsIgnoreCase(str, candidate, candidateLength);
}
/**
* @returns the length of the common prefix of the two strings.
*/
function commonPrefixLength(a, b) {
var i, len = Math.min(a.length, b.length);
for (i = 0; i < len; i++) {
if (a.charCodeAt(i) !== b.charCodeAt(i)) {
return i;
}
}
return len;
}
/**
* @returns the length of the common suffix of the two strings.
*/
function commonSuffixLength(a, b) {
var i, len = Math.min(a.length, b.length);
var aLastIndex = a.length - 1;
var bLastIndex = b.length - 1;
for (i = 0; i < len; i++) {
if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {
return i;
}
}
return len;
}
// --- unicode
// http://en.wikipedia.org/wiki/Surrogate_pair
// Returns the code point starting at a specified index in a string
// Code points U+0000 to U+D7FF and U+E000 to U+FFFF are represented on a single character
// Code points U+10000 to U+10FFFF are represented on two consecutive characters
//export function getUnicodePoint(str:string, index:number, len:number):number {
// const chrCode = str.charCodeAt(index);
// if (0xD800 <= chrCode && chrCode <= 0xDBFF && index + 1 < len) {
// const nextChrCode = str.charCodeAt(index + 1);
// if (0xDC00 <= nextChrCode && nextChrCode <= 0xDFFF) {
// return (chrCode - 0xD800) << 10 + (nextChrCode - 0xDC00) + 0x10000;
// }
// }
// return chrCode;
//}
function isHighSurrogate(charCode) {
return (0xD800 <= charCode && charCode <= 0xDBFF);
}
function isLowSurrogate(charCode) {
return (0xDC00 <= charCode && charCode <= 0xDFFF);
}
/**
* get the code point that begins at offset `offset`
*/
function getNextCodePoint(str, len, offset) {
var charCode = str.charCodeAt(offset);
if (isHighSurrogate(charCode) && offset + 1 < len) {
var nextCharCode = str.charCodeAt(offset + 1);
if (isLowSurrogate(nextCharCode)) {
return ((charCode - 0xD800) << 10) + (nextCharCode - 0xDC00) + 0x10000;
}
}
return charCode;
}
/**
* get the code point that ends right before offset `offset`
*/
function getPrevCodePoint(str, offset) {
var charCode = str.charCodeAt(offset - 1);
if (isLowSurrogate(charCode) && offset > 1) {
var prevCharCode = str.charCodeAt(offset - 2);
if (isHighSurrogate(prevCharCode)) {
return ((prevCharCode - 0xD800) << 10) + (charCode - 0xDC00) + 0x10000;
}
}
return charCode;
}
function nextCharLength(str, offset) {
var graphemeBreakTree = GraphemeBreakTree.getInstance();
var initialOffset = offset;
var len = str.length;
var initialCodePoint = getNextCodePoint(str, len, offset);
offset += (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
var graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
while (offset < len) {
var nextCodePoint = getNextCodePoint(str, len, offset);
var nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);
if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {
break;
}
offset += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
graphemeBreakType = nextGraphemeBreakType;
}
return (offset - initialOffset);
}
function prevCharLength(str, offset) {
var graphemeBreakTree = GraphemeBreakTree.getInstance();
var initialOffset = offset;
var initialCodePoint = getPrevCodePoint(str, offset);
offset -= (initialCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
var graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
while (offset > 0) {
var prevCodePoint = getPrevCodePoint(str, offset);
var prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint);
if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {
break;
}
offset -= (prevCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
graphemeBreakType = prevGraphemeBreakType;
}
return (initialOffset - offset);
}
/**
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-rtl-test.js
*/
var CONTAINS_RTL = /(?:[\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-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;
/**
* Returns true if `str` contains any Unicode character that is classified as "R" or "AL".
*/
function containsRTL(str) {
return CONTAINS_RTL.test(str);
}
/**
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js
*/
var CONTAINS_EMOJI = /(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;
function containsEmoji(str) {
return CONTAINS_EMOJI.test(str);
}
var IS_BASIC_ASCII = /^[\t\n\r\x20-\x7E]*$/;
/**
* Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \n, \r, \t
*/
function isBasicASCII(str) {
return IS_BASIC_ASCII.test(str);
}
function containsFullWidthCharacter(str) {
for (var i = 0, len = str.length; i < len; i++) {
if (isFullWidthCharacter(str.charCodeAt(i))) {
return true;
}
}
return false;
}
function isFullWidthCharacter(charCode) {
// Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns
// http://jrgraphix.net/research/unicode_blocks.php
// 2E80 — 2EFF CJK Radicals Supplement
// 2F00 — 2FDF Kangxi Radicals
// 2FF0 — 2FFF Ideographic Description Characters
// 3000 — 303F CJK Symbols and Punctuation
// 3040 — 309F Hiragana
// 30A0 — 30FF Katakana
// 3100 — 312F Bopomofo
// 3130 — 318F Hangul Compatibility Jamo
// 3190 — 319F Kanbun
// 31A0 — 31BF Bopomofo Extended
// 31F0 — 31FF Katakana Phonetic Extensions
// 3200 — 32FF Enclosed CJK Letters and Months
// 3300 — 33FF CJK Compatibility
// 3400 — 4DBF CJK Unified Ideographs Extension A
// 4DC0 — 4DFF Yijing Hexagram Symbols
// 4E00 — 9FFF CJK Unified Ideographs
// A000 — A48F Yi Syllables
// A490 — A4CF Yi Radicals
// AC00 — D7AF Hangul Syllables
// [IGNORE] D800 — DB7F High Surrogates
// [IGNORE] DB80 — DBFF High Private Use Surrogates
// [IGNORE] DC00 — DFFF Low Surrogates
// [IGNORE] E000 — F8FF Private Use Area
// F900 — FAFF CJK Compatibility Ideographs
// [IGNORE] FB00 — FB4F Alphabetic Presentation Forms
// [IGNORE] FB50 — FDFF Arabic Presentation Forms-A
// [IGNORE] FE00 — FE0F Variation Selectors
// [IGNORE] FE20 — FE2F Combining Half Marks
// [IGNORE] FE30 — FE4F CJK Compatibility Forms
// [IGNORE] FE50 — FE6F Small Form Variants
// [IGNORE] FE70 — FEFF Arabic Presentation Forms-B
// FF00 — FFEF Halfwidth and Fullwidth Forms
// [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]
// of which FF01 - FF5E fullwidth ASCII of 21 to 7E
// [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul
// [IGNORE] FFF0 — FFFF Specials
charCode = +charCode; // @perf
return ((charCode >= 0x2E80 && charCode <= 0xD7AF)
|| (charCode >= 0xF900 && charCode <= 0xFAFF)
|| (charCode >= 0xFF01 && charCode <= 0xFF5E));
}
/**
* A fast function (therefore imprecise) to check if code points are emojis.
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js
*/
function isEmojiImprecise(x) {
return ((x >= 0x1F1E6 && x <= 0x1F1FF) || (x >= 9728 && x <= 10175) || (x >= 127744 && x <= 128591)
|| (x >= 128640 && x <= 128764) || (x >= 128992 && x <= 129003) || (x >= 129280 && x <= 129535)
|| (x >= 129648 && x <= 129651) || (x >= 129656 && x <= 129666) || (x >= 129680 && x <= 129685));
}
// -- UTF-8 BOM
var UTF8_BOM_CHARACTER = String.fromCharCode(65279 /* UTF8_BOM */);
function startsWithUTF8BOM(str) {
return !!(str && str.length > 0 && str.charCodeAt(0) === 65279 /* UTF8_BOM */);
}
function safeBtoa(str) {
return btoa(encodeURIComponent(str)); // we use encodeURIComponent because btoa fails for non Latin 1 values
}
function repeat(s, count) {
var result = '';
for (var i = 0; i < count; i++) {
result += s;
}
return result;
}
function containsUppercaseCharacter(target, ignoreEscapedChars) {
if (ignoreEscapedChars === void 0) { ignoreEscapedChars = false; }
if (!target) {
return false;
}
if (ignoreEscapedChars) {
target = target.replace(/\\./g, '');
}
return target.toLowerCase() !== target;
}
/**
* Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.
*/
function singleLetterHash(n) {
var LETTERS_CNT = (90 /* Z */ - 65 /* A */ + 1);
n = n % (2 * LETTERS_CNT);
if (n < LETTERS_CNT) {
return String.fromCharCode(97 /* a */ + n);
}
return String.fromCharCode(65 /* A */ + n - LETTERS_CNT);
}
//#region Unicode Grapheme Break
function getGraphemeBreakType(codePoint) {
var graphemeBreakTree = GraphemeBreakTree.getInstance();
return graphemeBreakTree.getGraphemeBreakType(codePoint);
}
function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {
// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules
// !!! Let's make the common case a bit faster
if (breakTypeA === 0 /* Other */) {
// see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table
return (breakTypeB !== 5 /* Extend */ && breakTypeB !== 7 /* SpacingMark */);
}
// Do not break between a CR and LF. Otherwise, break before and after controls.
// GB3 CR × LF
// GB4 (Control | CR | LF) ÷
// GB5 ÷ (Control | CR | LF)
if (breakTypeA === 2 /* CR */) {
if (breakTypeB === 3 /* LF */) {
return false; // GB3
}
}
if (breakTypeA === 4 /* Control */ || breakTypeA === 2 /* CR */ || breakTypeA === 3 /* LF */) {
return true; // GB4
}
if (breakTypeB === 4 /* Control */ || breakTypeB === 2 /* CR */ || breakTypeB === 3 /* LF */) {
return true; // GB5
}
// Do not break Hangul syllable sequences.
// GB6 L × (L | V | LV | LVT)
// GB7 (LV | V) × (V | T)
// GB8 (LVT | T) × T
if (breakTypeA === 8 /* L */) {
if (breakTypeB === 8 /* L */ || breakTypeB === 9 /* V */ || breakTypeB === 11 /* LV */ || breakTypeB === 12 /* LVT */) {
return false; // GB6
}
}
if (breakTypeA === 11 /* LV */ || breakTypeA === 9 /* V */) {
if (breakTypeB === 9 /* V */ || breakTypeB === 10 /* T */) {
return false; // GB7
}
}
if (breakTypeA === 12 /* LVT */ || breakTypeA === 10 /* T */) {
if (breakTypeB === 10 /* T */) {
return false; // GB8
}
}
// Do not break before extending characters or ZWJ.
// GB9 × (Extend | ZWJ)
if (breakTypeB === 5 /* Extend */ || breakTypeB === 13 /* ZWJ */) {
return false; // GB9
}
// The GB9a and GB9b rules only apply to extended grapheme clusters:
// Do not break before SpacingMarks, or after Prepend characters.
// GB9a × SpacingMark
// GB9b Prepend ×
if (breakTypeB === 7 /* SpacingMark */) {
return false; // GB9a
}
if (breakTypeA === 1 /* Prepend */) {
return false; // GB9b
}
// Do not break within emoji modifier sequences or emoji zwj sequences.
// GB11 \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic}
if (breakTypeA === 13 /* ZWJ */ && breakTypeB === 14 /* Extended_Pictographic */) {
// Note: we are not implementing the rule entirely here to avoid introducing states
return false; // GB11
}
// GB12 sot (RI RI)* RI × RI
// GB13 [^RI] (RI RI)* RI × RI
if (breakTypeA === 6 /* Regional_Indicator */ && breakTypeB === 6 /* Regional_Indicator */) {
// Note: we are not implementing the rule entirely here to avoid introducing states
return false; // GB12 & GB13
}
// GB999 Any ÷ Any
return true;
}
var GraphemeBreakTree = /** @class */ (function () {
function GraphemeBreakTree() {
this._data = getGraphemeBreakRawData();
}
GraphemeBreakTree.getInstance = function () {
if (!GraphemeBreakTree._INSTANCE) {
GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();
}
return GraphemeBreakTree._INSTANCE;
};
GraphemeBreakTree.prototype.getGraphemeBreakType = function (codePoint) {
// !!! Let's make 7bit ASCII a bit faster: 0..31
if (codePoint < 32) {
if (codePoint === 10 /* LineFeed */) {
return 3 /* LF */;
}
if (codePoint === 13 /* CarriageReturn */) {
return 2 /* CR */;
}
return 4 /* Control */;
}
// !!! Let's make 7bit ASCII a bit faster: 32..126
if (codePoint < 127) {
return 0 /* Other */;
}
var data = this._data;
var nodeCount = data.length / 3;
var nodeIndex = 1;
while (nodeIndex <= nodeCount) {
if (codePoint < data[3 * nodeIndex]) {
// go left
nodeIndex = 2 * nodeIndex;
}
else if (codePoint > data[3 * nodeIndex + 1]) {
// go right
nodeIndex = 2 * nodeIndex + 1;
}
else {
// hit
return data[3 * nodeIndex + 2];
}
}
return 0 /* Other */;
};
GraphemeBreakTree._INSTANCE = null;
return GraphemeBreakTree;
}());
function getGraphemeBreakRawData() {
// generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-grapheme-break.js
return JSON.parse('[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,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,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,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,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,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,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,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,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,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,2259,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,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,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,6848,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,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,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,9776,9783,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,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,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,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,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]');
}
//#endregion
/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Position; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* A position in the editor.
*/
var Position = /** @class */ (function () {
function Position(lineNumber, column) {
this.lineNumber = lineNumber;
this.column = column;
}
/**
* Create a new position from this position.
*
* @param newLineNumber new line number
* @param newColumn new column
*/
Position.prototype.with = function (newLineNumber, newColumn) {
if (newLineNumber === void 0) { newLineNumber = this.lineNumber; }
if (newColumn === void 0) { 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
*/
Position.prototype.delta = function (deltaLineNumber, deltaColumn) {
if (deltaLineNumber === void 0) { deltaLineNumber = 0; }
if (deltaColumn === void 0) { deltaColumn = 0; }
return this.with(this.lineNumber + deltaLineNumber, this.column + deltaColumn);
};
/**
* Test if this position equals other position
*/
Position.prototype.equals = function (other) {
return Position.equals(this, other);
};
/**
* Test if position `a` equals position `b`
*/
Position.equals = function (a, b) {
if (!a && !b) {
return true;
}
return (!!a &&
!!b &&
a.lineNumber === b.lineNumber &&
a.column === b.column);
};
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be false.
*/
Position.prototype.isBefore = function (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.
*/
Position.isBefore = function (a, b) {
if (a.lineNumber < b.lineNumber) {
return true;
}
if (b.lineNumber < a.lineNumber) {
return false;
}
return a.column < b.column;
};
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be true.
*/
Position.prototype.isBeforeOrEqual = function (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.
*/
Position.isBeforeOrEqual = function (a, b) {
if (a.lineNumber < b.lineNumber) {
return true;
}
if (b.lineNumber < a.lineNumber) {
return false;
}
return a.column <= b.column;
};
/**
* A function that compares positions, useful for sorting
*/
Position.compare = function (a, b) {
var aLineNumber = a.lineNumber | 0;
var bLineNumber = b.lineNumber | 0;
if (aLineNumber === bLineNumber) {
var aColumn = a.column | 0;
var bColumn = b.column | 0;
return aColumn - bColumn;
}
return aLineNumber - bLineNumber;
};
/**
* Clone this position.
*/
Position.prototype.clone = function () {
return new Position(this.lineNumber, this.column);
};
/**
* Convert to a human-readable representation.
*/
Position.prototype.toString = function () {
return '(' + this.lineNumber + ',' + this.column + ')';
};
// ---
/**
* Create a `Position` from an `IPosition`.
*/
Position.lift = function (pos) {
return new Position(pos.lineNumber, pos.column);
};
/**
* Test if `obj` is an `IPosition`.
*/
Position.isIPosition = function (obj) {
return (obj
&& (typeof obj.lineNumber === 'number')
&& (typeof obj.column === 'number'));
};
return Position;
}());
/***/ }),
/* 13 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ContextKeyExpr; });
/* unused harmony export ContextKeyDefinedExpr */
/* unused harmony export ContextKeyEqualsExpr */
/* unused harmony export ContextKeyNotEqualsExpr */
/* unused harmony export ContextKeyNotExpr */
/* unused harmony export ContextKeyRegexExpr */
/* unused harmony export ContextKeyNotRegexExpr */
/* unused harmony export ContextKeyAndExpr */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ContextKeyOrExpr; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return RawContextKey; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return IContextKeyService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return SET_CONTEXT_COMMAND_ID; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ContextKeyExpr = /** @class */ (function () {
function ContextKeyExpr() {
}
ContextKeyExpr.has = function (key) {
return ContextKeyDefinedExpr.create(key);
};
ContextKeyExpr.equals = function (key, value) {
return ContextKeyEqualsExpr.create(key, value);
};
ContextKeyExpr.regex = function (key, value) {
return ContextKeyRegexExpr.create(key, value);
};
ContextKeyExpr.not = function (key) {
return ContextKeyNotExpr.create(key);
};
ContextKeyExpr.and = function () {
var expr = [];
for (var _i = 0; _i < arguments.length; _i++) {
expr[_i] = arguments[_i];
}
return ContextKeyAndExpr.create(expr);
};
ContextKeyExpr.or = function () {
var expr = [];
for (var _i = 0; _i < arguments.length; _i++) {
expr[_i] = arguments[_i];
}
return ContextKeyOrExpr.create(expr);
};
ContextKeyExpr.deserialize = function (serialized, strict) {
if (strict === void 0) { strict = false; }
if (!serialized) {
return undefined;
}
return this._deserializeOrExpression(serialized, strict);
};
ContextKeyExpr._deserializeOrExpression = function (serialized, strict) {
var _this = this;
var pieces = serialized.split('||');
return ContextKeyOrExpr.create(pieces.map(function (p) { return _this._deserializeAndExpression(p, strict); }));
};
ContextKeyExpr._deserializeAndExpression = function (serialized, strict) {
var _this = this;
var pieces = serialized.split('&&');
return ContextKeyAndExpr.create(pieces.map(function (p) { return _this._deserializeOne(p, strict); }));
};
ContextKeyExpr._deserializeOne = function (serializedOne, strict) {
serializedOne = serializedOne.trim();
if (serializedOne.indexOf('!=') >= 0) {
var pieces = serializedOne.split('!=');
return ContextKeyNotEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));
}
if (serializedOne.indexOf('==') >= 0) {
var pieces = serializedOne.split('==');
return ContextKeyEqualsExpr.create(pieces[0].trim(), this._deserializeValue(pieces[1], strict));
}
if (serializedOne.indexOf('=~') >= 0) {
var pieces = serializedOne.split('=~');
return ContextKeyRegexExpr.create(pieces[0].trim(), this._deserializeRegexValue(pieces[1], strict));
}
if (/^\!\s*/.test(serializedOne)) {
return ContextKeyNotExpr.create(serializedOne.substr(1).trim());
}
return ContextKeyDefinedExpr.create(serializedOne);
};
ContextKeyExpr._deserializeValue = function (serializedValue, strict) {
serializedValue = serializedValue.trim();
if (serializedValue === 'true') {
return true;
}
if (serializedValue === 'false') {
return false;
}
var m = /^'([^']*)'$/.exec(serializedValue);
if (m) {
return m[1].trim();
}
return serializedValue;
};
ContextKeyExpr._deserializeRegexValue = function (serializedValue, strict) {
if (Object(_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isFalsyOrWhitespace */ "x"])(serializedValue)) {
if (strict) {
throw new Error('missing regexp-value for =~-expression');
}
else {
console.warn('missing regexp-value for =~-expression');
}
return null;
}
var start = serializedValue.indexOf('/');
var end = serializedValue.lastIndexOf('/');
if (start === end || start < 0 /* || to < 0 */) {
if (strict) {
throw new Error("bad regexp-value '" + serializedValue + "', missing /-enclosure");
}
else {
console.warn("bad regexp-value '" + serializedValue + "', missing /-enclosure");
}
return null;
}
var value = serializedValue.slice(start + 1, end);
var caseIgnoreFlag = serializedValue[end + 1] === 'i' ? 'i' : '';
try {
return new RegExp(value, caseIgnoreFlag);
}
catch (e) {
if (strict) {
throw new Error("bad regexp-value '" + serializedValue + "', parse error: " + e);
}
else {
console.warn("bad regexp-value '" + serializedValue + "', parse error: " + e);
}
return null;
}
};
return ContextKeyExpr;
}());
function cmp(a, b) {
var aType = a.getType();
var bType = b.getType();
if (aType !== bType) {
return aType - bType;
}
switch (aType) {
case 1 /* Defined */:
return a.cmp(b);
case 2 /* Not */:
return a.cmp(b);
case 3 /* Equals */:
return a.cmp(b);
case 4 /* NotEquals */:
return a.cmp(b);
case 6 /* Regex */:
return a.cmp(b);
case 7 /* NotRegex */:
return a.cmp(b);
case 5 /* And */:
return a.cmp(b);
default:
throw new Error('Unknown ContextKeyExpr!');
}
}
var ContextKeyDefinedExpr = /** @class */ (function () {
function ContextKeyDefinedExpr(key) {
this.key = key;
}
ContextKeyDefinedExpr.create = function (key) {
return new ContextKeyDefinedExpr(key);
};
ContextKeyDefinedExpr.prototype.getType = function () {
return 1 /* Defined */;
};
ContextKeyDefinedExpr.prototype.cmp = function (other) {
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
return 0;
};
ContextKeyDefinedExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyDefinedExpr) {
return (this.key === other.key);
}
return false;
};
ContextKeyDefinedExpr.prototype.evaluate = function (context) {
return (!!context.getValue(this.key));
};
ContextKeyDefinedExpr.prototype.keys = function () {
return [this.key];
};
ContextKeyDefinedExpr.prototype.negate = function () {
return ContextKeyNotExpr.create(this.key);
};
return ContextKeyDefinedExpr;
}());
var ContextKeyEqualsExpr = /** @class */ (function () {
function ContextKeyEqualsExpr(key, value) {
this.key = key;
this.value = value;
}
ContextKeyEqualsExpr.create = function (key, value) {
if (typeof value === 'boolean') {
if (value) {
return ContextKeyDefinedExpr.create(key);
}
return ContextKeyNotExpr.create(key);
}
return new ContextKeyEqualsExpr(key, value);
};
ContextKeyEqualsExpr.prototype.getType = function () {
return 3 /* Equals */;
};
ContextKeyEqualsExpr.prototype.cmp = function (other) {
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
if (this.value < other.value) {
return -1;
}
if (this.value > other.value) {
return 1;
}
return 0;
};
ContextKeyEqualsExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyEqualsExpr) {
return (this.key === other.key && this.value === other.value);
}
return false;
};
ContextKeyEqualsExpr.prototype.evaluate = function (context) {
// Intentional ==
// eslint-disable-next-line eqeqeq
return (context.getValue(this.key) == this.value);
};
ContextKeyEqualsExpr.prototype.keys = function () {
return [this.key];
};
ContextKeyEqualsExpr.prototype.negate = function () {
return ContextKeyNotEqualsExpr.create(this.key, this.value);
};
return ContextKeyEqualsExpr;
}());
var ContextKeyNotEqualsExpr = /** @class */ (function () {
function ContextKeyNotEqualsExpr(key, value) {
this.key = key;
this.value = value;
}
ContextKeyNotEqualsExpr.create = function (key, value) {
if (typeof value === 'boolean') {
if (value) {
return ContextKeyNotExpr.create(key);
}
return ContextKeyDefinedExpr.create(key);
}
return new ContextKeyNotEqualsExpr(key, value);
};
ContextKeyNotEqualsExpr.prototype.getType = function () {
return 4 /* NotEquals */;
};
ContextKeyNotEqualsExpr.prototype.cmp = function (other) {
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
if (this.value < other.value) {
return -1;
}
if (this.value > other.value) {
return 1;
}
return 0;
};
ContextKeyNotEqualsExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyNotEqualsExpr) {
return (this.key === other.key && this.value === other.value);
}
return false;
};
ContextKeyNotEqualsExpr.prototype.evaluate = function (context) {
// Intentional !=
// eslint-disable-next-line eqeqeq
return (context.getValue(this.key) != this.value);
};
ContextKeyNotEqualsExpr.prototype.keys = function () {
return [this.key];
};
ContextKeyNotEqualsExpr.prototype.negate = function () {
return ContextKeyEqualsExpr.create(this.key, this.value);
};
return ContextKeyNotEqualsExpr;
}());
var ContextKeyNotExpr = /** @class */ (function () {
function ContextKeyNotExpr(key) {
this.key = key;
}
ContextKeyNotExpr.create = function (key) {
return new ContextKeyNotExpr(key);
};
ContextKeyNotExpr.prototype.getType = function () {
return 2 /* Not */;
};
ContextKeyNotExpr.prototype.cmp = function (other) {
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
return 0;
};
ContextKeyNotExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyNotExpr) {
return (this.key === other.key);
}
return false;
};
ContextKeyNotExpr.prototype.evaluate = function (context) {
return (!context.getValue(this.key));
};
ContextKeyNotExpr.prototype.keys = function () {
return [this.key];
};
ContextKeyNotExpr.prototype.negate = function () {
return ContextKeyDefinedExpr.create(this.key);
};
return ContextKeyNotExpr;
}());
var ContextKeyRegexExpr = /** @class */ (function () {
function ContextKeyRegexExpr(key, regexp) {
this.key = key;
this.regexp = regexp;
//
}
ContextKeyRegexExpr.create = function (key, regexp) {
return new ContextKeyRegexExpr(key, regexp);
};
ContextKeyRegexExpr.prototype.getType = function () {
return 6 /* Regex */;
};
ContextKeyRegexExpr.prototype.cmp = function (other) {
if (this.key < other.key) {
return -1;
}
if (this.key > other.key) {
return 1;
}
var thisSource = this.regexp ? this.regexp.source : '';
var otherSource = other.regexp ? other.regexp.source : '';
if (thisSource < otherSource) {
return -1;
}
if (thisSource > otherSource) {
return 1;
}
return 0;
};
ContextKeyRegexExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyRegexExpr) {
var thisSource = this.regexp ? this.regexp.source : '';
var otherSource = other.regexp ? other.regexp.source : '';
return (this.key === other.key && thisSource === otherSource);
}
return false;
};
ContextKeyRegexExpr.prototype.evaluate = function (context) {
var value = context.getValue(this.key);
return this.regexp ? this.regexp.test(value) : false;
};
ContextKeyRegexExpr.prototype.keys = function () {
return [this.key];
};
ContextKeyRegexExpr.prototype.negate = function () {
return ContextKeyNotRegexExpr.create(this);
};
return ContextKeyRegexExpr;
}());
var ContextKeyNotRegexExpr = /** @class */ (function () {
function ContextKeyNotRegexExpr(_actual) {
this._actual = _actual;
//
}
ContextKeyNotRegexExpr.create = function (actual) {
return new ContextKeyNotRegexExpr(actual);
};
ContextKeyNotRegexExpr.prototype.getType = function () {
return 7 /* NotRegex */;
};
ContextKeyNotRegexExpr.prototype.cmp = function (other) {
return this._actual.cmp(other._actual);
};
ContextKeyNotRegexExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyNotRegexExpr) {
return this._actual.equals(other._actual);
}
return false;
};
ContextKeyNotRegexExpr.prototype.evaluate = function (context) {
return !this._actual.evaluate(context);
};
ContextKeyNotRegexExpr.prototype.keys = function () {
return this._actual.keys();
};
ContextKeyNotRegexExpr.prototype.negate = function () {
return this._actual;
};
return ContextKeyNotRegexExpr;
}());
var ContextKeyAndExpr = /** @class */ (function () {
function ContextKeyAndExpr(expr) {
this.expr = expr;
}
ContextKeyAndExpr.create = function (_expr) {
var expr = ContextKeyAndExpr._normalizeArr(_expr);
if (expr.length === 0) {
return undefined;
}
if (expr.length === 1) {
return expr[0];
}
return new ContextKeyAndExpr(expr);
};
ContextKeyAndExpr.prototype.getType = function () {
return 5 /* And */;
};
ContextKeyAndExpr.prototype.cmp = function (other) {
if (this.expr.length < other.expr.length) {
return -1;
}
if (this.expr.length > other.expr.length) {
return 1;
}
for (var i = 0, len = this.expr.length; i < len; i++) {
var r = cmp(this.expr[i], other.expr[i]);
if (r !== 0) {
return r;
}
}
return 0;
};
ContextKeyAndExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyAndExpr) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (var i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
}
return false;
};
ContextKeyAndExpr.prototype.evaluate = function (context) {
for (var i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].evaluate(context)) {
return false;
}
}
return true;
};
ContextKeyAndExpr._normalizeArr = function (arr) {
var expr = [];
if (arr) {
for (var i = 0, len = arr.length; i < len; i++) {
var e = arr[i];
if (!e) {
continue;
}
if (e instanceof ContextKeyAndExpr) {
expr = expr.concat(e.expr);
continue;
}
if (e instanceof ContextKeyOrExpr) {
// Not allowed, because we don't have parens!
throw new Error("It is not allowed to have an or expression here due to lack of parens! For example \"a && (b||c)\" is not supported, use \"(a&&b) || (a&&c)\" instead.");
}
expr.push(e);
}
expr.sort(cmp);
}
return expr;
};
ContextKeyAndExpr.prototype.keys = function () {
var result = [];
for (var _i = 0, _a = this.expr; _i < _a.length; _i++) {
var expr = _a[_i];
result.push.apply(result, expr.keys());
}
return result;
};
ContextKeyAndExpr.prototype.negate = function () {
var result = [];
for (var _i = 0, _a = this.expr; _i < _a.length; _i++) {
var expr = _a[_i];
result.push(expr.negate());
}
return ContextKeyOrExpr.create(result);
};
return ContextKeyAndExpr;
}());
var ContextKeyOrExpr = /** @class */ (function () {
function ContextKeyOrExpr(expr) {
this.expr = expr;
}
ContextKeyOrExpr.create = function (_expr) {
var expr = ContextKeyOrExpr._normalizeArr(_expr);
if (expr.length === 0) {
return undefined;
}
if (expr.length === 1) {
return expr[0];
}
return new ContextKeyOrExpr(expr);
};
ContextKeyOrExpr.prototype.getType = function () {
return 8 /* Or */;
};
ContextKeyOrExpr.prototype.equals = function (other) {
if (other instanceof ContextKeyOrExpr) {
if (this.expr.length !== other.expr.length) {
return false;
}
for (var i = 0, len = this.expr.length; i < len; i++) {
if (!this.expr[i].equals(other.expr[i])) {
return false;
}
}
return true;
}
return false;
};
ContextKeyOrExpr.prototype.evaluate = function (context) {
for (var i = 0, len = this.expr.length; i < len; i++) {
if (this.expr[i].evaluate(context)) {
return true;
}
}
return false;
};
ContextKeyOrExpr._normalizeArr = function (arr) {
var expr = [];
if (arr) {
for (var i = 0, len = arr.length; i < len; i++) {
var e = arr[i];
if (!e) {
continue;
}
if (e instanceof ContextKeyOrExpr) {
expr = expr.concat(e.expr);
continue;
}
expr.push(e);
}
expr.sort(cmp);
}
return expr;
};
ContextKeyOrExpr.prototype.keys = function () {
var result = [];
for (var _i = 0, _a = this.expr; _i < _a.length; _i++) {
var expr = _a[_i];
result.push.apply(result, expr.keys());
}
return result;
};
ContextKeyOrExpr.prototype.negate = function () {
var result = [];
for (var _i = 0, _a = this.expr; _i < _a.length; _i++) {
var expr = _a[_i];
result.push(expr.negate());
}
var terminals = function (node) {
if (node instanceof ContextKeyOrExpr) {
return node.expr;
}
return [node];
};
// We don't support parens, so here we distribute the AND over the OR terminals
// We always take the first 2 AND pairs and distribute them
while (result.length > 1) {
var LEFT = result.shift();
var RIGHT = result.shift();
var all = [];
for (var _b = 0, _c = terminals(LEFT); _b < _c.length; _b++) {
var left = _c[_b];
for (var _d = 0, _e = terminals(RIGHT); _d < _e.length; _d++) {
var right = _e[_d];
all.push(ContextKeyExpr.and(left, right));
}
}
result.unshift(ContextKeyExpr.or.apply(ContextKeyExpr, all));
}
return result[0];
};
return ContextKeyOrExpr;
}());
var RawContextKey = /** @class */ (function (_super) {
__extends(RawContextKey, _super);
function RawContextKey(key, defaultValue) {
var _this = _super.call(this, key) || this;
_this._defaultValue = defaultValue;
return _this;
}
RawContextKey.prototype.bindTo = function (target) {
return target.createKey(this.key, this._defaultValue);
};
RawContextKey.prototype.getValue = function (target) {
return target.getContextKeyValue(this.key);
};
RawContextKey.prototype.toNegated = function () {
return ContextKeyExpr.not(this.key);
};
return RawContextKey;
}(ContextKeyDefinedExpr));
var IContextKeyService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__[/* createDecorator */ "c"])('contextKeyService');
var SET_CONTEXT_COMMAND_ID = 'setContext';
/***/ }),
/* 14 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "r", function() { return /* binding */ LanguageIdentifier; });
__webpack_require__.d(__webpack_exports__, "A", function() { return /* binding */ TokenMetadata; });
__webpack_require__.d(__webpack_exports__, "F", function() { return /* binding */ completionKindToCssClass; });
__webpack_require__.d(__webpack_exports__, "E", function() { return /* binding */ completionKindFromString; });
__webpack_require__.d(__webpack_exports__, "y", function() { return /* binding */ SignatureHelpTriggerKind; });
__webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ DocumentHighlightKind; });
__webpack_require__.d(__webpack_exports__, "G", function() { return /* binding */ isLocationLink; });
__webpack_require__.d(__webpack_exports__, "z", function() { return /* binding */ SymbolKinds; });
__webpack_require__.d(__webpack_exports__, "n", function() { return /* binding */ FoldingRangeKind; });
__webpack_require__.d(__webpack_exports__, "D", function() { return /* binding */ modes_WorkspaceTextEdit; });
__webpack_require__.d(__webpack_exports__, "u", function() { return /* binding */ ReferenceProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "v", function() { return /* binding */ RenameProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ CompletionProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "x", function() { return /* binding */ SignatureHelpProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "p", function() { return /* binding */ HoverProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "m", function() { return /* binding */ DocumentSymbolProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "i", function() { return /* binding */ DocumentHighlightProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ DefinitionProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ DeclarationProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "q", function() { return /* binding */ ImplementationProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "C", function() { return /* binding */ TypeDefinitionProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ CodeLensProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ CodeActionProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ DocumentFormattingEditProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "j", function() { return /* binding */ DocumentRangeFormattingEditProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "t", function() { return /* binding */ OnTypeFormattingEditProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "s", function() { return /* binding */ LinkProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ ColorProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "w", function() { return /* binding */ SelectionRangeRegistry; });
__webpack_require__.d(__webpack_exports__, "o", function() { return /* binding */ FoldingRangeProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "l", function() { return /* binding */ DocumentSemanticTokensProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "k", function() { return /* binding */ DocumentRangeSemanticTokensProviderRegistry; });
__webpack_require__.d(__webpack_exports__, "B", function() { return /* binding */ TokenizationRegistry; });
// UNUSED EXPORTS: WorkspaceFileEdit
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/uri.js
var uri = __webpack_require__(27);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var range = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/glob.js
var glob = __webpack_require__(231);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageSelector.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function score(selector, candidateUri, candidateLanguage, candidateIsSynchronized) {
if (Array.isArray(selector)) {
// array -> take max individual value
var ret = 0;
for (var _i = 0, selector_1 = selector; _i < selector_1.length; _i++) {
var filter = selector_1[_i];
var value = score(filter, candidateUri, candidateLanguage, candidateIsSynchronized);
if (value === 10) {
return value; // already at the highest
}
if (value > ret) {
ret = value;
}
}
return ret;
}
else if (typeof selector === 'string') {
if (!candidateIsSynchronized) {
return 0;
}
// short-hand notion, desugars to
// 'fooLang' -> { language: 'fooLang'}
// '*' -> { language: '*' }
if (selector === '*') {
return 5;
}
else if (selector === candidateLanguage) {
return 10;
}
else {
return 0;
}
}
else if (selector) {
// filter -> select accordingly, use defaults for scheme
var language = selector.language, pattern = selector.pattern, scheme = selector.scheme, hasAccessToAllModels = selector.hasAccessToAllModels;
if (!candidateIsSynchronized && !hasAccessToAllModels) {
return 0;
}
var ret = 0;
if (scheme) {
if (scheme === candidateUri.scheme) {
ret = 10;
}
else if (scheme === '*') {
ret = 5;
}
else {
return 0;
}
}
if (language) {
if (language === candidateLanguage) {
ret = 10;
}
else if (language === '*') {
ret = Math.max(ret, 5);
}
else {
return 0;
}
}
if (pattern) {
if (pattern === candidateUri.fsPath || Object(glob["a" /* match */])(pattern, candidateUri.fsPath)) {
ret = 10;
}
else {
return 0;
}
}
return ret;
}
else {
return 0;
}
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js
var modelService = __webpack_require__(58);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageFeatureRegistry.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function isExclusive(selector) {
if (typeof selector === 'string') {
return false;
}
else if (Array.isArray(selector)) {
return selector.every(isExclusive);
}
else {
return !!selector.exclusive;
}
}
var languageFeatureRegistry_LanguageFeatureRegistry = /** @class */ (function () {
function LanguageFeatureRegistry() {
this._clock = 0;
this._entries = [];
this._onDidChange = new common_event["a" /* Emitter */]();
}
Object.defineProperty(LanguageFeatureRegistry.prototype, "onDidChange", {
get: function () {
return this._onDidChange.event;
},
enumerable: true,
configurable: true
});
LanguageFeatureRegistry.prototype.register = function (selector, provider) {
var _this = this;
var entry = {
selector: selector,
provider: provider,
_score: -1,
_time: this._clock++
};
this._entries.push(entry);
this._lastCandidate = undefined;
this._onDidChange.fire(this._entries.length);
return Object(lifecycle["h" /* toDisposable */])(function () {
if (entry) {
var idx = _this._entries.indexOf(entry);
if (idx >= 0) {
_this._entries.splice(idx, 1);
_this._lastCandidate = undefined;
_this._onDidChange.fire(_this._entries.length);
entry = undefined;
}
}
});
};
LanguageFeatureRegistry.prototype.has = function (model) {
return this.all(model).length > 0;
};
LanguageFeatureRegistry.prototype.all = function (model) {
if (!model) {
return [];
}
this._updateScores(model);
var result = [];
// from registry
for (var _i = 0, _a = this._entries; _i < _a.length; _i++) {
var entry = _a[_i];
if (entry._score > 0) {
result.push(entry.provider);
}
}
return result;
};
LanguageFeatureRegistry.prototype.ordered = function (model) {
var result = [];
this._orderedForEach(model, function (entry) { return result.push(entry.provider); });
return result;
};
LanguageFeatureRegistry.prototype.orderedGroups = function (model) {
var result = [];
var lastBucket;
var lastBucketScore;
this._orderedForEach(model, function (entry) {
if (lastBucket && lastBucketScore === entry._score) {
lastBucket.push(entry.provider);
}
else {
lastBucketScore = entry._score;
lastBucket = [entry.provider];
result.push(lastBucket);
}
});
return result;
};
LanguageFeatureRegistry.prototype._orderedForEach = function (model, callback) {
if (!model) {
return;
}
this._updateScores(model);
for (var _i = 0, _a = this._entries; _i < _a.length; _i++) {
var entry = _a[_i];
if (entry._score > 0) {
callback(entry);
}
}
};
LanguageFeatureRegistry.prototype._updateScores = function (model) {
var candidate = {
uri: model.uri.toString(),
language: model.getLanguageIdentifier().language
};
if (this._lastCandidate
&& this._lastCandidate.language === candidate.language
&& this._lastCandidate.uri === candidate.uri) {
// nothing has changed
return;
}
this._lastCandidate = candidate;
for (var _i = 0, _a = this._entries; _i < _a.length; _i++) {
var entry = _a[_i];
entry._score = score(entry.selector, model.uri, model.getLanguageIdentifier().language, Object(modelService["b" /* shouldSynchronizeModel */])(model));
if (isExclusive(entry.selector) && entry._score > 0) {
// support for one exclusive selector that overwrites
// any other selector
for (var _b = 0, _c = this._entries; _b < _c.length; _b++) {
var entry_1 = _c[_b];
entry_1._score = 0;
}
entry._score = 1000;
break;
}
}
// needs sorting
this._entries.sort(LanguageFeatureRegistry._compareByScoreAndTime);
};
LanguageFeatureRegistry._compareByScoreAndTime = function (a, b) {
if (a._score < b._score) {
return 1;
}
else if (a._score > b._score) {
return -1;
}
else if (a._time < b._time) {
return 1;
}
else if (a._time > b._time) {
return -1;
}
else {
return 0;
}
};
return LanguageFeatureRegistry;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/map.js
var map = __webpack_require__(55);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/tokenizationRegistry.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var tokenizationRegistry_TokenizationRegistryImpl = /** @class */ (function () {
function TokenizationRegistryImpl() {
this._map = new Map();
this._promises = new Map();
this._onDidChange = new common_event["a" /* Emitter */]();
this.onDidChange = this._onDidChange.event;
this._colorMap = null;
}
TokenizationRegistryImpl.prototype.fire = function (languages) {
this._onDidChange.fire({
changedLanguages: languages,
changedColorMap: false
});
};
TokenizationRegistryImpl.prototype.register = function (language, support) {
var _this = this;
this._map.set(language, support);
this.fire([language]);
return Object(lifecycle["h" /* toDisposable */])(function () {
if (_this._map.get(language) !== support) {
return;
}
_this._map.delete(language);
_this.fire([language]);
});
};
TokenizationRegistryImpl.prototype.registerPromise = function (language, supportPromise) {
var _this = this;
var registration = null;
var isDisposed = false;
this._promises.set(language, supportPromise.then(function (support) {
_this._promises.delete(language);
if (isDisposed || !support) {
return;
}
registration = _this.register(language, support);
}));
return Object(lifecycle["h" /* toDisposable */])(function () {
isDisposed = true;
if (registration) {
registration.dispose();
}
});
};
TokenizationRegistryImpl.prototype.getPromise = function (language) {
var _this = this;
var support = this.get(language);
if (support) {
return Promise.resolve(support);
}
var promise = this._promises.get(language);
if (promise) {
return promise.then(function (_) { return _this.get(language); });
}
return null;
};
TokenizationRegistryImpl.prototype.get = function (language) {
return Object(types["o" /* withUndefinedAsNull */])(this._map.get(language));
};
TokenizationRegistryImpl.prototype.setColorMap = function (colorMap) {
this._colorMap = colorMap;
this._onDidChange.fire({
changedLanguages: Object(map["d" /* keys */])(this._map),
changedColorMap: true
});
};
TokenizationRegistryImpl.prototype.getColorMap = function () {
return this._colorMap;
};
TokenizationRegistryImpl.prototype.getDefaultBackground = function () {
if (this._colorMap && this._colorMap.length > 2 /* DefaultBackground */) {
return this._colorMap[2 /* DefaultBackground */];
}
return null;
};
return TokenizationRegistryImpl;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* @internal
*/
var LanguageIdentifier = /** @class */ (function () {
function LanguageIdentifier(language, id) {
this.language = language;
this.id = id;
}
return LanguageIdentifier;
}());
/**
* @internal
*/
var TokenMetadata = /** @class */ (function () {
function TokenMetadata() {
}
TokenMetadata.getLanguageId = function (metadata) {
return (metadata & 255 /* LANGUAGEID_MASK */) >>> 0 /* LANGUAGEID_OFFSET */;
};
TokenMetadata.getTokenType = function (metadata) {
return (metadata & 1792 /* TOKEN_TYPE_MASK */) >>> 8 /* TOKEN_TYPE_OFFSET */;
};
TokenMetadata.getFontStyle = function (metadata) {
return (metadata & 14336 /* FONT_STYLE_MASK */) >>> 11 /* FONT_STYLE_OFFSET */;
};
TokenMetadata.getForeground = function (metadata) {
return (metadata & 8372224 /* FOREGROUND_MASK */) >>> 14 /* FOREGROUND_OFFSET */;
};
TokenMetadata.getBackground = function (metadata) {
return (metadata & 4286578688 /* BACKGROUND_MASK */) >>> 23 /* BACKGROUND_OFFSET */;
};
TokenMetadata.getClassNameFromMetadata = function (metadata) {
var foreground = this.getForeground(metadata);
var className = 'mtk' + foreground;
var fontStyle = this.getFontStyle(metadata);
if (fontStyle & 1 /* Italic */) {
className += ' mtki';
}
if (fontStyle & 2 /* Bold */) {
className += ' mtkb';
}
if (fontStyle & 4 /* Underline */) {
className += ' mtku';
}
return className;
};
TokenMetadata.getInlineStyleFromMetadata = function (metadata, colorMap) {
var foreground = this.getForeground(metadata);
var fontStyle = this.getFontStyle(metadata);
var result = "color: " + colorMap[foreground] + ";";
if (fontStyle & 1 /* Italic */) {
result += 'font-style: italic;';
}
if (fontStyle & 2 /* Bold */) {
result += 'font-weight: bold;';
}
if (fontStyle & 4 /* Underline */) {
result += 'text-decoration: underline;';
}
return result;
};
return TokenMetadata;
}());
/**
* @internal
*/
var completionKindToCssClass = (function () {
var data = Object.create(null);
data[0 /* Method */] = 'method';
data[1 /* Function */] = 'function';
data[2 /* Constructor */] = 'constructor';
data[3 /* Field */] = 'field';
data[4 /* Variable */] = 'variable';
data[5 /* Class */] = 'class';
data[6 /* Struct */] = 'struct';
data[7 /* Interface */] = 'interface';
data[8 /* Module */] = 'module';
data[9 /* Property */] = 'property';
data[10 /* Event */] = 'event';
data[11 /* Operator */] = 'operator';
data[12 /* Unit */] = 'unit';
data[13 /* Value */] = 'value';
data[14 /* Constant */] = 'constant';
data[15 /* Enum */] = 'enum';
data[16 /* EnumMember */] = 'enum-member';
data[17 /* Keyword */] = 'keyword';
data[25 /* Snippet */] = 'snippet';
data[18 /* Text */] = 'text';
data[19 /* Color */] = 'color';
data[20 /* File */] = 'file';
data[21 /* Reference */] = 'reference';
data[22 /* Customcolor */] = 'customcolor';
data[23 /* Folder */] = 'folder';
data[24 /* TypeParameter */] = 'type-parameter';
return function (kind) {
return data[kind] || 'property';
};
})();
/**
* @internal
*/
var completionKindFromString = (function () {
var data = Object.create(null);
data['method'] = 0 /* Method */;
data['function'] = 1 /* Function */;
data['constructor'] = 2 /* Constructor */;
data['field'] = 3 /* Field */;
data['variable'] = 4 /* Variable */;
data['class'] = 5 /* Class */;
data['struct'] = 6 /* Struct */;
data['interface'] = 7 /* Interface */;
data['module'] = 8 /* Module */;
data['property'] = 9 /* Property */;
data['event'] = 10 /* Event */;
data['operator'] = 11 /* Operator */;
data['unit'] = 12 /* Unit */;
data['value'] = 13 /* Value */;
data['constant'] = 14 /* Constant */;
data['enum'] = 15 /* Enum */;
data['enum-member'] = 16 /* EnumMember */;
data['enumMember'] = 16 /* EnumMember */;
data['keyword'] = 17 /* Keyword */;
data['snippet'] = 25 /* Snippet */;
data['text'] = 18 /* Text */;
data['color'] = 19 /* Color */;
data['file'] = 20 /* File */;
data['reference'] = 21 /* Reference */;
data['customcolor'] = 22 /* Customcolor */;
data['folder'] = 23 /* Folder */;
data['type-parameter'] = 24 /* TypeParameter */;
data['typeParameter'] = 24 /* TypeParameter */;
return function (value, strict) {
var res = data[value];
if (typeof res === 'undefined' && !strict) {
res = 9 /* Property */;
}
return res;
};
})();
var SignatureHelpTriggerKind;
(function (SignatureHelpTriggerKind) {
SignatureHelpTriggerKind[SignatureHelpTriggerKind["Invoke"] = 1] = "Invoke";
SignatureHelpTriggerKind[SignatureHelpTriggerKind["TriggerCharacter"] = 2] = "TriggerCharacter";
SignatureHelpTriggerKind[SignatureHelpTriggerKind["ContentChange"] = 3] = "ContentChange";
})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));
/**
* A document highlight kind.
*/
var DocumentHighlightKind;
(function (DocumentHighlightKind) {
/**
* A textual occurrence.
*/
DocumentHighlightKind[DocumentHighlightKind["Text"] = 0] = "Text";
/**
* Read-access of a symbol, like reading a variable.
*/
DocumentHighlightKind[DocumentHighlightKind["Read"] = 1] = "Read";
/**
* Write-access of a symbol, like writing to a variable.
*/
DocumentHighlightKind[DocumentHighlightKind["Write"] = 2] = "Write";
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
/**
* @internal
*/
function isLocationLink(thing) {
return thing
&& uri["a" /* URI */].isUri(thing.uri)
&& range["a" /* Range */].isIRange(thing.range)
&& (range["a" /* Range */].isIRange(thing.originSelectionRange) || range["a" /* Range */].isIRange(thing.targetSelectionRange));
}
/**
* @internal
*/
var SymbolKinds;
(function (SymbolKinds) {
var byName = new Map();
byName.set('file', 0 /* File */);
byName.set('module', 1 /* Module */);
byName.set('namespace', 2 /* Namespace */);
byName.set('package', 3 /* Package */);
byName.set('class', 4 /* Class */);
byName.set('method', 5 /* Method */);
byName.set('property', 6 /* Property */);
byName.set('field', 7 /* Field */);
byName.set('constructor', 8 /* Constructor */);
byName.set('enum', 9 /* Enum */);
byName.set('interface', 10 /* Interface */);
byName.set('function', 11 /* Function */);
byName.set('variable', 12 /* Variable */);
byName.set('constant', 13 /* Constant */);
byName.set('string', 14 /* String */);
byName.set('number', 15 /* Number */);
byName.set('boolean', 16 /* Boolean */);
byName.set('array', 17 /* Array */);
byName.set('object', 18 /* Object */);
byName.set('key', 19 /* Key */);
byName.set('null', 20 /* Null */);
byName.set('enum-member', 21 /* EnumMember */);
byName.set('struct', 22 /* Struct */);
byName.set('event', 23 /* Event */);
byName.set('operator', 24 /* Operator */);
byName.set('type-parameter', 25 /* TypeParameter */);
var byKind = new Map();
byKind.set(0 /* File */, 'file');
byKind.set(1 /* Module */, 'module');
byKind.set(2 /* Namespace */, 'namespace');
byKind.set(3 /* Package */, 'package');
byKind.set(4 /* Class */, 'class');
byKind.set(5 /* Method */, 'method');
byKind.set(6 /* Property */, 'property');
byKind.set(7 /* Field */, 'field');
byKind.set(8 /* Constructor */, 'constructor');
byKind.set(9 /* Enum */, 'enum');
byKind.set(10 /* Interface */, 'interface');
byKind.set(11 /* Function */, 'function');
byKind.set(12 /* Variable */, 'variable');
byKind.set(13 /* Constant */, 'constant');
byKind.set(14 /* String */, 'string');
byKind.set(15 /* Number */, 'number');
byKind.set(16 /* Boolean */, 'boolean');
byKind.set(17 /* Array */, 'array');
byKind.set(18 /* Object */, 'object');
byKind.set(19 /* Key */, 'key');
byKind.set(20 /* Null */, 'null');
byKind.set(21 /* EnumMember */, 'enum-member');
byKind.set(22 /* Struct */, 'struct');
byKind.set(23 /* Event */, 'event');
byKind.set(24 /* Operator */, 'operator');
byKind.set(25 /* TypeParameter */, 'type-parameter');
/**
* @internal
*/
function fromString(value) {
return byName.get(value);
}
SymbolKinds.fromString = fromString;
/**
* @internal
*/
function toString(kind) {
return byKind.get(kind);
}
SymbolKinds.toString = toString;
/**
* @internal
*/
function toCssClassName(kind, inline) {
return "codicon " + (inline ? 'inline' : 'block') + " codicon-symbol-" + (byKind.get(kind) || 'property');
}
SymbolKinds.toCssClassName = toCssClassName;
})(SymbolKinds || (SymbolKinds = {}));
var FoldingRangeKind = /** @class */ (function () {
/**
* Creates a new [FoldingRangeKind](#FoldingRangeKind).
*
* @param value of the kind.
*/
function FoldingRangeKind(value) {
this.value = value;
}
/**
* Kind for folding range representing a comment. The value of the kind is 'comment'.
*/
FoldingRangeKind.Comment = new FoldingRangeKind('comment');
/**
* Kind for folding range representing a import. The value of the kind is 'imports'.
*/
FoldingRangeKind.Imports = new FoldingRangeKind('imports');
/**
* Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
* The value of the kind is 'region'.
*/
FoldingRangeKind.Region = new FoldingRangeKind('region');
return FoldingRangeKind;
}());
/**
* @internal
*/
var modes_WorkspaceFileEdit;
(function (WorkspaceFileEdit) {
/**
* @internal
*/
function is(thing) {
return Object(types["i" /* isObject */])(thing) && (Boolean(thing.newUri) || Boolean(thing.oldUri));
}
WorkspaceFileEdit.is = is;
})(modes_WorkspaceFileEdit || (modes_WorkspaceFileEdit = {}));
/**
* @internal
*/
var modes_WorkspaceTextEdit;
(function (WorkspaceTextEdit) {
/**
* @internal
*/
function is(thing) {
return Object(types["i" /* isObject */])(thing) && uri["a" /* URI */].isUri(thing.resource) && Object(types["i" /* isObject */])(thing.edit);
}
WorkspaceTextEdit.is = is;
})(modes_WorkspaceTextEdit || (modes_WorkspaceTextEdit = {}));
// --- feature registries ------
/**
* @internal
*/
var ReferenceProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var RenameProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var CompletionProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var SignatureHelpProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var HoverProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentSymbolProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentHighlightProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DefinitionProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DeclarationProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var ImplementationProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var TypeDefinitionProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var CodeLensProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var CodeActionProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentFormattingEditProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentRangeFormattingEditProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var OnTypeFormattingEditProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var LinkProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var ColorProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var SelectionRangeRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var FoldingRangeProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentSemanticTokensProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var DocumentRangeSemanticTokensProviderRegistry = new languageFeatureRegistry_LanguageFeatureRegistry();
/**
* @internal
*/
var TokenizationRegistry = new tokenizationRegistry_TokenizationRegistryImpl();
/***/ }),
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return RGBA; });
/* unused harmony export HSLA */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HSVA; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Color; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function roundFloat(number, decimalPoints) {
var decimal = Math.pow(10, decimalPoints);
return Math.round(number * decimal) / decimal;
}
var RGBA = /** @class */ (function () {
function RGBA(r, g, b, a) {
if (a === void 0) { a = 1; }
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, a), 0), 3);
}
RGBA.equals = function (a, b) {
return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a;
};
return RGBA;
}());
var HSLA = /** @class */ (function () {
function HSLA(h, s, l, a) {
this.h = Math.max(Math.min(360, h), 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, a), 0), 3);
}
HSLA.equals = function (a, b) {
return a.h === b.h && a.s === b.s && a.l === b.l && a.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].
*/
HSLA.fromRGBA = function (rgba) {
var r = rgba.r / 255;
var g = rgba.g / 255;
var b = rgba.b / 255;
var a = rgba.a;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h = 0;
var s = 0;
var l = (min + max) / 2;
var chroma = max - min;
if (chroma > 0) {
s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);
switch (max) {
case r:
h = (g - b) / chroma + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / chroma + 2;
break;
case b:
h = (r - g) / chroma + 4;
break;
}
h *= 60;
h = Math.round(h);
}
return new HSLA(h, s, l, a);
};
HSLA._hue2rgb = function (p, q, t) {
if (t < 0) {
t += 1;
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * 6 * t;
}
if (t < 1 / 2) {
return q;
}
if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 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].
*/
HSLA.toRGBA = function (hsla) {
var h = hsla.h / 360;
var s = hsla.s, l = hsla.l, a = hsla.a;
var r, g, b;
if (s === 0) {
r = g = b = l; // achromatic
}
else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = HSLA._hue2rgb(p, q, h + 1 / 3);
g = HSLA._hue2rgb(p, q, h);
b = HSLA._hue2rgb(p, q, h - 1 / 3);
}
return new RGBA(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);
};
return HSLA;
}());
var HSVA = /** @class */ (function () {
function HSVA(h, s, v, a) {
this.h = Math.max(Math.min(360, h), 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, a), 0), 3);
}
HSVA.equals = function (a, b) {
return a.h === b.h && a.s === b.s && a.v === b.v && a.a === b.a;
};
// from http://www.rapidtables.com/convert/color/rgb-to-hsv.htm
HSVA.fromRGBA = function (rgba) {
var r = rgba.r / 255;
var g = rgba.g / 255;
var b = rgba.b / 255;
var cmax = Math.max(r, g, b);
var cmin = Math.min(r, g, b);
var delta = cmax - cmin;
var s = cmax === 0 ? 0 : (delta / cmax);
var 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
HSVA.toRGBA = function (hsva) {
var h = hsva.h, s = hsva.s, v = hsva.v, a = hsva.a;
var c = v * s;
var x = c * (1 - Math.abs((h / 60) % 2 - 1));
var m = v - c;
var _a = [0, 0, 0], r = _a[0], g = _a[1], b = _a[2];
if (h < 60) {
r = c;
g = x;
}
else if (h < 120) {
r = x;
g = c;
}
else if (h < 180) {
g = c;
b = x;
}
else if (h < 240) {
g = x;
b = c;
}
else if (h < 300) {
r = x;
b = c;
}
else if (h < 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, a);
};
return HSVA;
}());
var Color = /** @class */ (function () {
function Color(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');
}
}
Color.fromHex = function (hex) {
return Color.Format.CSS.parseHex(hex) || Color.red;
};
Object.defineProperty(Color.prototype, "hsla", {
get: function () {
if (this._hsla) {
return this._hsla;
}
else {
return HSLA.fromRGBA(this.rgba);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Color.prototype, "hsva", {
get: function () {
if (this._hsva) {
return this._hsva;
}
return HSVA.fromRGBA(this.rgba);
},
enumerable: true,
configurable: true
});
Color.prototype.equals = function (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.
*/
Color.prototype.getRelativeLuminance = function () {
var R = Color._relativeLuminanceForComponent(this.rgba.r);
var G = Color._relativeLuminanceForComponent(this.rgba.g);
var B = Color._relativeLuminanceForComponent(this.rgba.b);
var luminance = 0.2126 * R + 0.7152 * G + 0.0722 * B;
return roundFloat(luminance, 4);
};
Color._relativeLuminanceForComponent = function (color) {
var 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'
*/
Color.prototype.isLighter = function () {
var yiq = (this.rgba.r * 299 + this.rgba.g * 587 + this.rgba.b * 114) / 1000;
return yiq >= 128;
};
Color.prototype.isLighterThan = function (another) {
var lum1 = this.getRelativeLuminance();
var lum2 = another.getRelativeLuminance();
return lum1 > lum2;
};
Color.prototype.isDarkerThan = function (another) {
var lum1 = this.getRelativeLuminance();
var lum2 = another.getRelativeLuminance();
return lum1 < lum2;
};
Color.prototype.lighten = function (factor) {
return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l + this.hsla.l * factor, this.hsla.a));
};
Color.prototype.darken = function (factor) {
return new Color(new HSLA(this.hsla.h, this.hsla.s, this.hsla.l - this.hsla.l * factor, this.hsla.a));
};
Color.prototype.transparent = function (factor) {
var _a = this.rgba, r = _a.r, g = _a.g, b = _a.b, a = _a.a;
return new Color(new RGBA(r, g, b, a * factor));
};
Color.prototype.isTransparent = function () {
return this.rgba.a === 0;
};
Color.prototype.isOpaque = function () {
return this.rgba.a === 1;
};
Color.prototype.opposite = function () {
return new Color(new RGBA(255 - this.rgba.r, 255 - this.rgba.g, 255 - this.rgba.b, this.rgba.a));
};
Color.prototype.toString = function () {
return '' + Color.Format.CSS.format(this);
};
Color.getLighterColor = function (of, relative, factor) {
if (of.isLighterThan(relative)) {
return of;
}
factor = factor ? factor : 0.5;
var lum1 = of.getRelativeLuminance();
var lum2 = relative.getRelativeLuminance();
factor = factor * (lum2 - lum1) / lum2;
return of.lighten(factor);
};
Color.getDarkerColor = function (of, relative, factor) {
if (of.isDarkerThan(relative)) {
return of;
}
factor = factor ? factor : 0.5;
var lum1 = of.getRelativeLuminance();
var lum2 = relative.getRelativeLuminance();
factor = factor * (lum1 - lum2) / lum1;
return of.darken(factor);
};
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.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));
return Color;
}());
(function (Color) {
var Format;
(function (Format) {
var CSS;
(function (CSS) {
function formatRGB(color) {
if (color.rgba.a === 1) {
return "rgb(" + color.rgba.r + ", " + color.rgba.g + ", " + color.rgba.b + ")";
}
return Color.Format.CSS.formatRGBA(color);
}
CSS.formatRGB = formatRGB;
function formatRGBA(color) {
return "rgba(" + color.rgba.r + ", " + color.rgba.g + ", " + color.rgba.b + ", " + +(color.rgba.a).toFixed(2) + ")";
}
CSS.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 Color.Format.CSS.formatHSLA(color);
}
CSS.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) + ")";
}
CSS.formatHSLA = formatHSLA;
function _toTwoDigitHex(n) {
var r = n.toString(16);
return r.length !== 2 ? '0' + r : r;
}
/**
* Formats the color as #RRGGBB
*/
function formatHex(color) {
return "#" + _toTwoDigitHex(color.rgba.r) + _toTwoDigitHex(color.rgba.g) + _toTwoDigitHex(color.rgba.b);
}
CSS.formatHex = formatHex;
/**
* Formats the color as #RRGGBBAA
* If 'compact' is set, colors without transparancy will be printed as #RRGGBB
*/
function formatHexA(color, compact) {
if (compact === void 0) { compact = false; }
if (compact && color.rgba.a === 1) {
return Color.Format.CSS.formatHex(color);
}
return "#" + _toTwoDigitHex(color.rgba.r) + _toTwoDigitHex(color.rgba.g) + _toTwoDigitHex(color.rgba.b) + _toTwoDigitHex(Math.round(color.rgba.a * 255));
}
CSS.formatHexA = formatHexA;
/**
* The default format will use HEX if opaque and RGBA otherwise.
*/
function format(color) {
if (color.isOpaque()) {
return Color.Format.CSS.formatHex(color);
}
return Color.Format.CSS.formatRGBA(color);
}
CSS.format = format;
/**
* Converts an Hex color value to a Color.
* returns r, g, and b are contained in the set [0, 255]
* @param hex string (#RGB, #RGBA, #RRGGBB or #RRGGBBAA).
*/
function parseHex(hex) {
var length = hex.length;
if (length === 0) {
// Invalid color
return null;
}
if (hex.charCodeAt(0) !== 35 /* Hash */) {
// Does not begin with a #
return null;
}
if (length === 7) {
// #RRGGBB format
var r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));
var g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
var b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
return new Color(new RGBA(r, g, b, 1));
}
if (length === 9) {
// #RRGGBBAA format
var r = 16 * _parseHexDigit(hex.charCodeAt(1)) + _parseHexDigit(hex.charCodeAt(2));
var g = 16 * _parseHexDigit(hex.charCodeAt(3)) + _parseHexDigit(hex.charCodeAt(4));
var b = 16 * _parseHexDigit(hex.charCodeAt(5)) + _parseHexDigit(hex.charCodeAt(6));
var a = 16 * _parseHexDigit(hex.charCodeAt(7)) + _parseHexDigit(hex.charCodeAt(8));
return new Color(new RGBA(r, g, b, a / 255));
}
if (length === 4) {
// #RGB format
var r = _parseHexDigit(hex.charCodeAt(1));
var g = _parseHexDigit(hex.charCodeAt(2));
var b = _parseHexDigit(hex.charCodeAt(3));
return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b));
}
if (length === 5) {
// #RGBA format
var r = _parseHexDigit(hex.charCodeAt(1));
var g = _parseHexDigit(hex.charCodeAt(2));
var b = _parseHexDigit(hex.charCodeAt(3));
var a = _parseHexDigit(hex.charCodeAt(4));
return new Color(new RGBA(16 * r + r, 16 * g + g, 16 * b + b, (16 * a + a) / 255));
}
// Invalid color
return null;
}
CSS.parseHex = parseHex;
function _parseHexDigit(charCode) {
switch (charCode) {
case 48 /* Digit0 */: return 0;
case 49 /* Digit1 */: return 1;
case 50 /* Digit2 */: return 2;
case 51 /* Digit3 */: return 3;
case 52 /* Digit4 */: return 4;
case 53 /* Digit5 */: return 5;
case 54 /* Digit6 */: return 6;
case 55 /* Digit7 */: return 7;
case 56 /* Digit8 */: return 8;
case 57 /* Digit9 */: return 9;
case 97 /* a */: return 10;
case 65 /* A */: return 10;
case 98 /* b */: return 11;
case 66 /* B */: return 11;
case 99 /* c */: return 12;
case 67 /* C */: return 12;
case 100 /* d */: return 13;
case 68 /* D */: return 13;
case 101 /* e */: return 14;
case 69 /* E */: return 14;
case 102 /* f */: return 15;
case 70 /* F */: return 15;
}
return 0;
}
})(CSS = Format.CSS || (Format.CSS = {}));
})(Format = Color.Format || (Color.Format = {}));
})(Color || (Color = {}));
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ErrorHandler */
/* unused harmony export errorHandler */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return onUnexpectedError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return onUnexpectedExternalError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return transformErrorForSerialization; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isPromiseCanceledError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return canceled; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return illegalArgument; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return illegalState; });
/*---------------------------------------------------------------------------------------------
* 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.
var ErrorHandler = /** @class */ (function () {
function ErrorHandler() {
this.listeners = [];
this.unexpectedErrorHandler = function (e) {
setTimeout(function () {
if (e.stack) {
throw new Error(e.message + '\n\n' + e.stack);
}
throw e;
}, 0);
};
}
ErrorHandler.prototype.emit = function (e) {
this.listeners.forEach(function (listener) {
listener(e);
});
};
ErrorHandler.prototype.onUnexpectedError = function (e) {
this.unexpectedErrorHandler(e);
this.emit(e);
};
// For external errors, we don't want the listeners to be called
ErrorHandler.prototype.onUnexpectedExternalError = function (e) {
this.unexpectedErrorHandler(e);
};
return ErrorHandler;
}());
var errorHandler = new ErrorHandler();
function onUnexpectedError(e) {
// ignore errors from cancelled promises
if (!isPromiseCanceledError(e)) {
errorHandler.onUnexpectedError(e);
}
return undefined;
}
function onUnexpectedExternalError(e) {
// ignore errors from cancelled promises
if (!isPromiseCanceledError(e)) {
errorHandler.onUnexpectedExternalError(e);
}
return undefined;
}
function transformErrorForSerialization(error) {
if (error instanceof Error) {
var name_1 = error.name, message = error.message;
var stack = error.stacktrace || error.stack;
return {
$isError: true,
name: name_1,
message: message,
stack: stack
};
}
// return as is
return error;
}
var canceledName = 'Canceled';
/**
* Checks if the given error is a promise in canceled state
*/
function isPromiseCanceledError(error) {
return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
/**
* Returns an error that signals cancellation.
*/
function canceled() {
var 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');
}
}
/***/ }),
/* 17 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isWindows; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isMacintosh; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isLinux; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isNative; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isWeb; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isIOS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return globals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return setImmediate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OS; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LANGUAGE_DEFAULT = 'en';
var _isWindows = false;
var _isMacintosh = false;
var _isLinux = false;
var _isNative = false;
var _isWeb = false;
var _isIOS = false;
var _locale = undefined;
var _language = LANGUAGE_DEFAULT;
var _translationsConfigFile = undefined;
var _userAgent = undefined;
var isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer');
// OS detection
if (typeof navigator === 'object' && !isElectronRenderer) {
_userAgent = navigator.userAgent;
_isWindows = _userAgent.indexOf('Windows') >= 0;
_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;
_isIOS = _userAgent.indexOf('Macintosh') >= 0 && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
_isLinux = _userAgent.indexOf('Linux') >= 0;
_isWeb = true;
_locale = navigator.language;
_language = _locale;
}
else if (typeof process === 'object') {
_isWindows = (process.platform === 'win32');
_isMacintosh = (process.platform === 'darwin');
_isLinux = (process.platform === 'linux');
_locale = LANGUAGE_DEFAULT;
_language = LANGUAGE_DEFAULT;
var rawNlsConfig = process.env['VSCODE_NLS_CONFIG'];
if (rawNlsConfig) {
try {
var nlsConfig = JSON.parse(rawNlsConfig);
var resolved = nlsConfig.availableLanguages['*'];
_locale = nlsConfig.locale;
// VSCode's default language is 'en'
_language = resolved ? resolved : LANGUAGE_DEFAULT;
_translationsConfigFile = nlsConfig._translationsConfigFile;
}
catch (e) {
}
}
_isNative = true;
}
var _platform = 0 /* Web */;
if (_isMacintosh) {
_platform = 1 /* Mac */;
}
else if (_isWindows) {
_platform = 3 /* Windows */;
}
else if (_isLinux) {
_platform = 2 /* Linux */;
}
var isWindows = _isWindows;
var isMacintosh = _isMacintosh;
var isLinux = _isLinux;
var isNative = _isNative;
var isWeb = _isWeb;
var isIOS = _isIOS;
var _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});
var globals = _globals;
var setImmediate = (function defineSetImmediate() {
if (globals.setImmediate) {
return globals.setImmediate.bind(globals);
}
if (typeof globals.postMessage === 'function' && !globals.importScripts) {
var pending_1 = [];
globals.addEventListener('message', function (e) {
if (e.data && e.data.vscodeSetImmediateId) {
for (var i = 0, len = pending_1.length; i < len; i++) {
var candidate = pending_1[i];
if (candidate.id === e.data.vscodeSetImmediateId) {
pending_1.splice(i, 1);
candidate.callback();
return;
}
}
}
});
var lastId_1 = 0;
return function (callback) {
var myId = ++lastId_1;
pending_1.push({
id: myId,
callback: callback
});
globals.postMessage({ vscodeSetImmediateId: myId }, '*');
};
}
if (typeof process !== 'undefined' && typeof process.nextTick === 'function') {
return process.nextTick.bind(process);
}
var _promise = Promise.resolve();
return function (callback) { return _promise.then(callback); };
})();
var OS = (_isMacintosh ? 2 /* Macintosh */ : (_isWindows ? 1 /* Windows */ : 3 /* Linux */));
/***/ }),
/* 18 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return tail; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return tail2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return equals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return binarySearch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return findFirstInSorted; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return mergeSort; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return groupBy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return coalesce; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return isFalsyOrEmpty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return isNonEmptyArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return distinct; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return distinctES6; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return fromSet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return firstIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return first; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return firstOrDefault; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return flatten; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return range; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayInsert; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return pushToStart; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return pushToEnd; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return find; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return asArray; });
/**
* Returns the last element of an array.
* @param array The array.
* @param n Which element from the end (default is zero).
*/
function tail(array, n) {
if (n === void 0) { n = 0; }
return array[array.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, itemEquals) {
if (itemEquals === void 0) { itemEquals = function (a, b) { return a === b; }; }
if (one === other) {
return true;
}
if (!one || !other) {
return false;
}
if (one.length !== other.length) {
return false;
}
for (var i = 0, len = one.length; i < len; i++) {
if (!itemEquals(one[i], other[i])) {
return false;
}
}
return true;
}
function binarySearch(array, key, comparator) {
var low = 0, high = array.length - 1;
while (low <= high) {
var mid = ((low + high) / 2) | 0;
var comp = comparator(array[mid], key);
if (comp < 0) {
low = mid + 1;
}
else if (comp > 0) {
high = mid - 1;
}
else {
return mid;
}
}
return -(low + 1);
}
/**
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
* are located before all elements where p(x) is true.
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
*/
function findFirstInSorted(array, p) {
var low = 0, high = array.length;
if (high === 0) {
return 0; // no children
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (p(array[mid])) {
high = mid;
}
else {
low = mid + 1;
}
}
return low;
}
/**
* Like `Array#sort` but always stable. Usually runs a little slower `than Array#sort`
* so only use this when actually needing stable sort.
*/
function mergeSort(data, compare) {
_sort(data, compare, 0, data.length - 1, []);
return data;
}
function _merge(a, compare, lo, mid, hi, aux) {
var leftIdx = lo, rightIdx = mid + 1;
for (var i = lo; i <= hi; i++) {
aux[i] = a[i];
}
for (var i = lo; i <= hi; i++) {
if (leftIdx > mid) {
// left side consumed
a[i] = aux[rightIdx++];
}
else if (rightIdx > hi) {
// right side consumed
a[i] = aux[leftIdx++];
}
else if (compare(aux[rightIdx], aux[leftIdx]) < 0) {
// right element is less -> comes first
a[i] = aux[rightIdx++];
}
else {
// left element comes first (less or equal)
a[i] = aux[leftIdx++];
}
}
}
function _sort(a, compare, lo, hi, aux) {
if (hi <= lo) {
return;
}
var mid = lo + ((hi - lo) / 2) | 0;
_sort(a, compare, lo, mid, aux);
_sort(a, compare, mid + 1, hi, aux);
if (compare(a[mid], a[mid + 1]) <= 0) {
// left and right are sorted and if the last-left element is less
// or equals than the first-right element there is nothing else
// to do
return;
}
_merge(a, compare, lo, mid, hi, aux);
}
function groupBy(data, compare) {
var result = [];
var currentGroup = undefined;
for (var _i = 0, _a = mergeSort(data.slice(0), compare); _i < _a.length; _i++) {
var element = _a[_i];
if (!currentGroup || compare(currentGroup[0], element) !== 0) {
currentGroup = [element];
result.push(currentGroup);
}
else {
currentGroup.push(element);
}
}
return result;
}
/**
* @returns New array with all falsy values removed. The original array IS NOT modified.
*/
function coalesce(array) {
return array.filter(function (e) { return !!e; });
}
/**
* @returns false if the provided object is an array and not empty.
*/
function isFalsyOrEmpty(obj) {
return !Array.isArray(obj) || obj.length === 0;
}
function isNonEmptyArray(obj) {
return Array.isArray(obj) && obj.length > 0;
}
/**
* Removes duplicates from the given array. The optional keyFn allows to specify
* how elements are checked for equalness by returning a unique string for each.
*/
function distinct(array, keyFn) {
if (!keyFn) {
return array.filter(function (element, position) {
return array.indexOf(element) === position;
});
}
var seen = Object.create(null);
return array.filter(function (elem) {
var key = keyFn(elem);
if (seen[key]) {
return false;
}
seen[key] = true;
return true;
});
}
function distinctES6(array) {
var seen = new Set();
return array.filter(function (element) {
if (seen.has(element)) {
return false;
}
seen.add(element);
return true;
});
}
function fromSet(set) {
var result = [];
set.forEach(function (o) { return result.push(o); });
return result;
}
function firstIndex(array, fn) {
for (var i = 0; i < array.length; i++) {
var element = array[i];
if (fn(element)) {
return i;
}
}
return -1;
}
function first(array, fn, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = undefined; }
var index = firstIndex(array, fn);
return index < 0 ? notFoundValue : array[index];
}
function firstOrDefault(array, notFoundValue) {
return array.length > 0 ? array[0] : notFoundValue;
}
function flatten(arr) {
var _a;
return (_a = []).concat.apply(_a, arr);
}
function range(arg, to) {
var from = typeof to === 'number' ? arg : 0;
if (typeof to === 'number') {
from = arg;
}
else {
from = 0;
to = arg;
}
var result = [];
if (from <= to) {
for (var i = from; i < to; i++) {
result.push(i);
}
}
else {
for (var i = from; i > to; i--) {
result.push(i);
}
}
return result;
}
/**
* Insert `insertArr` inside `target` at `insertIndex`.
* Please don't touch unless you understand https://jsperf.com/inserting-an-array-within-an-array
*/
function arrayInsert(target, insertIndex, insertArr) {
var before = target.slice(0, insertIndex);
var after = target.slice(insertIndex);
return before.concat(insertArr, after);
}
/**
* Pushes an element to the start of the array, if found.
*/
function pushToStart(arr, value) {
var index = arr.indexOf(value);
if (index > -1) {
arr.splice(index, 1);
arr.unshift(value);
}
}
/**
* Pushes an element to the end of the array, if found.
*/
function pushToEnd(arr, value) {
var index = arr.indexOf(value);
if (index > -1) {
arr.splice(index, 1);
arr.push(value);
}
}
function find(arr, predicate) {
for (var i = 0; i < arr.length; i++) {
var element = arr[i];
if (predicate(element, i, arr)) {
return element;
}
}
return undefined;
}
function asArray(x) {
return Array.isArray(x) ? x : [x];
}
/***/ }),
/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return IThemeService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return themeColorFromId; });
/* unused harmony export DARK */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HIGH_CONTRAST; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getThemeTypeSelector; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Extensions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return registerThemingParticipant; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/* harmony import */ var _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
/* harmony import */ var _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IThemeService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('themeService');
function themeColorFromId(id) {
return { id: id };
}
// base themes
var DARK = 'dark';
var HIGH_CONTRAST = 'hc';
function getThemeTypeSelector(type) {
switch (type) {
case DARK: return 'vs-dark';
case HIGH_CONTRAST: return 'hc-black';
default: return 'vs';
}
}
// static theming participant
var Extensions = {
ThemingContribution: 'base.contributions.theming'
};
var ThemingRegistry = /** @class */ (function () {
function ThemingRegistry() {
this.themingParticipants = [];
this.themingParticipants = [];
this.onThemingParticipantAddedEmitter = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_3__[/* Emitter */ "a"]();
}
ThemingRegistry.prototype.onThemeChange = function (participant) {
var _this = this;
this.themingParticipants.push(participant);
this.onThemingParticipantAddedEmitter.fire(participant);
return Object(_base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* toDisposable */ "h"])(function () {
var idx = _this.themingParticipants.indexOf(participant);
_this.themingParticipants.splice(idx, 1);
});
};
ThemingRegistry.prototype.getThemingParticipants = function () {
return this.themingParticipants;
};
return ThemingRegistry;
}());
var themingRegistry = new ThemingRegistry();
_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* Registry */ "a"].add(Extensions.ThemingContribution, themingRegistry);
function registerThemingParticipant(participant) {
return themingRegistry.onThemeChange(participant);
}
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isThenable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return createCancelablePromise; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return raceCancellation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Delayer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return timeout; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return disposableTimeout; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return first; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return TimeoutTimer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return IntervalTimer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return RunOnceScheduler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return runWhenIdle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IdleValue; });
/* harmony import */ var _cancellation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
/* harmony import */ var _lifecycle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function isThenable(obj) {
return obj && typeof obj.then === 'function';
}
function createCancelablePromise(callback) {
var source = new _cancellation_js__WEBPACK_IMPORTED_MODULE_0__[/* CancellationTokenSource */ "b"]();
var thenable = callback(source.token);
var promise = new Promise(function (resolve, reject) {
source.token.onCancellationRequested(function () {
reject(_errors_js__WEBPACK_IMPORTED_MODULE_1__[/* canceled */ "a"]());
});
Promise.resolve(thenable).then(function (value) {
source.dispose();
resolve(value);
}, function (err) {
source.dispose();
reject(err);
});
});
return new /** @class */ (function () {
function class_1() {
}
class_1.prototype.cancel = function () {
source.cancel();
};
class_1.prototype.then = function (resolve, reject) {
return promise.then(resolve, reject);
};
class_1.prototype.catch = function (reject) {
return this.then(undefined, reject);
};
class_1.prototype.finally = function (onfinally) {
return promise.finally(onfinally);
};
return class_1;
}());
}
function raceCancellation(promise, token, defaultValue) {
return Promise.race([promise, new Promise(function (resolve) { return token.onCancellationRequested(function () { return resolve(defaultValue); }); })]);
}
/**
* A helper to delay execution of a task that is being requested often.
*
* Following the throttler, now imagine the mail man wants to optimize the number of
* trips proactively. The trip itself can be long, so he decides not to make the trip
* as soon as a letter is submitted. Instead he waits a while, in case more
* letters are submitted. After said waiting period, if no letters were submitted, he
* decides to make the trip. Imagine that N more letters were submitted after the first
* one, all within a short period of time between each other. Even though N+1
* submissions occurred, only 1 delivery was made.
*
* The delayer offers this behavior via the trigger() method, into which both the task
* to be executed and the waiting period (delay) must be passed in as arguments. Following
* the example:
*
* const delayer = new Delayer(WAITING_PERIOD);
* const letters = [];
*
* function letterReceived(l) {
* letters.push(l);
* delayer.trigger(() => { return makeTheTrip(); });
* }
*/
var Delayer = /** @class */ (function () {
function Delayer(defaultDelay) {
this.defaultDelay = defaultDelay;
this.timeout = null;
this.completionPromise = null;
this.doResolve = null;
this.doReject = null;
this.task = null;
}
Delayer.prototype.trigger = function (task, delay) {
var _this = this;
if (delay === void 0) { delay = this.defaultDelay; }
this.task = task;
this.cancelTimeout();
if (!this.completionPromise) {
this.completionPromise = new Promise(function (c, e) {
_this.doResolve = c;
_this.doReject = e;
}).then(function () {
_this.completionPromise = null;
_this.doResolve = null;
if (_this.task) {
var task_1 = _this.task;
_this.task = null;
return task_1();
}
return undefined;
});
}
this.timeout = setTimeout(function () {
_this.timeout = null;
if (_this.doResolve) {
_this.doResolve(null);
}
}, delay);
return this.completionPromise;
};
Delayer.prototype.isTriggered = function () {
return this.timeout !== null;
};
Delayer.prototype.cancel = function () {
this.cancelTimeout();
if (this.completionPromise) {
if (this.doReject) {
this.doReject(_errors_js__WEBPACK_IMPORTED_MODULE_1__[/* canceled */ "a"]());
}
this.completionPromise = null;
}
};
Delayer.prototype.cancelTimeout = function () {
if (this.timeout !== null) {
clearTimeout(this.timeout);
this.timeout = null;
}
};
Delayer.prototype.dispose = function () {
this.cancelTimeout();
};
return Delayer;
}());
function timeout(millis, token) {
if (!token) {
return createCancelablePromise(function (token) { return timeout(millis, token); });
}
return new Promise(function (resolve, reject) {
var handle = setTimeout(resolve, millis);
token.onCancellationRequested(function () {
clearTimeout(handle);
reject(_errors_js__WEBPACK_IMPORTED_MODULE_1__[/* canceled */ "a"]());
});
});
}
function disposableTimeout(handler, timeout) {
if (timeout === void 0) { timeout = 0; }
var timer = setTimeout(handler, timeout);
return Object(_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* toDisposable */ "h"])(function () { return clearTimeout(timer); });
}
function first(promiseFactories, shouldStop, defaultValue) {
if (shouldStop === void 0) { shouldStop = function (t) { return !!t; }; }
if (defaultValue === void 0) { defaultValue = null; }
var index = 0;
var len = promiseFactories.length;
var loop = function () {
if (index >= len) {
return Promise.resolve(defaultValue);
}
var factory = promiseFactories[index++];
var promise = Promise.resolve(factory());
return promise.then(function (result) {
if (shouldStop(result)) {
return Promise.resolve(result);
}
return loop();
});
};
return loop();
}
var TimeoutTimer = /** @class */ (function () {
function TimeoutTimer(runner, timeout) {
this._token = -1;
if (typeof runner === 'function' && typeof timeout === 'number') {
this.setIfNotSet(runner, timeout);
}
}
TimeoutTimer.prototype.dispose = function () {
this.cancel();
};
TimeoutTimer.prototype.cancel = function () {
if (this._token !== -1) {
clearTimeout(this._token);
this._token = -1;
}
};
TimeoutTimer.prototype.cancelAndSet = function (runner, timeout) {
var _this = this;
this.cancel();
this._token = setTimeout(function () {
_this._token = -1;
runner();
}, timeout);
};
TimeoutTimer.prototype.setIfNotSet = function (runner, timeout) {
var _this = this;
if (this._token !== -1) {
// timer is already set
return;
}
this._token = setTimeout(function () {
_this._token = -1;
runner();
}, timeout);
};
return TimeoutTimer;
}());
var IntervalTimer = /** @class */ (function () {
function IntervalTimer() {
this._token = -1;
}
IntervalTimer.prototype.dispose = function () {
this.cancel();
};
IntervalTimer.prototype.cancel = function () {
if (this._token !== -1) {
clearInterval(this._token);
this._token = -1;
}
};
IntervalTimer.prototype.cancelAndSet = function (runner, interval) {
this.cancel();
this._token = setInterval(function () {
runner();
}, interval);
};
return IntervalTimer;
}());
var RunOnceScheduler = /** @class */ (function () {
function RunOnceScheduler(runner, timeout) {
this.timeoutToken = -1;
this.runner = runner;
this.timeout = timeout;
this.timeoutHandler = this.onTimeout.bind(this);
}
/**
* Dispose RunOnceScheduler
*/
RunOnceScheduler.prototype.dispose = function () {
this.cancel();
this.runner = null;
};
/**
* Cancel current scheduled runner (if any).
*/
RunOnceScheduler.prototype.cancel = function () {
if (this.isScheduled()) {
clearTimeout(this.timeoutToken);
this.timeoutToken = -1;
}
};
/**
* Cancel previous runner (if any) & schedule a new runner.
*/
RunOnceScheduler.prototype.schedule = function (delay) {
if (delay === void 0) { delay = this.timeout; }
this.cancel();
this.timeoutToken = setTimeout(this.timeoutHandler, delay);
};
/**
* Returns true if scheduled.
*/
RunOnceScheduler.prototype.isScheduled = function () {
return this.timeoutToken !== -1;
};
RunOnceScheduler.prototype.onTimeout = function () {
this.timeoutToken = -1;
if (this.runner) {
this.doRun();
}
};
RunOnceScheduler.prototype.doRun = function () {
if (this.runner) {
this.runner();
}
};
return RunOnceScheduler;
}());
/**
* Execute the callback the next time the browser is idle
*/
var runWhenIdle;
(function () {
if (typeof requestIdleCallback !== 'function' || typeof cancelIdleCallback !== 'function') {
var dummyIdle_1 = Object.freeze({
didTimeout: true,
timeRemaining: function () { return 15; }
});
runWhenIdle = function (runner) {
var handle = setTimeout(function () { return runner(dummyIdle_1); });
var disposed = false;
return {
dispose: function () {
if (disposed) {
return;
}
disposed = true;
clearTimeout(handle);
}
};
};
}
else {
runWhenIdle = function (runner, timeout) {
var handle = requestIdleCallback(runner, typeof timeout === 'number' ? { timeout: timeout } : undefined);
var disposed = false;
return {
dispose: function () {
if (disposed) {
return;
}
disposed = true;
cancelIdleCallback(handle);
}
};
};
}
})();
/**
* An implementation of the "idle-until-urgent"-strategy as introduced
* here: https://philipwalton.com/articles/idle-until-urgent/
*/
var IdleValue = /** @class */ (function () {
function IdleValue(executor) {
var _this = this;
this._didRun = false;
this._executor = function () {
try {
_this._value = executor();
}
catch (err) {
_this._error = err;
}
finally {
_this._didRun = true;
}
};
this._handle = runWhenIdle(function () { return _this._executor(); });
}
IdleValue.prototype.dispose = function () {
this._handle.dispose();
};
IdleValue.prototype.getValue = function () {
if (!this._didRun) {
this._handle.dispose();
this._executor();
}
if (this._error) {
throw this._error;
}
return this._value;
};
return IdleValue;
}());
/***/ }),
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return isString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isBoolean; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isUndefined; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return isUndefinedOrNull; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return assertType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isEmptyObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return validateConstraints; });
/* unused harmony export validateConstraint */
/* unused harmony export getAllPropertyNames */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getAllMethodNames; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createProxyObject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return withNullAsUndefined; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return withUndefinedAsNull; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var _typeof = {
number: 'number',
string: 'string',
undefined: 'undefined',
object: 'object',
function: 'function'
};
/**
* @returns whether the provided parameter is a JavaScript Array or not.
*/
function isArray(array) {
if (Array.isArray) {
return Array.isArray(array);
}
if (array && typeof (array.length) === _typeof.number && array.constructor === Array) {
return true;
}
return false;
}
/**
* @returns whether the provided parameter is a JavaScript String or not.
*/
function isString(str) {
if (typeof (str) === _typeof.string || str instanceof String) {
return true;
}
return false;
}
/**
*
* @returns whether the provided parameter is of type `object` but **not**
* `null`, an `array`, a `regexp`, nor a `date`.
*/
function isObject(obj) {
// The method can't do a type cast since there are type (like strings) which
// are subclasses of any put not positvely matched by the function. Hence type
// narrowing results in wrong results.
return typeof obj === _typeof.object
&& obj !== null
&& !Array.isArray(obj)
&& !(obj instanceof RegExp)
&& !(obj instanceof Date);
}
/**
* In **contrast** to just checking `typeof` this will return `false` for `NaN`.
* @returns whether the provided parameter is a JavaScript Number or not.
*/
function isNumber(obj) {
if ((typeof (obj) === _typeof.number || obj instanceof Number) && !isNaN(obj)) {
return true;
}
return false;
}
/**
* @returns whether the provided parameter is a JavaScript Boolean or not.
*/
function isBoolean(obj) {
return obj === true || obj === false;
}
/**
* @returns whether the provided parameter is undefined.
*/
function isUndefined(obj) {
return typeof (obj) === _typeof.undefined;
}
/**
* @returns whether the provided parameter is undefined or null.
*/
function isUndefinedOrNull(obj) {
return isUndefined(obj) || obj === null;
}
function assertType(condition, type) {
if (!condition) {
throw new Error(type ? "Unexpected type, expected '" + type + "'" : 'Unexpected type');
}
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* @returns whether the provided parameter is an empty JavaScript Object or not.
*/
function isEmptyObject(obj) {
if (!isObject(obj)) {
return false;
}
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) {
return false;
}
}
return true;
}
/**
* @returns whether the provided parameter is a JavaScript Function or not.
*/
function isFunction(obj) {
return typeof obj === _typeof.function;
}
function validateConstraints(args, constraints) {
var len = Math.min(args.length, constraints.length);
for (var 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 (_a) {
// ignore
}
if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {
return;
}
if (constraint.length === 1 && constraint.call(undefined, arg) === true) {
return;
}
throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true");
}
}
function getAllPropertyNames(obj) {
var res = [];
var proto = Object.getPrototypeOf(obj);
while (Object.prototype !== proto) {
res = res.concat(Object.getOwnPropertyNames(proto));
proto = Object.getPrototypeOf(proto);
}
return res;
}
function getAllMethodNames(obj) {
var methods = [];
for (var _i = 0, _a = getAllPropertyNames(obj); _i < _a.length; _i++) {
var prop = _a[_i];
if (typeof obj[prop] === 'function') {
methods.push(prop);
}
}
return methods;
}
function createProxyObject(methodNames, invoke) {
var createProxyMethod = function (method) {
return function () {
var args = Array.prototype.slice.call(arguments, 0);
return invoke(method, args);
};
};
var result = {};
for (var _i = 0, methodNames_1 = methodNames; _i < methodNames_1.length; _i++) {
var methodName = methodNames_1[_i];
result[methodName] = createProxyMethod(methodName);
}
return result;
}
/**
* Converts null to undefined, passes all other values through.
*/
function withNullAsUndefined(x) {
return x === null ? undefined : x;
}
/**
* Converts undefined to null, passes all other values through.
*/
function withUndefinedAsNull(x) {
return typeof x === 'undefined' ? null : x;
}
/***/ }),
/* 22 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _util; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IInstantiationService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return createDecorator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return optional; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// ------ internal util
var _util;
(function (_util) {
_util.serviceIds = new Map();
_util.DI_TARGET = '$di$target';
_util.DI_DEPENDENCIES = '$di$dependencies';
function getServiceDependencies(ctor) {
return ctor[_util.DI_DEPENDENCIES] || [];
}
_util.getServiceDependencies = getServiceDependencies;
})(_util || (_util = {}));
var IInstantiationService = createDecorator('instantiationService');
function storeServiceDependency(id, target, index, optional) {
if (target[_util.DI_TARGET] === target) {
target[_util.DI_DEPENDENCIES].push({ id: id, index: index, optional: optional });
}
else {
target[_util.DI_DEPENDENCIES] = [{ id: id, index: index, optional: optional }];
target[_util.DI_TARGET] = target;
}
}
/**
* A *only* valid way to create a {{ServiceIdentifier}}.
*/
function createDecorator(serviceId) {
if (_util.serviceIds.has(serviceId)) {
return _util.serviceIds.get(serviceId);
}
var 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, false);
};
id.toString = function () { return serviceId; };
_util.serviceIds.set(serviceId, id);
return id;
}
/**
* Mark a service dependency as optional.
*/
function optional(serviceIdentifier) {
return function (target, key, index) {
if (arguments.length !== 3) {
throw new Error('@optional-decorator can only be used to decorate a parameter');
}
storeServiceDependency(serviceIdentifier, target, index, true);
};
}
/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CursorConfiguration; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return SingleCursorState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CursorContext; });
/* unused harmony export PartialModelCursorState */
/* unused harmony export PartialViewCursorState */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return CursorState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return EditOperationResult; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CursorColumns; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isQuote; });
/* harmony import */ var _base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
/* harmony import */ var _core_selection_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24);
/* harmony import */ var _model_textModel_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(30);
/* harmony import */ var _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(33);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var autoCloseAlways = function () { return true; };
var autoCloseNever = function () { return false; };
var autoCloseBeforeWhitespace = function (chr) { return (chr === ' ' || chr === '\t'); };
function appendEntry(target, key, value) {
if (target.has(key)) {
target.get(key).push(value);
}
else {
target.set(key, [value]);
}
}
var CursorConfiguration = /** @class */ (function () {
function CursorConfiguration(languageIdentifier, modelOptions, configuration) {
this._languageIdentifier = languageIdentifier;
var options = configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this.readOnly = options.get(68 /* readOnly */);
this.tabSize = modelOptions.tabSize;
this.indentSize = modelOptions.indentSize;
this.insertSpaces = modelOptions.insertSpaces;
this.lineHeight = options.get(49 /* lineHeight */);
this.pageSize = Math.max(1, Math.floor(layoutInfo.height / this.lineHeight) - 2);
this.useTabStops = options.get(95 /* useTabStops */);
this.wordSeparators = options.get(96 /* wordSeparators */);
this.emptySelectionClipboard = options.get(25 /* emptySelectionClipboard */);
this.copyWithSyntaxHighlighting = options.get(15 /* copyWithSyntaxHighlighting */);
this.multiCursorMergeOverlapping = options.get(58 /* multiCursorMergeOverlapping */);
this.multiCursorPaste = options.get(60 /* multiCursorPaste */);
this.autoClosingBrackets = options.get(5 /* autoClosingBrackets */);
this.autoClosingQuotes = options.get(7 /* autoClosingQuotes */);
this.autoClosingOvertype = options.get(6 /* autoClosingOvertype */);
this.autoSurround = options.get(10 /* autoSurround */);
this.autoIndent = options.get(8 /* autoIndent */);
this.autoClosingPairsOpen2 = new Map();
this.autoClosingPairsClose2 = new Map();
this.surroundingPairs = {};
this._electricChars = null;
this.shouldAutoCloseBefore = {
quote: CursorConfiguration._getShouldAutoClose(languageIdentifier, this.autoClosingQuotes),
bracket: CursorConfiguration._getShouldAutoClose(languageIdentifier, this.autoClosingBrackets)
};
var autoClosingPairs = CursorConfiguration._getAutoClosingPairs(languageIdentifier);
if (autoClosingPairs) {
for (var _i = 0, autoClosingPairs_1 = autoClosingPairs; _i < autoClosingPairs_1.length; _i++) {
var pair = autoClosingPairs_1[_i];
appendEntry(this.autoClosingPairsOpen2, pair.open.charAt(pair.open.length - 1), pair);
if (pair.close.length === 1) {
appendEntry(this.autoClosingPairsClose2, pair.close, pair);
}
}
}
var surroundingPairs = CursorConfiguration._getSurroundingPairs(languageIdentifier);
if (surroundingPairs) {
for (var _a = 0, surroundingPairs_1 = surroundingPairs; _a < surroundingPairs_1.length; _a++) {
var pair = surroundingPairs_1[_a];
this.surroundingPairs[pair.open] = pair.close;
}
}
}
CursorConfiguration.shouldRecreate = function (e) {
return (e.hasChanged(107 /* layoutInfo */)
|| e.hasChanged(96 /* wordSeparators */)
|| e.hasChanged(25 /* emptySelectionClipboard */)
|| e.hasChanged(58 /* multiCursorMergeOverlapping */)
|| e.hasChanged(60 /* multiCursorPaste */)
|| e.hasChanged(5 /* autoClosingBrackets */)
|| e.hasChanged(7 /* autoClosingQuotes */)
|| e.hasChanged(6 /* autoClosingOvertype */)
|| e.hasChanged(10 /* autoSurround */)
|| e.hasChanged(95 /* useTabStops */)
|| e.hasChanged(49 /* lineHeight */)
|| e.hasChanged(68 /* readOnly */));
};
Object.defineProperty(CursorConfiguration.prototype, "electricChars", {
get: function () {
if (!this._electricChars) {
this._electricChars = {};
var electricChars = CursorConfiguration._getElectricCharacters(this._languageIdentifier);
if (electricChars) {
for (var _i = 0, electricChars_1 = electricChars; _i < electricChars_1.length; _i++) {
var char = electricChars_1[_i];
this._electricChars[char] = true;
}
}
}
return this._electricChars;
},
enumerable: true,
configurable: true
});
CursorConfiguration.prototype.normalizeIndentation = function (str) {
return _model_textModel_js__WEBPACK_IMPORTED_MODULE_5__[/* TextModel */ "b"].normalizeIndentation(str, this.indentSize, this.insertSpaces);
};
CursorConfiguration._getElectricCharacters = function (languageIdentifier) {
try {
return _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_6__[/* LanguageConfigurationRegistry */ "a"].getElectricCharacters(languageIdentifier.id);
}
catch (e) {
Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* onUnexpectedError */ "e"])(e);
return null;
}
};
CursorConfiguration._getAutoClosingPairs = function (languageIdentifier) {
try {
return _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_6__[/* LanguageConfigurationRegistry */ "a"].getAutoClosingPairs(languageIdentifier.id);
}
catch (e) {
Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* onUnexpectedError */ "e"])(e);
return null;
}
};
CursorConfiguration._getShouldAutoClose = function (languageIdentifier, autoCloseConfig) {
switch (autoCloseConfig) {
case 'beforeWhitespace':
return autoCloseBeforeWhitespace;
case 'languageDefined':
return CursorConfiguration._getLanguageDefinedShouldAutoClose(languageIdentifier);
case 'always':
return autoCloseAlways;
case 'never':
return autoCloseNever;
}
};
CursorConfiguration._getLanguageDefinedShouldAutoClose = function (languageIdentifier) {
try {
var autoCloseBeforeSet_1 = _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_6__[/* LanguageConfigurationRegistry */ "a"].getAutoCloseBeforeSet(languageIdentifier.id);
return function (c) { return autoCloseBeforeSet_1.indexOf(c) !== -1; };
}
catch (e) {
Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* onUnexpectedError */ "e"])(e);
return autoCloseNever;
}
};
CursorConfiguration._getSurroundingPairs = function (languageIdentifier) {
try {
return _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_6__[/* LanguageConfigurationRegistry */ "a"].getSurroundingPairs(languageIdentifier.id);
}
catch (e) {
Object(_base_common_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* onUnexpectedError */ "e"])(e);
return null;
}
};
return CursorConfiguration;
}());
/**
* Represents the cursor state on either the model or on the view model.
*/
var SingleCursorState = /** @class */ (function () {
function SingleCursorState(selectionStart, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns) {
this.selectionStart = selectionStart;
this.selectionStartLeftoverVisibleColumns = selectionStartLeftoverVisibleColumns;
this.position = position;
this.leftoverVisibleColumns = leftoverVisibleColumns;
this.selection = SingleCursorState._computeSelection(this.selectionStart, this.position);
}
SingleCursorState.prototype.equals = function (other) {
return (this.selectionStartLeftoverVisibleColumns === other.selectionStartLeftoverVisibleColumns
&& this.leftoverVisibleColumns === other.leftoverVisibleColumns
&& this.position.equals(other.position)
&& this.selectionStart.equalsRange(other.selectionStart));
};
SingleCursorState.prototype.hasSelection = function () {
return (!this.selection.isEmpty() || !this.selectionStart.isEmpty());
};
SingleCursorState.prototype.move = function (inSelectionMode, lineNumber, column, leftoverVisibleColumns) {
if (inSelectionMode) {
// move just position
return new SingleCursorState(this.selectionStart, this.selectionStartLeftoverVisibleColumns, new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](lineNumber, column), leftoverVisibleColumns);
}
else {
// move everything
return new SingleCursorState(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](lineNumber, column, lineNumber, column), leftoverVisibleColumns, new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](lineNumber, column), leftoverVisibleColumns);
}
};
SingleCursorState._computeSelection = function (selectionStart, position) {
var startLineNumber, startColumn, endLineNumber, endColumn;
if (selectionStart.isEmpty()) {
startLineNumber = selectionStart.startLineNumber;
startColumn = selectionStart.startColumn;
endLineNumber = position.lineNumber;
endColumn = position.column;
}
else {
if (position.isBeforeOrEqual(selectionStart.getStartPosition())) {
startLineNumber = selectionStart.endLineNumber;
startColumn = selectionStart.endColumn;
endLineNumber = position.lineNumber;
endColumn = position.column;
}
else {
startLineNumber = selectionStart.startLineNumber;
startColumn = selectionStart.startColumn;
endLineNumber = position.lineNumber;
endColumn = position.column;
}
}
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_4__[/* Selection */ "a"](startLineNumber, startColumn, endLineNumber, endColumn);
};
return SingleCursorState;
}());
var CursorContext = /** @class */ (function () {
function CursorContext(configuration, model, viewModel) {
this.model = model;
this.viewModel = viewModel;
this.config = new CursorConfiguration(this.model.getLanguageIdentifier(), this.model.getOptions(), configuration);
}
CursorContext.prototype.validateViewPosition = function (viewPosition, modelPosition) {
return this.viewModel.coordinatesConverter.validateViewPosition(viewPosition, modelPosition);
};
CursorContext.prototype.validateViewRange = function (viewRange, expectedModelRange) {
return this.viewModel.coordinatesConverter.validateViewRange(viewRange, expectedModelRange);
};
CursorContext.prototype.convertViewRangeToModelRange = function (viewRange) {
return this.viewModel.coordinatesConverter.convertViewRangeToModelRange(viewRange);
};
CursorContext.prototype.convertViewPositionToModelPosition = function (lineNumber, column) {
return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](lineNumber, column));
};
CursorContext.prototype.convertModelPositionToViewPosition = function (modelPosition) {
return this.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
};
CursorContext.prototype.convertModelRangeToViewRange = function (modelRange) {
return this.viewModel.coordinatesConverter.convertModelRangeToViewRange(modelRange);
};
CursorContext.prototype.getCurrentScrollTop = function () {
return this.viewModel.viewLayout.getCurrentScrollTop();
};
CursorContext.prototype.getCompletelyVisibleViewRange = function () {
return this.viewModel.getCompletelyVisibleViewRange();
};
CursorContext.prototype.getCompletelyVisibleModelRange = function () {
var viewRange = this.viewModel.getCompletelyVisibleViewRange();
return this.viewModel.coordinatesConverter.convertViewRangeToModelRange(viewRange);
};
CursorContext.prototype.getCompletelyVisibleViewRangeAtScrollTop = function (scrollTop) {
return this.viewModel.getCompletelyVisibleViewRangeAtScrollTop(scrollTop);
};
CursorContext.prototype.getVerticalOffsetForViewLine = function (viewLineNumber) {
return this.viewModel.viewLayout.getVerticalOffsetForLineNumber(viewLineNumber);
};
return CursorContext;
}());
var PartialModelCursorState = /** @class */ (function () {
function PartialModelCursorState(modelState) {
this.modelState = modelState;
this.viewState = null;
}
return PartialModelCursorState;
}());
var PartialViewCursorState = /** @class */ (function () {
function PartialViewCursorState(viewState) {
this.modelState = null;
this.viewState = viewState;
}
return PartialViewCursorState;
}());
var CursorState = /** @class */ (function () {
function CursorState(modelState, viewState) {
this.modelState = modelState;
this.viewState = viewState;
}
CursorState.fromModelState = function (modelState) {
return new PartialModelCursorState(modelState);
};
CursorState.fromViewState = function (viewState) {
return new PartialViewCursorState(viewState);
};
CursorState.fromModelSelection = function (modelSelection) {
var selectionStartLineNumber = modelSelection.selectionStartLineNumber;
var selectionStartColumn = modelSelection.selectionStartColumn;
var positionLineNumber = modelSelection.positionLineNumber;
var positionColumn = modelSelection.positionColumn;
var modelState = new SingleCursorState(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](selectionStartLineNumber, selectionStartColumn, selectionStartLineNumber, selectionStartColumn), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](positionLineNumber, positionColumn), 0);
return CursorState.fromModelState(modelState);
};
CursorState.fromModelSelections = function (modelSelections) {
var states = [];
for (var i = 0, len = modelSelections.length; i < len; i++) {
states[i] = this.fromModelSelection(modelSelections[i]);
}
return states;
};
CursorState.prototype.equals = function (other) {
return (this.viewState.equals(other.viewState) && this.modelState.equals(other.modelState));
};
return CursorState;
}());
var EditOperationResult = /** @class */ (function () {
function EditOperationResult(type, commands, opts) {
this.type = type;
this.commands = commands;
this.shouldPushStackElementBefore = opts.shouldPushStackElementBefore;
this.shouldPushStackElementAfter = opts.shouldPushStackElementAfter;
}
return EditOperationResult;
}());
/**
* Common operations that work and make sense both on the model and on the view model.
*/
var CursorColumns = /** @class */ (function () {
function CursorColumns() {
}
CursorColumns.visibleColumnFromColumn = function (lineContent, column, tabSize) {
var lineContentLength = lineContent.length;
var endOffset = column - 1 < lineContentLength ? column - 1 : lineContentLength;
var result = 0;
var i = 0;
while (i < endOffset) {
var codePoint = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getNextCodePoint */ "u"](lineContent, endOffset, i);
i += (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
if (codePoint === 9 /* Tab */) {
result = CursorColumns.nextRenderTabStop(result, tabSize);
}
else {
var graphemeBreakType = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getGraphemeBreakType */ "s"](codePoint);
while (i < endOffset) {
var nextCodePoint = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getNextCodePoint */ "u"](lineContent, endOffset, i);
var nextGraphemeBreakType = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getGraphemeBreakType */ "s"](nextCodePoint);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* breakBetweenGraphemeBreakType */ "b"](graphemeBreakType, nextGraphemeBreakType)) {
break;
}
i += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
graphemeBreakType = nextGraphemeBreakType;
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* isFullWidthCharacter */ "y"](codePoint) || _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* isEmojiImprecise */ "w"](codePoint)) {
result = result + 2;
}
else {
result = result + 1;
}
}
}
return result;
};
CursorColumns.visibleColumnFromColumn2 = function (config, model, position) {
return this.visibleColumnFromColumn(model.getLineContent(position.lineNumber), position.column, config.tabSize);
};
CursorColumns.columnFromVisibleColumn = function (lineContent, visibleColumn, tabSize) {
if (visibleColumn <= 0) {
return 1;
}
var lineLength = lineContent.length;
var beforeVisibleColumn = 0;
var beforeColumn = 1;
var i = 0;
while (i < lineLength) {
var codePoint = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getNextCodePoint */ "u"](lineContent, lineLength, i);
i += (codePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
var afterVisibleColumn = void 0;
if (codePoint === 9 /* Tab */) {
afterVisibleColumn = CursorColumns.nextRenderTabStop(beforeVisibleColumn, tabSize);
}
else {
var graphemeBreakType = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getGraphemeBreakType */ "s"](codePoint);
while (i < lineLength) {
var nextCodePoint = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getNextCodePoint */ "u"](lineContent, lineLength, i);
var nextGraphemeBreakType = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* getGraphemeBreakType */ "s"](nextCodePoint);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* breakBetweenGraphemeBreakType */ "b"](graphemeBreakType, nextGraphemeBreakType)) {
break;
}
i += (nextCodePoint >= 65536 /* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */ ? 2 : 1);
graphemeBreakType = nextGraphemeBreakType;
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* isFullWidthCharacter */ "y"](codePoint) || _base_common_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* isEmojiImprecise */ "w"](codePoint)) {
afterVisibleColumn = beforeVisibleColumn + 2;
}
else {
afterVisibleColumn = beforeVisibleColumn + 1;
}
}
var afterColumn = i + 1;
if (afterVisibleColumn >= visibleColumn) {
var beforeDelta = visibleColumn - beforeVisibleColumn;
var afterDelta = afterVisibleColumn - visibleColumn;
if (afterDelta < beforeDelta) {
return afterColumn;
}
else {
return beforeColumn;
}
}
beforeVisibleColumn = afterVisibleColumn;
beforeColumn = afterColumn;
}
// walked the entire string
return lineLength + 1;
};
CursorColumns.columnFromVisibleColumn2 = function (config, model, lineNumber, visibleColumn) {
var result = this.columnFromVisibleColumn(model.getLineContent(lineNumber), visibleColumn, config.tabSize);
var minColumn = model.getLineMinColumn(lineNumber);
if (result < minColumn) {
return minColumn;
}
var maxColumn = model.getLineMaxColumn(lineNumber);
if (result > maxColumn) {
return maxColumn;
}
return result;
};
/**
* ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)
*/
CursorColumns.nextRenderTabStop = function (visibleColumn, tabSize) {
return visibleColumn + tabSize - visibleColumn % tabSize;
};
/**
* ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)
*/
CursorColumns.nextIndentTabStop = function (visibleColumn, indentSize) {
return visibleColumn + indentSize - visibleColumn % indentSize;
};
/**
* ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)
*/
CursorColumns.prevRenderTabStop = function (column, tabSize) {
return column - 1 - (column - 1) % tabSize;
};
/**
* ATTENTION: This works with 0-based columns (as oposed to the regular 1-based columns)
*/
CursorColumns.prevIndentTabStop = function (column, indentSize) {
return column - 1 - (column - 1) % indentSize;
};
return CursorColumns;
}());
function isQuote(ch) {
return (ch === '\'' || ch === '"' || ch === '`');
}
/***/ }),
/* 24 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Selection; });
/* harmony import */ var _position_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
/* harmony import */ var _range_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* A selection in the editor.
* The selection is a range that has an orientation.
*/
var Selection = /** @class */ (function (_super) {
__extends(Selection, _super);
function Selection(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) {
var _this = _super.call(this, selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn) || this;
_this.selectionStartLineNumber = selectionStartLineNumber;
_this.selectionStartColumn = selectionStartColumn;
_this.positionLineNumber = positionLineNumber;
_this.positionColumn = positionColumn;
return _this;
}
/**
* Transform to a human-readable representation.
*/
Selection.prototype.toString = function () {
return '[' + this.selectionStartLineNumber + ',' + this.selectionStartColumn + ' -> ' + this.positionLineNumber + ',' + this.positionColumn + ']';
};
/**
* Test if equals other selection.
*/
Selection.prototype.equalsSelection = function (other) {
return (Selection.selectionsEqual(this, other));
};
/**
* Test if the two selections are equal.
*/
Selection.selectionsEqual = function (a, b) {
return (a.selectionStartLineNumber === b.selectionStartLineNumber &&
a.selectionStartColumn === b.selectionStartColumn &&
a.positionLineNumber === b.positionLineNumber &&
a.positionColumn === b.positionColumn);
};
/**
* Get directions (LTR or RTL).
*/
Selection.prototype.getDirection = function () {
if (this.selectionStartLineNumber === this.startLineNumber && this.selectionStartColumn === this.startColumn) {
return 0 /* LTR */;
}
return 1 /* RTL */;
};
/**
* Create a new selection with a different `positionLineNumber` and `positionColumn`.
*/
Selection.prototype.setEndPosition = function (endLineNumber, endColumn) {
if (this.getDirection() === 0 /* LTR */) {
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`.
*/
Selection.prototype.getPosition = function () {
return new _position_js__WEBPACK_IMPORTED_MODULE_0__[/* Position */ "a"](this.positionLineNumber, this.positionColumn);
};
/**
* Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
*/
Selection.prototype.setStartPosition = function (startLineNumber, startColumn) {
if (this.getDirection() === 0 /* LTR */) {
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
*/
Selection.fromPositions = function (start, end) {
if (end === void 0) { end = start; }
return new Selection(start.lineNumber, start.column, end.lineNumber, end.column);
};
/**
* Create a `Selection` from an `ISelection`.
*/
Selection.liftSelection = function (sel) {
return new Selection(sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);
};
/**
* `a` equals `b`.
*/
Selection.selectionsArrEqual = function (a, b) {
if (a && !b || !a && b) {
return false;
}
if (!a && !b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (var i = 0, len = a.length; i < len; i++) {
if (!this.selectionsEqual(a[i], b[i])) {
return false;
}
}
return true;
};
/**
* Test if `obj` is an `ISelection`.
*/
Selection.isISelection = function (obj) {
return (obj
&& (typeof obj.selectionStartLineNumber === 'number')
&& (typeof obj.selectionStartColumn === 'number')
&& (typeof obj.positionLineNumber === 'number')
&& (typeof obj.positionColumn === 'number'));
};
/**
* Create with a direction.
*/
Selection.createWithDirection = function (startLineNumber, startColumn, endLineNumber, endColumn, direction) {
if (direction === 0 /* LTR */) {
return new Selection(startLineNumber, startColumn, endLineNumber, endColumn);
}
return new Selection(endLineNumber, endColumn, startLineNumber, startColumn);
};
return Selection;
}(_range_js__WEBPACK_IMPORTED_MODULE_1__[/* Range */ "a"]));
/***/ }),
/* 25 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getZoomLevel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getTimeSinceLastZoomLevelChanged; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return onDidChangeZoomLevel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getPixelRatio; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isIE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isEdge; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isEdgeOrIE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isFirefox; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return isWebKit; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isChrome; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isSafari; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return isWebkitWebView; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return isIPad; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isEdgeWebView; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return isStandalone; });
/* harmony import */ var _common_event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var WindowManager = /** @class */ (function () {
function WindowManager() {
// --- Zoom Level
this._zoomLevel = 0;
this._lastZoomLevelChangeTime = 0;
this._onDidChangeZoomLevel = new _common_event_js__WEBPACK_IMPORTED_MODULE_0__[/* Emitter */ "a"]();
this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
}
WindowManager.prototype.getZoomLevel = function () {
return this._zoomLevel;
};
WindowManager.prototype.getTimeSinceLastZoomLevelChanged = function () {
return Date.now() - this._lastZoomLevelChangeTime;
};
// --- Pixel Ratio
WindowManager.prototype.getPixelRatio = function () {
var ctx = document.createElement('canvas').getContext('2d');
var dpr = window.devicePixelRatio || 1;
var bsr = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
return dpr / bsr;
};
WindowManager.INSTANCE = new WindowManager();
return WindowManager;
}());
function getZoomLevel() {
return WindowManager.INSTANCE.getZoomLevel();
}
/** Returns the time (in ms) since the zoom level was changed */
function getTimeSinceLastZoomLevelChanged() {
return WindowManager.INSTANCE.getTimeSinceLastZoomLevelChanged();
}
function onDidChangeZoomLevel(callback) {
return WindowManager.INSTANCE.onDidChangeZoomLevel(callback);
}
function getPixelRatio() {
return WindowManager.INSTANCE.getPixelRatio();
}
var userAgent = navigator.userAgent;
var isIE = (userAgent.indexOf('Trident') >= 0);
var isEdge = (userAgent.indexOf('Edge/') >= 0);
var isEdgeOrIE = isIE || isEdge;
var isFirefox = (userAgent.indexOf('Firefox') >= 0);
var isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
var isChrome = (userAgent.indexOf('Chrome') >= 0);
var isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));
var isWebkitWebView = (!isChrome && !isSafari && isWebKit);
var isIPad = (userAgent.indexOf('iPad') >= 0 || (isSafari && navigator.maxTouchPoints > 0));
var isEdgeWebView = isEdge && (userAgent.indexOf('WebView/') >= 0);
var isStandalone = (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches);
/***/ }),
/* 26 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return MINIMAP_GUTTER_WIDTH; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ConfigurationChangedEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ValidatedEditorOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return TextEditorCursorStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return EditorFontLigatures; });
/* unused harmony export EditorLayoutInfoComputer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return filterValidationDecorations; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return EDITOR_FONT_DEFAULTS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return EDITOR_MODEL_DEFAULTS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return editorOptionsRegistry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return EditorOptions; });
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/* harmony import */ var _model_wordHelper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(123);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* @internal
* The width of the minimap gutter, in pixels.
*/
var MINIMAP_GUTTER_WIDTH = 8;
//#endregion
/**
* An event describing that the configuration of the editor has changed.
*/
var ConfigurationChangedEvent = /** @class */ (function () {
/**
* @internal
*/
function ConfigurationChangedEvent(values) {
this._values = values;
}
ConfigurationChangedEvent.prototype.hasChanged = function (id) {
return this._values[id];
};
return ConfigurationChangedEvent;
}());
/**
* @internal
*/
var ValidatedEditorOptions = /** @class */ (function () {
function ValidatedEditorOptions() {
this._values = [];
}
ValidatedEditorOptions.prototype._read = function (option) {
return this._values[option];
};
ValidatedEditorOptions.prototype.get = function (id) {
return this._values[id];
};
ValidatedEditorOptions.prototype._write = function (option, value) {
this._values[option] = value;
};
return ValidatedEditorOptions;
}());
/**
* @internal
*/
var BaseEditorOption = /** @class */ (function () {
function BaseEditorOption(id, name, defaultValue, schema) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.schema = schema;
}
BaseEditorOption.prototype.compute = function (env, options, value) {
return value;
};
return BaseEditorOption;
}());
/**
* @internal
*/
var ComputedEditorOption = /** @class */ (function () {
function ComputedEditorOption(id, deps) {
if (deps === void 0) { deps = null; }
this.schema = undefined;
this.id = id;
this.name = '_never_';
this.defaultValue = undefined;
this.deps = deps;
}
ComputedEditorOption.prototype.validate = function (input) {
return this.defaultValue;
};
return ComputedEditorOption;
}());
var SimpleEditorOption = /** @class */ (function () {
function SimpleEditorOption(id, name, defaultValue, schema) {
this.id = id;
this.name = name;
this.defaultValue = defaultValue;
this.schema = schema;
}
SimpleEditorOption.prototype.validate = function (input) {
if (typeof input === 'undefined') {
return this.defaultValue;
}
return input;
};
SimpleEditorOption.prototype.compute = function (env, options, value) {
return value;
};
return SimpleEditorOption;
}());
var EditorBooleanOption = /** @class */ (function (_super) {
__extends(EditorBooleanOption, _super);
function EditorBooleanOption(id, name, defaultValue, schema) {
if (schema === void 0) { schema = undefined; }
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'boolean';
schema.default = defaultValue;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
return _this;
}
EditorBooleanOption.boolean = function (value, defaultValue) {
if (typeof value === 'undefined') {
return defaultValue;
}
if (value === 'false') {
// treat the string 'false' as false
return false;
}
return Boolean(value);
};
EditorBooleanOption.prototype.validate = function (input) {
return EditorBooleanOption.boolean(input, this.defaultValue);
};
return EditorBooleanOption;
}(SimpleEditorOption));
var EditorIntOption = /** @class */ (function (_super) {
__extends(EditorIntOption, _super);
function EditorIntOption(id, name, defaultValue, minimum, maximum, schema) {
if (schema === void 0) { schema = undefined; }
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'integer';
schema.default = defaultValue;
schema.minimum = minimum;
schema.maximum = maximum;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
_this.minimum = minimum;
_this.maximum = maximum;
return _this;
}
EditorIntOption.clampedInt = function (value, defaultValue, minimum, maximum) {
var r;
if (typeof value === 'undefined') {
r = defaultValue;
}
else {
r = parseInt(value, 10);
if (isNaN(r)) {
r = defaultValue;
}
}
r = Math.max(minimum, r);
r = Math.min(maximum, r);
return r | 0;
};
EditorIntOption.prototype.validate = function (input) {
return EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);
};
return EditorIntOption;
}(SimpleEditorOption));
var EditorFloatOption = /** @class */ (function (_super) {
__extends(EditorFloatOption, _super);
function EditorFloatOption(id, name, defaultValue, validationFn, schema) {
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'number';
schema.default = defaultValue;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
_this.validationFn = validationFn;
return _this;
}
EditorFloatOption.clamp = function (n, min, max) {
if (n < min) {
return min;
}
if (n > max) {
return max;
}
return n;
};
EditorFloatOption.float = function (value, defaultValue) {
if (typeof value === 'number') {
return value;
}
if (typeof value === 'undefined') {
return defaultValue;
}
var r = parseFloat(value);
return (isNaN(r) ? defaultValue : r);
};
EditorFloatOption.prototype.validate = function (input) {
return this.validationFn(EditorFloatOption.float(input, this.defaultValue));
};
return EditorFloatOption;
}(SimpleEditorOption));
var EditorStringOption = /** @class */ (function (_super) {
__extends(EditorStringOption, _super);
function EditorStringOption(id, name, defaultValue, schema) {
if (schema === void 0) { schema = undefined; }
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'string';
schema.default = defaultValue;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
return _this;
}
EditorStringOption.string = function (value, defaultValue) {
if (typeof value !== 'string') {
return defaultValue;
}
return value;
};
EditorStringOption.prototype.validate = function (input) {
return EditorStringOption.string(input, this.defaultValue);
};
return EditorStringOption;
}(SimpleEditorOption));
var EditorStringEnumOption = /** @class */ (function (_super) {
__extends(EditorStringEnumOption, _super);
function EditorStringEnumOption(id, name, defaultValue, allowedValues, schema) {
if (schema === void 0) { schema = undefined; }
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'string';
schema.enum = allowedValues;
schema.default = defaultValue;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
_this._allowedValues = allowedValues;
return _this;
}
EditorStringEnumOption.stringSet = function (value, defaultValue, allowedValues) {
if (typeof value !== 'string') {
return defaultValue;
}
if (allowedValues.indexOf(value) === -1) {
return defaultValue;
}
return value;
};
EditorStringEnumOption.prototype.validate = function (input) {
return EditorStringEnumOption.stringSet(input, this.defaultValue, this._allowedValues);
};
return EditorStringEnumOption;
}(SimpleEditorOption));
var EditorEnumOption = /** @class */ (function (_super) {
__extends(EditorEnumOption, _super);
function EditorEnumOption(id, name, defaultValue, defaultStringValue, allowedValues, convert, schema) {
if (schema === void 0) { schema = undefined; }
var _this = this;
if (typeof schema !== 'undefined') {
schema.type = 'string';
schema.enum = allowedValues;
schema.default = defaultStringValue;
}
_this = _super.call(this, id, name, defaultValue, schema) || this;
_this._allowedValues = allowedValues;
_this._convert = convert;
return _this;
}
EditorEnumOption.prototype.validate = function (input) {
if (typeof input !== 'string') {
return this.defaultValue;
}
if (this._allowedValues.indexOf(input) === -1) {
return this.defaultValue;
}
return this._convert(input);
};
return EditorEnumOption;
}(BaseEditorOption));
//#endregion
//#region autoIndent
function _autoIndentFromString(autoIndent) {
switch (autoIndent) {
case 'none': return 0 /* None */;
case 'keep': return 1 /* Keep */;
case 'brackets': return 2 /* Brackets */;
case 'advanced': return 3 /* Advanced */;
case 'full': return 4 /* Full */;
}
}
//#endregion
//#region accessibilitySupport
var EditorAccessibilitySupport = /** @class */ (function (_super) {
__extends(EditorAccessibilitySupport, _super);
function EditorAccessibilitySupport() {
return _super.call(this, 2 /* accessibilitySupport */, 'accessibilitySupport', 0 /* Unknown */, {
type: 'string',
enum: ['auto', 'on', 'off'],
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilitySupport.auto', "The editor will use platform APIs to detect when a Screen Reader is attached."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilitySupport.on', "The editor will be permanently optimized for usage with a Screen Reader."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilitySupport.off', "The editor will never be optimized for usage with a Screen Reader."),
],
default: 'auto',
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilitySupport', "Controls whether the editor should run in a mode where it is optimized for screen readers.")
}) || this;
}
EditorAccessibilitySupport.prototype.validate = function (input) {
switch (input) {
case 'auto': return 0 /* Unknown */;
case 'off': return 1 /* Disabled */;
case 'on': return 2 /* Enabled */;
}
return this.defaultValue;
};
EditorAccessibilitySupport.prototype.compute = function (env, options, value) {
if (value === 0 /* Unknown */) {
// The editor reads the `accessibilitySupport` from the environment
return env.accessibilitySupport;
}
return value;
};
return EditorAccessibilitySupport;
}(BaseEditorOption));
var EditorComments = /** @class */ (function (_super) {
__extends(EditorComments, _super);
function EditorComments() {
var _this = this;
var defaults = {
insertSpace: true,
};
_this = _super.call(this, 13 /* comments */, 'comments', defaults, {
'editor.comments.insertSpace': {
type: 'boolean',
default: defaults.insertSpace,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('comments.insertSpace', "Controls whether a space character is inserted when commenting.")
},
}) || this;
return _this;
}
EditorComments.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
insertSpace: EditorBooleanOption.boolean(input.insertSpace, this.defaultValue.insertSpace),
};
};
return EditorComments;
}(BaseEditorOption));
function _cursorBlinkingStyleFromString(cursorBlinkingStyle) {
switch (cursorBlinkingStyle) {
case 'blink': return 1 /* Blink */;
case 'smooth': return 2 /* Smooth */;
case 'phase': return 3 /* Phase */;
case 'expand': return 4 /* Expand */;
case 'solid': return 5 /* Solid */;
}
}
//#endregion
//#region cursorStyle
/**
* The style in which the editor's cursor should be rendered.
*/
var TextEditorCursorStyle;
(function (TextEditorCursorStyle) {
/**
* As a vertical line (sitting between two characters).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Line"] = 1] = "Line";
/**
* As a block (sitting on top of a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Block"] = 2] = "Block";
/**
* As a horizontal line (sitting under a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Underline"] = 3] = "Underline";
/**
* As a thin vertical line (sitting between two characters).
*/
TextEditorCursorStyle[TextEditorCursorStyle["LineThin"] = 4] = "LineThin";
/**
* As an outlined block (sitting on top of a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["BlockOutline"] = 5] = "BlockOutline";
/**
* As a thin horizontal line (sitting under a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["UnderlineThin"] = 6] = "UnderlineThin";
})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));
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;
}
}
//#endregion
//#region editorClassName
var EditorClassName = /** @class */ (function (_super) {
__extends(EditorClassName, _super);
function EditorClassName() {
return _super.call(this, 104 /* editorClassName */, [55 /* mouseStyle */, 26 /* extraEditorClassName */]) || this;
}
EditorClassName.prototype.compute = function (env, options, _) {
var className = 'monaco-editor';
if (options.get(26 /* extraEditorClassName */)) {
className += ' ' + options.get(26 /* extraEditorClassName */);
}
if (env.extraEditorClassName) {
className += ' ' + env.extraEditorClassName;
}
if (options.get(55 /* mouseStyle */) === 'default') {
className += ' mouse-default';
}
else if (options.get(55 /* mouseStyle */) === 'copy') {
className += ' mouse-copy';
}
if (options.get(85 /* showUnused */)) {
className += ' showUnused';
}
return className;
};
return EditorClassName;
}(ComputedEditorOption));
//#endregion
//#region emptySelectionClipboard
var EditorEmptySelectionClipboard = /** @class */ (function (_super) {
__extends(EditorEmptySelectionClipboard, _super);
function EditorEmptySelectionClipboard() {
return _super.call(this, 25 /* emptySelectionClipboard */, 'emptySelectionClipboard', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.") }) || this;
}
EditorEmptySelectionClipboard.prototype.compute = function (env, options, value) {
return value && env.emptySelectionClipboard;
};
return EditorEmptySelectionClipboard;
}(EditorBooleanOption));
var EditorFind = /** @class */ (function (_super) {
__extends(EditorFind, _super);
function EditorFind() {
var _this = this;
var defaults = {
seedSearchStringFromSelection: true,
autoFindInSelection: 'never',
globalFindClipboard: false,
addExtraSpaceOnTop: true
};
_this = _super.call(this, 28 /* find */, 'find', defaults, {
'editor.find.seedSearchStringFromSelection': {
type: 'boolean',
default: defaults.seedSearchStringFromSelection,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.find.autoFindInSelection.never', 'Never turn on Find in selection automatically (default)'),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.find.autoFindInSelection.always', 'Always turn on Find in selection automatically'),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.find.autoFindInSelection.multiline', 'Turn on Find in selection automatically when multiple lines of content are selected.')
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('find.autoFindInSelection', "Controls whether the find operation is carried out on selected text or the entire file in the editor.")
},
'editor.find.globalFindClipboard': {
type: 'boolean',
default: defaults.globalFindClipboard,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('find.globalFindClipboard', "Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),
included: _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isMacintosh */ "e"]
},
'editor.find.addExtraSpaceOnTop': {
type: 'boolean',
default: defaults.addExtraSpaceOnTop,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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.")
}
}) || this;
return _this;
}
EditorFind.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
seedSearchStringFromSelection: EditorBooleanOption.boolean(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection),
autoFindInSelection: typeof _input.autoFindInSelection === 'boolean'
? (_input.autoFindInSelection ? 'always' : 'never')
: EditorStringEnumOption.stringSet(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ['never', 'always', 'multiline']),
globalFindClipboard: EditorBooleanOption.boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),
addExtraSpaceOnTop: EditorBooleanOption.boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop)
};
};
return EditorFind;
}(BaseEditorOption));
//#endregion
//#region fontLigatures
/**
* @internal
*/
var EditorFontLigatures = /** @class */ (function (_super) {
__extends(EditorFontLigatures, _super);
function EditorFontLigatures() {
return _super.call(this, 35 /* fontLigatures */, 'fontLigatures', EditorFontLigatures.OFF, {
anyOf: [
{
type: 'boolean',
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontLigatures', "Enables/Disables font ligatures."),
},
{
type: 'string',
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontFeatureSettings', "Explicit font-feature-settings.")
}
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontLigaturesGeneral', "Configures font ligatures."),
default: false
}) || this;
}
EditorFontLigatures.prototype.validate = function (input) {
if (typeof input === 'undefined') {
return this.defaultValue;
}
if (typeof input === 'string') {
if (input === 'false') {
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';
return EditorFontLigatures;
}(BaseEditorOption));
//#endregion
//#region fontInfo
var EditorFontInfo = /** @class */ (function (_super) {
__extends(EditorFontInfo, _super);
function EditorFontInfo() {
return _super.call(this, 34 /* fontInfo */) || this;
}
EditorFontInfo.prototype.compute = function (env, options, _) {
return env.fontInfo;
};
return EditorFontInfo;
}(ComputedEditorOption));
//#endregion
//#region fontSize
var EditorFontSize = /** @class */ (function (_super) {
__extends(EditorFontSize, _super);
function EditorFontSize() {
return _super.call(this, 36 /* fontSize */, 'fontSize', EDITOR_FONT_DEFAULTS.fontSize, {
type: 'number',
minimum: 6,
maximum: 100,
default: EDITOR_FONT_DEFAULTS.fontSize,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontSize', "Controls the font size in pixels.")
}) || this;
}
EditorFontSize.prototype.validate = function (input) {
var r = EditorFloatOption.float(input, this.defaultValue);
if (r === 0) {
return EDITOR_FONT_DEFAULTS.fontSize;
}
return EditorFloatOption.clamp(r, 6, 100);
};
EditorFontSize.prototype.compute = function (env, options, value) {
// The final fontSize respects the editor zoom level.
// So take the result from env.fontInfo
return env.fontInfo.fontSize;
};
return EditorFontSize;
}(SimpleEditorOption));
var EditorGoToLocation = /** @class */ (function (_super) {
__extends(EditorGoToLocation, _super);
function EditorGoToLocation() {
var _this = this;
var 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: '',
};
var jsonSubset = {
type: 'string',
enum: ['peek', 'gotoAndPeek', 'goto'],
default: defaults.multiple,
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others')
]
};
_this = _super.call(this, 41 /* gotoLocation */, 'gotoLocation', defaults, {
'editor.gotoLocation.multiple': {
deprecationMessage: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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': __assign({ description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.editor.gotoLocation.multipleDefinitions', "Controls the behavior the 'Go to Definition'-command when multiple target locations exist.") }, jsonSubset),
'editor.gotoLocation.multipleTypeDefinitions': __assign({ description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.editor.gotoLocation.multipleTypeDefinitions', "Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.") }, jsonSubset),
'editor.gotoLocation.multipleDeclarations': __assign({ description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.editor.gotoLocation.multipleDeclarations', "Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.") }, jsonSubset),
'editor.gotoLocation.multipleImplementations': __assign({ description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.editor.gotoLocation.multipleImplemenattions', "Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.") }, jsonSubset),
'editor.gotoLocation.multipleReferences': __assign({ description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('alternativeReferenceCommand', "Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")
},
}) || this;
return _this;
}
EditorGoToLocation.prototype.validate = function (_input) {
var _a, _b, _c, _d, _e;
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
multiple: EditorStringEnumOption.stringSet(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),
multipleDefinitions: (_a = input.multipleDefinitions) !== null && _a !== void 0 ? _a : EditorStringEnumOption.stringSet(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleTypeDefinitions: (_b = input.multipleTypeDefinitions) !== null && _b !== void 0 ? _b : EditorStringEnumOption.stringSet(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleDeclarations: (_c = input.multipleDeclarations) !== null && _c !== void 0 ? _c : EditorStringEnumOption.stringSet(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleImplementations: (_d = input.multipleImplementations) !== null && _d !== void 0 ? _d : EditorStringEnumOption.stringSet(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']),
multipleReferences: (_e = input.multipleReferences) !== null && _e !== void 0 ? _e : EditorStringEnumOption.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),
};
};
return EditorGoToLocation;
}(BaseEditorOption));
var EditorHover = /** @class */ (function (_super) {
__extends(EditorHover, _super);
function EditorHover() {
var _this = this;
var defaults = {
enabled: true,
delay: 300,
sticky: true
};
_this = _super.call(this, 44 /* hover */, 'hover', defaults, {
'editor.hover.enabled': {
type: 'boolean',
default: defaults.enabled,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('hover.enabled', "Controls whether the hover is shown.")
},
'editor.hover.delay': {
type: 'number',
default: defaults.delay,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('hover.delay', "Controls the delay in milliseconds after which the hover is shown.")
},
'editor.hover.sticky': {
type: 'boolean',
default: defaults.sticky,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('hover.sticky', "Controls whether the hover should remain visible when mouse is moved over it.")
},
}) || this;
return _this;
}
EditorHover.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled),
delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 10000),
sticky: EditorBooleanOption.boolean(input.sticky, this.defaultValue.sticky)
};
};
return EditorHover;
}(BaseEditorOption));
/**
* @internal
*/
var EditorLayoutInfoComputer = /** @class */ (function (_super) {
__extends(EditorLayoutInfoComputer, _super);
function EditorLayoutInfoComputer() {
return _super.call(this, 107 /* layoutInfo */, [40 /* glyphMargin */, 48 /* lineDecorationsWidth */, 30 /* folding */, 54 /* minimap */, 78 /* scrollbar */, 50 /* lineNumbers */]) || this;
}
EditorLayoutInfoComputer.prototype.compute = function (env, options, _) {
return EditorLayoutInfoComputer.computeLayout(options, {
outerWidth: env.outerWidth,
outerHeight: env.outerHeight,
lineHeight: env.fontInfo.lineHeight,
lineNumbersDigitCount: env.lineNumbersDigitCount,
typicalHalfwidthCharacterWidth: env.fontInfo.typicalHalfwidthCharacterWidth,
maxDigitWidth: env.fontInfo.maxDigitWidth,
pixelRatio: env.pixelRatio
});
};
EditorLayoutInfoComputer.computeLayout = function (options, env) {
var outerWidth = env.outerWidth | 0;
var outerHeight = env.outerHeight | 0;
var lineHeight = env.lineHeight | 0;
var lineNumbersDigitCount = env.lineNumbersDigitCount | 0;
var typicalHalfwidthCharacterWidth = env.typicalHalfwidthCharacterWidth;
var maxDigitWidth = env.maxDigitWidth;
var pixelRatio = env.pixelRatio;
var showGlyphMargin = options.get(40 /* glyphMargin */);
var showLineNumbers = (options.get(50 /* lineNumbers */).renderType !== 0 /* Off */);
var lineNumbersMinChars = options.get(51 /* lineNumbersMinChars */) | 0;
var minimap = options.get(54 /* minimap */);
var minimapEnabled = minimap.enabled;
var minimapSide = minimap.side;
var minimapRenderCharacters = minimap.renderCharacters;
var minimapScale = (pixelRatio >= 2 ? Math.round(minimap.scale * 2) : minimap.scale);
var minimapMaxColumn = minimap.maxColumn | 0;
var scrollbar = options.get(78 /* scrollbar */);
var verticalScrollbarWidth = scrollbar.verticalScrollbarSize | 0;
var verticalScrollbarHasArrows = scrollbar.verticalHasArrows;
var scrollbarArrowSize = scrollbar.arrowSize | 0;
var horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize | 0;
var rawLineDecorationsWidth = options.get(48 /* lineDecorationsWidth */);
var folding = options.get(30 /* folding */);
var lineDecorationsWidth;
if (typeof rawLineDecorationsWidth === 'string' && /^\d+(\.\d+)?ch$/.test(rawLineDecorationsWidth)) {
var multiple = parseFloat(rawLineDecorationsWidth.substr(0, rawLineDecorationsWidth.length - 2));
lineDecorationsWidth = EditorIntOption.clampedInt(multiple * typicalHalfwidthCharacterWidth, 0, 0, 1000);
}
else {
lineDecorationsWidth = EditorIntOption.clampedInt(rawLineDecorationsWidth, 0, 0, 1000);
}
if (folding) {
lineDecorationsWidth += 16;
}
var lineNumbersWidth = 0;
if (showLineNumbers) {
var digitCount = Math.max(lineNumbersDigitCount, lineNumbersMinChars);
lineNumbersWidth = Math.round(digitCount * maxDigitWidth);
}
var glyphMarginWidth = 0;
if (showGlyphMargin) {
glyphMarginWidth = lineHeight;
}
var glyphMarginLeft = 0;
var lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;
var decorationsLeft = lineNumbersLeft + lineNumbersWidth;
var contentLeft = decorationsLeft + lineDecorationsWidth;
var remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;
var renderMinimap;
var minimapLeft;
var minimapWidth;
var contentWidth;
if (!minimapEnabled) {
minimapLeft = 0;
minimapWidth = 0;
renderMinimap = 0 /* None */;
contentWidth = remainingWidth;
}
else {
// The minimapScale is also the pixel width of each character. Adjust
// for the pixel ratio of the screen.
var minimapCharWidth = minimapScale / pixelRatio;
renderMinimap = minimapRenderCharacters ? 1 /* Text */ : 2 /* Blocks */;
// Given:
// (leaving 2px for the cursor to have space after the last character)
// viewportColumn = (contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth
// minimapWidth = viewportColumn * minimapCharWidth
// contentWidth = remainingWidth - minimapWidth
// What are good values for contentWidth and minimapWidth ?
// minimapWidth = ((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth) * minimapCharWidth
// typicalHalfwidthCharacterWidth * minimapWidth = (contentWidth - verticalScrollbarWidth - 2) * minimapCharWidth
// typicalHalfwidthCharacterWidth * minimapWidth = (remainingWidth - minimapWidth - verticalScrollbarWidth - 2) * minimapCharWidth
// (typicalHalfwidthCharacterWidth + minimapCharWidth) * minimapWidth = (remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth
// minimapWidth = ((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth)
minimapWidth = Math.max(0, Math.floor(((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH;
var minimapColumns = minimapWidth / minimapCharWidth;
if (minimapColumns > minimapMaxColumn) {
minimapWidth = Math.floor(minimapMaxColumn * minimapCharWidth);
}
contentWidth = remainingWidth - minimapWidth;
if (minimapSide === 'left') {
minimapLeft = 0;
glyphMarginLeft += minimapWidth;
lineNumbersLeft += minimapWidth;
decorationsLeft += minimapWidth;
contentLeft += minimapWidth;
}
else {
minimapLeft = outerWidth - minimapWidth - verticalScrollbarWidth;
}
}
// (leaving 2px for the cursor to have space after the last character)
var viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));
var verticalArrowSize = (verticalScrollbarHasArrows ? scrollbarArrowSize : 0);
return {
width: outerWidth,
height: outerHeight,
glyphMarginLeft: glyphMarginLeft,
glyphMarginWidth: glyphMarginWidth,
lineNumbersLeft: lineNumbersLeft,
lineNumbersWidth: lineNumbersWidth,
decorationsLeft: decorationsLeft,
decorationsWidth: lineDecorationsWidth,
contentLeft: contentLeft,
contentWidth: contentWidth,
renderMinimap: renderMinimap,
minimapLeft: minimapLeft,
minimapWidth: minimapWidth,
viewportColumn: viewportColumn,
verticalScrollbarWidth: verticalScrollbarWidth,
horizontalScrollbarHeight: horizontalScrollbarHeight,
overviewRuler: {
top: verticalArrowSize,
width: verticalScrollbarWidth,
height: (outerHeight - 2 * verticalArrowSize),
right: 0
}
};
};
return EditorLayoutInfoComputer;
}(ComputedEditorOption));
var EditorLightbulb = /** @class */ (function (_super) {
__extends(EditorLightbulb, _super);
function EditorLightbulb() {
var _this = this;
var defaults = { enabled: true };
_this = _super.call(this, 47 /* lightbulb */, 'lightbulb', defaults, {
'editor.lightbulb.enabled': {
type: 'boolean',
default: defaults.enabled,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('codeActions', "Enables the code action lightbulb in the editor.")
},
}) || this;
return _this;
}
EditorLightbulb.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled)
};
};
return EditorLightbulb;
}(BaseEditorOption));
//#endregion
//#region lineHeight
var EditorLineHeight = /** @class */ (function (_super) {
__extends(EditorLineHeight, _super);
function EditorLineHeight() {
return _super.call(this, 49 /* lineHeight */, 'lineHeight', EDITOR_FONT_DEFAULTS.lineHeight, 0, 150, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineHeight', "Controls the line height. Use 0 to compute the line height from the font size.") }) || this;
}
EditorLineHeight.prototype.compute = function (env, options, value) {
// The lineHeight is computed from the fontSize if it is 0.
// Moreover, the final lineHeight respects the editor zoom level.
// So take the result from env.fontInfo
return env.fontInfo.lineHeight;
};
return EditorLineHeight;
}(EditorIntOption));
var EditorMinimap = /** @class */ (function (_super) {
__extends(EditorMinimap, _super);
function EditorMinimap() {
var _this = this;
var defaults = {
enabled: true,
side: 'right',
showSlider: 'mouseover',
renderCharacters: true,
maxColumn: 120,
scale: 1,
};
_this = _super.call(this, 54 /* minimap */, 'minimap', defaults, {
'editor.minimap.enabled': {
type: 'boolean',
default: defaults.enabled,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.enabled', "Controls whether the minimap is shown.")
},
'editor.minimap.side': {
type: 'string',
enum: ['left', 'right'],
default: defaults.side,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.side', "Controls the side where to render the minimap.")
},
'editor.minimap.showSlider': {
type: 'string',
enum: ['always', 'mouseover'],
default: defaults.showSlider,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.showSlider', "Controls when the minimap slider is shown.")
},
'editor.minimap.scale': {
type: 'number',
default: defaults.scale,
minimum: 1,
maximum: 3,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.scale', "Scale of content drawn in the minimap.")
},
'editor.minimap.renderCharacters': {
type: 'boolean',
default: defaults.renderCharacters,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.renderCharacters', "Render the actual characters on a line as opposed to color blocks.")
},
'editor.minimap.maxColumn': {
type: 'number',
default: defaults.maxColumn,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns.")
},
}) || this;
return _this;
}
EditorMinimap.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled),
side: EditorStringEnumOption.stringSet(input.side, this.defaultValue.side, ['right', 'left']),
showSlider: EditorStringEnumOption.stringSet(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),
renderCharacters: EditorBooleanOption.boolean(input.renderCharacters, this.defaultValue.renderCharacters),
scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),
maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),
};
};
return EditorMinimap;
}(BaseEditorOption));
//#endregion
//#region multiCursorModifier
function _multiCursorModifierFromString(multiCursorModifier) {
if (multiCursorModifier === 'ctrlCmd') {
return (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isMacintosh */ "e"] ? 'metaKey' : 'ctrlKey');
}
return 'altKey';
}
var EditorParameterHints = /** @class */ (function (_super) {
__extends(EditorParameterHints, _super);
function EditorParameterHints() {
var _this = this;
var defaults = {
enabled: true,
cycle: false
};
_this = _super.call(this, 64 /* parameterHints */, 'parameterHints', defaults, {
'editor.parameterHints.enabled': {
type: 'boolean',
default: defaults.enabled,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('parameterHints.cycle', "Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")
},
}) || this;
return _this;
}
EditorParameterHints.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled),
cycle: EditorBooleanOption.boolean(input.cycle, this.defaultValue.cycle)
};
};
return EditorParameterHints;
}(BaseEditorOption));
//#endregion
//#region pixelRatio
var EditorPixelRatio = /** @class */ (function (_super) {
__extends(EditorPixelRatio, _super);
function EditorPixelRatio() {
return _super.call(this, 105 /* pixelRatio */) || this;
}
EditorPixelRatio.prototype.compute = function (env, options, _) {
return env.pixelRatio;
};
return EditorPixelRatio;
}(ComputedEditorOption));
var EditorQuickSuggestions = /** @class */ (function (_super) {
__extends(EditorQuickSuggestions, _super);
function EditorQuickSuggestions() {
var _this = this;
var defaults = {
other: true,
comments: false,
strings: false
};
_this = _super.call(this, 66 /* quickSuggestions */, 'quickSuggestions', defaults, {
anyOf: [
{
type: 'boolean',
},
{
type: 'object',
properties: {
strings: {
type: 'boolean',
default: defaults.strings,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickSuggestions.strings', "Enable quick suggestions inside strings.")
},
comments: {
type: 'boolean',
default: defaults.comments,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickSuggestions.comments', "Enable quick suggestions inside comments.")
},
other: {
type: 'boolean',
default: defaults.other,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickSuggestions.other', "Enable quick suggestions outside of strings and comments.")
},
}
}
],
default: defaults,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickSuggestions', "Controls whether suggestions should automatically show up while typing.")
}) || this;
_this.defaultValue = defaults;
return _this;
}
EditorQuickSuggestions.prototype.validate = function (_input) {
if (typeof _input === 'boolean') {
return _input;
}
if (typeof _input === 'object') {
var input = _input;
var opts = {
other: EditorBooleanOption.boolean(input.other, this.defaultValue.other),
comments: EditorBooleanOption.boolean(input.comments, this.defaultValue.comments),
strings: EditorBooleanOption.boolean(input.strings, this.defaultValue.strings),
};
if (opts.other && opts.comments && opts.strings) {
return true; // all on
}
else if (!opts.other && !opts.comments && !opts.strings) {
return false; // all off
}
else {
return opts;
}
}
return this.defaultValue;
};
return EditorQuickSuggestions;
}(BaseEditorOption));
var EditorRenderLineNumbersOption = /** @class */ (function (_super) {
__extends(EditorRenderLineNumbersOption, _super);
function EditorRenderLineNumbersOption() {
return _super.call(this, 50 /* lineNumbers */, 'lineNumbers', { renderType: 1 /* On */, renderFn: null }, {
type: 'string',
enum: ['off', 'on', 'relative', 'interval'],
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineNumbers.off', "Line numbers are not rendered."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineNumbers.on', "Line numbers are rendered as absolute number."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineNumbers.relative', "Line numbers are rendered as distance in lines to cursor position."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineNumbers.interval', "Line numbers are rendered every 10 lines.")
],
default: 'on',
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineNumbers', "Controls the display of line numbers.")
}) || this;
}
EditorRenderLineNumbersOption.prototype.validate = function (lineNumbers) {
var renderType = this.defaultValue.renderType;
var renderFn = this.defaultValue.renderFn;
if (typeof lineNumbers !== 'undefined') {
if (typeof lineNumbers === 'function') {
renderType = 4 /* Custom */;
renderFn = lineNumbers;
}
else if (lineNumbers === 'interval') {
renderType = 3 /* Interval */;
}
else if (lineNumbers === 'relative') {
renderType = 2 /* Relative */;
}
else if (lineNumbers === 'on') {
renderType = 1 /* On */;
}
else {
renderType = 0 /* Off */;
}
}
return {
renderType: renderType,
renderFn: renderFn
};
};
return EditorRenderLineNumbersOption;
}(BaseEditorOption));
//#endregion
//#region renderValidationDecorations
/**
* @internal
*/
function filterValidationDecorations(options) {
var renderValidationDecorations = options.get(73 /* renderValidationDecorations */);
if (renderValidationDecorations === 'editable') {
return options.get(68 /* readOnly */);
}
return renderValidationDecorations === 'on' ? false : true;
}
//#endregion
//#region rulers
var EditorRulers = /** @class */ (function (_super) {
__extends(EditorRulers, _super);
function EditorRulers() {
var _this = this;
var defaults = [];
_this = _super.call(this, 77 /* rulers */, 'rulers', defaults, {
type: 'array',
items: {
type: 'number'
},
default: defaults,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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.")
}) || this;
return _this;
}
EditorRulers.prototype.validate = function (input) {
if (Array.isArray(input)) {
var rulers = [];
for (var _i = 0, input_1 = input; _i < input_1.length; _i++) {
var value = input_1[_i];
rulers.push(EditorIntOption.clampedInt(value, 0, 0, 10000));
}
rulers.sort(function (a, b) { return a - b; });
return rulers;
}
return this.defaultValue;
};
return EditorRulers;
}(SimpleEditorOption));
function _scrollbarVisibilityFromString(visibility, defaultValue) {
if (typeof visibility !== 'string') {
return defaultValue;
}
switch (visibility) {
case 'hidden': return 2 /* Hidden */;
case 'visible': return 3 /* Visible */;
default: return 1 /* Auto */;
}
}
var EditorScrollbar = /** @class */ (function (_super) {
__extends(EditorScrollbar, _super);
function EditorScrollbar() {
return _super.call(this, 78 /* scrollbar */, 'scrollbar', {
vertical: 1 /* Auto */,
horizontal: 1 /* Auto */,
arrowSize: 11,
useShadows: true,
verticalHasArrows: false,
horizontalHasArrows: false,
horizontalScrollbarSize: 10,
horizontalSliderSize: 10,
verticalScrollbarSize: 14,
verticalSliderSize: 14,
handleMouseWheel: true,
alwaysConsumeMouseWheel: true
}) || this;
}
EditorScrollbar.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
var horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1000);
var verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1000);
return {
arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1000),
vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),
horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),
useShadows: EditorBooleanOption.boolean(input.useShadows, this.defaultValue.useShadows),
verticalHasArrows: EditorBooleanOption.boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),
horizontalHasArrows: EditorBooleanOption.boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),
handleMouseWheel: EditorBooleanOption.boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),
alwaysConsumeMouseWheel: EditorBooleanOption.boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),
horizontalScrollbarSize: horizontalScrollbarSize,
horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),
verticalScrollbarSize: verticalScrollbarSize,
verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1000),
};
};
return EditorScrollbar;
}(BaseEditorOption));
var EditorSuggest = /** @class */ (function (_super) {
__extends(EditorSuggest, _super);
function EditorSuggest() {
var _this = this;
var defaults = {
insertMode: 'insert',
insertHighlight: false,
filterGraceful: true,
snippetsPreventQuickSuggestions: true,
localityBonus: false,
shareSuggestSelections: false,
showIcons: true,
maxVisibleSuggestions: 12,
showMethods: true,
showFunctions: true,
showConstructors: 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,
hideStatusBar: true
};
_this = _super.call(this, 89 /* suggest */, 'suggest', defaults, {
'editor.suggest.insertMode': {
type: 'string',
enum: ['insert', 'replace'],
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.insertMode.insert', "Insert suggestion without overwriting text right of the cursor."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.insertMode.replace', "Insert suggestion and overwrite text right of the cursor."),
],
default: defaults.insertMode,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.insertMode', "Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")
},
'editor.suggest.insertHighlight': {
type: 'boolean',
default: defaults.insertHighlight,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.insertHighlight', "Controls whether unexpected text modifications while accepting completions should be highlighted, e.g `insertMode` is `replace` but the completion only supports `insert`.")
},
'editor.suggest.filterGraceful': {
type: 'boolean',
default: defaults.filterGraceful,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.filterGraceful', "Controls whether filtering and sorting suggestions accounts for small typos.")
},
'editor.suggest.localityBonus': {
type: 'boolean',
default: defaults.localityBonus,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.localityBonus', "Controls whether sorting favours words that appear close to the cursor.")
},
'editor.suggest.shareSuggestSelections': {
type: 'boolean',
default: defaults.shareSuggestSelections,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.shareSuggestSelections', "Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")
},
'editor.suggest.snippetsPreventQuickSuggestions': {
type: 'boolean',
default: defaults.snippetsPreventQuickSuggestions,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.snippetsPreventQuickSuggestions', "Controls whether an active snippet prevents quick suggestions.")
},
'editor.suggest.showIcons': {
type: 'boolean',
default: defaults.showIcons,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.showIcons', "Controls whether to show or hide icons in suggestions.")
},
'editor.suggest.maxVisibleSuggestions': {
type: 'number',
default: defaults.maxVisibleSuggestions,
minimum: 1,
maximum: 15,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggest.maxVisibleSuggestions', "Controls how many suggestions IntelliSense will show before showing a scrollbar (maximum 15).")
},
'editor.suggest.filteredTypes': {
type: 'object',
deprecationMessage: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showMethods', "When enabled IntelliSense shows `method`-suggestions.")
},
'editor.suggest.showFunctions': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showFunctions', "When enabled IntelliSense shows `function`-suggestions.")
},
'editor.suggest.showConstructors': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showConstructors', "When enabled IntelliSense shows `constructor`-suggestions.")
},
'editor.suggest.showFields': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showFields', "When enabled IntelliSense shows `field`-suggestions.")
},
'editor.suggest.showVariables': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showVariables', "When enabled IntelliSense shows `variable`-suggestions.")
},
'editor.suggest.showClasses': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showClasss', "When enabled IntelliSense shows `class`-suggestions.")
},
'editor.suggest.showStructs': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showStructs', "When enabled IntelliSense shows `struct`-suggestions.")
},
'editor.suggest.showInterfaces': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showInterfaces', "When enabled IntelliSense shows `interface`-suggestions.")
},
'editor.suggest.showModules': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showModules', "When enabled IntelliSense shows `module`-suggestions.")
},
'editor.suggest.showProperties': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showPropertys', "When enabled IntelliSense shows `property`-suggestions.")
},
'editor.suggest.showEvents': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showEvents', "When enabled IntelliSense shows `event`-suggestions.")
},
'editor.suggest.showOperators': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showOperators', "When enabled IntelliSense shows `operator`-suggestions.")
},
'editor.suggest.showUnits': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showUnits', "When enabled IntelliSense shows `unit`-suggestions.")
},
'editor.suggest.showValues': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showValues', "When enabled IntelliSense shows `value`-suggestions.")
},
'editor.suggest.showConstants': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showConstants', "When enabled IntelliSense shows `constant`-suggestions.")
},
'editor.suggest.showEnums': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showEnums', "When enabled IntelliSense shows `enum`-suggestions.")
},
'editor.suggest.showEnumMembers': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showEnumMembers', "When enabled IntelliSense shows `enumMember`-suggestions.")
},
'editor.suggest.showKeywords': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showKeywords', "When enabled IntelliSense shows `keyword`-suggestions.")
},
'editor.suggest.showWords': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showTexts', "When enabled IntelliSense shows `text`-suggestions.")
},
'editor.suggest.showColors': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showColors', "When enabled IntelliSense shows `color`-suggestions.")
},
'editor.suggest.showFiles': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showFiles', "When enabled IntelliSense shows `file`-suggestions.")
},
'editor.suggest.showReferences': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showReferences', "When enabled IntelliSense shows `reference`-suggestions.")
},
'editor.suggest.showCustomcolors': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showCustomcolors', "When enabled IntelliSense shows `customcolor`-suggestions.")
},
'editor.suggest.showFolders': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showFolders', "When enabled IntelliSense shows `folder`-suggestions.")
},
'editor.suggest.showTypeParameters': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showTypeParameters', "When enabled IntelliSense shows `typeParameter`-suggestions.")
},
'editor.suggest.showSnippets': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.showSnippets', "When enabled IntelliSense shows `snippet`-suggestions.")
},
'editor.suggest.hideStatusBar': {
type: 'boolean',
default: true,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.suggest.hideStatusBar', "Controls the visibility of the status bar at the bottom of the suggest widget.")
}
}) || this;
return _this;
}
EditorSuggest.prototype.validate = function (_input) {
if (typeof _input !== 'object') {
return this.defaultValue;
}
var input = _input;
return {
insertMode: EditorStringEnumOption.stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),
insertHighlight: EditorBooleanOption.boolean(input.insertHighlight, this.defaultValue.insertHighlight),
filterGraceful: EditorBooleanOption.boolean(input.filterGraceful, this.defaultValue.filterGraceful),
snippetsPreventQuickSuggestions: EditorBooleanOption.boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),
localityBonus: EditorBooleanOption.boolean(input.localityBonus, this.defaultValue.localityBonus),
shareSuggestSelections: EditorBooleanOption.boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),
showIcons: EditorBooleanOption.boolean(input.showIcons, this.defaultValue.showIcons),
maxVisibleSuggestions: EditorIntOption.clampedInt(input.maxVisibleSuggestions, this.defaultValue.maxVisibleSuggestions, 1, 15),
showMethods: EditorBooleanOption.boolean(input.showMethods, this.defaultValue.showMethods),
showFunctions: EditorBooleanOption.boolean(input.showFunctions, this.defaultValue.showFunctions),
showConstructors: EditorBooleanOption.boolean(input.showConstructors, this.defaultValue.showConstructors),
showFields: EditorBooleanOption.boolean(input.showFields, this.defaultValue.showFields),
showVariables: EditorBooleanOption.boolean(input.showVariables, this.defaultValue.showVariables),
showClasses: EditorBooleanOption.boolean(input.showClasses, this.defaultValue.showClasses),
showStructs: EditorBooleanOption.boolean(input.showStructs, this.defaultValue.showStructs),
showInterfaces: EditorBooleanOption.boolean(input.showInterfaces, this.defaultValue.showInterfaces),
showModules: EditorBooleanOption.boolean(input.showModules, this.defaultValue.showModules),
showProperties: EditorBooleanOption.boolean(input.showProperties, this.defaultValue.showProperties),
showEvents: EditorBooleanOption.boolean(input.showEvents, this.defaultValue.showEvents),
showOperators: EditorBooleanOption.boolean(input.showOperators, this.defaultValue.showOperators),
showUnits: EditorBooleanOption.boolean(input.showUnits, this.defaultValue.showUnits),
showValues: EditorBooleanOption.boolean(input.showValues, this.defaultValue.showValues),
showConstants: EditorBooleanOption.boolean(input.showConstants, this.defaultValue.showConstants),
showEnums: EditorBooleanOption.boolean(input.showEnums, this.defaultValue.showEnums),
showEnumMembers: EditorBooleanOption.boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),
showKeywords: EditorBooleanOption.boolean(input.showKeywords, this.defaultValue.showKeywords),
showWords: EditorBooleanOption.boolean(input.showWords, this.defaultValue.showWords),
showColors: EditorBooleanOption.boolean(input.showColors, this.defaultValue.showColors),
showFiles: EditorBooleanOption.boolean(input.showFiles, this.defaultValue.showFiles),
showReferences: EditorBooleanOption.boolean(input.showReferences, this.defaultValue.showReferences),
showFolders: EditorBooleanOption.boolean(input.showFolders, this.defaultValue.showFolders),
showTypeParameters: EditorBooleanOption.boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),
showSnippets: EditorBooleanOption.boolean(input.showSnippets, this.defaultValue.showSnippets),
hideStatusBar: EditorBooleanOption.boolean(input.hideStatusBar, this.defaultValue.hideStatusBar),
};
};
return EditorSuggest;
}(BaseEditorOption));
//#endregion
//#region tabFocusMode
var EditorTabFocusMode = /** @class */ (function (_super) {
__extends(EditorTabFocusMode, _super);
function EditorTabFocusMode() {
return _super.call(this, 106 /* tabFocusMode */, [68 /* readOnly */]) || this;
}
EditorTabFocusMode.prototype.compute = function (env, options, _) {
var readOnly = options.get(68 /* readOnly */);
return (readOnly ? true : env.tabFocusMode);
};
return EditorTabFocusMode;
}(ComputedEditorOption));
function _wrappingIndentFromString(wrappingIndent) {
switch (wrappingIndent) {
case 'none': return 0 /* None */;
case 'same': return 1 /* Same */;
case 'indent': return 2 /* Indent */;
case 'deepIndent': return 3 /* DeepIndent */;
}
}
var EditorWrappingInfoComputer = /** @class */ (function (_super) {
__extends(EditorWrappingInfoComputer, _super);
function EditorWrappingInfoComputer() {
return _super.call(this, 108 /* wrappingInfo */, [97 /* wordWrap */, 100 /* wordWrapColumn */, 101 /* wordWrapMinified */, 107 /* layoutInfo */, 2 /* accessibilitySupport */]) || this;
}
EditorWrappingInfoComputer.prototype.compute = function (env, options, _) {
var wordWrap = options.get(97 /* wordWrap */);
var wordWrapColumn = options.get(100 /* wordWrapColumn */);
var wordWrapMinified = options.get(101 /* wordWrapMinified */);
var layoutInfo = options.get(107 /* layoutInfo */);
var accessibilitySupport = options.get(2 /* accessibilitySupport */);
var bareWrappingInfo = null;
{
if (accessibilitySupport === 2 /* Enabled */) {
// See https://github.com/Microsoft/vscode/issues/27766
// Never enable wrapping when a screen reader is attached
// because arrow down etc. will not move the cursor in the way
// a screen reader expects.
bareWrappingInfo = {
isWordWrapMinified: false,
isViewportWrapping: false,
wrappingColumn: -1
};
}
else if (wordWrapMinified && env.isDominatedByLongLines) {
// Force viewport width wrapping if model is dominated by long lines
bareWrappingInfo = {
isWordWrapMinified: true,
isViewportWrapping: true,
wrappingColumn: Math.max(1, layoutInfo.viewportColumn)
};
}
else if (wordWrap === 'on') {
bareWrappingInfo = {
isWordWrapMinified: false,
isViewportWrapping: true,
wrappingColumn: Math.max(1, layoutInfo.viewportColumn)
};
}
else if (wordWrap === 'bounded') {
bareWrappingInfo = {
isWordWrapMinified: false,
isViewportWrapping: true,
wrappingColumn: Math.min(Math.max(1, layoutInfo.viewportColumn), wordWrapColumn)
};
}
else if (wordWrap === 'wordWrapColumn') {
bareWrappingInfo = {
isWordWrapMinified: false,
isViewportWrapping: false,
wrappingColumn: wordWrapColumn
};
}
else {
bareWrappingInfo = {
isWordWrapMinified: false,
isViewportWrapping: false,
wrappingColumn: -1
};
}
}
return {
isDominatedByLongLines: env.isDominatedByLongLines,
isWordWrapMinified: bareWrappingInfo.isWordWrapMinified,
isViewportWrapping: bareWrappingInfo.isViewportWrapping,
wrappingColumn: bareWrappingInfo.wrappingColumn,
};
};
return EditorWrappingInfoComputer;
}(ComputedEditorOption));
//#endregion
var DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace';
var DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace';
var DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'monospace\', monospace, \'Droid Sans Fallback\'';
/**
* @internal
*/
var EDITOR_FONT_DEFAULTS = {
fontFamily: (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isMacintosh */ "e"] ? DEFAULT_MAC_FONT_FAMILY : (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isLinux */ "d"] ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)),
fontWeight: 'normal',
fontSize: (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isMacintosh */ "e"] ? 12 : 14),
lineHeight: 0,
letterSpacing: 0,
};
/**
* @internal
*/
var EDITOR_MODEL_DEFAULTS = {
tabSize: 4,
indentSize: 4,
insertSpaces: true,
detectIndentation: true,
trimAutoWhitespace: true,
largeFileOptimizations: true
};
/**
* @internal
*/
var editorOptionsRegistry = [];
function register(option) {
editorOptionsRegistry[option.id] = option;
return option;
}
/**
* WORKAROUND: TS emits "any" for complex editor options values (anything except string, bool, enum, etc. ends up being "any")
* @monacodtsreplace
* /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/
* /comments, any/comments, EditorCommentsOptions/
* /find, any/find, EditorFindOptions/
* /fontInfo, any/fontInfo, FontInfo/
* /gotoLocation, any/gotoLocation, GoToLocationOptions/
* /hover, any/hover, EditorHoverOptions/
* /lightbulb, any/lightbulb, EditorLightbulbOptions/
* /minimap, any/minimap, EditorMinimapOptions/
* /parameterHints, any/parameterHints, InternalParameterHintOptions/
* /quickSuggestions, any/quickSuggestions, ValidQuickSuggestionsOptions/
* /suggest, any/suggest, InternalSuggestOptions/
*/
var EditorOptions = {
acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(0 /* acceptSuggestionOnCommitCharacter */, 'acceptSuggestionOnCommitCharacter', true, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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 */, 'acceptSuggestionOnEnter', 'on', ['on', 'smart', 'off'], {
markdownEnumDescriptions: [
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('acceptSuggestionOnEnterSmart', "Only accept a suggestion with `Enter` when it makes a textual change."),
''
],
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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 */, 'accessibilityPageSize', 10, 1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.") })),
ariaLabel: register(new EditorStringOption(4 /* ariaLabel */, 'ariaLabel', _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorViewAccessibleLabel', "Editor content"))),
autoClosingBrackets: register(new EditorStringEnumOption(5 /* autoClosingBrackets */, 'autoClosingBrackets', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {
enumDescriptions: [
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoClosingBrackets.languageDefined', "Use language configurations to determine when to autoclose brackets."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoClosingBrackets.beforeWhitespace', "Autoclose brackets only when the cursor is to the left of whitespace."),
'',
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('autoClosingBrackets', "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")
})),
autoClosingOvertype: register(new EditorStringEnumOption(6 /* autoClosingOvertype */, 'autoClosingOvertype', 'auto', ['always', 'auto', 'never'], {
enumDescriptions: [
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoClosingOvertype.auto', "Type over closing quotes or brackets only if they were automatically inserted."),
'',
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('autoClosingOvertype', "Controls whether the editor should type over closing quotes or brackets.")
})),
autoClosingQuotes: register(new EditorStringEnumOption(7 /* autoClosingQuotes */, 'autoClosingQuotes', 'languageDefined', ['always', 'languageDefined', 'beforeWhitespace', 'never'], {
enumDescriptions: [
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoClosingQuotes.languageDefined', "Use language configurations to determine when to autoclose quotes."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoClosingQuotes.beforeWhitespace', "Autoclose quotes only when the cursor is to the left of whitespace."),
'',
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.")
})),
autoIndent: register(new EditorEnumOption(8 /* autoIndent */, 'autoIndent', 4 /* Full */, 'full', ['none', 'keep', 'brackets', 'advanced', 'full'], _autoIndentFromString, {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoIndent.none', "The editor will not insert indentation automatically."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoIndent.keep', "The editor will keep the current line's indentation."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoIndent.brackets', "The editor will keep the current line's indentation and honor language defined brackets."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoIndent.advanced', "The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('autoIndent', "Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")
})),
automaticLayout: register(new EditorBooleanOption(9 /* automaticLayout */, 'automaticLayout', false)),
autoSurround: register(new EditorStringEnumOption(10 /* autoSurround */, 'autoSurround', 'languageDefined', ['languageDefined', 'quotes', 'brackets', 'never'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoSurround.languageDefined', "Use language configurations to determine when to automatically surround selections."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoSurround.quotes', "Surround with quotes but not brackets."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editor.autoSurround.brackets', "Surround with brackets but not quotes."),
''
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('autoSurround', "Controls whether the editor should automatically surround selections.")
})),
codeLens: register(new EditorBooleanOption(11 /* codeLens */, 'codeLens', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('codeLens', "Controls whether the editor shows CodeLens.") })),
colorDecorators: register(new EditorBooleanOption(12 /* colorDecorators */, 'colorDecorators', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.") })),
comments: register(new EditorComments()),
contextmenu: register(new EditorBooleanOption(14 /* contextmenu */, 'contextmenu', true)),
copyWithSyntaxHighlighting: register(new EditorBooleanOption(15 /* copyWithSyntaxHighlighting */, 'copyWithSyntaxHighlighting', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('copyWithSyntaxHighlighting', "Controls whether syntax highlighting should be copied into the clipboard.") })),
cursorBlinking: register(new EditorEnumOption(16 /* cursorBlinking */, 'cursorBlinking', 1 /* Blink */, 'blink', ['blink', 'smooth', 'phase', 'expand', 'solid'], _cursorBlinkingStyleFromString, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorBlinking', "Control the cursor animation style.") })),
cursorSmoothCaretAnimation: register(new EditorBooleanOption(17 /* cursorSmoothCaretAnimation */, 'cursorSmoothCaretAnimation', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorSmoothCaretAnimation', "Controls whether the smooth caret animation should be enabled.") })),
cursorStyle: register(new EditorEnumOption(18 /* cursorStyle */, 'cursorStyle', TextEditorCursorStyle.Line, 'line', ['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'], _cursorStyleFromString, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorStyle', "Controls the cursor style.") })),
cursorSurroundingLines: register(new EditorIntOption(19 /* cursorSurroundingLines */, 'cursorSurroundingLines', 0, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorSurroundingLines', "Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or `scrollOffset` in some other editors.") })),
cursorSurroundingLinesStyle: register(new EditorStringEnumOption(20 /* cursorSurroundingLinesStyle */, 'cursorSurroundingLinesStyle', 'default', ['default', 'all'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorSurroundingLinesStyle.default', "`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorSurroundingLinesStyle.all', "`cursorSurroundingLines` is enforced always.")
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorSurroundingLinesStyle', "Controls when `cursorSurroundingLines` should be enforced.")
})),
cursorWidth: register(new EditorIntOption(21 /* cursorWidth */, 'cursorWidth', 0, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('cursorWidth', "Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.") })),
disableLayerHinting: register(new EditorBooleanOption(22 /* disableLayerHinting */, 'disableLayerHinting', false)),
disableMonospaceOptimizations: register(new EditorBooleanOption(23 /* disableMonospaceOptimizations */, 'disableMonospaceOptimizations', false)),
dragAndDrop: register(new EditorBooleanOption(24 /* dragAndDrop */, 'dragAndDrop', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.") })),
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
extraEditorClassName: register(new EditorStringOption(26 /* extraEditorClassName */, 'extraEditorClassName', '')),
fastScrollSensitivity: register(new EditorFloatOption(27 /* fastScrollSensitivity */, 'fastScrollSensitivity', 5, function (x) { return (x <= 0 ? 5 : x); }, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fastScrollSensitivity', "Scrolling speed multiplier when pressing `Alt`.") })),
find: register(new EditorFind()),
fixedOverflowWidgets: register(new EditorBooleanOption(29 /* fixedOverflowWidgets */, 'fixedOverflowWidgets', false)),
folding: register(new EditorBooleanOption(30 /* folding */, 'folding', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('folding', "Controls whether the editor has code folding enabled.") })),
foldingStrategy: register(new EditorStringEnumOption(31 /* foldingStrategy */, 'foldingStrategy', 'auto', ['auto', 'indentation'], { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('foldingStrategy', "Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.") })),
foldingHighlight: register(new EditorBooleanOption(32 /* foldingHighlight */, 'foldingHighlight', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('foldingHighlight', "Controls whether the editor should highlight folded ranges.") })),
fontFamily: register(new EditorStringOption(33 /* fontFamily */, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontFamily', "Controls the font family.") })),
fontInfo: register(new EditorFontInfo()),
fontLigatures2: register(new EditorFontLigatures()),
fontSize: register(new EditorFontSize()),
fontWeight: register(new EditorStringOption(37 /* fontWeight */, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight, {
enum: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('fontWeight', "Controls the font weight.")
})),
formatOnPaste: register(new EditorBooleanOption(38 /* formatOnPaste */, 'formatOnPaste', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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(39 /* formatOnType */, 'formatOnType', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('formatOnType', "Controls whether the editor should automatically format the line after typing.") })),
glyphMargin: register(new EditorBooleanOption(40 /* glyphMargin */, 'glyphMargin', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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(42 /* hideCursorInOverviewRuler */, 'hideCursorInOverviewRuler', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('hideCursorInOverviewRuler', "Controls whether the cursor should be hidden in the overview ruler.") })),
highlightActiveIndentGuide: register(new EditorBooleanOption(43 /* highlightActiveIndentGuide */, 'highlightActiveIndentGuide', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('highlightActiveIndentGuide', "Controls whether the editor should highlight the active indent guide.") })),
hover: register(new EditorHover()),
inDiffEditor: register(new EditorBooleanOption(45 /* inDiffEditor */, 'inDiffEditor', false)),
letterSpacing: register(new EditorFloatOption(46 /* letterSpacing */, 'letterSpacing', EDITOR_FONT_DEFAULTS.letterSpacing, function (x) { return EditorFloatOption.clamp(x, -5, 20); }, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('letterSpacing', "Controls the letter spacing in pixels.") })),
lightbulb: register(new EditorLightbulb()),
lineDecorationsWidth: register(new SimpleEditorOption(48 /* lineDecorationsWidth */, 'lineDecorationsWidth', 10)),
lineHeight: register(new EditorLineHeight()),
lineNumbers: register(new EditorRenderLineNumbersOption()),
lineNumbersMinChars: register(new EditorIntOption(51 /* lineNumbersMinChars */, 'lineNumbersMinChars', 5, 1, 300)),
links: register(new EditorBooleanOption(52 /* links */, 'links', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('links', "Controls whether the editor should detect links and make them clickable.") })),
matchBrackets: register(new EditorStringEnumOption(53 /* matchBrackets */, 'matchBrackets', 'always', ['always', 'near', 'never'], { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('matchBrackets', "Highlight matching brackets.") })),
minimap: register(new EditorMinimap()),
mouseStyle: register(new EditorStringEnumOption(55 /* mouseStyle */, 'mouseStyle', 'text', ['text', 'default', 'copy'])),
mouseWheelScrollSensitivity: register(new EditorFloatOption(56 /* mouseWheelScrollSensitivity */, 'mouseWheelScrollSensitivity', 1, function (x) { return (x === 0 ? 1 : x); }, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.") })),
mouseWheelZoom: register(new EditorBooleanOption(57 /* mouseWheelZoom */, 'mouseWheelZoom', false, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding `Ctrl`.") })),
multiCursorMergeOverlapping: register(new EditorBooleanOption(58 /* multiCursorMergeOverlapping */, 'multiCursorMergeOverlapping', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorMergeOverlapping', "Merge multiple cursors when they are overlapping.") })),
multiCursorModifier: register(new EditorEnumOption(59 /* multiCursorModifier */, 'multiCursorModifier', 'altKey', 'alt', ['ctrlCmd', 'alt'], _multiCursorModifierFromString, {
markdownEnumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
],
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]({
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. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")
})),
multiCursorPaste: register(new EditorStringEnumOption(60 /* multiCursorPaste */, 'multiCursorPaste', 'spread', ['spread', 'full'], {
markdownEnumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorPaste.spread', "Each cursor pastes a single line of the text."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorPaste.full', "Each cursor pastes the full text.")
],
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('multiCursorPaste', "Controls pasting when the line count of the pasted text matches the cursor count.")
})),
occurrencesHighlight: register(new EditorBooleanOption(61 /* occurrencesHighlight */, 'occurrencesHighlight', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.") })),
overviewRulerBorder: register(new EditorBooleanOption(62 /* overviewRulerBorder */, 'overviewRulerBorder', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overviewRulerBorder', "Controls whether a border should be drawn around the overview ruler.") })),
overviewRulerLanes: register(new EditorIntOption(63 /* overviewRulerLanes */, 'overviewRulerLanes', 3, 0, 3)),
parameterHints: register(new EditorParameterHints()),
peekWidgetDefaultFocus: register(new EditorStringEnumOption(65 /* peekWidgetDefaultFocus */, 'peekWidgetDefaultFocus', 'tree', ['tree', 'editor'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('peekWidgetDefaultFocus.tree', "Focus the tree when opening peek"),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('peekWidgetDefaultFocus.editor', "Focus the editor when opening peek")
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('peekWidgetDefaultFocus', "Controls whether to focus the inline editor or the tree in the peek widget.")
})),
quickSuggestions: register(new EditorQuickSuggestions()),
quickSuggestionsDelay: register(new EditorIntOption(67 /* quickSuggestionsDelay */, 'quickSuggestionsDelay', 10, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickSuggestionsDelay', "Controls the delay in milliseconds after which quick suggestions will show up.") })),
readOnly: register(new EditorBooleanOption(68 /* readOnly */, 'readOnly', false)),
renderControlCharacters: register(new EditorBooleanOption(69 /* renderControlCharacters */, 'renderControlCharacters', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderControlCharacters', "Controls whether the editor should render control characters.") })),
renderIndentGuides: register(new EditorBooleanOption(70 /* renderIndentGuides */, 'renderIndentGuides', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderIndentGuides', "Controls whether the editor should render indent guides.") })),
renderFinalNewline: register(new EditorBooleanOption(71 /* renderFinalNewline */, 'renderFinalNewline', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderFinalNewline', "Render last line number when the file ends with a newline.") })),
renderLineHighlight: register(new EditorStringEnumOption(72 /* renderLineHighlight */, 'renderLineHighlight', 'line', ['none', 'gutter', 'line', 'all'], {
enumDescriptions: [
'',
'',
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderLineHighlight.all', "Highlights both the gutter and the current line."),
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderLineHighlight', "Controls how the editor should render the current line highlight.")
})),
renderValidationDecorations: register(new EditorStringEnumOption(73 /* renderValidationDecorations */, 'renderValidationDecorations', 'editable', ['editable', 'on', 'off'])),
renderWhitespace: register(new EditorStringEnumOption(74 /* renderWhitespace */, 'renderWhitespace', 'none', ['none', 'boundary', 'selection', 'all'], {
enumDescriptions: [
'',
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderWhitespace.boundary', "Render whitespace characters except for single spaces between words."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderWhitespace.selection', "Render whitespace characters only on selected text."),
''
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderWhitespace', "Controls how the editor should render whitespace characters.")
})),
revealHorizontalRightPadding: register(new EditorIntOption(75 /* revealHorizontalRightPadding */, 'revealHorizontalRightPadding', 30, 0, 1000)),
roundedSelection: register(new EditorBooleanOption(76 /* roundedSelection */, 'roundedSelection', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('roundedSelection', "Controls whether selections should have rounded corners.") })),
rulers: register(new EditorRulers()),
scrollbar: register(new EditorScrollbar()),
scrollBeyondLastColumn: register(new EditorIntOption(79 /* scrollBeyondLastColumn */, 'scrollBeyondLastColumn', 5, 0, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('scrollBeyondLastColumn', "Controls the number of extra characters beyond which the editor will scroll horizontally.") })),
scrollBeyondLastLine: register(new EditorBooleanOption(80 /* scrollBeyondLastLine */, 'scrollBeyondLastLine', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.") })),
selectionClipboard: register(new EditorBooleanOption(81 /* selectionClipboard */, 'selectionClipboard', true, {
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('selectionClipboard', "Controls whether the Linux primary clipboard should be supported."),
included: _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isLinux */ "d"]
})),
selectionHighlight: register(new EditorBooleanOption(82 /* selectionHighlight */, 'selectionHighlight', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('selectionHighlight', "Controls whether the editor should highlight matches similar to the selection.") })),
selectOnLineNumbers: register(new EditorBooleanOption(83 /* selectOnLineNumbers */, 'selectOnLineNumbers', true)),
showFoldingControls: register(new EditorStringEnumOption(84 /* showFoldingControls */, 'showFoldingControls', 'mouseover', ['always', 'mouseover'], { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('showFoldingControls', "Controls whether the fold controls on the gutter are automatically hidden.") })),
showUnused: register(new EditorBooleanOption(85 /* showUnused */, 'showUnused', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('showUnused', "Controls fading out of unused code.") })),
snippetSuggestions: register(new EditorStringEnumOption(86 /* snippetSuggestions */, 'snippetSuggestions', 'inline', ['top', 'bottom', 'inline', 'none'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('snippetSuggestions.top', "Show snippet suggestions on top of other suggestions."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('snippetSuggestions.bottom', "Show snippet suggestions below other suggestions."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('snippetSuggestions.inline', "Show snippets suggestions with other suggestions."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('snippetSuggestions.none', "Do not show snippet suggestions."),
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")
})),
smoothScrolling: register(new EditorBooleanOption(87 /* smoothScrolling */, 'smoothScrolling', false, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('smoothScrolling', "Controls whether the editor will scroll using an animation.") })),
stopRenderingLineAfter: register(new EditorIntOption(88 /* stopRenderingLineAfter */, 'stopRenderingLineAfter', 10000, -1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */)),
suggest: register(new EditorSuggest()),
suggestFontSize: register(new EditorIntOption(90 /* suggestFontSize */, 'suggestFontSize', 0, 0, 1000, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestFontSize', "Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.") })),
suggestLineHeight: register(new EditorIntOption(91 /* suggestLineHeight */, 'suggestLineHeight', 0, 0, 1000, { markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestLineHeight', "Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used.") })),
suggestOnTriggerCharacters: register(new EditorBooleanOption(92 /* suggestOnTriggerCharacters */, 'suggestOnTriggerCharacters', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestOnTriggerCharacters', "Controls whether suggestions should automatically show up when typing trigger characters.") })),
suggestSelection: register(new EditorStringEnumOption(93 /* suggestSelection */, 'suggestSelection', 'recentlyUsed', ['first', 'recentlyUsed', 'recentlyUsedByPrefix'], {
markdownEnumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestSelection.first', "Always select the first suggestion."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestSelection.recentlyUsed', "Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestSelection.recentlyUsedByPrefix', "Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`."),
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('suggestSelection', "Controls how suggestions are pre-selected when showing the suggest list.")
})),
tabCompletion: register(new EditorStringEnumOption(94 /* tabCompletion */, 'tabCompletion', 'off', ['on', 'off', 'onlySnippets'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('tabCompletion.on', "Tab complete will insert the best matching suggestion when pressing tab."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('tabCompletion.off', "Disable tab completions."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('tabCompletion.onlySnippets', "Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled."),
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('tabCompletion', "Enables tab completions.")
})),
useTabStops: register(new EditorBooleanOption(95 /* useTabStops */, 'useTabStops', true, { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('useTabStops', "Inserting and deleting whitespace follows tab stops.") })),
wordSeparators: register(new EditorStringOption(96 /* wordSeparators */, 'wordSeparators', _model_wordHelper_js__WEBPACK_IMPORTED_MODULE_2__[/* USUAL_WORD_SEPARATORS */ "b"], { description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.") })),
wordWrap: register(new EditorStringEnumOption(97 /* wordWrap */, 'wordWrap', 'off', ['off', 'on', 'wordWrapColumn', 'bounded'], {
markdownEnumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wordWrap.off', "Lines will never wrap."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wordWrap.on', "Lines will wrap at the viewport width."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]({
key: 'wordWrap.wordWrapColumn',
comment: [
'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
]
}, "Lines will wrap at `#editor.wordWrapColumn#`."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]({
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: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]({
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(98 /* wordWrapBreakAfterCharacters */, 'wordWrapBreakAfterCharacters', ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」')),
wordWrapBreakBeforeCharacters: register(new EditorStringOption(99 /* wordWrapBreakBeforeCharacters */, 'wordWrapBreakBeforeCharacters', '([{‘“〈《「『【〔([{「£¥$£¥++')),
wordWrapColumn: register(new EditorIntOption(100 /* wordWrapColumn */, 'wordWrapColumn', 80, 1, 1073741824 /* MAX_SAFE_SMALL_INTEGER */, {
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]({
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`.")
})),
wordWrapMinified: register(new EditorBooleanOption(101 /* wordWrapMinified */, 'wordWrapMinified', true)),
wrappingIndent: register(new EditorEnumOption(102 /* wrappingIndent */, 'wrappingIndent', 1 /* Same */, 'same', ['none', 'same', 'indent', 'deepIndent'], _wrappingIndentFromString, {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."),
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingIndent', "Controls the indentation of wrapped lines."),
})),
wrappingStrategy: register(new EditorStringEnumOption(103 /* wrappingStrategy */, 'wrappingStrategy', 'simple', ['simple', 'advanced'], {
enumDescriptions: [
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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."),
_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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.")
],
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wrappingStrategy', "Controls the algorithm that computes wrapping points.")
})),
// Leave these at the end (because they have dependencies!)
editorClassName: register(new EditorClassName()),
pixelRatio: register(new EditorPixelRatio()),
tabFocusMode: register(new EditorTabFocusMode()),
layoutInfo: register(new EditorLayoutInfoComputer()),
wrappingInfo: register(new EditorWrappingInfoComputer())
};
/***/ }),
/* 27 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return URI; });
/* harmony import */ var _platform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var _a;
var _schemePattern = /^\w[\w\d+.-]*$/;
var _singleSlashStart = /^\//;
var _doubleSlashStart = /^\/\//;
function _validateUri(ret, _strict) {
// scheme, must be set
if (!ret.scheme && _strict) {
throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}");
}
// scheme, https://tools.ietf.org/html/rfc3986#section-3.1
// ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
if (ret.scheme && !_schemePattern.test(ret.scheme)) {
throw new Error('[UriError]: Scheme contains illegal characters.');
}
// path, http://tools.ietf.org/html/rfc3986#section-3.3
// If a URI contains an authority component, then the path component
// must either be empty or begin with a slash ("/") character. If a URI
// does not contain an authority component, then the path cannot begin
// with two slash 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 ("//")');
}
}
}
}
// for a while we allowed uris *without* schemes and this is the migration
// for them, e.g. an uri without scheme and without strict-mode warns and falls
// back to the file-scheme. that should cause the least carnage and still be a
// clear warning
function _schemeFix(scheme, _strict) {
if (!scheme && !_strict) {
return 'file';
}
return scheme;
}
// implements a bit of https://tools.ietf.org/html/rfc3986#section-5
function _referenceResolution(scheme, path) {
// the slash-character is our 'default base' as we don't
// support constructing URIs relative to other URIs. This
// also means that we alter and potentially break paths.
// see https://tools.ietf.org/html/rfc3986#section-5.1.4
switch (scheme) {
case 'https':
case 'http':
case 'file':
if (!path) {
path = _slash;
}
else if (path[0] !== _slash) {
path = _slash + path;
}
break;
}
return path;
}
var _empty = '';
var _slash = '/';
var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
/**
* Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
* This class is a simple parser which creates the basic component parts
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
* and encoding.
*
* foo://example.com:8042/over/there?name=ferret#nose
* \_/ \______________/\_________/ \_________/ \__/
* | | | | |
* scheme authority path query fragment
* | _____________________|__
* / \ / \
* urn:example:animal:ferret:nose
*/
var URI = /** @class */ (function () {
/**
* @internal
*/
function URI(schemeOrData, authority, path, query, fragment, _strict) {
if (_strict === void 0) { _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;
// no validation because it's this URI
// that creates uri components.
// _validateUri(this);
}
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);
}
}
URI.isUri = function (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 === 'function'
&& typeof thing.with === 'function'
&& typeof thing.toString === 'function';
};
Object.defineProperty(URI.prototype, "fsPath", {
// ---- 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: function () {
// if (this.scheme !== 'file') {
// console.warn(`[UriError] calling fsPath with scheme ${this.scheme}`);
// }
return _makeFsPath(this);
},
enumerable: true,
configurable: true
});
// ---- modify to new -------------------------
URI.prototype.with = function (change) {
if (!change) {
return this;
}
var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment;
if (scheme === undefined) {
scheme = this.scheme;
}
else if (scheme === null) {
scheme = _empty;
}
if (authority === undefined) {
authority = this.authority;
}
else if (authority === null) {
authority = _empty;
}
if (path === undefined) {
path = this.path;
}
else if (path === null) {
path = _empty;
}
if (query === undefined) {
query = this.query;
}
else if (query === null) {
query = _empty;
}
if (fragment === undefined) {
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.msft.com/some/path`,
* `file:///usr/home`, or `scheme:with/path`.
*
* @param value A string which represents an URI (see `URI#toString`).
*/
URI.parse = function (value, _strict) {
if (_strict === void 0) { _strict = false; }
var match = _regexp.exec(value);
if (!match) {
return new _URI(_empty, _empty, _empty, _empty, _empty);
}
return new _URI(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[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`)
*/
URI.file = function (path) {
var authority = _empty;
// normalize to fwd-slashes on windows,
// on other systems bwd-slashes are valid
// filename character, eg /f\oo/ba\r.txt
if (_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* isWindows */ "h"]) {
path = path.replace(/\\/g, _slash);
}
// check for authority as used in UNC shares
// or use the path as given
if (path[0] === _slash && path[1] === _slash) {
var 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);
};
URI.from = function (components) {
return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment);
};
// ---- 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`
*/
URI.prototype.toString = function (skipEncoding) {
if (skipEncoding === void 0) { skipEncoding = false; }
return _asFormatted(this, skipEncoding);
};
URI.prototype.toJSON = function () {
return this;
};
URI.revive = function (data) {
if (!data) {
return data;
}
else if (data instanceof URI) {
return data;
}
else {
var result = new _URI(data);
result._formatted = data.external;
result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null;
return result;
}
};
return URI;
}());
var _pathSepMarker = _platform_js__WEBPACK_IMPORTED_MODULE_0__[/* isWindows */ "h"] ? 1 : undefined;
// eslint-disable-next-line @typescript-eslint/class-name-casing
var _URI = /** @class */ (function (_super) {
__extends(_URI, _super);
function _URI() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._formatted = null;
_this._fsPath = null;
return _this;
}
Object.defineProperty(_URI.prototype, "fsPath", {
get: function () {
if (!this._fsPath) {
this._fsPath = _makeFsPath(this);
}
return this._fsPath;
},
enumerable: true,
configurable: true
});
_URI.prototype.toString = function (skipEncoding) {
if (skipEncoding === void 0) { skipEncoding = false; }
if (!skipEncoding) {
if (!this._formatted) {
this._formatted = _asFormatted(this, false);
}
return this._formatted;
}
else {
// we don't cache that
return _asFormatted(this, true);
}
};
_URI.prototype.toJSON = function () {
var res = {
$mid: 1
};
// cached state
if (this._fsPath) {
res.fsPath = this._fsPath;
res._sep = _pathSepMarker;
}
if (this._formatted) {
res.external = this._formatted;
}
// uri components
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;
};
return _URI;
}(URI));
// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2
var encodeTable = (_a = {},
_a[58 /* Colon */] = '%3A',
_a[47 /* Slash */] = '%2F',
_a[63 /* QuestionMark */] = '%3F',
_a[35 /* Hash */] = '%23',
_a[91 /* OpenSquareBracket */] = '%5B',
_a[93 /* CloseSquareBracket */] = '%5D',
_a[64 /* AtSign */] = '%40',
_a[33 /* ExclamationMark */] = '%21',
_a[36 /* DollarSign */] = '%24',
_a[38 /* Ampersand */] = '%26',
_a[39 /* SingleQuote */] = '%27',
_a[40 /* OpenParen */] = '%28',
_a[41 /* CloseParen */] = '%29',
_a[42 /* Asterisk */] = '%2A',
_a[43 /* Plus */] = '%2B',
_a[44 /* Comma */] = '%2C',
_a[59 /* Semicolon */] = '%3B',
_a[61 /* Equals */] = '%3D',
_a[32 /* Space */] = '%20',
_a);
function encodeURIComponentFast(uriComponent, allowSlash) {
var res = undefined;
var nativeEncodePos = -1;
for (var pos = 0; pos < uriComponent.length; pos++) {
var code = uriComponent.charCodeAt(pos);
// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3
if ((code >= 97 /* a */ && code <= 122 /* z */)
|| (code >= 65 /* A */ && code <= 90 /* Z */)
|| (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */)
|| code === 45 /* Dash */
|| code === 46 /* Period */
|| code === 95 /* Underline */
|| code === 126 /* Tilde */
|| (allowSlash && code === 47 /* Slash */)) {
// check if we are delaying native encode
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
nativeEncodePos = -1;
}
// check if we write into a new string (by default we try to return the param)
if (res !== undefined) {
res += uriComponent.charAt(pos);
}
}
else {
// encoding needed, we need to allocate a new string
if (res === undefined) {
res = uriComponent.substr(0, pos);
}
// check with default table first
var escaped = encodeTable[code];
if (escaped !== undefined) {
// check if we are delaying native encode
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
nativeEncodePos = -1;
}
// append escaped variant to result
res += escaped;
}
else if (nativeEncodePos === -1) {
// use native encode only when needed
nativeEncodePos = pos;
}
}
}
if (nativeEncodePos !== -1) {
res += encodeURIComponent(uriComponent.substring(nativeEncodePos));
}
return res !== undefined ? res : uriComponent;
}
function encodeURIComponentMinimal(path) {
var res = undefined;
for (var pos = 0; pos < path.length; pos++) {
var code = path.charCodeAt(pos);
if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) {
if (res === undefined) {
res = path.substr(0, pos);
}
res += encodeTable[code];
}
else {
if (res !== undefined) {
res += path[pos];
}
}
}
return res !== undefined ? res : path;
}
/**
* Compute `fsPath` for the given uri
*/
function _makeFsPath(uri) {
var value;
if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') {
// unc path: file://shares/c$/far/boo
value = "//" + uri.authority + uri.path;
}
else if (uri.path.charCodeAt(0) === 47 /* Slash */
&& (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */)
&& uri.path.charCodeAt(2) === 58 /* Colon */) {
// windows drive letter: file:///c:/far/boo
value = uri.path[1].toLowerCase() + uri.path.substr(2);
}
else {
// other path
value = uri.path;
}
if (_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* isWindows */ "h"]) {
value = value.replace(/\//g, '\\');
}
return value;
}
/**
* Create the external version of a uri
*/
function _asFormatted(uri, skipEncoding) {
var encoder = !skipEncoding
? encodeURIComponentFast
: encodeURIComponentMinimal;
var res = '';
var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment;
if (scheme) {
res += scheme;
res += ':';
}
if (authority || scheme === 'file') {
res += _slash;
res += _slash;
}
if (authority) {
var idx = authority.indexOf('@');
if (idx !== -1) {
// @
var userinfo = authority.substr(0, idx);
authority = authority.substr(idx + 1);
idx = userinfo.indexOf(':');
if (idx === -1) {
res += encoder(userinfo, false);
}
else {
// :@
res += encoder(userinfo.substr(0, idx), false);
res += ':';
res += encoder(userinfo.substr(idx + 1), false);
}
res += '@';
}
authority = authority.toLowerCase();
idx = authority.indexOf(':');
if (idx === -1) {
res += encoder(authority, false);
}
else {
// :
res += encoder(authority.substr(0, idx), false);
res += authority.substr(idx);
}
}
if (path) {
// lower-case windows drive letters in /C:/fff or C:/fff
if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) {
var code = path.charCodeAt(1);
if (code >= 65 /* A */ && code <= 90 /* Z */) {
path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3); // "/c:".length === 3
}
}
else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) {
var code = path.charCodeAt(0);
if (code >= 65 /* A */ && code <= 90 /* Z */) {
path = String.fromCharCode(code + 32) + ":" + path.substr(2); // "/c:".length === 3
}
}
// encode the rest of the path
res += encoder(path, true);
}
if (query) {
res += '?';
res += encoder(query, false);
}
if (fragment) {
res += '#';
res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;
}
return res;
}
// --- decode
function decodeURIComponentGraceful(str) {
try {
return decodeURIComponent(str);
}
catch (_a) {
if (str.length > 3) {
return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3));
}
else {
return str;
}
}
}
var _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
function percentDecode(str) {
if (!str.match(_rEncodedAsHex)) {
return str;
}
return str.replace(_rEncodedAsHex, function (match) { return decodeURIComponentGraceful(match); });
}
/***/ }),
/* 28 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ICommandService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CommandsRegistry; });
/* harmony import */ var _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
/* harmony import */ var _base_common_linkedList_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98);
/* harmony import */ var _base_common_map_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var ICommandService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_2__[/* createDecorator */ "c"])('commandService');
var CommandsRegistry = new /** @class */ (function () {
function class_1() {
this._commands = new Map();
this._onDidRegisterCommand = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_3__[/* Emitter */ "a"]();
this.onDidRegisterCommand = this._onDidRegisterCommand.event;
}
class_1.prototype.registerCommand = function (idOrCommand, handler) {
var _this = this;
if (!idOrCommand) {
throw new Error("invalid command");
}
if (typeof idOrCommand === 'string') {
if (!handler) {
throw new Error("invalid command");
}
return this.registerCommand({ id: idOrCommand, handler: handler });
}
// add argument validation if rich command metadata is provided
if (idOrCommand.description) {
var constraints_1 = [];
for (var _i = 0, _a = idOrCommand.description.args; _i < _a.length; _i++) {
var arg = _a[_i];
constraints_1.push(arg.constraint);
}
var actualHandler_1 = idOrCommand.handler;
idOrCommand.handler = function (accessor) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_1__[/* validateConstraints */ "m"])(args, constraints_1);
return actualHandler_1.apply(void 0, __spreadArrays([accessor], args));
};
}
// find a place to store the command
var id = idOrCommand.id;
var commands = this._commands.get(id);
if (!commands) {
commands = new _base_common_linkedList_js__WEBPACK_IMPORTED_MODULE_4__[/* LinkedList */ "a"]();
this._commands.set(id, commands);
}
var removeFn = commands.unshift(idOrCommand);
var ret = Object(_base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_0__[/* toDisposable */ "h"])(function () {
removeFn();
var command = _this._commands.get(id);
if (command === null || command === void 0 ? void 0 : command.isEmpty()) {
_this._commands.delete(id);
}
});
// tell the world about this command
this._onDidRegisterCommand.fire(id);
return ret;
};
class_1.prototype.registerCommandAlias = function (oldId, newId) {
return CommandsRegistry.registerCommand(oldId, function (accessor) {
var _a;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return (_a = accessor.get(ICommandService)).executeCommand.apply(_a, __spreadArrays([newId], args));
});
};
class_1.prototype.getCommand = function (id) {
var list = this._commands.get(id);
if (!list || list.isEmpty()) {
return undefined;
}
return list.iterator().next().value;
};
class_1.prototype.getCommands = function () {
var result = new Map();
for (var _i = 0, _a = Object(_base_common_map_js__WEBPACK_IMPORTED_MODULE_5__[/* keys */ "d"])(this._commands); _i < _a.length; _i++) {
var key = _a[_i];
var command = this.getCommand(key);
if (command) {
result.set(key, command);
}
}
return result;
};
return class_1;
}());
/***/ }),
/* 29 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FastDomNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return createFastDomNode; });
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var FastDomNode = /** @class */ (function () {
function FastDomNode(domNode) {
this.domNode = domNode;
this._maxWidth = -1;
this._width = -1;
this._height = -1;
this._top = -1;
this._left = -1;
this._bottom = -1;
this._right = -1;
this._fontFamily = '';
this._fontWeight = '';
this._fontSize = -1;
this._fontFeatureSettings = '';
this._lineHeight = -1;
this._letterSpacing = -100;
this._className = '';
this._display = '';
this._position = '';
this._visibility = '';
this._backgroundColor = '';
this._layerHint = false;
this._contain = 'none';
}
FastDomNode.prototype.setMaxWidth = function (maxWidth) {
if (this._maxWidth === maxWidth) {
return;
}
this._maxWidth = maxWidth;
this.domNode.style.maxWidth = this._maxWidth + 'px';
};
FastDomNode.prototype.setWidth = function (width) {
if (this._width === width) {
return;
}
this._width = width;
this.domNode.style.width = this._width + 'px';
};
FastDomNode.prototype.setHeight = function (height) {
if (this._height === height) {
return;
}
this._height = height;
this.domNode.style.height = this._height + 'px';
};
FastDomNode.prototype.setTop = function (top) {
if (this._top === top) {
return;
}
this._top = top;
this.domNode.style.top = this._top + 'px';
};
FastDomNode.prototype.unsetTop = function () {
if (this._top === -1) {
return;
}
this._top = -1;
this.domNode.style.top = '';
};
FastDomNode.prototype.setLeft = function (left) {
if (this._left === left) {
return;
}
this._left = left;
this.domNode.style.left = this._left + 'px';
};
FastDomNode.prototype.setBottom = function (bottom) {
if (this._bottom === bottom) {
return;
}
this._bottom = bottom;
this.domNode.style.bottom = this._bottom + 'px';
};
FastDomNode.prototype.setRight = function (right) {
if (this._right === right) {
return;
}
this._right = right;
this.domNode.style.right = this._right + 'px';
};
FastDomNode.prototype.setFontFamily = function (fontFamily) {
if (this._fontFamily === fontFamily) {
return;
}
this._fontFamily = fontFamily;
this.domNode.style.fontFamily = this._fontFamily;
};
FastDomNode.prototype.setFontWeight = function (fontWeight) {
if (this._fontWeight === fontWeight) {
return;
}
this._fontWeight = fontWeight;
this.domNode.style.fontWeight = this._fontWeight;
};
FastDomNode.prototype.setFontSize = function (fontSize) {
if (this._fontSize === fontSize) {
return;
}
this._fontSize = fontSize;
this.domNode.style.fontSize = this._fontSize + 'px';
};
FastDomNode.prototype.setFontFeatureSettings = function (fontFeatureSettings) {
if (this._fontFeatureSettings === fontFeatureSettings) {
return;
}
this._fontFeatureSettings = fontFeatureSettings;
this.domNode.style.fontFeatureSettings = this._fontFeatureSettings;
};
FastDomNode.prototype.setLineHeight = function (lineHeight) {
if (this._lineHeight === lineHeight) {
return;
}
this._lineHeight = lineHeight;
this.domNode.style.lineHeight = this._lineHeight + 'px';
};
FastDomNode.prototype.setLetterSpacing = function (letterSpacing) {
if (this._letterSpacing === letterSpacing) {
return;
}
this._letterSpacing = letterSpacing;
this.domNode.style.letterSpacing = this._letterSpacing + 'px';
};
FastDomNode.prototype.setClassName = function (className) {
if (this._className === className) {
return;
}
this._className = className;
this.domNode.className = this._className;
};
FastDomNode.prototype.toggleClassName = function (className, shouldHaveIt) {
_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* toggleClass */ "Y"](this.domNode, className, shouldHaveIt);
this._className = this.domNode.className;
};
FastDomNode.prototype.setDisplay = function (display) {
if (this._display === display) {
return;
}
this._display = display;
this.domNode.style.display = this._display;
};
FastDomNode.prototype.setPosition = function (position) {
if (this._position === position) {
return;
}
this._position = position;
this.domNode.style.position = this._position;
};
FastDomNode.prototype.setVisibility = function (visibility) {
if (this._visibility === visibility) {
return;
}
this._visibility = visibility;
this.domNode.style.visibility = this._visibility;
};
FastDomNode.prototype.setBackgroundColor = function (backgroundColor) {
if (this._backgroundColor === backgroundColor) {
return;
}
this._backgroundColor = backgroundColor;
this.domNode.style.backgroundColor = this._backgroundColor;
};
FastDomNode.prototype.setLayerHinting = function (layerHint) {
if (this._layerHint === layerHint) {
return;
}
this._layerHint = layerHint;
this.domNode.style.transform = this._layerHint ? 'translate3d(0px, 0px, 0px)' : '';
};
FastDomNode.prototype.setContain = function (contain) {
if (this._contain === contain) {
return;
}
this._contain = contain;
this.domNode.style.contain = this._contain;
};
FastDomNode.prototype.setAttribute = function (name, value) {
this.domNode.setAttribute(name, value);
};
FastDomNode.prototype.removeAttribute = function (name) {
this.domNode.removeAttribute(name);
};
FastDomNode.prototype.appendChild = function (child) {
this.domNode.appendChild(child.domNode);
};
FastDomNode.prototype.removeChild = function (child) {
this.domNode.removeChild(child.domNode);
};
return FastDomNode;
}());
function createFastDomNode(domNode) {
return new FastDomNode(domNode);
}
/***/ }),
/* 30 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ textModel_TextModel; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ textModel_ModelDecorationOptions; });
// UNUSED EXPORTS: createTextBufferFactory, createTextBuffer, LONG_LINE_BOUNDARY, ModelDecorationOverviewRulerOptions, ModelDecorationMinimapOptions, DidChangeDecorationsEmitter, DidChangeContentEmitter
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/uri.js
var uri = __webpack_require__(27);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js
var editorOptions = __webpack_require__(26);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/position.js
var core_position = __webpack_require__(12);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var core_range = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/selection.js
var selection = __webpack_require__(24);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model.js
var model = __webpack_require__(47);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/editStack.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var EditStackElement = /** @class */ (function () {
function EditStackElement(beforeVersionId, beforeCursorState) {
this.beforeVersionId = beforeVersionId;
this.beforeCursorState = beforeCursorState;
this.afterCursorState = null;
this.afterVersionId = -1;
this.editOperations = [];
}
EditStackElement.prototype.undo = function (model) {
// Apply all operations in reverse order
for (var i = this.editOperations.length - 1; i >= 0; i--) {
this.editOperations[i] = {
operations: model.applyEdits(this.editOperations[i].operations)
};
}
};
EditStackElement.prototype.redo = function (model) {
// Apply all operations
for (var i = 0; i < this.editOperations.length; i++) {
this.editOperations[i] = {
operations: model.applyEdits(this.editOperations[i].operations)
};
}
};
return EditStackElement;
}());
function getModelEOL(model) {
var eol = model.getEOL();
if (eol === '\n') {
return 0 /* LF */;
}
else {
return 1 /* CRLF */;
}
}
var EOLStackElement = /** @class */ (function () {
function EOLStackElement(beforeVersionId, setEOL) {
this.beforeVersionId = beforeVersionId;
this.beforeCursorState = null;
this.afterCursorState = null;
this.afterVersionId = -1;
this.eol = setEOL;
}
EOLStackElement.prototype.undo = function (model) {
var redoEOL = getModelEOL(model);
model.setEOL(this.eol);
this.eol = redoEOL;
};
EOLStackElement.prototype.redo = function (model) {
var undoEOL = getModelEOL(model);
model.setEOL(this.eol);
this.eol = undoEOL;
};
return EOLStackElement;
}());
var editStack_EditStack = /** @class */ (function () {
function EditStack(model) {
this.model = model;
this.currentOpenStackElement = null;
this.past = [];
this.future = [];
}
EditStack.prototype.pushStackElement = function () {
if (this.currentOpenStackElement !== null) {
this.past.push(this.currentOpenStackElement);
this.currentOpenStackElement = null;
}
};
EditStack.prototype.clear = function () {
this.currentOpenStackElement = null;
this.past = [];
this.future = [];
};
EditStack.prototype.pushEOL = function (eol) {
// No support for parallel universes :(
this.future = [];
if (this.currentOpenStackElement) {
this.pushStackElement();
}
var prevEOL = getModelEOL(this.model);
var stackElement = new EOLStackElement(this.model.getAlternativeVersionId(), prevEOL);
this.model.setEOL(eol);
stackElement.afterVersionId = this.model.getVersionId();
this.currentOpenStackElement = stackElement;
this.pushStackElement();
};
EditStack.prototype.pushEditOperation = function (beforeCursorState, editOperations, cursorStateComputer) {
// No support for parallel universes :(
this.future = [];
var stackElement = null;
if (this.currentOpenStackElement) {
if (this.currentOpenStackElement instanceof EditStackElement) {
stackElement = this.currentOpenStackElement;
}
else {
this.pushStackElement();
}
}
if (!this.currentOpenStackElement) {
stackElement = new EditStackElement(this.model.getAlternativeVersionId(), beforeCursorState);
this.currentOpenStackElement = stackElement;
}
var inverseEditOperation = {
operations: this.model.applyEdits(editOperations)
};
stackElement.editOperations.push(inverseEditOperation);
stackElement.afterCursorState = EditStack._computeCursorState(cursorStateComputer, inverseEditOperation.operations);
stackElement.afterVersionId = this.model.getVersionId();
return stackElement.afterCursorState;
};
EditStack._computeCursorState = function (cursorStateComputer, inverseEditOperations) {
try {
return cursorStateComputer ? cursorStateComputer(inverseEditOperations) : null;
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
return null;
}
};
EditStack.prototype.undo = function () {
this.pushStackElement();
if (this.past.length > 0) {
var pastStackElement = this.past.pop();
try {
pastStackElement.undo(this.model);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
this.clear();
return null;
}
this.future.push(pastStackElement);
return {
selections: pastStackElement.beforeCursorState,
recordedVersionId: pastStackElement.beforeVersionId
};
}
return null;
};
EditStack.prototype.canUndo = function () {
return (this.past.length > 0) || this.currentOpenStackElement !== null;
};
EditStack.prototype.redo = function () {
if (this.future.length > 0) {
var futureStackElement = this.future.pop();
try {
futureStackElement.redo(this.model);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
this.clear();
return null;
}
this.past.push(futureStackElement);
return {
selections: futureStackElement.afterCursorState,
recordedVersionId: futureStackElement.afterVersionId
};
}
return null;
};
EditStack.prototype.canRedo = function () {
return (this.future.length > 0);
};
return EditStack;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/indentationGuesser.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var SpacesDiffResult = /** @class */ (function () {
function SpacesDiffResult() {
this.spacesDiff = 0;
this.looksLikeAlignment = false;
}
return SpacesDiffResult;
}());
/**
* Compute the diff in spaces between two line's indentation.
*/
function spacesDiff(a, aLength, b, bLength, result) {
result.spacesDiff = 0;
result.looksLikeAlignment = false;
// This can go both ways (e.g.):
// - a: "\t"
// - b: "\t "
// => This should count 1 tab and 4 spaces
var i;
for (i = 0; i < aLength && i < bLength; i++) {
var aCharCode = a.charCodeAt(i);
var bCharCode = b.charCodeAt(i);
if (aCharCode !== bCharCode) {
break;
}
}
var aSpacesCnt = 0, aTabsCount = 0;
for (var j = i; j < aLength; j++) {
var aCharCode = a.charCodeAt(j);
if (aCharCode === 32 /* Space */) {
aSpacesCnt++;
}
else {
aTabsCount++;
}
}
var bSpacesCnt = 0, bTabsCount = 0;
for (var j = i; j < bLength; j++) {
var bCharCode = b.charCodeAt(j);
if (bCharCode === 32 /* Space */) {
bSpacesCnt++;
}
else {
bTabsCount++;
}
}
if (aSpacesCnt > 0 && aTabsCount > 0) {
return;
}
if (bSpacesCnt > 0 && bTabsCount > 0) {
return;
}
var tabsDiff = Math.abs(aTabsCount - bTabsCount);
var spacesDiff = Math.abs(aSpacesCnt - bSpacesCnt);
if (tabsDiff === 0) {
// check if the indentation difference might be caused by alignment reasons
// sometime folks like to align their code, but this should not be used as a hint
result.spacesDiff = spacesDiff;
if (spacesDiff > 0 && 0 <= bSpacesCnt - 1 && bSpacesCnt - 1 < a.length && bSpacesCnt < b.length) {
if (b.charCodeAt(bSpacesCnt) !== 32 /* Space */ && a.charCodeAt(bSpacesCnt - 1) === 32 /* Space */) {
if (a.charCodeAt(a.length - 1) === 44 /* Comma */) {
// This looks like an alignment desire: e.g.
// const a = b + c,
// d = b - c;
result.looksLikeAlignment = true;
}
}
}
return;
}
if (spacesDiff % tabsDiff === 0) {
result.spacesDiff = spacesDiff / tabsDiff;
return;
}
}
function guessIndentation(source, defaultTabSize, defaultInsertSpaces) {
// Look at most at the first 10k lines
var linesCount = Math.min(source.getLineCount(), 10000);
var linesIndentedWithTabsCount = 0; // number of lines that contain at least one tab in indentation
var linesIndentedWithSpacesCount = 0; // number of lines that contain only spaces in indentation
var previousLineText = ''; // content of latest line that contained non-whitespace chars
var previousLineIndentation = 0; // index at which latest line contained the first non-whitespace char
var ALLOWED_TAB_SIZE_GUESSES = [2, 4, 6, 8, 3, 5, 7]; // prefer even guesses for `tabSize`, limit to [2, 8].
var MAX_ALLOWED_TAB_SIZE_GUESS = 8; // max(ALLOWED_TAB_SIZE_GUESSES) = 8
var spacesDiffCount = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // `tabSize` scores
var tmp = new SpacesDiffResult();
for (var lineNumber = 1; lineNumber <= linesCount; lineNumber++) {
var currentLineLength = source.getLineLength(lineNumber);
var currentLineText = source.getLineContent(lineNumber);
// if the text buffer is chunk based, so long lines are cons-string, v8 will flattern the string when we check charCode.
// checking charCode on chunks directly is cheaper.
var useCurrentLineText = (currentLineLength <= 65536);
var currentLineHasContent = false; // does `currentLineText` contain non-whitespace chars
var currentLineIndentation = 0; // index at which `currentLineText` contains the first non-whitespace char
var currentLineSpacesCount = 0; // count of spaces found in `currentLineText` indentation
var currentLineTabsCount = 0; // count of tabs found in `currentLineText` indentation
for (var j = 0, lenJ = currentLineLength; j < lenJ; j++) {
var charCode = (useCurrentLineText ? currentLineText.charCodeAt(j) : source.getLineCharCode(lineNumber, j));
if (charCode === 9 /* Tab */) {
currentLineTabsCount++;
}
else if (charCode === 32 /* Space */) {
currentLineSpacesCount++;
}
else {
// Hit non whitespace character on this line
currentLineHasContent = true;
currentLineIndentation = j;
break;
}
}
// Ignore empty or only whitespace lines
if (!currentLineHasContent) {
continue;
}
if (currentLineTabsCount > 0) {
linesIndentedWithTabsCount++;
}
else if (currentLineSpacesCount > 1) {
linesIndentedWithSpacesCount++;
}
spacesDiff(previousLineText, previousLineIndentation, currentLineText, currentLineIndentation, tmp);
if (tmp.looksLikeAlignment) {
// if defaultInsertSpaces === true && the spaces count == tabSize, we may want to count it as valid indentation
//
// - item1
// - item2
//
// otherwise skip this line entirely
//
// const a = 1,
// b = 2;
if (!(defaultInsertSpaces && defaultTabSize === tmp.spacesDiff)) {
continue;
}
}
var currentSpacesDiff = tmp.spacesDiff;
if (currentSpacesDiff <= MAX_ALLOWED_TAB_SIZE_GUESS) {
spacesDiffCount[currentSpacesDiff]++;
}
previousLineText = currentLineText;
previousLineIndentation = currentLineIndentation;
}
var insertSpaces = defaultInsertSpaces;
if (linesIndentedWithTabsCount !== linesIndentedWithSpacesCount) {
insertSpaces = (linesIndentedWithTabsCount < linesIndentedWithSpacesCount);
}
var tabSize = defaultTabSize;
// Guess tabSize only if inserting spaces...
if (insertSpaces) {
var tabSizeScore_1 = (insertSpaces ? 0 : 0.1 * linesCount);
// console.log("score threshold: " + tabSizeScore);
ALLOWED_TAB_SIZE_GUESSES.forEach(function (possibleTabSize) {
var possibleTabSizeScore = spacesDiffCount[possibleTabSize];
if (possibleTabSizeScore > tabSizeScore_1) {
tabSizeScore_1 = possibleTabSizeScore;
tabSize = possibleTabSize;
}
});
// Let a tabSize of 2 win even if it is not the maximum
// (only in case 4 was guessed)
if (tabSize === 4 && spacesDiffCount[4] > 0 && spacesDiffCount[2] > 0 && spacesDiffCount[2] >= spacesDiffCount[4] / 2) {
tabSize = 2;
}
}
// console.log('--------------------------');
// console.log('linesIndentedWithTabsCount: ' + linesIndentedWithTabsCount + ', linesIndentedWithSpacesCount: ' + linesIndentedWithSpacesCount);
// console.log('spacesDiffCount: ' + spacesDiffCount);
// console.log('tabSize: ' + tabSize + ', tabSizeScore: ' + tabSizeScore);
return {
insertSpaces: insertSpaces,
tabSize: tabSize
};
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/intervalTree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function getNodeColor(node) {
return ((node.metadata & 1 /* ColorMask */) >>> 0 /* ColorOffset */);
}
function setNodeColor(node, color) {
node.metadata = ((node.metadata & 254 /* ColorMaskInverse */) | (color << 0 /* ColorOffset */));
}
function getNodeIsVisited(node) {
return ((node.metadata & 2 /* IsVisitedMask */) >>> 1 /* IsVisitedOffset */) === 1;
}
function setNodeIsVisited(node, value) {
node.metadata = ((node.metadata & 253 /* IsVisitedMaskInverse */) | ((value ? 1 : 0) << 1 /* IsVisitedOffset */));
}
function getNodeIsForValidation(node) {
return ((node.metadata & 4 /* IsForValidationMask */) >>> 2 /* IsForValidationOffset */) === 1;
}
function setNodeIsForValidation(node, value) {
node.metadata = ((node.metadata & 251 /* IsForValidationMaskInverse */) | ((value ? 1 : 0) << 2 /* IsForValidationOffset */));
}
function getNodeIsInOverviewRuler(node) {
return ((node.metadata & 8 /* IsInOverviewRulerMask */) >>> 3 /* IsInOverviewRulerOffset */) === 1;
}
function setNodeIsInOverviewRuler(node, value) {
node.metadata = ((node.metadata & 247 /* IsInOverviewRulerMaskInverse */) | ((value ? 1 : 0) << 3 /* IsInOverviewRulerOffset */));
}
function getNodeStickiness(node) {
return ((node.metadata & 48 /* StickinessMask */) >>> 4 /* StickinessOffset */);
}
function _setNodeStickiness(node, stickiness) {
node.metadata = ((node.metadata & 207 /* StickinessMaskInverse */) | (stickiness << 4 /* StickinessOffset */));
}
function getCollapseOnReplaceEdit(node) {
return ((node.metadata & 64 /* CollapseOnReplaceEditMask */) >>> 6 /* CollapseOnReplaceEditOffset */) === 1;
}
function setCollapseOnReplaceEdit(node, value) {
node.metadata = ((node.metadata & 191 /* CollapseOnReplaceEditMaskInverse */) | ((value ? 1 : 0) << 6 /* CollapseOnReplaceEditOffset */));
}
var IntervalNode = /** @class */ (function () {
function IntervalNode(id, start, end) {
this.metadata = 0;
this.parent = this;
this.left = this;
this.right = this;
setNodeColor(this, 1 /* Red */);
this.start = start;
this.end = end;
// FORCE_OVERFLOWING_TEST: this.delta = start;
this.delta = 0;
this.maxEnd = end;
this.id = id;
this.ownerId = 0;
this.options = null;
setNodeIsForValidation(this, false);
_setNodeStickiness(this, 1 /* NeverGrowsWhenTypingAtEdges */);
setNodeIsInOverviewRuler(this, false);
setCollapseOnReplaceEdit(this, false);
this.cachedVersionId = 0;
this.cachedAbsoluteStart = start;
this.cachedAbsoluteEnd = end;
this.range = null;
setNodeIsVisited(this, false);
}
IntervalNode.prototype.reset = function (versionId, start, end, range) {
this.start = start;
this.end = end;
this.maxEnd = end;
this.cachedVersionId = versionId;
this.cachedAbsoluteStart = start;
this.cachedAbsoluteEnd = end;
this.range = range;
};
IntervalNode.prototype.setOptions = function (options) {
this.options = options;
var className = this.options.className;
setNodeIsForValidation(this, (className === "squiggly-error" /* EditorErrorDecoration */
|| className === "squiggly-warning" /* EditorWarningDecoration */
|| className === "squiggly-info" /* EditorInfoDecoration */));
_setNodeStickiness(this, this.options.stickiness);
setNodeIsInOverviewRuler(this, (this.options.overviewRuler && this.options.overviewRuler.color) ? true : false);
setCollapseOnReplaceEdit(this, this.options.collapseOnReplaceEdit);
};
IntervalNode.prototype.setCachedOffsets = function (absoluteStart, absoluteEnd, cachedVersionId) {
if (this.cachedVersionId !== cachedVersionId) {
this.range = null;
}
this.cachedVersionId = cachedVersionId;
this.cachedAbsoluteStart = absoluteStart;
this.cachedAbsoluteEnd = absoluteEnd;
};
IntervalNode.prototype.detach = function () {
this.parent = null;
this.left = null;
this.right = null;
};
return IntervalNode;
}());
var SENTINEL = new IntervalNode(null, 0, 0);
SENTINEL.parent = SENTINEL;
SENTINEL.left = SENTINEL;
SENTINEL.right = SENTINEL;
setNodeColor(SENTINEL, 0 /* Black */);
var IntervalTree = /** @class */ (function () {
function IntervalTree() {
this.root = SENTINEL;
this.requestNormalizeDelta = false;
}
IntervalTree.prototype.intervalSearch = function (start, end, filterOwnerId, filterOutValidation, cachedVersionId) {
if (this.root === SENTINEL) {
return [];
}
return intervalSearch(this, start, end, filterOwnerId, filterOutValidation, cachedVersionId);
};
IntervalTree.prototype.search = function (filterOwnerId, filterOutValidation, cachedVersionId) {
if (this.root === SENTINEL) {
return [];
}
return search(this, filterOwnerId, filterOutValidation, cachedVersionId);
};
/**
* Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!
*/
IntervalTree.prototype.collectNodesFromOwner = function (ownerId) {
return collectNodesFromOwner(this, ownerId);
};
/**
* Will not set `cachedAbsoluteStart` nor `cachedAbsoluteEnd` on the returned nodes!
*/
IntervalTree.prototype.collectNodesPostOrder = function () {
return collectNodesPostOrder(this);
};
IntervalTree.prototype.insert = function (node) {
rbTreeInsert(this, node);
this._normalizeDeltaIfNecessary();
};
IntervalTree.prototype.delete = function (node) {
rbTreeDelete(this, node);
this._normalizeDeltaIfNecessary();
};
IntervalTree.prototype.resolveNode = function (node, cachedVersionId) {
var initialNode = node;
var delta = 0;
while (node !== this.root) {
if (node === node.parent.right) {
delta += node.parent.delta;
}
node = node.parent;
}
var nodeStart = initialNode.start + delta;
var nodeEnd = initialNode.end + delta;
initialNode.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
};
IntervalTree.prototype.acceptReplace = function (offset, length, textLength, forceMoveMarkers) {
// Our strategy is to remove all directly impacted nodes, and then add them back to the tree.
// (1) collect all nodes that are intersecting this edit as nodes of interest
var nodesOfInterest = searchForEditing(this, offset, offset + length);
// (2) remove all nodes that are intersecting this edit
for (var i = 0, len = nodesOfInterest.length; i < len; i++) {
var node = nodesOfInterest[i];
rbTreeDelete(this, node);
}
this._normalizeDeltaIfNecessary();
// (3) edit all tree nodes except the nodes of interest
noOverlapReplace(this, offset, offset + length, textLength);
this._normalizeDeltaIfNecessary();
// (4) edit the nodes of interest and insert them back in the tree
for (var i = 0, len = nodesOfInterest.length; i < len; i++) {
var 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();
};
IntervalTree.prototype._normalizeDeltaIfNecessary = function () {
if (!this.requestNormalizeDelta) {
return;
}
this.requestNormalizeDelta = false;
normalizeDelta(this);
};
return IntervalTree;
}());
//#region Delta Normalization
function normalizeDelta(T) {
var node = T.root;
var delta = 0;
while (node !== SENTINEL) {
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
// go left
node = node.left;
continue;
}
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
delta += node.delta;
node = node.right;
continue;
}
// handle current node
node.start = delta + node.start;
node.end = delta + node.end;
node.delta = 0;
recomputeMaxEnd(node);
setNodeIsVisited(node, true);
// going up from this node
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 /* ForceMove */) {
return false;
}
if (moveSemantics === 2 /* ForceStay */) {
return true;
}
return markerStickToPreviousCharacter;
}
/**
* This is a lot more complicated than strictly necessary to maintain the same behaviour
* as when decorations were implemented using two markers.
*/
function nodeAcceptEdit(node, start, end, textLength, forceMoveMarkers) {
var nodeStickiness = getNodeStickiness(node);
var startStickToPreviousCharacter = (nodeStickiness === 0 /* AlwaysGrowsWhenTypingAtEdges */
|| nodeStickiness === 2 /* GrowsOnlyWhenTypingBefore */);
var endStickToPreviousCharacter = (nodeStickiness === 1 /* NeverGrowsWhenTypingAtEdges */
|| nodeStickiness === 2 /* GrowsOnlyWhenTypingBefore */);
var deletingCnt = (end - start);
var insertingCnt = textLength;
var commonLength = Math.min(deletingCnt, insertingCnt);
var nodeStart = node.start;
var startDone = false;
var nodeEnd = node.end;
var endDone = false;
if (start <= nodeStart && nodeEnd <= end && getCollapseOnReplaceEdit(node)) {
// This edit encompasses the entire decoration range
// and the decoration has asked to become collapsed
node.start = start;
startDone = true;
node.end = start;
endDone = true;
}
{
var moveSemantics = forceMoveMarkers ? 1 /* ForceMove */ : (deletingCnt > 0 ? 2 /* ForceStay */ : 0 /* MarkerDefined */);
if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start, moveSemantics)) {
startDone = true;
}
if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start, moveSemantics)) {
endDone = true;
}
}
if (commonLength > 0 && !forceMoveMarkers) {
var moveSemantics = (deletingCnt > insertingCnt ? 2 /* ForceStay */ : 0 /* MarkerDefined */);
if (!startDone && adjustMarkerBeforeColumn(nodeStart, startStickToPreviousCharacter, start + commonLength, moveSemantics)) {
startDone = true;
}
if (!endDone && adjustMarkerBeforeColumn(nodeEnd, endStickToPreviousCharacter, start + commonLength, moveSemantics)) {
endDone = true;
}
}
{
var moveSemantics = forceMoveMarkers ? 1 /* ForceMove */ : 0 /* MarkerDefined */;
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;
}
}
// Finish
var 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) {
// https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree
// Now, it is known that two intervals A and B overlap only when both
// A.low <= B.high and A.high >= B.low. When searching the trees for
// nodes overlapping with a given interval, you can immediately skip:
// a) all nodes to the right of nodes whose low value is past the end of the given interval.
// b) all nodes that have their maximum 'high' value below the start of the given interval.
var node = T.root;
var delta = 0;
var nodeMaxEnd = 0;
var nodeStart = 0;
var nodeEnd = 0;
var result = [];
var resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this 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)) {
// first time seeing this node
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < start) {
// cover case b) from above
// there is no need to search this node or its children
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
// go left
node = node.left;
continue;
}
}
// handle current node
nodeStart = delta + node.start;
if (nodeStart > end) {
// cover case a) from above
// there is no need to search this node or its right subtree
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)) {
// go right
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function noOverlapReplace(T, start, end, textLength) {
// https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree
// Now, it is known that two intervals A and B overlap only when both
// A.low <= B.high and A.high >= B.low. When searching the trees for
// nodes overlapping with a given interval, you can immediately skip:
// a) all nodes to the right of nodes whose low value is past the end of the given interval.
// b) all nodes that have their maximum 'high' value below the start of the given interval.
var node = T.root;
var delta = 0;
var nodeMaxEnd = 0;
var nodeStart = 0;
var editDelta = (textLength - (end - start));
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this 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)) {
// first time seeing this node
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < start) {
// cover case b) from above
// there is no need to search this node or its children
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
// go left
node = node.left;
continue;
}
}
// handle current node
nodeStart = delta + node.start;
if (nodeStart > end) {
node.start += editDelta;
node.end += editDelta;
node.delta += editDelta;
if (node.delta < -1073741824 /* MIN_SAFE_DELTA */ || node.delta > 1073741824 /* MAX_SAFE_DELTA */) {
T.requestNormalizeDelta = true;
}
// cover case a) from above
// there is no need to search this node or its right subtree
setNodeIsVisited(node, true);
continue;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
}
//#endregion
//#region Searching
function collectNodesFromOwner(T, ownerId) {
var node = T.root;
var result = [];
var resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this node
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
node = node.parent;
continue;
}
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
// go left
node = node.left;
continue;
}
// handle current node
if (node.ownerId === ownerId) {
result[resultLen++] = node;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function collectNodesPostOrder(T) {
var node = T.root;
var result = [];
var resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this node
setNodeIsVisited(node.left, false);
setNodeIsVisited(node.right, false);
node = node.parent;
continue;
}
if (node.left !== SENTINEL && !getNodeIsVisited(node.left)) {
// go left
node = node.left;
continue;
}
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
node = node.right;
continue;
}
// handle current node
result[resultLen++] = node;
setNodeIsVisited(node, true);
}
setNodeIsVisited(T.root, false);
return result;
}
function search(T, filterOwnerId, filterOutValidation, cachedVersionId) {
var node = T.root;
var delta = 0;
var nodeStart = 0;
var nodeEnd = 0;
var result = [];
var resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this 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)) {
// go left
node = node.left;
continue;
}
// handle current node
nodeStart = delta + node.start;
nodeEnd = delta + node.end;
node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
var include = true;
if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {
include = false;
}
if (filterOutValidation && getNodeIsForValidation(node)) {
include = false;
}
if (include) {
result[resultLen++] = node;
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
function intervalSearch(T, intervalStart, intervalEnd, filterOwnerId, filterOutValidation, cachedVersionId) {
// https://en.wikipedia.org/wiki/Interval_tree#Augmented_tree
// Now, it is known that two intervals A and B overlap only when both
// A.low <= B.high and A.high >= B.low. When searching the trees for
// nodes overlapping with a given interval, you can immediately skip:
// a) all nodes to the right of nodes whose low value is past the end of the given interval.
// b) all nodes that have their maximum 'high' value below the start of the given interval.
var node = T.root;
var delta = 0;
var nodeMaxEnd = 0;
var nodeStart = 0;
var nodeEnd = 0;
var result = [];
var resultLen = 0;
while (node !== SENTINEL) {
if (getNodeIsVisited(node)) {
// going up from this 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)) {
// first time seeing this node
nodeMaxEnd = delta + node.maxEnd;
if (nodeMaxEnd < intervalStart) {
// cover case b) from above
// there is no need to search this node or its children
setNodeIsVisited(node, true);
continue;
}
if (node.left !== SENTINEL) {
// go left
node = node.left;
continue;
}
}
// handle current node
nodeStart = delta + node.start;
if (nodeStart > intervalEnd) {
// cover case a) from above
// there is no need to search this node or its right subtree
setNodeIsVisited(node, true);
continue;
}
nodeEnd = delta + node.end;
if (nodeEnd >= intervalStart) {
// There is overlap
node.setCachedOffsets(nodeStart, nodeEnd, cachedVersionId);
var include = true;
if (filterOwnerId && node.ownerId && node.ownerId !== filterOwnerId) {
include = false;
}
if (filterOutValidation && getNodeIsForValidation(node)) {
include = false;
}
if (include) {
result[resultLen++] = node;
}
}
setNodeIsVisited(node, true);
if (node.right !== SENTINEL && !getNodeIsVisited(node.right)) {
// go right
delta += node.delta;
node = node.right;
continue;
}
}
setNodeIsVisited(T.root, false);
return result;
}
//#endregion
//#region Insertion
function rbTreeInsert(T, newNode) {
if (T.root === SENTINEL) {
newNode.parent = SENTINEL;
newNode.left = SENTINEL;
newNode.right = SENTINEL;
setNodeColor(newNode, 0 /* Black */);
T.root = newNode;
return T.root;
}
treeInsert(T, newNode);
recomputeMaxEndWalkToRoot(newNode.parent);
// repair tree
var x = newNode;
while (x !== T.root && getNodeColor(x.parent) === 1 /* Red */) {
if (x.parent === x.parent.parent.left) {
var y = x.parent.parent.right;
if (getNodeColor(y) === 1 /* Red */) {
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(y, 0 /* Black */);
setNodeColor(x.parent.parent, 1 /* Red */);
x = x.parent.parent;
}
else {
if (x === x.parent.right) {
x = x.parent;
leftRotate(T, x);
}
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(x.parent.parent, 1 /* Red */);
rightRotate(T, x.parent.parent);
}
}
else {
var y = x.parent.parent.left;
if (getNodeColor(y) === 1 /* Red */) {
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(y, 0 /* Black */);
setNodeColor(x.parent.parent, 1 /* Red */);
x = x.parent.parent;
}
else {
if (x === x.parent.left) {
x = x.parent;
rightRotate(T, x);
}
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(x.parent.parent, 1 /* Red */);
leftRotate(T, x.parent.parent);
}
}
}
setNodeColor(T.root, 0 /* Black */);
return newNode;
}
function treeInsert(T, z) {
var delta = 0;
var x = T.root;
var zAbsoluteStart = z.start;
var zAbsoluteEnd = z.end;
while (true) {
var cmp = intervalCompare(zAbsoluteStart, zAbsoluteEnd, x.start + delta, x.end + delta);
if (cmp < 0) {
// this node should be inserted to the left
// => it is not affected by the node's delta
if (x.left === SENTINEL) {
z.start -= delta;
z.end -= delta;
z.maxEnd -= delta;
x.left = z;
break;
}
else {
x = x.left;
}
}
else {
// this node should be inserted to the right
// => it is not affected by the node's delta
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 /* Red */);
}
//#endregion
//#region Deletion
function rbTreeDelete(T, z) {
var x;
var y;
// RB-DELETE except we don't swap z and y in case c)
// i.e. we always delete what's pointed at by z.
if (z.left === SENTINEL) {
x = z.right;
y = z;
// x's delta is no longer influenced by z's delta
x.delta += z.delta;
if (x.delta < -1073741824 /* MIN_SAFE_DELTA */ || x.delta > 1073741824 /* MAX_SAFE_DELTA */) {
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;
// y's delta is no longer influenced by z's delta,
// but we don't want to walk the entire right-hand-side subtree of x.
// we therefore maintain z's delta in y, and adjust only x
x.start += y.delta;
x.end += y.delta;
x.delta += y.delta;
if (x.delta < -1073741824 /* MIN_SAFE_DELTA */ || x.delta > 1073741824 /* MAX_SAFE_DELTA */) {
T.requestNormalizeDelta = true;
}
y.start += z.delta;
y.end += z.delta;
y.delta = z.delta;
if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {
T.requestNormalizeDelta = true;
}
}
if (y === T.root) {
T.root = x;
setNodeColor(x, 0 /* Black */);
z.detach();
resetSentinel();
recomputeMaxEnd(x);
T.root.parent = SENTINEL;
return;
}
var yWasRed = (getNodeColor(y) === 1 /* Red */);
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);
}
// RB-DELETE-FIXUP
var w;
while (x !== T.root && getNodeColor(x) === 0 /* Black */) {
if (x === x.parent.left) {
w = x.parent.right;
if (getNodeColor(w) === 1 /* Red */) {
setNodeColor(w, 0 /* Black */);
setNodeColor(x.parent, 1 /* Red */);
leftRotate(T, x.parent);
w = x.parent.right;
}
if (getNodeColor(w.left) === 0 /* Black */ && getNodeColor(w.right) === 0 /* Black */) {
setNodeColor(w, 1 /* Red */);
x = x.parent;
}
else {
if (getNodeColor(w.right) === 0 /* Black */) {
setNodeColor(w.left, 0 /* Black */);
setNodeColor(w, 1 /* Red */);
rightRotate(T, w);
w = x.parent.right;
}
setNodeColor(w, getNodeColor(x.parent));
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(w.right, 0 /* Black */);
leftRotate(T, x.parent);
x = T.root;
}
}
else {
w = x.parent.left;
if (getNodeColor(w) === 1 /* Red */) {
setNodeColor(w, 0 /* Black */);
setNodeColor(x.parent, 1 /* Red */);
rightRotate(T, x.parent);
w = x.parent.left;
}
if (getNodeColor(w.left) === 0 /* Black */ && getNodeColor(w.right) === 0 /* Black */) {
setNodeColor(w, 1 /* Red */);
x = x.parent;
}
else {
if (getNodeColor(w.left) === 0 /* Black */) {
setNodeColor(w.right, 0 /* Black */);
setNodeColor(w, 1 /* Red */);
leftRotate(T, w);
w = x.parent.left;
}
setNodeColor(w, getNodeColor(x.parent));
setNodeColor(x.parent, 0 /* Black */);
setNodeColor(w.left, 0 /* Black */);
rightRotate(T, x.parent);
x = T.root;
}
}
}
setNodeColor(x, 0 /* Black */);
resetSentinel();
}
function leftest(node) {
while (node.left !== SENTINEL) {
node = node.left;
}
return node;
}
function resetSentinel() {
SENTINEL.parent = SENTINEL;
SENTINEL.delta = 0; // optional
SENTINEL.start = 0; // optional
SENTINEL.end = 0; // optional
}
//#endregion
//#region Rotations
function leftRotate(T, x) {
var y = x.right; // set y.
y.delta += x.delta; // y's delta is no longer influenced by x's delta
if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {
T.requestNormalizeDelta = true;
}
y.start += x.delta;
y.end += x.delta;
x.right = y.left; // turn y's left subtree into x's right subtree.
if (y.left !== SENTINEL) {
y.left.parent = x;
}
y.parent = x.parent; // link x's parent to y.
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; // put x on y's left.
x.parent = y;
recomputeMaxEnd(x);
recomputeMaxEnd(y);
}
function rightRotate(T, y) {
var x = y.left;
y.delta -= x.delta;
if (y.delta < -1073741824 /* MIN_SAFE_DELTA */ || y.delta > 1073741824 /* MAX_SAFE_DELTA */) {
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);
}
//#endregion
//#region max end computation
function computeMaxEnd(node) {
var maxEnd = node.end;
if (node.left !== SENTINEL) {
var leftMaxEnd = node.left.maxEnd;
if (leftMaxEnd > maxEnd) {
maxEnd = leftMaxEnd;
}
}
if (node.right !== SENTINEL) {
var 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) {
var maxEnd = computeMaxEnd(node);
if (node.maxEnd === maxEnd) {
// no need to go further
return;
}
node.maxEnd = maxEnd;
node = node.parent;
}
}
//#endregion
//#region utils
function intervalCompare(aStart, aEnd, bStart, bEnd) {
if (aStart === bStart) {
return aEnd - bEnd;
}
return aStart - bStart;
}
//#endregion
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var TreeNode = /** @class */ (function () {
function TreeNode(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;
}
TreeNode.prototype.next = function () {
if (this.right !== rbTreeBase_SENTINEL) {
return rbTreeBase_leftest(this.right);
}
var node = this;
while (node.parent !== rbTreeBase_SENTINEL) {
if (node.parent.left === node) {
break;
}
node = node.parent;
}
if (node.parent === rbTreeBase_SENTINEL) {
return rbTreeBase_SENTINEL;
}
else {
return node.parent;
}
};
TreeNode.prototype.prev = function () {
if (this.left !== rbTreeBase_SENTINEL) {
return righttest(this.left);
}
var node = this;
while (node.parent !== rbTreeBase_SENTINEL) {
if (node.parent.right === node) {
break;
}
node = node.parent;
}
if (node.parent === rbTreeBase_SENTINEL) {
return rbTreeBase_SENTINEL;
}
else {
return node.parent;
}
};
TreeNode.prototype.detach = function () {
this.parent = null;
this.left = null;
this.right = null;
};
return TreeNode;
}());
var rbTreeBase_SENTINEL = new TreeNode(null, 0 /* Black */);
rbTreeBase_SENTINEL.parent = rbTreeBase_SENTINEL;
rbTreeBase_SENTINEL.left = rbTreeBase_SENTINEL;
rbTreeBase_SENTINEL.right = rbTreeBase_SENTINEL;
rbTreeBase_SENTINEL.color = 0 /* Black */;
function rbTreeBase_leftest(node) {
while (node.left !== rbTreeBase_SENTINEL) {
node = node.left;
}
return node;
}
function righttest(node) {
while (node.right !== rbTreeBase_SENTINEL) {
node = node.right;
}
return node;
}
function calculateSize(node) {
if (node === rbTreeBase_SENTINEL) {
return 0;
}
return node.size_left + node.piece.length + calculateSize(node.right);
}
function calculateLF(node) {
if (node === rbTreeBase_SENTINEL) {
return 0;
}
return node.lf_left + node.piece.lineFeedCnt + calculateLF(node.right);
}
function rbTreeBase_resetSentinel() {
rbTreeBase_SENTINEL.parent = rbTreeBase_SENTINEL;
}
function rbTreeBase_leftRotate(tree, x) {
var y = x.right;
// fix size_left
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 !== rbTreeBase_SENTINEL) {
y.left.parent = x;
}
y.parent = x.parent;
if (x.parent === rbTreeBase_SENTINEL) {
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 rbTreeBase_rightRotate(tree, y) {
var x = y.left;
y.left = x.right;
if (x.right !== rbTreeBase_SENTINEL) {
x.right.parent = y;
}
x.parent = y.parent;
// fix size_left
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 === rbTreeBase_SENTINEL) {
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) {
var x;
var y;
if (z.left === rbTreeBase_SENTINEL) {
y = z;
x = y.right;
}
else if (z.right === rbTreeBase_SENTINEL) {
y = z;
x = y.left;
}
else {
y = rbTreeBase_leftest(z.right);
x = y.right;
}
if (y === tree.root) {
tree.root = x;
// if x is null, we are removing the only node
x.color = 0 /* Black */;
z.detach();
rbTreeBase_resetSentinel();
tree.root.parent = rbTreeBase_SENTINEL;
return;
}
var yWasRed = (y.color === 1 /* Red */);
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;
}
// as we make changes to x's hierarchy, update size_left of subtree first
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 !== rbTreeBase_SENTINEL) {
y.left.parent = y;
}
if (y.right !== rbTreeBase_SENTINEL) {
y.right.parent = y;
}
// update metadata
// we replace z with y, so in this sub tree, the length change is z.item.length
y.size_left = z.size_left;
y.lf_left = z.lf_left;
recomputeTreeMetadata(tree, y);
}
z.detach();
if (x.parent.left === x) {
var newSizeLeft = calculateSize(x);
var newLFLeft = calculateLF(x);
if (newSizeLeft !== x.parent.size_left || newLFLeft !== x.parent.lf_left) {
var delta = newSizeLeft - x.parent.size_left;
var 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) {
rbTreeBase_resetSentinel();
return;
}
// RB-DELETE-FIXUP
var w;
while (x !== tree.root && x.color === 0 /* Black */) {
if (x === x.parent.left) {
w = x.parent.right;
if (w.color === 1 /* Red */) {
w.color = 0 /* Black */;
x.parent.color = 1 /* Red */;
rbTreeBase_leftRotate(tree, x.parent);
w = x.parent.right;
}
if (w.left.color === 0 /* Black */ && w.right.color === 0 /* Black */) {
w.color = 1 /* Red */;
x = x.parent;
}
else {
if (w.right.color === 0 /* Black */) {
w.left.color = 0 /* Black */;
w.color = 1 /* Red */;
rbTreeBase_rightRotate(tree, w);
w = x.parent.right;
}
w.color = x.parent.color;
x.parent.color = 0 /* Black */;
w.right.color = 0 /* Black */;
rbTreeBase_leftRotate(tree, x.parent);
x = tree.root;
}
}
else {
w = x.parent.left;
if (w.color === 1 /* Red */) {
w.color = 0 /* Black */;
x.parent.color = 1 /* Red */;
rbTreeBase_rightRotate(tree, x.parent);
w = x.parent.left;
}
if (w.left.color === 0 /* Black */ && w.right.color === 0 /* Black */) {
w.color = 1 /* Red */;
x = x.parent;
}
else {
if (w.left.color === 0 /* Black */) {
w.right.color = 0 /* Black */;
w.color = 1 /* Red */;
rbTreeBase_leftRotate(tree, w);
w = x.parent.left;
}
w.color = x.parent.color;
x.parent.color = 0 /* Black */;
w.left.color = 0 /* Black */;
rbTreeBase_rightRotate(tree, x.parent);
x = tree.root;
}
}
}
x.color = 0 /* Black */;
rbTreeBase_resetSentinel();
}
function fixInsert(tree, x) {
recomputeTreeMetadata(tree, x);
while (x !== tree.root && x.parent.color === 1 /* Red */) {
if (x.parent === x.parent.parent.left) {
var y = x.parent.parent.right;
if (y.color === 1 /* Red */) {
x.parent.color = 0 /* Black */;
y.color = 0 /* Black */;
x.parent.parent.color = 1 /* Red */;
x = x.parent.parent;
}
else {
if (x === x.parent.right) {
x = x.parent;
rbTreeBase_leftRotate(tree, x);
}
x.parent.color = 0 /* Black */;
x.parent.parent.color = 1 /* Red */;
rbTreeBase_rightRotate(tree, x.parent.parent);
}
}
else {
var y = x.parent.parent.left;
if (y.color === 1 /* Red */) {
x.parent.color = 0 /* Black */;
y.color = 0 /* Black */;
x.parent.parent.color = 1 /* Red */;
x = x.parent.parent;
}
else {
if (x === x.parent.left) {
x = x.parent;
rbTreeBase_rightRotate(tree, x);
}
x.parent.color = 0 /* Black */;
x.parent.parent.color = 1 /* Red */;
rbTreeBase_leftRotate(tree, x.parent.parent);
}
}
}
tree.root.color = 0 /* Black */;
}
function updateTreeMetadata(tree, x, delta, lineFeedCntDelta) {
// node length change or line feed count change
while (x !== tree.root && x !== rbTreeBase_SENTINEL) {
if (x.parent.left === x) {
x.parent.size_left += delta;
x.parent.lf_left += lineFeedCntDelta;
}
x = x.parent;
}
}
function recomputeTreeMetadata(tree, x) {
var delta = 0;
var lf_delta = 0;
if (x === tree.root) {
return;
}
if (delta === 0) {
// go upwards till the node whose left subtree is changed.
while (x !== tree.root && x === x.parent.right) {
x = x.parent;
}
if (x === tree.root) {
// well, it means we add a node to the end (inorder)
return;
}
// x is the node whose right subtree is changed.
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;
}
// go upwards till root. O(logN)
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;
}
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModelSearch.js
var textModelSearch = __webpack_require__(92);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// const lfRegex = new RegExp(/\r\n|\r|\n/g);
var AverageBufferSize = 65535;
function createUintArray(arr) {
var r;
if (arr[arr.length - 1] < 65536) {
r = new Uint16Array(arr.length);
}
else {
r = new Uint32Array(arr.length);
}
r.set(arr, 0);
return r;
}
var LineStarts = /** @class */ (function () {
function LineStarts(lineStarts, cr, lf, crlf, isBasicASCII) {
this.lineStarts = lineStarts;
this.cr = cr;
this.lf = lf;
this.crlf = crlf;
this.isBasicASCII = isBasicASCII;
}
return LineStarts;
}());
function createLineStartsFast(str, readonly) {
if (readonly === void 0) { readonly = true; }
var r = [0], rLength = 1;
for (var i = 0, len = str.length; i < len; i++) {
var chr = str.charCodeAt(i);
if (chr === 13 /* CarriageReturn */) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {
// \r\n... case
r[rLength++] = i + 2;
i++; // skip \n
}
else {
// \r... case
r[rLength++] = i + 1;
}
}
else if (chr === 10 /* LineFeed */) {
r[rLength++] = i + 1;
}
}
if (readonly) {
return createUintArray(r);
}
else {
return r;
}
}
function createLineStarts(r, str) {
r.length = 0;
r[0] = 0;
var rLength = 1;
var cr = 0, lf = 0, crlf = 0;
var isBasicASCII = true;
for (var i = 0, len = str.length; i < len; i++) {
var chr = str.charCodeAt(i);
if (chr === 13 /* CarriageReturn */) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {
// \r\n... case
crlf++;
r[rLength++] = i + 2;
i++; // skip \n
}
else {
cr++;
// \r... case
r[rLength++] = i + 1;
}
}
else if (chr === 10 /* LineFeed */) {
lf++;
r[rLength++] = i + 1;
}
else {
if (isBasicASCII) {
if (chr !== 9 /* Tab */ && (chr < 32 || chr > 126)) {
isBasicASCII = false;
}
}
}
}
var result = new LineStarts(createUintArray(r), cr, lf, crlf, isBasicASCII);
r.length = 0;
return result;
}
var Piece = /** @class */ (function () {
function Piece(bufferIndex, start, end, lineFeedCnt, length) {
this.bufferIndex = bufferIndex;
this.start = start;
this.end = end;
this.lineFeedCnt = lineFeedCnt;
this.length = length;
}
return Piece;
}());
var StringBuffer = /** @class */ (function () {
function StringBuffer(buffer, lineStarts) {
this.buffer = buffer;
this.lineStarts = lineStarts;
}
return StringBuffer;
}());
var PieceTreeSearchCache = /** @class */ (function () {
function PieceTreeSearchCache(limit) {
this._limit = limit;
this._cache = [];
}
PieceTreeSearchCache.prototype.get = function (offset) {
for (var i = this._cache.length - 1; i >= 0; i--) {
var nodePos = this._cache[i];
if (nodePos.nodeStartOffset <= offset && nodePos.nodeStartOffset + nodePos.node.piece.length >= offset) {
return nodePos;
}
}
return null;
};
PieceTreeSearchCache.prototype.get2 = function (lineNumber) {
for (var i = this._cache.length - 1; i >= 0; i--) {
var nodePos = this._cache[i];
if (nodePos.nodeStartLineNumber && nodePos.nodeStartLineNumber < lineNumber && nodePos.nodeStartLineNumber + nodePos.node.piece.lineFeedCnt >= lineNumber) {
return nodePos;
}
}
return null;
};
PieceTreeSearchCache.prototype.set = function (nodePosition) {
if (this._cache.length >= this._limit) {
this._cache.shift();
}
this._cache.push(nodePosition);
};
PieceTreeSearchCache.prototype.valdiate = function (offset) {
var hasInvalidVal = false;
var tmp = this._cache;
for (var i = 0; i < tmp.length; i++) {
var nodePos = tmp[i];
if (nodePos.node.parent === null || nodePos.nodeStartOffset >= offset) {
tmp[i] = null;
hasInvalidVal = true;
continue;
}
}
if (hasInvalidVal) {
var newArr = [];
for (var _i = 0, tmp_1 = tmp; _i < tmp_1.length; _i++) {
var entry = tmp_1[_i];
if (entry !== null) {
newArr.push(entry);
}
}
this._cache = newArr;
}
};
return PieceTreeSearchCache;
}());
var pieceTreeBase_PieceTreeBase = /** @class */ (function () {
function PieceTreeBase(chunks, eol, eolNormalized) {
this.create(chunks, eol, eolNormalized);
}
PieceTreeBase.prototype.create = function (chunks, eol, eolNormalized) {
this._buffers = [
new StringBuffer('', [0])
];
this._lastChangeBufferPos = { line: 0, column: 0 };
this.root = rbTreeBase_SENTINEL;
this._lineCnt = 1;
this._length = 0;
this._EOL = eol;
this._EOLLength = eol.length;
this._EOLNormalized = eolNormalized;
var lastNode = null;
for (var 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);
}
var 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();
};
PieceTreeBase.prototype.normalizeEOL = function (eol) {
var _this = this;
var averageBufferSize = AverageBufferSize;
var min = averageBufferSize - Math.floor(averageBufferSize / 3);
var max = min * 2;
var tempChunk = '';
var tempChunkLen = 0;
var chunks = [];
this.iterate(this.root, function (node) {
var str = _this.getNodeContent(node);
var len = str.length;
if (tempChunkLen <= min || tempChunkLen + len < max) {
tempChunk += str;
tempChunkLen += len;
return true;
}
// flush anyways
var text = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text, createLineStartsFast(text)));
tempChunk = str;
tempChunkLen = len;
return true;
});
if (tempChunkLen > 0) {
var text = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text, createLineStartsFast(text)));
}
this.create(chunks, eol, true);
};
// #region Buffer API
PieceTreeBase.prototype.getEOL = function () {
return this._EOL;
};
PieceTreeBase.prototype.setEOL = function (newEOL) {
this._EOL = newEOL;
this._EOLLength = this._EOL.length;
this.normalizeEOL(newEOL);
};
PieceTreeBase.prototype.getOffsetAt = function (lineNumber, column) {
var leftLen = 0; // inorder
var x = this.root;
while (x !== rbTreeBase_SENTINEL) {
if (x.left !== rbTreeBase_SENTINEL && x.lf_left + 1 >= lineNumber) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt + 1 >= lineNumber) {
leftLen += x.size_left;
// lineNumber >= 2
var 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;
};
PieceTreeBase.prototype.getPositionAt = function (offset) {
offset = Math.floor(offset);
offset = Math.max(0, offset);
var x = this.root;
var lfCnt = 0;
var originalOffset = offset;
while (x !== rbTreeBase_SENTINEL) {
if (x.size_left !== 0 && x.size_left >= offset) {
x = x.left;
}
else if (x.size_left + x.piece.length >= offset) {
var out = this.getIndexOf(x, offset - x.size_left);
lfCnt += x.lf_left + out.index;
if (out.index === 0) {
var lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
var column = originalOffset - lineStartOffset;
return new core_position["a" /* Position */](lfCnt + 1, column + 1);
}
return new core_position["a" /* Position */](lfCnt + 1, out.remainder + 1);
}
else {
offset -= x.size_left + x.piece.length;
lfCnt += x.lf_left + x.piece.lineFeedCnt;
if (x.right === rbTreeBase_SENTINEL) {
// last node
var lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
var column = originalOffset - offset - lineStartOffset;
return new core_position["a" /* Position */](lfCnt + 1, column + 1);
}
else {
x = x.right;
}
}
}
return new core_position["a" /* Position */](1, 1);
};
PieceTreeBase.prototype.getValueInRange = function (range, eol) {
if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {
return '';
}
var startPosition = this.nodeAt2(range.startLineNumber, range.startColumn);
var endPosition = this.nodeAt2(range.endLineNumber, range.endColumn);
var 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;
};
PieceTreeBase.prototype.getValueInRange2 = function (startPosition, endPosition) {
if (startPosition.node === endPosition.node) {
var node = startPosition.node;
var buffer_1 = this._buffers[node.piece.bufferIndex].buffer;
var startOffset_1 = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
return buffer_1.substring(startOffset_1 + startPosition.remainder, startOffset_1 + endPosition.remainder);
}
var x = startPosition.node;
var buffer = this._buffers[x.piece.bufferIndex].buffer;
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
var ret = buffer.substring(startOffset + startPosition.remainder, startOffset + x.piece.length);
x = x.next();
while (x !== rbTreeBase_SENTINEL) {
var buffer_2 = this._buffers[x.piece.bufferIndex].buffer;
var startOffset_2 = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (x === endPosition.node) {
ret += buffer_2.substring(startOffset_2, startOffset_2 + endPosition.remainder);
break;
}
else {
ret += buffer_2.substr(startOffset_2, x.piece.length);
}
x = x.next();
}
return ret;
};
PieceTreeBase.prototype.getLinesContent = function () {
var _this = this;
var lines = [];
var linesLength = 0;
var currentLine = '';
var danglingCR = false;
this.iterate(this.root, function (node) {
if (node === rbTreeBase_SENTINEL) {
return true;
}
var piece = node.piece;
var pieceLength = piece.length;
if (pieceLength === 0) {
return true;
}
var buffer = _this._buffers[piece.bufferIndex].buffer;
var lineStarts = _this._buffers[piece.bufferIndex].lineStarts;
var pieceStartLine = piece.start.line;
var pieceEndLine = piece.end.line;
var pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;
if (danglingCR) {
if (buffer.charCodeAt(pieceStartOffset) === 10 /* LineFeed */) {
// pretend the \n was in the previous piece..
pieceStartOffset++;
pieceLength--;
}
lines[linesLength++] = currentLine;
currentLine = '';
danglingCR = false;
if (pieceLength === 0) {
return true;
}
}
if (pieceStartLine === pieceEndLine) {
// this piece has no new lines
if (!_this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === 13 /* CarriageReturn */) {
danglingCR = true;
currentLine += buffer.substr(pieceStartOffset, pieceLength - 1);
}
else {
currentLine += buffer.substr(pieceStartOffset, pieceLength);
}
return true;
}
// add the text before the first line start in this piece
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 (var 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 /* CarriageReturn */) {
danglingCR = true;
if (piece.end.column === 0) {
// The last line ended with a \r, let's undo the push, it will be pushed by next iteration
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;
};
PieceTreeBase.prototype.getLength = function () {
return this._length;
};
PieceTreeBase.prototype.getLineCount = function () {
return this._lineCnt;
};
PieceTreeBase.prototype.getLineContent = function (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;
};
PieceTreeBase.prototype.getLineCharCode = function (lineNumber, index) {
var nodePos = this.nodeAt2(lineNumber, index + 1);
if (nodePos.remainder === nodePos.node.piece.length) {
// the char we want to fetch is at the head of next node.
var matchingNode = nodePos.node.next();
if (!matchingNode) {
return 0;
}
var buffer = this._buffers[matchingNode.piece.bufferIndex];
var startOffset = this.offsetInBuffer(matchingNode.piece.bufferIndex, matchingNode.piece.start);
return buffer.buffer.charCodeAt(startOffset);
}
else {
var buffer = this._buffers[nodePos.node.piece.bufferIndex];
var startOffset = this.offsetInBuffer(nodePos.node.piece.bufferIndex, nodePos.node.piece.start);
var targetOffset = startOffset + nodePos.remainder;
return buffer.buffer.charCodeAt(targetOffset);
}
};
PieceTreeBase.prototype.getLineLength = function (lineNumber) {
if (lineNumber === this.getLineCount()) {
var startOffset = this.getOffsetAt(lineNumber, 1);
return this.getLength() - startOffset;
}
return this.getOffsetAt(lineNumber + 1, 1) - this.getOffsetAt(lineNumber, 1) - this._EOLLength;
};
PieceTreeBase.prototype.findMatchesInNode = function (node, searcher, startLineNumber, startColumn, startCursor, endCursor, searchData, captureMatches, limitResultCount, resultLen, result) {
var buffer = this._buffers[node.piece.bufferIndex];
var startOffsetInBuffer = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
var start = this.offsetInBuffer(node.piece.bufferIndex, startCursor);
var end = this.offsetInBuffer(node.piece.bufferIndex, endCursor);
var m;
// Reset regex to search from the beginning
var ret = { line: 0, column: 0 };
var searchText;
var offsetInBuffer;
if (searcher._wordSeparators) {
searchText = buffer.buffer.substring(start, end);
offsetInBuffer = function (offset) { return offset + start; };
searcher.reset(-1);
}
else {
searchText = buffer.buffer;
offsetInBuffer = function (offset) { return 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);
var lineFeedCnt = this.getLineFeedCnt(node.piece.bufferIndex, startCursor, ret);
var retStartColumn = ret.line === startCursor.line ? ret.column - startCursor.column + startColumn : ret.column + 1;
var retEndColumn = retStartColumn + m[0].length;
result[resultLen++] = Object(textModelSearch["d" /* createFindMatch */])(new core_range["a" /* 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;
};
PieceTreeBase.prototype.findMatchesLineByLine = function (searchRange, searchData, captureMatches, limitResultCount) {
var result = [];
var resultLen = 0;
var searcher = new textModelSearch["b" /* Searcher */](searchData.wordSeparators, searchData.regex);
var startPosition = this.nodeAt2(searchRange.startLineNumber, searchRange.startColumn);
if (startPosition === null) {
return [];
}
var endPosition = this.nodeAt2(searchRange.endLineNumber, searchRange.endColumn);
if (endPosition === null) {
return [];
}
var start = this.positionInBuffer(startPosition.node, startPosition.remainder);
var 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;
}
var startLineNumber = searchRange.startLineNumber;
var currentNode = startPosition.node;
while (currentNode !== endPosition.node) {
var lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);
if (lineBreakCnt >= 1) {
// last line break position
var lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;
var startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);
var nextLineStartOffset = lineStarts[start.line + lineBreakCnt];
var startColumn_1 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn_1, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);
if (resultLen >= limitResultCount) {
return result;
}
startLineNumber += lineBreakCnt;
}
var startColumn_2 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
// search for the remaining content
if (startLineNumber === searchRange.endLineNumber) {
var text = this.getLineContent(startLineNumber).substring(startColumn_2, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn_2, resultLen, result, captureMatches, limitResultCount);
return result;
}
resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn_2), startLineNumber, startColumn_2, 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) {
var startColumn_3 = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
var text = this.getLineContent(startLineNumber).substring(startColumn_3, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn_3, resultLen, result, captureMatches, limitResultCount);
return result;
}
var startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(endPosition.node, searcher, startLineNumber, startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);
return result;
};
PieceTreeBase.prototype._findMatchesInLine = function (searchData, searcher, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {
var wordSeparators = searchData.wordSeparators;
if (!captureMatches && searchData.simpleSearch) {
var searchString = searchData.simpleSearch;
var searchStringLen = searchString.length;
var textLength = text.length;
var lastMatchIndex = -searchStringLen;
while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {
if (!wordSeparators || Object(textModelSearch["e" /* isValidMatch */])(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {
result[resultLen++] = new model["b" /* FindMatch */](new core_range["a" /* Range */](lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
}
return resultLen;
}
var m;
// Reset regex to search from the beginning
searcher.reset(0);
do {
m = searcher.next(text);
if (m) {
result[resultLen++] = Object(textModelSearch["d" /* createFindMatch */])(new core_range["a" /* 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
PieceTreeBase.prototype.insert = function (offset, value, eolNormalized) {
if (eolNormalized === void 0) { eolNormalized = false; }
this._EOLNormalized = this._EOLNormalized && eolNormalized;
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = '';
if (this.root !== rbTreeBase_SENTINEL) {
var _a = this.nodeAt(offset), node = _a.node, remainder = _a.remainder, nodeStartOffset = _a.nodeStartOffset;
var piece = node.piece;
var bufferIndex = piece.bufferIndex;
var 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) {
// changed buffer
this.appendToNode(node, value);
this.computeBufferMetadata();
return;
}
if (nodeStartOffset === offset) {
this.insertContentToNodeLeft(value, node);
this._searchCache.valdiate(offset);
}
else if (nodeStartOffset + node.piece.length > offset) {
// we are inserting into the middle of a node.
var nodesToDel = [];
var 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)) {
var headOfRight = this.nodeCharCodeAt(node, remainder);
if (headOfRight === 10 /** \n */) {
var 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';
}
}
// reuse node for content before insertion point.
if (this.shouldCheckCRLF() && this.startWithLF(value)) {
var tailOfLeft = this.nodeCharCodeAt(node, remainder - 1);
if (tailOfLeft === 13 /** \r */) {
var 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);
}
var newPieces = this.createNewPieces(value);
if (newRightPiece.length > 0) {
this.rbInsertRight(node, newRightPiece);
}
var tmpNode = node;
for (var k = 0; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.deleteNodes(nodesToDel);
}
else {
this.insertContentToNodeRight(value, node);
}
}
else {
// insert new node
var pieces = this.createNewPieces(value);
var node = this.rbInsertLeft(null, pieces[0]);
for (var k = 1; k < pieces.length; k++) {
node = this.rbInsertRight(node, pieces[k]);
}
}
// todo, this is too brutal. Total line feed count should be updated the same way as lf_left.
this.computeBufferMetadata();
};
PieceTreeBase.prototype.delete = function (offset, cnt) {
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = '';
if (cnt <= 0 || this.root === rbTreeBase_SENTINEL) {
return;
}
var startPosition = this.nodeAt(offset);
var endPosition = this.nodeAt(offset + cnt);
var startNode = startPosition.node;
var endNode = endPosition.node;
if (startNode === endNode) {
var startSplitPosInBuffer_1 = this.positionInBuffer(startNode, startPosition.remainder);
var endSplitPosInBuffer_1 = this.positionInBuffer(startNode, endPosition.remainder);
if (startPosition.nodeStartOffset === offset) {
if (cnt === startNode.piece.length) { // delete node
var next = startNode.next();
rbDelete(this, startNode);
this.validateCRLFWithPrevNode(next);
this.computeBufferMetadata();
return;
}
this.deleteNodeHead(startNode, endSplitPosInBuffer_1);
this._searchCache.valdiate(offset);
this.validateCRLFWithPrevNode(startNode);
this.computeBufferMetadata();
return;
}
if (startPosition.nodeStartOffset + startNode.piece.length === offset + cnt) {
this.deleteNodeTail(startNode, startSplitPosInBuffer_1);
this.validateCRLFWithNextNode(startNode);
this.computeBufferMetadata();
return;
}
// delete content in the middle, this node will be splitted to nodes
this.shrinkNode(startNode, startSplitPosInBuffer_1, endSplitPosInBuffer_1);
this.computeBufferMetadata();
return;
}
var nodesToDel = [];
var startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);
this.deleteNodeTail(startNode, startSplitPosInBuffer);
this._searchCache.valdiate(offset);
if (startNode.piece.length === 0) {
nodesToDel.push(startNode);
}
// update last touched node
var endSplitPosInBuffer = this.positionInBuffer(endNode, endPosition.remainder);
this.deleteNodeHead(endNode, endSplitPosInBuffer);
if (endNode.piece.length === 0) {
nodesToDel.push(endNode);
}
// delete nodes in between
var secondNode = startNode.next();
for (var node = secondNode; node !== rbTreeBase_SENTINEL && node !== endNode; node = node.next()) {
nodesToDel.push(node);
}
var prev = startNode.piece.length === 0 ? startNode.prev() : startNode;
this.deleteNodes(nodesToDel);
this.validateCRLFWithNextNode(prev);
this.computeBufferMetadata();
};
PieceTreeBase.prototype.insertContentToNodeLeft = function (value, node) {
// we are inserting content to the beginning of node
var nodesToDel = [];
if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) {
// move `\n` to new node.
var piece = node.piece;
var newStart = { line: piece.start.line + 1, column: 0 };
var 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);
}
}
var newPieces = this.createNewPieces(value);
var newNode = this.rbInsertLeft(node, newPieces[newPieces.length - 1]);
for (var k = newPieces.length - 2; k >= 0; k--) {
newNode = this.rbInsertLeft(newNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
this.deleteNodes(nodesToDel);
};
PieceTreeBase.prototype.insertContentToNodeRight = function (value, node) {
// we are inserting to the right of this node.
if (this.adjustCarriageReturnFromNext(value, node)) {
// move \n to the new node.
value += '\n';
}
var newPieces = this.createNewPieces(value);
var newNode = this.rbInsertRight(node, newPieces[0]);
var tmpNode = newNode;
for (var k = 1; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
};
PieceTreeBase.prototype.positionInBuffer = function (node, remainder, ret) {
var piece = node.piece;
var bufferIndex = node.piece.bufferIndex;
var lineStarts = this._buffers[bufferIndex].lineStarts;
var startOffset = lineStarts[piece.start.line] + piece.start.column;
var offset = startOffset + remainder;
// binary search offset between startOffset and endOffset
var low = piece.start.line;
var high = piece.end.line;
var mid = 0;
var midStop = 0;
var 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
};
};
PieceTreeBase.prototype.getLineFeedCnt = function (bufferIndex, start, end) {
// we don't need to worry about start: abc\r|\n, or abc|\r, or abc|\n, or abc|\r\n doesn't change the fact that, there is one line break after start.
// now let's take care of end: abc\r|\n, if end is in between \r and \n, we need to add line feed count by 1
if (end.column === 0) {
return end.line - start.line;
}
var lineStarts = this._buffers[bufferIndex].lineStarts;
if (end.line === lineStarts.length - 1) { // it means, there is no \n after end, otherwise, there will be one more lineStart.
return end.line - start.line;
}
var nextLineStartOffset = lineStarts[end.line + 1];
var endOffset = lineStarts[end.line] + end.column;
if (nextLineStartOffset > endOffset + 1) { // there are more than 1 character after end, which means it can't be \n
return end.line - start.line;
}
// endOffset + 1 === nextLineStartOffset
// character at endOffset is \n, so we check the character before first
// if character at endOffset is \r, end.column is 0 and we can't get here.
var previousCharOffset = endOffset - 1; // end.column > 0 so it's okay.
var buffer = this._buffers[bufferIndex].buffer;
if (buffer.charCodeAt(previousCharOffset) === 13) {
return end.line - start.line + 1;
}
else {
return end.line - start.line;
}
};
PieceTreeBase.prototype.offsetInBuffer = function (bufferIndex, cursor) {
var lineStarts = this._buffers[bufferIndex].lineStarts;
return lineStarts[cursor.line] + cursor.column;
};
PieceTreeBase.prototype.deleteNodes = function (nodes) {
for (var i = 0; i < nodes.length; i++) {
rbDelete(this, nodes[i]);
}
};
PieceTreeBase.prototype.createNewPieces = function (text) {
if (text.length > AverageBufferSize) {
// the content is large, operations like substring, charCode becomes slow
// so here we split it into smaller chunks, just like what we did for CR/LF normalization
var newPieces = [];
while (text.length > AverageBufferSize) {
var lastChar = text.charCodeAt(AverageBufferSize - 1);
var splitText = void 0;
if (lastChar === 13 /* CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {
// last character is \r or a high surrogate => keep it back
splitText = text.substring(0, AverageBufferSize - 1);
text = text.substring(AverageBufferSize - 1);
}
else {
splitText = text.substring(0, AverageBufferSize);
text = text.substring(AverageBufferSize);
}
var lineStarts_1 = createLineStartsFast(splitText);
newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts_1.length - 1, column: splitText.length - lineStarts_1[lineStarts_1.length - 1] }, lineStarts_1.length - 1, splitText.length));
this._buffers.push(new StringBuffer(splitText, lineStarts_1));
}
var lineStarts_2 = createLineStartsFast(text);
newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts_2.length - 1, column: text.length - lineStarts_2[lineStarts_2.length - 1] }, lineStarts_2.length - 1, text.length));
this._buffers.push(new StringBuffer(text, lineStarts_2));
return newPieces;
}
var startOffset = this._buffers[0].buffer.length;
var lineStarts = createLineStartsFast(text, false);
var start = this._lastChangeBufferPos;
if (this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 1] === startOffset
&& startOffset !== 0
&& this.startWithLF(text)
&& this.endWithCR(this._buffers[0].buffer) // todo, we can check this._lastChangeBufferPos's column as it's the last one
) {
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line, column: this._lastChangeBufferPos.column + 1 };
start = this._lastChangeBufferPos;
for (var 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 += '_' + text;
startOffset += 1;
}
else {
if (startOffset !== 0) {
for (var 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 += text;
}
var endOffset = this._buffers[0].buffer.length;
var endIndex = this._buffers[0].lineStarts.length - 1;
var endColumn = endOffset - this._buffers[0].lineStarts[endIndex];
var endPos = { line: endIndex, column: endColumn };
var newPiece = new Piece(0, /** todo@peng */ start, endPos, this.getLineFeedCnt(0, start, endPos), endOffset - startOffset);
this._lastChangeBufferPos = endPos;
return [newPiece];
};
PieceTreeBase.prototype.getLineRawContent = function (lineNumber, endOffset) {
if (endOffset === void 0) { endOffset = 0; }
var x = this.root;
var ret = '';
var cache = this._searchCache.get2(lineNumber);
if (cache) {
x = cache.node;
var prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);
var buffer = this._buffers[x.piece.bufferIndex].buffer;
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {
ret = buffer.substring(startOffset + prevAccumualtedValue, startOffset + x.piece.length);
}
else {
var accumualtedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);
return buffer.substring(startOffset + prevAccumualtedValue, startOffset + accumualtedValue - endOffset);
}
}
else {
var nodeStartOffset = 0;
var originalLineNumber = lineNumber;
while (x !== rbTreeBase_SENTINEL) {
if (x.left !== rbTreeBase_SENTINEL && x.lf_left >= lineNumber - 1) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
var prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
var accumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
var buffer = this._buffers[x.piece.bufferIndex].buffer;
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
nodeStartOffset += x.size_left;
this._searchCache.set({
node: x,
nodeStartOffset: nodeStartOffset,
nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)
});
return buffer.substring(startOffset + prevAccumualtedValue, startOffset + accumualtedValue - endOffset);
}
else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
var prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
var buffer = this._buffers[x.piece.bufferIndex].buffer;
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret = buffer.substring(startOffset + prevAccumualtedValue, startOffset + x.piece.length);
break;
}
else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
}
// search in order, to find the node contains end column
x = x.next();
while (x !== rbTreeBase_SENTINEL) {
var buffer = this._buffers[x.piece.bufferIndex].buffer;
if (x.piece.lineFeedCnt > 0) {
var accumualtedValue = this.getAccumulatedValue(x, 0);
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substring(startOffset, startOffset + accumualtedValue - endOffset);
return ret;
}
else {
var startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substr(startOffset, x.piece.length);
}
x = x.next();
}
return ret;
};
PieceTreeBase.prototype.computeBufferMetadata = function () {
var x = this.root;
var lfCnt = 1;
var len = 0;
while (x !== rbTreeBase_SENTINEL) {
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.valdiate(this._length);
};
// #region node operations
PieceTreeBase.prototype.getIndexOf = function (node, accumulatedValue) {
var piece = node.piece;
var pos = this.positionInBuffer(node, accumulatedValue);
var lineCnt = pos.line - piece.start.line;
if (this.offsetInBuffer(piece.bufferIndex, piece.end) - this.offsetInBuffer(piece.bufferIndex, piece.start) === accumulatedValue) {
// we are checking the end of this node, so a CRLF check is necessary.
var realLineCnt = this.getLineFeedCnt(node.piece.bufferIndex, piece.start, pos);
if (realLineCnt !== lineCnt) {
// aha yes, CRLF
return { index: realLineCnt, remainder: 0 };
}
}
return { index: lineCnt, remainder: pos.column };
};
PieceTreeBase.prototype.getAccumulatedValue = function (node, index) {
if (index < 0) {
return 0;
}
var piece = node.piece;
var lineStarts = this._buffers[piece.bufferIndex].lineStarts;
var 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;
}
};
PieceTreeBase.prototype.deleteNodeTail = function (node, pos) {
var piece = node.piece;
var originalLFCnt = piece.lineFeedCnt;
var originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
var newEnd = pos;
var newEndOffset = this.offsetInBuffer(piece.bufferIndex, newEnd);
var newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
var lf_delta = newLineFeedCnt - originalLFCnt;
var size_delta = newEndOffset - originalEndOffset;
var newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
};
PieceTreeBase.prototype.deleteNodeHead = function (node, pos) {
var piece = node.piece;
var originalLFCnt = piece.lineFeedCnt;
var originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
var newStart = pos;
var newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);
var newStartOffset = this.offsetInBuffer(piece.bufferIndex, newStart);
var lf_delta = newLineFeedCnt - originalLFCnt;
var size_delta = originalStartOffset - newStartOffset;
var newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
};
PieceTreeBase.prototype.shrinkNode = function (node, start, end) {
var piece = node.piece;
var originalStartPos = piece.start;
var originalEndPos = piece.end;
// old piece, originalStartPos, start
var oldLength = piece.length;
var oldLFCnt = piece.lineFeedCnt;
var newEnd = start;
var newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
var 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);
// new right piece, end, originalEndPos
var newPiece = new Piece(piece.bufferIndex, end, originalEndPos, this.getLineFeedCnt(piece.bufferIndex, end, originalEndPos), this.offsetInBuffer(piece.bufferIndex, originalEndPos) - this.offsetInBuffer(piece.bufferIndex, end));
var newNode = this.rbInsertRight(node, newPiece);
this.validateCRLFWithPrevNode(newNode);
};
PieceTreeBase.prototype.appendToNode = function (node, value) {
if (this.adjustCarriageReturnFromNext(value, node)) {
value += '\n';
}
var hitCRLF = this.shouldCheckCRLF() && this.startWithLF(value) && this.endWithCR(node);
var startOffset = this._buffers[0].buffer.length;
this._buffers[0].buffer += value;
var lineStarts = createLineStartsFast(value, false);
for (var i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset;
}
if (hitCRLF) {
var prevStartOffset = this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 2];
this._buffers[0].lineStarts.pop();
// _lastChangeBufferPos is already wrong
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line - 1, column: startOffset - prevStartOffset };
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
var endIndex = this._buffers[0].lineStarts.length - 1;
var endColumn = this._buffers[0].buffer.length - this._buffers[0].lineStarts[endIndex];
var newEnd = { line: endIndex, column: endColumn };
var newLength = node.piece.length + value.length;
var oldLineFeedCnt = node.piece.lineFeedCnt;
var newLineFeedCnt = this.getLineFeedCnt(0, node.piece.start, newEnd);
var 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);
};
PieceTreeBase.prototype.nodeAt = function (offset) {
var x = this.root;
var cache = this._searchCache.get(offset);
if (cache) {
return {
node: cache.node,
nodeStartOffset: cache.nodeStartOffset,
remainder: offset - cache.nodeStartOffset
};
}
var nodeStartOffset = 0;
while (x !== rbTreeBase_SENTINEL) {
if (x.size_left > offset) {
x = x.left;
}
else if (x.size_left + x.piece.length >= offset) {
nodeStartOffset += x.size_left;
var ret = {
node: x,
remainder: offset - x.size_left,
nodeStartOffset: 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;
};
PieceTreeBase.prototype.nodeAt2 = function (lineNumber, column) {
var x = this.root;
var nodeStartOffset = 0;
while (x !== rbTreeBase_SENTINEL) {
if (x.left !== rbTreeBase_SENTINEL && x.lf_left >= lineNumber - 1) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
var prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
var accumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
nodeStartOffset += x.size_left;
return {
node: x,
remainder: Math.min(prevAccumualtedValue + column - 1, accumualtedValue),
nodeStartOffset: nodeStartOffset
};
}
else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
var prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
if (prevAccumualtedValue + column - 1 <= x.piece.length) {
return {
node: x,
remainder: prevAccumualtedValue + column - 1,
nodeStartOffset: 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;
}
}
// search in order, to find the node contains position.column
x = x.next();
while (x !== rbTreeBase_SENTINEL) {
if (x.piece.lineFeedCnt > 0) {
var accumualtedValue = this.getAccumulatedValue(x, 0);
var nodeStartOffset_1 = this.offsetOfNode(x);
return {
node: x,
remainder: Math.min(column - 1, accumualtedValue),
nodeStartOffset: nodeStartOffset_1
};
}
else {
if (x.piece.length >= column - 1) {
var nodeStartOffset_2 = this.offsetOfNode(x);
return {
node: x,
remainder: column - 1,
nodeStartOffset: nodeStartOffset_2
};
}
else {
column -= x.piece.length;
}
}
x = x.next();
}
return null;
};
PieceTreeBase.prototype.nodeCharCodeAt = function (node, offset) {
if (node.piece.lineFeedCnt < 1) {
return -1;
}
var buffer = this._buffers[node.piece.bufferIndex];
var newOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start) + offset;
return buffer.buffer.charCodeAt(newOffset);
};
PieceTreeBase.prototype.offsetOfNode = function (node) {
if (!node) {
return 0;
}
var 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
PieceTreeBase.prototype.shouldCheckCRLF = function () {
return !(this._EOLNormalized && this._EOL === '\n');
};
PieceTreeBase.prototype.startWithLF = function (val) {
if (typeof val === 'string') {
return val.charCodeAt(0) === 10;
}
if (val === rbTreeBase_SENTINEL || val.piece.lineFeedCnt === 0) {
return false;
}
var piece = val.piece;
var lineStarts = this._buffers[piece.bufferIndex].lineStarts;
var line = piece.start.line;
var startOffset = lineStarts[line] + piece.start.column;
if (line === lineStarts.length - 1) {
// last line, so there is no line feed at the end of this line
return false;
}
var nextLineOffset = lineStarts[line + 1];
if (nextLineOffset > startOffset + 1) {
return false;
}
return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10;
};
PieceTreeBase.prototype.endWithCR = function (val) {
if (typeof val === 'string') {
return val.charCodeAt(val.length - 1) === 13;
}
if (val === rbTreeBase_SENTINEL || val.piece.lineFeedCnt === 0) {
return false;
}
return this.nodeCharCodeAt(val, val.piece.length - 1) === 13;
};
PieceTreeBase.prototype.validateCRLFWithPrevNode = function (nextNode) {
if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) {
var node = nextNode.prev();
if (this.endWithCR(node)) {
this.fixCRLF(node, nextNode);
}
}
};
PieceTreeBase.prototype.validateCRLFWithNextNode = function (node) {
if (this.shouldCheckCRLF() && this.endWithCR(node)) {
var nextNode = node.next();
if (this.startWithLF(nextNode)) {
this.fixCRLF(node, nextNode);
}
}
};
PieceTreeBase.prototype.fixCRLF = function (prev, next) {
var nodesToDel = [];
// update node
var lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;
var newEnd;
if (prev.piece.end.column === 0) {
// it means, last line ends with \r, not \r\n
newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };
}
else {
// \r\n
newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };
}
var prevNewLength = prev.piece.length - 1;
var 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);
}
// update nextNode
var newStart = { line: next.piece.start.line + 1, column: 0 };
var newLength = next.piece.length - 1;
var 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);
}
// create new piece which contains \r\n
var pieces = this.createNewPieces('\r\n');
this.rbInsertRight(prev, pieces[0]);
// delete empty nodes
for (var i = 0; i < nodesToDel.length; i++) {
rbDelete(this, nodesToDel[i]);
}
};
PieceTreeBase.prototype.adjustCarriageReturnFromNext = function (value, node) {
if (this.shouldCheckCRLF() && this.endWithCR(value)) {
var nextNode = node.next();
if (this.startWithLF(nextNode)) {
// move `\n` forward
value += '\n';
if (nextNode.piece.length === 1) {
rbDelete(this, nextNode);
}
else {
var piece = nextNode.piece;
var newStart = { line: piece.start.line + 1, column: 0 };
var newLength = piece.length - 1;
var 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
PieceTreeBase.prototype.iterate = function (node, callback) {
if (node === rbTreeBase_SENTINEL) {
return callback(rbTreeBase_SENTINEL);
}
var leftRet = this.iterate(node.left, callback);
if (!leftRet) {
return leftRet;
}
return callback(node) && this.iterate(node.right, callback);
};
PieceTreeBase.prototype.getNodeContent = function (node) {
if (node === rbTreeBase_SENTINEL) {
return '';
}
var buffer = this._buffers[node.piece.bufferIndex];
var currentContent;
var piece = node.piece;
var startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
var endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
currentContent = buffer.buffer.substring(startOffset, endOffset);
return currentContent;
};
/**
* node node
* / \ / \
* a b <---- a b
* /
* z
*/
PieceTreeBase.prototype.rbInsertRight = function (node, p) {
var z = new TreeNode(p, 1 /* Red */);
z.left = rbTreeBase_SENTINEL;
z.right = rbTreeBase_SENTINEL;
z.parent = rbTreeBase_SENTINEL;
z.size_left = 0;
z.lf_left = 0;
var x = this.root;
if (x === rbTreeBase_SENTINEL) {
this.root = z;
z.color = 0 /* Black */;
}
else if (node.right === rbTreeBase_SENTINEL) {
node.right = z;
z.parent = node;
}
else {
var nextNode = rbTreeBase_leftest(node.right);
nextNode.left = z;
z.parent = nextNode;
}
fixInsert(this, z);
return z;
};
/**
* node node
* / \ / \
* a b ----> a b
* \
* z
*/
PieceTreeBase.prototype.rbInsertLeft = function (node, p) {
var z = new TreeNode(p, 1 /* Red */);
z.left = rbTreeBase_SENTINEL;
z.right = rbTreeBase_SENTINEL;
z.parent = rbTreeBase_SENTINEL;
z.size_left = 0;
z.lf_left = 0;
if (this.root === rbTreeBase_SENTINEL) {
this.root = z;
z.color = 0 /* Black */;
}
else if (node.left === rbTreeBase_SENTINEL) {
node.left = z;
z.parent = node;
}
else {
var prevNode = righttest(node.left); // a
prevNode.right = z;
z.parent = prevNode;
}
fixInsert(this, z);
return z;
};
return PieceTreeBase;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var pieceTreeTextBuffer_PieceTreeTextBuffer = /** @class */ (function () {
function PieceTreeTextBuffer(chunks, BOM, eol, containsRTL, isBasicASCII, eolNormalized) {
this._BOM = BOM;
this._mightContainNonBasicASCII = !isBasicASCII;
this._mightContainRTL = containsRTL;
this._pieceTree = new pieceTreeBase_PieceTreeBase(chunks, eol, eolNormalized);
}
PieceTreeTextBuffer.prototype.mightContainRTL = function () {
return this._mightContainRTL;
};
PieceTreeTextBuffer.prototype.mightContainNonBasicASCII = function () {
return this._mightContainNonBasicASCII;
};
PieceTreeTextBuffer.prototype.getBOM = function () {
return this._BOM;
};
PieceTreeTextBuffer.prototype.getEOL = function () {
return this._pieceTree.getEOL();
};
PieceTreeTextBuffer.prototype.getOffsetAt = function (lineNumber, column) {
return this._pieceTree.getOffsetAt(lineNumber, column);
};
PieceTreeTextBuffer.prototype.getPositionAt = function (offset) {
return this._pieceTree.getPositionAt(offset);
};
PieceTreeTextBuffer.prototype.getRangeAt = function (start, length) {
var end = start + length;
var startPosition = this.getPositionAt(start);
var endPosition = this.getPositionAt(end);
return new core_range["a" /* Range */](startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
};
PieceTreeTextBuffer.prototype.getValueInRange = function (range, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
if (range.isEmpty()) {
return '';
}
var lineEnding = this._getEndOfLine(eol);
return this._pieceTree.getValueInRange(range, lineEnding);
};
PieceTreeTextBuffer.prototype.getValueLengthInRange = function (range, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
if (range.isEmpty()) {
return 0;
}
if (range.startLineNumber === range.endLineNumber) {
return (range.endColumn - range.startColumn);
}
var startOffset = this.getOffsetAt(range.startLineNumber, range.startColumn);
var endOffset = this.getOffsetAt(range.endLineNumber, range.endColumn);
return endOffset - startOffset;
};
PieceTreeTextBuffer.prototype.getCharacterCountInRange = function (range, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
if (this._mightContainNonBasicASCII) {
// we must count by iterating
var result = 0;
var fromLineNumber = range.startLineNumber;
var toLineNumber = range.endLineNumber;
for (var lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
var lineContent = this.getLineContent(lineNumber);
var fromOffset = (lineNumber === fromLineNumber ? range.startColumn - 1 : 0);
var toOffset = (lineNumber === toLineNumber ? range.endColumn - 1 : lineContent.length);
for (var offset = fromOffset; offset < toOffset; offset++) {
if (strings["z" /* 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(range, eol);
};
PieceTreeTextBuffer.prototype.getLength = function () {
return this._pieceTree.getLength();
};
PieceTreeTextBuffer.prototype.getLineCount = function () {
return this._pieceTree.getLineCount();
};
PieceTreeTextBuffer.prototype.getLinesContent = function () {
return this._pieceTree.getLinesContent();
};
PieceTreeTextBuffer.prototype.getLineContent = function (lineNumber) {
return this._pieceTree.getLineContent(lineNumber);
};
PieceTreeTextBuffer.prototype.getLineCharCode = function (lineNumber, index) {
return this._pieceTree.getLineCharCode(lineNumber, index);
};
PieceTreeTextBuffer.prototype.getLineLength = function (lineNumber) {
return this._pieceTree.getLineLength(lineNumber);
};
PieceTreeTextBuffer.prototype.getLineFirstNonWhitespaceColumn = function (lineNumber) {
var result = strings["q" /* firstNonWhitespaceIndex */](this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
};
PieceTreeTextBuffer.prototype.getLineLastNonWhitespaceColumn = function (lineNumber) {
var result = strings["D" /* lastNonWhitespaceIndex */](this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
};
PieceTreeTextBuffer.prototype._getEndOfLine = function (eol) {
switch (eol) {
case 1 /* LF */:
return '\n';
case 2 /* CRLF */:
return '\r\n';
case 0 /* TextDefined */:
return this.getEOL();
}
throw new Error('Unknown EOL preference');
};
PieceTreeTextBuffer.prototype.setEOL = function (newEOL) {
this._pieceTree.setEOL(newEOL);
};
PieceTreeTextBuffer.prototype.applyEdits = function (rawOperations, recordTrimAutoWhitespace) {
var mightContainRTL = this._mightContainRTL;
var mightContainNonBasicASCII = this._mightContainNonBasicASCII;
var canReduceOperations = true;
var operations = [];
for (var i = 0; i < rawOperations.length; i++) {
var op = rawOperations[i];
if (canReduceOperations && op._isTracked) {
canReduceOperations = false;
}
var validatedRange = op.range;
if (!mightContainRTL && op.text) {
// check if the new inserted text contains RTL
mightContainRTL = strings["i" /* containsRTL */](op.text);
}
if (!mightContainNonBasicASCII && op.text) {
mightContainNonBasicASCII = !strings["v" /* isBasicASCII */](op.text);
}
operations[i] = {
sortIndex: i,
identifier: op.identifier || null,
range: validatedRange,
rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),
rangeLength: this.getValueLengthInRange(validatedRange),
lines: op.text ? op.text.split(/\r\n|\r|\n/) : null,
forceMoveMarkers: Boolean(op.forceMoveMarkers),
isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false
};
}
// Sort operations ascending
operations.sort(PieceTreeTextBuffer._sortOpsAscending);
var hasTouchingRanges = false;
for (var i = 0, count = operations.length - 1; i < count; i++) {
var rangeEnd = operations[i].range.getEndPosition();
var nextRangeStart = operations[i + 1].range.getStartPosition();
if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {
if (nextRangeStart.isBefore(rangeEnd)) {
// overlapping ranges
throw new Error('Overlapping ranges are not allowed!');
}
hasTouchingRanges = true;
}
}
if (canReduceOperations) {
operations = this._reduceOperations(operations);
}
// Delta encode operations
var reverseRanges = PieceTreeTextBuffer._getInverseEditRanges(operations);
var newTrimAutoWhitespaceCandidates = [];
for (var i = 0; i < operations.length; i++) {
var op = operations[i];
var reverseRange = reverseRanges[i];
if (recordTrimAutoWhitespace && op.isAutoWhitespaceEdit && op.range.isEmpty()) {
// Record already the future line numbers that might be auto whitespace removal candidates on next edit
for (var lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {
var currentLineContent = '';
if (lineNumber === reverseRange.startLineNumber) {
currentLineContent = this.getLineContent(op.range.startLineNumber);
if (strings["q" /* firstNonWhitespaceIndex */](currentLineContent) !== -1) {
continue;
}
}
newTrimAutoWhitespaceCandidates.push({ lineNumber: lineNumber, oldContent: currentLineContent });
}
}
}
var reverseOperations = [];
for (var i = 0; i < operations.length; i++) {
var op = operations[i];
var reverseRange = reverseRanges[i];
reverseOperations[i] = {
sortIndex: op.sortIndex,
identifier: op.identifier,
range: reverseRange,
text: this.getValueInRange(op.range),
forceMoveMarkers: op.forceMoveMarkers
};
}
// Can only sort reverse operations when the order is not significant
if (!hasTouchingRanges) {
reverseOperations.sort(function (a, b) { return a.sortIndex - b.sortIndex; });
}
this._mightContainRTL = mightContainRTL;
this._mightContainNonBasicASCII = mightContainNonBasicASCII;
var contentChanges = this._doApplyEdits(operations);
var trimAutoWhitespaceLineNumbers = null;
if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {
// sort line numbers auto whitespace removal candidates for next edit descending
newTrimAutoWhitespaceCandidates.sort(function (a, b) { return b.lineNumber - a.lineNumber; });
trimAutoWhitespaceLineNumbers = [];
for (var i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {
var lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;
if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {
// Do not have the same line number twice
continue;
}
var prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;
var lineContent = this.getLineContent(lineNumber);
if (lineContent.length === 0 || lineContent === prevContent || strings["q" /* firstNonWhitespaceIndex */](lineContent) !== -1) {
continue;
}
trimAutoWhitespaceLineNumbers.push(lineNumber);
}
}
return new model["a" /* ApplyEditsResult */](reverseOperations, contentChanges, trimAutoWhitespaceLineNumbers);
};
/**
* Transform operations such that they represent the same logic edit,
* but that they also do not cause OOM crashes.
*/
PieceTreeTextBuffer.prototype._reduceOperations = function (operations) {
if (operations.length < 1000) {
// We know from empirical testing that a thousand edits work fine regardless of their shape.
return operations;
}
// At one point, due to how events are emitted and how each operation is handled,
// some operations can trigger a high amount of temporary string allocations,
// that will immediately get edited again.
// e.g. a formatter inserting ridiculous ammounts of \n on a model with a single line
// Therefore, the strategy is to collapse all the operations into a huge single edit operation
return [this._toSingleEditOperation(operations)];
};
PieceTreeTextBuffer.prototype._toSingleEditOperation = function (operations) {
var forceMoveMarkers = false, firstEditRange = operations[0].range, lastEditRange = operations[operations.length - 1].range, entireEditRange = new core_range["a" /* Range */](firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn), lastEndLineNumber = firstEditRange.startLineNumber, lastEndColumn = firstEditRange.startColumn, result = [];
for (var i = 0, len = operations.length; i < len; i++) {
var operation = operations[i], range = operation.range;
forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;
// (1) -- Push old text
for (var lineNumber = lastEndLineNumber; lineNumber < range.startLineNumber; lineNumber++) {
if (lineNumber === lastEndLineNumber) {
result.push(this.getLineContent(lineNumber).substring(lastEndColumn - 1));
}
else {
result.push('\n');
result.push(this.getLineContent(lineNumber));
}
}
if (range.startLineNumber === lastEndLineNumber) {
result.push(this.getLineContent(range.startLineNumber).substring(lastEndColumn - 1, range.startColumn - 1));
}
else {
result.push('\n');
result.push(this.getLineContent(range.startLineNumber).substring(0, range.startColumn - 1));
}
// (2) -- Push new text
if (operation.lines) {
for (var j = 0, lenJ = operation.lines.length; j < lenJ; j++) {
if (j !== 0) {
result.push('\n');
}
result.push(operation.lines[j]);
}
}
lastEndLineNumber = operation.range.endLineNumber;
lastEndColumn = operation.range.endColumn;
}
return {
sortIndex: 0,
identifier: operations[0].identifier,
range: entireEditRange,
rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),
rangeLength: this.getValueLengthInRange(entireEditRange, 0 /* TextDefined */),
lines: result.join('').split('\n'),
forceMoveMarkers: forceMoveMarkers,
isAutoWhitespaceEdit: false
};
};
PieceTreeTextBuffer.prototype._doApplyEdits = function (operations) {
operations.sort(PieceTreeTextBuffer._sortOpsDescending);
var contentChanges = [];
// operations are from bottom to top
for (var i = 0; i < operations.length; i++) {
var op = operations[i];
var startLineNumber = op.range.startLineNumber;
var startColumn = op.range.startColumn;
var endLineNumber = op.range.endLineNumber;
var endColumn = op.range.endColumn;
if (startLineNumber === endLineNumber && startColumn === endColumn && (!op.lines || op.lines.length === 0)) {
// no-op
continue;
}
var deletingLinesCnt = endLineNumber - startLineNumber;
var insertingLinesCnt = (op.lines ? op.lines.length - 1 : 0);
var editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);
var text = (op.lines ? op.lines.join(this.getEOL()) : '');
if (text) {
// replacement
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
this._pieceTree.insert(op.rangeOffset, text, true);
}
else {
// deletion
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
}
if (editingLinesCnt < insertingLinesCnt) {
var newLinesContent = [];
for (var j = editingLinesCnt + 1; j <= insertingLinesCnt; j++) {
newLinesContent.push(op.lines[j]);
}
newLinesContent[newLinesContent.length - 1] = this.getLineContent(startLineNumber + insertingLinesCnt - 1);
}
var contentChangeRange = new core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn);
contentChanges.push({
range: contentChangeRange,
rangeLength: op.rangeLength,
text: text,
rangeOffset: op.rangeOffset,
forceMoveMarkers: op.forceMoveMarkers
});
}
return contentChanges;
};
PieceTreeTextBuffer.prototype.findMatchesLineByLine = function (searchRange, searchData, captureMatches, limitResultCount) {
return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
};
/**
* Assumes `operations` are validated and sorted ascending
*/
PieceTreeTextBuffer._getInverseEditRanges = function (operations) {
var result = [];
var prevOpEndLineNumber = 0;
var prevOpEndColumn = 0;
var prevOp = null;
for (var i = 0, len = operations.length; i < len; i++) {
var op = operations[i];
var startLineNumber = void 0;
var startColumn = void 0;
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;
}
var resultRange = void 0;
if (op.lines && op.lines.length > 0) {
// the operation inserts something
var lineCount = op.lines.length;
var firstLine = op.lines[0];
var lastLine = op.lines[lineCount - 1];
if (lineCount === 1) {
// single line insert
resultRange = new core_range["a" /* Range */](startLineNumber, startColumn, startLineNumber, startColumn + firstLine.length);
}
else {
// multi line insert
resultRange = new core_range["a" /* Range */](startLineNumber, startColumn, startLineNumber + lineCount - 1, lastLine.length + 1);
}
}
else {
// There is nothing to insert
resultRange = new core_range["a" /* Range */](startLineNumber, startColumn, startLineNumber, startColumn);
}
prevOpEndLineNumber = resultRange.endLineNumber;
prevOpEndColumn = resultRange.endColumn;
result.push(resultRange);
prevOp = op;
}
return result;
};
PieceTreeTextBuffer._sortOpsAscending = function (a, b) {
var r = core_range["a" /* Range */].compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return a.sortIndex - b.sortIndex;
}
return r;
};
PieceTreeTextBuffer._sortOpsDescending = function (a, b) {
var r = core_range["a" /* Range */].compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return b.sortIndex - a.sortIndex;
}
return -r;
};
return PieceTreeTextBuffer;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var pieceTreeTextBufferBuilder_PieceTreeTextBufferFactory = /** @class */ (function () {
function PieceTreeTextBufferFactory(_chunks, _bom, _cr, _lf, _crlf, _containsRTL, _isBasicASCII, _normalizeEOL) {
this._chunks = _chunks;
this._bom = _bom;
this._cr = _cr;
this._lf = _lf;
this._crlf = _crlf;
this._containsRTL = _containsRTL;
this._isBasicASCII = _isBasicASCII;
this._normalizeEOL = _normalizeEOL;
}
PieceTreeTextBufferFactory.prototype._getEOL = function (defaultEOL) {
var totalEOLCount = this._cr + this._lf + this._crlf;
var totalCRCount = this._cr + this._crlf;
if (totalEOLCount === 0) {
// This is an empty file or a file with precisely one line
return (defaultEOL === 1 /* LF */ ? '\n' : '\r\n');
}
if (totalCRCount > totalEOLCount / 2) {
// More than half of the file contains \r\n ending lines
return '\r\n';
}
// At least one line more ends in \n
return '\n';
};
PieceTreeTextBufferFactory.prototype.create = function (defaultEOL) {
var eol = this._getEOL(defaultEOL);
var chunks = this._chunks;
if (this._normalizeEOL &&
((eol === '\r\n' && (this._cr > 0 || this._lf > 0))
|| (eol === '\n' && (this._cr > 0 || this._crlf > 0)))) {
// Normalize pieces
for (var i = 0, len = chunks.length; i < len; i++) {
var str = chunks[i].buffer.replace(/\r\n|\r|\n/g, eol);
var newLineStart = createLineStartsFast(str);
chunks[i] = new StringBuffer(str, newLineStart);
}
}
return new pieceTreeTextBuffer_PieceTreeTextBuffer(chunks, this._bom, eol, this._containsRTL, this._isBasicASCII, this._normalizeEOL);
};
return PieceTreeTextBufferFactory;
}());
var pieceTreeTextBufferBuilder_PieceTreeTextBufferBuilder = /** @class */ (function () {
function PieceTreeTextBufferBuilder() {
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.isBasicASCII = true;
}
PieceTreeTextBufferBuilder.prototype.acceptChunk = function (chunk) {
if (chunk.length === 0) {
return;
}
if (this.chunks.length === 0) {
if (strings["P" /* startsWithUTF8BOM */](chunk)) {
this.BOM = strings["a" /* UTF8_BOM_CHARACTER */];
chunk = chunk.substr(1);
}
}
var lastChar = chunk.charCodeAt(chunk.length - 1);
if (lastChar === 13 /* CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {
// last character is \r or a high surrogate => keep it back
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;
}
};
PieceTreeTextBufferBuilder.prototype._acceptChunk1 = function (chunk, allowEmptyStrings) {
if (!allowEmptyStrings && chunk.length === 0) {
// Nothing to do
return;
}
if (this._hasPreviousChar) {
this._acceptChunk2(String.fromCharCode(this._previousChar) + chunk);
}
else {
this._acceptChunk2(chunk);
}
};
PieceTreeTextBufferBuilder.prototype._acceptChunk2 = function (chunk) {
var 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 (this.isBasicASCII) {
this.isBasicASCII = lineStarts.isBasicASCII;
}
if (!this.isBasicASCII && !this.containsRTL) {
// No need to check if is basic ASCII
this.containsRTL = strings["i" /* containsRTL */](chunk);
}
};
PieceTreeTextBufferBuilder.prototype.finish = function (normalizeEOL) {
if (normalizeEOL === void 0) { normalizeEOL = true; }
this._finish();
return new pieceTreeTextBufferBuilder_PieceTreeTextBufferFactory(this.chunks, this.BOM, this.cr, this.lf, this.crlf, this.containsRTL, this.isBasicASCII, normalizeEOL);
};
PieceTreeTextBufferBuilder.prototype._finish = function () {
if (this.chunks.length === 0) {
this._acceptChunk1('', true);
}
if (this._hasPreviousChar) {
this._hasPreviousChar = false;
// recreate last chunk
var lastChunk = this.chunks[this.chunks.length - 1];
lastChunk.buffer += String.fromCharCode(this._previousChar);
var newLineStarts = createLineStartsFast(lastChunk.buffer);
lastChunk.lineStarts = newLineStarts;
if (this._previousChar === 13 /* CarriageReturn */) {
this.cr++;
}
}
};
return PieceTreeTextBufferBuilder;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModelEvents.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* An event describing that a model has been reset to a new value.
* @internal
*/
var ModelRawFlush = /** @class */ (function () {
function ModelRawFlush() {
this.changeType = 1 /* Flush */;
}
return ModelRawFlush;
}());
/**
* An event describing that a line has changed in a model.
* @internal
*/
var ModelRawLineChanged = /** @class */ (function () {
function ModelRawLineChanged(lineNumber, detail) {
this.changeType = 2 /* LineChanged */;
this.lineNumber = lineNumber;
this.detail = detail;
}
return ModelRawLineChanged;
}());
/**
* An event describing that line(s) have been deleted in a model.
* @internal
*/
var ModelRawLinesDeleted = /** @class */ (function () {
function ModelRawLinesDeleted(fromLineNumber, toLineNumber) {
this.changeType = 3 /* LinesDeleted */;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
return ModelRawLinesDeleted;
}());
/**
* An event describing that line(s) have been inserted in a model.
* @internal
*/
var ModelRawLinesInserted = /** @class */ (function () {
function ModelRawLinesInserted(fromLineNumber, toLineNumber, detail) {
this.changeType = 4 /* LinesInserted */;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
this.detail = detail;
}
return ModelRawLinesInserted;
}());
/**
* An event describing that a model has had its EOL changed.
* @internal
*/
var ModelRawEOLChanged = /** @class */ (function () {
function ModelRawEOLChanged() {
this.changeType = 5 /* EOLChanged */;
}
return ModelRawEOLChanged;
}());
/**
* An event describing a change in the text of a model.
* @internal
*/
var ModelRawContentChangedEvent = /** @class */ (function () {
function ModelRawContentChangedEvent(changes, versionId, isUndoing, isRedoing) {
this.changes = changes;
this.versionId = versionId;
this.isUndoing = isUndoing;
this.isRedoing = isRedoing;
}
ModelRawContentChangedEvent.prototype.containsEvent = function (type) {
for (var i = 0, len = this.changes.length; i < len; i++) {
var change = this.changes[i];
if (change.changeType === type) {
return true;
}
}
return false;
};
ModelRawContentChangedEvent.merge = function (a, b) {
var changes = [].concat(a.changes).concat(b.changes);
var versionId = b.versionId;
var isUndoing = (a.isUndoing || b.isUndoing);
var isRedoing = (a.isRedoing || b.isRedoing);
return new ModelRawContentChangedEvent(changes, versionId, isUndoing, isRedoing);
};
return ModelRawContentChangedEvent;
}());
/**
* @internal
*/
var InternalModelContentChangeEvent = /** @class */ (function () {
function InternalModelContentChangeEvent(rawContentChangedEvent, contentChangedEvent) {
this.rawContentChangedEvent = rawContentChangedEvent;
this.contentChangedEvent = contentChangedEvent;
}
InternalModelContentChangeEvent.prototype.merge = function (other) {
var rawContentChangedEvent = ModelRawContentChangedEvent.merge(this.rawContentChangedEvent, other.rawContentChangedEvent);
var contentChangedEvent = InternalModelContentChangeEvent._mergeChangeEvents(this.contentChangedEvent, other.contentChangedEvent);
return new InternalModelContentChangeEvent(rawContentChangedEvent, contentChangedEvent);
};
InternalModelContentChangeEvent._mergeChangeEvents = function (a, b) {
var changes = [].concat(a.changes).concat(b.changes);
var eol = b.eol;
var versionId = b.versionId;
var isUndoing = (a.isUndoing || b.isUndoing);
var isRedoing = (a.isRedoing || b.isRedoing);
var isFlush = (a.isFlush || b.isFlush);
return {
changes: changes,
eol: eol,
versionId: versionId,
isUndoing: isUndoing,
isRedoing: isRedoing,
isFlush: isFlush
};
};
return InternalModelContentChangeEvent;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/lineTokens.js
var core_lineTokens = __webpack_require__(94);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes.js + 3 modules
var modes = __webpack_require__(14);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/nullMode.js
var nullMode = __webpack_require__(73);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/stopwatch.js
var stopwatch = __webpack_require__(180);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/tokensStore.js
var tokensStore = __webpack_require__(124);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModelTokens.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var textModelTokens_TokenizationStateStore = /** @class */ (function () {
function TokenizationStateStore() {
this._beginState = [];
this._valid = [];
this._len = 0;
this._invalidLineStartIndex = 0;
}
TokenizationStateStore.prototype._reset = function (initialState) {
this._beginState = [];
this._valid = [];
this._len = 0;
this._invalidLineStartIndex = 0;
if (initialState) {
this._setBeginState(0, initialState);
}
};
TokenizationStateStore.prototype.flush = function (initialState) {
this._reset(initialState);
};
Object.defineProperty(TokenizationStateStore.prototype, "invalidLineStartIndex", {
get: function () {
return this._invalidLineStartIndex;
},
enumerable: true,
configurable: true
});
TokenizationStateStore.prototype._invalidateLine = function (lineIndex) {
if (lineIndex < this._len) {
this._valid[lineIndex] = false;
}
if (lineIndex < this._invalidLineStartIndex) {
this._invalidLineStartIndex = lineIndex;
}
};
TokenizationStateStore.prototype._isValid = function (lineIndex) {
if (lineIndex < this._len) {
return this._valid[lineIndex];
}
return false;
};
TokenizationStateStore.prototype.getBeginState = function (lineIndex) {
if (lineIndex < this._len) {
return this._beginState[lineIndex];
}
return null;
};
TokenizationStateStore.prototype._ensureLine = function (lineIndex) {
while (lineIndex >= this._len) {
this._beginState[this._len] = null;
this._valid[this._len] = false;
this._len++;
}
};
TokenizationStateStore.prototype._deleteLines = function (start, deleteCount) {
if (deleteCount === 0) {
return;
}
if (start + deleteCount > this._len) {
deleteCount = this._len - start;
}
this._beginState.splice(start, deleteCount);
this._valid.splice(start, deleteCount);
this._len -= deleteCount;
};
TokenizationStateStore.prototype._insertLines = function (insertIndex, insertCount) {
if (insertCount === 0) {
return;
}
var beginState = [];
var valid = [];
for (var i = 0; i < insertCount; i++) {
beginState[i] = null;
valid[i] = false;
}
this._beginState = arrays["a" /* arrayInsert */](this._beginState, insertIndex, beginState);
this._valid = arrays["a" /* arrayInsert */](this._valid, insertIndex, valid);
this._len += insertCount;
};
TokenizationStateStore.prototype._setValid = function (lineIndex, valid) {
this._ensureLine(lineIndex);
this._valid[lineIndex] = valid;
};
TokenizationStateStore.prototype._setBeginState = function (lineIndex, beginState) {
this._ensureLine(lineIndex);
this._beginState[lineIndex] = beginState;
};
TokenizationStateStore.prototype.setEndState = function (linesLength, lineIndex, endState) {
this._setValid(lineIndex, true);
this._invalidLineStartIndex = lineIndex + 1;
// Check if this was the last line
if (lineIndex === linesLength - 1) {
return;
}
// Check if the end state has changed
var previousEndState = this.getBeginState(lineIndex + 1);
if (previousEndState === null || !endState.equals(previousEndState)) {
this._setBeginState(lineIndex + 1, endState);
this._invalidateLine(lineIndex + 1);
return;
}
// Perhaps we can skip tokenizing some lines...
var i = lineIndex + 1;
while (i < linesLength) {
if (!this._isValid(i)) {
break;
}
i++;
}
this._invalidLineStartIndex = i;
};
TokenizationStateStore.prototype.setFakeTokens = function (lineIndex) {
this._setValid(lineIndex, false);
};
//#region Editing
TokenizationStateStore.prototype.applyEdits = function (range, eolCount) {
var deletingLinesCnt = range.endLineNumber - range.startLineNumber;
var insertingLinesCnt = eolCount;
var editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);
for (var j = editingLinesCnt; j >= 0; j--) {
this._invalidateLine(range.startLineNumber + j - 1);
}
this._acceptDeleteRange(range);
this._acceptInsertText(new core_position["a" /* Position */](range.startLineNumber, range.startColumn), eolCount);
};
TokenizationStateStore.prototype._acceptDeleteRange = function (range) {
var firstLineIndex = range.startLineNumber - 1;
if (firstLineIndex >= this._len) {
return;
}
this._deleteLines(range.startLineNumber, range.endLineNumber - range.startLineNumber);
};
TokenizationStateStore.prototype._acceptInsertText = function (position, eolCount) {
var lineIndex = position.lineNumber - 1;
if (lineIndex >= this._len) {
return;
}
this._insertLines(position.lineNumber, eolCount);
};
return TokenizationStateStore;
}());
var textModelTokens_TextModelTokenization = /** @class */ (function (_super) {
__extends(TextModelTokenization, _super);
function TextModelTokenization(textModel) {
var _this = _super.call(this) || this;
_this._isDisposed = false;
_this._textModel = textModel;
_this._tokenizationStateStore = new textModelTokens_TokenizationStateStore();
_this._tokenizationSupport = null;
_this._register(modes["B" /* TokenizationRegistry */].onDidChange(function (e) {
var languageIdentifier = _this._textModel.getLanguageIdentifier();
if (e.changedLanguages.indexOf(languageIdentifier.language) === -1) {
return;
}
_this._resetTokenizationState();
_this._textModel.clearTokens();
}));
_this._register(_this._textModel.onDidChangeRawContentFast(function (e) {
if (e.containsEvent(1 /* Flush */)) {
_this._resetTokenizationState();
return;
}
}));
_this._register(_this._textModel.onDidChangeContentFast(function (e) {
for (var i = 0, len = e.changes.length; i < len; i++) {
var change = e.changes[i];
var eolCount = Object(tokensStore["f" /* countEOL */])(change.text)[0];
_this._tokenizationStateStore.applyEdits(change.range, eolCount);
}
_this._beginBackgroundTokenization();
}));
_this._register(_this._textModel.onDidChangeAttached(function () {
_this._beginBackgroundTokenization();
}));
_this._register(_this._textModel.onDidChangeLanguage(function () {
_this._resetTokenizationState();
_this._textModel.clearTokens();
}));
_this._resetTokenizationState();
return _this;
}
TextModelTokenization.prototype.dispose = function () {
this._isDisposed = true;
_super.prototype.dispose.call(this);
};
TextModelTokenization.prototype._resetTokenizationState = function () {
var _a = initializeTokenization(this._textModel), tokenizationSupport = _a[0], initialState = _a[1];
this._tokenizationSupport = tokenizationSupport;
this._tokenizationStateStore.flush(initialState);
this._beginBackgroundTokenization();
};
TextModelTokenization.prototype._beginBackgroundTokenization = function () {
var _this = this;
if (this._textModel.isAttachedToEditor() && this._hasLinesToTokenize()) {
platform["i" /* setImmediate */](function () {
if (_this._isDisposed) {
// disposed in the meantime
return;
}
_this._revalidateTokensNow();
});
}
};
TextModelTokenization.prototype._revalidateTokensNow = function (toLineNumber) {
if (toLineNumber === void 0) { toLineNumber = this._textModel.getLineCount(); }
var MAX_ALLOWED_TIME = 1;
var builder = new tokensStore["b" /* MultilineTokensBuilder */]();
var sw = stopwatch["a" /* StopWatch */].create(false);
while (this._hasLinesToTokenize()) {
if (sw.elapsed() > MAX_ALLOWED_TIME) {
// Stop if MAX_ALLOWED_TIME is reached
break;
}
var tokenizedLineNumber = this._tokenizeOneInvalidLine(builder);
if (tokenizedLineNumber >= toLineNumber) {
break;
}
}
this._beginBackgroundTokenization();
this._textModel.setTokens(builder.tokens);
};
TextModelTokenization.prototype.tokenizeViewport = function (startLineNumber, endLineNumber) {
var builder = new tokensStore["b" /* MultilineTokensBuilder */]();
this._tokenizeViewport(builder, startLineNumber, endLineNumber);
this._textModel.setTokens(builder.tokens);
};
TextModelTokenization.prototype.reset = function () {
this._resetTokenizationState();
this._textModel.clearTokens();
};
TextModelTokenization.prototype.forceTokenization = function (lineNumber) {
var builder = new tokensStore["b" /* MultilineTokensBuilder */]();
this._updateTokensUntilLine(builder, lineNumber);
this._textModel.setTokens(builder.tokens);
};
TextModelTokenization.prototype.isCheapToTokenize = function (lineNumber) {
if (!this._tokenizationSupport) {
return true;
}
var firstInvalidLineNumber = this._tokenizationStateStore.invalidLineStartIndex + 1;
if (lineNumber > firstInvalidLineNumber) {
return false;
}
if (lineNumber < firstInvalidLineNumber) {
return true;
}
if (this._textModel.getLineLength(lineNumber) < 2048 /* CHEAP_TOKENIZATION_LENGTH_LIMIT */) {
return true;
}
return false;
};
TextModelTokenization.prototype._hasLinesToTokenize = function () {
if (!this._tokenizationSupport) {
return false;
}
return (this._tokenizationStateStore.invalidLineStartIndex < this._textModel.getLineCount());
};
TextModelTokenization.prototype._tokenizeOneInvalidLine = function (builder) {
if (!this._hasLinesToTokenize()) {
return this._textModel.getLineCount() + 1;
}
var lineNumber = this._tokenizationStateStore.invalidLineStartIndex + 1;
this._updateTokensUntilLine(builder, lineNumber);
return lineNumber;
};
TextModelTokenization.prototype._updateTokensUntilLine = function (builder, lineNumber) {
if (!this._tokenizationSupport) {
return;
}
var languageIdentifier = this._textModel.getLanguageIdentifier();
var linesLength = this._textModel.getLineCount();
var endLineIndex = lineNumber - 1;
// Validate all states up to and including endLineIndex
for (var lineIndex = this._tokenizationStateStore.invalidLineStartIndex; lineIndex <= endLineIndex; lineIndex++) {
var text = this._textModel.getLineContent(lineIndex + 1);
var lineStartState = this._tokenizationStateStore.getBeginState(lineIndex);
var r = safeTokenize(languageIdentifier, this._tokenizationSupport, text, lineStartState);
builder.add(lineIndex + 1, r.tokens);
this._tokenizationStateStore.setEndState(linesLength, lineIndex, r.endState);
lineIndex = this._tokenizationStateStore.invalidLineStartIndex - 1; // -1 because the outer loop increments it
}
};
TextModelTokenization.prototype._tokenizeViewport = function (builder, startLineNumber, endLineNumber) {
if (!this._tokenizationSupport) {
// nothing to do
return;
}
if (endLineNumber <= this._tokenizationStateStore.invalidLineStartIndex) {
// nothing to do
return;
}
if (startLineNumber <= this._tokenizationStateStore.invalidLineStartIndex) {
// tokenization has reached the viewport start...
this._updateTokensUntilLine(builder, endLineNumber);
return;
}
var nonWhitespaceColumn = this._textModel.getLineFirstNonWhitespaceColumn(startLineNumber);
var fakeLines = [];
var initialState = null;
for (var i = startLineNumber - 1; nonWhitespaceColumn > 0 && i >= 1; i--) {
var newNonWhitespaceIndex = this._textModel.getLineFirstNonWhitespaceColumn(i);
if (newNonWhitespaceIndex === 0) {
continue;
}
if (newNonWhitespaceIndex < nonWhitespaceColumn) {
initialState = this._tokenizationStateStore.getBeginState(i - 1);
if (initialState) {
break;
}
fakeLines.push(this._textModel.getLineContent(i));
nonWhitespaceColumn = newNonWhitespaceIndex;
}
}
if (!initialState) {
initialState = this._tokenizationSupport.getInitialState();
}
var languageIdentifier = this._textModel.getLanguageIdentifier();
var state = initialState;
for (var i = fakeLines.length - 1; i >= 0; i--) {
var r = safeTokenize(languageIdentifier, this._tokenizationSupport, fakeLines[i], state);
state = r.endState;
}
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var text = this._textModel.getLineContent(lineNumber);
var r = safeTokenize(languageIdentifier, this._tokenizationSupport, text, state);
builder.add(lineNumber, r.tokens);
this._tokenizationStateStore.setFakeTokens(lineNumber - 1);
state = r.endState;
}
};
return TextModelTokenization;
}(lifecycle["a" /* Disposable */]));
function initializeTokenization(textModel) {
var languageIdentifier = textModel.getLanguageIdentifier();
var tokenizationSupport = (textModel.isTooLargeForTokenization()
? null
: modes["B" /* TokenizationRegistry */].get(languageIdentifier.language));
var initialState = null;
if (tokenizationSupport) {
try {
initialState = tokenizationSupport.getInitialState();
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
tokenizationSupport = null;
}
}
return [tokenizationSupport, initialState];
}
function safeTokenize(languageIdentifier, tokenizationSupport, text, state) {
var r = null;
if (tokenizationSupport) {
try {
r = tokenizationSupport.tokenize2(text, state.clone(), 0);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
}
if (!r) {
r = Object(nullMode["e" /* nullTokenize2 */])(languageIdentifier.id, text, state, 0);
}
core_lineTokens["a" /* LineTokens */].convertToEndOffset(r.tokens, text.length);
return r;
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/wordHelper.js
var wordHelper = __webpack_require__(123);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfigurationRegistry.js + 4 modules
var languageConfigurationRegistry = __webpack_require__(33);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports.js
var supports = __webpack_require__(96);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/richEditBrackets.js
var richEditBrackets = __webpack_require__(99);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/color.js
var common_color = __webpack_require__(15);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var textModel_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
function createTextBufferBuilder() {
return new pieceTreeTextBufferBuilder_PieceTreeTextBufferBuilder();
}
function createTextBufferFactory(text) {
var builder = createTextBufferBuilder();
builder.acceptChunk(text);
return builder.finish();
}
function createTextBuffer(value, defaultEOL) {
var factory = (typeof value === 'string' ? createTextBufferFactory(value) : value);
return factory.create(defaultEOL);
}
var MODEL_ID = 0;
var LIMIT_FIND_COUNT = 999;
var LONG_LINE_BOUNDARY = 10000;
var invalidFunc = function () { throw new Error("Invalid change accessor"); };
var textModel_TextModel = /** @class */ (function (_super) {
textModel_extends(TextModel, _super);
//#endregion
function TextModel(source, creationOptions, languageIdentifier, associatedResource) {
if (associatedResource === void 0) { associatedResource = null; }
var _this = _super.call(this) || this;
//#region Events
_this._onWillDispose = _this._register(new common_event["a" /* Emitter */]());
_this.onWillDispose = _this._onWillDispose.event;
_this._onDidChangeDecorations = _this._register(new textModel_DidChangeDecorationsEmitter());
_this.onDidChangeDecorations = _this._onDidChangeDecorations.event;
_this._onDidChangeLanguage = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeLanguage = _this._onDidChangeLanguage.event;
_this._onDidChangeLanguageConfiguration = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeLanguageConfiguration = _this._onDidChangeLanguageConfiguration.event;
_this._onDidChangeTokens = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeTokens = _this._onDidChangeTokens.event;
_this._onDidChangeOptions = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeOptions = _this._onDidChangeOptions.event;
_this._onDidChangeAttached = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeAttached = _this._onDidChangeAttached.event;
_this._eventEmitter = _this._register(new textModel_DidChangeContentEmitter());
// Generate a new unique model id
MODEL_ID++;
_this.id = '$model' + MODEL_ID;
_this.isForSimpleWidget = creationOptions.isForSimpleWidget;
if (typeof associatedResource === 'undefined' || associatedResource === null) {
_this._associatedResource = uri["a" /* URI */].parse('inmemory://model/' + MODEL_ID);
}
else {
_this._associatedResource = associatedResource;
}
_this._attachedEditorCount = 0;
_this._buffer = createTextBuffer(source, creationOptions.defaultEOL);
_this._options = TextModel.resolveOptions(_this._buffer, creationOptions);
var bufferLineCount = _this._buffer.getLineCount();
var bufferTextLength = _this._buffer.getValueLengthInRange(new core_range["a" /* Range */](1, 1, bufferLineCount, _this._buffer.getLineLength(bufferLineCount) + 1), 0 /* TextDefined */);
// !!! Make a decision in the ctor and permanently respect this decision !!!
// If a model is too large at construction time, it will never get tokenized,
// under no circumstances.
if (creationOptions.largeFileOptimizations) {
_this._isTooLargeForTokenization = ((bufferTextLength > TextModel.LARGE_FILE_SIZE_THRESHOLD)
|| (bufferLineCount > TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD));
}
else {
_this._isTooLargeForTokenization = false;
}
_this._isTooLargeForSyncing = (bufferTextLength > TextModel.MODEL_SYNC_LIMIT);
_this._versionId = 1;
_this._alternativeVersionId = 1;
_this._isDisposed = false;
_this._isDisposing = false;
_this._languageIdentifier = languageIdentifier || nullMode["a" /* NULL_LANGUAGE_IDENTIFIER */];
_this._languageRegistryListener = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].onDidChange(function (e) {
if (e.languageIdentifier.id === _this._languageIdentifier.id) {
_this._onDidChangeLanguageConfiguration.fire({});
}
});
_this._instanceId = strings["M" /* singleLetterHash */](MODEL_ID);
_this._lastDecorationId = 0;
_this._decorations = Object.create(null);
_this._decorationsTree = new textModel_DecorationsTrees();
_this._commandManager = new editStack_EditStack(_this);
_this._isUndoing = false;
_this._isRedoing = false;
_this._trimAutoWhitespaceLines = null;
_this._tokens = new tokensStore["d" /* TokensStore */]();
_this._tokens2 = new tokensStore["e" /* TokensStore2 */]();
_this._tokenization = new textModelTokens_TextModelTokenization(_this);
return _this;
}
TextModel.createFromString = function (text, options, languageIdentifier, uri) {
if (options === void 0) { options = TextModel.DEFAULT_CREATION_OPTIONS; }
if (languageIdentifier === void 0) { languageIdentifier = null; }
if (uri === void 0) { uri = null; }
return new TextModel(text, options, languageIdentifier, uri);
};
TextModel.resolveOptions = function (textBuffer, options) {
if (options.detectIndentation) {
var guessedIndentation = guessIndentation(textBuffer, options.tabSize, options.insertSpaces);
return new model["e" /* TextModelResolvedOptions */]({
tabSize: guessedIndentation.tabSize,
indentSize: guessedIndentation.tabSize,
insertSpaces: guessedIndentation.insertSpaces,
trimAutoWhitespace: options.trimAutoWhitespace,
defaultEOL: options.defaultEOL
});
}
return new model["e" /* TextModelResolvedOptions */]({
tabSize: options.tabSize,
indentSize: options.indentSize,
insertSpaces: options.insertSpaces,
trimAutoWhitespace: options.trimAutoWhitespace,
defaultEOL: options.defaultEOL
});
};
TextModel.prototype.onDidChangeRawContentFast = function (listener) {
return this._eventEmitter.fastEvent(function (e) { return listener(e.rawContentChangedEvent); });
};
TextModel.prototype.onDidChangeRawContent = function (listener) {
return this._eventEmitter.slowEvent(function (e) { return listener(e.rawContentChangedEvent); });
};
TextModel.prototype.onDidChangeContentFast = function (listener) {
return this._eventEmitter.fastEvent(function (e) { return listener(e.contentChangedEvent); });
};
TextModel.prototype.onDidChangeContent = function (listener) {
return this._eventEmitter.slowEvent(function (e) { return listener(e.contentChangedEvent); });
};
TextModel.prototype.dispose = function () {
this._isDisposing = true;
this._onWillDispose.fire();
this._languageRegistryListener.dispose();
this._tokenization.dispose();
this._isDisposed = true;
_super.prototype.dispose.call(this);
this._isDisposing = false;
};
TextModel.prototype._assertNotDisposed = function () {
if (this._isDisposed) {
throw new Error('Model is disposed!');
}
};
TextModel.prototype._emitContentChangedEvent = function (rawChange, change) {
if (this._isDisposing) {
// Do not confuse listeners by emitting any event after disposing
return;
}
this._eventEmitter.fire(new InternalModelContentChangeEvent(rawChange, change));
};
TextModel.prototype.setValue = function (value) {
this._assertNotDisposed();
if (value === null) {
// There's nothing to do
return;
}
var textBuffer = createTextBuffer(value, this._options.defaultEOL);
this.setValueFromTextBuffer(textBuffer);
};
TextModel.prototype._createContentChanged2 = function (range, rangeOffset, rangeLength, text, isUndoing, isRedoing, isFlush) {
return {
changes: [{
range: range,
rangeOffset: rangeOffset,
rangeLength: rangeLength,
text: text,
}],
eol: this._buffer.getEOL(),
versionId: this.getVersionId(),
isUndoing: isUndoing,
isRedoing: isRedoing,
isFlush: isFlush
};
};
TextModel.prototype.setValueFromTextBuffer = function (textBuffer) {
this._assertNotDisposed();
if (textBuffer === null) {
// There's nothing to do
return;
}
var oldFullModelRange = this.getFullModelRange();
var oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);
var endLineNumber = this.getLineCount();
var endColumn = this.getLineMaxColumn(endLineNumber);
this._buffer = textBuffer;
this._increaseVersionId();
// Flush all tokens
this._tokens.flush();
this._tokens2.flush();
// Destroy all my decorations
this._decorations = Object.create(null);
this._decorationsTree = new textModel_DecorationsTrees();
// Destroy my edit history and settings
this._commandManager = new editStack_EditStack(this);
this._trimAutoWhitespaceLines = null;
this._emitContentChangedEvent(new ModelRawContentChangedEvent([
new ModelRawFlush()
], this._versionId, false, false), this._createContentChanged2(new core_range["a" /* Range */](1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, true));
};
TextModel.prototype.setEOL = function (eol) {
this._assertNotDisposed();
var newEOL = (eol === 1 /* CRLF */ ? '\r\n' : '\n');
if (this._buffer.getEOL() === newEOL) {
// Nothing to do
return;
}
var oldFullModelRange = this.getFullModelRange();
var oldModelValueLength = this.getValueLengthInRange(oldFullModelRange);
var endLineNumber = this.getLineCount();
var 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 core_range["a" /* Range */](1, 1, endLineNumber, endColumn), 0, oldModelValueLength, this.getValue(), false, false, false));
};
TextModel.prototype._onBeforeEOLChange = function () {
// Ensure all decorations get their `range` set.
var versionId = this.getVersionId();
var allDecorations = this._decorationsTree.search(0, false, false, versionId);
this._ensureNodesHaveRanges(allDecorations);
};
TextModel.prototype._onAfterEOLChange = function () {
// Transform back `range` to offsets
var versionId = this.getVersionId();
var allDecorations = this._decorationsTree.collectNodesPostOrder();
for (var i = 0, len = allDecorations.length; i < len; i++) {
var node = allDecorations[i];
var delta = node.cachedAbsoluteStart - node.start;
var startOffset = this._buffer.getOffsetAt(node.range.startLineNumber, node.range.startColumn);
var endOffset = this._buffer.getOffsetAt(node.range.endLineNumber, node.range.endColumn);
node.cachedAbsoluteStart = startOffset;
node.cachedAbsoluteEnd = endOffset;
node.cachedVersionId = versionId;
node.start = startOffset - delta;
node.end = endOffset - delta;
recomputeMaxEnd(node);
}
};
TextModel.prototype.onBeforeAttached = function () {
this._attachedEditorCount++;
if (this._attachedEditorCount === 1) {
this._onDidChangeAttached.fire(undefined);
}
};
TextModel.prototype.onBeforeDetached = function () {
this._attachedEditorCount--;
if (this._attachedEditorCount === 0) {
this._onDidChangeAttached.fire(undefined);
}
};
TextModel.prototype.isAttachedToEditor = function () {
return this._attachedEditorCount > 0;
};
TextModel.prototype.getAttachedEditorCount = function () {
return this._attachedEditorCount;
};
TextModel.prototype.isTooLargeForSyncing = function () {
return this._isTooLargeForSyncing;
};
TextModel.prototype.isTooLargeForTokenization = function () {
return this._isTooLargeForTokenization;
};
TextModel.prototype.isDisposed = function () {
return this._isDisposed;
};
TextModel.prototype.isDominatedByLongLines = function () {
this._assertNotDisposed();
if (this.isTooLargeForTokenization()) {
// Cannot word wrap huge files anyways, so it doesn't really matter
return false;
}
var smallLineCharCount = 0;
var longLineCharCount = 0;
var lineCount = this._buffer.getLineCount();
for (var lineNumber = 1; lineNumber <= lineCount; lineNumber++) {
var lineLength = this._buffer.getLineLength(lineNumber);
if (lineLength >= LONG_LINE_BOUNDARY) {
longLineCharCount += lineLength;
}
else {
smallLineCharCount += lineLength;
}
}
return (longLineCharCount > smallLineCharCount);
};
Object.defineProperty(TextModel.prototype, "uri", {
get: function () {
return this._associatedResource;
},
enumerable: true,
configurable: true
});
//#region Options
TextModel.prototype.getOptions = function () {
this._assertNotDisposed();
return this._options;
};
TextModel.prototype.getFormattingOptions = function () {
return {
tabSize: this._options.indentSize,
insertSpaces: this._options.insertSpaces
};
};
TextModel.prototype.updateOptions = function (_newOpts) {
this._assertNotDisposed();
var tabSize = (typeof _newOpts.tabSize !== 'undefined') ? _newOpts.tabSize : this._options.tabSize;
var indentSize = (typeof _newOpts.indentSize !== 'undefined') ? _newOpts.indentSize : this._options.indentSize;
var insertSpaces = (typeof _newOpts.insertSpaces !== 'undefined') ? _newOpts.insertSpaces : this._options.insertSpaces;
var trimAutoWhitespace = (typeof _newOpts.trimAutoWhitespace !== 'undefined') ? _newOpts.trimAutoWhitespace : this._options.trimAutoWhitespace;
var newOpts = new model["e" /* TextModelResolvedOptions */]({
tabSize: tabSize,
indentSize: indentSize,
insertSpaces: insertSpaces,
defaultEOL: this._options.defaultEOL,
trimAutoWhitespace: trimAutoWhitespace
});
if (this._options.equals(newOpts)) {
return;
}
var e = this._options.createChangeEvent(newOpts);
this._options = newOpts;
this._onDidChangeOptions.fire(e);
};
TextModel.prototype.detectIndentation = function (defaultInsertSpaces, defaultTabSize) {
this._assertNotDisposed();
var guessedIndentation = guessIndentation(this._buffer, defaultTabSize, defaultInsertSpaces);
this.updateOptions({
insertSpaces: guessedIndentation.insertSpaces,
tabSize: guessedIndentation.tabSize,
indentSize: guessedIndentation.tabSize,
});
};
TextModel._normalizeIndentationFromWhitespace = function (str, indentSize, insertSpaces) {
var spacesCnt = 0;
for (var i = 0; i < str.length; i++) {
if (str.charAt(i) === '\t') {
spacesCnt += indentSize;
}
else {
spacesCnt++;
}
}
var result = '';
if (!insertSpaces) {
var tabsCnt = Math.floor(spacesCnt / indentSize);
spacesCnt = spacesCnt % indentSize;
for (var i = 0; i < tabsCnt; i++) {
result += '\t';
}
}
for (var i = 0; i < spacesCnt; i++) {
result += ' ';
}
return result;
};
TextModel.normalizeIndentation = function (str, indentSize, insertSpaces) {
var firstNonWhitespaceIndex = strings["q" /* firstNonWhitespaceIndex */](str);
if (firstNonWhitespaceIndex === -1) {
firstNonWhitespaceIndex = str.length;
}
return TextModel._normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex), indentSize, insertSpaces) + str.substring(firstNonWhitespaceIndex);
};
TextModel.prototype.normalizeIndentation = function (str) {
this._assertNotDisposed();
return TextModel.normalizeIndentation(str, this._options.indentSize, this._options.insertSpaces);
};
//#endregion
//#region Reading
TextModel.prototype.getVersionId = function () {
this._assertNotDisposed();
return this._versionId;
};
TextModel.prototype.mightContainRTL = function () {
return this._buffer.mightContainRTL();
};
TextModel.prototype.mightContainNonBasicASCII = function () {
return this._buffer.mightContainNonBasicASCII();
};
TextModel.prototype.getAlternativeVersionId = function () {
this._assertNotDisposed();
return this._alternativeVersionId;
};
TextModel.prototype.getOffsetAt = function (rawPosition) {
this._assertNotDisposed();
var position = this._validatePosition(rawPosition.lineNumber, rawPosition.column, 0 /* Relaxed */);
return this._buffer.getOffsetAt(position.lineNumber, position.column);
};
TextModel.prototype.getPositionAt = function (rawOffset) {
this._assertNotDisposed();
var offset = (Math.min(this._buffer.getLength(), Math.max(0, rawOffset)));
return this._buffer.getPositionAt(offset);
};
TextModel.prototype._increaseVersionId = function () {
this._versionId = this._versionId + 1;
this._alternativeVersionId = this._versionId;
};
TextModel.prototype._overwriteAlternativeVersionId = function (newAlternativeVersionId) {
this._alternativeVersionId = newAlternativeVersionId;
};
TextModel.prototype.getValue = function (eol, preserveBOM) {
if (preserveBOM === void 0) { preserveBOM = false; }
this._assertNotDisposed();
var fullModelRange = this.getFullModelRange();
var fullModelValue = this.getValueInRange(fullModelRange, eol);
if (preserveBOM) {
return this._buffer.getBOM() + fullModelValue;
}
return fullModelValue;
};
TextModel.prototype.getValueLength = function (eol, preserveBOM) {
if (preserveBOM === void 0) { preserveBOM = false; }
this._assertNotDisposed();
var fullModelRange = this.getFullModelRange();
var fullModelValue = this.getValueLengthInRange(fullModelRange, eol);
if (preserveBOM) {
return this._buffer.getBOM().length + fullModelValue;
}
return fullModelValue;
};
TextModel.prototype.getValueInRange = function (rawRange, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
this._assertNotDisposed();
return this._buffer.getValueInRange(this.validateRange(rawRange), eol);
};
TextModel.prototype.getValueLengthInRange = function (rawRange, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
this._assertNotDisposed();
return this._buffer.getValueLengthInRange(this.validateRange(rawRange), eol);
};
TextModel.prototype.getCharacterCountInRange = function (rawRange, eol) {
if (eol === void 0) { eol = 0 /* TextDefined */; }
this._assertNotDisposed();
return this._buffer.getCharacterCountInRange(this.validateRange(rawRange), eol);
};
TextModel.prototype.getLineCount = function () {
this._assertNotDisposed();
return this._buffer.getLineCount();
};
TextModel.prototype.getLineContent = function (lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
return this._buffer.getLineContent(lineNumber);
};
TextModel.prototype.getLineLength = function (lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
return this._buffer.getLineLength(lineNumber);
};
TextModel.prototype.getLinesContent = function () {
this._assertNotDisposed();
return this._buffer.getLinesContent();
};
TextModel.prototype.getEOL = function () {
this._assertNotDisposed();
return this._buffer.getEOL();
};
TextModel.prototype.getLineMinColumn = function (lineNumber) {
this._assertNotDisposed();
return 1;
};
TextModel.prototype.getLineMaxColumn = function (lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
return this._buffer.getLineLength(lineNumber) + 1;
};
TextModel.prototype.getLineFirstNonWhitespaceColumn = function (lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
return this._buffer.getLineFirstNonWhitespaceColumn(lineNumber);
};
TextModel.prototype.getLineLastNonWhitespaceColumn = function (lineNumber) {
this._assertNotDisposed();
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('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.
*/
TextModel.prototype._validateRangeRelaxedNoAllocations = function (range) {
var linesCount = this._buffer.getLineCount();
var initialStartLineNumber = range.startLineNumber;
var initialStartColumn = range.startColumn;
var startLineNumber;
var startColumn;
if (initialStartLineNumber < 1) {
startLineNumber = 1;
startColumn = 1;
}
else if (initialStartLineNumber > linesCount) {
startLineNumber = linesCount;
startColumn = this.getLineMaxColumn(startLineNumber);
}
else {
startLineNumber = initialStartLineNumber | 0;
if (initialStartColumn <= 1) {
startColumn = 1;
}
else {
var maxColumn = this.getLineMaxColumn(startLineNumber);
if (initialStartColumn >= maxColumn) {
startColumn = maxColumn;
}
else {
startColumn = initialStartColumn | 0;
}
}
}
var initialEndLineNumber = range.endLineNumber;
var initialEndColumn = range.endColumn;
var endLineNumber;
var endColumn;
if (initialEndLineNumber < 1) {
endLineNumber = 1;
endColumn = 1;
}
else if (initialEndLineNumber > linesCount) {
endLineNumber = linesCount;
endColumn = this.getLineMaxColumn(endLineNumber);
}
else {
endLineNumber = initialEndLineNumber | 0;
if (initialEndColumn <= 1) {
endColumn = 1;
}
else {
var maxColumn = this.getLineMaxColumn(endLineNumber);
if (initialEndColumn >= maxColumn) {
endColumn = maxColumn;
}
else {
endColumn = initialEndColumn | 0;
}
}
}
if (initialStartLineNumber === startLineNumber
&& initialStartColumn === startColumn
&& initialEndLineNumber === endLineNumber
&& initialEndColumn === endColumn
&& range instanceof core_range["a" /* Range */]
&& !(range instanceof selection["a" /* Selection */])) {
return range;
}
return new core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn);
};
TextModel.prototype._isValidPosition = function (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;
}
var lineCount = this._buffer.getLineCount();
if (lineNumber > lineCount) {
return false;
}
if (column === 1) {
return true;
}
var maxColumn = this.getLineMaxColumn(lineNumber);
if (column > maxColumn) {
return false;
}
if (validationType === 1 /* SurrogatePairs */) {
// !!At this point, column > 1
var charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);
if (strings["z" /* isHighSurrogate */](charCodeBefore)) {
return false;
}
}
return true;
};
TextModel.prototype._validatePosition = function (_lineNumber, _column, validationType) {
var lineNumber = Math.floor((typeof _lineNumber === 'number' && !isNaN(_lineNumber)) ? _lineNumber : 1);
var column = Math.floor((typeof _column === 'number' && !isNaN(_column)) ? _column : 1);
var lineCount = this._buffer.getLineCount();
if (lineNumber < 1) {
return new core_position["a" /* Position */](1, 1);
}
if (lineNumber > lineCount) {
return new core_position["a" /* Position */](lineCount, this.getLineMaxColumn(lineCount));
}
if (column <= 1) {
return new core_position["a" /* Position */](lineNumber, 1);
}
var maxColumn = this.getLineMaxColumn(lineNumber);
if (column >= maxColumn) {
return new core_position["a" /* Position */](lineNumber, maxColumn);
}
if (validationType === 1 /* SurrogatePairs */) {
// If the position would end up in the middle of a high-low surrogate pair,
// we move it to before the pair
// !!At this point, column > 1
var charCodeBefore = this._buffer.getLineCharCode(lineNumber, column - 2);
if (strings["z" /* isHighSurrogate */](charCodeBefore)) {
return new core_position["a" /* Position */](lineNumber, column - 1);
}
}
return new core_position["a" /* Position */](lineNumber, column);
};
TextModel.prototype.validatePosition = function (position) {
var validationType = 1 /* SurrogatePairs */;
this._assertNotDisposed();
// Avoid object allocation and cover most likely case
if (position instanceof core_position["a" /* Position */]) {
if (this._isValidPosition(position.lineNumber, position.column, validationType)) {
return position;
}
}
return this._validatePosition(position.lineNumber, position.column, validationType);
};
TextModel.prototype._isValidRange = function (range, validationType) {
var startLineNumber = range.startLineNumber;
var startColumn = range.startColumn;
var endLineNumber = range.endLineNumber;
var endColumn = range.endColumn;
if (!this._isValidPosition(startLineNumber, startColumn, 0 /* Relaxed */)) {
return false;
}
if (!this._isValidPosition(endLineNumber, endColumn, 0 /* Relaxed */)) {
return false;
}
if (validationType === 1 /* SurrogatePairs */) {
var charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);
var charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);
var startInsideSurrogatePair = strings["z" /* isHighSurrogate */](charCodeBeforeStart);
var endInsideSurrogatePair = strings["z" /* isHighSurrogate */](charCodeBeforeEnd);
if (!startInsideSurrogatePair && !endInsideSurrogatePair) {
return true;
}
return false;
}
return true;
};
TextModel.prototype.validateRange = function (_range) {
var validationType = 1 /* SurrogatePairs */;
this._assertNotDisposed();
// Avoid object allocation and cover most likely case
if ((_range instanceof core_range["a" /* Range */]) && !(_range instanceof selection["a" /* Selection */])) {
if (this._isValidRange(_range, validationType)) {
return _range;
}
}
var start = this._validatePosition(_range.startLineNumber, _range.startColumn, 0 /* Relaxed */);
var end = this._validatePosition(_range.endLineNumber, _range.endColumn, 0 /* Relaxed */);
var startLineNumber = start.lineNumber;
var startColumn = start.column;
var endLineNumber = end.lineNumber;
var endColumn = end.column;
if (validationType === 1 /* SurrogatePairs */) {
var charCodeBeforeStart = (startColumn > 1 ? this._buffer.getLineCharCode(startLineNumber, startColumn - 2) : 0);
var charCodeBeforeEnd = (endColumn > 1 && endColumn <= this._buffer.getLineLength(endLineNumber) ? this._buffer.getLineCharCode(endLineNumber, endColumn - 2) : 0);
var startInsideSurrogatePair = strings["z" /* isHighSurrogate */](charCodeBeforeStart);
var endInsideSurrogatePair = strings["z" /* isHighSurrogate */](charCodeBeforeEnd);
if (!startInsideSurrogatePair && !endInsideSurrogatePair) {
return new core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn);
}
if (startLineNumber === endLineNumber && startColumn === endColumn) {
// do not expand a collapsed range, simply move it to a valid location
return new core_range["a" /* Range */](startLineNumber, startColumn - 1, endLineNumber, endColumn - 1);
}
if (startInsideSurrogatePair && endInsideSurrogatePair) {
// expand range at both ends
return new core_range["a" /* Range */](startLineNumber, startColumn - 1, endLineNumber, endColumn + 1);
}
if (startInsideSurrogatePair) {
// only expand range at the start
return new core_range["a" /* Range */](startLineNumber, startColumn - 1, endLineNumber, endColumn);
}
// only expand range at the end
return new core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn + 1);
}
return new core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn);
};
TextModel.prototype.modifyPosition = function (rawPosition, offset) {
this._assertNotDisposed();
var candidate = this.getOffsetAt(rawPosition) + offset;
return this.getPositionAt(Math.min(this._buffer.getLength(), Math.max(0, candidate)));
};
TextModel.prototype.getFullModelRange = function () {
this._assertNotDisposed();
var lineCount = this.getLineCount();
return new core_range["a" /* Range */](1, 1, lineCount, this.getLineMaxColumn(lineCount));
};
TextModel.prototype.findMatchesLineByLine = function (searchRange, searchData, captureMatches, limitResultCount) {
return this._buffer.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
};
TextModel.prototype.findMatches = function (searchString, rawSearchScope, isRegex, matchCase, wordSeparators, captureMatches, limitResultCount) {
if (limitResultCount === void 0) { limitResultCount = LIMIT_FIND_COUNT; }
this._assertNotDisposed();
var searchRange;
if (core_range["a" /* Range */].isIRange(rawSearchScope)) {
searchRange = this.validateRange(rawSearchScope);
}
else {
searchRange = this.getFullModelRange();
}
if (!isRegex && searchString.indexOf('\n') < 0) {
// not regex, not multi line
var searchParams = new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators);
var searchData = searchParams.parseSearchRequest();
if (!searchData) {
return [];
}
return this.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
}
return textModelSearch["c" /* TextModelSearch */].findMatches(this, new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators), searchRange, captureMatches, limitResultCount);
};
TextModel.prototype.findNextMatch = function (searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {
this._assertNotDisposed();
var searchStart = this.validatePosition(rawSearchStart);
if (!isRegex && searchString.indexOf('\n') < 0) {
var searchParams = new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators);
var searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
var lineCount = this.getLineCount();
var searchRange = new core_range["a" /* Range */](searchStart.lineNumber, searchStart.column, lineCount, this.getLineMaxColumn(lineCount));
var ret = this.findMatchesLineByLine(searchRange, searchData, captureMatches, 1);
textModelSearch["c" /* TextModelSearch */].findNextMatch(this, new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);
if (ret.length > 0) {
return ret[0];
}
searchRange = new core_range["a" /* 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["c" /* TextModelSearch */].findNextMatch(this, new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);
};
TextModel.prototype.findPreviousMatch = function (searchString, rawSearchStart, isRegex, matchCase, wordSeparators, captureMatches) {
this._assertNotDisposed();
var searchStart = this.validatePosition(rawSearchStart);
return textModelSearch["c" /* TextModelSearch */].findPreviousMatch(this, new textModelSearch["a" /* SearchParams */](searchString, isRegex, matchCase, wordSeparators), searchStart, captureMatches);
};
//#endregion
//#region Editing
TextModel.prototype.pushStackElement = function () {
this._commandManager.pushStackElement();
};
TextModel.prototype.pushEOL = function (eol) {
var currentEOL = (this.getEOL() === '\n' ? 0 /* LF */ : 1 /* CRLF */);
if (currentEOL === eol) {
return;
}
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
this._commandManager.pushEOL(eol);
}
finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype.pushEditOperations = function (beforeCursorState, editOperations, cursorStateComputer) {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
return this._pushEditOperations(beforeCursorState, editOperations, cursorStateComputer);
}
finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype._pushEditOperations = function (beforeCursorState, editOperations, cursorStateComputer) {
var _this = this;
if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {
// Go through each saved line number and insert a trim whitespace edit
// if it is safe to do so (no conflicts with other edits).
var incomingEdits = editOperations.map(function (op) {
return {
range: _this.validateRange(op.range),
text: op.text
};
});
// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor
// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace
var editsAreNearCursors = true;
for (var i = 0, len = beforeCursorState.length; i < len; i++) {
var sel = beforeCursorState[i];
var foundEditNearSel = false;
for (var j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
var editRange = incomingEdits[j].range;
var selIsAbove = editRange.startLineNumber > sel.endLineNumber;
var selIsBelow = sel.startLineNumber > editRange.endLineNumber;
if (!selIsAbove && !selIsBelow) {
foundEditNearSel = true;
break;
}
}
if (!foundEditNearSel) {
editsAreNearCursors = false;
break;
}
}
if (editsAreNearCursors) {
for (var i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {
var trimLineNumber = this._trimAutoWhitespaceLines[i];
var maxLineColumn = this.getLineMaxColumn(trimLineNumber);
var allowTrimLine = true;
for (var j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
var editRange = incomingEdits[j].range;
var editText = incomingEdits[j].text;
if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {
// `trimLine` is completely outside this edit
continue;
}
// At this point:
// editRange.startLineNumber <= trimLine <= editRange.endLineNumber
if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn
&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\n') {
// This edit inserts a new line (and maybe other text) after `trimLine`
continue;
}
if (trimLineNumber === editRange.startLineNumber && editRange.startColumn === 1
&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(editText.length - 1) === '\n') {
// This edit inserts a new line (and maybe other text) before `trimLine`
continue;
}
// Looks like we can't trim this line as it would interfere with an incoming edit
allowTrimLine = false;
break;
}
if (allowTrimLine) {
editOperations.push({
range: new core_range["a" /* Range */](trimLineNumber, 1, trimLineNumber, maxLineColumn),
text: null
});
}
}
}
this._trimAutoWhitespaceLines = null;
}
return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);
};
TextModel.prototype.applyEdits = function (rawOperations) {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
return this._applyEdits(rawOperations);
}
finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype._applyEdits = function (rawOperations) {
for (var i = 0, len = rawOperations.length; i < len; i++) {
rawOperations[i].range = this.validateRange(rawOperations[i].range);
}
var oldLineCount = this._buffer.getLineCount();
var result = this._buffer.applyEdits(rawOperations, this._options.trimAutoWhitespace);
var newLineCount = this._buffer.getLineCount();
var contentChanges = result.changes;
this._trimAutoWhitespaceLines = result.trimAutoWhitespaceLineNumbers;
if (contentChanges.length !== 0) {
var rawContentChanges = [];
var lineCount = oldLineCount;
for (var i = 0, len = contentChanges.length; i < len; i++) {
var change = contentChanges[i];
var _a = Object(tokensStore["f" /* countEOL */])(change.text), eolCount = _a[0], firstLineLength = _a[1], lastLineLength = _a[2];
this._tokens.acceptEdit(change.range, eolCount, firstLineLength);
this._tokens2.acceptEdit(change.range, eolCount, firstLineLength, lastLineLength, change.text.length > 0 ? change.text.charCodeAt(0) : 0 /* Null */);
this._onDidChangeDecorations.fire();
this._decorationsTree.acceptReplace(change.rangeOffset, change.rangeLength, change.text.length, change.forceMoveMarkers);
var startLineNumber = change.range.startLineNumber;
var endLineNumber = change.range.endLineNumber;
var deletingLinesCnt = endLineNumber - startLineNumber;
var insertingLinesCnt = eolCount;
var editingLinesCnt = Math.min(deletingLinesCnt, insertingLinesCnt);
var changeLineCountDelta = (insertingLinesCnt - deletingLinesCnt);
for (var j = editingLinesCnt; j >= 0; j--) {
var editLineNumber = startLineNumber + j;
var currentEditLineNumber = newLineCount - lineCount - changeLineCountDelta + editLineNumber;
rawContentChanges.push(new ModelRawLineChanged(editLineNumber, this.getLineContent(currentEditLineNumber)));
}
if (editingLinesCnt < deletingLinesCnt) {
// Must delete some lines
var spliceStartLineNumber = startLineNumber + editingLinesCnt;
rawContentChanges.push(new ModelRawLinesDeleted(spliceStartLineNumber + 1, endLineNumber));
}
if (editingLinesCnt < insertingLinesCnt) {
// Must insert some lines
var spliceLineNumber = startLineNumber + editingLinesCnt;
var cnt = insertingLinesCnt - editingLinesCnt;
var fromLineNumber = newLineCount - lineCount - cnt + spliceLineNumber + 1;
var newLines = [];
for (var i_1 = 0; i_1 < cnt; i_1++) {
var lineNumber = fromLineNumber + i_1;
newLines[lineNumber - fromLineNumber] = this.getLineContent(lineNumber);
}
rawContentChanges.push(new ModelRawLinesInserted(spliceLineNumber + 1, startLineNumber + insertingLinesCnt, newLines));
}
lineCount += changeLineCountDelta;
}
this._increaseVersionId();
this._emitContentChangedEvent(new ModelRawContentChangedEvent(rawContentChanges, this.getVersionId(), this._isUndoing, this._isRedoing), {
changes: contentChanges,
eol: this._buffer.getEOL(),
versionId: this.getVersionId(),
isUndoing: this._isUndoing,
isRedoing: this._isRedoing,
isFlush: false
});
}
return result.reverseEdits;
};
TextModel.prototype._undo = function () {
this._isUndoing = true;
var r = this._commandManager.undo();
this._isUndoing = false;
if (!r) {
return null;
}
this._overwriteAlternativeVersionId(r.recordedVersionId);
return r.selections;
};
TextModel.prototype.undo = function () {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
return this._undo();
}
finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype.canUndo = function () {
return this._commandManager.canUndo();
};
TextModel.prototype._redo = function () {
this._isRedoing = true;
var r = this._commandManager.redo();
this._isRedoing = false;
if (!r) {
return null;
}
this._overwriteAlternativeVersionId(r.recordedVersionId);
return r.selections;
};
TextModel.prototype.redo = function () {
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._eventEmitter.beginDeferredEmit();
return this._redo();
}
finally {
this._eventEmitter.endDeferredEmit();
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype.canRedo = function () {
return this._commandManager.canRedo();
};
//#endregion
//#region Decorations
TextModel.prototype.changeDecorations = function (callback, ownerId) {
if (ownerId === void 0) { ownerId = 0; }
this._assertNotDisposed();
try {
this._onDidChangeDecorations.beginDeferredEmit();
return this._changeDecorations(ownerId, callback);
}
finally {
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype._changeDecorations = function (ownerId, callback) {
var _this = this;
var changeAccessor = {
addDecoration: function (range, options) {
_this._onDidChangeDecorations.fire();
return _this._deltaDecorationsImpl(ownerId, [], [{ range: range, options: options }])[0];
},
changeDecoration: function (id, newRange) {
_this._onDidChangeDecorations.fire();
_this._changeDecorationImpl(id, newRange);
},
changeDecorationOptions: function (id, options) {
_this._onDidChangeDecorations.fire();
_this._changeDecorationOptionsImpl(id, _normalizeOptions(options));
},
removeDecoration: function (id) {
_this._onDidChangeDecorations.fire();
_this._deltaDecorationsImpl(ownerId, [id], []);
},
deltaDecorations: function (oldDecorations, newDecorations) {
if (oldDecorations.length === 0 && newDecorations.length === 0) {
// nothing to do
return [];
}
_this._onDidChangeDecorations.fire();
return _this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);
}
};
var result = null;
try {
result = callback(changeAccessor);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
// Invalidate change accessor
changeAccessor.addDecoration = invalidFunc;
changeAccessor.changeDecoration = invalidFunc;
changeAccessor.changeDecorationOptions = invalidFunc;
changeAccessor.removeDecoration = invalidFunc;
changeAccessor.deltaDecorations = invalidFunc;
return result;
};
TextModel.prototype.deltaDecorations = function (oldDecorations, newDecorations, ownerId) {
if (ownerId === void 0) { ownerId = 0; }
this._assertNotDisposed();
if (!oldDecorations) {
oldDecorations = [];
}
if (oldDecorations.length === 0 && newDecorations.length === 0) {
// nothing to do
return [];
}
try {
this._onDidChangeDecorations.beginDeferredEmit();
this._onDidChangeDecorations.fire();
return this._deltaDecorationsImpl(ownerId, oldDecorations, newDecorations);
}
finally {
this._onDidChangeDecorations.endDeferredEmit();
}
};
TextModel.prototype._getTrackedRange = function (id) {
return this.getDecorationRange(id);
};
TextModel.prototype._setTrackedRange = function (id, newRange, newStickiness) {
var node = (id ? this._decorations[id] : null);
if (!node) {
if (!newRange) {
// node doesn't exist, the request is to delete => nothing to do
return null;
}
// node doesn't exist, the request is to set => add the tracked range
return this._deltaDecorationsImpl(0, [], [{ range: newRange, options: TRACKED_RANGE_OPTIONS[newStickiness] }])[0];
}
if (!newRange) {
// node exists, the request is to delete => delete node
this._decorationsTree.delete(node);
delete this._decorations[node.id];
return null;
}
// node exists, the request is to set => change the tracked range and its options
var range = this._validateRangeRelaxedNoAllocations(newRange);
var startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);
var endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);
this._decorationsTree.delete(node);
node.reset(this.getVersionId(), startOffset, endOffset, range);
node.setOptions(TRACKED_RANGE_OPTIONS[newStickiness]);
this._decorationsTree.insert(node);
return node.id;
};
TextModel.prototype.removeAllDecorationsWithOwnerId = function (ownerId) {
if (this._isDisposed) {
return;
}
var nodes = this._decorationsTree.collectNodesFromOwner(ownerId);
for (var i = 0, len = nodes.length; i < len; i++) {
var node = nodes[i];
this._decorationsTree.delete(node);
delete this._decorations[node.id];
}
};
TextModel.prototype.getDecorationOptions = function (decorationId) {
var node = this._decorations[decorationId];
if (!node) {
return null;
}
return node.options;
};
TextModel.prototype.getDecorationRange = function (decorationId) {
var node = this._decorations[decorationId];
if (!node) {
return null;
}
var versionId = this.getVersionId();
if (node.cachedVersionId !== versionId) {
this._decorationsTree.resolveNode(node, versionId);
}
if (node.range === null) {
node.range = this._getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);
}
return node.range;
};
TextModel.prototype.getLineDecorations = function (lineNumber, ownerId, filterOutValidation) {
if (ownerId === void 0) { ownerId = 0; }
if (filterOutValidation === void 0) { filterOutValidation = false; }
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
return [];
}
return this.getLinesDecorations(lineNumber, lineNumber, ownerId, filterOutValidation);
};
TextModel.prototype.getLinesDecorations = function (_startLineNumber, _endLineNumber, ownerId, filterOutValidation) {
if (ownerId === void 0) { ownerId = 0; }
if (filterOutValidation === void 0) { filterOutValidation = false; }
var lineCount = this.getLineCount();
var startLineNumber = Math.min(lineCount, Math.max(1, _startLineNumber));
var endLineNumber = Math.min(lineCount, Math.max(1, _endLineNumber));
var endColumn = this.getLineMaxColumn(endLineNumber);
return this._getDecorationsInRange(new core_range["a" /* Range */](startLineNumber, 1, endLineNumber, endColumn), ownerId, filterOutValidation);
};
TextModel.prototype.getDecorationsInRange = function (range, ownerId, filterOutValidation) {
if (ownerId === void 0) { ownerId = 0; }
if (filterOutValidation === void 0) { filterOutValidation = false; }
var validatedRange = this.validateRange(range);
return this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation);
};
TextModel.prototype.getOverviewRulerDecorations = function (ownerId, filterOutValidation) {
if (ownerId === void 0) { ownerId = 0; }
if (filterOutValidation === void 0) { filterOutValidation = false; }
var versionId = this.getVersionId();
var result = this._decorationsTree.search(ownerId, filterOutValidation, true, versionId);
return this._ensureNodesHaveRanges(result);
};
TextModel.prototype.getAllDecorations = function (ownerId, filterOutValidation) {
if (ownerId === void 0) { ownerId = 0; }
if (filterOutValidation === void 0) { filterOutValidation = false; }
var versionId = this.getVersionId();
var result = this._decorationsTree.search(ownerId, filterOutValidation, false, versionId);
return this._ensureNodesHaveRanges(result);
};
TextModel.prototype._getDecorationsInRange = function (filterRange, filterOwnerId, filterOutValidation) {
var startOffset = this._buffer.getOffsetAt(filterRange.startLineNumber, filterRange.startColumn);
var endOffset = this._buffer.getOffsetAt(filterRange.endLineNumber, filterRange.endColumn);
var versionId = this.getVersionId();
var result = this._decorationsTree.intervalSearch(startOffset, endOffset, filterOwnerId, filterOutValidation, versionId);
return this._ensureNodesHaveRanges(result);
};
TextModel.prototype._ensureNodesHaveRanges = function (nodes) {
for (var i = 0, len = nodes.length; i < len; i++) {
var node = nodes[i];
if (node.range === null) {
node.range = this._getRangeAt(node.cachedAbsoluteStart, node.cachedAbsoluteEnd);
}
}
return nodes;
};
TextModel.prototype._getRangeAt = function (start, end) {
return this._buffer.getRangeAt(start, end - start);
};
TextModel.prototype._changeDecorationImpl = function (decorationId, _range) {
var node = this._decorations[decorationId];
if (!node) {
return;
}
var range = this._validateRangeRelaxedNoAllocations(_range);
var startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);
var endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);
this._decorationsTree.delete(node);
node.reset(this.getVersionId(), startOffset, endOffset, range);
this._decorationsTree.insert(node);
};
TextModel.prototype._changeDecorationOptionsImpl = function (decorationId, options) {
var node = this._decorations[decorationId];
if (!node) {
return;
}
var nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);
var nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);
if (nodeWasInOverviewRuler !== nodeIsInOverviewRuler) {
// Delete + Insert due to an overview ruler status change
this._decorationsTree.delete(node);
node.setOptions(options);
this._decorationsTree.insert(node);
}
else {
node.setOptions(options);
}
};
TextModel.prototype._deltaDecorationsImpl = function (ownerId, oldDecorationsIds, newDecorations) {
var versionId = this.getVersionId();
var oldDecorationsLen = oldDecorationsIds.length;
var oldDecorationIndex = 0;
var newDecorationsLen = newDecorations.length;
var newDecorationIndex = 0;
var result = new Array(newDecorationsLen);
while (oldDecorationIndex < oldDecorationsLen || newDecorationIndex < newDecorationsLen) {
var node = null;
if (oldDecorationIndex < oldDecorationsLen) {
// (1) get ourselves an old node
do {
node = this._decorations[oldDecorationsIds[oldDecorationIndex++]];
} while (!node && oldDecorationIndex < oldDecorationsLen);
// (2) remove the node from the tree (if it exists)
if (node) {
this._decorationsTree.delete(node);
}
}
if (newDecorationIndex < newDecorationsLen) {
// (3) create a new node if necessary
if (!node) {
var internalDecorationId = (++this._lastDecorationId);
var decorationId = this._instanceId + ";" + internalDecorationId;
node = new IntervalNode(decorationId, 0, 0);
this._decorations[decorationId] = node;
}
// (4) initialize node
var newDecoration = newDecorations[newDecorationIndex];
var range = this._validateRangeRelaxedNoAllocations(newDecoration.range);
var options = _normalizeOptions(newDecoration.options);
var startOffset = this._buffer.getOffsetAt(range.startLineNumber, range.startColumn);
var endOffset = this._buffer.getOffsetAt(range.endLineNumber, range.endColumn);
node.ownerId = ownerId;
node.reset(versionId, startOffset, endOffset, range);
node.setOptions(options);
this._decorationsTree.insert(node);
result[newDecorationIndex] = node.id;
newDecorationIndex++;
}
else {
if (node) {
delete this._decorations[node.id];
}
}
}
return result;
};
//#endregion
//#region Tokenization
TextModel.prototype.setLineTokens = function (lineNumber, tokens) {
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
this._tokens.setTokens(this._languageIdentifier.id, lineNumber - 1, this._buffer.getLineLength(lineNumber), tokens);
};
TextModel.prototype.setTokens = function (tokens) {
if (tokens.length === 0) {
return;
}
var ranges = [];
for (var i = 0, len = tokens.length; i < len; i++) {
var element = tokens[i];
ranges.push({ fromLineNumber: element.startLineNumber, toLineNumber: element.startLineNumber + element.tokens.length - 1 });
for (var j = 0, lenJ = element.tokens.length; j < lenJ; j++) {
this.setLineTokens(element.startLineNumber + j, element.tokens[j]);
}
}
this._emitModelTokensChangedEvent({
tokenizationSupportChanged: false,
ranges: ranges
});
};
TextModel.prototype.setSemanticTokens = function (tokens) {
this._tokens2.set(tokens);
this._emitModelTokensChangedEvent({
tokenizationSupportChanged: false,
ranges: [{ fromLineNumber: 1, toLineNumber: this.getLineCount() }]
});
};
TextModel.prototype.tokenizeViewport = function (startLineNumber, endLineNumber) {
startLineNumber = Math.max(1, startLineNumber);
endLineNumber = Math.min(this._buffer.getLineCount(), endLineNumber);
this._tokenization.tokenizeViewport(startLineNumber, endLineNumber);
};
TextModel.prototype.clearTokens = function () {
this._tokens.flush();
this._emitModelTokensChangedEvent({
tokenizationSupportChanged: true,
ranges: [{
fromLineNumber: 1,
toLineNumber: this._buffer.getLineCount()
}]
});
};
TextModel.prototype._emitModelTokensChangedEvent = function (e) {
if (!this._isDisposing) {
this._onDidChangeTokens.fire(e);
}
};
TextModel.prototype.resetTokenization = function () {
this._tokenization.reset();
};
TextModel.prototype.forceTokenization = function (lineNumber) {
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
this._tokenization.forceTokenization(lineNumber);
};
TextModel.prototype.isCheapToTokenize = function (lineNumber) {
return this._tokenization.isCheapToTokenize(lineNumber);
};
TextModel.prototype.tokenizeIfCheap = function (lineNumber) {
if (this.isCheapToTokenize(lineNumber)) {
this.forceTokenization(lineNumber);
}
};
TextModel.prototype.getLineTokens = function (lineNumber) {
if (lineNumber < 1 || lineNumber > this.getLineCount()) {
throw new Error('Illegal value for lineNumber');
}
return this._getLineTokens(lineNumber);
};
TextModel.prototype._getLineTokens = function (lineNumber) {
var lineText = this.getLineContent(lineNumber);
var syntacticTokens = this._tokens.getTokens(this._languageIdentifier.id, lineNumber - 1, lineText);
return this._tokens2.addSemanticTokens(lineNumber, syntacticTokens);
};
TextModel.prototype.getLanguageIdentifier = function () {
return this._languageIdentifier;
};
TextModel.prototype.getModeId = function () {
return this._languageIdentifier.language;
};
TextModel.prototype.setMode = function (languageIdentifier) {
if (this._languageIdentifier.id === languageIdentifier.id) {
// There's nothing to do
return;
}
var e = {
oldLanguage: this._languageIdentifier.language,
newLanguage: languageIdentifier.language
};
this._languageIdentifier = languageIdentifier;
this._onDidChangeLanguage.fire(e);
this._onDidChangeLanguageConfiguration.fire({});
};
TextModel.prototype.getLanguageIdAtPosition = function (lineNumber, column) {
var position = this.validatePosition(new core_position["a" /* Position */](lineNumber, column));
var lineTokens = this.getLineTokens(position.lineNumber);
return lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));
};
// Having tokens allows implementing additional helper methods
TextModel.prototype.getWordAtPosition = function (_position) {
this._assertNotDisposed();
var position = this.validatePosition(_position);
var lineContent = this.getLineContent(position.lineNumber);
var lineTokens = this._getLineTokens(position.lineNumber);
var tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
// (1). First try checking right biased word
var _a = TextModel._findLanguageBoundaries(lineTokens, tokenIndex), rbStartOffset = _a[0], rbEndOffset = _a[1];
var rightBiasedWord = Object(wordHelper["d" /* getWordAtText */])(position.column, languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getWordDefinition(lineTokens.getLanguageId(tokenIndex)), lineContent.substring(rbStartOffset, rbEndOffset), rbStartOffset);
// Make sure the result touches the original passed in position
if (rightBiasedWord && rightBiasedWord.startColumn <= _position.column && _position.column <= rightBiasedWord.endColumn) {
return rightBiasedWord;
}
// (2). Else, if we were at a language boundary, check the left biased word
if (tokenIndex > 0 && rbStartOffset === position.column - 1) {
// edge case, where `position` sits between two tokens belonging to two different languages
var _b = TextModel._findLanguageBoundaries(lineTokens, tokenIndex - 1), lbStartOffset = _b[0], lbEndOffset = _b[1];
var leftBiasedWord = Object(wordHelper["d" /* getWordAtText */])(position.column, languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getWordDefinition(lineTokens.getLanguageId(tokenIndex - 1)), lineContent.substring(lbStartOffset, lbEndOffset), lbStartOffset);
// Make sure the result touches the original passed in position
if (leftBiasedWord && leftBiasedWord.startColumn <= _position.column && _position.column <= leftBiasedWord.endColumn) {
return leftBiasedWord;
}
}
return null;
};
TextModel._findLanguageBoundaries = function (lineTokens, tokenIndex) {
var languageId = lineTokens.getLanguageId(tokenIndex);
// go left until a different language is hit
var startOffset = 0;
for (var i = tokenIndex; i >= 0 && lineTokens.getLanguageId(i) === languageId; i--) {
startOffset = lineTokens.getStartOffset(i);
}
// go right until a different language is hit
var endOffset = lineTokens.getLineContent().length;
for (var i = tokenIndex, tokenCount = lineTokens.getCount(); i < tokenCount && lineTokens.getLanguageId(i) === languageId; i++) {
endOffset = lineTokens.getEndOffset(i);
}
return [startOffset, endOffset];
};
TextModel.prototype.getWordUntilPosition = function (position) {
var 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
};
};
TextModel.prototype.findMatchingBracketUp = function (_bracket, _position) {
var bracket = _bracket.toLowerCase();
var position = this.validatePosition(_position);
var lineTokens = this._getLineTokens(position.lineNumber);
var languageId = lineTokens.getLanguageId(lineTokens.findTokenIndexAtOffset(position.column - 1));
var bracketsSupport = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
if (!bracketsSupport) {
return null;
}
var data = bracketsSupport.textIsBracket[bracket];
if (!data) {
return null;
}
return this._findMatchingBracketUp(data, position);
};
TextModel.prototype.matchBracket = function (position) {
return this._matchBracket(this.validatePosition(position));
};
TextModel.prototype._matchBracket = function (position) {
var lineNumber = position.lineNumber;
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
if (tokenIndex < 0) {
return null;
}
var currentModeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(lineTokens.getLanguageId(tokenIndex));
// check that the token is not to be ignored
if (currentModeBrackets && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex))) {
// limit search to not go before `maxBracketLength`
var searchStartOffset = Math.max(0, position.column - 1 - currentModeBrackets.maxBracketLength);
for (var i = tokenIndex - 1; i >= 0; i--) {
var tokenEndOffset = lineTokens.getEndOffset(i);
if (tokenEndOffset <= searchStartOffset) {
break;
}
if (Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(i))) {
searchStartOffset = tokenEndOffset;
}
}
// limit search to not go after `maxBracketLength`
var searchEndOffset = Math.min(lineText.length, position.column - 1 + currentModeBrackets.maxBracketLength);
// it might be the case that [currentTokenStart -> currentTokenEnd] contains multiple brackets
// `bestResult` will contain the most right-side result
var bestResult = null;
while (true) {
var foundBracket = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(currentModeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!foundBracket) {
// there are no more brackets in this text
break;
}
// check that we didn't hit a bracket too far away from position
if (foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {
var foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();
var r = this._matchFoundBracket(foundBracket, currentModeBrackets.textIsBracket[foundBracketText], currentModeBrackets.textIsOpenBracket[foundBracketText]);
if (r) {
bestResult = r;
}
}
searchStartOffset = foundBracket.endColumn - 1;
}
if (bestResult) {
return bestResult;
}
}
// If position is in between two tokens, try also looking in the previous token
if (tokenIndex > 0 && lineTokens.getStartOffset(tokenIndex) === position.column - 1) {
var prevTokenIndex = tokenIndex - 1;
var prevModeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(lineTokens.getLanguageId(prevTokenIndex));
// check that previous token is not to be ignored
if (prevModeBrackets && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(prevTokenIndex))) {
// limit search in case previous token is very large, there's no need to go beyond `maxBracketLength`
var searchStartOffset = Math.max(0, position.column - 1 - prevModeBrackets.maxBracketLength);
var searchEndOffset = Math.min(lineText.length, position.column - 1 + prevModeBrackets.maxBracketLength);
for (var i = prevTokenIndex + 1; i < tokenCount; i++) {
var tokenStartOffset = lineTokens.getStartOffset(i);
if (tokenStartOffset >= searchEndOffset) {
break;
}
if (Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(i))) {
searchEndOffset = tokenStartOffset;
}
}
var foundBracket = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(prevModeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
// check that we didn't hit a bracket too far away from position
if (foundBracket && foundBracket.startColumn <= position.column && position.column <= foundBracket.endColumn) {
var foundBracketText = lineText.substring(foundBracket.startColumn - 1, foundBracket.endColumn - 1).toLowerCase();
var r = this._matchFoundBracket(foundBracket, prevModeBrackets.textIsBracket[foundBracketText], prevModeBrackets.textIsOpenBracket[foundBracketText]);
if (r) {
return r;
}
}
}
}
return null;
};
TextModel.prototype._matchFoundBracket = function (foundBracket, data, isOpen) {
if (!data) {
return null;
}
if (isOpen) {
var matched = this._findMatchingBracketDown(data, foundBracket.getEndPosition());
if (matched) {
return [foundBracket, matched];
}
}
else {
var matched = this._findMatchingBracketUp(data, foundBracket.getStartPosition());
if (matched) {
return [foundBracket, matched];
}
}
return null;
};
TextModel.prototype._findMatchingBracketUp = function (bracket, position) {
// console.log('_findMatchingBracketUp: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));
var languageId = bracket.languageIdentifier.id;
var reversedBracketRegex = bracket.reversedRegex;
var count = -1;
var searchPrevMatchingBracketInRange = function (lineNumber, lineText, searchStartOffset, searchEndOffset) {
while (true) {
var r = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(reversedBracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
var 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 (var lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = tokenCount - 1;
var searchStartOffset = lineText.length;
var searchEndOffset = lineText.length;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
}
var prevSearchInToken = true;
for (; tokenIndex >= 0; tokenIndex--) {
var searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex)));
if (searchInToken) {
// this token should be searched
if (prevSearchInToken) {
// the previous token should be searched, simply extend searchStartOffset
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
}
else {
// the previous token should not be searched
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
}
else {
// this token should not be searched
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
prevSearchInToken = searchInToken;
}
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchPrevMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
return null;
};
TextModel.prototype._findMatchingBracketDown = function (bracket, position) {
// console.log('_findMatchingBracketDown: ', 'bracket: ', JSON.stringify(bracket), 'startPosition: ', String(position));
var languageId = bracket.languageIdentifier.id;
var bracketRegex = bracket.forwardRegex;
var count = 1;
var searchNextMatchingBracketInRange = function (lineNumber, lineText, searchStartOffset, searchEndOffset) {
while (true) {
var r = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(bracketRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
var 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;
};
var lineCount = this.getLineCount();
for (var lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = 0;
var searchStartOffset = 0;
var searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
}
var prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
var searchInToken = (lineTokens.getLanguageId(tokenIndex) === languageId && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex)));
if (searchInToken) {
// this token should be searched
if (prevSearchInToken) {
// the previous token should be searched, simply extend searchEndOffset
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
else {
// the previous token should not be searched
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
}
else {
// this token should not be searched
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
prevSearchInToken = searchInToken;
}
if (prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchNextMatchingBracketInRange(lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
return null;
};
TextModel.prototype.findPrevBracket = function (_position) {
var position = this.validatePosition(_position);
var languageId = -1;
var modeBrackets = null;
for (var lineNumber = position.lineNumber; lineNumber >= 1; lineNumber--) {
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = tokenCount - 1;
var searchStartOffset = lineText.length;
var searchEndOffset = lineText.length;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
}
}
var prevSearchInToken = true;
for (; tokenIndex >= 0; tokenIndex--) {
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
// language id change!
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
}
var searchInToken = (!!modeBrackets && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex)));
if (searchInToken) {
// this token should be searched
if (prevSearchInToken) {
// the previous token should be searched, simply extend searchStartOffset
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
}
else {
// the previous token should not be searched
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
}
else {
// this token should not be searched
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
}
}
prevSearchInToken = searchInToken;
}
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(modeBrackets.reversedRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
}
}
return null;
};
TextModel.prototype.findNextBracket = function (_position) {
var position = this.validatePosition(_position);
var lineCount = this.getLineCount();
var languageId = -1;
var modeBrackets = null;
for (var lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = 0;
var searchStartOffset = 0;
var searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
}
}
var prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
// language id change!
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
}
var searchInToken = (!!modeBrackets && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex)));
if (searchInToken) {
// this token should be searched
if (prevSearchInToken) {
// the previous token should be searched, simply extend searchEndOffset
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
else {
// the previous token should not be searched
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
}
else {
// this token should not be searched
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
}
}
prevSearchInToken = searchInToken;
}
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return this._toFoundBracket(modeBrackets, r);
}
}
}
return null;
};
TextModel.prototype.findEnclosingBrackets = function (_position, maxDuration) {
var _this = this;
if (maxDuration === void 0) { maxDuration = 1073741824 /* MAX_SAFE_SMALL_INTEGER */; }
var position = this.validatePosition(_position);
var lineCount = this.getLineCount();
var savedCounts = new Map();
var counts = [];
var resetCounts = function (languageId, modeBrackets) {
if (!savedCounts.has(languageId)) {
var tmp = [];
for (var i = 0, len = modeBrackets ? modeBrackets.brackets.length : 0; i < len; i++) {
tmp[i] = 0;
}
savedCounts.set(languageId, tmp);
}
counts = savedCounts.get(languageId);
};
var searchInRange = function (modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset) {
while (true) {
var r = richEditBrackets["a" /* BracketsUtils */].findNextBracketInRange(modeBrackets.forwardRegex, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (!r) {
break;
}
var hitText = lineText.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
var bracket = modeBrackets.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);
}
}
searchStartOffset = r.endColumn - 1;
}
return null;
};
var languageId = -1;
var modeBrackets = null;
var startTime = Date.now();
for (var lineNumber = position.lineNumber; lineNumber <= lineCount; lineNumber++) {
var elapsedTime = Date.now() - startTime;
if (elapsedTime > maxDuration) {
return null;
}
var lineTokens = this._getLineTokens(lineNumber);
var tokenCount = lineTokens.getCount();
var lineText = this._buffer.getLineContent(lineNumber);
var tokenIndex = 0;
var searchStartOffset = 0;
var searchEndOffset = 0;
if (lineNumber === position.lineNumber) {
tokenIndex = lineTokens.findTokenIndexAtOffset(position.column - 1);
searchStartOffset = position.column - 1;
searchEndOffset = position.column - 1;
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
resetCounts(languageId, modeBrackets);
}
}
var prevSearchInToken = true;
for (; tokenIndex < tokenCount; tokenIndex++) {
var tokenLanguageId = lineTokens.getLanguageId(tokenIndex);
if (languageId !== tokenLanguageId) {
// language id change!
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
prevSearchInToken = false;
}
languageId = tokenLanguageId;
modeBrackets = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getBracketsSupport(languageId);
resetCounts(languageId, modeBrackets);
}
var searchInToken = (!!modeBrackets && !Object(supports["b" /* ignoreBracketsInToken */])(lineTokens.getStandardTokenType(tokenIndex)));
if (searchInToken) {
// this token should be searched
if (prevSearchInToken) {
// the previous token should be searched, simply extend searchEndOffset
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
else {
// the previous token should not be searched
searchStartOffset = lineTokens.getStartOffset(tokenIndex);
searchEndOffset = lineTokens.getEndOffset(tokenIndex);
}
}
else {
// this token should not be searched
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
prevSearchInToken = searchInToken;
}
if (modeBrackets && prevSearchInToken && searchStartOffset !== searchEndOffset) {
var r = searchInRange(modeBrackets, lineNumber, lineText, searchStartOffset, searchEndOffset);
if (r) {
return r;
}
}
}
return null;
};
TextModel.prototype._toFoundBracket = function (modeBrackets, r) {
if (!r) {
return null;
}
var text = this.getValueInRange(r);
text = text.toLowerCase();
var data = modeBrackets.textIsBracket[text];
if (!data) {
return null;
}
return {
range: r,
open: data.open,
close: data.close,
isOpen: modeBrackets.textIsOpenBracket[text]
};
};
/**
* Returns:
* - -1 => the line consists of whitespace
* - otherwise => the indent level is returned value
*/
TextModel.computeIndentLevel = function (line, tabSize) {
var indent = 0;
var i = 0;
var len = line.length;
while (i < len) {
var chCode = line.charCodeAt(i);
if (chCode === 32 /* Space */) {
indent++;
}
else if (chCode === 9 /* Tab */) {
indent = indent - indent % tabSize + tabSize;
}
else {
break;
}
i++;
}
if (i === len) {
return -1; // line only consists of whitespace
}
return indent;
};
TextModel.prototype._computeIndentLevel = function (lineIndex) {
return TextModel.computeIndentLevel(this._buffer.getLineContent(lineIndex + 1), this._options.tabSize);
};
TextModel.prototype.getActiveIndentGuide = function (lineNumber, minLineNumber, maxLineNumber) {
var _this = this;
this._assertNotDisposed();
var lineCount = this.getLineCount();
if (lineNumber < 1 || lineNumber > lineCount) {
throw new Error('Illegal value for lineNumber');
}
var foldingRules = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getFoldingRules(this._languageIdentifier.id);
var offSide = Boolean(foldingRules && foldingRules.offSide);
var up_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */
var up_aboveContentLineIndent = -1;
var up_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */
var up_belowContentLineIndent = -1;
var up_resolveIndents = function (lineNumber) {
if (up_aboveContentLineIndex !== -1 && (up_aboveContentLineIndex === -2 || up_aboveContentLineIndex > lineNumber - 1)) {
up_aboveContentLineIndex = -1;
up_aboveContentLineIndent = -1;
// must find previous line with content
for (var lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
var indent_1 = _this._computeIndentLevel(lineIndex);
if (indent_1 >= 0) {
up_aboveContentLineIndex = lineIndex;
up_aboveContentLineIndent = indent_1;
break;
}
}
}
if (up_belowContentLineIndex === -2) {
up_belowContentLineIndex = -1;
up_belowContentLineIndent = -1;
// must find next line with content
for (var lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
var indent_2 = _this._computeIndentLevel(lineIndex);
if (indent_2 >= 0) {
up_belowContentLineIndex = lineIndex;
up_belowContentLineIndent = indent_2;
break;
}
}
}
};
var down_aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */
var down_aboveContentLineIndent = -1;
var down_belowContentLineIndex = -2; /* -2 is a marker for not having computed it */
var down_belowContentLineIndent = -1;
var down_resolveIndents = function (lineNumber) {
if (down_aboveContentLineIndex === -2) {
down_aboveContentLineIndex = -1;
down_aboveContentLineIndent = -1;
// must find previous line with content
for (var lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
var indent_3 = _this._computeIndentLevel(lineIndex);
if (indent_3 >= 0) {
down_aboveContentLineIndex = lineIndex;
down_aboveContentLineIndent = indent_3;
break;
}
}
}
if (down_belowContentLineIndex !== -1 && (down_belowContentLineIndex === -2 || down_belowContentLineIndex < lineNumber - 1)) {
down_belowContentLineIndex = -1;
down_belowContentLineIndent = -1;
// must find next line with content
for (var lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
var indent_4 = _this._computeIndentLevel(lineIndex);
if (indent_4 >= 0) {
down_belowContentLineIndex = lineIndex;
down_belowContentLineIndent = indent_4;
break;
}
}
}
};
var startLineNumber = 0;
var goUp = true;
var endLineNumber = 0;
var goDown = true;
var indent = 0;
for (var distance = 0; goUp || goDown; distance++) {
var upLineNumber = lineNumber - distance;
var downLineNumber = lineNumber + distance;
if (distance !== 0 && (upLineNumber < 1 || upLineNumber < minLineNumber)) {
goUp = false;
}
if (distance !== 0 && (downLineNumber > lineCount || downLineNumber > maxLineNumber)) {
goDown = false;
}
if (distance > 50000) {
// stop processing
goUp = false;
goDown = false;
}
if (goUp) {
// compute indent level going up
var upLineIndentLevel = void 0;
var currentIndent = this._computeIndentLevel(upLineNumber - 1);
if (currentIndent >= 0) {
// This line has content (besides whitespace)
// Use the line's indent
up_belowContentLineIndex = upLineNumber - 1;
up_belowContentLineIndent = currentIndent;
upLineIndentLevel = Math.ceil(currentIndent / this._options.indentSize);
}
else {
up_resolveIndents(upLineNumber);
upLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, up_aboveContentLineIndent, up_belowContentLineIndent);
}
if (distance === 0) {
// This is the initial line number
startLineNumber = upLineNumber;
endLineNumber = downLineNumber;
indent = upLineIndentLevel;
if (indent === 0) {
// No need to continue
return { startLineNumber: startLineNumber, endLineNumber: endLineNumber, indent: indent };
}
continue;
}
if (upLineIndentLevel >= indent) {
startLineNumber = upLineNumber;
}
else {
goUp = false;
}
}
if (goDown) {
// compute indent level going down
var downLineIndentLevel = void 0;
var currentIndent = this._computeIndentLevel(downLineNumber - 1);
if (currentIndent >= 0) {
// This line has content (besides whitespace)
// Use the line's indent
down_aboveContentLineIndex = downLineNumber - 1;
down_aboveContentLineIndent = currentIndent;
downLineIndentLevel = Math.ceil(currentIndent / this._options.indentSize);
}
else {
down_resolveIndents(downLineNumber);
downLineIndentLevel = this._getIndentLevelForWhitespaceLine(offSide, down_aboveContentLineIndent, down_belowContentLineIndent);
}
if (downLineIndentLevel >= indent) {
endLineNumber = downLineNumber;
}
else {
goDown = false;
}
}
}
return { startLineNumber: startLineNumber, endLineNumber: endLineNumber, indent: indent };
};
TextModel.prototype.getLinesIndentGuides = function (startLineNumber, endLineNumber) {
this._assertNotDisposed();
var lineCount = this.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');
}
var foldingRules = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getFoldingRules(this._languageIdentifier.id);
var offSide = Boolean(foldingRules && foldingRules.offSide);
var result = new Array(endLineNumber - startLineNumber + 1);
var aboveContentLineIndex = -2; /* -2 is a marker for not having computed it */
var aboveContentLineIndent = -1;
var belowContentLineIndex = -2; /* -2 is a marker for not having computed it */
var belowContentLineIndent = -1;
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var resultIndex = lineNumber - startLineNumber;
var currentIndent = this._computeIndentLevel(lineNumber - 1);
if (currentIndent >= 0) {
// This line has content (besides whitespace)
// Use the line's indent
aboveContentLineIndex = lineNumber - 1;
aboveContentLineIndent = currentIndent;
result[resultIndex] = Math.ceil(currentIndent / this._options.indentSize);
continue;
}
if (aboveContentLineIndex === -2) {
aboveContentLineIndex = -1;
aboveContentLineIndent = -1;
// must find previous line with content
for (var lineIndex = lineNumber - 2; lineIndex >= 0; lineIndex--) {
var indent = this._computeIndentLevel(lineIndex);
if (indent >= 0) {
aboveContentLineIndex = lineIndex;
aboveContentLineIndent = indent;
break;
}
}
}
if (belowContentLineIndex !== -1 && (belowContentLineIndex === -2 || belowContentLineIndex < lineNumber - 1)) {
belowContentLineIndex = -1;
belowContentLineIndent = -1;
// must find next line with content
for (var lineIndex = lineNumber; lineIndex < lineCount; lineIndex++) {
var indent = this._computeIndentLevel(lineIndex);
if (indent >= 0) {
belowContentLineIndex = lineIndex;
belowContentLineIndent = indent;
break;
}
}
}
result[resultIndex] = this._getIndentLevelForWhitespaceLine(offSide, aboveContentLineIndent, belowContentLineIndent);
}
return result;
};
TextModel.prototype._getIndentLevelForWhitespaceLine = function (offSide, aboveContentLineIndent, belowContentLineIndent) {
if (aboveContentLineIndent === -1 || belowContentLineIndent === -1) {
// At the top or bottom of the file
return 0;
}
else if (aboveContentLineIndent < belowContentLineIndent) {
// we are inside the region above
return (1 + Math.floor(aboveContentLineIndent / this._options.indentSize));
}
else if (aboveContentLineIndent === belowContentLineIndent) {
// we are in between two regions
return Math.ceil(belowContentLineIndent / this._options.indentSize);
}
else {
if (offSide) {
// same level as region below
return Math.ceil(belowContentLineIndent / this._options.indentSize);
}
else {
// we are inside the region that ends below
return (1 + Math.floor(belowContentLineIndent / this._options.indentSize));
}
}
};
TextModel.MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB
TextModel.LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;
TextModel.LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines
TextModel.DEFAULT_CREATION_OPTIONS = {
isForSimpleWidget: false,
tabSize: editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].tabSize,
indentSize: editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].indentSize,
insertSpaces: editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].insertSpaces,
detectIndentation: false,
defaultEOL: 1 /* LF */,
trimAutoWhitespace: editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].trimAutoWhitespace,
largeFileOptimizations: editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].largeFileOptimizations,
};
return TextModel;
}(lifecycle["a" /* Disposable */]));
//#region Decorations
var textModel_DecorationsTrees = /** @class */ (function () {
function DecorationsTrees() {
this._decorationsTree0 = new IntervalTree();
this._decorationsTree1 = new IntervalTree();
}
DecorationsTrees.prototype.intervalSearch = function (start, end, filterOwnerId, filterOutValidation, cachedVersionId) {
var r0 = this._decorationsTree0.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId);
var r1 = this._decorationsTree1.intervalSearch(start, end, filterOwnerId, filterOutValidation, cachedVersionId);
return r0.concat(r1);
};
DecorationsTrees.prototype.search = function (filterOwnerId, filterOutValidation, overviewRulerOnly, cachedVersionId) {
if (overviewRulerOnly) {
return this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId);
}
else {
var r0 = this._decorationsTree0.search(filterOwnerId, filterOutValidation, cachedVersionId);
var r1 = this._decorationsTree1.search(filterOwnerId, filterOutValidation, cachedVersionId);
return r0.concat(r1);
}
};
DecorationsTrees.prototype.collectNodesFromOwner = function (ownerId) {
var r0 = this._decorationsTree0.collectNodesFromOwner(ownerId);
var r1 = this._decorationsTree1.collectNodesFromOwner(ownerId);
return r0.concat(r1);
};
DecorationsTrees.prototype.collectNodesPostOrder = function () {
var r0 = this._decorationsTree0.collectNodesPostOrder();
var r1 = this._decorationsTree1.collectNodesPostOrder();
return r0.concat(r1);
};
DecorationsTrees.prototype.insert = function (node) {
if (getNodeIsInOverviewRuler(node)) {
this._decorationsTree1.insert(node);
}
else {
this._decorationsTree0.insert(node);
}
};
DecorationsTrees.prototype.delete = function (node) {
if (getNodeIsInOverviewRuler(node)) {
this._decorationsTree1.delete(node);
}
else {
this._decorationsTree0.delete(node);
}
};
DecorationsTrees.prototype.resolveNode = function (node, cachedVersionId) {
if (getNodeIsInOverviewRuler(node)) {
this._decorationsTree1.resolveNode(node, cachedVersionId);
}
else {
this._decorationsTree0.resolveNode(node, cachedVersionId);
}
};
DecorationsTrees.prototype.acceptReplace = function (offset, length, textLength, forceMoveMarkers) {
this._decorationsTree0.acceptReplace(offset, length, textLength, forceMoveMarkers);
this._decorationsTree1.acceptReplace(offset, length, textLength, forceMoveMarkers);
};
return DecorationsTrees;
}());
function cleanClassName(className) {
return className.replace(/[^a-z0-9\-_]/gi, ' ');
}
var DecorationOptions = /** @class */ (function () {
function DecorationOptions(options) {
this.color = options.color || '';
this.darkColor = options.darkColor || '';
}
return DecorationOptions;
}());
var textModel_ModelDecorationOverviewRulerOptions = /** @class */ (function (_super) {
textModel_extends(ModelDecorationOverviewRulerOptions, _super);
function ModelDecorationOverviewRulerOptions(options) {
var _this = _super.call(this, options) || this;
_this._resolvedColor = null;
_this.position = (typeof options.position === 'number' ? options.position : model["d" /* OverviewRulerLane */].Center);
return _this;
}
ModelDecorationOverviewRulerOptions.prototype.getColor = function (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;
};
ModelDecorationOverviewRulerOptions.prototype.invalidateCachedColor = function () {
this._resolvedColor = null;
};
ModelDecorationOverviewRulerOptions.prototype._resolveColor = function (color, theme) {
if (typeof color === 'string') {
return color;
}
var c = color ? theme.getColor(color.id) : null;
if (!c) {
return '';
}
return c.toString();
};
return ModelDecorationOverviewRulerOptions;
}(DecorationOptions));
var textModel_ModelDecorationMinimapOptions = /** @class */ (function (_super) {
textModel_extends(ModelDecorationMinimapOptions, _super);
function ModelDecorationMinimapOptions(options) {
var _this = _super.call(this, options) || this;
_this.position = options.position;
return _this;
}
ModelDecorationMinimapOptions.prototype.getColor = function (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;
};
ModelDecorationMinimapOptions.prototype.invalidateCachedColor = function () {
this._resolvedColor = undefined;
};
ModelDecorationMinimapOptions.prototype._resolveColor = function (color, theme) {
if (typeof color === 'string') {
return common_color["a" /* Color */].fromHex(color);
}
return theme.getColor(color.id);
};
return ModelDecorationMinimapOptions;
}(DecorationOptions));
var textModel_ModelDecorationOptions = /** @class */ (function () {
function ModelDecorationOptions(options) {
this.stickiness = options.stickiness || 0 /* AlwaysGrowsWhenTypingAtEdges */;
this.zIndex = options.zIndex || 0;
this.className = options.className ? cleanClassName(options.className) : null;
this.hoverMessage = Object(types["o" /* withUndefinedAsNull */])(options.hoverMessage);
this.glyphMarginHoverMessage = Object(types["o" /* withUndefinedAsNull */])(options.glyphMarginHoverMessage);
this.isWholeLine = options.isWholeLine || false;
this.showIfCollapsed = options.showIfCollapsed || false;
this.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;
this.overviewRuler = options.overviewRuler ? new textModel_ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;
this.minimap = options.minimap ? new textModel_ModelDecorationMinimapOptions(options.minimap) : null;
this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;
this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;
this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;
this.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;
this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;
this.beforeContentClassName = options.beforeContentClassName ? cleanClassName(options.beforeContentClassName) : null;
this.afterContentClassName = options.afterContentClassName ? cleanClassName(options.afterContentClassName) : null;
}
ModelDecorationOptions.register = function (options) {
return new ModelDecorationOptions(options);
};
ModelDecorationOptions.createDynamic = function (options) {
return new ModelDecorationOptions(options);
};
return ModelDecorationOptions;
}());
textModel_ModelDecorationOptions.EMPTY = textModel_ModelDecorationOptions.register({});
/**
* The order carefully matches the values of the enum.
*/
var TRACKED_RANGE_OPTIONS = [
textModel_ModelDecorationOptions.register({ stickiness: 0 /* AlwaysGrowsWhenTypingAtEdges */ }),
textModel_ModelDecorationOptions.register({ stickiness: 1 /* NeverGrowsWhenTypingAtEdges */ }),
textModel_ModelDecorationOptions.register({ stickiness: 2 /* GrowsOnlyWhenTypingBefore */ }),
textModel_ModelDecorationOptions.register({ stickiness: 3 /* GrowsOnlyWhenTypingAfter */ }),
];
function _normalizeOptions(options) {
if (options instanceof textModel_ModelDecorationOptions) {
return options;
}
return textModel_ModelDecorationOptions.createDynamic(options);
}
var textModel_DidChangeDecorationsEmitter = /** @class */ (function (_super) {
textModel_extends(DidChangeDecorationsEmitter, _super);
function DidChangeDecorationsEmitter() {
var _this = _super.call(this) || this;
_this._actual = _this._register(new common_event["a" /* Emitter */]());
_this.event = _this._actual.event;
_this._deferredCnt = 0;
_this._shouldFire = false;
return _this;
}
DidChangeDecorationsEmitter.prototype.beginDeferredEmit = function () {
this._deferredCnt++;
};
DidChangeDecorationsEmitter.prototype.endDeferredEmit = function () {
this._deferredCnt--;
if (this._deferredCnt === 0) {
if (this._shouldFire) {
this._shouldFire = false;
this._actual.fire({});
}
}
};
DidChangeDecorationsEmitter.prototype.fire = function () {
this._shouldFire = true;
};
return DidChangeDecorationsEmitter;
}(lifecycle["a" /* Disposable */]));
//#endregion
var textModel_DidChangeContentEmitter = /** @class */ (function (_super) {
textModel_extends(DidChangeContentEmitter, _super);
function DidChangeContentEmitter() {
var _this = _super.call(this) || this;
/**
* Both `fastEvent` and `slowEvent` work the same way and contain the same events, but first we invoke `fastEvent` and then `slowEvent`.
*/
_this._fastEmitter = _this._register(new common_event["a" /* Emitter */]());
_this.fastEvent = _this._fastEmitter.event;
_this._slowEmitter = _this._register(new common_event["a" /* Emitter */]());
_this.slowEvent = _this._slowEmitter.event;
_this._deferredCnt = 0;
_this._deferredEvent = null;
return _this;
}
DidChangeContentEmitter.prototype.beginDeferredEmit = function () {
this._deferredCnt++;
};
DidChangeContentEmitter.prototype.endDeferredEmit = function () {
this._deferredCnt--;
if (this._deferredCnt === 0) {
if (this._deferredEvent !== null) {
var e = this._deferredEvent;
this._deferredEvent = null;
this._fastEmitter.fire(e);
this._slowEmitter.fire(e);
}
}
};
DidChangeContentEmitter.prototype.fire = function (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);
};
return DidChangeContentEmitter;
}(lifecycle["a" /* Disposable */]));
/***/ }),
/* 31 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CancellationToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CancellationTokenSource; });
/* harmony import */ var _event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var shortcutEvent = Object.freeze(function (callback, context) {
var handle = setTimeout(callback.bind(context), 0);
return { dispose: function () { clearTimeout(handle); } };
});
var CancellationToken;
(function (CancellationToken) {
function isCancellationToken(thing) {
if (thing === CancellationToken.None || thing === CancellationToken.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';
}
CancellationToken.isCancellationToken = isCancellationToken;
CancellationToken.None = Object.freeze({
isCancellationRequested: false,
onCancellationRequested: _event_js__WEBPACK_IMPORTED_MODULE_0__[/* Event */ "b"].None
});
CancellationToken.Cancelled = Object.freeze({
isCancellationRequested: true,
onCancellationRequested: shortcutEvent
});
})(CancellationToken || (CancellationToken = {}));
var MutableToken = /** @class */ (function () {
function MutableToken() {
this._isCancelled = false;
this._emitter = null;
}
MutableToken.prototype.cancel = function () {
if (!this._isCancelled) {
this._isCancelled = true;
if (this._emitter) {
this._emitter.fire(undefined);
this.dispose();
}
}
};
Object.defineProperty(MutableToken.prototype, "isCancellationRequested", {
get: function () {
return this._isCancelled;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MutableToken.prototype, "onCancellationRequested", {
get: function () {
if (this._isCancelled) {
return shortcutEvent;
}
if (!this._emitter) {
this._emitter = new _event_js__WEBPACK_IMPORTED_MODULE_0__[/* Emitter */ "a"]();
}
return this._emitter.event;
},
enumerable: true,
configurable: true
});
MutableToken.prototype.dispose = function () {
if (this._emitter) {
this._emitter.dispose();
this._emitter = null;
}
};
return MutableToken;
}());
var CancellationTokenSource = /** @class */ (function () {
function CancellationTokenSource(parent) {
this._token = undefined;
this._parentListener = undefined;
this._parentListener = parent && parent.onCancellationRequested(this.cancel, this);
}
Object.defineProperty(CancellationTokenSource.prototype, "token", {
get: function () {
if (!this._token) {
// be lazy and create the token only when
// actually needed
this._token = new MutableToken();
}
return this._token;
},
enumerable: true,
configurable: true
});
CancellationTokenSource.prototype.cancel = function () {
if (!this._token) {
// save an object by returning the default
// cancelled token when cancellation happens
// before someone asks for the token
this._token = CancellationToken.Cancelled;
}
else if (this._token instanceof MutableToken) {
// actually cancel
this._token.cancel();
}
};
CancellationTokenSource.prototype.dispose = function (cancel) {
if (cancel === void 0) { cancel = false; }
if (cancel) {
this.cancel();
}
if (this._parentListener) {
this._parentListener.dispose();
}
if (!this._token) {
// ensure to initialize with an empty token if we had none
this._token = CancellationToken.None;
}
else if (this._token instanceof MutableToken) {
// actually dispose
this._token.dispose();
}
};
return CancellationTokenSource;
}());
/***/ }),
/* 32 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AccessibilityHelpNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return InspectTokensNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GoToLineNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return QuickCommandNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return QuickOutlineNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return StandaloneCodeEditorNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ToggleHighContrastNLS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return SimpleServicesNLS; });
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var AccessibilityHelpNLS;
(function (AccessibilityHelpNLS) {
AccessibilityHelpNLS.noSelection = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("noSelection", "No selection");
AccessibilityHelpNLS.singleSelectionRange = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("singleSelectionRange", "Line {0}, Column {1} ({2} selected)");
AccessibilityHelpNLS.singleSelection = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("singleSelection", "Line {0}, Column {1}");
AccessibilityHelpNLS.multiSelectionRange = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("multiSelectionRange", "{0} selections ({1} characters selected)");
AccessibilityHelpNLS.multiSelection = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("multiSelection", "{0} selections");
AccessibilityHelpNLS.emergencyConfOn = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("emergencyConfOn", "Now changing the setting `accessibilitySupport` to 'on'.");
AccessibilityHelpNLS.openingDocs = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("openingDocs", "Now opening the Editor Accessibility documentation page.");
AccessibilityHelpNLS.readonlyDiffEditor = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("readonlyDiffEditor", " in a read-only pane of a diff editor.");
AccessibilityHelpNLS.editableDiffEditor = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("editableDiffEditor", " in a pane of a diff editor.");
AccessibilityHelpNLS.readonlyEditor = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("readonlyEditor", " in a read-only code editor");
AccessibilityHelpNLS.editableEditor = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("editableEditor", " in a code editor");
AccessibilityHelpNLS.changeConfigToOnMac = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("changeConfigToOnMac", "To configure the editor to be optimized for usage with a Screen Reader press Command+E now.");
AccessibilityHelpNLS.changeConfigToOnWinLinux = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("changeConfigToOnWinLinux", "To configure the editor to be optimized for usage with a Screen Reader press Control+E now.");
AccessibilityHelpNLS.auto_on = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("auto_on", "The editor is configured to be optimized for usage with a Screen Reader.");
AccessibilityHelpNLS.auto_off = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("auto_off", "The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time.");
AccessibilityHelpNLS.tabFocusModeOnMsg = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("tabFocusModeOnMsg", "Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}.");
AccessibilityHelpNLS.tabFocusModeOnMsgNoKb = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("tabFocusModeOnMsgNoKb", "Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding.");
AccessibilityHelpNLS.tabFocusModeOffMsg = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("tabFocusModeOffMsg", "Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}.");
AccessibilityHelpNLS.tabFocusModeOffMsgNoKb = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("tabFocusModeOffMsgNoKb", "Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding.");
AccessibilityHelpNLS.openDocMac = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("openDocMac", "Press Command+H now to open a browser window with more information related to editor accessibility.");
AccessibilityHelpNLS.openDocWinLinux = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("openDocWinLinux", "Press Control+H now to open a browser window with more information related to editor accessibility.");
AccessibilityHelpNLS.outroMsg = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("outroMsg", "You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape.");
AccessibilityHelpNLS.showAccessibilityHelpAction = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]("showAccessibilityHelpAction", "Show Accessibility Help");
})(AccessibilityHelpNLS || (AccessibilityHelpNLS = {}));
var InspectTokensNLS;
(function (InspectTokensNLS) {
InspectTokensNLS.inspectTokensAction = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('inspectTokens', "Developer: Inspect Tokens");
})(InspectTokensNLS || (InspectTokensNLS = {}));
var GoToLineNLS;
(function (GoToLineNLS) {
GoToLineNLS.gotoLineLabelValidLineAndColumn = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineLabelValidLineAndColumn', "Go to line {0} and character {1}");
GoToLineNLS.gotoLineLabelValidLine = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineLabelValidLine', "Go to line {0}");
GoToLineNLS.gotoLineLabelEmptyWithLineLimit = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineLabelEmptyWithLineLimit', "Type a line number between 1 and {0} to navigate to");
GoToLineNLS.gotoLineLabelEmptyWithLineAndColumnLimit = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineLabelEmptyWithLineAndColumnLimit', "Type a character between 1 and {0} to navigate to");
GoToLineNLS.gotoLineAriaLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineAriaLabel', "Current Line: {0}. Go to line {1}.");
GoToLineNLS.gotoLineActionInput = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineActionInput', "Type a line number, followed by an optional colon and a character number to navigate to");
GoToLineNLS.gotoLineActionLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('gotoLineActionLabel', "Go to Line...");
})(GoToLineNLS || (GoToLineNLS = {}));
var QuickCommandNLS;
(function (QuickCommandNLS) {
QuickCommandNLS.ariaLabelEntryWithKey = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('ariaLabelEntryWithKey', "{0}, {1}, commands");
QuickCommandNLS.ariaLabelEntry = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('ariaLabelEntry', "{0}, commands");
QuickCommandNLS.quickCommandActionInput = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickCommandActionInput', "Type the name of an action you want to execute");
QuickCommandNLS.quickCommandActionLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickCommandActionLabel', "Command Palette");
})(QuickCommandNLS || (QuickCommandNLS = {}));
var QuickOutlineNLS;
(function (QuickOutlineNLS) {
QuickOutlineNLS.entryAriaLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('entryAriaLabel', "{0}, symbols");
QuickOutlineNLS.quickOutlineActionInput = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickOutlineActionInput', "Type the name of an identifier you wish to navigate to");
QuickOutlineNLS.quickOutlineActionLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('quickOutlineActionLabel', "Go to Symbol...");
QuickOutlineNLS._symbols_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('symbols', "symbols ({0})");
QuickOutlineNLS._modules_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('modules', "modules ({0})");
QuickOutlineNLS._class_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('class', "classes ({0})");
QuickOutlineNLS._interface_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('interface', "interfaces ({0})");
QuickOutlineNLS._method_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('method', "methods ({0})");
QuickOutlineNLS._function_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('function', "functions ({0})");
QuickOutlineNLS._property_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('property', "properties ({0})");
QuickOutlineNLS._variable_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('variable', "variables ({0})");
QuickOutlineNLS._variable2_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('variable2', "variables ({0})");
QuickOutlineNLS._constructor_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('_constructor', "constructors ({0})");
QuickOutlineNLS._call_ = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('call', "calls ({0})");
})(QuickOutlineNLS || (QuickOutlineNLS = {}));
var StandaloneCodeEditorNLS;
(function (StandaloneCodeEditorNLS) {
StandaloneCodeEditorNLS.editorViewAccessibleLabel = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorViewAccessibleLabel', "Editor content");
StandaloneCodeEditorNLS.accessibilityHelpMessageIE = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilityHelpMessageIE', "Press Ctrl+F1 for Accessibility Options.");
StandaloneCodeEditorNLS.accessibilityHelpMessage = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('accessibilityHelpMessage', "Press Alt+F1 for Accessibility Options.");
})(StandaloneCodeEditorNLS || (StandaloneCodeEditorNLS = {}));
var ToggleHighContrastNLS;
(function (ToggleHighContrastNLS) {
ToggleHighContrastNLS.toggleHighContrast = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('toggleHighContrast', "Toggle High Contrast Theme");
})(ToggleHighContrastNLS || (ToggleHighContrastNLS = {}));
var SimpleServicesNLS;
(function (SimpleServicesNLS) {
SimpleServicesNLS.bulkEditServiceSummary = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('bulkEditServiceSummary', "Made {0} edits in {1} files");
})(SimpleServicesNLS || (SimpleServicesNLS = {}));
/***/ }),
/* 33 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ LanguageConfigurationRegistry; });
// UNUSED EXPORTS: RichEditSupport, LanguageConfigurationChangeEvent, LanguageConfigurationRegistryImpl
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/wordHelper.js
var wordHelper = __webpack_require__(123);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfiguration.js
var languageConfiguration = __webpack_require__(56);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports.js
var supports = __webpack_require__(96);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/characterPair.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var characterPair_CharacterPairSupport = /** @class */ (function () {
function CharacterPairSupport(config) {
if (config.autoClosingPairs) {
this._autoClosingPairs = config.autoClosingPairs.map(function (el) { return new languageConfiguration["b" /* StandardAutoClosingPairConditional */](el); });
}
else if (config.brackets) {
this._autoClosingPairs = config.brackets.map(function (b) { return new languageConfiguration["b" /* StandardAutoClosingPairConditional */]({ open: b[0], close: b[1] }); });
}
else {
this._autoClosingPairs = [];
}
if (config.__electricCharacterSupport && config.__electricCharacterSupport.docComment) {
var docComment = config.__electricCharacterSupport.docComment;
// IDocComment is legacy, only partially supported
this._autoClosingPairs.push(new languageConfiguration["b" /* StandardAutoClosingPairConditional */]({ open: docComment.open, close: docComment.close || '' }));
}
this._autoCloseBefore = typeof config.autoCloseBefore === 'string' ? config.autoCloseBefore : CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED;
this._surroundingPairs = config.surroundingPairs || this._autoClosingPairs;
}
CharacterPairSupport.prototype.getAutoClosingPairs = function () {
return this._autoClosingPairs;
};
CharacterPairSupport.prototype.getAutoCloseBeforeSet = function () {
return this._autoCloseBefore;
};
CharacterPairSupport.shouldAutoClosePair = function (autoClosingPair, context, column) {
// Always complete on empty line
if (context.getTokenCount() === 0) {
return true;
}
var tokenIndex = context.findTokenIndexAtOffset(column - 2);
var standardTokenType = context.getStandardTokenType(tokenIndex);
return autoClosingPair.isOK(standardTokenType);
};
CharacterPairSupport.prototype.getSurroundingPairs = function () {
return this._surroundingPairs;
};
CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED = ';:.,=}])> \n\t';
return CharacterPairSupport;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/richEditBrackets.js
var richEditBrackets = __webpack_require__(99);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/electricCharacter.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var electricCharacter_BracketElectricCharacterSupport = /** @class */ (function () {
function BracketElectricCharacterSupport(richEditBrackets) {
this._richEditBrackets = richEditBrackets;
}
BracketElectricCharacterSupport.prototype.getElectricCharacters = function () {
var result = [];
if (this._richEditBrackets) {
for (var _i = 0, _a = this._richEditBrackets.brackets; _i < _a.length; _i++) {
var bracket = _a[_i];
for (var _b = 0, _c = bracket.close; _b < _c.length; _b++) {
var close_1 = _c[_b];
var lastChar = close_1.charAt(close_1.length - 1);
result.push(lastChar);
}
}
}
// Filter duplicate entries
result = result.filter(function (item, pos, array) {
return array.indexOf(item) === pos;
});
return result;
};
BracketElectricCharacterSupport.prototype.onElectricCharacter = function (character, context, column) {
if (!this._richEditBrackets || this._richEditBrackets.brackets.length === 0) {
return null;
}
var tokenIndex = context.findTokenIndexAtOffset(column - 1);
if (Object(supports["b" /* ignoreBracketsInToken */])(context.getStandardTokenType(tokenIndex))) {
return null;
}
var reversedBracketRegex = this._richEditBrackets.reversedRegex;
var text = context.getLineContent().substring(0, column - 1) + character;
var r = richEditBrackets["a" /* BracketsUtils */].findPrevBracketInRange(reversedBracketRegex, 1, text, 0, text.length);
if (!r) {
return null;
}
var bracketText = text.substring(r.startColumn - 1, r.endColumn - 1).toLowerCase();
var isOpen = this._richEditBrackets.textIsOpenBracket[bracketText];
if (isOpen) {
return null;
}
var textBeforeBracket = context.getActualLineContentBefore(r.startColumn - 1);
if (!/^\s*$/.test(textBeforeBracket)) {
// There is other text on the line before the bracket
return null;
}
return {
matchOpenBracket: bracketText
};
};
return BracketElectricCharacterSupport;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/indentRules.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IndentRulesSupport = /** @class */ (function () {
function IndentRulesSupport(indentationRules) {
this._indentationRules = indentationRules;
}
IndentRulesSupport.prototype.shouldIncrease = function (text) {
if (this._indentationRules) {
if (this._indentationRules.increaseIndentPattern && this._indentationRules.increaseIndentPattern.test(text)) {
return true;
}
// if (this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {
// return true;
// }
}
return false;
};
IndentRulesSupport.prototype.shouldDecrease = function (text) {
if (this._indentationRules && this._indentationRules.decreaseIndentPattern && this._indentationRules.decreaseIndentPattern.test(text)) {
return true;
}
return false;
};
IndentRulesSupport.prototype.shouldIndentNextLine = function (text) {
if (this._indentationRules && this._indentationRules.indentNextLinePattern && this._indentationRules.indentNextLinePattern.test(text)) {
return true;
}
return false;
};
IndentRulesSupport.prototype.shouldIgnore = function (text) {
// the text matches `unIndentedLinePattern`
if (this._indentationRules && this._indentationRules.unIndentedLinePattern && this._indentationRules.unIndentedLinePattern.test(text)) {
return true;
}
return false;
};
IndentRulesSupport.prototype.getIndentMetadata = function (text) {
var ret = 0;
if (this.shouldIncrease(text)) {
ret += 1 /* INCREASE_MASK */;
}
if (this.shouldDecrease(text)) {
ret += 2 /* DECREASE_MASK */;
}
if (this.shouldIndentNextLine(text)) {
ret += 4 /* INDENT_NEXTLINE_MASK */;
}
if (this.shouldIgnore(text)) {
ret += 8 /* UNINDENT_MASK */;
}
return ret;
};
return IndentRulesSupport;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/onEnter.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var onEnter_OnEnterSupport = /** @class */ (function () {
function OnEnterSupport(opts) {
var _this = this;
opts = opts || {};
opts.brackets = opts.brackets || [
['(', ')'],
['{', '}'],
['[', ']']
];
this._brackets = [];
opts.brackets.forEach(function (bracket) {
var openRegExp = OnEnterSupport._createOpenBracketRegExp(bracket[0]);
var closeRegExp = OnEnterSupport._createCloseBracketRegExp(bracket[1]);
if (openRegExp && closeRegExp) {
_this._brackets.push({
open: bracket[0],
openRegExp: openRegExp,
close: bracket[1],
closeRegExp: closeRegExp,
});
}
});
this._regExpRules = opts.onEnterRules || [];
}
OnEnterSupport.prototype.onEnter = function (autoIndent, oneLineAboveText, beforeEnterText, afterEnterText) {
// (1): `regExpRules`
if (autoIndent >= 3 /* Advanced */) {
for (var i = 0, len = this._regExpRules.length; i < len; i++) {
var rule = this._regExpRules[i];
var regResult = [{
reg: rule.beforeText,
text: beforeEnterText
}, {
reg: rule.afterText,
text: afterEnterText
}, {
reg: rule.oneLineAboveText,
text: oneLineAboveText
}].every(function (obj) {
return obj.reg ? obj.reg.test(obj.text) : true;
});
if (regResult) {
return rule.action;
}
}
}
// (2): Special indent-outdent
if (autoIndent >= 2 /* Brackets */) {
if (beforeEnterText.length > 0 && afterEnterText.length > 0) {
for (var i = 0, len = this._brackets.length; i < len; i++) {
var bracket = this._brackets[i];
if (bracket.openRegExp.test(beforeEnterText) && bracket.closeRegExp.test(afterEnterText)) {
return { indentAction: languageConfiguration["a" /* IndentAction */].IndentOutdent };
}
}
}
}
// (4): Open bracket based logic
if (autoIndent >= 2 /* Brackets */) {
if (beforeEnterText.length > 0) {
for (var i = 0, len = this._brackets.length; i < len; i++) {
var bracket = this._brackets[i];
if (bracket.openRegExp.test(beforeEnterText)) {
return { indentAction: languageConfiguration["a" /* IndentAction */].Indent };
}
}
}
}
return null;
};
OnEnterSupport._createOpenBracketRegExp = function (bracket) {
var str = strings["p" /* escapeRegExpCharacters */](bracket);
if (!/\B/.test(str.charAt(0))) {
str = '\\b' + str;
}
str += '\\s*$';
return OnEnterSupport._safeRegExp(str);
};
OnEnterSupport._createCloseBracketRegExp = function (bracket) {
var str = strings["p" /* escapeRegExpCharacters */](bracket);
if (!/\B/.test(str.charAt(str.length - 1))) {
str = str + '\\b';
}
str = '^\\s*' + str;
return OnEnterSupport._safeRegExp(str);
};
OnEnterSupport._safeRegExp = function (def) {
try {
return new RegExp(def);
}
catch (err) {
Object(errors["e" /* onUnexpectedError */])(err);
return null;
}
};
return OnEnterSupport;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfigurationRegistry.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var languageConfigurationRegistry_RichEditSupport = /** @class */ (function () {
function RichEditSupport(languageIdentifier, previous, rawConf) {
this._languageIdentifier = languageIdentifier;
this._brackets = null;
this._electricCharacter = null;
var prev = null;
if (previous) {
prev = previous._conf;
}
this._conf = RichEditSupport._mergeConf(prev, rawConf);
this._onEnterSupport = (this._conf.brackets || this._conf.indentationRules || this._conf.onEnterRules ? new onEnter_OnEnterSupport(this._conf) : null);
this.comments = RichEditSupport._handleComments(this._conf);
this.characterPair = new characterPair_CharacterPairSupport(this._conf);
this.wordDefinition = this._conf.wordPattern || wordHelper["a" /* DEFAULT_WORD_REGEXP */];
this.indentationRules = this._conf.indentationRules;
if (this._conf.indentationRules) {
this.indentRulesSupport = new IndentRulesSupport(this._conf.indentationRules);
}
else {
this.indentRulesSupport = null;
}
this.foldingRules = this._conf.folding || {};
}
Object.defineProperty(RichEditSupport.prototype, "brackets", {
get: function () {
if (!this._brackets && this._conf.brackets) {
this._brackets = new richEditBrackets["b" /* RichEditBrackets */](this._languageIdentifier, this._conf.brackets);
}
return this._brackets;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RichEditSupport.prototype, "electricCharacter", {
get: function () {
if (!this._electricCharacter) {
this._electricCharacter = new electricCharacter_BracketElectricCharacterSupport(this.brackets);
}
return this._electricCharacter;
},
enumerable: true,
configurable: true
});
RichEditSupport.prototype.onEnter = function (autoIndent, oneLineAboveText, beforeEnterText, afterEnterText) {
if (!this._onEnterSupport) {
return null;
}
return this._onEnterSupport.onEnter(autoIndent, oneLineAboveText, beforeEnterText, afterEnterText);
};
RichEditSupport._mergeConf = function (prev, current) {
return {
comments: (prev ? current.comments || prev.comments : current.comments),
brackets: (prev ? current.brackets || prev.brackets : current.brackets),
wordPattern: (prev ? current.wordPattern || prev.wordPattern : current.wordPattern),
indentationRules: (prev ? current.indentationRules || prev.indentationRules : current.indentationRules),
onEnterRules: (prev ? current.onEnterRules || prev.onEnterRules : current.onEnterRules),
autoClosingPairs: (prev ? current.autoClosingPairs || prev.autoClosingPairs : current.autoClosingPairs),
surroundingPairs: (prev ? current.surroundingPairs || prev.surroundingPairs : current.surroundingPairs),
autoCloseBefore: (prev ? current.autoCloseBefore || prev.autoCloseBefore : current.autoCloseBefore),
folding: (prev ? current.folding || prev.folding : current.folding),
__electricCharacterSupport: (prev ? current.__electricCharacterSupport || prev.__electricCharacterSupport : current.__electricCharacterSupport),
};
};
RichEditSupport._handleComments = function (conf) {
var commentRule = conf.comments;
if (!commentRule) {
return null;
}
// comment configuration
var comments = {};
if (commentRule.lineComment) {
comments.lineCommentToken = commentRule.lineComment;
}
if (commentRule.blockComment) {
var _a = commentRule.blockComment, blockStart = _a[0], blockEnd = _a[1];
comments.blockCommentStartToken = blockStart;
comments.blockCommentEndToken = blockEnd;
}
return comments;
};
return RichEditSupport;
}());
var LanguageConfigurationChangeEvent = /** @class */ (function () {
function LanguageConfigurationChangeEvent(languageIdentifier) {
this.languageIdentifier = languageIdentifier;
}
return LanguageConfigurationChangeEvent;
}());
var languageConfigurationRegistry_LanguageConfigurationRegistryImpl = /** @class */ (function () {
function LanguageConfigurationRegistryImpl() {
this._entries = new Map();
this._onDidChange = new common_event["a" /* Emitter */]();
this.onDidChange = this._onDidChange.event;
}
LanguageConfigurationRegistryImpl.prototype.register = function (languageIdentifier, configuration) {
var _this = this;
var previous = this._getRichEditSupport(languageIdentifier.id);
var current = new languageConfigurationRegistry_RichEditSupport(languageIdentifier, previous, configuration);
this._entries.set(languageIdentifier.id, current);
this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageIdentifier));
return Object(lifecycle["h" /* toDisposable */])(function () {
if (_this._entries.get(languageIdentifier.id) === current) {
_this._entries.set(languageIdentifier.id, previous);
_this._onDidChange.fire(new LanguageConfigurationChangeEvent(languageIdentifier));
}
});
};
LanguageConfigurationRegistryImpl.prototype._getRichEditSupport = function (languageId) {
return this._entries.get(languageId);
};
// begin electricCharacter
LanguageConfigurationRegistryImpl.prototype._getElectricCharacterSupport = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return null;
}
return value.electricCharacter || null;
};
LanguageConfigurationRegistryImpl.prototype.getElectricCharacters = function (languageId) {
var electricCharacterSupport = this._getElectricCharacterSupport(languageId);
if (!electricCharacterSupport) {
return [];
}
return electricCharacterSupport.getElectricCharacters();
};
/**
* Should return opening bracket type to match indentation with
*/
LanguageConfigurationRegistryImpl.prototype.onElectricCharacter = function (character, context, column) {
var scopedLineTokens = Object(supports["a" /* createScopedLineTokens */])(context, column - 1);
var electricCharacterSupport = this._getElectricCharacterSupport(scopedLineTokens.languageId);
if (!electricCharacterSupport) {
return null;
}
return electricCharacterSupport.onElectricCharacter(character, scopedLineTokens, column - scopedLineTokens.firstCharOffset);
};
// end electricCharacter
LanguageConfigurationRegistryImpl.prototype.getComments = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return null;
}
return value.comments || null;
};
// begin characterPair
LanguageConfigurationRegistryImpl.prototype._getCharacterPairSupport = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return null;
}
return value.characterPair || null;
};
LanguageConfigurationRegistryImpl.prototype.getAutoClosingPairs = function (languageId) {
var characterPairSupport = this._getCharacterPairSupport(languageId);
if (!characterPairSupport) {
return [];
}
return characterPairSupport.getAutoClosingPairs();
};
LanguageConfigurationRegistryImpl.prototype.getAutoCloseBeforeSet = function (languageId) {
var characterPairSupport = this._getCharacterPairSupport(languageId);
if (!characterPairSupport) {
return characterPair_CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED;
}
return characterPairSupport.getAutoCloseBeforeSet();
};
LanguageConfigurationRegistryImpl.prototype.getSurroundingPairs = function (languageId) {
var characterPairSupport = this._getCharacterPairSupport(languageId);
if (!characterPairSupport) {
return [];
}
return characterPairSupport.getSurroundingPairs();
};
LanguageConfigurationRegistryImpl.prototype.shouldAutoClosePair = function (autoClosingPair, context, column) {
var scopedLineTokens = Object(supports["a" /* createScopedLineTokens */])(context, column - 1);
return characterPair_CharacterPairSupport.shouldAutoClosePair(autoClosingPair, scopedLineTokens, column - scopedLineTokens.firstCharOffset);
};
// end characterPair
LanguageConfigurationRegistryImpl.prototype.getWordDefinition = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return Object(wordHelper["c" /* ensureValidWordDefinition */])(null);
}
return Object(wordHelper["c" /* ensureValidWordDefinition */])(value.wordDefinition || null);
};
LanguageConfigurationRegistryImpl.prototype.getFoldingRules = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return {};
}
return value.foldingRules;
};
// begin Indent Rules
LanguageConfigurationRegistryImpl.prototype.getIndentRulesSupport = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return null;
}
return value.indentRulesSupport || null;
};
/**
* Get nearest preceiding line which doesn't match unIndentPattern or contains all whitespace.
* Result:
* -1: run into the boundary of embedded languages
* 0: every line above are invalid
* else: nearest preceding line of the same language
*/
LanguageConfigurationRegistryImpl.prototype.getPrecedingValidLine = function (model, lineNumber, indentRulesSupport) {
var languageID = model.getLanguageIdAtPosition(lineNumber, 0);
if (lineNumber > 1) {
var lastLineNumber = void 0;
var resultLineNumber = -1;
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
if (model.getLanguageIdAtPosition(lastLineNumber, 0) !== languageID) {
return resultLineNumber;
}
var text = model.getLineContent(lastLineNumber);
if (indentRulesSupport.shouldIgnore(text) || /^\s+$/.test(text) || text === '') {
resultLineNumber = lastLineNumber;
continue;
}
return lastLineNumber;
}
}
return -1;
};
/**
* Get inherited indentation from above lines.
* 1. Find the nearest preceding line which doesn't match unIndentedLinePattern.
* 2. If this line matches indentNextLinePattern or increaseIndentPattern, it means that the indent level of `lineNumber` should be 1 greater than this line.
* 3. If this line doesn't match any indent rules
* a. check whether the line above it matches indentNextLinePattern
* b. If not, the indent level of this line is the result
* c. If so, it means the indent of this line is *temporary*, go upward utill we find a line whose indent is not temporary (the same workflow a -> b -> c).
* 4. Otherwise, we fail to get an inherited indent from aboves. Return null and we should not touch the indent of `lineNumber`
*
* This function only return the inherited indent based on above lines, it doesn't check whether current line should decrease or not.
*/
LanguageConfigurationRegistryImpl.prototype.getInheritIndentForLine = function (autoIndent, model, lineNumber, honorIntentialIndent) {
if (honorIntentialIndent === void 0) { honorIntentialIndent = true; }
if (autoIndent < 4 /* Full */) {
return null;
}
var indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);
if (!indentRulesSupport) {
return null;
}
if (lineNumber <= 1) {
return {
indentation: '',
action: null
};
}
var precedingUnIgnoredLine = this.getPrecedingValidLine(model, lineNumber, indentRulesSupport);
if (precedingUnIgnoredLine < 0) {
return null;
}
else if (precedingUnIgnoredLine < 1) {
return {
indentation: '',
action: null
};
}
var precedingUnIgnoredLineContent = model.getLineContent(precedingUnIgnoredLine);
if (indentRulesSupport.shouldIncrease(precedingUnIgnoredLineContent) || indentRulesSupport.shouldIndentNextLine(precedingUnIgnoredLineContent)) {
return {
indentation: strings["t" /* getLeadingWhitespace */](precedingUnIgnoredLineContent),
action: languageConfiguration["a" /* IndentAction */].Indent,
line: precedingUnIgnoredLine
};
}
else if (indentRulesSupport.shouldDecrease(precedingUnIgnoredLineContent)) {
return {
indentation: strings["t" /* getLeadingWhitespace */](precedingUnIgnoredLineContent),
action: null,
line: precedingUnIgnoredLine
};
}
else {
// precedingUnIgnoredLine can not be ignored.
// it doesn't increase indent of following lines
// it doesn't increase just next line
// so current line is not affect by precedingUnIgnoredLine
// and then we should get a correct inheritted indentation from above lines
if (precedingUnIgnoredLine === 1) {
return {
indentation: strings["t" /* getLeadingWhitespace */](model.getLineContent(precedingUnIgnoredLine)),
action: null,
line: precedingUnIgnoredLine
};
}
var previousLine = precedingUnIgnoredLine - 1;
var previousLineIndentMetadata = indentRulesSupport.getIndentMetadata(model.getLineContent(previousLine));
if (!(previousLineIndentMetadata & (1 /* INCREASE_MASK */ | 2 /* DECREASE_MASK */)) &&
(previousLineIndentMetadata & 4 /* INDENT_NEXTLINE_MASK */)) {
var stopLine = 0;
for (var i = previousLine - 1; i > 0; i--) {
if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {
continue;
}
stopLine = i;
break;
}
return {
indentation: strings["t" /* getLeadingWhitespace */](model.getLineContent(stopLine + 1)),
action: null,
line: stopLine + 1
};
}
if (honorIntentialIndent) {
return {
indentation: strings["t" /* getLeadingWhitespace */](model.getLineContent(precedingUnIgnoredLine)),
action: null,
line: precedingUnIgnoredLine
};
}
else {
// search from precedingUnIgnoredLine until we find one whose indent is not temporary
for (var i = precedingUnIgnoredLine; i > 0; i--) {
var lineContent = model.getLineContent(i);
if (indentRulesSupport.shouldIncrease(lineContent)) {
return {
indentation: strings["t" /* getLeadingWhitespace */](lineContent),
action: languageConfiguration["a" /* IndentAction */].Indent,
line: i
};
}
else if (indentRulesSupport.shouldIndentNextLine(lineContent)) {
var stopLine = 0;
for (var j = i - 1; j > 0; j--) {
if (indentRulesSupport.shouldIndentNextLine(model.getLineContent(i))) {
continue;
}
stopLine = j;
break;
}
return {
indentation: strings["t" /* getLeadingWhitespace */](model.getLineContent(stopLine + 1)),
action: null,
line: stopLine + 1
};
}
else if (indentRulesSupport.shouldDecrease(lineContent)) {
return {
indentation: strings["t" /* getLeadingWhitespace */](lineContent),
action: null,
line: i
};
}
}
return {
indentation: strings["t" /* getLeadingWhitespace */](model.getLineContent(1)),
action: null,
line: 1
};
}
}
};
LanguageConfigurationRegistryImpl.prototype.getGoodIndentForLine = function (autoIndent, virtualModel, languageId, lineNumber, indentConverter) {
if (autoIndent < 4 /* Full */) {
return null;
}
var richEditSupport = this._getRichEditSupport(languageId);
if (!richEditSupport) {
return null;
}
var indentRulesSupport = this.getIndentRulesSupport(languageId);
if (!indentRulesSupport) {
return null;
}
var indent = this.getInheritIndentForLine(autoIndent, virtualModel, lineNumber);
var lineContent = virtualModel.getLineContent(lineNumber);
if (indent) {
var inheritLine = indent.line;
if (inheritLine !== undefined) {
var enterResult = richEditSupport.onEnter(autoIndent, '', virtualModel.getLineContent(inheritLine), '');
if (enterResult) {
var indentation = strings["t" /* getLeadingWhitespace */](virtualModel.getLineContent(inheritLine));
if (enterResult.removeText) {
indentation = indentation.substring(0, indentation.length - enterResult.removeText);
}
if ((enterResult.indentAction === languageConfiguration["a" /* IndentAction */].Indent) ||
(enterResult.indentAction === languageConfiguration["a" /* IndentAction */].IndentOutdent)) {
indentation = indentConverter.shiftIndent(indentation);
}
else if (enterResult.indentAction === languageConfiguration["a" /* IndentAction */].Outdent) {
indentation = indentConverter.unshiftIndent(indentation);
}
if (indentRulesSupport.shouldDecrease(lineContent)) {
indentation = indentConverter.unshiftIndent(indentation);
}
if (enterResult.appendText) {
indentation += enterResult.appendText;
}
return strings["t" /* getLeadingWhitespace */](indentation);
}
}
if (indentRulesSupport.shouldDecrease(lineContent)) {
if (indent.action === languageConfiguration["a" /* IndentAction */].Indent) {
return indent.indentation;
}
else {
return indentConverter.unshiftIndent(indent.indentation);
}
}
else {
if (indent.action === languageConfiguration["a" /* IndentAction */].Indent) {
return indentConverter.shiftIndent(indent.indentation);
}
else {
return indent.indentation;
}
}
}
return null;
};
LanguageConfigurationRegistryImpl.prototype.getIndentForEnter = function (autoIndent, model, range, indentConverter) {
if (autoIndent < 4 /* Full */) {
return null;
}
model.forceTokenization(range.startLineNumber);
var lineTokens = model.getLineTokens(range.startLineNumber);
var scopedLineTokens = Object(supports["a" /* createScopedLineTokens */])(lineTokens, range.startColumn - 1);
var scopedLineText = scopedLineTokens.getLineContent();
var embeddedLanguage = false;
var beforeEnterText;
if (scopedLineTokens.firstCharOffset > 0 && lineTokens.getLanguageId(0) !== scopedLineTokens.languageId) {
// we are in the embeded language content
embeddedLanguage = true; // if embeddedLanguage is true, then we don't touch the indentation of current line
beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);
}
else {
beforeEnterText = lineTokens.getLineContent().substring(0, range.startColumn - 1);
}
var afterEnterText;
if (range.isEmpty()) {
afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);
}
else {
var endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);
afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);
}
var indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId);
if (!indentRulesSupport) {
return null;
}
var beforeEnterResult = beforeEnterText;
var beforeEnterIndent = strings["t" /* getLeadingWhitespace */](beforeEnterText);
var virtualModel = {
getLineTokens: function (lineNumber) {
return model.getLineTokens(lineNumber);
},
getLanguageIdentifier: function () {
return model.getLanguageIdentifier();
},
getLanguageIdAtPosition: function (lineNumber, column) {
return model.getLanguageIdAtPosition(lineNumber, column);
},
getLineContent: function (lineNumber) {
if (lineNumber === range.startLineNumber) {
return beforeEnterResult;
}
else {
return model.getLineContent(lineNumber);
}
}
};
var currentLineIndent = strings["t" /* getLeadingWhitespace */](lineTokens.getLineContent());
var afterEnterAction = this.getInheritIndentForLine(autoIndent, virtualModel, range.startLineNumber + 1);
if (!afterEnterAction) {
var beforeEnter = embeddedLanguage ? currentLineIndent : beforeEnterIndent;
return {
beforeEnter: beforeEnter,
afterEnter: beforeEnter
};
}
var afterEnterIndent = embeddedLanguage ? currentLineIndent : afterEnterAction.indentation;
if (afterEnterAction.action === languageConfiguration["a" /* IndentAction */].Indent) {
afterEnterIndent = indentConverter.shiftIndent(afterEnterIndent);
}
if (indentRulesSupport.shouldDecrease(afterEnterText)) {
afterEnterIndent = indentConverter.unshiftIndent(afterEnterIndent);
}
return {
beforeEnter: embeddedLanguage ? currentLineIndent : beforeEnterIndent,
afterEnter: afterEnterIndent
};
};
/**
* We should always allow intentional indentation. It means, if users change the indentation of `lineNumber` and the content of
* this line doesn't match decreaseIndentPattern, we should not adjust the indentation.
*/
LanguageConfigurationRegistryImpl.prototype.getIndentActionForType = function (autoIndent, model, range, ch, indentConverter) {
if (autoIndent < 4 /* Full */) {
return null;
}
var scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);
var indentRulesSupport = this.getIndentRulesSupport(scopedLineTokens.languageId);
if (!indentRulesSupport) {
return null;
}
var scopedLineText = scopedLineTokens.getLineContent();
var beforeTypeText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);
// selection support
var afterTypeText;
if (range.isEmpty()) {
afterTypeText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);
}
else {
var endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);
afterTypeText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);
}
// If previous content already matches decreaseIndentPattern, it means indentation of this line should already be adjusted
// Users might change the indentation by purpose and we should honor that instead of readjusting.
if (!indentRulesSupport.shouldDecrease(beforeTypeText + afterTypeText) && indentRulesSupport.shouldDecrease(beforeTypeText + ch + afterTypeText)) {
// after typing `ch`, the content matches decreaseIndentPattern, we should adjust the indent to a good manner.
// 1. Get inherited indent action
var r = this.getInheritIndentForLine(autoIndent, model, range.startLineNumber, false);
if (!r) {
return null;
}
var indentation = r.indentation;
if (r.action !== languageConfiguration["a" /* IndentAction */].Indent) {
indentation = indentConverter.unshiftIndent(indentation);
}
return indentation;
}
return null;
};
LanguageConfigurationRegistryImpl.prototype.getIndentMetadata = function (model, lineNumber) {
var indentRulesSupport = this.getIndentRulesSupport(model.getLanguageIdentifier().id);
if (!indentRulesSupport) {
return null;
}
if (lineNumber < 1 || lineNumber > model.getLineCount()) {
return null;
}
return indentRulesSupport.getIndentMetadata(model.getLineContent(lineNumber));
};
// end Indent Rules
// begin onEnter
LanguageConfigurationRegistryImpl.prototype.getEnterAction = function (autoIndent, model, range) {
var scopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber, range.startColumn);
var richEditSupport = this._getRichEditSupport(scopedLineTokens.languageId);
if (!richEditSupport) {
return null;
}
var scopedLineText = scopedLineTokens.getLineContent();
var beforeEnterText = scopedLineText.substr(0, range.startColumn - 1 - scopedLineTokens.firstCharOffset);
// selection support
var afterEnterText;
if (range.isEmpty()) {
afterEnterText = scopedLineText.substr(range.startColumn - 1 - scopedLineTokens.firstCharOffset);
}
else {
var endScopedLineTokens = this.getScopedLineTokens(model, range.endLineNumber, range.endColumn);
afterEnterText = endScopedLineTokens.getLineContent().substr(range.endColumn - 1 - scopedLineTokens.firstCharOffset);
}
var oneLineAboveText = '';
if (range.startLineNumber > 1 && scopedLineTokens.firstCharOffset === 0) {
// This is not the first line and the entire line belongs to this mode
var oneLineAboveScopedLineTokens = this.getScopedLineTokens(model, range.startLineNumber - 1);
if (oneLineAboveScopedLineTokens.languageId === scopedLineTokens.languageId) {
// The line above ends with text belonging to the same mode
oneLineAboveText = oneLineAboveScopedLineTokens.getLineContent();
}
}
var enterResult = richEditSupport.onEnter(autoIndent, oneLineAboveText, beforeEnterText, afterEnterText);
if (!enterResult) {
return null;
}
var indentAction = enterResult.indentAction;
var appendText = enterResult.appendText;
var removeText = enterResult.removeText || 0;
// Here we add `\t` to appendText first because enterAction is leveraging appendText and removeText to change indentation.
if (!appendText) {
if ((indentAction === languageConfiguration["a" /* IndentAction */].Indent) ||
(indentAction === languageConfiguration["a" /* IndentAction */].IndentOutdent)) {
appendText = '\t';
}
else {
appendText = '';
}
}
var indentation = this.getIndentationAtPosition(model, range.startLineNumber, range.startColumn);
if (removeText) {
indentation = indentation.substring(0, indentation.length - removeText);
}
return {
indentAction: indentAction,
appendText: appendText,
removeText: removeText,
indentation: indentation
};
};
LanguageConfigurationRegistryImpl.prototype.getIndentationAtPosition = function (model, lineNumber, column) {
var lineText = model.getLineContent(lineNumber);
var indentation = strings["t" /* getLeadingWhitespace */](lineText);
if (indentation.length > column - 1) {
indentation = indentation.substring(0, column - 1);
}
return indentation;
};
LanguageConfigurationRegistryImpl.prototype.getScopedLineTokens = function (model, lineNumber, columnNumber) {
model.forceTokenization(lineNumber);
var lineTokens = model.getLineTokens(lineNumber);
var column = (typeof columnNumber === 'undefined' ? model.getLineMaxColumn(lineNumber) - 1 : columnNumber - 1);
return Object(supports["a" /* createScopedLineTokens */])(lineTokens, column);
};
// end onEnter
LanguageConfigurationRegistryImpl.prototype.getBracketsSupport = function (languageId) {
var value = this._getRichEditSupport(languageId);
if (!value) {
return null;
}
return value.brackets || null;
};
return LanguageConfigurationRegistryImpl;
}());
var LanguageConfigurationRegistry = new languageConfigurationRegistry_LanguageConfigurationRegistryImpl();
/***/ }),
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return domEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return stop; });
/* harmony import */ var _common_event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var domEvent = function (element, type, useCapture) {
var fn = function (e) { return emitter.fire(e); };
var emitter = new _common_event_js__WEBPACK_IMPORTED_MODULE_0__[/* Emitter */ "a"]({
onFirstListenerAdd: function () {
element.addEventListener(type, fn, useCapture);
},
onLastListenerRemove: function () {
element.removeEventListener(type, fn, useCapture);
}
});
return emitter.event;
};
function stop(event) {
return _common_event_js__WEBPACK_IMPORTED_MODULE_0__[/* Event */ "b"].map(event, function (e) {
e.preventDefault();
e.stopPropagation();
return e;
});
}
/***/ }),
/* 35 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deepClone; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return deepFreeze; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return cloneAndChange; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return mixin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return assign; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return equals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getOrDefault; });
/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function deepClone(obj) {
if (!obj || typeof obj !== 'object') {
return obj;
}
if (obj instanceof RegExp) {
// See https://github.com/Microsoft/TypeScript/issues/10990
return obj;
}
var result = Array.isArray(obj) ? [] : {};
Object.keys(obj).forEach(function (key) {
if (obj[key] && typeof obj[key] === 'object') {
result[key] = deepClone(obj[key]);
}
else {
result[key] = obj[key];
}
});
return result;
}
function deepFreeze(obj) {
if (!obj || typeof obj !== 'object') {
return obj;
}
var stack = [obj];
while (stack.length > 0) {
var obj_1 = stack.shift();
Object.freeze(obj_1);
for (var key in obj_1) {
if (_hasOwnProperty.call(obj_1, key)) {
var prop = obj_1[key];
if (typeof prop === 'object' && !Object.isFrozen(prop)) {
stack.push(prop);
}
}
}
}
return obj;
}
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function cloneAndChange(obj, changer) {
return _cloneAndChange(obj, changer, new Set());
}
function _cloneAndChange(obj, changer, seen) {
if (Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isUndefinedOrNull */ "l"])(obj)) {
return obj;
}
var changed = changer(obj);
if (typeof changed !== 'undefined') {
return changed;
}
if (Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isArray */ "d"])(obj)) {
var r1 = [];
for (var _i = 0, obj_2 = obj; _i < obj_2.length; _i++) {
var e = obj_2[_i];
r1.push(_cloneAndChange(e, changer, seen));
}
return r1;
}
if (Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"])(obj)) {
if (seen.has(obj)) {
throw new Error('Cannot clone recursive data-structure');
}
seen.add(obj);
var r2 = {};
for (var i2 in obj) {
if (_hasOwnProperty.call(obj, i2)) {
r2[i2] = _cloneAndChange(obj[i2], changer, seen);
}
}
seen.delete(obj);
return r2;
}
return obj;
}
/**
* Copies all properties of source into destination. The optional parameter "overwrite" allows to control
* if existing properties on the destination should be overwritten or not. Defaults to true (overwrite).
*/
function mixin(destination, source, overwrite) {
if (overwrite === void 0) { overwrite = true; }
if (!Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"])(destination)) {
return source;
}
if (Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"])(source)) {
Object.keys(source).forEach(function (key) {
if (key in destination) {
if (overwrite) {
if (Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"])(destination[key]) && Object(_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"])(source[key])) {
mixin(destination[key], source[key], overwrite);
}
else {
destination[key] = source[key];
}
}
}
else {
destination[key] = source[key];
}
});
}
return destination;
}
function assign(destination) {
var sources = [];
for (var _i = 1; _i < arguments.length; _i++) {
sources[_i - 1] = arguments[_i];
}
sources.forEach(function (source) { return Object.keys(source).forEach(function (key) { return destination[key] = source[key]; }); });
return destination;
}
function equals(one, other) {
if (one === other) {
return true;
}
if (one === null || one === undefined || other === null || other === undefined) {
return false;
}
if (typeof one !== typeof other) {
return false;
}
if (typeof one !== 'object') {
return false;
}
if ((Array.isArray(one)) !== (Array.isArray(other))) {
return false;
}
var i;
var key;
if (Array.isArray(one)) {
if (one.length !== other.length) {
return false;
}
for (i = 0; i < one.length; i++) {
if (!equals(one[i], other[i])) {
return false;
}
}
}
else {
var oneKeys = [];
for (key in one) {
oneKeys.push(key);
}
oneKeys.sort();
var otherKeys = [];
for (key in other) {
otherKeys.push(key);
}
otherKeys.sort();
if (!equals(oneKeys, otherKeys)) {
return false;
}
for (i = 0; i < oneKeys.length; i++) {
if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
return false;
}
}
}
return true;
}
function getOrDefault(obj, fn, defaultValue) {
var result = fn(obj);
return typeof result === 'undefined' ? defaultValue : result;
}
/***/ }),
/* 36 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ICodeEditorService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ICodeEditorService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('codeEditorService');
/***/ }),
/* 37 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Schemas; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RemoteAuthorities; });
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
/* harmony import */ var _platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Schemas;
(function (Schemas) {
/**
* A schema that is used for models that exist in memory
* only and that have no correspondence on a server or such.
*/
Schemas.inMemory = 'inmemory';
/**
* A schema that is used for setting files
*/
Schemas.vscode = 'vscode';
/**
* A schema that is used for internal private files
*/
Schemas.internal = 'private';
/**
* A walk-through document.
*/
Schemas.walkThrough = 'walkThrough';
/**
* An embedded code snippet.
*/
Schemas.walkThroughSnippet = 'walkThroughSnippet';
Schemas.http = 'http';
Schemas.https = 'https';
Schemas.file = 'file';
Schemas.mailto = 'mailto';
Schemas.untitled = 'untitled';
Schemas.data = 'data';
Schemas.command = 'command';
Schemas.vscodeRemote = 'vscode-remote';
Schemas.vscodeRemoteResource = 'vscode-remote-resource';
Schemas.userData = 'vscode-userdata';
})(Schemas || (Schemas = {}));
var RemoteAuthoritiesImpl = /** @class */ (function () {
function RemoteAuthoritiesImpl() {
this._hosts = Object.create(null);
this._ports = Object.create(null);
this._connectionTokens = Object.create(null);
this._preferredWebSchema = 'http';
this._delegate = null;
}
RemoteAuthoritiesImpl.prototype.setPreferredWebSchema = function (schema) {
this._preferredWebSchema = schema;
};
RemoteAuthoritiesImpl.prototype.rewrite = function (uri) {
if (this._delegate) {
return this._delegate(uri);
}
var authority = uri.authority;
var host = this._hosts[authority];
if (host && host.indexOf(':') !== -1) {
host = "[" + host + "]";
}
var port = this._ports[authority];
var connectionToken = this._connectionTokens[authority];
var query = "path=" + encodeURIComponent(uri.path);
if (typeof connectionToken === 'string') {
query += "&tkn=" + encodeURIComponent(connectionToken);
}
return _uri_js__WEBPACK_IMPORTED_MODULE_0__[/* URI */ "a"].from({
scheme: _platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isWeb */ "g"] ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
authority: host + ":" + port,
path: "/vscode-remote-resource",
query: query
});
};
return RemoteAuthoritiesImpl;
}());
var RemoteAuthorities = new RemoteAuthoritiesImpl();
/***/ }),
/* 38 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return FIN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return Iterator; });
/* unused harmony export ChainableIterator */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getSequenceIterator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayIterator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ArrayNavigator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return MappedIterator; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var FIN = { done: true, value: undefined };
var Iterator;
(function (Iterator) {
var _empty = {
next: function () {
return FIN;
}
};
function empty() {
return _empty;
}
Iterator.empty = empty;
function single(value) {
var done = false;
return {
next: function () {
if (done) {
return FIN;
}
done = true;
return { done: false, value: value };
}
};
}
Iterator.single = single;
function fromArray(array, index, length) {
if (index === void 0) { index = 0; }
if (length === void 0) { length = array.length; }
return {
next: function () {
if (index >= length) {
return FIN;
}
return { done: false, value: array[index++] };
}
};
}
Iterator.fromArray = fromArray;
function fromNativeIterator(it) {
return {
next: function () {
var result = it.next();
if (result.done) {
return FIN;
}
return { done: false, value: result.value };
}
};
}
Iterator.fromNativeIterator = fromNativeIterator;
function from(elements) {
if (!elements) {
return Iterator.empty();
}
else if (Array.isArray(elements)) {
return Iterator.fromArray(elements);
}
else {
return elements;
}
}
Iterator.from = from;
function map(iterator, fn) {
return {
next: function () {
var element = iterator.next();
if (element.done) {
return FIN;
}
else {
return { done: false, value: fn(element.value) };
}
}
};
}
Iterator.map = map;
function filter(iterator, fn) {
return {
next: function () {
while (true) {
var element = iterator.next();
if (element.done) {
return FIN;
}
if (fn(element.value)) {
return { done: false, value: element.value };
}
}
}
};
}
Iterator.filter = filter;
function forEach(iterator, fn) {
for (var next = iterator.next(); !next.done; next = iterator.next()) {
fn(next.value);
}
}
Iterator.forEach = forEach;
function collect(iterator, atMost) {
if (atMost === void 0) { atMost = Number.POSITIVE_INFINITY; }
var result = [];
if (atMost === 0) {
return result;
}
var i = 0;
for (var next = iterator.next(); !next.done; next = iterator.next()) {
result.push(next.value);
if (++i >= atMost) {
break;
}
}
return result;
}
Iterator.collect = collect;
function concat() {
var iterators = [];
for (var _i = 0; _i < arguments.length; _i++) {
iterators[_i] = arguments[_i];
}
var i = 0;
return {
next: function () {
if (i >= iterators.length) {
return FIN;
}
var iterator = iterators[i];
var result = iterator.next();
if (result.done) {
i++;
return this.next();
}
return result;
}
};
}
Iterator.concat = concat;
function chain(iterator) {
return new ChainableIterator(iterator);
}
Iterator.chain = chain;
})(Iterator || (Iterator = {}));
var ChainableIterator = /** @class */ (function () {
function ChainableIterator(it) {
this.it = it;
}
ChainableIterator.prototype.next = function () { return this.it.next(); };
return ChainableIterator;
}());
function getSequenceIterator(arg) {
if (Array.isArray(arg)) {
return Iterator.fromArray(arg);
}
else if (!arg) {
return Iterator.empty();
}
else {
return arg;
}
}
var ArrayIterator = /** @class */ (function () {
function ArrayIterator(items, start, end, index) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = items.length; }
if (index === void 0) { index = start - 1; }
this.items = items;
this.start = start;
this.end = end;
this.index = index;
}
ArrayIterator.prototype.first = function () {
this.index = this.start;
return this.current();
};
ArrayIterator.prototype.next = function () {
this.index = Math.min(this.index + 1, this.end);
return this.current();
};
ArrayIterator.prototype.current = function () {
if (this.index === this.start - 1 || this.index === this.end) {
return null;
}
return this.items[this.index];
};
return ArrayIterator;
}());
var ArrayNavigator = /** @class */ (function (_super) {
__extends(ArrayNavigator, _super);
function ArrayNavigator(items, start, end, index) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = items.length; }
if (index === void 0) { index = start - 1; }
return _super.call(this, items, start, end, index) || this;
}
ArrayNavigator.prototype.current = function () {
return _super.prototype.current.call(this);
};
ArrayNavigator.prototype.previous = function () {
this.index = Math.max(this.index - 1, this.start - 1);
return this.current();
};
ArrayNavigator.prototype.first = function () {
this.index = this.start;
return this.current();
};
ArrayNavigator.prototype.last = function () {
this.index = this.end - 1;
return this.current();
};
ArrayNavigator.prototype.parent = function () {
return null;
};
return ArrayNavigator;
}(ArrayIterator));
var MappedIterator = /** @class */ (function () {
function MappedIterator(iterator, fn) {
this.iterator = iterator;
this.fn = fn;
// noop
}
MappedIterator.prototype.next = function () { return this.fn(this.iterator.next()); };
return MappedIterator;
}());
/***/ }),
/* 39 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return KeyCodeUtils; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return KeyChord; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return createKeybinding; });
/* unused harmony export createSimpleKeybinding */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return SimpleKeybinding; });
/* unused harmony export ChordKeybinding */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ResolvedKeybindingPart; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ResolvedKeybinding; });
/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var KeyCodeStrMap = /** @class */ (function () {
function KeyCodeStrMap() {
this._keyCodeToStr = [];
this._strToKeyCode = Object.create(null);
}
KeyCodeStrMap.prototype.define = function (keyCode, str) {
this._keyCodeToStr[keyCode] = str;
this._strToKeyCode[str.toLowerCase()] = keyCode;
};
KeyCodeStrMap.prototype.keyCodeToStr = function (keyCode) {
return this._keyCodeToStr[keyCode];
};
KeyCodeStrMap.prototype.strToKeyCode = function (str) {
return this._strToKeyCode[str.toLowerCase()] || 0 /* Unknown */;
};
return KeyCodeStrMap;
}());
var uiMap = new KeyCodeStrMap();
var userSettingsUSMap = new KeyCodeStrMap();
var userSettingsGeneralMap = new KeyCodeStrMap();
(function () {
function define(keyCode, uiLabel, usUserSettingsLabel, generalUserSettingsLabel) {
if (usUserSettingsLabel === void 0) { usUserSettingsLabel = uiLabel; }
if (generalUserSettingsLabel === void 0) { generalUserSettingsLabel = usUserSettingsLabel; }
uiMap.define(keyCode, uiLabel);
userSettingsUSMap.define(keyCode, usUserSettingsLabel);
userSettingsGeneralMap.define(keyCode, generalUserSettingsLabel);
}
define(0 /* Unknown */, 'unknown');
define(1 /* Backspace */, 'Backspace');
define(2 /* Tab */, 'Tab');
define(3 /* Enter */, 'Enter');
define(4 /* Shift */, 'Shift');
define(5 /* Ctrl */, 'Ctrl');
define(6 /* Alt */, 'Alt');
define(7 /* PauseBreak */, 'PauseBreak');
define(8 /* CapsLock */, 'CapsLock');
define(9 /* Escape */, 'Escape');
define(10 /* Space */, 'Space');
define(11 /* PageUp */, 'PageUp');
define(12 /* PageDown */, 'PageDown');
define(13 /* End */, 'End');
define(14 /* Home */, 'Home');
define(15 /* LeftArrow */, 'LeftArrow', 'Left');
define(16 /* UpArrow */, 'UpArrow', 'Up');
define(17 /* RightArrow */, 'RightArrow', 'Right');
define(18 /* DownArrow */, 'DownArrow', 'Down');
define(19 /* Insert */, 'Insert');
define(20 /* Delete */, 'Delete');
define(21 /* KEY_0 */, '0');
define(22 /* KEY_1 */, '1');
define(23 /* KEY_2 */, '2');
define(24 /* KEY_3 */, '3');
define(25 /* KEY_4 */, '4');
define(26 /* KEY_5 */, '5');
define(27 /* KEY_6 */, '6');
define(28 /* KEY_7 */, '7');
define(29 /* KEY_8 */, '8');
define(30 /* KEY_9 */, '9');
define(31 /* KEY_A */, 'A');
define(32 /* KEY_B */, 'B');
define(33 /* KEY_C */, 'C');
define(34 /* KEY_D */, 'D');
define(35 /* KEY_E */, 'E');
define(36 /* KEY_F */, 'F');
define(37 /* KEY_G */, 'G');
define(38 /* KEY_H */, 'H');
define(39 /* KEY_I */, 'I');
define(40 /* KEY_J */, 'J');
define(41 /* KEY_K */, 'K');
define(42 /* KEY_L */, 'L');
define(43 /* KEY_M */, 'M');
define(44 /* KEY_N */, 'N');
define(45 /* KEY_O */, 'O');
define(46 /* KEY_P */, 'P');
define(47 /* KEY_Q */, 'Q');
define(48 /* KEY_R */, 'R');
define(49 /* KEY_S */, 'S');
define(50 /* KEY_T */, 'T');
define(51 /* KEY_U */, 'U');
define(52 /* KEY_V */, 'V');
define(53 /* KEY_W */, 'W');
define(54 /* KEY_X */, 'X');
define(55 /* KEY_Y */, 'Y');
define(56 /* KEY_Z */, 'Z');
define(57 /* Meta */, 'Meta');
define(58 /* ContextMenu */, 'ContextMenu');
define(59 /* F1 */, 'F1');
define(60 /* F2 */, 'F2');
define(61 /* F3 */, 'F3');
define(62 /* F4 */, 'F4');
define(63 /* F5 */, 'F5');
define(64 /* F6 */, 'F6');
define(65 /* F7 */, 'F7');
define(66 /* F8 */, 'F8');
define(67 /* F9 */, 'F9');
define(68 /* F10 */, 'F10');
define(69 /* F11 */, 'F11');
define(70 /* F12 */, 'F12');
define(71 /* F13 */, 'F13');
define(72 /* F14 */, 'F14');
define(73 /* F15 */, 'F15');
define(74 /* F16 */, 'F16');
define(75 /* F17 */, 'F17');
define(76 /* F18 */, 'F18');
define(77 /* F19 */, 'F19');
define(78 /* NumLock */, 'NumLock');
define(79 /* ScrollLock */, 'ScrollLock');
define(80 /* US_SEMICOLON */, ';', ';', 'OEM_1');
define(81 /* US_EQUAL */, '=', '=', 'OEM_PLUS');
define(82 /* US_COMMA */, ',', ',', 'OEM_COMMA');
define(83 /* US_MINUS */, '-', '-', 'OEM_MINUS');
define(84 /* US_DOT */, '.', '.', 'OEM_PERIOD');
define(85 /* US_SLASH */, '/', '/', 'OEM_2');
define(86 /* US_BACKTICK */, '`', '`', 'OEM_3');
define(110 /* ABNT_C1 */, 'ABNT_C1');
define(111 /* ABNT_C2 */, 'ABNT_C2');
define(87 /* US_OPEN_SQUARE_BRACKET */, '[', '[', 'OEM_4');
define(88 /* US_BACKSLASH */, '\\', '\\', 'OEM_5');
define(89 /* US_CLOSE_SQUARE_BRACKET */, ']', ']', 'OEM_6');
define(90 /* US_QUOTE */, '\'', '\'', 'OEM_7');
define(91 /* OEM_8 */, 'OEM_8');
define(92 /* OEM_102 */, 'OEM_102');
define(93 /* NUMPAD_0 */, 'NumPad0');
define(94 /* NUMPAD_1 */, 'NumPad1');
define(95 /* NUMPAD_2 */, 'NumPad2');
define(96 /* NUMPAD_3 */, 'NumPad3');
define(97 /* NUMPAD_4 */, 'NumPad4');
define(98 /* NUMPAD_5 */, 'NumPad5');
define(99 /* NUMPAD_6 */, 'NumPad6');
define(100 /* NUMPAD_7 */, 'NumPad7');
define(101 /* NUMPAD_8 */, 'NumPad8');
define(102 /* NUMPAD_9 */, 'NumPad9');
define(103 /* NUMPAD_MULTIPLY */, 'NumPad_Multiply');
define(104 /* NUMPAD_ADD */, 'NumPad_Add');
define(105 /* NUMPAD_SEPARATOR */, 'NumPad_Separator');
define(106 /* NUMPAD_SUBTRACT */, 'NumPad_Subtract');
define(107 /* NUMPAD_DECIMAL */, 'NumPad_Decimal');
define(108 /* NUMPAD_DIVIDE */, 'NumPad_Divide');
})();
var KeyCodeUtils;
(function (KeyCodeUtils) {
function toString(keyCode) {
return uiMap.keyCodeToStr(keyCode);
}
KeyCodeUtils.toString = toString;
function fromString(key) {
return uiMap.strToKeyCode(key);
}
KeyCodeUtils.fromString = fromString;
function toUserSettingsUS(keyCode) {
return userSettingsUSMap.keyCodeToStr(keyCode);
}
KeyCodeUtils.toUserSettingsUS = toUserSettingsUS;
function toUserSettingsGeneral(keyCode) {
return userSettingsGeneralMap.keyCodeToStr(keyCode);
}
KeyCodeUtils.toUserSettingsGeneral = toUserSettingsGeneral;
function fromUserSettings(key) {
return userSettingsUSMap.strToKeyCode(key) || userSettingsGeneralMap.strToKeyCode(key);
}
KeyCodeUtils.fromUserSettings = fromUserSettings;
})(KeyCodeUtils || (KeyCodeUtils = {}));
function KeyChord(firstPart, secondPart) {
var chordPart = ((secondPart & 0x0000FFFF) << 16) >>> 0;
return (firstPart | chordPart) >>> 0;
}
function createKeybinding(keybinding, OS) {
if (keybinding === 0) {
return null;
}
var firstPart = (keybinding & 0x0000FFFF) >>> 0;
var chordPart = (keybinding & 0xFFFF0000) >>> 16;
if (chordPart !== 0) {
return new ChordKeybinding([
createSimpleKeybinding(firstPart, OS),
createSimpleKeybinding(chordPart, OS)
]);
}
return new ChordKeybinding([createSimpleKeybinding(firstPart, OS)]);
}
function createSimpleKeybinding(keybinding, OS) {
var ctrlCmd = (keybinding & 2048 /* CtrlCmd */ ? true : false);
var winCtrl = (keybinding & 256 /* WinCtrl */ ? true : false);
var ctrlKey = (OS === 2 /* Macintosh */ ? winCtrl : ctrlCmd);
var shiftKey = (keybinding & 1024 /* Shift */ ? true : false);
var altKey = (keybinding & 512 /* Alt */ ? true : false);
var metaKey = (OS === 2 /* Macintosh */ ? ctrlCmd : winCtrl);
var keyCode = (keybinding & 255 /* KeyCode */);
return new SimpleKeybinding(ctrlKey, shiftKey, altKey, metaKey, keyCode);
}
var SimpleKeybinding = /** @class */ (function () {
function SimpleKeybinding(ctrlKey, shiftKey, altKey, metaKey, keyCode) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyCode = keyCode;
}
SimpleKeybinding.prototype.equals = function (other) {
return (this.ctrlKey === other.ctrlKey
&& this.shiftKey === other.shiftKey
&& this.altKey === other.altKey
&& this.metaKey === other.metaKey
&& this.keyCode === other.keyCode);
};
SimpleKeybinding.prototype.isModifierKey = function () {
return (this.keyCode === 0 /* Unknown */
|| this.keyCode === 5 /* Ctrl */
|| this.keyCode === 57 /* Meta */
|| this.keyCode === 6 /* Alt */
|| this.keyCode === 4 /* Shift */);
};
SimpleKeybinding.prototype.toChord = function () {
return new ChordKeybinding([this]);
};
/**
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
*/
SimpleKeybinding.prototype.isDuplicateModifierCase = function () {
return ((this.ctrlKey && this.keyCode === 5 /* Ctrl */)
|| (this.shiftKey && this.keyCode === 4 /* Shift */)
|| (this.altKey && this.keyCode === 6 /* Alt */)
|| (this.metaKey && this.keyCode === 57 /* Meta */));
};
return SimpleKeybinding;
}());
var ChordKeybinding = /** @class */ (function () {
function ChordKeybinding(parts) {
if (parts.length === 0) {
throw Object(_errors_js__WEBPACK_IMPORTED_MODULE_0__[/* illegalArgument */ "b"])("parts");
}
this.parts = parts;
}
ChordKeybinding.prototype.equals = function (other) {
if (other === null) {
return false;
}
if (this.parts.length !== other.parts.length) {
return false;
}
for (var i = 0; i < this.parts.length; i++) {
if (!this.parts[i].equals(other.parts[i])) {
return false;
}
}
return true;
};
return ChordKeybinding;
}());
var ResolvedKeybindingPart = /** @class */ (function () {
function ResolvedKeybindingPart(ctrlKey, shiftKey, altKey, metaKey, kbLabel, kbAriaLabel) {
this.ctrlKey = ctrlKey;
this.shiftKey = shiftKey;
this.altKey = altKey;
this.metaKey = metaKey;
this.keyLabel = kbLabel;
this.keyAriaLabel = kbAriaLabel;
}
return ResolvedKeybindingPart;
}());
/**
* A resolved keybinding. Can be a simple keybinding or a chord keybinding.
*/
var ResolvedKeybinding = /** @class */ (function () {
function ResolvedKeybinding() {
}
return ResolvedKeybinding;
}());
/***/ }),
/* 40 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isThemeColor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EditorType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Handler; });
/**
* @internal
*/
function isThemeColor(o) {
return o && typeof o.id === 'string';
}
/**
* The type of the `IEditor`.
*/
var EditorType = {
ICodeEditor: 'vs.editor.ICodeEditor',
IDiffEditor: 'vs.editor.IDiffEditor'
};
/**
* Built-in commands.
* @internal
*/
var Handler = {
ExecuteCommand: 'executeCommand',
ExecuteCommands: 'executeCommands',
Type: 'type',
ReplacePreviousChar: 'replacePreviousChar',
CompositionStart: 'compositionStart',
CompositionEnd: 'compositionEnd',
Paste: 'paste',
Cut: 'cut',
Undo: 'undo',
Redo: 'redo',
};
/***/ }),
/* 41 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export hasToIgnoreCase */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return basenameOrAuthority; });
/* unused harmony export isEqualAuthority */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isEqual; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return basename; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return dirname; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return joinPath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return normalizePath; });
/* unused harmony export originalFSPath */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return relativePath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DataUri; });
/* harmony import */ var _extpath_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(198);
/* harmony import */ var _path_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51);
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27);
/* harmony import */ var _strings_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
/* harmony import */ var _network_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37);
/* harmony import */ var _platform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function hasToIgnoreCase(resource) {
// A file scheme resource is in the same platform as code, so ignore case for non linux platforms
// Resource can be from another platform. Lowering the case as an hack. Should come from File system provider
return resource && resource.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file ? !_platform_js__WEBPACK_IMPORTED_MODULE_5__[/* isLinux */ "d"] : true;
}
function basenameOrAuthority(resource) {
return basename(resource) || resource.authority;
}
/**
* Tests wheter the two authorities are the same
*/
function isEqualAuthority(a1, a2) {
return a1 === a2 || Object(_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* equalsIgnoreCase */ "n"])(a1, a2);
}
function isEqual(first, second, ignoreCase) {
if (ignoreCase === void 0) { ignoreCase = hasToIgnoreCase(first); }
if (first === second) {
return true;
}
if (!first || !second) {
return false;
}
if (first.scheme !== second.scheme || !isEqualAuthority(first.authority, second.authority)) {
return false;
}
var p1 = first.path || '/', p2 = second.path || '/';
return p1 === p2 || ignoreCase && Object(_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* equalsIgnoreCase */ "n"])(p1 || '/', p2 || '/');
}
function basename(resource) {
return _path_js__WEBPACK_IMPORTED_MODULE_1__["posix"].basename(resource.path);
}
/**
* Return a URI representing the directory of a URI path.
*
* @param resource The input URI.
* @returns The URI representing the directory of the input URI.
*/
function dirname(resource) {
if (resource.path.length === 0) {
return resource;
}
if (resource.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file) {
return _uri_js__WEBPACK_IMPORTED_MODULE_2__[/* URI */ "a"].file(_path_js__WEBPACK_IMPORTED_MODULE_1__["dirname"](originalFSPath(resource)));
}
var dirname = _path_js__WEBPACK_IMPORTED_MODULE_1__["posix"].dirname(resource.path);
if (resource.authority && dirname.length && dirname.charCodeAt(0) !== 47 /* Slash */) {
console.error("dirname(\"" + resource.toString + ")) resulted in a relative path");
dirname = '/'; // If a URI contains an authority component, then the path component must either be empty or begin with a CharCode.Slash ("/") character
}
return resource.with({
path: dirname
});
}
/**
* Join a URI path with path fragments and normalizes the resulting path.
*
* @param resource The input URI.
* @param pathFragment The path fragment to add to the URI path.
* @returns The resulting URI.
*/
function joinPath(resource) {
var _a;
var pathFragment = [];
for (var _i = 1; _i < arguments.length; _i++) {
pathFragment[_i - 1] = arguments[_i];
}
var joinedPath;
if (resource.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file) {
joinedPath = _uri_js__WEBPACK_IMPORTED_MODULE_2__[/* URI */ "a"].file(_path_js__WEBPACK_IMPORTED_MODULE_1__["join"].apply(_path_js__WEBPACK_IMPORTED_MODULE_1__, __spreadArrays([originalFSPath(resource)], pathFragment))).path;
}
else {
joinedPath = (_a = _path_js__WEBPACK_IMPORTED_MODULE_1__["posix"]).join.apply(_a, __spreadArrays([resource.path || '/'], pathFragment));
}
return resource.with({
path: joinedPath
});
}
/**
* Normalizes the path part of a URI: Resolves `.` and `..` elements with directory names.
*
* @param resource The URI to normalize the path.
* @returns The URI with the normalized path.
*/
function normalizePath(resource) {
if (!resource.path.length) {
return resource;
}
var normalizedPath;
if (resource.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file) {
normalizedPath = _uri_js__WEBPACK_IMPORTED_MODULE_2__[/* URI */ "a"].file(_path_js__WEBPACK_IMPORTED_MODULE_1__["normalize"](originalFSPath(resource))).path;
}
else {
normalizedPath = _path_js__WEBPACK_IMPORTED_MODULE_1__["posix"].normalize(resource.path);
}
return resource.with({
path: normalizedPath
});
}
/**
* Returns the fsPath of an URI where the drive letter is not normalized.
* See #56403.
*/
function originalFSPath(uri) {
var value;
var uriPath = uri.path;
if (uri.authority && uriPath.length > 1 && uri.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file) {
// unc path: file://shares/c$/far/boo
value = "//" + uri.authority + uriPath;
}
else if (_platform_js__WEBPACK_IMPORTED_MODULE_5__[/* isWindows */ "h"]
&& uriPath.charCodeAt(0) === 47 /* Slash */
&& _extpath_js__WEBPACK_IMPORTED_MODULE_0__[/* isWindowsDriveLetter */ "b"](uriPath.charCodeAt(1))
&& uriPath.charCodeAt(2) === 58 /* Colon */) {
value = uriPath.substr(1);
}
else {
// other path
value = uriPath;
}
if (_platform_js__WEBPACK_IMPORTED_MODULE_5__[/* isWindows */ "h"]) {
value = value.replace(/\//g, '\\');
}
return value;
}
/**
* Returns a relative path between two URIs. If the URIs don't have the same schema or authority, `undefined` is returned.
* The returned relative path always uses forward slashes.
*/
function relativePath(from, to, ignoreCase) {
if (ignoreCase === void 0) { ignoreCase = hasToIgnoreCase(from); }
if (from.scheme !== to.scheme || !isEqualAuthority(from.authority, to.authority)) {
return undefined;
}
if (from.scheme === _network_js__WEBPACK_IMPORTED_MODULE_4__[/* Schemas */ "b"].file) {
var relativePath_1 = _path_js__WEBPACK_IMPORTED_MODULE_1__["relative"](from.path, to.path);
return _platform_js__WEBPACK_IMPORTED_MODULE_5__[/* isWindows */ "h"] ? _extpath_js__WEBPACK_IMPORTED_MODULE_0__[/* toSlashes */ "c"](relativePath_1) : relativePath_1;
}
var fromPath = from.path || '/', toPath = to.path || '/';
if (ignoreCase) {
// make casing of fromPath match toPath
var i = 0;
for (var 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 _path_js__WEBPACK_IMPORTED_MODULE_1__["posix"].relative(fromPath, toPath);
}
/**
* Data URI related helpers.
*/
var DataUri;
(function (DataUri) {
DataUri.META_DATA_LABEL = 'label';
DataUri.META_DATA_DESCRIPTION = 'description';
DataUri.META_DATA_SIZE = 'size';
DataUri.META_DATA_MIME = 'mime';
function parseMetaData(dataUri) {
var metadata = new Map();
// Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
// the metadata is: size:2313;label:SomeLabel;description:SomeDescription
var meta = dataUri.path.substring(dataUri.path.indexOf(';') + 1, dataUri.path.lastIndexOf(';'));
meta.split(';').forEach(function (property) {
var _a = property.split(':'), key = _a[0], value = _a[1];
if (key && value) {
metadata.set(key, value);
}
});
// Given a URI of: data:image/png;size:2313;label:SomeLabel;description:SomeDescription;base64,77+9UE5...
// the mime is: image/png
var mime = dataUri.path.substring(0, dataUri.path.indexOf(';'));
if (mime) {
metadata.set(DataUri.META_DATA_MIME, mime);
}
return metadata;
}
DataUri.parseMetaData = parseMetaData;
})(DataUri || (DataUri = {}));
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(380)();
}
/***/ }),
/* 43 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IConfigurationService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return toValuesTree; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return addToValueTree; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeFromValueTree; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getConfigurationValue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getConfigurationKeys; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getDefaultValues; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return overrideIdentifierFromKey; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getMigratedSettingValue; });
/* harmony import */ var _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
/* harmony import */ var _configurationRegistry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(114);
var IConfigurationService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__[/* createDecorator */ "c"])('configurationService');
function toValuesTree(properties, conflictReporter) {
var root = Object.create(null);
for (var key in properties) {
addToValueTree(root, key, properties[key], conflictReporter);
}
return root;
}
function addToValueTree(settingsTreeRoot, key, value, conflictReporter) {
var segments = key.split('.');
var last = segments.pop();
var curr = settingsTreeRoot;
for (var i = 0; i < segments.length; i++) {
var s = segments[i];
var obj = curr[s];
switch (typeof obj) {
case 'undefined':
obj = curr[s] = Object.create(null);
break;
case 'object':
break;
default:
conflictReporter("Ignoring " + key + " as " + segments.slice(0, i + 1).join('.') + " is " + JSON.stringify(obj));
return;
}
curr = obj;
}
if (typeof curr === 'object') {
curr[last] = value; // workaround https://github.com/Microsoft/vscode/issues/13606
}
else {
conflictReporter("Ignoring " + key + " as " + segments.join('.') + " is " + JSON.stringify(curr));
}
}
function removeFromValueTree(valueTree, key) {
var segments = key.split('.');
doRemoveFromValueTree(valueTree, segments);
}
function doRemoveFromValueTree(valueTree, segments) {
var first = segments.shift();
if (segments.length === 0) {
// Reached last segment
delete valueTree[first];
return;
}
if (Object.keys(valueTree).indexOf(first) !== -1) {
var value = valueTree[first];
if (typeof value === 'object' && !Array.isArray(value)) {
doRemoveFromValueTree(value, segments);
if (Object.keys(value).length === 0) {
delete valueTree[first];
}
}
}
}
/**
* A helper function to get the configuration value with a specific settings path (e.g. config.some.setting)
*/
function getConfigurationValue(config, settingPath, defaultValue) {
function accessSetting(config, path) {
var current = config;
for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
var component = path_1[_i];
if (typeof current !== 'object' || current === null) {
return undefined;
}
current = current[component];
}
return current;
}
var path = settingPath.split('.');
var result = accessSetting(config, path);
return typeof result === 'undefined' ? defaultValue : result;
}
function getConfigurationKeys() {
var properties = _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* Registry */ "a"].as(_configurationRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* Extensions */ "a"].Configuration).getConfigurationProperties();
return Object.keys(properties);
}
function getDefaultValues() {
var valueTreeRoot = Object.create(null);
var properties = _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* Registry */ "a"].as(_configurationRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* Extensions */ "a"].Configuration).getConfigurationProperties();
for (var key in properties) {
var value = properties[key].default;
addToValueTree(valueTreeRoot, key, value, function (message) { return console.error("Conflict in default settings: " + message); });
}
return valueTreeRoot;
}
function overrideIdentifierFromKey(key) {
return key.substring(1, key.length - 1);
}
function getMigratedSettingValue(configurationService, currentSettingName, legacySettingName) {
var setting = configurationService.inspect(currentSettingName);
var legacySetting = configurationService.inspect(legacySettingName);
if (typeof setting.userValue !== 'undefined' || typeof setting.workspaceValue !== 'undefined' || typeof setting.workspaceFolderValue !== 'undefined') {
return setting.value;
}
else if (typeof legacySetting.userValue !== 'undefined' || typeof legacySetting.workspaceValue !== 'undefined' || typeof legacySetting.workspaceFolderValue !== 'undefined') {
return legacySetting.value;
}
else {
return setting.defaultValue;
}
}
/***/ }),
/* 44 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return editorLineHighlight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return editorLineHighlightBorder; });
/* unused harmony export editorRangeHighlight */
/* unused harmony export editorRangeHighlightBorder */
/* unused harmony export editorSymbolHighlight */
/* unused harmony export editorSymbolHighlightBorder */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return editorCursorForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return editorCursorBackground; });
/* unused harmony export editorWhitespaces */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return editorIndentGuides; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return editorActiveIndentGuides; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return editorLineNumbers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return editorActiveLineNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return editorRuler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return editorCodeLensForeground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return editorBracketMatchBackground; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return editorBracketMatchBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return editorOverviewRulerBorder; });
/* unused harmony export editorGutter */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return editorUnnecessaryCodeBorder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return editorUnnecessaryCodeOpacity; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return overviewRulerError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return overviewRulerWarning; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return overviewRulerInfo; });
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15);
/* harmony import */ var _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
/* harmony import */ var _platform_theme_common_themeService_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(19);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Definition of the editor colors
*/
var editorLineHighlight = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.lineHighlightBackground', { dark: null, light: null, hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineHighlight', 'Background color for the highlight of line at the cursor position.'));
var editorLineHighlightBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.lineHighlightBorder', { dark: '#282828', light: '#eeeeee', hc: '#f38518' }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('lineHighlightBorderBox', 'Background color for the border around the line at the cursor position.'));
var editorRangeHighlight = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.rangeHighlightBackground', { dark: '#ffffff0b', light: '#fdff0033', hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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);
var editorRangeHighlightBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.rangeHighlightBorder', { dark: null, light: null, hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* activeContrastBorder */ "b"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('rangeHighlightBorder', 'Background color of the border around highlighted ranges.'), true);
var editorSymbolHighlight = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.symbolHighlightBackground', { dark: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorFindMatchHighlight */ "t"], light: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorFindMatchHighlight */ "t"], hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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);
var editorSymbolHighlightBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editor.symbolHighlightBorder', { dark: null, light: null, hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* activeContrastBorder */ "b"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('symbolHighlightBorder', 'Background color of the border around highlighted symbols.'), true);
var editorCursorForeground = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorCursor.foreground', { dark: '#AEAFAD', light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].black, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('caret', 'Color of the editor cursor.'));
var editorCursorBackground = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorCursor.background', null, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorCursorBackground', 'The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.'));
var editorWhitespaces = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorWhitespace.foreground', { dark: '#e3e4e229', light: '#33333333', hc: '#e3e4e229' }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorWhitespaces', 'Color of whitespace characters in the editor.'));
var editorIndentGuides = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorIndentGuide.background', { dark: editorWhitespaces, light: editorWhitespaces, hc: editorWhitespaces }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorIndentGuides', 'Color of the editor indentation guides.'));
var editorActiveIndentGuides = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorIndentGuide.activeBackground', { dark: editorWhitespaces, light: editorWhitespaces, hc: editorWhitespaces }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorActiveIndentGuide', 'Color of the active editor indentation guides.'));
var editorLineNumbers = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorLineNumber.foreground', { dark: '#858585', light: '#237893', hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorLineNumbers', 'Color of editor line numbers.'));
var deprecatedEditorActiveLineNumber = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorActiveLineNumber.foreground', { dark: '#c6c6c6', light: '#0B216F', hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* activeContrastBorder */ "b"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorActiveLineNumber', 'Color of editor active line number'), false, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('deprecatedEditorActiveLineNumber', 'Id is deprecated. Use \'editorLineNumber.activeForeground\' instead.'));
var editorActiveLineNumber = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorLineNumber.activeForeground', { dark: deprecatedEditorActiveLineNumber, light: deprecatedEditorActiveLineNumber, hc: deprecatedEditorActiveLineNumber }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorActiveLineNumber', 'Color of editor active line number'));
var editorRuler = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorRuler.foreground', { dark: '#5A5A5A', light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].lightgrey, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].white }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorRuler', 'Color of the editor rulers.'));
var editorCodeLensForeground = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorCodeLens.foreground', { dark: '#999999', light: '#999999', hc: '#999999' }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorCodeLensForeground', 'Foreground color of editor code lenses'));
var editorBracketMatchBackground = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorBracketMatch.background', { dark: '#0064001a', light: '#0064001a', hc: '#0064001a' }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorBracketMatchBackground', 'Background color behind matching brackets'));
var editorBracketMatchBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* contrastBorder */ "e"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorBracketMatchBorder', 'Color for matching brackets boxes'));
var editorOverviewRulerBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorOverviewRuler.border', { dark: '#7f7f7f4d', light: '#7f7f7f4d', hc: '#7f7f7f4d' }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorOverviewRulerBorder', 'Color of the overview ruler border.'));
var editorGutter = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorGutter.background', { dark: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorBackground */ "o"], light: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorBackground */ "o"], hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorBackground */ "o"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorGutter', 'Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.'));
var editorUnnecessaryCodeBorder = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorUnnecessaryCode.border', { dark: null, light: null, hc: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#fff').transparent(0.8) }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('unnecessaryCodeBorder', 'Border color of unnecessary (unused) source code in the editor.'));
var editorUnnecessaryCodeOpacity = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorUnnecessaryCode.opacity', { dark: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#000a'), light: _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"].fromHex('#0007'), hc: null }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('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.'));
var overviewRulerError = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorOverviewRuler.errorForeground', { dark: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 18, 18, 0.7)), light: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 18, 18, 0.7)), hc: new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* Color */ "a"](new _base_common_color_js__WEBPACK_IMPORTED_MODULE_1__[/* RGBA */ "c"](255, 50, 50, 1)) }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overviewRuleError', 'Overview ruler marker color for errors.'));
var overviewRulerWarning = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorOverviewRuler.warningForeground', { dark: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorWarningForeground */ "P"], light: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorWarningForeground */ "P"], hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorWarningBorder */ "O"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overviewRuleWarning', 'Overview ruler marker color for warnings.'));
var overviewRulerInfo = Object(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* registerColor */ "Tb"])('editorOverviewRuler.infoForeground', { dark: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorInfoForeground */ "H"], light: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorInfoForeground */ "H"], hc: _platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorInfoBorder */ "G"] }, _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overviewRuleInfo', 'Overview ruler marker color for infos.'));
// contains all color rules that used to defined in editor/browser/widget/editor.css
Object(_platform_theme_common_themeService_js__WEBPACK_IMPORTED_MODULE_3__[/* registerThemingParticipant */ "e"])(function (theme, collector) {
var background = theme.getColor(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorBackground */ "o"]);
if (background) {
collector.addRule(".monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input { background-color: " + background + "; }");
}
var foreground = theme.getColor(_platform_theme_common_colorRegistry_js__WEBPACK_IMPORTED_MODULE_2__[/* editorForeground */ "x"]);
if (foreground) {
collector.addRule(".monaco-editor, .monaco-editor .inputarea.ime-input { color: " + foreground + "; }");
}
var gutter = theme.getColor(editorGutter);
if (gutter) {
collector.addRule(".monaco-editor .margin { background-color: " + gutter + "; }");
}
var rangeHighlight = theme.getColor(editorRangeHighlight);
if (rangeHighlight) {
collector.addRule(".monaco-editor .rangeHighlight { background-color: " + rangeHighlight + "; }");
}
var rangeHighlightBorder = theme.getColor(editorRangeHighlightBorder);
if (rangeHighlightBorder) {
collector.addRule(".monaco-editor .rangeHighlight { border: 1px " + (theme.type === 'hc' ? 'dotted' : 'solid') + " " + rangeHighlightBorder + "; }");
}
var symbolHighlight = theme.getColor(editorSymbolHighlight);
if (symbolHighlight) {
collector.addRule(".monaco-editor .symbolHighlight { background-color: " + symbolHighlight + "; }");
}
var symbolHighlightBorder = theme.getColor(editorSymbolHighlightBorder);
if (symbolHighlightBorder) {
collector.addRule(".monaco-editor .symbolHighlight { border: 1px " + (theme.type === 'hc' ? 'dotted' : 'solid') + " " + symbolHighlightBorder + "; }");
}
var invisibles = theme.getColor(editorWhitespaces);
if (invisibles) {
collector.addRule(".vs-whitespace { color: " + invisibles + " !important; }");
}
});
/***/ }),
/* 45 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IKeybindingService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IKeybindingService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('keybindingService');
/***/ }),
/* 46 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return StandardMouseEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DragMouseEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return StandardWheelEvent; });
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var _iframe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(196);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var StandardMouseEvent = /** @class */ (function () {
function StandardMouseEvent(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 {
// Probably hit by MSGestureEvent
this.posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
this.posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
// Find the position of the iframe this code is executing in relative to the iframe where the event was captured.
var iframeOffsets = _iframe_js__WEBPACK_IMPORTED_MODULE_1__[/* IframeUtils */ "a"].getPositionOfChildWindowRelativeToAncestorWindow(self, e.view);
this.posx -= iframeOffsets.left;
this.posy -= iframeOffsets.top;
}
StandardMouseEvent.prototype.preventDefault = function () {
if (this.browserEvent.preventDefault) {
this.browserEvent.preventDefault();
}
};
StandardMouseEvent.prototype.stopPropagation = function () {
if (this.browserEvent.stopPropagation) {
this.browserEvent.stopPropagation();
}
};
return StandardMouseEvent;
}());
var DragMouseEvent = /** @class */ (function (_super) {
__extends(DragMouseEvent, _super);
function DragMouseEvent(e) {
var _this = _super.call(this, e) || this;
_this.dataTransfer = e.dataTransfer;
return _this;
}
return DragMouseEvent;
}(StandardMouseEvent));
var StandardWheelEvent = /** @class */ (function () {
function StandardWheelEvent(e, deltaX, deltaY) {
if (deltaX === void 0) { deltaX = 0; }
if (deltaY === void 0) { deltaY = 0; }
this.browserEvent = e || null;
this.target = e ? (e.target || e.targetNode || e.srcElement) : null;
this.deltaY = deltaY;
this.deltaX = deltaX;
if (e) {
// Old (deprecated) wheel events
var e1 = e;
var e2 = e;
// vertical delta scroll
if (typeof e1.wheelDeltaY !== 'undefined') {
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') {
// Modern wheel event
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
var ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
// the deltas are expressed in lines
this.deltaY = -e.deltaY;
}
else {
this.deltaY = -e.deltaY / 40;
}
}
// horizontal delta scroll
if (typeof e1.wheelDeltaX !== 'undefined') {
if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isSafari */ "k"] && _common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isWindows */ "h"]) {
this.deltaX = -(e1.wheelDeltaX / 120);
}
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') {
// Modern wheel event
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
var ev = e;
if (ev.deltaMode === ev.DOM_DELTA_LINE) {
// the deltas are expressed in lines
this.deltaX = -e.deltaX;
}
else {
this.deltaX = -e.deltaX / 40;
}
}
// Assume a vertical scroll if nothing else worked
if (this.deltaY === 0 && this.deltaX === 0 && e.wheelDelta) {
this.deltaY = e.wheelDelta / 120;
}
}
}
StandardWheelEvent.prototype.preventDefault = function () {
if (this.browserEvent) {
if (this.browserEvent.preventDefault) {
this.browserEvent.preventDefault();
}
}
};
StandardWheelEvent.prototype.stopPropagation = function () {
if (this.browserEvent) {
if (this.browserEvent.stopPropagation) {
this.browserEvent.stopPropagation();
}
}
};
return StandardWheelEvent;
}());
/***/ }),
/* 47 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return OverviewRulerLane; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MinimapPosition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return TextModelResolvedOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FindMatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ApplyEditsResult; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Vertical Lane in the overview ruler of the editor.
*/
var OverviewRulerLane;
(function (OverviewRulerLane) {
OverviewRulerLane[OverviewRulerLane["Left"] = 1] = "Left";
OverviewRulerLane[OverviewRulerLane["Center"] = 2] = "Center";
OverviewRulerLane[OverviewRulerLane["Right"] = 4] = "Right";
OverviewRulerLane[OverviewRulerLane["Full"] = 7] = "Full";
})(OverviewRulerLane || (OverviewRulerLane = {}));
/**
* Position in the minimap to render the decoration.
*/
var MinimapPosition;
(function (MinimapPosition) {
MinimapPosition[MinimapPosition["Inline"] = 1] = "Inline";
MinimapPosition[MinimapPosition["Gutter"] = 2] = "Gutter";
})(MinimapPosition || (MinimapPosition = {}));
var TextModelResolvedOptions = /** @class */ (function () {
/**
* @internal
*/
function TextModelResolvedOptions(src) {
this.tabSize = Math.max(1, src.tabSize | 0);
this.indentSize = src.tabSize | 0;
this.insertSpaces = Boolean(src.insertSpaces);
this.defaultEOL = src.defaultEOL | 0;
this.trimAutoWhitespace = Boolean(src.trimAutoWhitespace);
}
/**
* @internal
*/
TextModelResolvedOptions.prototype.equals = function (other) {
return (this.tabSize === other.tabSize
&& this.indentSize === other.indentSize
&& this.insertSpaces === other.insertSpaces
&& this.defaultEOL === other.defaultEOL
&& this.trimAutoWhitespace === other.trimAutoWhitespace);
};
/**
* @internal
*/
TextModelResolvedOptions.prototype.createChangeEvent = function (newOpts) {
return {
tabSize: this.tabSize !== newOpts.tabSize,
indentSize: this.indentSize !== newOpts.indentSize,
insertSpaces: this.insertSpaces !== newOpts.insertSpaces,
trimAutoWhitespace: this.trimAutoWhitespace !== newOpts.trimAutoWhitespace,
};
};
return TextModelResolvedOptions;
}());
var FindMatch = /** @class */ (function () {
/**
* @internal
*/
function FindMatch(range, matches) {
this.range = range;
this.matches = matches;
}
return FindMatch;
}());
/**
* @internal
*/
var ApplyEditsResult = /** @class */ (function () {
function ApplyEditsResult(reverseEdits, changes, trimAutoWhitespaceLineNumbers) {
this.reverseEdits = reverseEdits;
this.changes = changes;
this.trimAutoWhitespaceLineNumbers = trimAutoWhitespaceLineNumbers;
}
return ApplyEditsResult;
}());
/***/ }),
/* 48 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ReplaceCommand; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ReplaceCommandThatSelectsText; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ReplaceCommandWithoutChangingPosition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ReplaceCommandWithOffsetCursorState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ReplaceCommandThatPreservesSelection; });
/* harmony import */ var _core_selection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ReplaceCommand = /** @class */ (function () {
function ReplaceCommand(range, text, insertsAutoWhitespace) {
if (insertsAutoWhitespace === void 0) { insertsAutoWhitespace = false; }
this._range = range;
this._text = text;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
ReplaceCommand.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
};
ReplaceCommand.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_0__[/* Selection */ "a"](srcRange.endLineNumber, srcRange.endColumn, srcRange.endLineNumber, srcRange.endColumn);
};
return ReplaceCommand;
}());
var ReplaceCommandThatSelectsText = /** @class */ (function () {
function ReplaceCommandThatSelectsText(range, text) {
this._range = range;
this._text = text;
}
ReplaceCommandThatSelectsText.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
};
ReplaceCommandThatSelectsText.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_0__[/* Selection */ "a"](srcRange.startLineNumber, srcRange.startColumn, srcRange.endLineNumber, srcRange.endColumn);
};
return ReplaceCommandThatSelectsText;
}());
var ReplaceCommandWithoutChangingPosition = /** @class */ (function () {
function ReplaceCommandWithoutChangingPosition(range, text, insertsAutoWhitespace) {
if (insertsAutoWhitespace === void 0) { insertsAutoWhitespace = false; }
this._range = range;
this._text = text;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
ReplaceCommandWithoutChangingPosition.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
};
ReplaceCommandWithoutChangingPosition.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_0__[/* Selection */ "a"](srcRange.startLineNumber, srcRange.startColumn, srcRange.startLineNumber, srcRange.startColumn);
};
return ReplaceCommandWithoutChangingPosition;
}());
var ReplaceCommandWithOffsetCursorState = /** @class */ (function () {
function ReplaceCommandWithOffsetCursorState(range, text, lineNumberDeltaOffset, columnDeltaOffset, insertsAutoWhitespace) {
if (insertsAutoWhitespace === void 0) { insertsAutoWhitespace = false; }
this._range = range;
this._text = text;
this._columnDeltaOffset = columnDeltaOffset;
this._lineNumberDeltaOffset = lineNumberDeltaOffset;
this.insertsAutoWhitespace = insertsAutoWhitespace;
}
ReplaceCommandWithOffsetCursorState.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(this._range, this._text);
};
ReplaceCommandWithOffsetCursorState.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_0__[/* Selection */ "a"](srcRange.endLineNumber + this._lineNumberDeltaOffset, srcRange.endColumn + this._columnDeltaOffset, srcRange.endLineNumber + this._lineNumberDeltaOffset, srcRange.endColumn + this._columnDeltaOffset);
};
return ReplaceCommandWithOffsetCursorState;
}());
var ReplaceCommandThatPreservesSelection = /** @class */ (function () {
function ReplaceCommandThatPreservesSelection(editRange, text, initialSelection, forceMoveMarkers) {
if (forceMoveMarkers === void 0) { forceMoveMarkers = false; }
this._range = editRange;
this._text = text;
this._initialSelection = initialSelection;
this._forceMoveMarkers = forceMoveMarkers;
this._selectionId = null;
}
ReplaceCommandThatPreservesSelection.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(this._range, this._text, this._forceMoveMarkers);
this._selectionId = builder.trackSelection(this._initialSelection);
};
ReplaceCommandThatPreservesSelection.prototype.computeCursorState = function (model, helper) {
return helper.getTrackedSelection(this._selectionId);
};
return ReplaceCommandThatPreservesSelection;
}());
/***/ }),
/* 49 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Severity */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return INotificationService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NoOpNotification; });
/* harmony import */ var _base_common_severity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Severity = _base_common_severity_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"];
var INotificationService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__[/* createDecorator */ "c"])('notificationService');
var NoOpNotification = /** @class */ (function () {
function NoOpNotification() {
}
return NoOpNotification;
}());
/***/ }),
/* 50 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MarkerSeverity; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IMarkerData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IMarkerService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
/* harmony import */ var _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var MarkerSeverity;
(function (MarkerSeverity) {
MarkerSeverity[MarkerSeverity["Hint"] = 1] = "Hint";
MarkerSeverity[MarkerSeverity["Info"] = 2] = "Info";
MarkerSeverity[MarkerSeverity["Warning"] = 4] = "Warning";
MarkerSeverity[MarkerSeverity["Error"] = 8] = "Error";
})(MarkerSeverity || (MarkerSeverity = {}));
(function (MarkerSeverity) {
function compare(a, b) {
return b - a;
}
MarkerSeverity.compare = compare;
var _displayStrings = Object.create(null);
_displayStrings[MarkerSeverity.Error] = Object(_nls_js__WEBPACK_IMPORTED_MODULE_1__[/* localize */ "a"])('sev.error', "Error");
_displayStrings[MarkerSeverity.Warning] = Object(_nls_js__WEBPACK_IMPORTED_MODULE_1__[/* localize */ "a"])('sev.warning', "Warning");
_displayStrings[MarkerSeverity.Info] = Object(_nls_js__WEBPACK_IMPORTED_MODULE_1__[/* localize */ "a"])('sev.info', "Info");
function toString(a) {
return _displayStrings[a] || '';
}
MarkerSeverity.toString = toString;
function fromSeverity(severity) {
switch (severity) {
case _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Error: return MarkerSeverity.Error;
case _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Warning: return MarkerSeverity.Warning;
case _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Info: return MarkerSeverity.Info;
case _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Ignore: return MarkerSeverity.Hint;
}
}
MarkerSeverity.fromSeverity = fromSeverity;
function toSeverity(severity) {
switch (severity) {
case MarkerSeverity.Error: return _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Error;
case MarkerSeverity.Warning: return _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Warning;
case MarkerSeverity.Info: return _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Info;
case MarkerSeverity.Hint: return _base_common_severity_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].Ignore;
}
}
MarkerSeverity.toSeverity = toSeverity;
})(MarkerSeverity || (MarkerSeverity = {}));
var IMarkerData;
(function (IMarkerData) {
var emptyString = '';
function makeKey(markerData) {
return makeKeyOptionalMessage(markerData, true);
}
IMarkerData.makeKey = makeKey;
function makeKeyOptionalMessage(markerData, useMessage) {
var result = [emptyString];
if (markerData.source) {
result.push(markerData.source.replace('¦', '\¦'));
}
else {
result.push(emptyString);
}
if (markerData.code) {
if (typeof markerData.code === 'string') {
result.push(markerData.code.replace('¦', '\¦'));
}
else {
result.push(markerData.code.value.replace('¦', '\¦'));
}
}
else {
result.push(emptyString);
}
if (markerData.severity !== undefined && markerData.severity !== null) {
result.push(MarkerSeverity.toString(markerData.severity));
}
else {
result.push(emptyString);
}
// Modifed to not include the message as part of the marker key to work around
// https://github.com/microsoft/vscode/issues/77475
if (markerData.message && useMessage) {
result.push(markerData.message.replace('¦', '\¦'));
}
else {
result.push(emptyString);
}
if (markerData.startLineNumber !== undefined && markerData.startLineNumber !== null) {
result.push(markerData.startLineNumber.toString());
}
else {
result.push(emptyString);
}
if (markerData.startColumn !== undefined && markerData.startColumn !== null) {
result.push(markerData.startColumn.toString());
}
else {
result.push(emptyString);
}
if (markerData.endLineNumber !== undefined && markerData.endLineNumber !== null) {
result.push(markerData.endLineNumber.toString());
}
else {
result.push(emptyString);
}
if (markerData.endColumn !== undefined && markerData.endColumn !== null) {
result.push(markerData.endColumn.toString());
}
else {
result.push(emptyString);
}
result.push(emptyString);
return result.join('¦');
}
IMarkerData.makeKeyOptionalMessage = makeKeyOptionalMessage;
})(IMarkerData || (IMarkerData = {}));
var IMarkerService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('markerService');
/***/ }),
/* 51 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "win32", function() { return /* binding */ win32; });
__webpack_require__.d(__webpack_exports__, "posix", function() { return /* binding */ posix; });
__webpack_require__.d(__webpack_exports__, "normalize", function() { return /* binding */ normalize; });
__webpack_require__.d(__webpack_exports__, "join", function() { return /* binding */ join; });
__webpack_require__.d(__webpack_exports__, "relative", function() { return /* binding */ relative; });
__webpack_require__.d(__webpack_exports__, "dirname", function() { return /* binding */ dirname; });
__webpack_require__.d(__webpack_exports__, "basename", function() { return /* binding */ basename; });
__webpack_require__.d(__webpack_exports__, "extname", function() { return /* binding */ extname; });
__webpack_require__.d(__webpack_exports__, "sep", function() { return /* binding */ sep; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/process.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var safeProcess = (typeof process === 'undefined') ? {
cwd: function () { return '/'; },
env: Object.create(null),
get platform() { return platform["h" /* isWindows */] ? 'win32' : platform["e" /* isMacintosh */] ? 'darwin' : 'linux'; },
nextTick: function (callback) { return Object(platform["i" /* setImmediate */])(callback); }
} : process;
var cwd = safeProcess.cwd;
var env = safeProcess.env;
var process_platform = safeProcess.platform;
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/path.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
// NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace
// Copied from: https://github.com/nodejs/node/tree/43dd49c9782848c25e5b03448c8a0f923f13c158
/**
* Copyright Joyent, Inc. and other Node contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
var CHAR_UPPERCASE_A = 65; /* A */
var CHAR_LOWERCASE_A = 97; /* a */
var CHAR_UPPERCASE_Z = 90; /* Z */
var CHAR_LOWERCASE_Z = 122; /* z */
var CHAR_DOT = 46; /* . */
var CHAR_FORWARD_SLASH = 47; /* / */
var CHAR_BACKWARD_SLASH = 92; /* \ */
var CHAR_COLON = 58; /* : */
var CHAR_QUESTION_MARK = 63; /* ? */
var ErrorInvalidArgType = /** @class */ (function (_super) {
__extends(ErrorInvalidArgType, _super);
function ErrorInvalidArgType(name, expected, actual) {
var _this = this;
// determiner: 'must be' or 'must not be'
var determiner;
if (typeof expected === 'string' && expected.indexOf('not ') === 0) {
determiner = 'must not be';
expected = expected.replace(/^not /, '');
}
else {
determiner = 'must be';
}
var type = name.indexOf('.') !== -1 ? 'property' : 'argument';
var msg = "The \"" + name + "\" " + type + " " + determiner + " of type " + expected;
msg += ". Received type " + typeof actual;
_this = _super.call(this, msg) || this;
_this.code = 'ERR_INVALID_ARG_TYPE';
return _this;
}
return ErrorInvalidArgType;
}(Error));
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;
}
// Resolves . and .. elements in a path with directory names
function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
var res = '';
var lastSegmentLength = 0;
var lastSlash = -1;
var dots = 0;
var code;
for (var i = 0; i <= path.length; ++i) {
if (i < path.length) {
code = path.charCodeAt(i);
}
else if (isPathSeparator(code)) {
break;
}
else {
code = CHAR_FORWARD_SLASH;
}
if (isPathSeparator(code)) {
if (lastSlash === i - 1 || dots === 1) {
// NOOP
}
else if (lastSlash !== i - 1 && 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) {
var 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 === 2 || res.length === 1) {
res = '';
lastSegmentLength = 0;
lastSlash = i;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
if (res.length > 0) {
res += separator + "..";
}
else {
res = '..';
}
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 _format(sep, pathObject) {
var dir = pathObject.dir || pathObject.root;
var base = pathObject.base ||
((pathObject.name || '') + (pathObject.ext || ''));
if (!dir) {
return base;
}
if (dir === pathObject.root) {
return dir + base;
}
return dir + sep + base;
}
var win32 = {
// path.resolve([from ...], to)
resolve: function () {
var pathSegments = [];
for (var _i = 0; _i < arguments.length; _i++) {
pathSegments[_i] = arguments[_i];
}
var resolvedDevice = '';
var resolvedTail = '';
var resolvedAbsolute = false;
for (var i = pathSegments.length - 1; i >= -1; i--) {
var path = void 0;
if (i >= 0) {
path = pathSegments[i];
}
else if (!resolvedDevice) {
path = cwd();
}
else {
// Windows has the concept of drive-specific current working
// directories. If we've resolved a drive letter but not yet an
// absolute path, get cwd for that drive, or the process cwd if
// the drive cwd is not available. We're sure the device is not
// a UNC path at this points, because UNC paths are always absolute.
path = env['=' + resolvedDevice] || cwd();
// Verify that a cwd was found and that it actually points
// to our drive. If not, default to the drive's root.
if (path === undefined ||
path.slice(0, 3).toLowerCase() !==
resolvedDevice.toLowerCase() + '\\') {
path = resolvedDevice + '\\';
}
}
validateString(path, 'path');
// Skip empty entries
if (path.length === 0) {
continue;
}
var len = path.length;
var rootEnd = 0;
var device = '';
var isAbsolute = false;
var code = path.charCodeAt(0);
// Try to match a root
if (len > 1) {
if (isPathSeparator(code)) {
// Possible UNC root
// If we started with a separator, we know we at least have an
// absolute path of some kind (UNC or otherwise)
isAbsolute = true;
if (isPathSeparator(path.charCodeAt(1))) {
// Matched double path separator at beginning
var j = 2;
var last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
var firstPart = path.slice(last, j);
// Matched!
last = j;
// Match 1 or more path separators
for (; j < len; ++j) {
if (!isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j === len) {
// We matched a UNC root only
device = '\\\\' + firstPart + '\\' + path.slice(last);
rootEnd = j;
}
else if (j !== last) {
// We matched a UNC root with leftovers
device = '\\\\' + firstPart + '\\' + path.slice(last, j);
rootEnd = j;
}
}
}
}
else {
rootEnd = 1;
}
}
else if (isWindowsDeviceRoot(code)) {
// Possible device root
if (path.charCodeAt(1) === CHAR_COLON) {
device = path.slice(0, 2);
rootEnd = 2;
if (len > 2) {
if (isPathSeparator(path.charCodeAt(2))) {
// Treat separator following drive name as an absolute path
// indicator
isAbsolute = true;
rootEnd = 3;
}
}
}
}
}
else if (isPathSeparator(code)) {
// `path` contains just a path separator
rootEnd = 1;
isAbsolute = true;
}
if (device.length > 0 &&
resolvedDevice.length > 0 &&
device.toLowerCase() !== resolvedDevice.toLowerCase()) {
// This path points to another device so it is not applicable
continue;
}
if (resolvedDevice.length === 0 && device.length > 0) {
resolvedDevice = device;
}
if (!resolvedAbsolute) {
resolvedTail = path.slice(rootEnd) + '\\' + resolvedTail;
resolvedAbsolute = isAbsolute;
}
if (resolvedDevice.length > 0 && resolvedAbsolute) {
break;
}
}
// At this point the path should be resolved to a full absolute path,
// but handle relative paths to be safe (might happen when process.cwd()
// fails)
// Normalize the tail path
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, '\\', isPathSeparator);
return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) ||
'.';
},
normalize: function (path) {
validateString(path, 'path');
var len = path.length;
if (len === 0) {
return '.';
}
var rootEnd = 0;
var device;
var isAbsolute = false;
var code = path.charCodeAt(0);
// Try to match a root
if (len > 1) {
if (isPathSeparator(code)) {
// Possible UNC root
// If we started with a separator, we know we at least have an absolute
// path of some kind (UNC or otherwise)
isAbsolute = true;
if (isPathSeparator(path.charCodeAt(1))) {
// Matched double path separator at beginning
var j = 2;
var last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
var firstPart = path.slice(last, j);
// Matched!
last = j;
// Match 1 or more path separators
for (; j < len; ++j) {
if (!isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j === len) {
// We matched a UNC root only
// Return the normalized version of the UNC root since there
// is nothing left to process
return '\\\\' + firstPart + '\\' + path.slice(last) + '\\';
}
else if (j !== last) {
// We matched a UNC root with leftovers
device = '\\\\' + firstPart + '\\' + path.slice(last, j);
rootEnd = j;
}
}
}
}
else {
rootEnd = 1;
}
}
else if (isWindowsDeviceRoot(code)) {
// Possible device root
if (path.charCodeAt(1) === CHAR_COLON) {
device = path.slice(0, 2);
rootEnd = 2;
if (len > 2) {
if (isPathSeparator(path.charCodeAt(2))) {
// Treat separator following drive name as an absolute path
// indicator
isAbsolute = true;
rootEnd = 3;
}
}
}
}
}
else if (isPathSeparator(code)) {
// `path` contains just a path separator, exit early to avoid unnecessary
// work
return '\\';
}
var tail;
if (rootEnd < len) {
tail = normalizeString(path.slice(rootEnd), !isAbsolute, '\\', isPathSeparator);
}
else {
tail = '';
}
if (tail.length === 0 && !isAbsolute) {
tail = '.';
}
if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
tail += '\\';
}
if (device === undefined) {
if (isAbsolute) {
if (tail.length > 0) {
return '\\' + tail;
}
else {
return '\\';
}
}
else if (tail.length > 0) {
return tail;
}
else {
return '';
}
}
else if (isAbsolute) {
if (tail.length > 0) {
return device + '\\' + tail;
}
else {
return device + '\\';
}
}
else if (tail.length > 0) {
return device + tail;
}
else {
return device;
}
},
isAbsolute: function (path) {
validateString(path, 'path');
var len = path.length;
if (len === 0) {
return false;
}
var code = path.charCodeAt(0);
if (isPathSeparator(code)) {
return true;
}
else if (isWindowsDeviceRoot(code)) {
// Possible device root
if (len > 2 && path.charCodeAt(1) === CHAR_COLON) {
if (isPathSeparator(path.charCodeAt(2))) {
return true;
}
}
}
return false;
},
join: function () {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
if (paths.length === 0) {
return '.';
}
var joined;
var firstPart;
for (var i = 0; i < paths.length; ++i) {
var arg = paths[i];
validateString(arg, 'path');
if (arg.length > 0) {
if (joined === undefined) {
joined = firstPart = arg;
}
else {
joined += '\\' + arg;
}
}
}
if (joined === undefined) {
return '.';
}
// Make sure that the joined path doesn't start with two slashes, because
// normalize() will mistake it for an UNC path then.
//
// This step is skipped when it is very clear that the user actually
// intended to point at an UNC path. This is assumed when the first
// non-empty string arguments starts with exactly two slashes followed by
// at least one more non-slash character.
//
// Note that for normalize() to treat a path as an UNC path it needs to
// have at least 2 components, so we don't filter for that here.
// This means that the user can use join to construct UNC paths from
// a server name and a share name; for example:
// path.join('//server', 'share') -> '\\\\server\\share\\')
var needsReplace = true;
var slashCount = 0;
if (typeof firstPart === 'string' && isPathSeparator(firstPart.charCodeAt(0))) {
++slashCount;
var firstLen = firstPart.length;
if (firstLen > 1) {
if (isPathSeparator(firstPart.charCodeAt(1))) {
++slashCount;
if (firstLen > 2) {
if (isPathSeparator(firstPart.charCodeAt(2))) {
++slashCount;
}
else {
// We matched a UNC path in the first part
needsReplace = false;
}
}
}
}
}
if (needsReplace) {
// Find any more consecutive slashes we need to replace
for (; slashCount < joined.length; ++slashCount) {
if (!isPathSeparator(joined.charCodeAt(slashCount))) {
break;
}
}
// Replace the slashes if needed
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: function (from, to) {
validateString(from, 'from');
validateString(to, 'to');
if (from === to) {
return '';
}
var fromOrig = win32.resolve(from);
var toOrig = win32.resolve(to);
if (fromOrig === toOrig) {
return '';
}
from = fromOrig.toLowerCase();
to = toOrig.toLowerCase();
if (from === to) {
return '';
}
// Trim any leading backslashes
var fromStart = 0;
for (; fromStart < from.length; ++fromStart) {
if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) {
break;
}
}
// Trim trailing backslashes (applicable to UNC paths only)
var fromEnd = from.length;
for (; fromEnd - 1 > fromStart; --fromEnd) {
if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) {
break;
}
}
var fromLen = (fromEnd - fromStart);
// Trim any leading backslashes
var toStart = 0;
for (; toStart < to.length; ++toStart) {
if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) {
break;
}
}
// Trim trailing backslashes (applicable to UNC paths only)
var toEnd = to.length;
for (; toEnd - 1 > toStart; --toEnd) {
if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) {
break;
}
}
var toLen = (toEnd - toStart);
// Compare paths to find the longest common path from root
var length = (fromLen < toLen ? fromLen : toLen);
var lastCommonSep = -1;
var i = 0;
for (; i <= length; ++i) {
if (i === length) {
if (toLen > length) {
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
// We get here if `from` is the exact base path for `to`.
// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
return toOrig.slice(toStart + i + 1);
}
else if (i === 2) {
// We get here if `from` is the device root.
// For example: from='C:\\'; to='C:\\foo'
return toOrig.slice(toStart + i);
}
}
if (fromLen > length) {
if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
// We get here if `to` is the exact base path for `from`.
// For example: from='C:\\foo\\bar'; to='C:\\foo'
lastCommonSep = i;
}
else if (i === 2) {
// We get here if `to` is the device root.
// For example: from='C:\\foo\\bar'; to='C:\\'
lastCommonSep = 3;
}
}
break;
}
var fromCode = from.charCodeAt(fromStart + i);
var toCode = to.charCodeAt(toStart + i);
if (fromCode !== toCode) {
break;
}
else if (fromCode === CHAR_BACKWARD_SLASH) {
lastCommonSep = i;
}
}
// We found a mismatch before the first common path separator was seen, so
// return the original `to`.
if (i !== length && lastCommonSep === -1) {
return toOrig;
}
var out = '';
if (lastCommonSep === -1) {
lastCommonSep = 0;
}
// Generate the relative path based on the path difference between `to` and
// `from`
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
if (out.length === 0) {
out += '..';
}
else {
out += '\\..';
}
}
}
// Lastly, append the rest of the destination (`to`) path that comes after
// the common path parts
if (out.length > 0) {
return out + toOrig.slice(toStart + lastCommonSep, toEnd);
}
else {
toStart += lastCommonSep;
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) {
++toStart;
}
return toOrig.slice(toStart, toEnd);
}
},
toNamespacedPath: function (path) {
// Note: this will *probably* throw somewhere.
if (typeof path !== 'string') {
return path;
}
if (path.length === 0) {
return '';
}
var resolvedPath = win32.resolve(path);
if (resolvedPath.length >= 3) {
if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) {
// Possible UNC root
if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) {
var code = resolvedPath.charCodeAt(2);
if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
// Matched non-long UNC root, convert the path to a long UNC path
return '\\\\?\\UNC\\' + resolvedPath.slice(2);
}
}
}
else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) {
// Possible device root
if (resolvedPath.charCodeAt(1) === CHAR_COLON &&
resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) {
// Matched device root, convert the path to a long UNC path
return '\\\\?\\' + resolvedPath;
}
}
}
return path;
},
dirname: function (path) {
validateString(path, 'path');
var len = path.length;
if (len === 0) {
return '.';
}
var rootEnd = -1;
var end = -1;
var matchedSlash = true;
var offset = 0;
var code = path.charCodeAt(0);
// Try to match a root
if (len > 1) {
if (isPathSeparator(code)) {
// Possible UNC root
rootEnd = offset = 1;
if (isPathSeparator(path.charCodeAt(1))) {
// Matched double path separator at beginning
var j = 2;
var last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more path separators
for (; j < len; ++j) {
if (!isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j === len) {
// We matched a UNC root only
return path;
}
if (j !== last) {
// We matched a UNC root with leftovers
// Offset by 1 to include the separator after the UNC root to
// treat it as a "normal root" on top of a (UNC) root
rootEnd = offset = j + 1;
}
}
}
}
}
else if (isWindowsDeviceRoot(code)) {
// Possible device root
if (path.charCodeAt(1) === CHAR_COLON) {
rootEnd = offset = 2;
if (len > 2) {
if (isPathSeparator(path.charCodeAt(2))) {
rootEnd = offset = 3;
}
}
}
}
}
else if (isPathSeparator(code)) {
// `path` contains just a path separator, exit early to avoid
// unnecessary work
return path;
}
for (var i = len - 1; i >= offset; --i) {
if (isPathSeparator(path.charCodeAt(i))) {
if (!matchedSlash) {
end = i;
break;
}
}
else {
// We saw the first non-path separator
matchedSlash = false;
}
}
if (end === -1) {
if (rootEnd === -1) {
return '.';
}
else {
end = rootEnd;
}
}
return path.slice(0, end);
},
basename: function (path, ext) {
if (ext !== undefined) {
validateString(ext, 'ext');
}
validateString(path, 'path');
var start = 0;
var end = -1;
var matchedSlash = true;
var i;
// Check for a drive letter prefix so as not to mistake the following
// path separator as an extra separator at the end of the path that can be
// disregarded
if (path.length >= 2) {
var drive = path.charCodeAt(0);
if (isWindowsDeviceRoot(drive)) {
if (path.charCodeAt(1) === CHAR_COLON) {
start = 2;
}
}
}
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
if (ext.length === path.length && ext === path) {
return '';
}
var extIdx = ext.length - 1;
var firstNonSlashEnd = -1;
for (i = path.length - 1; i >= start; --i) {
var code = path.charCodeAt(i);
if (isPathSeparator(code)) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
}
else {
if (firstNonSlashEnd === -1) {
// We saw the first non-path separator, remember this index in case
// we need it if the extension ends up not matching
matchedSlash = false;
firstNonSlashEnd = i + 1;
}
if (extIdx >= 0) {
// Try to match the explicit extension
if (code === ext.charCodeAt(extIdx)) {
if (--extIdx === -1) {
// We matched the extension, so mark this as the end of our path
// component
end = i;
}
}
else {
// Extension does not match, so our result is the entire path
// component
extIdx = -1;
end = firstNonSlashEnd;
}
}
}
}
if (start === end) {
end = firstNonSlashEnd;
}
else if (end === -1) {
end = path.length;
}
return path.slice(start, end);
}
else {
for (i = path.length - 1; i >= start; --i) {
if (isPathSeparator(path.charCodeAt(i))) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
}
else if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// path component
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) {
return '';
}
return path.slice(start, end);
}
},
extname: function (path) {
validateString(path, 'path');
var start = 0;
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
// Check for a drive letter prefix so as not to mistake the following
// path separator as an extra separator at the end of the path that can be
// disregarded
if (path.length >= 2 &&
path.charCodeAt(1) === CHAR_COLON &&
isWindowsDeviceRoot(path.charCodeAt(0))) {
start = startPart = 2;
}
for (var i = path.length - 1; i >= start; --i) {
var code = path.charCodeAt(i);
if (isPathSeparator(code)) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) {
startDot = i;
}
else if (preDotState !== 1) {
preDotState = 1;
}
}
else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
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: function (pathObject) {
if (pathObject === null || typeof pathObject !== 'object') {
throw new ErrorInvalidArgType('pathObject', 'Object', pathObject);
}
return _format('\\', pathObject);
},
parse: function (path) {
validateString(path, 'path');
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
if (path.length === 0) {
return ret;
}
var len = path.length;
var rootEnd = 0;
var code = path.charCodeAt(0);
// Try to match a root
if (len > 1) {
if (isPathSeparator(code)) {
// Possible UNC root
rootEnd = 1;
if (isPathSeparator(path.charCodeAt(1))) {
// Matched double path separator at beginning
var j = 2;
var last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more path separators
for (; j < len; ++j) {
if (!isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j < len && j !== last) {
// Matched!
last = j;
// Match 1 or more non-path separators
for (; j < len; ++j) {
if (isPathSeparator(path.charCodeAt(j))) {
break;
}
}
if (j === len) {
// We matched a UNC root only
rootEnd = j;
}
else if (j !== last) {
// We matched a UNC root with leftovers
rootEnd = j + 1;
}
}
}
}
}
else if (isWindowsDeviceRoot(code)) {
// Possible device root
if (path.charCodeAt(1) === CHAR_COLON) {
rootEnd = 2;
if (len > 2) {
if (isPathSeparator(path.charCodeAt(2))) {
if (len === 3) {
// `path` contains just a drive root, exit early to avoid
// unnecessary work
ret.root = ret.dir = path;
return ret;
}
rootEnd = 3;
}
}
else {
// `path` contains just a drive root, exit early to avoid
// unnecessary work
ret.root = ret.dir = path;
return ret;
}
}
}
}
else if (isPathSeparator(code)) {
// `path` contains just a path separator, exit early to avoid
// unnecessary work
ret.root = ret.dir = path;
return ret;
}
if (rootEnd > 0) {
ret.root = path.slice(0, rootEnd);
}
var startDot = -1;
var startPart = rootEnd;
var end = -1;
var matchedSlash = true;
var i = path.length - 1;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
// Get non-dir info
for (; i >= rootEnd; --i) {
code = path.charCodeAt(i);
if (isPathSeparator(code)) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) {
startDot = i;
}
else if (preDotState !== 1) {
preDotState = 1;
}
}
else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
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)) {
if (end !== -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 the directory is the root, use the entire root as the `dir` including
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
// trailing slash (`C:\abc\def` -> `C:\abc`).
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
};
var posix = {
// path.resolve([from ...], to)
resolve: function () {
var pathSegments = [];
for (var _i = 0; _i < arguments.length; _i++) {
pathSegments[_i] = arguments[_i];
}
var resolvedPath = '';
var resolvedAbsolute = false;
for (var i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = void 0;
if (i >= 0) {
path = pathSegments[i];
}
else {
path = cwd();
}
validateString(path, 'path');
// Skip empty entries
if (path.length === 0) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, '/', isPosixPathSeparator);
if (resolvedAbsolute) {
if (resolvedPath.length > 0) {
return '/' + resolvedPath;
}
else {
return '/';
}
}
else if (resolvedPath.length > 0) {
return resolvedPath;
}
else {
return '.';
}
},
normalize: function (path) {
validateString(path, 'path');
if (path.length === 0) {
return '.';
}
var isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
var trailingSeparator = path.charCodeAt(path.length - 1) === CHAR_FORWARD_SLASH;
// Normalize the path
path = normalizeString(path, !isAbsolute, '/', isPosixPathSeparator);
if (path.length === 0 && !isAbsolute) {
path = '.';
}
if (path.length > 0 && trailingSeparator) {
path += '/';
}
if (isAbsolute) {
return '/' + path;
}
return path;
},
isAbsolute: function (path) {
validateString(path, 'path');
return path.length > 0 && path.charCodeAt(0) === CHAR_FORWARD_SLASH;
},
join: function () {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
if (paths.length === 0) {
return '.';
}
var joined;
for (var i = 0; i < paths.length; ++i) {
var arg = arguments[i];
validateString(arg, 'path');
if (arg.length > 0) {
if (joined === undefined) {
joined = arg;
}
else {
joined += '/' + arg;
}
}
}
if (joined === undefined) {
return '.';
}
return posix.normalize(joined);
},
relative: function (from, to) {
validateString(from, 'from');
validateString(to, 'to');
if (from === to) {
return '';
}
from = posix.resolve(from);
to = posix.resolve(to);
if (from === to) {
return '';
}
// Trim any leading backslashes
var fromStart = 1;
for (; fromStart < from.length; ++fromStart) {
if (from.charCodeAt(fromStart) !== CHAR_FORWARD_SLASH) {
break;
}
}
var fromEnd = from.length;
var fromLen = (fromEnd - fromStart);
// Trim any leading backslashes
var toStart = 1;
for (; toStart < to.length; ++toStart) {
if (to.charCodeAt(toStart) !== CHAR_FORWARD_SLASH) {
break;
}
}
var toEnd = to.length;
var toLen = (toEnd - toStart);
// Compare paths to find the longest common path from root
var length = (fromLen < toLen ? fromLen : toLen);
var lastCommonSep = -1;
var i = 0;
for (; i <= length; ++i) {
if (i === length) {
if (toLen > length) {
if (to.charCodeAt(toStart + i) === CHAR_FORWARD_SLASH) {
// We get here if `from` is the exact base path for `to`.
// For example: from='/foo/bar'; to='/foo/bar/baz'
return to.slice(toStart + i + 1);
}
else if (i === 0) {
// We get here if `from` is the root
// For example: from='/'; to='/foo'
return to.slice(toStart + i);
}
}
else if (fromLen > length) {
if (from.charCodeAt(fromStart + i) === CHAR_FORWARD_SLASH) {
// We get here if `to` is the exact base path for `from`.
// For example: from='/foo/bar/baz'; to='/foo/bar'
lastCommonSep = i;
}
else if (i === 0) {
// We get here if `to` is the root.
// For example: from='/foo'; to='/'
lastCommonSep = 0;
}
}
break;
}
var fromCode = from.charCodeAt(fromStart + i);
var toCode = to.charCodeAt(toStart + i);
if (fromCode !== toCode) {
break;
}
else if (fromCode === CHAR_FORWARD_SLASH) {
lastCommonSep = i;
}
}
var out = '';
// Generate the relative path based on the path difference between `to`
// and `from`
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
if (i === fromEnd || from.charCodeAt(i) === CHAR_FORWARD_SLASH) {
if (out.length === 0) {
out += '..';
}
else {
out += '/..';
}
}
}
// Lastly, append the rest of the destination (`to`) path that comes after
// the common path parts
if (out.length > 0) {
return out + to.slice(toStart + lastCommonSep);
}
else {
toStart += lastCommonSep;
if (to.charCodeAt(toStart) === CHAR_FORWARD_SLASH) {
++toStart;
}
return to.slice(toStart);
}
},
toNamespacedPath: function (path) {
// Non-op on posix systems
return path;
},
dirname: function (path) {
validateString(path, 'path');
if (path.length === 0) {
return '.';
}
var hasRoot = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
var end = -1;
var matchedSlash = true;
for (var i = path.length - 1; i >= 1; --i) {
if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
if (!matchedSlash) {
end = i;
break;
}
}
else {
// We saw the first non-path separator
matchedSlash = false;
}
}
if (end === -1) {
return hasRoot ? '/' : '.';
}
if (hasRoot && end === 1) {
return '//';
}
return path.slice(0, end);
},
basename: function (path, ext) {
if (ext !== undefined) {
validateString(ext, 'ext');
}
validateString(path, 'path');
var start = 0;
var end = -1;
var matchedSlash = true;
var i;
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
if (ext.length === path.length && ext === path) {
return '';
}
var extIdx = ext.length - 1;
var firstNonSlashEnd = -1;
for (i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
}
else {
if (firstNonSlashEnd === -1) {
// We saw the first non-path separator, remember this index in case
// we need it if the extension ends up not matching
matchedSlash = false;
firstNonSlashEnd = i + 1;
}
if (extIdx >= 0) {
// Try to match the explicit extension
if (code === ext.charCodeAt(extIdx)) {
if (--extIdx === -1) {
// We matched the extension, so mark this as the end of our path
// component
end = i;
}
}
else {
// Extension does not match, so our result is the entire path
// component
extIdx = -1;
end = firstNonSlashEnd;
}
}
}
}
if (start === end) {
end = firstNonSlashEnd;
}
else if (end === -1) {
end = path.length;
}
return path.slice(start, end);
}
else {
for (i = path.length - 1; i >= 0; --i) {
if (path.charCodeAt(i) === CHAR_FORWARD_SLASH) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
}
else if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// path component
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) {
return '';
}
return path.slice(start, end);
}
},
extname: function (path) {
validateString(path, 'path');
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
for (var i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) {
startDot = i;
}
else if (preDotState !== 1) {
preDotState = 1;
}
}
else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
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: function (pathObject) {
if (pathObject === null || typeof pathObject !== 'object') {
throw new ErrorInvalidArgType('pathObject', 'Object', pathObject);
}
return _format('/', pathObject);
},
parse: function (path) {
validateString(path, 'path');
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
if (path.length === 0) {
return ret;
}
var isAbsolute = path.charCodeAt(0) === CHAR_FORWARD_SLASH;
var start;
if (isAbsolute) {
ret.root = '/';
start = 1;
}
else {
start = 0;
}
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
var i = path.length - 1;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
// Get non-dir info
for (; i >= start; --i) {
var code = path.charCodeAt(i);
if (code === CHAR_FORWARD_SLASH) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === CHAR_DOT) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1) {
startDot = i;
}
else if (preDotState !== 1) {
preDotState = 1;
}
}
else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
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)) {
if (end !== -1) {
if (startPart === 0 && isAbsolute) {
ret.base = ret.name = path.slice(1, end);
}
else {
ret.base = ret.name = path.slice(startPart, end);
}
}
}
else {
if (startPart === 0 && isAbsolute) {
ret.name = path.slice(1, startDot);
ret.base = path.slice(1, end);
}
else {
ret.name = path.slice(startPart, startDot);
ret.base = path.slice(startPart, 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;
var normalize = (process_platform === 'win32' ? win32.normalize : posix.normalize);
var join = (process_platform === 'win32' ? win32.join : posix.join);
var relative = (process_platform === 'win32' ? win32.relative : posix.relative);
var dirname = (process_platform === 'win32' ? win32.dirname : posix.dirname);
var basename = (process_platform === 'win32' ? win32.basename : posix.basename);
var extname = (process_platform === 'win32' ? win32.extname : posix.extname);
var sep = (process_platform === 'win32' ? win32.sep : posix.sep);
/***/ }),
/* 52 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SideBySide; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _styles_module_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(374);
/* harmony import */ var _styles_module_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_styles_module_scss__WEBPACK_IMPORTED_MODULE_1__);
function SideBySide({children}){const count=react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(children);if(count!==2){throw new Error(`Invalid SideBySide children count: ${count}`);}const[left,right]=react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.toArray(children);return/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div",{className:_styles_module_scss__WEBPACK_IMPORTED_MODULE_1___default.a.sideBySide},left,right);}
/***/ }),
/* 53 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StandardKeyboardEvent; });
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var _common_keyCodes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var KEY_CODE_MAP = new Array(230);
var INVERSE_KEY_CODE_MAP = new Array(112 /* MAX_VALUE */);
(function () {
for (var i = 0; i < INVERSE_KEY_CODE_MAP.length; i++) {
INVERSE_KEY_CODE_MAP[i] = -1;
}
function define(code, keyCode) {
KEY_CODE_MAP[code] = keyCode;
INVERSE_KEY_CODE_MAP[keyCode] = code;
}
define(3, 7 /* PauseBreak */); // VK_CANCEL 0x03 Control-break processing
define(8, 1 /* Backspace */);
define(9, 2 /* Tab */);
define(13, 3 /* Enter */);
define(16, 4 /* Shift */);
define(17, 5 /* Ctrl */);
define(18, 6 /* Alt */);
define(19, 7 /* PauseBreak */);
define(20, 8 /* CapsLock */);
define(27, 9 /* Escape */);
define(32, 10 /* Space */);
define(33, 11 /* PageUp */);
define(34, 12 /* PageDown */);
define(35, 13 /* End */);
define(36, 14 /* Home */);
define(37, 15 /* LeftArrow */);
define(38, 16 /* UpArrow */);
define(39, 17 /* RightArrow */);
define(40, 18 /* DownArrow */);
define(45, 19 /* Insert */);
define(46, 20 /* Delete */);
define(48, 21 /* KEY_0 */);
define(49, 22 /* KEY_1 */);
define(50, 23 /* KEY_2 */);
define(51, 24 /* KEY_3 */);
define(52, 25 /* KEY_4 */);
define(53, 26 /* KEY_5 */);
define(54, 27 /* KEY_6 */);
define(55, 28 /* KEY_7 */);
define(56, 29 /* KEY_8 */);
define(57, 30 /* KEY_9 */);
define(65, 31 /* KEY_A */);
define(66, 32 /* KEY_B */);
define(67, 33 /* KEY_C */);
define(68, 34 /* KEY_D */);
define(69, 35 /* KEY_E */);
define(70, 36 /* KEY_F */);
define(71, 37 /* KEY_G */);
define(72, 38 /* KEY_H */);
define(73, 39 /* KEY_I */);
define(74, 40 /* KEY_J */);
define(75, 41 /* KEY_K */);
define(76, 42 /* KEY_L */);
define(77, 43 /* KEY_M */);
define(78, 44 /* KEY_N */);
define(79, 45 /* KEY_O */);
define(80, 46 /* KEY_P */);
define(81, 47 /* KEY_Q */);
define(82, 48 /* KEY_R */);
define(83, 49 /* KEY_S */);
define(84, 50 /* KEY_T */);
define(85, 51 /* KEY_U */);
define(86, 52 /* KEY_V */);
define(87, 53 /* KEY_W */);
define(88, 54 /* KEY_X */);
define(89, 55 /* KEY_Y */);
define(90, 56 /* KEY_Z */);
define(93, 58 /* ContextMenu */);
define(96, 93 /* NUMPAD_0 */);
define(97, 94 /* NUMPAD_1 */);
define(98, 95 /* NUMPAD_2 */);
define(99, 96 /* NUMPAD_3 */);
define(100, 97 /* NUMPAD_4 */);
define(101, 98 /* NUMPAD_5 */);
define(102, 99 /* NUMPAD_6 */);
define(103, 100 /* NUMPAD_7 */);
define(104, 101 /* NUMPAD_8 */);
define(105, 102 /* NUMPAD_9 */);
define(106, 103 /* NUMPAD_MULTIPLY */);
define(107, 104 /* NUMPAD_ADD */);
define(108, 105 /* NUMPAD_SEPARATOR */);
define(109, 106 /* NUMPAD_SUBTRACT */);
define(110, 107 /* NUMPAD_DECIMAL */);
define(111, 108 /* NUMPAD_DIVIDE */);
define(112, 59 /* F1 */);
define(113, 60 /* F2 */);
define(114, 61 /* F3 */);
define(115, 62 /* F4 */);
define(116, 63 /* F5 */);
define(117, 64 /* F6 */);
define(118, 65 /* F7 */);
define(119, 66 /* F8 */);
define(120, 67 /* F9 */);
define(121, 68 /* F10 */);
define(122, 69 /* F11 */);
define(123, 70 /* F12 */);
define(124, 71 /* F13 */);
define(125, 72 /* F14 */);
define(126, 73 /* F15 */);
define(127, 74 /* F16 */);
define(128, 75 /* F17 */);
define(129, 76 /* F18 */);
define(130, 77 /* F19 */);
define(144, 78 /* NumLock */);
define(145, 79 /* ScrollLock */);
define(186, 80 /* US_SEMICOLON */);
define(187, 81 /* US_EQUAL */);
define(188, 82 /* US_COMMA */);
define(189, 83 /* US_MINUS */);
define(190, 84 /* US_DOT */);
define(191, 85 /* US_SLASH */);
define(192, 86 /* US_BACKTICK */);
define(193, 110 /* ABNT_C1 */);
define(194, 111 /* ABNT_C2 */);
define(219, 87 /* US_OPEN_SQUARE_BRACKET */);
define(220, 88 /* US_BACKSLASH */);
define(221, 89 /* US_CLOSE_SQUARE_BRACKET */);
define(222, 90 /* US_QUOTE */);
define(223, 91 /* OEM_8 */);
define(226, 92 /* OEM_102 */);
/**
* 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.
*/
define(229, 109 /* KEY_IN_COMPOSITION */);
if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isIE */ "i"]) {
define(91, 57 /* Meta */);
}
else if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isFirefox */ "h"]) {
define(59, 80 /* US_SEMICOLON */);
define(107, 81 /* US_EQUAL */);
define(109, 83 /* US_MINUS */);
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isMacintosh */ "e"]) {
define(224, 57 /* Meta */);
}
}
else if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isWebKit */ "m"]) {
define(91, 57 /* Meta */);
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isMacintosh */ "e"]) {
// the two meta keys in the Mac have different key codes (91 and 93)
define(93, 57 /* Meta */);
}
else {
define(92, 57 /* Meta */);
}
}
})();
function extractKeyCode(e) {
if (e.charCode) {
// "keypress" events mostly
var char = String.fromCharCode(e.charCode).toUpperCase();
return _common_keyCodes_js__WEBPACK_IMPORTED_MODULE_1__[/* KeyCodeUtils */ "b"].fromString(char);
}
return KEY_CODE_MAP[e.keyCode] || 0 /* Unknown */;
}
var ctrlKeyMod = (_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isMacintosh */ "e"] ? 256 /* WinCtrl */ : 2048 /* CtrlCmd */);
var altKeyMod = 512 /* Alt */;
var shiftKeyMod = 1024 /* Shift */;
var metaKeyMod = (_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isMacintosh */ "e"] ? 2048 /* CtrlCmd */ : 256 /* WinCtrl */);
var StandardKeyboardEvent = /** @class */ (function () {
function StandardKeyboardEvent(source) {
this._standardKeyboardEventBrand = true;
var 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.keyCode = extractKeyCode(e);
this.code = e.code;
// console.info(e.type + ": keyCode: " + e.keyCode + ", which: " + e.which + ", charCode: " + e.charCode + ", detail: " + e.detail + " ====> " + this.keyCode + ' -- ' + KeyCode[this.keyCode]);
this.ctrlKey = this.ctrlKey || this.keyCode === 5 /* Ctrl */;
this.altKey = this.altKey || this.keyCode === 6 /* Alt */;
this.shiftKey = this.shiftKey || this.keyCode === 4 /* Shift */;
this.metaKey = this.metaKey || this.keyCode === 57 /* Meta */;
this._asKeybinding = this._computeKeybinding();
this._asRuntimeKeybinding = this._computeRuntimeKeybinding();
// console.log(`code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`);
}
StandardKeyboardEvent.prototype.preventDefault = function () {
if (this.browserEvent && this.browserEvent.preventDefault) {
this.browserEvent.preventDefault();
}
};
StandardKeyboardEvent.prototype.stopPropagation = function () {
if (this.browserEvent && this.browserEvent.stopPropagation) {
this.browserEvent.stopPropagation();
}
};
StandardKeyboardEvent.prototype.toKeybinding = function () {
return this._asRuntimeKeybinding;
};
StandardKeyboardEvent.prototype.equals = function (other) {
return this._asKeybinding === other;
};
StandardKeyboardEvent.prototype._computeKeybinding = function () {
var key = 0 /* Unknown */;
if (this.keyCode !== 5 /* Ctrl */ && this.keyCode !== 4 /* Shift */ && this.keyCode !== 6 /* Alt */ && this.keyCode !== 57 /* Meta */) {
key = this.keyCode;
}
var 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;
};
StandardKeyboardEvent.prototype._computeRuntimeKeybinding = function () {
var key = 0 /* Unknown */;
if (this.keyCode !== 5 /* Ctrl */ && this.keyCode !== 4 /* Shift */ && this.keyCode !== 6 /* Alt */ && this.keyCode !== 57 /* Meta */) {
key = this.keyCode;
}
return new _common_keyCodes_js__WEBPACK_IMPORTED_MODULE_1__[/* SimpleKeybinding */ "e"](this.ctrlKey, this.shiftKey, this.altKey, this.metaKey, key);
};
return StandardKeyboardEvent;
}());
/***/ }),
/* 54 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EventType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Gesture; });
/* harmony import */ var _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
/* harmony import */ var _common_decorators_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(95);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (undefined && undefined.__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;
};
var EventType;
(function (EventType) {
EventType.Tap = '-monaco-gesturetap';
EventType.Change = '-monaco-gesturechange';
EventType.Start = '-monaco-gesturestart';
EventType.End = '-monaco-gesturesend';
EventType.Contextmenu = '-monaco-gesturecontextmenu';
})(EventType || (EventType = {}));
var Gesture = /** @class */ (function (_super) {
__extends(Gesture, _super);
function Gesture() {
var _this = _super.call(this) || this;
_this.dispatched = false;
_this.activeTouches = {};
_this.handle = null;
_this.targets = [];
_this.ignoreTargets = [];
_this._lastSetTapCountTime = 0;
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_2__[/* addDisposableListener */ "j"](document, 'touchstart', function (e) { return _this.onTouchStart(e); }));
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_2__[/* addDisposableListener */ "j"](document, 'touchend', function (e) { return _this.onTouchEnd(e); }));
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_2__[/* addDisposableListener */ "j"](document, 'touchmove', function (e) { return _this.onTouchMove(e); }));
return _this;
}
Gesture.addTarget = function (element) {
if (!Gesture.isTouchDevice()) {
return _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* Disposable */ "a"].None;
}
if (!Gesture.INSTANCE) {
Gesture.INSTANCE = new Gesture();
}
Gesture.INSTANCE.targets.push(element);
return {
dispose: function () {
Gesture.INSTANCE.targets = Gesture.INSTANCE.targets.filter(function (t) { return t !== element; });
}
};
};
Gesture.ignoreTarget = function (element) {
if (!Gesture.isTouchDevice()) {
return _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* Disposable */ "a"].None;
}
if (!Gesture.INSTANCE) {
Gesture.INSTANCE = new Gesture();
}
Gesture.INSTANCE.ignoreTargets.push(element);
return {
dispose: function () {
Gesture.INSTANCE.ignoreTargets = Gesture.INSTANCE.ignoreTargets.filter(function (t) { return t !== element; });
}
};
};
Gesture.isTouchDevice = function () {
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0;
};
Gesture.prototype.dispose = function () {
if (this.handle) {
this.handle.dispose();
this.handle = null;
}
_super.prototype.dispose.call(this);
};
Gesture.prototype.onTouchStart = function (e) {
var timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
if (this.handle) {
this.handle.dispose();
this.handle = null;
}
for (var i = 0, len = e.targetTouches.length; i < len; i++) {
var 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]
};
var evt = this.newGestureEvent(EventType.Start, touch.target);
evt.pageX = touch.pageX;
evt.pageY = touch.pageY;
this.dispatchEvent(evt);
}
if (this.dispatched) {
e.preventDefault();
e.stopPropagation();
this.dispatched = false;
}
};
Gesture.prototype.onTouchEnd = function (e) {
var timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
var activeTouchCount = Object.keys(this.activeTouches).length;
var _loop_1 = function (i, len) {
var touch = e.changedTouches.item(i);
if (!this_1.activeTouches.hasOwnProperty(String(touch.identifier))) {
console.warn('move of an UNKNOWN touch', touch);
return "continue";
}
var data = this_1.activeTouches[touch.identifier], holdTime = Date.now() - data.initialTimeStamp;
if (holdTime < Gesture.HOLD_DELAY
&& Math.abs(data.initialPageX - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX)) < 30
&& Math.abs(data.initialPageY - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY)) < 30) {
var evt = this_1.newGestureEvent(EventType.Tap, data.initialTarget);
evt.pageX = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX);
evt.pageY = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY);
this_1.dispatchEvent(evt);
}
else if (holdTime >= Gesture.HOLD_DELAY
&& Math.abs(data.initialPageX - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX)) < 30
&& Math.abs(data.initialPageY - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY)) < 30) {
var evt = this_1.newGestureEvent(EventType.Contextmenu, data.initialTarget);
evt.pageX = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX);
evt.pageY = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY);
this_1.dispatchEvent(evt);
}
else if (activeTouchCount === 1) {
var finalX = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX);
var finalY = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY);
var deltaT = _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingTimestamps) - data.rollingTimestamps[0];
var deltaX = finalX - data.rollingPageX[0];
var deltaY = finalY - data.rollingPageY[0];
// We need to get all the dispatch targets on the start of the inertia event
var dispatchTo = this_1.targets.filter(function (t) { return data.initialTarget instanceof Node && t.contains(data.initialTarget); });
this_1.inertia(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_1.dispatchEvent(this_1.newGestureEvent(EventType.End, data.initialTarget));
// forget about this touch
delete this_1.activeTouches[touch.identifier];
};
var this_1 = this;
for (var i = 0, len = e.changedTouches.length; i < len; i++) {
_loop_1(i, len);
}
if (this.dispatched) {
e.preventDefault();
e.stopPropagation();
this.dispatched = false;
}
};
Gesture.prototype.newGestureEvent = function (type, initialTarget) {
var event = document.createEvent('CustomEvent');
event.initEvent(type, false, true);
event.initialTarget = initialTarget;
event.tapCount = 0;
return event;
};
Gesture.prototype.dispatchEvent = function (event) {
var _this = this;
if (event.type === EventType.Tap) {
var currentTime = (new Date()).getTime();
var 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 === EventType.Change || event.type === EventType.Contextmenu) {
// tap is canceled by scrolling or context menu
this._lastSetTapCountTime = 0;
}
for (var i = 0; i < this.ignoreTargets.length; i++) {
if (event.initialTarget instanceof Node && this.ignoreTargets[i].contains(event.initialTarget)) {
return;
}
}
this.targets.forEach(function (target) {
if (event.initialTarget instanceof Node && target.contains(event.initialTarget)) {
target.dispatchEvent(event);
_this.dispatched = true;
}
});
};
Gesture.prototype.inertia = function (dispatchTo, t1, vX, dirX, x, vY, dirY, y) {
var _this = this;
this.handle = _dom_js__WEBPACK_IMPORTED_MODULE_2__[/* scheduleAtNextAnimationFrame */ "W"](function () {
var now = Date.now();
// velocity: old speed + accel_over_time
var deltaT = now - t1, delta_pos_x = 0, delta_pos_y = 0, 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;
}
// dispatch translation event
var evt = _this.newGestureEvent(EventType.Change);
evt.translationX = delta_pos_x;
evt.translationY = delta_pos_y;
dispatchTo.forEach(function (d) { return d.dispatchEvent(evt); });
if (!stopped) {
_this.inertia(dispatchTo, now, vX, dirX, x + delta_pos_x, vY, dirY, y + delta_pos_y);
}
});
};
Gesture.prototype.onTouchMove = function (e) {
var timestamp = Date.now(); // use Date.now() because on FF e.timeStamp is not epoch based.
for (var i = 0, len = e.changedTouches.length; i < len; i++) {
var touch = e.changedTouches.item(i);
if (!this.activeTouches.hasOwnProperty(String(touch.identifier))) {
console.warn('end of an UNKNOWN touch', touch);
continue;
}
var data = this.activeTouches[touch.identifier];
var evt = this.newGestureEvent(EventType.Change, data.initialTarget);
evt.translationX = touch.pageX - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageX);
evt.translationY = touch.pageY - _common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* tail */ "v"](data.rollingPageY);
evt.pageX = touch.pageX;
evt.pageY = touch.pageY;
this.dispatchEvent(evt);
// only keep a few data points, to average the final speed
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 = -0.005;
Gesture.HOLD_DELAY = 700;
Gesture.CLEAR_TAP_COUNT_TIME = 400; // ms
__decorate([
_common_decorators_js__WEBPACK_IMPORTED_MODULE_3__[/* memoize */ "a"]
], Gesture, "isTouchDevice", null);
return Gesture;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* Disposable */ "a"]));
/***/ }),
/* 55 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return values; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return keys; });
/* unused harmony export StringIterator */
/* unused harmony export PathIterator */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return TernarySearchTree; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ResourceMap; });
/* unused harmony export LinkedMap */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LRUCache; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
function values(forEachable) {
var result = [];
forEachable.forEach(function (value) { return result.push(value); });
return result;
}
function keys(map) {
var result = [];
map.forEach(function (_value, key) { return result.push(key); });
return result;
}
var StringIterator = /** @class */ (function () {
function StringIterator() {
this._value = '';
this._pos = 0;
}
StringIterator.prototype.reset = function (key) {
this._value = key;
this._pos = 0;
return this;
};
StringIterator.prototype.next = function () {
this._pos += 1;
return this;
};
StringIterator.prototype.hasNext = function () {
return this._pos < this._value.length - 1;
};
StringIterator.prototype.cmp = function (a) {
var aCode = a.charCodeAt(0);
var thisCode = this._value.charCodeAt(this._pos);
return aCode - thisCode;
};
StringIterator.prototype.value = function () {
return this._value[this._pos];
};
return StringIterator;
}());
var PathIterator = /** @class */ (function () {
function PathIterator(_splitOnBackslash) {
if (_splitOnBackslash === void 0) { _splitOnBackslash = true; }
this._splitOnBackslash = _splitOnBackslash;
}
PathIterator.prototype.reset = function (key) {
this._value = key.replace(/\\$|\/$/, '');
this._from = 0;
this._to = 0;
return this.next();
};
PathIterator.prototype.hasNext = function () {
return this._to < this._value.length;
};
PathIterator.prototype.next = function () {
// this._data = key.split(/[\\/]/).filter(s => !!s);
this._from = this._to;
var justSeps = true;
for (; this._to < this._value.length; this._to++) {
var ch = this._value.charCodeAt(this._to);
if (ch === 47 /* Slash */ || this._splitOnBackslash && ch === 92 /* Backslash */) {
if (justSeps) {
this._from++;
}
else {
break;
}
}
else {
justSeps = false;
}
}
return this;
};
PathIterator.prototype.cmp = function (a) {
var aPos = 0;
var aLen = a.length;
var thisPos = this._from;
while (aPos < aLen && thisPos < this._to) {
var cmp = a.charCodeAt(aPos) - this._value.charCodeAt(thisPos);
if (cmp !== 0) {
return cmp;
}
aPos += 1;
thisPos += 1;
}
if (aLen === this._to - this._from) {
return 0;
}
else if (aPos < aLen) {
return -1;
}
else {
return 1;
}
};
PathIterator.prototype.value = function () {
return this._value.substring(this._from, this._to);
};
return PathIterator;
}());
var TernarySearchTreeNode = /** @class */ (function () {
function TernarySearchTreeNode() {
}
return TernarySearchTreeNode;
}());
var TernarySearchTree = /** @class */ (function () {
function TernarySearchTree(segments) {
this._iter = segments;
}
TernarySearchTree.forPaths = function () {
return new TernarySearchTree(new PathIterator());
};
TernarySearchTree.forStrings = function () {
return new TernarySearchTree(new StringIterator());
};
TernarySearchTree.prototype.clear = function () {
this._root = undefined;
};
TernarySearchTree.prototype.set = function (key, element) {
var iter = this._iter.reset(key);
var node;
if (!this._root) {
this._root = new TernarySearchTreeNode();
this._root.segment = iter.value();
}
node = this._root;
while (true) {
var val = iter.cmp(node.segment);
if (val > 0) {
// left
if (!node.left) {
node.left = new TernarySearchTreeNode();
node.left.segment = iter.value();
}
node = node.left;
}
else if (val < 0) {
// right
if (!node.right) {
node.right = new TernarySearchTreeNode();
node.right.segment = iter.value();
}
node = node.right;
}
else if (iter.hasNext()) {
// mid
iter.next();
if (!node.mid) {
node.mid = new TernarySearchTreeNode();
node.mid.segment = iter.value();
}
node = node.mid;
}
else {
break;
}
}
var oldElement = node.value;
node.value = element;
node.key = key;
return oldElement;
};
TernarySearchTree.prototype.get = function (key) {
var iter = this._iter.reset(key);
var node = this._root;
while (node) {
var val = iter.cmp(node.segment);
if (val > 0) {
// left
node = node.left;
}
else if (val < 0) {
// right
node = node.right;
}
else if (iter.hasNext()) {
// mid
iter.next();
node = node.mid;
}
else {
break;
}
}
return node ? node.value : undefined;
};
TernarySearchTree.prototype.findSubstr = function (key) {
var iter = this._iter.reset(key);
var node = this._root;
var candidate = undefined;
while (node) {
var val = iter.cmp(node.segment);
if (val > 0) {
// left
node = node.left;
}
else if (val < 0) {
// right
node = node.right;
}
else if (iter.hasNext()) {
// mid
iter.next();
candidate = node.value || candidate;
node = node.mid;
}
else {
break;
}
}
return node && node.value || candidate;
};
TernarySearchTree.prototype.forEach = function (callback) {
this._forEach(this._root, callback);
};
TernarySearchTree.prototype._forEach = function (node, callback) {
if (node) {
// left
this._forEach(node.left, callback);
// node
if (node.value) {
// callback(node.value, this._iter.join(parts));
callback(node.value, node.key);
}
// mid
this._forEach(node.mid, callback);
// right
this._forEach(node.right, callback);
}
};
return TernarySearchTree;
}());
var ResourceMap = /** @class */ (function () {
function ResourceMap() {
this.map = new Map();
this.ignoreCase = false; // in the future this should be an uri-comparator
}
ResourceMap.prototype.set = function (resource, value) {
this.map.set(this.toKey(resource), value);
};
ResourceMap.prototype.get = function (resource) {
return this.map.get(this.toKey(resource));
};
ResourceMap.prototype.toKey = function (resource) {
var key = resource.toString();
if (this.ignoreCase) {
key = key.toLowerCase();
}
return key;
};
return ResourceMap;
}());
var LinkedMap = /** @class */ (function () {
function LinkedMap() {
this._map = new Map();
this._head = undefined;
this._tail = undefined;
this._size = 0;
}
LinkedMap.prototype.clear = function () {
this._map.clear();
this._head = undefined;
this._tail = undefined;
this._size = 0;
};
Object.defineProperty(LinkedMap.prototype, "size", {
get: function () {
return this._size;
},
enumerable: true,
configurable: true
});
LinkedMap.prototype.get = function (key, touch) {
if (touch === void 0) { touch = 0 /* None */; }
var item = this._map.get(key);
if (!item) {
return undefined;
}
if (touch !== 0 /* None */) {
this.touch(item, touch);
}
return item.value;
};
LinkedMap.prototype.set = function (key, value, touch) {
if (touch === void 0) { touch = 0 /* None */; }
var item = this._map.get(key);
if (item) {
item.value = value;
if (touch !== 0 /* None */) {
this.touch(item, touch);
}
}
else {
item = { key: key, value: value, next: undefined, previous: undefined };
switch (touch) {
case 0 /* None */:
this.addItemLast(item);
break;
case 1 /* AsOld */:
this.addItemFirst(item);
break;
case 2 /* AsNew */:
this.addItemLast(item);
break;
default:
this.addItemLast(item);
break;
}
this._map.set(key, item);
this._size++;
}
};
LinkedMap.prototype.delete = function (key) {
return !!this.remove(key);
};
LinkedMap.prototype.remove = function (key) {
var item = this._map.get(key);
if (!item) {
return undefined;
}
this._map.delete(key);
this.removeItem(item);
this._size--;
return item.value;
};
LinkedMap.prototype.forEach = function (callbackfn, thisArg) {
var current = this._head;
while (current) {
if (thisArg) {
callbackfn.bind(thisArg)(current.value, current.key, this);
}
else {
callbackfn(current.value, current.key, this);
}
current = current.next;
}
};
/* VS Code / Monaco editor runs on es5 which has no Symbol.iterator
keys(): IterableIterator {
const current = this._head;
const iterator: IterableIterator = {
[Symbol.iterator]() {
return iterator;
},
next():IteratorResult {
if (current) {
const result = { value: current.key, done: false };
current = current.next;
return result;
} else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
values(): IterableIterator {
const current = this._head;
const iterator: IterableIterator = {
[Symbol.iterator]() {
return iterator;
},
next():IteratorResult {
if (current) {
const result = { value: current.value, done: false };
current = current.next;
return result;
} else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
*/
LinkedMap.prototype.trimOld = function (newSize) {
if (newSize >= this.size) {
return;
}
if (newSize === 0) {
this.clear();
return;
}
var current = this._head;
var 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 = undefined;
}
};
LinkedMap.prototype.addItemFirst = function (item) {
// First time Insert
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;
};
LinkedMap.prototype.addItemLast = function (item) {
// First time Insert
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;
};
LinkedMap.prototype.removeItem = function (item) {
if (item === this._head && item === this._tail) {
this._head = undefined;
this._tail = undefined;
}
else if (item === this._head) {
// This can only happend if size === 1 which is handle
// by the case above.
if (!item.next) {
throw new Error('Invalid list');
}
item.next.previous = undefined;
this._head = item.next;
}
else if (item === this._tail) {
// This can only happend if size === 1 which is handle
// by the case above.
if (!item.previous) {
throw new Error('Invalid list');
}
item.previous.next = undefined;
this._tail = item.previous;
}
else {
var next = item.next;
var previous = item.previous;
if (!next || !previous) {
throw new Error('Invalid list');
}
next.previous = previous;
previous.next = next;
}
item.next = undefined;
item.previous = undefined;
};
LinkedMap.prototype.touch = function (item, touch) {
if (!this._head || !this._tail) {
throw new Error('Invalid list');
}
if ((touch !== 1 /* AsOld */ && touch !== 2 /* AsNew */)) {
return;
}
if (touch === 1 /* AsOld */) {
if (item === this._head) {
return;
}
var next = item.next;
var previous = item.previous;
// Unlink the item
if (item === this._tail) {
// previous must be defined since item was not head but is tail
// So there are more than on item in the map
previous.next = undefined;
this._tail = previous;
}
else {
// Both next and previous are not undefined since item was neither head nor tail.
next.previous = previous;
previous.next = next;
}
// Insert the node at head
item.previous = undefined;
item.next = this._head;
this._head.previous = item;
this._head = item;
}
else if (touch === 2 /* AsNew */) {
if (item === this._tail) {
return;
}
var next = item.next;
var previous = item.previous;
// Unlink the item.
if (item === this._head) {
// next must be defined since item was not tail but is head
// So there are more than on item in the map
next.previous = undefined;
this._head = next;
}
else {
// Both next and previous are not undefined since item was neither head nor tail.
next.previous = previous;
previous.next = next;
}
item.next = undefined;
item.previous = this._tail;
this._tail.next = item;
this._tail = item;
}
};
LinkedMap.prototype.toJSON = function () {
var data = [];
this.forEach(function (value, key) {
data.push([key, value]);
});
return data;
};
return LinkedMap;
}());
var LRUCache = /** @class */ (function (_super) {
__extends(LRUCache, _super);
function LRUCache(limit, ratio) {
if (ratio === void 0) { ratio = 1; }
var _this = _super.call(this) || this;
_this._limit = limit;
_this._ratio = Math.min(Math.max(0, ratio), 1);
return _this;
}
LRUCache.prototype.get = function (key) {
return _super.prototype.get.call(this, key, 2 /* AsNew */);
};
LRUCache.prototype.peek = function (key) {
return _super.prototype.get.call(this, key, 0 /* None */);
};
LRUCache.prototype.set = function (key, value) {
_super.prototype.set.call(this, key, value, 2 /* AsNew */);
this.checkTrim();
};
LRUCache.prototype.checkTrim = function () {
if (this.size > this._limit) {
this.trimOld(Math.round(this._limit * this._ratio));
}
};
return LRUCache;
}(LinkedMap));
/***/ }),
/* 56 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IndentAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return StandardAutoClosingPairConditional; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Describes what to do with the indentation when pressing Enter.
*/
var IndentAction;
(function (IndentAction) {
/**
* Insert new line and copy the previous line's indentation.
*/
IndentAction[IndentAction["None"] = 0] = "None";
/**
* Insert new line and indent once (relative to the previous line's indentation).
*/
IndentAction[IndentAction["Indent"] = 1] = "Indent";
/**
* Insert two new lines:
* - the first one indented which will hold the cursor
* - the second one at the same indentation level
*/
IndentAction[IndentAction["IndentOutdent"] = 2] = "IndentOutdent";
/**
* Insert new line and outdent once (relative to the previous line's indentation).
*/
IndentAction[IndentAction["Outdent"] = 3] = "Outdent";
})(IndentAction || (IndentAction = {}));
/**
* @internal
*/
var StandardAutoClosingPairConditional = /** @class */ (function () {
function StandardAutoClosingPairConditional(source) {
this.open = source.open;
this.close = source.close;
// initially allowed in all tokens
this._standardTokenMask = 0;
if (Array.isArray(source.notIn)) {
for (var i = 0, len = source.notIn.length; i < len; i++) {
var notIn = source.notIn[i];
switch (notIn) {
case 'string':
this._standardTokenMask |= 2 /* String */;
break;
case 'comment':
this._standardTokenMask |= 1 /* Comment */;
break;
case 'regex':
this._standardTokenMask |= 4 /* RegEx */;
break;
}
}
}
}
StandardAutoClosingPairConditional.prototype.isOK = function (standardToken) {
return (this._standardTokenMask & standardToken) === 0;
};
return StandardAutoClosingPairConditional;
}());
/***/ }),
/* 57 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Registry; });
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
/* harmony import */ var _base_common_assert_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(143);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var RegistryImpl = /** @class */ (function () {
function RegistryImpl() {
this.data = new Map();
}
RegistryImpl.prototype.add = function (id, data) {
_base_common_assert_js__WEBPACK_IMPORTED_MODULE_1__[/* ok */ "a"](_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isString */ "j"](id));
_base_common_assert_js__WEBPACK_IMPORTED_MODULE_1__[/* ok */ "a"](_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"](data));
_base_common_assert_js__WEBPACK_IMPORTED_MODULE_1__[/* ok */ "a"](!this.data.has(id), 'There is already an extension with this id');
this.data.set(id, data);
};
RegistryImpl.prototype.as = function (id) {
return this.data.get(id) || null;
};
return RegistryImpl;
}());
var Registry = new RegistryImpl();
/***/ }),
/* 58 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IModelService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return shouldSynchronizeModel; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IModelService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('modelService');
function shouldSynchronizeModel(model) {
return (!model.isTooLargeForSyncing() && !model.isForSimpleWidget);
}
/***/ }),
/* 59 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EditOperation; });
/* harmony import */ var _range_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var EditOperation = /** @class */ (function () {
function EditOperation() {
}
EditOperation.insert = function (position, text) {
return {
range: new _range_js__WEBPACK_IMPORTED_MODULE_0__[/* Range */ "a"](position.lineNumber, position.column, position.lineNumber, position.column),
text: text,
forceMoveMarkers: true
};
};
EditOperation.delete = function (range) {
return {
range: range,
text: null
};
};
EditOperation.replace = function (range, text) {
return {
range: range,
text: text
};
};
EditOperation.replaceMove = function (range, text) {
return {
range: range,
text: text,
forceMoveMarkers: true
};
};
return EditOperation;
}());
/***/ }),
/* 60 */
/***/ (function(module, exports) {
module.exports = require("path");
/***/ }),
/* 61 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setARIAContainer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return alert; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return status; });
/* harmony import */ var _aria_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(621);
/* harmony import */ var _aria_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aria_css__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ariaContainer;
var alertContainer;
var statusContainer;
function setARIAContainer(parent) {
ariaContainer = document.createElement('div');
ariaContainer.className = 'monaco-aria-container';
alertContainer = document.createElement('div');
alertContainer.className = 'monaco-alert';
alertContainer.setAttribute('role', 'alert');
alertContainer.setAttribute('aria-atomic', 'true');
ariaContainer.appendChild(alertContainer);
statusContainer = document.createElement('div');
statusContainer.className = 'monaco-status';
statusContainer.setAttribute('role', 'status');
statusContainer.setAttribute('aria-atomic', 'true');
ariaContainer.appendChild(statusContainer);
parent.appendChild(ariaContainer);
}
/**
* Given the provided message, will make sure that it is read as alert to screen readers.
*/
function alert(msg, disableRepeat) {
insertMessage(alertContainer, msg, disableRepeat);
}
/**
* Given the provided message, will make sure that it is read as status to screen readers.
*/
function status(msg, disableRepeat) {
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* isMacintosh */ "e"]) {
alert(msg, disableRepeat); // VoiceOver does not seem to support status role
}
else {
insertMessage(statusContainer, msg, disableRepeat);
}
}
var repeatedTimes = 0;
var prevText = undefined;
function insertMessage(target, msg, disableRepeat) {
if (!ariaContainer) {
return;
}
// If the same message should be inserted that is already present, a screen reader would
// not announce this message because it matches the previous one. As a workaround, we
// alter the message with the number of occurences unless this is explicitly disabled
// via the disableRepeat flag.
if (!disableRepeat) {
if (prevText === msg) {
repeatedTimes++;
}
else {
prevText = msg;
repeatedTimes = 0;
}
switch (repeatedTimes) {
case 0: break;
case 1:
msg = _nls_js__WEBPACK_IMPORTED_MODULE_1__[/* localize */ "a"]('repeated', "{0} (occurred again)", msg);
break;
default:
msg = _nls_js__WEBPACK_IMPORTED_MODULE_1__[/* localize */ "a"]('repeatedNtimes', "{0} (occurred {1} times)", msg, repeatedTimes);
break;
}
}
_dom_js__WEBPACK_IMPORTED_MODULE_3__[/* clearNode */ "t"](target);
target.textContent = msg;
// See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/
target.style.visibility = 'hidden';
target.style.visibility = 'visible';
}
/***/ }),
/* 62 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return Viewport; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MinimapLinesRenderingData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ViewLineData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ViewLineRenderingData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InlineDecoration; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ViewModelDecoration; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Viewport = /** @class */ (function () {
function Viewport(top, left, width, height) {
this.top = top | 0;
this.left = left | 0;
this.width = width | 0;
this.height = height | 0;
}
return Viewport;
}());
var MinimapLinesRenderingData = /** @class */ (function () {
function MinimapLinesRenderingData(tabSize, data) {
this.tabSize = tabSize;
this.data = data;
}
return MinimapLinesRenderingData;
}());
var ViewLineData = /** @class */ (function () {
function ViewLineData(content, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, tokens) {
this.content = content;
this.continuesWithWrappedLine = continuesWithWrappedLine;
this.minColumn = minColumn;
this.maxColumn = maxColumn;
this.startVisibleColumn = startVisibleColumn;
this.tokens = tokens;
}
return ViewLineData;
}());
var ViewLineRenderingData = /** @class */ (function () {
function ViewLineRenderingData(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;
}
ViewLineRenderingData.isBasicASCII = function (lineContent, mightContainNonBasicASCII) {
if (mightContainNonBasicASCII) {
return _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isBasicASCII */ "v"](lineContent);
}
return true;
};
ViewLineRenderingData.containsRTL = function (lineContent, isBasicASCII, mightContainRTL) {
if (!isBasicASCII && mightContainRTL) {
return _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* containsRTL */ "i"](lineContent);
}
return false;
};
return ViewLineRenderingData;
}());
var InlineDecoration = /** @class */ (function () {
function InlineDecoration(range, inlineClassName, type) {
this.range = range;
this.inlineClassName = inlineClassName;
this.type = type;
}
return InlineDecoration;
}());
var ViewModelDecoration = /** @class */ (function () {
function ViewModelDecoration(range, options) {
this.range = range;
this.options = options;
}
return ViewModelDecoration;
}());
/***/ }),
/* 63 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export CursorPosition */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MoveOperations; });
/* harmony import */ var _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var CursorPosition = /** @class */ (function () {
function CursorPosition(lineNumber, column, leftoverVisibleColumns) {
this.lineNumber = lineNumber;
this.column = column;
this.leftoverVisibleColumns = leftoverVisibleColumns;
}
return CursorPosition;
}());
var MoveOperations = /** @class */ (function () {
function MoveOperations() {
}
MoveOperations.leftPosition = function (model, lineNumber, column) {
if (column > model.getLineMinColumn(lineNumber)) {
column = column - _base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* prevCharLength */ "G"](model.getLineContent(lineNumber), column - 1);
}
else if (lineNumber > 1) {
lineNumber = lineNumber - 1;
column = model.getLineMaxColumn(lineNumber);
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](lineNumber, column);
};
MoveOperations.left = function (config, model, lineNumber, column) {
var pos = MoveOperations.leftPosition(model, lineNumber, column);
return new CursorPosition(pos.lineNumber, pos.column, 0);
};
MoveOperations.moveLeft = function (config, model, cursor, inSelectionMode, noOfColumns) {
var lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
// If we are in selection mode, move left without selection cancels selection and puts cursor at the beginning of the selection
lineNumber = cursor.selection.startLineNumber;
column = cursor.selection.startColumn;
}
else {
var r = MoveOperations.left(config, model, cursor.position.lineNumber, cursor.position.column - (noOfColumns - 1));
lineNumber = r.lineNumber;
column = r.column;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
};
MoveOperations.rightPosition = function (model, lineNumber, column) {
if (column < model.getLineMaxColumn(lineNumber)) {
column = column + _base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* nextCharLength */ "E"](model.getLineContent(lineNumber), column - 1);
}
else if (lineNumber < model.getLineCount()) {
lineNumber = lineNumber + 1;
column = model.getLineMinColumn(lineNumber);
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](lineNumber, column);
};
MoveOperations.right = function (config, model, lineNumber, column) {
var pos = MoveOperations.rightPosition(model, lineNumber, column);
return new CursorPosition(pos.lineNumber, pos.column, 0);
};
MoveOperations.moveRight = function (config, model, cursor, inSelectionMode, noOfColumns) {
var lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
// If we are in selection mode, move right without selection cancels selection and puts cursor at the end of the selection
lineNumber = cursor.selection.endLineNumber;
column = cursor.selection.endColumn;
}
else {
var r = MoveOperations.right(config, model, cursor.position.lineNumber, cursor.position.column + (noOfColumns - 1));
lineNumber = r.lineNumber;
column = r.column;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
};
MoveOperations.down = function (config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnLastLine) {
var currentVisibleColumn = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;
lineNumber = lineNumber + count;
var lineCount = model.getLineCount();
if (lineNumber > lineCount) {
lineNumber = lineCount;
if (allowMoveOnLastLine) {
column = model.getLineMaxColumn(lineNumber);
}
else {
column = Math.min(model.getLineMaxColumn(lineNumber), column);
}
}
else {
column = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].columnFromVisibleColumn2(config, model, lineNumber, currentVisibleColumn);
}
leftoverVisibleColumns = currentVisibleColumn - _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);
return new CursorPosition(lineNumber, column, leftoverVisibleColumns);
};
MoveOperations.moveDown = function (config, model, cursor, inSelectionMode, linesCount) {
var lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
// If we are in selection mode, move down acts relative to the end of selection
lineNumber = cursor.selection.endLineNumber;
column = cursor.selection.endColumn;
}
else {
lineNumber = cursor.position.lineNumber;
column = cursor.position.column;
}
var r = MoveOperations.down(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);
return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);
};
MoveOperations.translateDown = function (config, model, cursor) {
var selection = cursor.selection;
var selectionStart = MoveOperations.down(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);
var position = MoveOperations.down(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);
return new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), selectionStart.leftoverVisibleColumns, new _core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](position.lineNumber, position.column), position.leftoverVisibleColumns);
};
MoveOperations.up = function (config, model, lineNumber, column, leftoverVisibleColumns, count, allowMoveOnFirstLine) {
var currentVisibleColumn = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;
lineNumber = lineNumber - count;
if (lineNumber < 1) {
lineNumber = 1;
if (allowMoveOnFirstLine) {
column = model.getLineMinColumn(lineNumber);
}
else {
column = Math.min(model.getLineMaxColumn(lineNumber), column);
}
}
else {
column = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].columnFromVisibleColumn2(config, model, lineNumber, currentVisibleColumn);
}
leftoverVisibleColumns = currentVisibleColumn - _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* CursorColumns */ "a"].visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);
return new CursorPosition(lineNumber, column, leftoverVisibleColumns);
};
MoveOperations.moveUp = function (config, model, cursor, inSelectionMode, linesCount) {
var lineNumber, column;
if (cursor.hasSelection() && !inSelectionMode) {
// If we are in selection mode, move up acts relative to the beginning of selection
lineNumber = cursor.selection.startLineNumber;
column = cursor.selection.startColumn;
}
else {
lineNumber = cursor.position.lineNumber;
column = cursor.position.column;
}
var r = MoveOperations.up(config, model, lineNumber, column, cursor.leftoverVisibleColumns, linesCount, true);
return cursor.move(inSelectionMode, r.lineNumber, r.column, r.leftoverVisibleColumns);
};
MoveOperations.translateUp = function (config, model, cursor) {
var selection = cursor.selection;
var selectionStart = MoveOperations.up(config, model, selection.selectionStartLineNumber, selection.selectionStartColumn, cursor.selectionStartLeftoverVisibleColumns, 1, false);
var position = MoveOperations.up(config, model, selection.positionLineNumber, selection.positionColumn, cursor.leftoverVisibleColumns, 1, false);
return new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](selectionStart.lineNumber, selectionStart.column, selectionStart.lineNumber, selectionStart.column), selectionStart.leftoverVisibleColumns, new _core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](position.lineNumber, position.column), position.leftoverVisibleColumns);
};
MoveOperations.moveToBeginningOfLine = function (config, model, cursor, inSelectionMode) {
var lineNumber = cursor.position.lineNumber;
var minColumn = model.getLineMinColumn(lineNumber);
var firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;
var column;
var relevantColumnNumber = cursor.position.column;
if (relevantColumnNumber === firstNonBlankColumn) {
column = minColumn;
}
else {
column = firstNonBlankColumn;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
};
MoveOperations.moveToEndOfLine = function (config, model, cursor, inSelectionMode) {
var lineNumber = cursor.position.lineNumber;
var maxColumn = model.getLineMaxColumn(lineNumber);
return cursor.move(inSelectionMode, lineNumber, maxColumn, 0);
};
MoveOperations.moveToBeginningOfBuffer = function (config, model, cursor, inSelectionMode) {
return cursor.move(inSelectionMode, 1, 1, 0);
};
MoveOperations.moveToEndOfBuffer = function (config, model, cursor, inSelectionMode) {
var lastLineNumber = model.getLineCount();
var lastColumn = model.getLineMaxColumn(lastLineNumber);
return cursor.move(inSelectionMode, lastLineNumber, lastColumn, 0);
};
return MoveOperations;
}());
/***/ }),
/* 64 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IOpenerService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NullOpenerService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return matchesScheme; });
/* harmony import */ var _base_common_uri_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
/* harmony import */ var _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var IOpenerService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__[/* createDecorator */ "c"])('openerService');
var NullOpenerService = Object.freeze({
_serviceBrand: undefined,
registerOpener: function () { return _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"].None; },
registerValidator: function () { return _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"].None; },
registerExternalUriResolver: function () { return _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"].None; },
setExternalOpener: function () { },
open: function () {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, false];
}); });
},
resolveExternalUri: function (uri) {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, { resolved: uri, dispose: function () { } }];
}); });
},
});
function matchesScheme(target, scheme) {
if (_base_common_uri_js__WEBPACK_IMPORTED_MODULE_0__[/* URI */ "a"].isUri(target)) {
return Object(_base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* equalsIgnoreCase */ "n"])(target.scheme, scheme);
}
else {
return Object(_base_common_strings_js__WEBPACK_IMPORTED_MODULE_3__[/* startsWithIgnoreCase */ "O"])(target, scheme + ':');
}
}
/***/ }),
/* 65 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export or */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return matchesPrefix; });
/* unused harmony export matchesContiguousSubString */
/* unused harmony export matchesSubString */
/* unused harmony export isUpper */
/* unused harmony export matchesCamelCase */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return matchesFuzzy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return anyScore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return createMatches; });
/* unused harmony export isPatternInWord */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FuzzyScore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return fuzzyScore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return fuzzyScoreGracefulAggressive; });
/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(55);
/* harmony import */ var _strings_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Combined filters
/**
* @returns A filter which combines the provided set
* of filters with an or. The *first* filters that
* matches defined the return value of the returned
* filter.
*/
function or() {
var filter = [];
for (var _i = 0; _i < arguments.length; _i++) {
filter[_i] = arguments[_i];
}
return function (word, wordToMatchAgainst) {
for (var i = 0, len = filter.length; i < len; i++) {
var match = filter[i](word, wordToMatchAgainst);
if (match) {
return match;
}
}
return null;
};
}
var matchesPrefix = _matchesPrefix.bind(undefined, true);
function _matchesPrefix(ignoreCase, word, wordToMatchAgainst) {
if (!wordToMatchAgainst || wordToMatchAgainst.length < word.length) {
return null;
}
var matches;
if (ignoreCase) {
matches = _strings_js__WEBPACK_IMPORTED_MODULE_1__[/* startsWithIgnoreCase */ "O"](wordToMatchAgainst, word);
}
else {
matches = wordToMatchAgainst.indexOf(word) === 0;
}
if (!matches) {
return null;
}
return word.length > 0 ? [{ start: 0, end: word.length }] : [];
}
// Contiguous Substring
function matchesContiguousSubString(word, wordToMatchAgainst) {
var index = wordToMatchAgainst.toLowerCase().indexOf(word.toLowerCase());
if (index === -1) {
return null;
}
return [{ start: index, end: index + word.length }];
}
// Substring
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]) {
var 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);
}
}
// CamelCase
function isLower(code) {
return 97 /* a */ <= code && code <= 122 /* z */;
}
function isUpper(code) {
return 65 /* A */ <= code && code <= 90 /* Z */;
}
function isNumber(code) {
return 48 /* Digit0 */ <= code && code <= 57 /* Digit9 */;
}
function isWhitespace(code) {
return (code === 32 /* Space */
|| code === 9 /* Tab */
|| code === 10 /* LineFeed */
|| code === 13 /* CarriageReturn */);
}
var wordSeparators = new Set();
'`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?'
.split('')
.forEach(function (s) { return wordSeparators.add(s.charCodeAt(0)); });
function isAlphanumeric(code) {
return isLower(code) || isUpper(code) || isNumber(code);
}
function join(head, tail) {
if (tail.length === 0) {
tail = [head];
}
else if (head.end === tail[0].start) {
tail[0].start = head.start;
}
else {
tail.unshift(head);
}
return tail;
}
function nextAnchor(camelCaseWord, start) {
for (var i = start; i < camelCaseWord.length; i++) {
var c = camelCaseWord.charCodeAt(i);
if (isUpper(c) || isNumber(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 {
var result = null;
var 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);
}
}
// Heuristic to avoid computing camel case matcher for words that don't
// look like camelCaseWords.
function analyzeCamelCaseWord(word) {
var upper = 0, lower = 0, alpha = 0, numeric = 0, code = 0;
for (var i = 0; i < word.length; i++) {
code = word.charCodeAt(i);
if (isUpper(code)) {
upper++;
}
if (isLower(code)) {
lower++;
}
if (isAlphanumeric(code)) {
alpha++;
}
if (isNumber(code)) {
numeric++;
}
}
var upperPercent = upper / word.length;
var lowerPercent = lower / word.length;
var alphaPercent = alpha / word.length;
var numericPercent = numeric / word.length;
return { upperPercent: upperPercent, lowerPercent: lowerPercent, alphaPercent: alphaPercent, numericPercent: numericPercent };
}
function isUpperCaseWord(analysis) {
var upperPercent = analysis.upperPercent, lowerPercent = analysis.lowerPercent;
return lowerPercent === 0 && upperPercent > 0.6;
}
function isCamelCaseWord(analysis) {
var upperPercent = analysis.upperPercent, lowerPercent = analysis.lowerPercent, alphaPercent = analysis.alphaPercent, numericPercent = analysis.numericPercent;
return lowerPercent > 0.2 && upperPercent < 0.8 && alphaPercent > 0.6 && numericPercent < 0.2;
}
// Heuristic to avoid computing camel case matcher for words that don't
// look like camel case patterns.
function isCamelCasePattern(word) {
var upper = 0, lower = 0, code = 0, whitespace = 0;
for (var 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) {
return null;
}
var analysis = analyzeCamelCaseWord(camelCaseWord);
if (!isCamelCaseWord(analysis)) {
if (!isUpperCaseWord(analysis)) {
return null;
}
camelCaseWord = camelCaseWord.toLowerCase();
}
var result = null;
var i = 0;
word = word.toLowerCase();
while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) {
i = nextAnchor(camelCaseWord, i + 1);
}
return result;
}
// Fuzzy
var fuzzyContiguousFilter = or(matchesPrefix, matchesCamelCase, matchesContiguousSubString);
var fuzzySeparateFilter = or(matchesPrefix, matchesCamelCase, matchesSubString);
var fuzzyRegExpCache = new _map_js__WEBPACK_IMPORTED_MODULE_0__[/* LRUCache */ "a"](10000); // bounded to 10000 elements
function matchesFuzzy(word, wordToMatchAgainst, enableSeparateSubstringMatching) {
if (enableSeparateSubstringMatching === void 0) { enableSeparateSubstringMatching = false; }
if (typeof word !== 'string' || typeof wordToMatchAgainst !== 'string') {
return null; // return early for invalid input
}
// Form RegExp for wildcard matches
var regexp = fuzzyRegExpCache.get(word);
if (!regexp) {
regexp = new RegExp(_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* convertSimple2RegExpPattern */ "k"](word), 'i');
fuzzyRegExpCache.set(word, regexp);
}
// RegExp Filter
var match = regexp.exec(wordToMatchAgainst);
if (match) {
return [{ start: match.index, end: match.index + match[0].length }];
}
// Default Filter
return enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst);
}
function anyScore(pattern, lowPattern, _patternPos, word, lowWord, _wordPos) {
var result = fuzzyScore(pattern, lowPattern, 0, word, lowWord, 0, true);
if (result) {
return result;
}
var matches = 0;
var score = 0;
var idx = _wordPos;
for (var patternPos = 0; patternPos < lowPattern.length && patternPos < _maxLen; ++patternPos) {
var wordPos = lowWord.indexOf(lowPattern.charAt(patternPos), idx);
if (wordPos >= 0) {
score += 1;
matches += Math.pow(2, wordPos);
idx = wordPos + 1;
}
else if (matches !== 0) {
// once we have started matching things
// we need to match the remaining pattern
// characters
break;
}
}
return [score, matches, _wordPos];
}
//#region --- fuzzyScore ---
function createMatches(score) {
if (typeof score === 'undefined') {
return [];
}
var matches = score[1].toString(2);
var wordStart = score[2];
var res = [];
for (var pos = wordStart; pos < _maxLen; pos++) {
if (matches[matches.length - (pos + 1)] === '1') {
var last = res[res.length - 1];
if (last && last.end === pos) {
last.end = pos + 1;
}
else {
res.push({ start: pos, end: pos + 1 });
}
}
}
return res;
}
var _maxLen = 128;
function initTable() {
var table = [];
var row = [0];
for (var i = 1; i <= _maxLen; i++) {
row.push(-i);
}
for (var i = 0; i <= _maxLen; i++) {
var thisRow = row.slice(0);
thisRow[0] = -i;
table.push(thisRow);
}
return table;
}
var _table = initTable();
var _scores = initTable();
var _arrows = initTable();
var _debug = false;
function printTable(table, pattern, patternLen, word, wordLen) {
function pad(s, n, pad) {
if (pad === void 0) { pad = ' '; }
while (s.length < n) {
s = pad + s;
}
return s;
}
var ret = " | |" + word.split('').map(function (c) { return pad(c, 3); }).join('|') + "\n";
for (var i = 0; i <= patternLen; i++) {
if (i === 0) {
ret += ' |';
}
else {
ret += pattern[i - 1] + "|";
}
ret += table[i].slice(0, wordLen + 1).map(function (n) { return 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(_scores, pattern, pattern.length, word, word.length));
}
function isSeparatorAtPos(value, index) {
if (index < 0 || index >= value.length) {
return false;
}
var code = value.charCodeAt(index);
switch (code) {
case 95 /* Underline */:
case 45 /* Dash */:
case 46 /* Period */:
case 32 /* Space */:
case 47 /* Slash */:
case 92 /* Backslash */:
case 39 /* SingleQuote */:
case 34 /* DoubleQuote */:
case 58 /* Colon */:
case 36 /* DollarSign */:
return true;
default:
return false;
}
}
function isWhitespaceAtPos(value, index) {
if (index < 0 || index >= value.length) {
return false;
}
var code = value.charCodeAt(index);
switch (code) {
case 32 /* Space */:
case 9 /* Tab */:
return true;
default:
return false;
}
}
function isUpperCaseAtPos(pos, word, wordLow) {
return word[pos] !== wordLow[pos];
}
function isPatternInWord(patternLow, patternPos, patternLen, wordLow, wordPos, wordLen) {
while (patternPos < patternLen && wordPos < wordLen) {
if (patternLow[patternPos] === wordLow[wordPos]) {
patternPos += 1;
}
wordPos += 1;
}
return patternPos === patternLen; // pattern must be exhausted
}
var FuzzyScore;
(function (FuzzyScore) {
/**
* No matches and value `-100`
*/
FuzzyScore.Default = Object.freeze([-100, 0, 0]);
function isDefault(score) {
return !score || (score[0] === -100 && score[1] === 0 && score[2] === 0);
}
FuzzyScore.isDefault = isDefault;
})(FuzzyScore || (FuzzyScore = {}));
function fuzzyScore(pattern, patternLow, patternStart, word, wordLow, wordStart, firstMatchCanBeWeak) {
var patternLen = pattern.length > _maxLen ? _maxLen : pattern.length;
var wordLen = word.length > _maxLen ? _maxLen : word.length;
if (patternStart >= patternLen || wordStart >= wordLen || (patternLen - patternStart) > (wordLen - wordStart)) {
return undefined;
}
// Run a simple check if the characters of pattern occur
// (in order) at all in word. If that isn't the case we
// stop because no match will be possible
if (!isPatternInWord(patternLow, patternStart, patternLen, wordLow, wordStart, wordLen)) {
return undefined;
}
var row = 1;
var column = 1;
var patternPos = patternStart;
var wordPos = wordStart;
// There will be a match, fill in tables
for (row = 1, patternPos = patternStart; patternPos < patternLen; row++, patternPos++) {
for (column = 1, wordPos = wordStart; wordPos < wordLen; column++, wordPos++) {
var score = _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos);
_scores[row][column] = score;
var diag = _table[row - 1][column - 1] + (score > 1 ? 1 : score);
var top_1 = _table[row - 1][column] + -1;
var left = _table[row][column - 1] + -1;
if (left >= top_1) {
// left or diag
if (left > diag) {
_table[row][column] = left;
_arrows[row][column] = 4 /* Left */;
}
else if (left === diag) {
_table[row][column] = left;
_arrows[row][column] = 4 /* Left */ | 2 /* Diag */;
}
else {
_table[row][column] = diag;
_arrows[row][column] = 2 /* Diag */;
}
}
else {
// top or diag
if (top_1 > diag) {
_table[row][column] = top_1;
_arrows[row][column] = 1 /* Top */;
}
else if (top_1 === diag) {
_table[row][column] = top_1;
_arrows[row][column] = 1 /* Top */ | 2 /* Diag */;
}
else {
_table[row][column] = diag;
_arrows[row][column] = 2 /* Diag */;
}
}
}
}
if (_debug) {
printTables(pattern, patternStart, word, wordStart);
}
_matchesCount = 0;
_topScore = -100;
_wordStart = wordStart;
_firstMatchCanBeWeak = firstMatchCanBeWeak;
_findAllMatches2(row - 1, column - 1, patternLen === wordLen ? 1 : 0, 0, false);
if (_matchesCount === 0) {
return undefined;
}
return [_topScore, _topMatch2, wordStart];
}
function _doScore(pattern, patternLow, patternPos, patternStart, word, wordLow, wordPos) {
if (patternLow[patternPos] !== wordLow[wordPos]) {
return -1;
}
if (wordPos === (patternPos - patternStart)) {
// common prefix: `foobar <-> foobaz`
// ^^^^^
if (pattern[patternPos] === word[wordPos]) {
return 7;
}
else {
return 5;
}
}
else if (isUpperCaseAtPos(wordPos, word, wordLow) && (wordPos === 0 || !isUpperCaseAtPos(wordPos - 1, word, wordLow))) {
// hitting upper-case: `foo <-> forOthers`
// ^^ ^
if (pattern[patternPos] === word[wordPos]) {
return 7;
}
else {
return 5;
}
}
else if (isSeparatorAtPos(wordLow, wordPos) && (wordPos === 0 || !isSeparatorAtPos(wordLow, wordPos - 1))) {
// hitting a separator: `. <-> foo.bar`
// ^
return 5;
}
else if (isSeparatorAtPos(wordLow, wordPos - 1) || isWhitespaceAtPos(wordLow, wordPos - 1)) {
// post separator: `foo <-> bar_foo`
// ^^^
return 5;
}
else {
return 1;
}
}
var _matchesCount = 0;
var _topMatch2 = 0;
var _topScore = 0;
var _wordStart = 0;
var _firstMatchCanBeWeak = false;
function _findAllMatches2(row, column, total, matches, lastMatched) {
if (_matchesCount >= 10 || total < -25) {
// stop when having already 10 results, or
// when a potential alignment as already 5 gaps
return;
}
var simpleMatchCount = 0;
while (row > 0 && column > 0) {
var score = _scores[row][column];
var arrow = _arrows[row][column];
if (arrow === 4 /* Left */) {
// left -> no match, skip a word character
column -= 1;
if (lastMatched) {
total -= 5; // new gap penalty
}
else if (matches !== 0) {
total -= 1; // gap penalty after first match
}
lastMatched = false;
simpleMatchCount = 0;
}
else if (arrow & 2 /* Diag */) {
if (arrow & 4 /* Left */) {
// left
_findAllMatches2(row, column - 1, matches !== 0 ? total - 1 : total, // gap penalty after first match
matches, lastMatched);
}
// diag
total += score;
row -= 1;
column -= 1;
lastMatched = true;
// match -> set a 1 at the word pos
matches += Math.pow(2, (column + _wordStart));
// count simple matches and boost a row of
// simple matches when they yield in a
// strong match.
if (score === 1) {
simpleMatchCount += 1;
if (row === 0 && !_firstMatchCanBeWeak) {
// when the first match is a weak
// match we discard it
return undefined;
}
}
else {
// boost
total += 1 + (simpleMatchCount * (score - 1));
simpleMatchCount = 0;
}
}
else {
return undefined;
}
}
total -= column >= 3 ? 9 : column * 3; // late start penalty
// dynamically keep track of the current top score
// and insert the current best score at head, the rest at tail
_matchesCount += 1;
if (total > _topScore) {
_topScore = total;
_topMatch2 = matches;
}
}
//#endregion
//#region --- graceful ---
function fuzzyScoreGracefulAggressive(pattern, lowPattern, patternPos, word, lowWord, wordPos, firstMatchCanBeWeak) {
return fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, true, firstMatchCanBeWeak);
}
function fuzzyScoreWithPermutations(pattern, lowPattern, patternPos, word, lowWord, wordPos, aggressive, firstMatchCanBeWeak) {
var top = fuzzyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos, firstMatchCanBeWeak);
if (top && !aggressive) {
// when using the original pattern yield a result we`
// return it unless we are aggressive and try to find
// a better alignment, e.g. `cno` -> `^co^ns^ole` or `^c^o^nsole`.
return top;
}
if (pattern.length >= 3) {
// When the pattern is long enough then try a few (max 7)
// permutations of the pattern to find a better match. The
// permutations only swap neighbouring characters, e.g
// `cnoso` becomes `conso`, `cnsoo`, `cnoos`.
var tries = Math.min(7, pattern.length - 1);
for (var movingPatternPos = patternPos + 1; movingPatternPos < tries; movingPatternPos++) {
var newPattern = nextTypoPermutation(pattern, movingPatternPos);
if (newPattern) {
var candidate = fuzzyScore(newPattern, newPattern.toLowerCase(), patternPos, word, lowWord, wordPos, firstMatchCanBeWeak);
if (candidate) {
candidate[0] -= 3; // permutation penalty
if (!top || candidate[0] > top[0]) {
top = candidate;
}
}
}
}
}
return top;
}
function nextTypoPermutation(pattern, patternPos) {
if (patternPos + 1 >= pattern.length) {
return undefined;
}
var swap1 = pattern[patternPos];
var swap2 = pattern[patternPos + 1];
if (swap1 === swap2) {
return undefined;
}
return pattern.slice(0, patternPos)
+ swap2
+ swap1
+ pattern.slice(patternPos + 2);
}
//#endregion
/***/ }),
/* 66 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(223);
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function useDocusaurusContext(){return Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_context__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]);}/* harmony default export */ __webpack_exports__["a"] = (useDocusaurusContext);
/***/ }),
/* 67 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Widget; });
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53);
/* harmony import */ var _mouseEvent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
/* harmony import */ var _touch_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Widget = /** @class */ (function (_super) {
__extends(Widget, _super);
function Widget() {
return _super !== null && _super.apply(this, arguments) || this;
}
Widget.prototype.onclick = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].CLICK, function (e) { return listener(new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_2__[/* StandardMouseEvent */ "b"](e)); }));
};
Widget.prototype.onmousedown = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].MOUSE_DOWN, function (e) { return listener(new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_2__[/* StandardMouseEvent */ "b"](e)); }));
};
Widget.prototype.onmouseover = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].MOUSE_OVER, function (e) { return listener(new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_2__[/* StandardMouseEvent */ "b"](e)); }));
};
Widget.prototype.onnonbubblingmouseout = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableNonBubblingMouseOutListener */ "k"](domNode, function (e) { return listener(new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_2__[/* StandardMouseEvent */ "b"](e)); }));
};
Widget.prototype.onkeydown = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].KEY_DOWN, function (e) { return listener(new _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_1__[/* StandardKeyboardEvent */ "a"](e)); }));
};
Widget.prototype.onkeyup = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].KEY_UP, function (e) { return listener(new _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_1__[/* StandardKeyboardEvent */ "a"](e)); }));
};
Widget.prototype.oninput = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].INPUT, listener));
};
Widget.prototype.onblur = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].BLUR, listener));
};
Widget.prototype.onfocus = function (domNode, listener) {
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](domNode, _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* EventType */ "d"].FOCUS, listener));
};
Widget.prototype.ignoreGesture = function (domNode) {
_touch_js__WEBPACK_IMPORTED_MODULE_4__[/* Gesture */ "b"].ignoreTarget(domNode);
};
return Widget;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__[/* Disposable */ "a"]));
/***/ }),
/* 68 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isIMenuItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IMenuService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MenuRegistry; });
/* unused harmony export ExecuteCommandAction */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SubmenuItemAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MenuItemAction; });
/* harmony import */ var _base_common_actions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69);
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
/* harmony import */ var _contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
/* harmony import */ var _commands_common_commands_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (undefined && undefined.__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;
};
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function isIMenuItem(item) {
return item.command !== undefined;
}
var IMenuService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_1__[/* createDecorator */ "c"])('menuService');
var MenuRegistry = new /** @class */ (function () {
function class_1() {
this._commands = new Map();
this._menuItems = new Map();
this._onDidChangeMenu = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_4__[/* Emitter */ "a"]();
this.onDidChangeMenu = this._onDidChangeMenu.event;
}
class_1.prototype.addCommand = function (command) {
var _this = this;
this._commands.set(command.id, command);
this._onDidChangeMenu.fire(0 /* CommandPalette */);
return {
dispose: function () {
if (_this._commands.delete(command.id)) {
_this._onDidChangeMenu.fire(0 /* CommandPalette */);
}
}
};
};
class_1.prototype.getCommand = function (id) {
return this._commands.get(id);
};
class_1.prototype.getCommands = function () {
var map = new Map();
this._commands.forEach(function (value, key) { return map.set(key, value); });
return map;
};
class_1.prototype.appendMenuItem = function (id, item) {
var _this = this;
var array = this._menuItems.get(id);
if (!array) {
array = [item];
this._menuItems.set(id, array);
}
else {
array.push(item);
}
this._onDidChangeMenu.fire(id);
return {
dispose: function () {
var idx = array.indexOf(item);
if (idx >= 0) {
array.splice(idx, 1);
_this._onDidChangeMenu.fire(id);
}
}
};
};
class_1.prototype.getMenuItems = function (id) {
var result = (this._menuItems.get(id) || []).slice(0);
if (id === 0 /* CommandPalette */) {
// CommandPalette is special because it shows
// all commands by default
this._appendImplicitItems(result);
}
return result;
};
class_1.prototype._appendImplicitItems = function (result) {
var set = new Set();
var temp = result.filter(function (item) { return isIMenuItem(item); });
for (var _i = 0, temp_1 = temp; _i < temp_1.length; _i++) {
var _a = temp_1[_i], command = _a.command, alt = _a.alt;
set.add(command.id);
if (alt) {
set.add(alt.id);
}
}
this._commands.forEach(function (command, id) {
if (!set.has(id)) {
result.push({ command: command });
}
});
};
return class_1;
}());
var ExecuteCommandAction = /** @class */ (function (_super) {
__extends(ExecuteCommandAction, _super);
function ExecuteCommandAction(id, label, _commandService) {
var _this = _super.call(this, id, label) || this;
_this._commandService = _commandService;
return _this;
}
ExecuteCommandAction.prototype.run = function () {
var _a;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return (_a = this._commandService).executeCommand.apply(_a, __spreadArrays([this.id], args));
};
ExecuteCommandAction = __decorate([
__param(2, _commands_common_commands_js__WEBPACK_IMPORTED_MODULE_3__[/* ICommandService */ "b"])
], ExecuteCommandAction);
return ExecuteCommandAction;
}(_base_common_actions_js__WEBPACK_IMPORTED_MODULE_0__[/* Action */ "a"]));
var SubmenuItemAction = /** @class */ (function (_super) {
__extends(SubmenuItemAction, _super);
function SubmenuItemAction(item) {
var _this = this;
typeof item.title === 'string' ? _this = _super.call(this, '', item.title, 'submenu') || this : _this = _super.call(this, '', item.title.value, 'submenu') || this;
_this.item = item;
return _this;
}
return SubmenuItemAction;
}(_base_common_actions_js__WEBPACK_IMPORTED_MODULE_0__[/* Action */ "a"]));
var MenuItemAction = /** @class */ (function (_super) {
__extends(MenuItemAction, _super);
function MenuItemAction(item, alt, options, contextKeyService, commandService) {
var _this = this;
typeof item.title === 'string' ? _this = _super.call(this, item.id, item.title, commandService) || this : _this = _super.call(this, item.id, item.title.value, commandService) || this;
_this._cssClass = undefined;
_this._enabled = !item.precondition || contextKeyService.contextMatchesRules(item.precondition);
_this._checked = Boolean(item.toggled && contextKeyService.contextMatchesRules(item.toggled));
_this._options = options || {};
_this.item = item;
_this.alt = alt ? new MenuItemAction(alt, undefined, _this._options, contextKeyService, commandService) : undefined;
return _this;
}
MenuItemAction.prototype.dispose = function () {
if (this.alt) {
this.alt.dispose();
}
_super.prototype.dispose.call(this);
};
MenuItemAction.prototype.run = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var runArgs = [];
if (this._options.arg) {
runArgs = __spreadArrays(runArgs, [this._options.arg]);
}
if (this._options.shouldForwardArgs) {
runArgs = __spreadArrays(runArgs, args);
}
return _super.prototype.run.apply(this, runArgs);
};
MenuItemAction = __decorate([
__param(3, _contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_2__[/* IContextKeyService */ "c"]),
__param(4, _commands_common_commands_js__WEBPACK_IMPORTED_MODULE_3__[/* ICommandService */ "b"])
], MenuItemAction);
return MenuItemAction;
}(ExecuteCommandAction));
//#endregion
/***/ }),
/* 69 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Action; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ActionRunner; });
/* harmony import */ var _lifecycle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
/* harmony import */ var _event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var Action = /** @class */ (function (_super) {
__extends(Action, _super);
function Action(id, label, cssClass, enabled, actionCallback) {
if (label === void 0) { label = ''; }
if (cssClass === void 0) { cssClass = ''; }
if (enabled === void 0) { enabled = true; }
var _this = _super.call(this) || this;
_this._onDidChange = _this._register(new _event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onDidChange = _this._onDidChange.event;
_this._enabled = true;
_this._checked = false;
_this._id = id;
_this._label = label;
_this._cssClass = cssClass;
_this._enabled = enabled;
_this._actionCallback = actionCallback;
return _this;
}
Object.defineProperty(Action.prototype, "id", {
get: function () {
return this._id;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Action.prototype, "label", {
get: function () {
return this._label;
},
set: function (value) {
this._setLabel(value);
},
enumerable: true,
configurable: true
});
Action.prototype._setLabel = function (value) {
if (this._label !== value) {
this._label = value;
this._onDidChange.fire({ label: value });
}
};
Object.defineProperty(Action.prototype, "tooltip", {
get: function () {
return this._tooltip || '';
},
set: function (value) {
this._setTooltip(value);
},
enumerable: true,
configurable: true
});
Action.prototype._setTooltip = function (value) {
if (this._tooltip !== value) {
this._tooltip = value;
this._onDidChange.fire({ tooltip: value });
}
};
Object.defineProperty(Action.prototype, "class", {
get: function () {
return this._cssClass;
},
set: function (value) {
this._setClass(value);
},
enumerable: true,
configurable: true
});
Action.prototype._setClass = function (value) {
if (this._cssClass !== value) {
this._cssClass = value;
this._onDidChange.fire({ class: value });
}
};
Object.defineProperty(Action.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
this._setEnabled(value);
},
enumerable: true,
configurable: true
});
Action.prototype._setEnabled = function (value) {
if (this._enabled !== value) {
this._enabled = value;
this._onDidChange.fire({ enabled: value });
}
};
Object.defineProperty(Action.prototype, "checked", {
get: function () {
return this._checked;
},
set: function (value) {
this._setChecked(value);
},
enumerable: true,
configurable: true
});
Action.prototype._setChecked = function (value) {
if (this._checked !== value) {
this._checked = value;
this._onDidChange.fire({ checked: value });
}
};
Action.prototype.run = function (event, _data) {
if (this._actionCallback) {
return this._actionCallback(event);
}
return Promise.resolve(true);
};
return Action;
}(_lifecycle_js__WEBPACK_IMPORTED_MODULE_0__[/* Disposable */ "a"]));
var ActionRunner = /** @class */ (function (_super) {
__extends(ActionRunner, _super);
function ActionRunner() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._onDidBeforeRun = _this._register(new _event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onDidBeforeRun = _this._onDidBeforeRun.event;
_this._onDidRun = _this._register(new _event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onDidRun = _this._onDidRun.event;
return _this;
}
ActionRunner.prototype.run = function (action, context) {
return __awaiter(this, void 0, void 0, function () {
var result, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!action.enabled) {
return [2 /*return*/, Promise.resolve(null)];
}
this._onDidBeforeRun.fire({ action: action });
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.runAction(action, context)];
case 2:
result = _a.sent();
this._onDidRun.fire({ action: action, result: result });
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
this._onDidRun.fire({ action: action, error: error_1 });
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
};
ActionRunner.prototype.runAction = function (action, context) {
var res = context ? action.run(context) : action.run();
return Promise.resolve(res);
};
return ActionRunner;
}(_lifecycle_js__WEBPACK_IMPORTED_MODULE_0__[/* Disposable */ "a"]));
/***/ }),
/* 70 */
/***/ (function(module, exports) {
var Token = {
AT_RULE: 'at-rule', // e.g. `@import`, `@charset`
AT_RULE_BLOCK: 'at-rule-block', // e.g. `@font-face{...}`
AT_RULE_BLOCK_SCOPE: 'at-rule-block-scope', // e.g. `@font-face`
COMMENT: 'comment', // e.g. `/* comment */`
NESTED_BLOCK: 'nested-block', // e.g. `@media screen{...}`, `@keyframes animation {...}`
NESTED_BLOCK_SCOPE: 'nested-block-scope', // e.g. `@media`, `@keyframes`
PROPERTY: 'property', // e.g. `color:red`
PROPERTY_BLOCK: 'property-block', // e.g. `--var:{color:red}`
PROPERTY_NAME: 'property-name', // e.g. `color`
PROPERTY_VALUE: 'property-value', // e.g. `red`
RAW: 'raw', // e.g. anything between /* clean-css ignore:start */ and /* clean-css ignore:end */ comments
RULE: 'rule', // e.g `div > a{...}`
RULE_SCOPE: 'rule-scope' // e.g `div > a`
};
module.exports = Token;
/***/ }),
/* 71 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ clearAllFontInfos; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ configuration_Configuration; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/browser.js
var browser = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/config/charWidthReader.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var CharWidthRequest = /** @class */ (function () {
function CharWidthRequest(chr, type) {
this.chr = chr;
this.type = type;
this.width = 0;
}
CharWidthRequest.prototype.fulfill = function (width) {
this.width = width;
};
return CharWidthRequest;
}());
var DomCharWidthReader = /** @class */ (function () {
function DomCharWidthReader(bareFontInfo, requests) {
this._bareFontInfo = bareFontInfo;
this._requests = requests;
this._container = null;
this._testElements = null;
}
DomCharWidthReader.prototype.read = function () {
// Create a test container with all these test elements
this._createDomElements();
// Add the container to the DOM
document.body.appendChild(this._container);
// Read character widths
this._readFromDomElements();
// Remove the container from the DOM
document.body.removeChild(this._container);
this._container = null;
this._testElements = null;
};
DomCharWidthReader.prototype._createDomElements = function () {
var container = document.createElement('div');
container.style.position = 'absolute';
container.style.top = '-50000px';
container.style.width = '50000px';
var regularDomNode = document.createElement('div');
regularDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();
regularDomNode.style.fontWeight = this._bareFontInfo.fontWeight;
regularDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';
regularDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;
regularDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';
regularDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';
container.appendChild(regularDomNode);
var boldDomNode = document.createElement('div');
boldDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();
boldDomNode.style.fontWeight = 'bold';
boldDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';
boldDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;
boldDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';
boldDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';
container.appendChild(boldDomNode);
var italicDomNode = document.createElement('div');
italicDomNode.style.fontFamily = this._bareFontInfo.getMassagedFontFamily();
italicDomNode.style.fontWeight = this._bareFontInfo.fontWeight;
italicDomNode.style.fontSize = this._bareFontInfo.fontSize + 'px';
italicDomNode.style.fontFeatureSettings = this._bareFontInfo.fontFeatureSettings;
italicDomNode.style.lineHeight = this._bareFontInfo.lineHeight + 'px';
italicDomNode.style.letterSpacing = this._bareFontInfo.letterSpacing + 'px';
italicDomNode.style.fontStyle = 'italic';
container.appendChild(italicDomNode);
var testElements = [];
for (var _i = 0, _a = this._requests; _i < _a.length; _i++) {
var request = _a[_i];
var parent_1 = void 0;
if (request.type === 0 /* Regular */) {
parent_1 = regularDomNode;
}
if (request.type === 2 /* Bold */) {
parent_1 = boldDomNode;
}
if (request.type === 1 /* Italic */) {
parent_1 = italicDomNode;
}
parent_1.appendChild(document.createElement('br'));
var testElement = document.createElement('span');
DomCharWidthReader._render(testElement, request);
parent_1.appendChild(testElement);
testElements.push(testElement);
}
this._container = container;
this._testElements = testElements;
};
DomCharWidthReader._render = function (testElement, request) {
if (request.chr === ' ') {
var htmlString = ' ';
// Repeat character 256 (2^8) times
for (var i = 0; i < 8; i++) {
htmlString += htmlString;
}
testElement.innerHTML = htmlString;
}
else {
var testString = request.chr;
// Repeat character 256 (2^8) times
for (var i = 0; i < 8; i++) {
testString += testString;
}
testElement.textContent = testString;
}
};
DomCharWidthReader.prototype._readFromDomElements = function () {
for (var i = 0, len = this._requests.length; i < len; i++) {
var request = this._requests[i];
var testElement = this._testElements[i];
request.fulfill(testElement.offsetWidth / 256);
}
};
return DomCharWidthReader;
}());
function readCharWidths(bareFontInfo, requests) {
var reader = new DomCharWidthReader(bareFontInfo, requests);
reader.read();
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/config/elementSizeObserver.js
var elementSizeObserver = __webpack_require__(234);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/commonEditorConfig.js
var commonEditorConfig = __webpack_require__(154);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js
var editorOptions = __webpack_require__(26);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js
var fontInfo = __webpack_require__(153);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/config/configuration.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var CSSBasedConfigurationCache = /** @class */ (function () {
function CSSBasedConfigurationCache() {
this._keys = Object.create(null);
this._values = Object.create(null);
}
CSSBasedConfigurationCache.prototype.has = function (item) {
var itemId = item.getId();
return !!this._values[itemId];
};
CSSBasedConfigurationCache.prototype.get = function (item) {
var itemId = item.getId();
return this._values[itemId];
};
CSSBasedConfigurationCache.prototype.put = function (item, value) {
var itemId = item.getId();
this._keys[itemId] = item;
this._values[itemId] = value;
};
CSSBasedConfigurationCache.prototype.remove = function (item) {
var itemId = item.getId();
delete this._keys[itemId];
delete this._values[itemId];
};
CSSBasedConfigurationCache.prototype.getValues = function () {
var _this = this;
return Object.keys(this._keys).map(function (id) { return _this._values[id]; });
};
return CSSBasedConfigurationCache;
}());
function clearAllFontInfos() {
configuration_CSSBasedConfiguration.INSTANCE.clearCache();
}
var configuration_CSSBasedConfiguration = /** @class */ (function (_super) {
__extends(CSSBasedConfiguration, _super);
function CSSBasedConfiguration() {
var _this = _super.call(this) || this;
_this._onDidChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChange = _this._onDidChange.event;
_this._cache = new CSSBasedConfigurationCache();
_this._evictUntrustedReadingsTimeout = -1;
return _this;
}
CSSBasedConfiguration.prototype.dispose = function () {
if (this._evictUntrustedReadingsTimeout !== -1) {
clearTimeout(this._evictUntrustedReadingsTimeout);
this._evictUntrustedReadingsTimeout = -1;
}
_super.prototype.dispose.call(this);
};
CSSBasedConfiguration.prototype.clearCache = function () {
this._cache = new CSSBasedConfigurationCache();
this._onDidChange.fire();
};
CSSBasedConfiguration.prototype._writeToCache = function (item, value) {
var _this = this;
this._cache.put(item, value);
if (!value.isTrusted && this._evictUntrustedReadingsTimeout === -1) {
// Try reading again after some time
this._evictUntrustedReadingsTimeout = setTimeout(function () {
_this._evictUntrustedReadingsTimeout = -1;
_this._evictUntrustedReadings();
}, 5000);
}
};
CSSBasedConfiguration.prototype._evictUntrustedReadings = function () {
var values = this._cache.getValues();
var somethingRemoved = false;
for (var i = 0, len = values.length; i < len; i++) {
var item = values[i];
if (!item.isTrusted) {
somethingRemoved = true;
this._cache.remove(item);
}
}
if (somethingRemoved) {
this._onDidChange.fire();
}
};
CSSBasedConfiguration.prototype.readConfiguration = function (bareFontInfo) {
if (!this._cache.has(bareFontInfo)) {
var readConfig = CSSBasedConfiguration._actualReadConfiguration(bareFontInfo);
if (readConfig.typicalHalfwidthCharacterWidth <= 2 || readConfig.typicalFullwidthCharacterWidth <= 2 || readConfig.spaceWidth <= 2 || readConfig.maxDigitWidth <= 2) {
// Hey, it's Bug 14341 ... we couldn't read
readConfig = new fontInfo["b" /* FontInfo */]({
zoomLevel: browser["c" /* getZoomLevel */](),
fontFamily: readConfig.fontFamily,
fontWeight: readConfig.fontWeight,
fontSize: readConfig.fontSize,
fontFeatureSettings: readConfig.fontFeatureSettings,
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),
maxDigitWidth: Math.max(readConfig.maxDigitWidth, 5),
}, false);
}
this._writeToCache(bareFontInfo, readConfig);
}
return this._cache.get(bareFontInfo);
};
CSSBasedConfiguration.createRequest = function (chr, type, all, monospace) {
var result = new CharWidthRequest(chr, type);
all.push(result);
if (monospace) {
monospace.push(result);
}
return result;
};
CSSBasedConfiguration._actualReadConfiguration = function (bareFontInfo) {
var all = [];
var monospace = [];
var typicalHalfwidthCharacter = this.createRequest('n', 0 /* Regular */, all, monospace);
var typicalFullwidthCharacter = this.createRequest('\uff4d', 0 /* Regular */, all, null);
var space = this.createRequest(' ', 0 /* Regular */, all, monospace);
var digit0 = this.createRequest('0', 0 /* Regular */, all, monospace);
var digit1 = this.createRequest('1', 0 /* Regular */, all, monospace);
var digit2 = this.createRequest('2', 0 /* Regular */, all, monospace);
var digit3 = this.createRequest('3', 0 /* Regular */, all, monospace);
var digit4 = this.createRequest('4', 0 /* Regular */, all, monospace);
var digit5 = this.createRequest('5', 0 /* Regular */, all, monospace);
var digit6 = this.createRequest('6', 0 /* Regular */, all, monospace);
var digit7 = this.createRequest('7', 0 /* Regular */, all, monospace);
var digit8 = this.createRequest('8', 0 /* Regular */, all, monospace);
var digit9 = this.createRequest('9', 0 /* Regular */, all, monospace);
// monospace test: used for whitespace rendering
var rightwardsArrow = this.createRequest('→', 0 /* Regular */, all, monospace);
var halfwidthRightwardsArrow = this.createRequest('→', 0 /* Regular */, all, null);
// middle dot character
var middot = this.createRequest('·', 0 /* Regular */, all, monospace);
// monospace test: some characters
this.createRequest('|', 0 /* Regular */, all, monospace);
this.createRequest('/', 0 /* Regular */, all, monospace);
this.createRequest('-', 0 /* Regular */, all, monospace);
this.createRequest('_', 0 /* Regular */, all, monospace);
this.createRequest('i', 0 /* Regular */, all, monospace);
this.createRequest('l', 0 /* Regular */, all, monospace);
this.createRequest('m', 0 /* Regular */, all, monospace);
// monospace italic test
this.createRequest('|', 1 /* Italic */, all, monospace);
this.createRequest('_', 1 /* Italic */, all, monospace);
this.createRequest('i', 1 /* Italic */, all, monospace);
this.createRequest('l', 1 /* Italic */, all, monospace);
this.createRequest('m', 1 /* Italic */, all, monospace);
this.createRequest('n', 1 /* Italic */, all, monospace);
// monospace bold test
this.createRequest('|', 2 /* Bold */, all, monospace);
this.createRequest('_', 2 /* Bold */, all, monospace);
this.createRequest('i', 2 /* Bold */, all, monospace);
this.createRequest('l', 2 /* Bold */, all, monospace);
this.createRequest('m', 2 /* Bold */, all, monospace);
this.createRequest('n', 2 /* Bold */, all, monospace);
readCharWidths(bareFontInfo, all);
var maxDigitWidth = Math.max(digit0.width, digit1.width, digit2.width, digit3.width, digit4.width, digit5.width, digit6.width, digit7.width, digit8.width, digit9.width);
var isMonospace = (bareFontInfo.fontFeatureSettings === editorOptions["d" /* EditorFontLigatures */].OFF);
var referenceWidth = monospace[0].width;
for (var i = 1, len = monospace.length; isMonospace && i < len; i++) {
var diff = referenceWidth - monospace[i].width;
if (diff < -0.001 || diff > 0.001) {
isMonospace = false;
break;
}
}
var canUseHalfwidthRightwardsArrow = true;
if (isMonospace && halfwidthRightwardsArrow.width !== referenceWidth) {
// using a halfwidth rightwards arrow would break monospace...
canUseHalfwidthRightwardsArrow = false;
}
if (halfwidthRightwardsArrow.width > rightwardsArrow.width) {
// using a halfwidth rightwards arrow would paint a larger arrow than a regular rightwards arrow
canUseHalfwidthRightwardsArrow = false;
}
// let's trust the zoom level only 2s after it was changed.
var canTrustBrowserZoomLevel = (browser["b" /* getTimeSinceLastZoomLevelChanged */]() > 2000);
return new fontInfo["b" /* FontInfo */]({
zoomLevel: browser["c" /* getZoomLevel */](),
fontFamily: bareFontInfo.fontFamily,
fontWeight: bareFontInfo.fontWeight,
fontSize: bareFontInfo.fontSize,
fontFeatureSettings: bareFontInfo.fontFeatureSettings,
lineHeight: bareFontInfo.lineHeight,
letterSpacing: bareFontInfo.letterSpacing,
isMonospace: isMonospace,
typicalHalfwidthCharacterWidth: typicalHalfwidthCharacter.width,
typicalFullwidthCharacterWidth: typicalFullwidthCharacter.width,
canUseHalfwidthRightwardsArrow: canUseHalfwidthRightwardsArrow,
spaceWidth: space.width,
middotWidth: middot.width,
maxDigitWidth: maxDigitWidth
}, canTrustBrowserZoomLevel);
};
CSSBasedConfiguration.INSTANCE = new CSSBasedConfiguration();
return CSSBasedConfiguration;
}(lifecycle["a" /* Disposable */]));
var configuration_Configuration = /** @class */ (function (_super) {
__extends(Configuration, _super);
function Configuration(isSimpleWidget, options, referenceDomElement, accessibilityService) {
if (referenceDomElement === void 0) { referenceDomElement = null; }
var _this = _super.call(this, isSimpleWidget, options) || this;
_this.accessibilityService = accessibilityService;
_this._elementSizeObserver = _this._register(new elementSizeObserver["a" /* ElementSizeObserver */](referenceDomElement, options.dimension, function () { return _this._onReferenceDomElementSizeChanged(); }));
_this._register(configuration_CSSBasedConfiguration.INSTANCE.onDidChange(function () { return _this._onCSSBasedConfigurationChanged(); }));
if (_this._validatedOptions.get(9 /* automaticLayout */)) {
_this._elementSizeObserver.startObserving();
}
_this._register(browser["o" /* onDidChangeZoomLevel */](function (_) { return _this._recomputeOptions(); }));
_this._register(_this.accessibilityService.onDidChangeScreenReaderOptimized(function () { return _this._recomputeOptions(); }));
_this._recomputeOptions();
return _this;
}
Configuration.applyFontInfoSlow = function (domNode, fontInfo) {
domNode.style.fontFamily = fontInfo.getMassagedFontFamily();
domNode.style.fontWeight = fontInfo.fontWeight;
domNode.style.fontSize = fontInfo.fontSize + 'px';
domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;
domNode.style.lineHeight = fontInfo.lineHeight + 'px';
domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';
};
Configuration.applyFontInfo = function (domNode, fontInfo) {
domNode.setFontFamily(fontInfo.getMassagedFontFamily());
domNode.setFontWeight(fontInfo.fontWeight);
domNode.setFontSize(fontInfo.fontSize);
domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);
domNode.setLineHeight(fontInfo.lineHeight);
domNode.setLetterSpacing(fontInfo.letterSpacing);
};
Configuration.prototype._onReferenceDomElementSizeChanged = function () {
this._recomputeOptions();
};
Configuration.prototype._onCSSBasedConfigurationChanged = function () {
this._recomputeOptions();
};
Configuration.prototype.observeReferenceElement = function (dimension) {
this._elementSizeObserver.observe(dimension);
};
Configuration.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
Configuration.prototype._getExtraEditorClassName = function () {
var extra = '';
if (!browser["k" /* isSafari */] && !browser["n" /* isWebkitWebView */]) {
// Use user-select: none in all browsers except Safari and native macOS WebView
extra += 'no-user-select ';
}
if (platform["e" /* isMacintosh */]) {
extra += 'mac ';
}
return extra;
};
Configuration.prototype._getEnvConfiguration = function () {
return {
extraEditorClassName: this._getExtraEditorClassName(),
outerWidth: this._elementSizeObserver.getWidth(),
outerHeight: this._elementSizeObserver.getHeight(),
emptySelectionClipboard: browser["m" /* isWebKit */] || browser["h" /* isFirefox */],
pixelRatio: browser["a" /* getPixelRatio */](),
zoomLevel: browser["c" /* getZoomLevel */](),
accessibilitySupport: (this.accessibilityService.isScreenReaderOptimized()
? 2 /* Enabled */
: this.accessibilityService.getAccessibilitySupport())
};
};
Configuration.prototype.readConfiguration = function (bareFontInfo) {
return configuration_CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo);
};
return Configuration;
}(commonEditorConfig["a" /* CommonEditorConfiguration */]));
/***/ }),
/* 72 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IAccessibilityService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CONTEXT_ACCESSIBILITY_MODE_ENABLED; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/* harmony import */ var _contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IAccessibilityService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('accessibilityService');
var CONTEXT_ACCESSIBILITY_MODE_ENABLED = new _contextkey_common_contextkey_js__WEBPACK_IMPORTED_MODULE_1__[/* RawContextKey */ "d"]('accessibilityModeEnabled', false);
/***/ }),
/* 73 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NULL_STATE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NULL_MODE_ID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NULL_LANGUAGE_IDENTIFIER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return nullTokenize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return nullTokenize2; });
/* harmony import */ var _core_token_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(105);
/* harmony import */ var _modes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var NullStateImpl = /** @class */ (function () {
function NullStateImpl() {
}
NullStateImpl.prototype.clone = function () {
return this;
};
NullStateImpl.prototype.equals = function (other) {
return (this === other);
};
return NullStateImpl;
}());
var NULL_STATE = new NullStateImpl();
var NULL_MODE_ID = 'vs.editor.nullMode';
var NULL_LANGUAGE_IDENTIFIER = new _modes_js__WEBPACK_IMPORTED_MODULE_1__[/* LanguageIdentifier */ "r"](NULL_MODE_ID, 0 /* Null */);
function nullTokenize(modeId, buffer, state, deltaOffset) {
return new _core_token_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenizationResult */ "b"]([new _core_token_js__WEBPACK_IMPORTED_MODULE_0__[/* Token */ "a"](deltaOffset, '', modeId)], state);
}
function nullTokenize2(languageId, buffer, state, deltaOffset) {
var tokens = new Uint32Array(2);
tokens[0] = deltaOffset;
tokens[1] = ((languageId << 0 /* LANGUAGEID_OFFSET */)
| (0 /* Other */ << 8 /* TOKEN_TYPE_OFFSET */)
| (0 /* None */ << 11 /* FONT_STYLE_OFFSET */)
| (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)
| (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;
return new _core_token_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenizationResult2 */ "c"](tokens, state === null ? NULL_STATE : state);
}
/***/ }),
/* 74 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LineRange; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return RenderLineInput; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CharacterMapping; });
/* unused harmony export RenderLineOutput */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return renderViewLine; });
/* unused harmony export RenderLineOutput2 */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return renderViewLine2; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _core_stringBuilder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(149);
/* harmony import */ var _lineDecorations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(144);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LinePart = /** @class */ (function () {
function LinePart(endIndex, type) {
this.endIndex = endIndex;
this.type = type;
}
return LinePart;
}());
var LineRange = /** @class */ (function () {
function LineRange(startIndex, endIndex) {
this.startOffset = startIndex;
this.endOffset = endIndex;
}
LineRange.prototype.equals = function (otherLineRange) {
return this.startOffset === otherLineRange.startOffset
&& this.endOffset === otherLineRange.endOffset;
};
return LineRange;
}());
var RenderLineInput = /** @class */ (function () {
function RenderLineInput(useMonospaceOptimizations, canUseHalfwidthRightwardsArrow, lineContent, continuesWithWrappedLine, isBasicASCII, containsRTL, fauxIndentLength, lineTokens, lineDecorations, tabSize, startVisibleColumn, spaceWidth, middotWidth, stopRenderingLineAfter, renderWhitespace, renderControlCharacters, fontLigatures, selectionsOnLine) {
this.useMonospaceOptimizations = useMonospaceOptimizations;
this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;
this.lineContent = lineContent;
this.continuesWithWrappedLine = continuesWithWrappedLine;
this.isBasicASCII = isBasicASCII;
this.containsRTL = containsRTL;
this.fauxIndentLength = fauxIndentLength;
this.lineTokens = lineTokens;
this.lineDecorations = lineDecorations;
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
this.spaceWidth = spaceWidth;
this.middotWidth = middotWidth;
this.stopRenderingLineAfter = stopRenderingLineAfter;
this.renderWhitespace = (renderWhitespace === 'all'
? 3 /* All */
: renderWhitespace === 'boundary'
? 1 /* Boundary */
: renderWhitespace === 'selection'
? 2 /* Selection */
: 0 /* None */);
this.renderControlCharacters = renderControlCharacters;
this.fontLigatures = fontLigatures;
this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort(function (a, b) { return a.startOffset < b.startOffset ? -1 : 1; });
}
RenderLineInput.prototype.sameSelection = function (otherSelections) {
if (this.selectionsOnLine === null) {
return otherSelections === null;
}
if (otherSelections === null) {
return false;
}
if (otherSelections.length !== this.selectionsOnLine.length) {
return false;
}
for (var i = 0; i < this.selectionsOnLine.length; i++) {
if (!this.selectionsOnLine[i].equals(otherSelections[i])) {
return false;
}
}
return true;
};
RenderLineInput.prototype.equals = function (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.stopRenderingLineAfter === other.stopRenderingLineAfter
&& this.renderWhitespace === other.renderWhitespace
&& this.renderControlCharacters === other.renderControlCharacters
&& this.fontLigatures === other.fontLigatures
&& _lineDecorations_js__WEBPACK_IMPORTED_MODULE_2__[/* LineDecoration */ "a"].equalsArr(this.lineDecorations, other.lineDecorations)
&& this.lineTokens.equals(other.lineTokens)
&& this.sameSelection(other.selectionsOnLine));
};
return RenderLineInput;
}());
/**
* Provides a both direction mapping between a line's character and its rendered position.
*/
var CharacterMapping = /** @class */ (function () {
function CharacterMapping(length, partCount) {
this.length = length;
this._data = new Uint32Array(this.length);
this._absoluteOffsets = new Uint32Array(this.length);
}
CharacterMapping.getPartIndex = function (partData) {
return (partData & 4294901760 /* PART_INDEX_MASK */) >>> 16 /* PART_INDEX_OFFSET */;
};
CharacterMapping.getCharIndex = function (partData) {
return (partData & 65535 /* CHAR_INDEX_MASK */) >>> 0 /* CHAR_INDEX_OFFSET */;
};
CharacterMapping.prototype.setPartData = function (charOffset, partIndex, charIndex, partAbsoluteOffset) {
var partData = ((partIndex << 16 /* PART_INDEX_OFFSET */)
| (charIndex << 0 /* CHAR_INDEX_OFFSET */)) >>> 0;
this._data[charOffset] = partData;
this._absoluteOffsets[charOffset] = partAbsoluteOffset + charIndex;
};
CharacterMapping.prototype.getAbsoluteOffsets = function () {
return this._absoluteOffsets;
};
CharacterMapping.prototype.charOffsetToPartData = function (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];
};
CharacterMapping.prototype.partDataToCharOffset = function (partIndex, partLength, charIndex) {
if (this.length === 0) {
return 0;
}
var searchEntry = ((partIndex << 16 /* PART_INDEX_OFFSET */)
| (charIndex << 0 /* CHAR_INDEX_OFFSET */)) >>> 0;
var min = 0;
var max = this.length - 1;
while (min + 1 < max) {
var mid = ((min + max) >>> 1);
var midEntry = this._data[mid];
if (midEntry === searchEntry) {
return mid;
}
else if (midEntry > searchEntry) {
max = mid;
}
else {
min = mid;
}
}
if (min === max) {
return min;
}
var minEntry = this._data[min];
var maxEntry = this._data[max];
if (minEntry === searchEntry) {
return min;
}
if (maxEntry === searchEntry) {
return max;
}
var minPartIndex = CharacterMapping.getPartIndex(minEntry);
var minCharIndex = CharacterMapping.getCharIndex(minEntry);
var maxPartIndex = CharacterMapping.getPartIndex(maxEntry);
var maxCharIndex;
if (minPartIndex !== maxPartIndex) {
// sitting between parts
maxCharIndex = partLength;
}
else {
maxCharIndex = CharacterMapping.getCharIndex(maxEntry);
}
var minEntryDistance = charIndex - minCharIndex;
var maxEntryDistance = maxCharIndex - charIndex;
if (minEntryDistance <= maxEntryDistance) {
return min;
}
return max;
};
return CharacterMapping;
}());
var RenderLineOutput = /** @class */ (function () {
function RenderLineOutput(characterMapping, containsRTL, containsForeignElements) {
this.characterMapping = characterMapping;
this.containsRTL = containsRTL;
this.containsForeignElements = containsForeignElements;
}
return RenderLineOutput;
}());
function renderViewLine(input, sb) {
if (input.lineContent.length === 0) {
var containsForeignElements = 0 /* None */;
// This is basically for IE's hit test to work
var content = '\u00a0';
if (input.lineDecorations.length > 0) {
// This line is empty, but it contains inline decorations
var beforeClassNames = [];
var afterClassNames = [];
for (var i = 0, len = input.lineDecorations.length; i < len; i++) {
var lineDecoration = input.lineDecorations[i];
if (lineDecoration.type === 1 /* Before */) {
beforeClassNames.push(input.lineDecorations[i].className);
containsForeignElements |= 1 /* Before */;
}
if (lineDecoration.type === 2 /* After */) {
afterClassNames.push(input.lineDecorations[i].className);
containsForeignElements |= 2 /* After */;
}
}
if (containsForeignElements !== 0 /* None */) {
var beforeSpan = (beforeClassNames.length > 0 ? "" : "");
var afterSpan = (afterClassNames.length > 0 ? "" : "");
content = "" + beforeSpan + afterSpan + "";
}
}
sb.appendASCIIString(content);
return new RenderLineOutput(new CharacterMapping(0, 0), false, containsForeignElements);
}
return _renderLine(resolveRenderLineInput(input), sb);
}
var RenderLineOutput2 = /** @class */ (function () {
function RenderLineOutput2(characterMapping, html, containsRTL, containsForeignElements) {
this.characterMapping = characterMapping;
this.html = html;
this.containsRTL = containsRTL;
this.containsForeignElements = containsForeignElements;
}
return RenderLineOutput2;
}());
function renderViewLine2(input) {
var sb = Object(_core_stringBuilder_js__WEBPACK_IMPORTED_MODULE_1__[/* createStringBuilder */ "a"])(10000);
var out = renderViewLine(input, sb);
return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);
}
var ResolvedRenderLineInput = /** @class */ (function () {
function ResolvedRenderLineInput(fontIsMonospace, canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, parts, containsForeignElements, fauxIndentLength, tabSize, startVisibleColumn, containsRTL, spaceWidth, middotWidth, renderWhitespace, renderControlCharacters) {
this.fontIsMonospace = fontIsMonospace;
this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;
this.lineContent = lineContent;
this.len = len;
this.isOverflowing = isOverflowing;
this.parts = parts;
this.containsForeignElements = containsForeignElements;
this.fauxIndentLength = fauxIndentLength;
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
this.containsRTL = containsRTL;
this.spaceWidth = spaceWidth;
this.middotWidth = middotWidth;
this.renderWhitespace = renderWhitespace;
this.renderControlCharacters = renderControlCharacters;
//
}
return ResolvedRenderLineInput;
}());
function resolveRenderLineInput(input) {
var useMonospaceOptimizations = input.useMonospaceOptimizations;
var lineContent = input.lineContent;
var isOverflowing;
var len;
if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {
isOverflowing = true;
len = input.stopRenderingLineAfter;
}
else {
isOverflowing = false;
len = lineContent.length;
}
var tokens = transformAndRemoveOverflowing(input.lineTokens, input.fauxIndentLength, len);
if (input.renderWhitespace === 3 /* All */ || input.renderWhitespace === 1 /* Boundary */ || (input.renderWhitespace === 2 /* Selection */ && !!input.selectionsOnLine)) {
tokens = _applyRenderWhitespace(lineContent, len, input.continuesWithWrappedLine, tokens, input.fauxIndentLength, input.tabSize, input.startVisibleColumn, useMonospaceOptimizations, input.selectionsOnLine, input.renderWhitespace === 1 /* Boundary */);
}
var containsForeignElements = 0 /* None */;
if (input.lineDecorations.length > 0) {
for (var i = 0, len_1 = input.lineDecorations.length; i < len_1; i++) {
var lineDecoration = input.lineDecorations[i];
if (lineDecoration.type === 3 /* RegularAffectingLetterSpacing */) {
// Pretend there are foreign elements... although not 100% accurate.
containsForeignElements |= 1 /* Before */;
}
else if (lineDecoration.type === 1 /* Before */) {
containsForeignElements |= 1 /* Before */;
}
else if (lineDecoration.type === 2 /* After */) {
containsForeignElements |= 2 /* After */;
}
}
tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);
}
if (!input.containsRTL) {
// We can never split RTL text, as it ruins the rendering
tokens = splitLargeTokens(lineContent, tokens, !input.isBasicASCII || input.fontLigatures);
}
return new ResolvedRenderLineInput(useMonospaceOptimizations, input.canUseHalfwidthRightwardsArrow, lineContent, len, isOverflowing, tokens, containsForeignElements, input.fauxIndentLength, input.tabSize, input.startVisibleColumn, input.containsRTL, input.spaceWidth, input.middotWidth, input.renderWhitespace, input.renderControlCharacters);
}
/**
* In the rendering phase, characters are always looped until token.endIndex.
* Ensure that all tokens end before `len` and the last one ends precisely at `len`.
*/
function transformAndRemoveOverflowing(tokens, fauxIndentLength, len) {
var result = [], resultLen = 0;
// The faux indent part of the line should have no token type
if (fauxIndentLength > 0) {
result[resultLen++] = new LinePart(fauxIndentLength, '');
}
for (var tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {
var endIndex = tokens.getEndOffset(tokenIndex);
if (endIndex <= fauxIndentLength) {
// The faux indent part of the line should have no token type
continue;
}
var type = tokens.getClassName(tokenIndex);
if (endIndex >= len) {
result[resultLen++] = new LinePart(len, type);
break;
}
result[resultLen++] = new LinePart(endIndex, type);
}
return result;
}
/**
* See https://github.com/Microsoft/vscode/issues/6885.
* It appears that having very large spans causes very slow reading of character positions.
* So here we try to avoid that.
*/
function splitLargeTokens(lineContent, tokens, onlyAtSpaces) {
var lastTokenEndIndex = 0;
var result = [], resultLen = 0;
if (onlyAtSpaces) {
// Split only at spaces => we need to walk each character
for (var i = 0, len = tokens.length; i < len; i++) {
var token = tokens[i];
var tokenEndIndex = token.endIndex;
if (lastTokenEndIndex + 50 /* LongToken */ < tokenEndIndex) {
var tokenType = token.type;
var lastSpaceOffset = -1;
var currTokenStart = lastTokenEndIndex;
for (var j = lastTokenEndIndex; j < tokenEndIndex; j++) {
if (lineContent.charCodeAt(j) === 32 /* Space */) {
lastSpaceOffset = j;
}
if (lastSpaceOffset !== -1 && j - currTokenStart >= 50 /* LongToken */) {
// Split at `lastSpaceOffset` + 1
result[resultLen++] = new LinePart(lastSpaceOffset + 1, tokenType);
currTokenStart = lastSpaceOffset + 1;
lastSpaceOffset = -1;
}
}
if (currTokenStart !== tokenEndIndex) {
result[resultLen++] = new LinePart(tokenEndIndex, tokenType);
}
}
else {
result[resultLen++] = token;
}
lastTokenEndIndex = tokenEndIndex;
}
}
else {
// Split anywhere => we don't need to walk each character
for (var i = 0, len = tokens.length; i < len; i++) {
var token = tokens[i];
var tokenEndIndex = token.endIndex;
var diff = (tokenEndIndex - lastTokenEndIndex);
if (diff > 50 /* LongToken */) {
var tokenType = token.type;
var piecesCount = Math.ceil(diff / 50 /* LongToken */);
for (var j = 1; j < piecesCount; j++) {
var pieceEndIndex = lastTokenEndIndex + (j * 50 /* LongToken */);
result[resultLen++] = new LinePart(pieceEndIndex, tokenType);
}
result[resultLen++] = new LinePart(tokenEndIndex, tokenType);
}
else {
result[resultLen++] = token;
}
lastTokenEndIndex = tokenEndIndex;
}
}
return result;
}
/**
* Whitespace is rendered by "replacing" tokens with a special-purpose `vs-whitespace` type that is later recognized in the rendering phase.
* Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as .
* The rendering phase will generate `style="width:..."` for these tokens.
*/
function _applyRenderWhitespace(lineContent, len, continuesWithWrappedLine, tokens, fauxIndentLength, tabSize, startVisibleColumn, useMonospaceOptimizations, selections, onlyBoundary) {
var result = [], resultLen = 0;
var tokenIndex = 0;
var tokenType = tokens[tokenIndex].type;
var tokenEndIndex = tokens[tokenIndex].endIndex;
var tokensLength = tokens.length;
var firstNonWhitespaceIndex = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* firstNonWhitespaceIndex */ "q"](lineContent);
var lastNonWhitespaceIndex;
if (firstNonWhitespaceIndex === -1) {
// The entire line is whitespace
firstNonWhitespaceIndex = len;
lastNonWhitespaceIndex = len;
}
else {
lastNonWhitespaceIndex = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* lastNonWhitespaceIndex */ "D"](lineContent);
}
var wasInWhitespace = false;
var currentSelectionIndex = 0;
var currentSelection = selections && selections[currentSelectionIndex];
var tmpIndent = startVisibleColumn % tabSize;
for (var charIndex = fauxIndentLength; charIndex < len; charIndex++) {
var chCode = lineContent.charCodeAt(charIndex);
if (currentSelection && charIndex >= currentSelection.endOffset) {
currentSelectionIndex++;
currentSelection = selections && selections[currentSelectionIndex];
}
var isInWhitespace = void 0;
if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {
// in leading or trailing whitespace
isInWhitespace = true;
}
else if (chCode === 9 /* Tab */) {
// a tab character is rendered both in all and boundary cases
isInWhitespace = true;
}
else if (chCode === 32 /* Space */) {
// hit a space character
if (onlyBoundary) {
// rendering only boundary whitespace
if (wasInWhitespace) {
isInWhitespace = true;
}
else {
var nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* Null */);
isInWhitespace = (nextChCode === 32 /* Space */ || nextChCode === 9 /* Tab */);
}
}
else {
isInWhitespace = true;
}
}
else {
isInWhitespace = false;
}
// If rendering whitespace on selection, check that the charIndex falls within a selection
if (isInWhitespace && selections) {
isInWhitespace = !!currentSelection && currentSelection.startOffset <= charIndex && currentSelection.endOffset > charIndex;
}
if (wasInWhitespace) {
// was in whitespace token
if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {
// leaving whitespace token or entering a new indent
result[resultLen++] = new LinePart(charIndex, 'vs-whitespace');
tmpIndent = tmpIndent % tabSize;
}
}
else {
// was in regular token
if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {
result[resultLen++] = new LinePart(charIndex, tokenType);
tmpIndent = tmpIndent % tabSize;
}
}
if (chCode === 9 /* Tab */) {
tmpIndent = tabSize;
}
else if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isFullWidthCharacter */ "y"](chCode)) {
tmpIndent += 2;
}
else {
tmpIndent++;
}
wasInWhitespace = isInWhitespace;
if (charIndex === tokenEndIndex) {
tokenIndex++;
if (tokenIndex < tokensLength) {
tokenType = tokens[tokenIndex].type;
tokenEndIndex = tokens[tokenIndex].endIndex;
}
}
}
var generateWhitespace = false;
if (wasInWhitespace) {
// was in whitespace token
if (continuesWithWrappedLine && onlyBoundary) {
var lastCharCode = (len > 0 ? lineContent.charCodeAt(len - 1) : 0 /* Null */);
var prevCharCode = (len > 1 ? lineContent.charCodeAt(len - 2) : 0 /* Null */);
var isSingleTrailingSpace = (lastCharCode === 32 /* Space */ && (prevCharCode !== 32 /* Space */ && prevCharCode !== 9 /* Tab */));
if (!isSingleTrailingSpace) {
generateWhitespace = true;
}
}
else {
generateWhitespace = true;
}
}
result[resultLen++] = new LinePart(len, generateWhitespace ? 'vs-whitespace' : tokenType);
return result;
}
/**
* Inline decorations are "merged" on top of tokens.
* Special care must be taken when multiple inline decorations are at play and they overlap.
*/
function _applyInlineDecorations(lineContent, len, tokens, _lineDecorations) {
_lineDecorations.sort(_lineDecorations_js__WEBPACK_IMPORTED_MODULE_2__[/* LineDecoration */ "a"].compare);
var lineDecorations = _lineDecorations_js__WEBPACK_IMPORTED_MODULE_2__[/* LineDecorationsNormalizer */ "b"].normalize(lineContent, _lineDecorations);
var lineDecorationsLen = lineDecorations.length;
var lineDecorationIndex = 0;
var result = [], resultLen = 0, lastResultEndIndex = 0;
for (var tokenIndex = 0, len_2 = tokens.length; tokenIndex < len_2; tokenIndex++) {
var token = tokens[tokenIndex];
var tokenEndIndex = token.endIndex;
var tokenType = token.type;
while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {
var lineDecoration = lineDecorations[lineDecorationIndex];
if (lineDecoration.startOffset > lastResultEndIndex) {
lastResultEndIndex = lineDecoration.startOffset;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType);
}
if (lineDecoration.endOffset + 1 <= tokenEndIndex) {
// This line decoration ends before this token ends
lastResultEndIndex = lineDecoration.endOffset + 1;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
lineDecorationIndex++;
}
else {
// This line decoration continues on to the next token
lastResultEndIndex = tokenEndIndex;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
break;
}
}
if (tokenEndIndex > lastResultEndIndex) {
lastResultEndIndex = tokenEndIndex;
result[resultLen++] = new LinePart(lastResultEndIndex, tokenType);
}
}
var lastTokenEndIndex = tokens[tokens.length - 1].endIndex;
if (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {
var classNames = [];
while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset === lastTokenEndIndex) {
classNames.push(lineDecorations[lineDecorationIndex].className);
lineDecorationIndex++;
}
result[resultLen++] = new LinePart(lastResultEndIndex, classNames.join(' '));
}
return result;
}
/**
* This function is on purpose not split up into multiple functions to allow runtime type inference (i.e. performance reasons).
* Notice how all the needed data is fully resolved and passed in (i.e. no other calls).
*/
function _renderLine(input, sb) {
var fontIsMonospace = input.fontIsMonospace;
var canUseHalfwidthRightwardsArrow = input.canUseHalfwidthRightwardsArrow;
var containsForeignElements = input.containsForeignElements;
var lineContent = input.lineContent;
var len = input.len;
var isOverflowing = input.isOverflowing;
var parts = input.parts;
var fauxIndentLength = input.fauxIndentLength;
var tabSize = input.tabSize;
var startVisibleColumn = input.startVisibleColumn;
var containsRTL = input.containsRTL;
var spaceWidth = input.spaceWidth;
var middotWidth = input.middotWidth;
var renderWhitespace = input.renderWhitespace;
var renderControlCharacters = input.renderControlCharacters;
// use U+2E31 - WORD SEPARATOR MIDDLE DOT or U+00B7 - MIDDLE DOT
var spaceRenderWhitespaceCharacter = (middotWidth > spaceWidth ? 0x2E31 : 0xB7);
var characterMapping = new CharacterMapping(len + 1, parts.length);
var charIndex = 0;
var visibleColumn = startVisibleColumn;
var charOffsetInPart = 0;
var prevPartContentCnt = 0;
var partAbsoluteOffset = 0;
sb.appendASCIIString('');
for (var partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {
partAbsoluteOffset += prevPartContentCnt;
var part = parts[partIndex];
var partEndIndex = part.endIndex;
var partType = part.type;
var partRendersWhitespace = (renderWhitespace !== 0 /* None */ && (partType.indexOf('vs-whitespace') >= 0));
charOffsetInPart = 0;
sb.appendASCIIString(' 1) {
sb.write1(0x2192); // RIGHTWARDS ARROW
}
else {
sb.write1(0xFFEB); // HALFWIDTH RIGHTWARDS ARROW
}
for (var space = 2; space <= charWidth; space++) {
sb.write1(0xA0); //
}
}
else { // must be CharCode.Space
charWidth = 1;
sb.write1(spaceRenderWhitespaceCharacter); // · or word separator middle dot
}
charOffsetInPart += charWidth;
if (charIndex >= fauxIndentLength) {
visibleColumn += charWidth;
}
}
prevPartContentCnt = partContentCnt;
}
else {
var partContentCnt = 0;
if (containsRTL) {
sb.appendASCIIString(' dir="ltr"');
}
sb.appendASCII(62 /* GreaterThan */);
for (; charIndex < partEndIndex; charIndex++) {
characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);
var charCode = lineContent.charCodeAt(charIndex);
var producedCharacters = 1;
var charWidth = 1;
switch (charCode) {
case 9 /* Tab */:
producedCharacters = (tabSize - (visibleColumn % tabSize));
charWidth = producedCharacters;
for (var space = 1; space <= producedCharacters; space++) {
sb.write1(0xA0); //
}
break;
case 32 /* Space */:
sb.write1(0xA0); //
break;
case 60 /* LessThan */:
sb.appendASCIIString('<');
break;
case 62 /* GreaterThan */:
sb.appendASCIIString('>');
break;
case 38 /* Ampersand */:
sb.appendASCIIString('&');
break;
case 0 /* Null */:
sb.appendASCIIString('�');
break;
case 65279 /* UTF8_BOM */:
case 8232 /* LINE_SEPARATOR_2028 */:
sb.write1(0xFFFD);
break;
default:
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isFullWidthCharacter */ "y"](charCode)) {
charWidth++;
}
if (renderControlCharacters && charCode < 32) {
sb.write1(9216 + charCode);
}
else {
sb.write1(charCode);
}
}
charOffsetInPart += producedCharacters;
partContentCnt += producedCharacters;
if (charIndex >= fauxIndentLength) {
visibleColumn += charWidth;
}
}
prevPartContentCnt = partContentCnt;
}
sb.appendASCIIString('');
}
// When getting client rects for the last character, we will position the
// text range at the end of the span, insteaf of at the beginning of next span
characterMapping.setPartData(len, parts.length - 1, charOffsetInPart, partAbsoluteOffset);
if (isOverflowing) {
sb.appendASCIIString('…');
}
sb.appendASCIIString('');
return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);
}
/***/ }),
/* 75 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CursorMoveCommands; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CursorMove; });
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
/* harmony import */ var _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
/* harmony import */ var _cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(63);
/* harmony import */ var _cursorWordOperations_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(125);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var CursorMoveCommands = /** @class */ (function () {
function CursorMoveCommands() {
}
CursorMoveCommands.addCursorDown = function (context, cursors, useLogicalLine) {
var result = [], resultLen = 0;
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[resultLen++] = new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"](cursor.modelState, cursor.viewState);
if (useLogicalLine) {
result[resultLen++] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].translateDown(context.config, context.model, cursor.modelState));
}
else {
result[resultLen++] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].translateDown(context.config, context.viewModel, cursor.viewState));
}
}
return result;
};
CursorMoveCommands.addCursorUp = function (context, cursors, useLogicalLine) {
var result = [], resultLen = 0;
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[resultLen++] = new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"](cursor.modelState, cursor.viewState);
if (useLogicalLine) {
result[resultLen++] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].translateUp(context.config, context.model, cursor.modelState));
}
else {
result[resultLen++] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].translateUp(context.config, context.viewModel, cursor.viewState));
}
}
return result;
};
CursorMoveCommands.moveToBeginningOfLine = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = this._moveToLineStart(context, cursor, inSelectionMode);
}
return result;
};
CursorMoveCommands._moveToLineStart = function (context, cursor, inSelectionMode) {
var currentViewStateColumn = cursor.viewState.position.column;
var currentModelStateColumn = cursor.modelState.position.column;
var isFirstLineOfWrappedLine = currentViewStateColumn === currentModelStateColumn;
var currentViewStatelineNumber = cursor.viewState.position.lineNumber;
var firstNonBlankColumn = context.viewModel.getLineFirstNonWhitespaceColumn(currentViewStatelineNumber);
var isBeginningOfViewLine = currentViewStateColumn === firstNonBlankColumn;
if (!isFirstLineOfWrappedLine && !isBeginningOfViewLine) {
return this._moveToLineStartByView(context, cursor, inSelectionMode);
}
else {
return this._moveToLineStartByModel(context, cursor, inSelectionMode);
}
};
CursorMoveCommands._moveToLineStartByView = function (context, cursor, inSelectionMode) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToBeginningOfLine(context.config, context.viewModel, cursor.viewState, inSelectionMode));
};
CursorMoveCommands._moveToLineStartByModel = function (context, cursor, inSelectionMode) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToBeginningOfLine(context.config, context.model, cursor.modelState, inSelectionMode));
};
CursorMoveCommands.moveToEndOfLine = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = this._moveToLineEnd(context, cursor, inSelectionMode);
}
return result;
};
CursorMoveCommands._moveToLineEnd = function (context, cursor, inSelectionMode) {
var viewStatePosition = cursor.viewState.position;
var viewModelMaxColumn = context.viewModel.getLineMaxColumn(viewStatePosition.lineNumber);
var isEndOfViewLine = viewStatePosition.column === viewModelMaxColumn;
var modelStatePosition = cursor.modelState.position;
var modelMaxColumn = context.model.getLineMaxColumn(modelStatePosition.lineNumber);
var isEndLineOfWrappedLine = viewModelMaxColumn - viewStatePosition.column === modelMaxColumn - modelStatePosition.column;
if (isEndOfViewLine || isEndLineOfWrappedLine) {
return this._moveToLineEndByModel(context, cursor, inSelectionMode);
}
else {
return this._moveToLineEndByView(context, cursor, inSelectionMode);
}
};
CursorMoveCommands._moveToLineEndByView = function (context, cursor, inSelectionMode) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToEndOfLine(context.config, context.viewModel, cursor.viewState, inSelectionMode));
};
CursorMoveCommands._moveToLineEndByModel = function (context, cursor, inSelectionMode) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToEndOfLine(context.config, context.model, cursor.modelState, inSelectionMode));
};
CursorMoveCommands.expandLineSelection = function (context, cursors) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var startLineNumber = cursor.modelState.selection.startLineNumber;
var lineCount = context.model.getLineCount();
var endLineNumber = cursor.modelState.selection.endLineNumber;
var endColumn = void 0;
if (endLineNumber === lineCount) {
endColumn = context.model.getLineMaxColumn(lineCount);
}
else {
endLineNumber++;
endColumn = 1;
}
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_5__[/* Range */ "a"](startLineNumber, 1, startLineNumber, 1), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](endLineNumber, endColumn), 0));
}
return result;
};
CursorMoveCommands.moveToBeginningOfBuffer = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToBeginningOfBuffer(context.config, context.model, cursor.modelState, inSelectionMode));
}
return result;
};
CursorMoveCommands.moveToEndOfBuffer = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveToEndOfBuffer(context.config, context.model, cursor.modelState, inSelectionMode));
}
return result;
};
CursorMoveCommands.selectAll = function (context, cursor) {
var lineCount = context.model.getLineCount();
var maxColumn = context.model.getLineMaxColumn(lineCount);
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_5__[/* Range */ "a"](1, 1, 1, 1), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](lineCount, maxColumn), 0));
};
CursorMoveCommands.line = function (context, cursor, inSelectionMode, _position, _viewPosition) {
var position = context.model.validatePosition(_position);
var viewPosition = (_viewPosition
? context.validateViewPosition(new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](_viewPosition.lineNumber, _viewPosition.column), position)
: context.convertModelPositionToViewPosition(position));
if (!inSelectionMode || !cursor.modelState.hasSelection()) {
// Entering line selection for the first time
var lineCount = context.model.getLineCount();
var selectToLineNumber = position.lineNumber + 1;
var selectToColumn = 1;
if (selectToLineNumber > lineCount) {
selectToLineNumber = lineCount;
selectToColumn = context.model.getLineMaxColumn(selectToLineNumber);
}
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_5__[/* Range */ "a"](position.lineNumber, 1, selectToLineNumber, selectToColumn), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](selectToLineNumber, selectToColumn), 0));
}
// Continuing line selection
var enteringLineNumber = cursor.modelState.selectionStart.getStartPosition().lineNumber;
if (position.lineNumber < enteringLineNumber) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(cursor.viewState.move(cursor.modelState.hasSelection(), viewPosition.lineNumber, 1, 0));
}
else if (position.lineNumber > enteringLineNumber) {
var lineCount = context.viewModel.getLineCount();
var selectToViewLineNumber = viewPosition.lineNumber + 1;
var selectToViewColumn = 1;
if (selectToViewLineNumber > lineCount) {
selectToViewLineNumber = lineCount;
selectToViewColumn = context.viewModel.getLineMaxColumn(selectToViewLineNumber);
}
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(cursor.viewState.move(cursor.modelState.hasSelection(), selectToViewLineNumber, selectToViewColumn, 0));
}
else {
var endPositionOfSelectionStart = cursor.modelState.selectionStart.getEndPosition();
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(cursor.modelState.move(cursor.modelState.hasSelection(), endPositionOfSelectionStart.lineNumber, endPositionOfSelectionStart.column, 0));
}
};
CursorMoveCommands.word = function (context, cursor, inSelectionMode, _position) {
var position = context.model.validatePosition(_position);
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorWordOperations_js__WEBPACK_IMPORTED_MODULE_3__[/* WordOperations */ "a"].word(context.config, context.model, cursor.modelState, inSelectionMode, position));
};
CursorMoveCommands.cancelSelection = function (context, cursor) {
if (!cursor.modelState.hasSelection()) {
return new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"](cursor.modelState, cursor.viewState);
}
var lineNumber = cursor.viewState.position.lineNumber;
var column = cursor.viewState.position.column;
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_5__[/* Range */ "a"](lineNumber, column, lineNumber, column), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](lineNumber, column), 0));
};
CursorMoveCommands.moveTo = function (context, cursor, inSelectionMode, _position, _viewPosition) {
var position = context.model.validatePosition(_position);
var viewPosition = (_viewPosition
? context.validateViewPosition(new _core_position_js__WEBPACK_IMPORTED_MODULE_4__[/* Position */ "a"](_viewPosition.lineNumber, _viewPosition.column), position)
: context.convertModelPositionToViewPosition(position));
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(cursor.viewState.move(inSelectionMode, viewPosition.lineNumber, viewPosition.column, 0));
};
CursorMoveCommands.move = function (context, cursors, args) {
var inSelectionMode = args.select;
var value = args.value;
switch (args.direction) {
case 0 /* Left */: {
if (args.unit === 4 /* HalfLine */) {
// Move left by half the current line length
return this._moveHalfLineLeft(context, cursors, inSelectionMode);
}
else {
// Move left by `moveParams.value` columns
return this._moveLeft(context, cursors, inSelectionMode, value);
}
}
case 1 /* Right */: {
if (args.unit === 4 /* HalfLine */) {
// Move right by half the current line length
return this._moveHalfLineRight(context, cursors, inSelectionMode);
}
else {
// Move right by `moveParams.value` columns
return this._moveRight(context, cursors, inSelectionMode, value);
}
}
case 2 /* Up */: {
if (args.unit === 2 /* WrappedLine */) {
// Move up by view lines
return this._moveUpByViewLines(context, cursors, inSelectionMode, value);
}
else {
// Move up by model lines
return this._moveUpByModelLines(context, cursors, inSelectionMode, value);
}
}
case 3 /* Down */: {
if (args.unit === 2 /* WrappedLine */) {
// Move down by view lines
return this._moveDownByViewLines(context, cursors, inSelectionMode, value);
}
else {
// Move down by model lines
return this._moveDownByModelLines(context, cursors, inSelectionMode, value);
}
}
case 4 /* WrappedLineStart */: {
// Move to the beginning of the current view line
return this._moveToViewMinColumn(context, cursors, inSelectionMode);
}
case 5 /* WrappedLineFirstNonWhitespaceCharacter */: {
// Move to the first non-whitespace column of the current view line
return this._moveToViewFirstNonWhitespaceColumn(context, cursors, inSelectionMode);
}
case 6 /* WrappedLineColumnCenter */: {
// Move to the "center" of the current view line
return this._moveToViewCenterColumn(context, cursors, inSelectionMode);
}
case 7 /* WrappedLineEnd */: {
// Move to the end of the current view line
return this._moveToViewMaxColumn(context, cursors, inSelectionMode);
}
case 8 /* WrappedLineLastNonWhitespaceCharacter */: {
// Move to the last non-whitespace column of the current view line
return this._moveToViewLastNonWhitespaceColumn(context, cursors, inSelectionMode);
}
case 9 /* ViewPortTop */: {
// Move to the nth line start in the viewport (from the top)
var cursor = cursors[0];
var visibleModelRange = context.getCompletelyVisibleModelRange();
var modelLineNumber = this._firstLineNumberInRange(context.model, visibleModelRange, value);
var modelColumn = context.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(context, cursor, inSelectionMode, modelLineNumber, modelColumn)];
}
case 11 /* ViewPortBottom */: {
// Move to the nth line start in the viewport (from the bottom)
var cursor = cursors[0];
var visibleModelRange = context.getCompletelyVisibleModelRange();
var modelLineNumber = this._lastLineNumberInRange(context.model, visibleModelRange, value);
var modelColumn = context.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(context, cursor, inSelectionMode, modelLineNumber, modelColumn)];
}
case 10 /* ViewPortCenter */: {
// Move to the line start in the viewport center
var cursor = cursors[0];
var visibleModelRange = context.getCompletelyVisibleModelRange();
var modelLineNumber = Math.round((visibleModelRange.startLineNumber + visibleModelRange.endLineNumber) / 2);
var modelColumn = context.model.getLineFirstNonWhitespaceColumn(modelLineNumber);
return [this._moveToModelPosition(context, cursor, inSelectionMode, modelLineNumber, modelColumn)];
}
case 12 /* ViewPortIfOutside */: {
// Move to a position inside the viewport
var visibleViewRange = context.getCompletelyVisibleViewRange();
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = this.findPositionInViewportIfOutside(context, cursor, visibleViewRange, inSelectionMode);
}
return result;
}
}
return null;
};
CursorMoveCommands.findPositionInViewportIfOutside = function (context, cursor, visibleViewRange, inSelectionMode) {
var viewLineNumber = cursor.viewState.position.lineNumber;
if (visibleViewRange.startLineNumber <= viewLineNumber && viewLineNumber <= visibleViewRange.endLineNumber - 1) {
// Nothing to do, cursor is in viewport
return new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"](cursor.modelState, cursor.viewState);
}
else {
if (viewLineNumber > visibleViewRange.endLineNumber - 1) {
viewLineNumber = visibleViewRange.endLineNumber - 1;
}
if (viewLineNumber < visibleViewRange.startLineNumber) {
viewLineNumber = visibleViewRange.startLineNumber;
}
var viewColumn = context.viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);
return this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
};
/**
* Find the nth line start included in the range (from the start).
*/
CursorMoveCommands._firstLineNumberInRange = function (model, range, count) {
var startLineNumber = range.startLineNumber;
if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {
// Move on to the second line if the first line start is not included in the range
startLineNumber++;
}
return Math.min(range.endLineNumber, startLineNumber + count - 1);
};
/**
* Find the nth line start included in the range (from the end).
*/
CursorMoveCommands._lastLineNumberInRange = function (model, range, count) {
var startLineNumber = range.startLineNumber;
if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {
// Move on to the second line if the first line start is not included in the range
startLineNumber++;
}
return Math.max(startLineNumber, range.endLineNumber - count + 1);
};
CursorMoveCommands._moveLeft = function (context, cursors, inSelectionMode, noOfColumns) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var newViewState = _cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveLeft(context.config, context.viewModel, cursor.viewState, inSelectionMode, noOfColumns);
if (noOfColumns === 1 && newViewState.position.lineNumber !== cursor.viewState.position.lineNumber) {
// moved over to the previous view line
var newViewModelPosition = context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(newViewState.position);
if (newViewModelPosition.lineNumber === cursor.modelState.position.lineNumber) {
// stayed on the same model line => pass wrapping point where 2 view positions map to a single model position
newViewState = _cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveLeft(context.config, context.viewModel, newViewState, inSelectionMode, 1);
}
}
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(newViewState);
}
return result;
};
CursorMoveCommands._moveHalfLineLeft = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var halfLine = Math.round(context.viewModel.getLineContent(viewLineNumber).length / 2);
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveLeft(context.config, context.viewModel, cursor.viewState, inSelectionMode, halfLine));
}
return result;
};
CursorMoveCommands._moveRight = function (context, cursors, inSelectionMode, noOfColumns) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var newViewState = _cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveRight(context.config, context.viewModel, cursor.viewState, inSelectionMode, noOfColumns);
if (noOfColumns === 1 && newViewState.position.lineNumber !== cursor.viewState.position.lineNumber) {
// moved over to the next view line
var newViewModelPosition = context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(newViewState.position);
if (newViewModelPosition.lineNumber === cursor.modelState.position.lineNumber) {
// stayed on the same model line => pass wrapping point where 2 view positions map to a single model position
newViewState = _cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveRight(context.config, context.viewModel, newViewState, inSelectionMode, 1);
}
}
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(newViewState);
}
return result;
};
CursorMoveCommands._moveHalfLineRight = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var halfLine = Math.round(context.viewModel.getLineContent(viewLineNumber).length / 2);
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveRight(context.config, context.viewModel, cursor.viewState, inSelectionMode, halfLine));
}
return result;
};
CursorMoveCommands._moveDownByViewLines = function (context, cursors, inSelectionMode, linesCount) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveDown(context.config, context.viewModel, cursor.viewState, inSelectionMode, linesCount));
}
return result;
};
CursorMoveCommands._moveDownByModelLines = function (context, cursors, inSelectionMode, linesCount) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveDown(context.config, context.model, cursor.modelState, inSelectionMode, linesCount));
}
return result;
};
CursorMoveCommands._moveUpByViewLines = function (context, cursors, inSelectionMode, linesCount) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveUp(context.config, context.viewModel, cursor.viewState, inSelectionMode, linesCount));
}
return result;
};
CursorMoveCommands._moveUpByModelLines = function (context, cursors, inSelectionMode, linesCount) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
result[i] = _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(_cursorMoveOperations_js__WEBPACK_IMPORTED_MODULE_2__[/* MoveOperations */ "a"].moveUp(context.config, context.model, cursor.modelState, inSelectionMode, linesCount));
}
return result;
};
CursorMoveCommands._moveToViewPosition = function (context, cursor, inSelectionMode, toViewLineNumber, toViewColumn) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromViewState(cursor.viewState.move(inSelectionMode, toViewLineNumber, toViewColumn, 0));
};
CursorMoveCommands._moveToModelPosition = function (context, cursor, inSelectionMode, toModelLineNumber, toModelColumn) {
return _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorState */ "d"].fromModelState(cursor.modelState.move(inSelectionMode, toModelLineNumber, toModelColumn, 0));
};
CursorMoveCommands._moveToViewMinColumn = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var viewColumn = context.viewModel.getLineMinColumn(viewLineNumber);
result[i] = this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
};
CursorMoveCommands._moveToViewFirstNonWhitespaceColumn = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var viewColumn = context.viewModel.getLineFirstNonWhitespaceColumn(viewLineNumber);
result[i] = this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
};
CursorMoveCommands._moveToViewCenterColumn = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var viewColumn = Math.round((context.viewModel.getLineMaxColumn(viewLineNumber) + context.viewModel.getLineMinColumn(viewLineNumber)) / 2);
result[i] = this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
};
CursorMoveCommands._moveToViewMaxColumn = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var viewColumn = context.viewModel.getLineMaxColumn(viewLineNumber);
result[i] = this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
};
CursorMoveCommands._moveToViewLastNonWhitespaceColumn = function (context, cursors, inSelectionMode) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var viewLineNumber = cursor.viewState.position.lineNumber;
var viewColumn = context.viewModel.getLineLastNonWhitespaceColumn(viewLineNumber);
result[i] = this._moveToViewPosition(context, cursor, inSelectionMode, viewLineNumber, viewColumn);
}
return result;
};
return CursorMoveCommands;
}());
var CursorMove;
(function (CursorMove) {
var isCursorMoveArgs = function (arg) {
if (!_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ "i"](arg)) {
return false;
}
var cursorMoveArg = arg;
if (!_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isString */ "j"](cursorMoveArg.to)) {
return false;
}
if (!_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isUndefined */ "k"](cursorMoveArg.select) && !_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isBoolean */ "e"](cursorMoveArg.select)) {
return false;
}
if (!_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isUndefined */ "k"](cursorMoveArg.by) && !_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isString */ "j"](cursorMoveArg.by)) {
return false;
}
if (!_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isUndefined */ "k"](cursorMoveArg.value) && !_base_common_types_js__WEBPACK_IMPORTED_MODULE_0__[/* isNumber */ "h"](cursorMoveArg.value)) {
return false;
}
return true;
};
CursorMove.description = {
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:\n\t\t\t\t\t* 'to': A mandatory logical position value providing where to move the cursor.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'left', 'right', 'up', 'down'\n\t\t\t\t\t\t'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'\n\t\t\t\t\t\t'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'\n\t\t\t\t\t\t'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'line', 'wrappedLine', 'character', 'halfLine'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'select': If 'true' makes the selection. Default is 'false'.\n\t\t\t\t",
constraint: isCursorMoveArgs,
schema: {
'type': 'object',
'required': ['to'],
'properties': {
'to': {
'type': 'string',
'enum': ['left', 'right', 'up', 'down', '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
}
}
}
}
]
};
/**
* Positions in the view for cursor move command.
*/
CursorMove.RawDirection = {
Left: 'left',
Right: 'right',
Up: 'up',
Down: 'down',
WrappedLineStart: 'wrappedLineStart',
WrappedLineFirstNonWhitespaceCharacter: 'wrappedLineFirstNonWhitespaceCharacter',
WrappedLineColumnCenter: 'wrappedLineColumnCenter',
WrappedLineEnd: 'wrappedLineEnd',
WrappedLineLastNonWhitespaceCharacter: 'wrappedLineLastNonWhitespaceCharacter',
ViewPortTop: 'viewPortTop',
ViewPortCenter: 'viewPortCenter',
ViewPortBottom: 'viewPortBottom',
ViewPortIfOutside: 'viewPortIfOutside'
};
/**
* Units for Cursor move 'by' argument
*/
CursorMove.RawUnit = {
Line: 'line',
WrappedLine: 'wrappedLine',
Character: 'character',
HalfLine: 'halfLine'
};
function parse(args) {
if (!args.to) {
// illegal arguments
return null;
}
var direction;
switch (args.to) {
case CursorMove.RawDirection.Left:
direction = 0 /* Left */;
break;
case CursorMove.RawDirection.Right:
direction = 1 /* Right */;
break;
case CursorMove.RawDirection.Up:
direction = 2 /* Up */;
break;
case CursorMove.RawDirection.Down:
direction = 3 /* Down */;
break;
case CursorMove.RawDirection.WrappedLineStart:
direction = 4 /* WrappedLineStart */;
break;
case CursorMove.RawDirection.WrappedLineFirstNonWhitespaceCharacter:
direction = 5 /* WrappedLineFirstNonWhitespaceCharacter */;
break;
case CursorMove.RawDirection.WrappedLineColumnCenter:
direction = 6 /* WrappedLineColumnCenter */;
break;
case CursorMove.RawDirection.WrappedLineEnd:
direction = 7 /* WrappedLineEnd */;
break;
case CursorMove.RawDirection.WrappedLineLastNonWhitespaceCharacter:
direction = 8 /* WrappedLineLastNonWhitespaceCharacter */;
break;
case CursorMove.RawDirection.ViewPortTop:
direction = 9 /* ViewPortTop */;
break;
case CursorMove.RawDirection.ViewPortBottom:
direction = 11 /* ViewPortBottom */;
break;
case CursorMove.RawDirection.ViewPortCenter:
direction = 10 /* ViewPortCenter */;
break;
case CursorMove.RawDirection.ViewPortIfOutside:
direction = 12 /* ViewPortIfOutside */;
break;
default:
// illegal arguments
return null;
}
var unit = 0 /* None */;
switch (args.by) {
case CursorMove.RawUnit.Line:
unit = 1 /* Line */;
break;
case CursorMove.RawUnit.WrappedLine:
unit = 2 /* WrappedLine */;
break;
case CursorMove.RawUnit.Character:
unit = 3 /* Character */;
break;
case CursorMove.RawUnit.HalfLine:
unit = 4 /* HalfLine */;
break;
}
return {
direction: direction,
unit: unit,
select: (!!args.select),
value: (args.value || 1)
};
}
CursorMove.parse = parse;
})(CursorMove || (CursorMove = {}));
/***/ }),
/* 76 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IContextViewService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IContextMenuService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IContextViewService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('contextViewService');
var IContextMenuService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('contextMenuService');
/***/ }),
/* 77 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _strings_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Severity;
(function (Severity) {
Severity[Severity["Ignore"] = 0] = "Ignore";
Severity[Severity["Info"] = 1] = "Info";
Severity[Severity["Warning"] = 2] = "Warning";
Severity[Severity["Error"] = 3] = "Error";
})(Severity || (Severity = {}));
(function (Severity) {
var _error = 'error';
var _warning = 'warning';
var _warn = 'warn';
var _info = 'info';
var _displayStrings = Object.create(null);
_displayStrings[Severity.Error] = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('sev.error', "Error");
_displayStrings[Severity.Warning] = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('sev.warning', "Warning");
_displayStrings[Severity.Info] = _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('sev.info', "Info");
/**
* Parses 'error', 'warning', 'warn', 'info' in call casings
* and falls back to ignore.
*/
function fromValue(value) {
if (!value) {
return Severity.Ignore;
}
if (_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* equalsIgnoreCase */ "n"](_error, value)) {
return Severity.Error;
}
if (_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* equalsIgnoreCase */ "n"](_warning, value) || _strings_js__WEBPACK_IMPORTED_MODULE_1__[/* equalsIgnoreCase */ "n"](_warn, value)) {
return Severity.Warning;
}
if (_strings_js__WEBPACK_IMPORTED_MODULE_1__[/* equalsIgnoreCase */ "n"](_info, value)) {
return Severity.Info;
}
return Severity.Ignore;
}
Severity.fromValue = fromValue;
})(Severity || (Severity = {}));
/* harmony default export */ __webpack_exports__["a"] = (Severity);
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/* 79 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DataTransfers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DragAndDropData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return StaticDND; });
// Common data transfers
var 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: 'text/plain'
};
var DragAndDropData = /** @class */ (function () {
function DragAndDropData(data) {
this.data = data;
}
DragAndDropData.prototype.update = function () {
// noop
};
DragAndDropData.prototype.getData = function () {
return this.data;
};
return DragAndDropData;
}());
var StaticDND = {
CurrentDragAndDropData: undefined
};
/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {
var helpers = __webpack_require__(249);
function store(serializeContext, token) {
serializeContext.output.push(typeof token == 'string' ? token : token[1]);
}
function context() {
var newContext = {
output: [],
store: store
};
return newContext;
}
function all(tokens) {
var oneTimeContext = context();
helpers.all(oneTimeContext, tokens);
return oneTimeContext.output.join('');
}
function body(tokens) {
var oneTimeContext = context();
helpers.body(oneTimeContext, tokens);
return oneTimeContext.output.join('');
}
function property(tokens, position) {
var oneTimeContext = context();
helpers.property(oneTimeContext, tokens, position, true);
return oneTimeContext.output.join('');
}
function rules(tokens) {
var oneTimeContext = context();
helpers.rules(oneTimeContext, tokens);
return oneTimeContext.output.join('');
}
function value(tokens) {
var oneTimeContext = context();
helpers.value(oneTimeContext, tokens);
return oneTimeContext.output.join('');
}
module.exports = {
all: all,
body: body,
property: property,
rules: rules,
value: value
};
/***/ }),
/* 81 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ scrollableElement_ScrollableElement; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ SmoothScrollableElement; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ DomScrollableElement; });
// UNUSED EXPORTS: MouseWheelClassifier, AbstractScrollableElement
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css
var scrollbars = __webpack_require__(627);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/browser.js
var browser = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js
var fastDomNode = __webpack_require__(29);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js
var mouseEvent = __webpack_require__(46);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/globalMouseMoveMonitor.js
var globalMouseMoveMonitor = __webpack_require__(89);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/widget.js
var widget = __webpack_require__(67);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/async.js
var common_async = __webpack_require__(20);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarArrow.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* The arrow image size.
*/
var ARROW_IMG_SIZE = 11;
var scrollbarArrow_ScrollbarArrow = /** @class */ (function (_super) {
__extends(ScrollbarArrow, _super);
function ScrollbarArrow(opts) {
var _this = _super.call(this) || this;
_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.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._mouseMoveMonitor = _this._register(new globalMouseMoveMonitor["a" /* GlobalMouseMoveMonitor */]());
_this.onmousedown(_this.bgDomNode, function (e) { return _this._arrowMouseDown(e); });
_this.onmousedown(_this.domNode, function (e) { return _this._arrowMouseDown(e); });
_this._mousedownRepeatTimer = _this._register(new common_async["c" /* IntervalTimer */]());
_this._mousedownScheduleRepeatTimer = _this._register(new common_async["e" /* TimeoutTimer */]());
return _this;
}
ScrollbarArrow.prototype._arrowMouseDown = function (e) {
var _this = this;
var scheduleRepeater = function () {
_this._mousedownRepeatTimer.cancelAndSet(function () { return _this._onActivate(); }, 1000 / 24);
};
this._onActivate();
this._mousedownRepeatTimer.cancel();
this._mousedownScheduleRepeatTimer.cancelAndSet(scheduleRepeater, 200);
this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, globalMouseMoveMonitor["b" /* standardMouseMoveMerger */], function (mouseMoveData) {
/* Intentional empty */
}, function () {
_this._mousedownRepeatTimer.cancel();
_this._mousedownScheduleRepeatTimer.cancel();
});
e.preventDefault();
};
return ScrollbarArrow;
}(widget["a" /* Widget */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var scrollbarVisibilityController_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var scrollbarVisibilityController_ScrollbarVisibilityController = /** @class */ (function (_super) {
scrollbarVisibilityController_extends(ScrollbarVisibilityController, _super);
function ScrollbarVisibilityController(visibility, visibleClassName, invisibleClassName) {
var _this = _super.call(this) || this;
_this._visibility = visibility;
_this._visibleClassName = visibleClassName;
_this._invisibleClassName = invisibleClassName;
_this._domNode = null;
_this._isVisible = false;
_this._isNeeded = false;
_this._shouldBeVisible = false;
_this._revealTimer = _this._register(new common_async["e" /* TimeoutTimer */]());
return _this;
}
// ----------------- Hide / Reveal
ScrollbarVisibilityController.prototype.applyVisibilitySetting = function (shouldBeVisible) {
if (this._visibility === 2 /* Hidden */) {
return false;
}
if (this._visibility === 3 /* Visible */) {
return true;
}
return shouldBeVisible;
};
ScrollbarVisibilityController.prototype.setShouldBeVisible = function (rawShouldBeVisible) {
var shouldBeVisible = this.applyVisibilitySetting(rawShouldBeVisible);
if (this._shouldBeVisible !== shouldBeVisible) {
this._shouldBeVisible = shouldBeVisible;
this.ensureVisibility();
}
};
ScrollbarVisibilityController.prototype.setIsNeeded = function (isNeeded) {
if (this._isNeeded !== isNeeded) {
this._isNeeded = isNeeded;
this.ensureVisibility();
}
};
ScrollbarVisibilityController.prototype.setDomNode = function (domNode) {
this._domNode = domNode;
this._domNode.setClassName(this._invisibleClassName);
// Now that the flags & the dom node are in a consistent state, ensure the Hidden/Visible configuration
this.setShouldBeVisible(false);
};
ScrollbarVisibilityController.prototype.ensureVisibility = function () {
if (!this._isNeeded) {
// Nothing to be rendered
this._hide(false);
return;
}
if (this._shouldBeVisible) {
this._reveal();
}
else {
this._hide(true);
}
};
ScrollbarVisibilityController.prototype._reveal = function () {
var _this = this;
if (this._isVisible) {
return;
}
this._isVisible = true;
// The CSS animation doesn't play otherwise
this._revealTimer.setIfNotSet(function () {
if (_this._domNode) {
_this._domNode.setClassName(_this._visibleClassName);
}
}, 0);
};
ScrollbarVisibilityController.prototype._hide = function (withFadeAway) {
this._revealTimer.cancel();
if (!this._isVisible) {
return;
}
this._isVisible = false;
if (this._domNode) {
this._domNode.setClassName(this._invisibleClassName + (withFadeAway ? ' fade' : ''));
}
};
return ScrollbarVisibilityController;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/abstractScrollbar.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var abstractScrollbar_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* The orthogonal distance to the slider at which dragging "resets". This implements "snapping"
*/
var MOUSE_DRAG_RESET_DISTANCE = 140;
var abstractScrollbar_AbstractScrollbar = /** @class */ (function (_super) {
abstractScrollbar_extends(AbstractScrollbar, _super);
function AbstractScrollbar(opts) {
var _this = _super.call(this) || this;
_this._lazyRender = opts.lazyRender;
_this._host = opts.host;
_this._scrollable = opts.scrollable;
_this._scrollbarState = opts.scrollbarState;
_this._visibilityController = _this._register(new scrollbarVisibilityController_ScrollbarVisibilityController(opts.visibility, 'visible scrollbar ' + opts.extraScrollbarClassName, 'invisible scrollbar ' + opts.extraScrollbarClassName));
_this._visibilityController.setIsNeeded(_this._scrollbarState.isNeeded());
_this._mouseMoveMonitor = _this._register(new globalMouseMoveMonitor["a" /* GlobalMouseMoveMonitor */]());
_this._shouldRender = true;
_this.domNode = Object(fastDomNode["b" /* 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.onmousedown(_this.domNode.domNode, function (e) { return _this._domNodeMouseDown(e); });
return _this;
}
// ----------------- creation
/**
* Creates the dom node for an arrow & adds it to the container
*/
AbstractScrollbar.prototype._createArrow = function (opts) {
var arrow = this._register(new scrollbarArrow_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
*/
AbstractScrollbar.prototype._createSlider = function (top, left, width, height) {
var _this = this;
this.slider = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
this.slider.setClassName('slider');
this.slider.setPosition('absolute');
this.slider.setTop(top);
this.slider.setLeft(left);
if (typeof width === 'number') {
this.slider.setWidth(width);
}
if (typeof height === 'number') {
this.slider.setHeight(height);
}
this.slider.setLayerHinting(true);
this.slider.setContain('strict');
this.domNode.domNode.appendChild(this.slider.domNode);
this.onmousedown(this.slider.domNode, function (e) {
if (e.leftButton) {
e.preventDefault();
_this._sliderMouseDown(e, function () { });
}
});
this.onclick(this.slider.domNode, function (e) {
if (e.leftButton) {
e.stopPropagation();
}
});
};
// ----------------- Update state
AbstractScrollbar.prototype._onElementSize = function (visibleSize) {
if (this._scrollbarState.setVisibleSize(visibleSize)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
};
AbstractScrollbar.prototype._onElementScrollSize = function (elementScrollSize) {
if (this._scrollbarState.setScrollSize(elementScrollSize)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
};
AbstractScrollbar.prototype._onElementScrollPosition = function (elementScrollPosition) {
if (this._scrollbarState.setScrollPosition(elementScrollPosition)) {
this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded());
this._shouldRender = true;
if (!this._lazyRender) {
this.render();
}
}
return this._shouldRender;
};
// ----------------- rendering
AbstractScrollbar.prototype.beginReveal = function () {
this._visibilityController.setShouldBeVisible(true);
};
AbstractScrollbar.prototype.beginHide = function () {
this._visibilityController.setShouldBeVisible(false);
};
AbstractScrollbar.prototype.render = function () {
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
AbstractScrollbar.prototype._domNodeMouseDown = function (e) {
if (e.target !== this.domNode.domNode) {
return;
}
this._onMouseDown(e);
};
AbstractScrollbar.prototype.delegateMouseDown = function (e) {
var domTop = this.domNode.domNode.getClientRects()[0].top;
var sliderStart = domTop + this._scrollbarState.getSliderPosition();
var sliderStop = domTop + this._scrollbarState.getSliderPosition() + this._scrollbarState.getSliderSize();
var mousePos = this._sliderMousePosition(e);
if (sliderStart <= mousePos && mousePos <= sliderStop) {
// Act as if it was a mouse down on the slider
if (e.leftButton) {
e.preventDefault();
this._sliderMouseDown(e, function () { });
}
}
else {
// Act as if it was a mouse down on the scrollbar
this._onMouseDown(e);
}
};
AbstractScrollbar.prototype._onMouseDown = function (e) {
var offsetX;
var offsetY;
if (e.target === this.domNode.domNode && typeof e.browserEvent.offsetX === 'number' && typeof e.browserEvent.offsetY === 'number') {
offsetX = e.browserEvent.offsetX;
offsetY = e.browserEvent.offsetY;
}
else {
var domNodePosition = dom["C" /* getDomNodePagePosition */](this.domNode.domNode);
offsetX = e.posx - domNodePosition.left;
offsetY = e.posy - domNodePosition.top;
}
this._setDesiredScrollPositionNow(this._scrollbarState.getDesiredScrollPositionFromOffset(this._mouseDownRelativePosition(offsetX, offsetY)));
if (e.leftButton) {
e.preventDefault();
this._sliderMouseDown(e, function () { });
}
};
AbstractScrollbar.prototype._sliderMouseDown = function (e, onDragFinished) {
var _this = this;
var initialMousePosition = this._sliderMousePosition(e);
var initialMouseOrthogonalPosition = this._sliderOrthogonalMousePosition(e);
var initialScrollbarState = this._scrollbarState.clone();
this.slider.toggleClassName('active', true);
this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, globalMouseMoveMonitor["b" /* standardMouseMoveMerger */], function (mouseMoveData) {
var mouseOrthogonalPosition = _this._sliderOrthogonalMousePosition(mouseMoveData);
var mouseOrthogonalDelta = Math.abs(mouseOrthogonalPosition - initialMouseOrthogonalPosition);
if (platform["h" /* isWindows */] && mouseOrthogonalDelta > MOUSE_DRAG_RESET_DISTANCE) {
// The mouse has wondered away from the scrollbar => reset dragging
_this._setDesiredScrollPositionNow(initialScrollbarState.getScrollPosition());
return;
}
var mousePosition = _this._sliderMousePosition(mouseMoveData);
var mouseDelta = mousePosition - initialMousePosition;
_this._setDesiredScrollPositionNow(initialScrollbarState.getDesiredScrollPositionFromDelta(mouseDelta));
}, function () {
_this.slider.toggleClassName('active', false);
_this._host.onDragEnd();
onDragFinished();
});
this._host.onDragStart();
};
AbstractScrollbar.prototype._setDesiredScrollPositionNow = function (_desiredScrollPosition) {
var desiredScrollPosition = {};
this.writeScrollPosition(desiredScrollPosition, _desiredScrollPosition);
this._scrollable.setScrollPositionNow(desiredScrollPosition);
};
return AbstractScrollbar;
}(widget["a" /* Widget */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollbarState.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* The minimal size of the slider (such that it can still be clickable) -- it is artificially enlarged.
*/
var MINIMUM_SLIDER_SIZE = 20;
var ScrollbarState = /** @class */ (function () {
function ScrollbarState(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();
}
ScrollbarState.prototype.clone = function () {
return new ScrollbarState(this._arrowSize, this._scrollbarSize, this._oppositeScrollbarSize, this._visibleSize, this._scrollSize, this._scrollPosition);
};
ScrollbarState.prototype.setVisibleSize = function (visibleSize) {
var iVisibleSize = Math.round(visibleSize);
if (this._visibleSize !== iVisibleSize) {
this._visibleSize = iVisibleSize;
this._refreshComputedValues();
return true;
}
return false;
};
ScrollbarState.prototype.setScrollSize = function (scrollSize) {
var iScrollSize = Math.round(scrollSize);
if (this._scrollSize !== iScrollSize) {
this._scrollSize = iScrollSize;
this._refreshComputedValues();
return true;
}
return false;
};
ScrollbarState.prototype.setScrollPosition = function (scrollPosition) {
var iScrollPosition = Math.round(scrollPosition);
if (this._scrollPosition !== iScrollPosition) {
this._scrollPosition = iScrollPosition;
this._refreshComputedValues();
return true;
}
return false;
};
ScrollbarState._computeValues = function (oppositeScrollbarSize, arrowSize, visibleSize, scrollSize, scrollPosition) {
var computedAvailableSize = Math.max(0, visibleSize - oppositeScrollbarSize);
var computedRepresentableSize = Math.max(0, computedAvailableSize - 2 * arrowSize);
var computedIsNeeded = (scrollSize > 0 && scrollSize > visibleSize);
if (!computedIsNeeded) {
// There is no need for a slider
return {
computedAvailableSize: Math.round(computedAvailableSize),
computedIsNeeded: computedIsNeeded,
computedSliderSize: Math.round(computedRepresentableSize),
computedSliderRatio: 0,
computedSliderPosition: 0,
};
}
// We must artificially increase the size of the slider if needed, since the slider would be too small to grab with the mouse otherwise
var computedSliderSize = Math.round(Math.max(MINIMUM_SLIDER_SIZE, Math.floor(visibleSize * computedRepresentableSize / scrollSize)));
// The slider can move from 0 to `computedRepresentableSize` - `computedSliderSize`
// in the same way `scrollPosition` can move from 0 to `scrollSize` - `visibleSize`.
var computedSliderRatio = (computedRepresentableSize - computedSliderSize) / (scrollSize - visibleSize);
var computedSliderPosition = (scrollPosition * computedSliderRatio);
return {
computedAvailableSize: Math.round(computedAvailableSize),
computedIsNeeded: computedIsNeeded,
computedSliderSize: Math.round(computedSliderSize),
computedSliderRatio: computedSliderRatio,
computedSliderPosition: Math.round(computedSliderPosition),
};
};
ScrollbarState.prototype._refreshComputedValues = function () {
var 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;
};
ScrollbarState.prototype.getArrowSize = function () {
return this._arrowSize;
};
ScrollbarState.prototype.getScrollPosition = function () {
return this._scrollPosition;
};
ScrollbarState.prototype.getRectangleLargeSize = function () {
return this._computedAvailableSize;
};
ScrollbarState.prototype.getRectangleSmallSize = function () {
return this._scrollbarSize;
};
ScrollbarState.prototype.isNeeded = function () {
return this._computedIsNeeded;
};
ScrollbarState.prototype.getSliderSize = function () {
return this._computedSliderSize;
};
ScrollbarState.prototype.getSliderPosition = function () {
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`.
*/
ScrollbarState.prototype.getDesiredScrollPositionFromOffset = function (offset) {
if (!this._computedIsNeeded) {
// no need for a slider
return 0;
}
var desiredSliderPosition = offset - this._arrowSize - this._computedSliderSize / 2;
return Math.round(desiredSliderPosition / this._computedSliderRatio);
};
/**
* Compute a desired `scrollPosition` such that the slider moves by `delta`.
*/
ScrollbarState.prototype.getDesiredScrollPositionFromDelta = function (delta) {
if (!this._computedIsNeeded) {
// no need for a slider
return 0;
}
var desiredSliderPosition = this._computedSliderPosition + delta;
return Math.round(desiredSliderPosition / this._computedSliderRatio);
};
return ScrollbarState;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/horizontalScrollbar.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var horizontalScrollbar_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var horizontalScrollbar_HorizontalScrollbar = /** @class */ (function (_super) {
horizontalScrollbar_extends(HorizontalScrollbar, _super);
function HorizontalScrollbar(scrollable, options, host) {
var _this = this;
var scrollDimensions = scrollable.getScrollDimensions();
var scrollPosition = scrollable.getCurrentScrollPosition();
_this = _super.call(this, {
lazyRender: options.lazyRender,
host: host,
scrollbarState: new ScrollbarState((options.horizontalHasArrows ? options.arrowSize : 0), (options.horizontal === 2 /* Hidden */ ? 0 : options.horizontalScrollbarSize), (options.vertical === 2 /* Hidden */ ? 0 : options.verticalScrollbarSize), scrollDimensions.width, scrollDimensions.scrollWidth, scrollPosition.scrollLeft),
visibility: options.horizontal,
extraScrollbarClassName: 'horizontal',
scrollable: scrollable
}) || this;
if (options.horizontalHasArrows) {
var arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;
var scrollbarDelta = (options.horizontalScrollbarSize - ARROW_IMG_SIZE) / 2;
_this._createArrow({
className: 'left-arrow',
top: scrollbarDelta,
left: arrowDelta,
bottom: undefined,
right: undefined,
bgWidth: options.arrowSize,
bgHeight: options.horizontalScrollbarSize,
onActivate: function () { return _this._host.onMouseWheel(new mouseEvent["c" /* StandardWheelEvent */](null, 1, 0)); },
});
_this._createArrow({
className: 'right-arrow',
top: scrollbarDelta,
left: undefined,
bottom: undefined,
right: arrowDelta,
bgWidth: options.arrowSize,
bgHeight: options.horizontalScrollbarSize,
onActivate: function () { return _this._host.onMouseWheel(new mouseEvent["c" /* StandardWheelEvent */](null, -1, 0)); },
});
}
_this._createSlider(Math.floor((options.horizontalScrollbarSize - options.horizontalSliderSize) / 2), 0, undefined, options.horizontalSliderSize);
return _this;
}
HorizontalScrollbar.prototype._updateSlider = function (sliderSize, sliderPosition) {
this.slider.setWidth(sliderSize);
this.slider.setLeft(sliderPosition);
};
HorizontalScrollbar.prototype._renderDomNode = function (largeSize, smallSize) {
this.domNode.setWidth(largeSize);
this.domNode.setHeight(smallSize);
this.domNode.setLeft(0);
this.domNode.setBottom(0);
};
HorizontalScrollbar.prototype.onDidScroll = function (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;
};
HorizontalScrollbar.prototype._mouseDownRelativePosition = function (offsetX, offsetY) {
return offsetX;
};
HorizontalScrollbar.prototype._sliderMousePosition = function (e) {
return e.posx;
};
HorizontalScrollbar.prototype._sliderOrthogonalMousePosition = function (e) {
return e.posy;
};
HorizontalScrollbar.prototype.writeScrollPosition = function (target, scrollPosition) {
target.scrollLeft = scrollPosition;
};
return HorizontalScrollbar;
}(abstractScrollbar_AbstractScrollbar));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/verticalScrollbar.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var verticalScrollbar_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var verticalScrollbar_VerticalScrollbar = /** @class */ (function (_super) {
verticalScrollbar_extends(VerticalScrollbar, _super);
function VerticalScrollbar(scrollable, options, host) {
var _this = this;
var scrollDimensions = scrollable.getScrollDimensions();
var scrollPosition = scrollable.getCurrentScrollPosition();
_this = _super.call(this, {
lazyRender: options.lazyRender,
host: host,
scrollbarState: new ScrollbarState((options.verticalHasArrows ? options.arrowSize : 0), (options.vertical === 2 /* Hidden */ ? 0 : options.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: options.vertical,
extraScrollbarClassName: 'vertical',
scrollable: scrollable
}) || this;
if (options.verticalHasArrows) {
var arrowDelta = (options.arrowSize - ARROW_IMG_SIZE) / 2;
var scrollbarDelta = (options.verticalScrollbarSize - ARROW_IMG_SIZE) / 2;
_this._createArrow({
className: 'up-arrow',
top: arrowDelta,
left: scrollbarDelta,
bottom: undefined,
right: undefined,
bgWidth: options.verticalScrollbarSize,
bgHeight: options.arrowSize,
onActivate: function () { return _this._host.onMouseWheel(new mouseEvent["c" /* StandardWheelEvent */](null, 0, 1)); },
});
_this._createArrow({
className: 'down-arrow',
top: undefined,
left: scrollbarDelta,
bottom: arrowDelta,
right: undefined,
bgWidth: options.verticalScrollbarSize,
bgHeight: options.arrowSize,
onActivate: function () { return _this._host.onMouseWheel(new mouseEvent["c" /* StandardWheelEvent */](null, 0, -1)); },
});
}
_this._createSlider(0, Math.floor((options.verticalScrollbarSize - options.verticalSliderSize) / 2), options.verticalSliderSize, undefined);
return _this;
}
VerticalScrollbar.prototype._updateSlider = function (sliderSize, sliderPosition) {
this.slider.setHeight(sliderSize);
this.slider.setTop(sliderPosition);
};
VerticalScrollbar.prototype._renderDomNode = function (largeSize, smallSize) {
this.domNode.setWidth(smallSize);
this.domNode.setHeight(largeSize);
this.domNode.setRight(0);
this.domNode.setTop(0);
};
VerticalScrollbar.prototype.onDidScroll = function (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;
};
VerticalScrollbar.prototype._mouseDownRelativePosition = function (offsetX, offsetY) {
return offsetY;
};
VerticalScrollbar.prototype._sliderMousePosition = function (e) {
return e.posy;
};
VerticalScrollbar.prototype._sliderOrthogonalMousePosition = function (e) {
return e.posx;
};
VerticalScrollbar.prototype.writeScrollPosition = function (target, scrollPosition) {
target.scrollTop = scrollPosition;
};
return VerticalScrollbar;
}(abstractScrollbar_AbstractScrollbar));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/scrollable.js
var common_scrollable = __webpack_require__(235);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var scrollableElement_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var HIDE_TIMEOUT = 500;
var SCROLL_WHEEL_SENSITIVITY = 50;
var SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED = true;
var MouseWheelClassifierItem = /** @class */ (function () {
function MouseWheelClassifierItem(timestamp, deltaX, deltaY) {
this.timestamp = timestamp;
this.deltaX = deltaX;
this.deltaY = deltaY;
this.score = 0;
}
return MouseWheelClassifierItem;
}());
var MouseWheelClassifier = /** @class */ (function () {
function MouseWheelClassifier() {
this._capacity = 5;
this._memory = [];
this._front = -1;
this._rear = -1;
}
MouseWheelClassifier.prototype.isPhysicalMouseWheel = function () {
if (this._front === -1 && this._rear === -1) {
// no elements
return false;
}
// 0.5 * last + 0.25 * 2nd last + 0.125 * 3rd last + ...
var remainingInfluence = 1;
var score = 0;
var iteration = 1;
var index = this._rear;
do {
var influence = (index === this._front ? remainingInfluence : Math.pow(2, -iteration));
remainingInfluence -= influence;
score += this._memory[index].score * influence;
if (index === this._front) {
break;
}
index = (this._capacity + index - 1) % this._capacity;
iteration++;
} while (true);
return (score <= 0.5);
};
MouseWheelClassifier.prototype.accept = function (timestamp, deltaX, deltaY) {
var item = new MouseWheelClassifierItem(timestamp, deltaX, deltaY);
item.score = this._computeScore(item);
if (this._front === -1 && this._rear === -1) {
this._memory[0] = item;
this._front = 0;
this._rear = 0;
}
else {
this._rear = (this._rear + 1) % this._capacity;
if (this._rear === this._front) {
// Drop oldest
this._front = (this._front + 1) % this._capacity;
}
this._memory[this._rear] = item;
}
};
/**
* 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.
*/
MouseWheelClassifier.prototype._computeScore = function (item) {
if (Math.abs(item.deltaX) > 0 && Math.abs(item.deltaY) > 0) {
// both axes exercised => definitely not a physical mouse wheel
return 1;
}
var score = 0.5;
var prev = (this._front === -1 && this._rear === -1 ? null : this._memory[this._rear]);
if (prev) {
// const deltaT = item.timestamp - prev.timestamp;
// if (deltaT < 1000 / 30) {
// // sooner than X times per second => indicator that this is not a physical mouse wheel
// score += 0.25;
// }
// if (item.deltaX === prev.deltaX && item.deltaY === prev.deltaY) {
// // equal amplitude => indicator that this is a physical mouse wheel
// score -= 0.25;
// }
}
if (Math.abs(item.deltaX - Math.round(item.deltaX)) > 0 || Math.abs(item.deltaY - Math.round(item.deltaY)) > 0) {
// non-integer deltas => indicator that this is not a physical mouse wheel
score += 0.25;
}
return Math.min(Math.max(score, 0), 1);
};
MouseWheelClassifier.INSTANCE = new MouseWheelClassifier();
return MouseWheelClassifier;
}());
var scrollableElement_AbstractScrollableElement = /** @class */ (function (_super) {
scrollableElement_extends(AbstractScrollableElement, _super);
function AbstractScrollableElement(element, options, scrollable) {
var _this = _super.call(this) || this;
_this._onScroll = _this._register(new common_event["a" /* Emitter */]());
_this.onScroll = _this._onScroll.event;
element.style.overflow = 'hidden';
_this._options = resolveOptions(options);
_this._scrollable = scrollable;
_this._register(_this._scrollable.onScroll(function (e) {
_this._onDidScroll(e);
_this._onScroll.fire(e);
}));
var scrollbarHost = {
onMouseWheel: function (mouseWheelEvent) { return _this._onMouseWheel(mouseWheelEvent); },
onDragStart: function () { return _this._onDragStart(); },
onDragEnd: function () { return _this._onDragEnd(); },
};
_this._verticalScrollbar = _this._register(new verticalScrollbar_VerticalScrollbar(_this._scrollable, _this._options, scrollbarHost));
_this._horizontalScrollbar = _this._register(new horizontalScrollbar_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 = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._leftShadowDomNode.setClassName('shadow');
_this._domNode.appendChild(_this._leftShadowDomNode.domNode);
_this._topShadowDomNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._topShadowDomNode.setClassName('shadow');
_this._domNode.appendChild(_this._topShadowDomNode.domNode);
_this._topLeftShadowDomNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._topLeftShadowDomNode.setClassName('shadow top-left-corner');
_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, function (e) { return _this._onMouseOver(e); });
_this.onnonbubblingmouseout(_this._listenOnDomNode, function (e) { return _this._onMouseOut(e); });
_this._hideTimeout = _this._register(new common_async["e" /* TimeoutTimer */]());
_this._isDragging = false;
_this._mouseIsOver = false;
_this._shouldRender = true;
_this._revealOnScroll = true;
return _this;
}
AbstractScrollableElement.prototype.dispose = function () {
this._mouseWheelToDispose = Object(lifecycle["f" /* dispose */])(this._mouseWheelToDispose);
_super.prototype.dispose.call(this);
};
/**
* Get the generated 'scrollable' dom node
*/
AbstractScrollableElement.prototype.getDomNode = function () {
return this._domNode;
};
AbstractScrollableElement.prototype.getOverviewRulerLayoutInfo = function () {
return {
parent: this._domNode,
insertBefore: this._verticalScrollbar.domNode.domNode,
};
};
/**
* Delegate a mouse down event to the vertical scrollbar.
* This is to help with clicking somewhere else and having the scrollbar react.
*/
AbstractScrollableElement.prototype.delegateVerticalScrollbarMouseDown = function (browserEvent) {
this._verticalScrollbar.delegateMouseDown(browserEvent);
};
AbstractScrollableElement.prototype.getScrollDimensions = function () {
return this._scrollable.getScrollDimensions();
};
AbstractScrollableElement.prototype.setScrollDimensions = function (dimensions) {
this._scrollable.setScrollDimensions(dimensions);
};
/**
* Update the class name of the scrollable element.
*/
AbstractScrollableElement.prototype.updateClassName = function (newClassName) {
this._options.className = newClassName;
// Defaults are different on Macs
if (platform["e" /* isMacintosh */]) {
this._options.className += ' mac';
}
this._domNode.className = 'monaco-scrollable-element ' + this._options.className;
};
/**
* Update configuration options for the scrollbar.
* Really this is Editor.IEditorScrollbarOptions, but base shouldn't
* depend on Editor.
*/
AbstractScrollableElement.prototype.updateOptions = function (newOptions) {
var massagedOptions = resolveOptions(newOptions);
this._options.handleMouseWheel = massagedOptions.handleMouseWheel;
this._options.mouseWheelScrollSensitivity = massagedOptions.mouseWheelScrollSensitivity;
this._options.fastScrollSensitivity = massagedOptions.fastScrollSensitivity;
this._setListeningToMouseWheel(this._options.handleMouseWheel);
if (!this._options.lazyRender) {
this._render();
}
};
// -------------------- mouse wheel scrolling --------------------
AbstractScrollableElement.prototype._setListeningToMouseWheel = function (shouldListen) {
var _this = this;
var isListening = (this._mouseWheelToDispose.length > 0);
if (isListening === shouldListen) {
// No change
return;
}
// Stop listening (if necessary)
this._mouseWheelToDispose = Object(lifecycle["f" /* dispose */])(this._mouseWheelToDispose);
// Start listening (if necessary)
if (shouldListen) {
var onMouseWheel = function (browserEvent) {
_this._onMouseWheel(new mouseEvent["c" /* StandardWheelEvent */](browserEvent));
};
this._mouseWheelToDispose.push(dom["j" /* addDisposableListener */](this._listenOnDomNode, browser["f" /* isEdgeOrIE */] ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false }));
}
};
AbstractScrollableElement.prototype._onMouseWheel = function (e) {
var _a;
var classifier = MouseWheelClassifier.INSTANCE;
if (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED) {
classifier.accept(Date.now(), e.deltaX, e.deltaY);
}
// console.log(`${Date.now()}, ${e.deltaY}, ${e.deltaX}`);
if (e.deltaY || e.deltaX) {
var deltaY = e.deltaY * this._options.mouseWheelScrollSensitivity;
var deltaX = e.deltaX * this._options.mouseWheelScrollSensitivity;
if (this._options.flipAxes) {
_a = [deltaX, deltaY], deltaY = _a[0], deltaX = _a[1];
}
// Convert vertical scrolling to horizontal if shift is held, this
// is handled at a higher level on Mac
var shiftConvert = !platform["e" /* isMacintosh */] && e.browserEvent && e.browserEvent.shiftKey;
if ((this._options.scrollYToX || shiftConvert) && !deltaX) {
deltaX = deltaY;
deltaY = 0;
}
if (e.browserEvent && e.browserEvent.altKey) {
// fastScrolling
deltaX = deltaX * this._options.fastScrollSensitivity;
deltaY = deltaY * this._options.fastScrollSensitivity;
}
var futureScrollPosition = this._scrollable.getFutureScrollPosition();
var desiredScrollPosition = {};
if (deltaY) {
var desiredScrollTop = futureScrollPosition.scrollTop - SCROLL_WHEEL_SENSITIVITY * deltaY;
this._verticalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollTop);
}
if (deltaX) {
var desiredScrollLeft = futureScrollPosition.scrollLeft - SCROLL_WHEEL_SENSITIVITY * deltaX;
this._horizontalScrollbar.writeScrollPosition(desiredScrollPosition, desiredScrollLeft);
}
// Check that we are scrolling towards a location which is valid
desiredScrollPosition = this._scrollable.validateScrollPosition(desiredScrollPosition);
if (futureScrollPosition.scrollLeft !== desiredScrollPosition.scrollLeft || futureScrollPosition.scrollTop !== desiredScrollPosition.scrollTop) {
var canPerformSmoothScroll = (SCROLL_WHEEL_SMOOTH_SCROLL_ENABLED
&& this._options.mouseWheelSmoothScroll
&& classifier.isPhysicalMouseWheel());
if (canPerformSmoothScroll) {
this._scrollable.setScrollPositionSmooth(desiredScrollPosition);
}
else {
this._scrollable.setScrollPositionNow(desiredScrollPosition);
}
this._shouldRender = true;
}
}
if (this._options.alwaysConsumeMouseWheel || this._shouldRender) {
e.preventDefault();
e.stopPropagation();
}
};
AbstractScrollableElement.prototype._onDidScroll = function (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`.
*/
AbstractScrollableElement.prototype.renderNow = function () {
if (!this._options.lazyRender) {
throw new Error('Please use `lazyRender` together with `renderNow`!');
}
this._render();
};
AbstractScrollableElement.prototype._render = function () {
if (!this._shouldRender) {
return;
}
this._shouldRender = false;
this._horizontalScrollbar.render();
this._verticalScrollbar.render();
if (this._options.useShadows) {
var scrollState = this._scrollable.getCurrentScrollPosition();
var enableTop = scrollState.scrollTop > 0;
var enableLeft = scrollState.scrollLeft > 0;
this._leftShadowDomNode.setClassName('shadow' + (enableLeft ? ' left' : ''));
this._topShadowDomNode.setClassName('shadow' + (enableTop ? ' top' : ''));
this._topLeftShadowDomNode.setClassName('shadow top-left-corner' + (enableTop ? ' top' : '') + (enableLeft ? ' left' : ''));
}
};
// -------------------- fade in / fade out --------------------
AbstractScrollableElement.prototype._onDragStart = function () {
this._isDragging = true;
this._reveal();
};
AbstractScrollableElement.prototype._onDragEnd = function () {
this._isDragging = false;
this._hide();
};
AbstractScrollableElement.prototype._onMouseOut = function (e) {
this._mouseIsOver = false;
this._hide();
};
AbstractScrollableElement.prototype._onMouseOver = function (e) {
this._mouseIsOver = true;
this._reveal();
};
AbstractScrollableElement.prototype._reveal = function () {
this._verticalScrollbar.beginReveal();
this._horizontalScrollbar.beginReveal();
this._scheduleHide();
};
AbstractScrollableElement.prototype._hide = function () {
if (!this._mouseIsOver && !this._isDragging) {
this._verticalScrollbar.beginHide();
this._horizontalScrollbar.beginHide();
}
};
AbstractScrollableElement.prototype._scheduleHide = function () {
var _this = this;
if (!this._mouseIsOver && !this._isDragging) {
this._hideTimeout.cancelAndSet(function () { return _this._hide(); }, HIDE_TIMEOUT);
}
};
return AbstractScrollableElement;
}(widget["a" /* Widget */]));
var scrollableElement_ScrollableElement = /** @class */ (function (_super) {
scrollableElement_extends(ScrollableElement, _super);
function ScrollableElement(element, options) {
var _this = this;
options = options || {};
options.mouseWheelSmoothScroll = false;
var scrollable = new common_scrollable["a" /* Scrollable */](0, function (callback) { return dom["W" /* scheduleAtNextAnimationFrame */](callback); });
_this = _super.call(this, element, options, scrollable) || this;
_this._register(scrollable);
return _this;
}
ScrollableElement.prototype.setScrollPosition = function (update) {
this._scrollable.setScrollPositionNow(update);
};
ScrollableElement.prototype.getScrollPosition = function () {
return this._scrollable.getCurrentScrollPosition();
};
return ScrollableElement;
}(scrollableElement_AbstractScrollableElement));
var SmoothScrollableElement = /** @class */ (function (_super) {
scrollableElement_extends(SmoothScrollableElement, _super);
function SmoothScrollableElement(element, options, scrollable) {
return _super.call(this, element, options, scrollable) || this;
}
return SmoothScrollableElement;
}(scrollableElement_AbstractScrollableElement));
var DomScrollableElement = /** @class */ (function (_super) {
scrollableElement_extends(DomScrollableElement, _super);
function DomScrollableElement(element, options) {
var _this = _super.call(this, element, options) || this;
_this._element = element;
_this.onScroll(function (e) {
if (e.scrollTopChanged) {
_this._element.scrollTop = e.scrollTop;
}
if (e.scrollLeftChanged) {
_this._element.scrollLeft = e.scrollLeft;
}
});
_this.scanDomNode();
return _this;
}
DomScrollableElement.prototype.scanDomNode = function () {
// width, scrollLeft, scrollWidth, height, scrollTop, scrollHeight
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,
});
};
return DomScrollableElement;
}(scrollableElement_ScrollableElement));
function resolveOptions(opts) {
var 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),
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),
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 /* Auto */),
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 /* Auto */),
verticalScrollbarSize: (typeof opts.verticalScrollbarSize !== 'undefined' ? opts.verticalScrollbarSize : 10),
verticalHasArrows: (typeof opts.verticalHasArrows !== 'undefined' ? opts.verticalHasArrows : false),
verticalSliderSize: (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : 0)
};
result.horizontalSliderSize = (typeof opts.horizontalSliderSize !== 'undefined' ? opts.horizontalSliderSize : result.horizontalScrollbarSize);
result.verticalSliderSize = (typeof opts.verticalSliderSize !== 'undefined' ? opts.verticalSliderSize : result.verticalScrollbarSize);
// Defaults are different on Macs
if (platform["e" /* isMacintosh */]) {
result.className += ' mac';
}
return result;
}
/***/ }),
/* 82 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ID_EDITOR_WORKER_SERVICE */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IEditorWorkerService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ID_EDITOR_WORKER_SERVICE = 'editorWorkerService';
var IEditorWorkerService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])(ID_EDITOR_WORKER_SERVICE);
/***/ }),
/* 83 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ editorState_EditorState; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ editorState_EditorStateCancellationTokenSource; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ TextModelCancellationTokenSource; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ StableEditorScrollState; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/cancellation.js
var cancellation = __webpack_require__(31);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js
var editorExtensions = __webpack_require__(7);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
var contextkey = __webpack_require__(13);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/linkedList.js
var linkedList = __webpack_require__(98);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js
var instantiation = __webpack_require__(22);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js
var extensions = __webpack_require__(119);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/core/keybindingCancellation.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var IEditorCancellationTokens = Object(instantiation["c" /* createDecorator */])('IEditorCancelService');
var ctxCancellableOperation = new contextkey["d" /* RawContextKey */]('cancellableOperation', false);
Object(extensions["b" /* registerSingleton */])(IEditorCancellationTokens, /** @class */ (function () {
function class_1() {
this._tokens = new WeakMap();
}
class_1.prototype.add = function (editor, cts) {
var data = this._tokens.get(editor);
if (!data) {
data = editor.invokeWithinContext(function (accessor) {
var key = ctxCancellableOperation.bindTo(accessor.get(contextkey["c" /* IContextKeyService */]));
var tokens = new linkedList["a" /* LinkedList */]();
return { key: key, tokens: tokens };
});
this._tokens.set(editor, data);
}
var removeFn;
data.key.set(true);
removeFn = data.tokens.push(cts);
return function () {
// remove w/o cancellation
if (removeFn) {
removeFn();
data.key.set(!data.tokens.isEmpty());
removeFn = undefined;
}
};
};
class_1.prototype.cancel = function (editor) {
var data = this._tokens.get(editor);
if (!data) {
return;
}
// remove with cancellation
var cts = data.tokens.pop();
if (cts) {
cts.cancel();
data.key.set(!data.tokens.isEmpty());
}
};
return class_1;
}()), true);
var EditorKeybindingCancellationTokenSource = /** @class */ (function (_super) {
__extends(EditorKeybindingCancellationTokenSource, _super);
function EditorKeybindingCancellationTokenSource(editor, parent) {
var _this = _super.call(this, parent) || this;
_this.editor = editor;
_this._unregister = editor.invokeWithinContext(function (accessor) { return accessor.get(IEditorCancellationTokens).add(editor, _this); });
return _this;
}
EditorKeybindingCancellationTokenSource.prototype.dispose = function () {
this._unregister();
_super.prototype.dispose.call(this);
};
return EditorKeybindingCancellationTokenSource;
}(cancellation["b" /* CancellationTokenSource */]));
Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_2, _super);
function class_2() {
return _super.call(this, {
id: 'editor.cancelOperation',
kbOpts: {
weight: 100 /* EditorContrib */,
primary: 9 /* Escape */
},
precondition: ctxCancellableOperation
}) || this;
}
class_2.prototype.runEditorCommand = function (accessor, editor) {
accessor.get(IEditorCancellationTokens).cancel(editor);
};
return class_2;
}(editorExtensions["c" /* EditorCommand */])));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/core/editorState.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var editorState_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var editorState_EditorState = /** @class */ (function () {
function EditorState(editor, flags) {
this.flags = flags;
if ((this.flags & 1 /* Value */) !== 0) {
var model = editor.getModel();
this.modelVersionId = model ? strings["r" /* format */]('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;
}
else {
this.modelVersionId = null;
}
if ((this.flags & 4 /* Position */) !== 0) {
this.position = editor.getPosition();
}
else {
this.position = null;
}
if ((this.flags & 2 /* Selection */) !== 0) {
this.selection = editor.getSelection();
}
else {
this.selection = null;
}
if ((this.flags & 8 /* Scroll */) !== 0) {
this.scrollLeft = editor.getScrollLeft();
this.scrollTop = editor.getScrollTop();
}
else {
this.scrollLeft = -1;
this.scrollTop = -1;
}
}
EditorState.prototype._equals = function (other) {
if (!(other instanceof EditorState)) {
return false;
}
var 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;
};
EditorState.prototype.validate = function (editor) {
return this._equals(new EditorState(editor, this.flags));
};
return EditorState;
}());
/**
* A cancellation token source that cancels when the editor changes as expressed
* by the provided flags
*/
var editorState_EditorStateCancellationTokenSource = /** @class */ (function (_super) {
editorState_extends(EditorStateCancellationTokenSource, _super);
function EditorStateCancellationTokenSource(editor, flags, parent) {
var _this = _super.call(this, editor, parent) || this;
_this.editor = editor;
_this._listener = new lifecycle["b" /* DisposableStore */]();
if (flags & 4 /* Position */) {
_this._listener.add(editor.onDidChangeCursorPosition(function (_) { return _this.cancel(); }));
}
if (flags & 2 /* Selection */) {
_this._listener.add(editor.onDidChangeCursorSelection(function (_) { return _this.cancel(); }));
}
if (flags & 8 /* Scroll */) {
_this._listener.add(editor.onDidScrollChange(function (_) { return _this.cancel(); }));
}
if (flags & 1 /* Value */) {
_this._listener.add(editor.onDidChangeModel(function (_) { return _this.cancel(); }));
_this._listener.add(editor.onDidChangeModelContent(function (_) { return _this.cancel(); }));
}
return _this;
}
EditorStateCancellationTokenSource.prototype.dispose = function () {
this._listener.dispose();
_super.prototype.dispose.call(this);
};
return EditorStateCancellationTokenSource;
}(EditorKeybindingCancellationTokenSource));
/**
* A cancellation token source that cancels when the provided model changes
*/
var TextModelCancellationTokenSource = /** @class */ (function (_super) {
editorState_extends(TextModelCancellationTokenSource, _super);
function TextModelCancellationTokenSource(model, parent) {
var _this = _super.call(this, parent) || this;
_this._listener = model.onDidChangeContent(function () { return _this.cancel(); });
return _this;
}
TextModelCancellationTokenSource.prototype.dispose = function () {
this._listener.dispose();
_super.prototype.dispose.call(this);
};
return TextModelCancellationTokenSource;
}(cancellation["b" /* CancellationTokenSource */]));
var StableEditorScrollState = /** @class */ (function () {
function StableEditorScrollState(_visiblePosition, _visiblePositionScrollDelta) {
this._visiblePosition = _visiblePosition;
this._visiblePositionScrollDelta = _visiblePositionScrollDelta;
}
StableEditorScrollState.capture = function (editor) {
var visiblePosition = null;
var visiblePositionScrollDelta = 0;
if (editor.getScrollTop() !== 0) {
var visibleRanges = editor.getVisibleRanges();
if (visibleRanges.length > 0) {
visiblePosition = visibleRanges[0].getStartPosition();
var visiblePositionScrollTop = editor.getTopForPosition(visiblePosition.lineNumber, visiblePosition.column);
visiblePositionScrollDelta = editor.getScrollTop() - visiblePositionScrollTop;
}
}
return new StableEditorScrollState(visiblePosition, visiblePositionScrollDelta);
};
StableEditorScrollState.prototype.restore = function (editor) {
if (this._visiblePosition) {
var visiblePositionScrollTop = editor.getTopForPosition(this._visiblePosition.lineNumber, this._visiblePosition.column);
editor.setScrollTop(visiblePositionScrollTop + this._visiblePositionScrollDelta);
}
};
return StableEditorScrollState;
}());
/***/ }),
/* 84 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return BaseActionViewItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return Separator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ActionViewItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActionBar; });
/* harmony import */ var _actionbar_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(642);
/* harmony import */ var _actionbar_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_actionbar_css__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
/* harmony import */ var _common_actions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69);
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
/* harmony import */ var _common_types_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21);
/* harmony import */ var _touch_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54);
/* harmony import */ var _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(53);
/* harmony import */ var _common_event_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(9);
/* harmony import */ var _dnd_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(79);
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(25);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var BaseActionViewItem = /** @class */ (function (_super) {
__extends(BaseActionViewItem, _super);
function BaseActionViewItem(context, action, options) {
var _this = _super.call(this) || this;
_this.options = options;
_this._context = context || _this;
_this._action = action;
if (action instanceof _common_actions_js__WEBPACK_IMPORTED_MODULE_4__[/* Action */ "a"]) {
_this._register(action.onDidChange(function (event) {
if (!_this.element) {
// we have not been rendered yet, so there
// is no point in updating the UI
return;
}
_this.handleActionChangeEvent(event);
}));
}
return _this;
}
BaseActionViewItem.prototype.handleActionChangeEvent = function (event) {
if (event.enabled !== undefined) {
this.updateEnabled();
}
if (event.checked !== undefined) {
this.updateChecked();
}
if (event.class !== undefined) {
this.updateClass();
}
if (event.label !== undefined) {
this.updateLabel();
this.updateTooltip();
}
if (event.tooltip !== undefined) {
this.updateTooltip();
}
};
Object.defineProperty(BaseActionViewItem.prototype, "actionRunner", {
get: function () {
if (!this._actionRunner) {
this._actionRunner = this._register(new _common_actions_js__WEBPACK_IMPORTED_MODULE_4__[/* ActionRunner */ "b"]());
}
return this._actionRunner;
},
set: function (actionRunner) {
this._actionRunner = actionRunner;
},
enumerable: true,
configurable: true
});
BaseActionViewItem.prototype.getAction = function () {
return this._action;
};
BaseActionViewItem.prototype.isEnabled = function () {
return this._action.enabled;
};
BaseActionViewItem.prototype.setActionContext = function (newContext) {
this._context = newContext;
};
BaseActionViewItem.prototype.render = function (container) {
var _this = this;
var element = this.element = container;
this._register(_touch_js__WEBPACK_IMPORTED_MODULE_7__[/* Gesture */ "b"].addTarget(container));
var enableDragging = this.options && this.options.draggable;
if (enableDragging) {
container.draggable = true;
if (_browser_js__WEBPACK_IMPORTED_MODULE_11__[/* isFirefox */ "h"]) {
// Firefox: requires to set a text data transfer to get going
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](container, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].DRAG_START, function (e) { var _a; return (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData(_dnd_js__WEBPACK_IMPORTED_MODULE_10__[/* DataTransfers */ "a"].TEXT, _this._action.label); }));
}
}
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](element, _touch_js__WEBPACK_IMPORTED_MODULE_7__[/* EventType */ "a"].Tap, function (e) { return _this.onClick(e); }));
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](element, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].MOUSE_DOWN, function (e) {
if (!enableDragging) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventHelper */ "c"].stop(e, true); // do not run when dragging is on because that would disable it
}
if (_this._action.enabled && e.button === 0) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](element, 'active');
}
}));
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](element, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].CLICK, function (e) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventHelper */ "c"].stop(e, true);
// See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Interact_with_the_clipboard
// > Writing to the clipboard
// > You can use the "cut" and "copy" commands without any special
// permission if you are using them in a short-lived event handler
// for a user action (for example, a click handler).
// => to get the Copy and Paste context menu actions working on Firefox,
// there should be no timeout here
if (_this.options && _this.options.isMenu) {
_this.onClick(e);
}
else {
_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* setImmediate */ "i"](function () { return _this.onClick(e); });
}
}));
this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](element, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].DBLCLICK, function (e) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventHelper */ "c"].stop(e, true);
}));
[_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].MOUSE_UP, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].MOUSE_OUT].forEach(function (event) {
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](element, event, function (e) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventHelper */ "c"].stop(e);
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](element, 'active');
}));
});
};
BaseActionViewItem.prototype.onClick = function (event) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventHelper */ "c"].stop(event, true);
var context;
if (_common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isUndefinedOrNull */ "l"](this._context)) {
context = event;
}
else {
context = this._context;
if (_common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isObject */ "i"](context)) {
context.event = event;
}
}
this.actionRunner.run(this._action, context);
};
BaseActionViewItem.prototype.focus = function () {
if (this.element) {
this.element.focus();
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](this.element, 'focused');
}
};
BaseActionViewItem.prototype.blur = function () {
if (this.element) {
this.element.blur();
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](this.element, 'focused');
}
};
BaseActionViewItem.prototype.updateEnabled = function () {
// implement in subclass
};
BaseActionViewItem.prototype.updateLabel = function () {
// implement in subclass
};
BaseActionViewItem.prototype.updateTooltip = function () {
// implement in subclass
};
BaseActionViewItem.prototype.updateClass = function () {
// implement in subclass
};
BaseActionViewItem.prototype.updateChecked = function () {
// implement in subclass
};
BaseActionViewItem.prototype.dispose = function () {
if (this.element) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeNode */ "R"](this.element);
this.element = undefined;
}
_super.prototype.dispose.call(this);
};
return BaseActionViewItem;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__[/* Disposable */ "a"]));
var Separator = /** @class */ (function (_super) {
__extends(Separator, _super);
function Separator(label) {
var _this = _super.call(this, Separator.ID, label, label ? 'separator text' : 'separator') || this;
_this.checked = false;
_this.enabled = false;
return _this;
}
Separator.ID = 'vs.actions.separator';
return Separator;
}(_common_actions_js__WEBPACK_IMPORTED_MODULE_4__[/* Action */ "a"]));
var ActionViewItem = /** @class */ (function (_super) {
__extends(ActionViewItem, _super);
function ActionViewItem(context, action, options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this, context, action, options) || this;
_this.options = options;
_this.options.icon = options.icon !== undefined ? options.icon : false;
_this.options.label = options.label !== undefined ? options.label : true;
_this.cssClass = '';
return _this;
}
ActionViewItem.prototype.render = function (container) {
_super.prototype.render.call(this, container);
if (this.element) {
this.label = _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* append */ "q"](this.element, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* $ */ "a"]('a.action-label'));
}
if (this.label) {
if (this._action.id === Separator.ID) {
this.label.setAttribute('role', 'presentation'); // A separator is a presentation item
}
else {
if (this.options.isMenu) {
this.label.setAttribute('role', 'menuitem');
}
else {
this.label.setAttribute('role', 'button');
}
}
}
if (this.options.label && this.options.keybinding && this.element) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* append */ "q"](this.element, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* $ */ "a"]('span.keybinding')).textContent = this.options.keybinding;
}
this.updateClass();
this.updateLabel();
this.updateTooltip();
this.updateEnabled();
this.updateChecked();
};
ActionViewItem.prototype.focus = function () {
_super.prototype.focus.call(this);
if (this.label) {
this.label.focus();
}
};
ActionViewItem.prototype.updateLabel = function () {
if (this.options.label && this.label) {
this.label.textContent = this.getAction().label;
}
};
ActionViewItem.prototype.updateTooltip = function () {
var title = null;
if (this.getAction().tooltip) {
title = this.getAction().tooltip;
}
else if (!this.options.label && this.getAction().label && this.options.icon) {
title = this.getAction().label;
if (this.options.keybinding) {
title = _nls_js__WEBPACK_IMPORTED_MODULE_2__[/* localize */ "a"]({ key: 'titleLabel', comment: ['action title', 'action keybinding'] }, "{0} ({1})", title, this.options.keybinding);
}
}
if (title && this.label) {
this.label.title = title;
}
};
ActionViewItem.prototype.updateClass = function () {
if (this.cssClass && this.label) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClasses */ "Q"](this.label, this.cssClass);
}
if (this.options.icon) {
this.cssClass = this.getAction().class;
if (this.label) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](this.label, 'codicon');
if (this.cssClass) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClasses */ "g"](this.label, this.cssClass);
}
}
this.updateEnabled();
}
else {
if (this.label) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](this.label, 'codicon');
}
}
};
ActionViewItem.prototype.updateEnabled = function () {
if (this.getAction().enabled) {
if (this.label) {
this.label.removeAttribute('aria-disabled');
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](this.label, 'disabled');
this.label.tabIndex = 0;
}
if (this.element) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](this.element, 'disabled');
}
}
else {
if (this.label) {
this.label.setAttribute('aria-disabled', 'true');
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](this.label, 'disabled');
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeTabIndexAndUpdateFocus */ "S"](this.label);
}
if (this.element) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](this.element, 'disabled');
}
}
};
ActionViewItem.prototype.updateChecked = function () {
if (this.label) {
if (this.getAction().checked) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](this.label, 'checked');
}
else {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeClass */ "P"](this.label, 'checked');
}
}
};
return ActionViewItem;
}(BaseActionViewItem));
var defaultOptions = {
orientation: 0 /* HORIZONTAL */,
context: null,
triggerKeys: {
keys: [3 /* Enter */, 10 /* Space */],
keyDown: false
}
};
var ActionBar = /** @class */ (function (_super) {
__extends(ActionBar, _super);
function ActionBar(container, options) {
if (options === void 0) { options = defaultOptions; }
var _this = _super.call(this) || this;
_this._onDidBlur = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_9__[/* Emitter */ "a"]());
_this.onDidBlur = _this._onDidBlur.event;
_this._onDidCancel = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_9__[/* Emitter */ "a"]());
_this.onDidCancel = _this._onDidCancel.event;
_this._onDidRun = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_9__[/* Emitter */ "a"]());
_this.onDidRun = _this._onDidRun.event;
_this._onDidBeforeRun = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_9__[/* Emitter */ "a"]());
_this.onDidBeforeRun = _this._onDidBeforeRun.event;
_this.options = options;
_this._context = options.context;
if (!_this.options.triggerKeys) {
_this.options.triggerKeys = defaultOptions.triggerKeys;
}
if (_this.options.actionRunner) {
_this._actionRunner = _this.options.actionRunner;
}
else {
_this._actionRunner = new _common_actions_js__WEBPACK_IMPORTED_MODULE_4__[/* ActionRunner */ "b"]();
_this._register(_this._actionRunner);
}
_this._register(_this._actionRunner.onDidRun(function (e) { return _this._onDidRun.fire(e); }));
_this._register(_this._actionRunner.onDidBeforeRun(function (e) { return _this._onDidBeforeRun.fire(e); }));
_this.viewItems = [];
_this.focusedItem = undefined;
_this.domNode = document.createElement('div');
_this.domNode.className = 'monaco-action-bar';
if (options.animated !== false) {
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addClass */ "f"](_this.domNode, 'animated');
}
var previousKey;
var nextKey;
switch (_this.options.orientation) {
case 0 /* HORIZONTAL */:
previousKey = 15 /* LeftArrow */;
nextKey = 17 /* RightArrow */;
break;
case 1 /* HORIZONTAL_REVERSE */:
previousKey = 17 /* RightArrow */;
nextKey = 15 /* LeftArrow */;
_this.domNode.className += ' reverse';
break;
case 2 /* VERTICAL */:
previousKey = 16 /* UpArrow */;
nextKey = 18 /* DownArrow */;
_this.domNode.className += ' vertical';
break;
case 3 /* VERTICAL_REVERSE */:
previousKey = 18 /* DownArrow */;
nextKey = 16 /* UpArrow */;
_this.domNode.className += ' vertical reverse';
break;
}
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](_this.domNode, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].KEY_DOWN, function (e) {
var event = new _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_8__[/* StandardKeyboardEvent */ "a"](e);
var eventHandled = true;
if (event.equals(previousKey)) {
_this.focusPrevious();
}
else if (event.equals(nextKey)) {
_this.focusNext();
}
else if (event.equals(9 /* Escape */)) {
_this.cancel();
}
else if (_this.isTriggerKeyEvent(event)) {
// Staying out of the else branch even if not triggered
if (_this.options.triggerKeys && _this.options.triggerKeys.keyDown) {
_this.doTrigger(event);
}
}
else {
eventHandled = false;
}
if (eventHandled) {
event.preventDefault();
event.stopPropagation();
}
}));
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](_this.domNode, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].KEY_UP, function (e) {
var event = new _keyboardEvent_js__WEBPACK_IMPORTED_MODULE_8__[/* StandardKeyboardEvent */ "a"](e);
// Run action on Enter/Space
if (_this.isTriggerKeyEvent(event)) {
if (_this.options.triggerKeys && !_this.options.triggerKeys.keyDown) {
_this.doTrigger(event);
}
event.preventDefault();
event.stopPropagation();
}
// Recompute focused item
else if (event.equals(2 /* Tab */) || event.equals(1024 /* Shift */ | 2 /* Tab */)) {
_this.updateFocusedItem();
}
}));
_this.focusTracker = _this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* trackFocus */ "Z"](_this.domNode));
_this._register(_this.focusTracker.onDidBlur(function () {
if (document.activeElement === _this.domNode || !_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* isAncestor */ "K"](document.activeElement, _this.domNode)) {
_this._onDidBlur.fire();
_this.focusedItem = undefined;
}
}));
_this._register(_this.focusTracker.onDidFocus(function () { return _this.updateFocusedItem(); }));
_this.actionsList = document.createElement('ul');
_this.actionsList.className = 'actions-container';
_this.actionsList.setAttribute('role', 'toolbar');
if (_this.options.ariaLabel) {
_this.actionsList.setAttribute('aria-label', _this.options.ariaLabel);
}
_this.domNode.appendChild(_this.actionsList);
container.appendChild(_this.domNode);
return _this;
}
ActionBar.prototype.isTriggerKeyEvent = function (event) {
var ret = false;
if (this.options.triggerKeys) {
this.options.triggerKeys.keys.forEach(function (keyCode) {
ret = ret || event.equals(keyCode);
});
}
return ret;
};
ActionBar.prototype.updateFocusedItem = function () {
for (var i = 0; i < this.actionsList.children.length; i++) {
var elem = this.actionsList.children[i];
if (_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* isAncestor */ "K"](document.activeElement, elem)) {
this.focusedItem = i;
break;
}
}
};
Object.defineProperty(ActionBar.prototype, "context", {
get: function () {
return this._context;
},
set: function (context) {
this._context = context;
this.viewItems.forEach(function (i) { return i.setActionContext(context); });
},
enumerable: true,
configurable: true
});
ActionBar.prototype.getContainer = function () {
return this.domNode;
};
ActionBar.prototype.push = function (arg, options) {
var _this = this;
if (options === void 0) { options = {}; }
var actions = Array.isArray(arg) ? arg : [arg];
var index = _common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isNumber */ "h"](options.index) ? options.index : null;
actions.forEach(function (action) {
var actionViewItemElement = document.createElement('li');
actionViewItemElement.className = 'action-item';
actionViewItemElement.setAttribute('role', 'presentation');
// Prevent native context menu on actions
_this._register(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* addDisposableListener */ "j"](actionViewItemElement, _dom_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "d"].CONTEXT_MENU, function (e) {
e.preventDefault();
e.stopPropagation();
}));
var item;
if (_this.options.actionViewItemProvider) {
item = _this.options.actionViewItemProvider(action);
}
if (!item) {
item = new ActionViewItem(_this.context, action, options);
}
item.actionRunner = _this._actionRunner;
item.setActionContext(_this.context);
item.render(actionViewItemElement);
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++;
}
});
};
ActionBar.prototype.clear = function () {
this.viewItems = Object(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__[/* dispose */ "f"])(this.viewItems);
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* clearNode */ "t"](this.actionsList);
};
ActionBar.prototype.isEmpty = function () {
return this.viewItems.length === 0;
};
ActionBar.prototype.focus = function (arg) {
var selectFirst = false;
var index = undefined;
if (arg === undefined) {
selectFirst = true;
}
else if (typeof arg === 'number') {
index = arg;
}
else if (typeof arg === 'boolean') {
selectFirst = arg;
}
if (selectFirst && typeof this.focusedItem === 'undefined') {
// Focus the first enabled item
this.focusedItem = this.viewItems.length - 1;
this.focusNext();
}
else {
if (index !== undefined) {
this.focusedItem = index;
}
this.updateFocus();
}
};
ActionBar.prototype.focusNext = function () {
if (typeof this.focusedItem === 'undefined') {
this.focusedItem = this.viewItems.length - 1;
}
var startIndex = this.focusedItem;
var item;
do {
this.focusedItem = (this.focusedItem + 1) % this.viewItems.length;
item = this.viewItems[this.focusedItem];
} while (this.focusedItem !== startIndex && !item.isEnabled());
if (this.focusedItem === startIndex && !item.isEnabled()) {
this.focusedItem = undefined;
}
this.updateFocus();
};
ActionBar.prototype.focusPrevious = function () {
if (typeof this.focusedItem === 'undefined') {
this.focusedItem = 0;
}
var startIndex = this.focusedItem;
var item;
do {
this.focusedItem = this.focusedItem - 1;
if (this.focusedItem < 0) {
this.focusedItem = this.viewItems.length - 1;
}
item = this.viewItems[this.focusedItem];
} while (this.focusedItem !== startIndex && !item.isEnabled());
if (this.focusedItem === startIndex && !item.isEnabled()) {
this.focusedItem = undefined;
}
this.updateFocus(true);
};
ActionBar.prototype.updateFocus = function (fromRight, preventScroll) {
if (typeof this.focusedItem === 'undefined') {
this.actionsList.focus({ preventScroll: preventScroll });
}
for (var i = 0; i < this.viewItems.length; i++) {
var item = this.viewItems[i];
var actionViewItem = item;
if (i === this.focusedItem) {
if (_common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isFunction */ "g"](actionViewItem.isEnabled)) {
if (actionViewItem.isEnabled() && _common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isFunction */ "g"](actionViewItem.focus)) {
actionViewItem.focus(fromRight);
}
else {
this.actionsList.focus({ preventScroll: preventScroll });
}
}
}
else {
if (_common_types_js__WEBPACK_IMPORTED_MODULE_6__[/* isFunction */ "g"](actionViewItem.blur)) {
actionViewItem.blur();
}
}
}
};
ActionBar.prototype.doTrigger = function (event) {
if (typeof this.focusedItem === 'undefined') {
return; //nothing to focus
}
// trigger action
var actionViewItem = this.viewItems[this.focusedItem];
if (actionViewItem instanceof BaseActionViewItem) {
var context = (actionViewItem._context === null || actionViewItem._context === undefined) ? event : actionViewItem._context;
this.run(actionViewItem._action, context);
}
};
ActionBar.prototype.cancel = function () {
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur(); // remove focus from focused action
}
this._onDidCancel.fire();
};
ActionBar.prototype.run = function (action, context) {
return this._actionRunner.run(action, context);
};
ActionBar.prototype.dispose = function () {
Object(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__[/* dispose */ "f"])(this.viewItems);
this.viewItems = [];
_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeNode */ "R"](this.getContainer());
_super.prototype.dispose.call(this);
};
return ActionBar;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_3__[/* Disposable */ "a"]));
/***/ }),
/* 85 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _interopRequireWildcard; });
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function _getRequireWildcardCache() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
return {
"default": obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj["default"] = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/***/ }),
/* 86 */
/***/ (function(module, exports, __webpack_require__) {
var fs = __webpack_require__(157)
var polyfills = __webpack_require__(480)
var legacy = __webpack_require__(482)
var clone = __webpack_require__(483)
var util = __webpack_require__(484)
/* istanbul ignore next - node 0.x polyfill */
var gracefulQueue
var previousSymbol
/* istanbul ignore else - node 0.x polyfill */
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
gracefulQueue = Symbol.for('graceful-fs.queue')
// This is used in testing by future versions
previousSymbol = Symbol.for('graceful-fs.previous')
} else {
gracefulQueue = '___graceful-fs.queue'
previousSymbol = '___graceful-fs.previous'
}
function noop () {}
var debug = noop
if (util.debuglog)
debug = util.debuglog('gfs4')
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
debug = function() {
var m = util.format.apply(util, arguments)
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
console.error(m)
}
// Once time initialization
if (!global[gracefulQueue]) {
// This queue can be shared by multiple loaded instances
var queue = []
Object.defineProperty(global, gracefulQueue, {
get: function() {
return queue
}
})
// Patch fs.close/closeSync to shared queue version, because we need
// to retry() whenever a close happens *anywhere* in the program.
// This is essential when multiple graceful-fs instances are
// in play at the same time.
fs.close = (function (fs$close) {
function close (fd, cb) {
return fs$close.call(fs, fd, function (err) {
// This function uses the graceful-fs shared queue
if (!err) {
retry()
}
if (typeof cb === 'function')
cb.apply(this, arguments)
})
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
})
return close
})(fs.close)
fs.closeSync = (function (fs$closeSync) {
function closeSync (fd) {
// This function uses the graceful-fs shared queue
fs$closeSync.apply(fs, arguments)
retry()
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
})
return closeSync
})(fs.closeSync)
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
process.on('exit', function() {
debug(global[gracefulQueue])
__webpack_require__(311).equal(global[gracefulQueue].length, 0)
})
}
}
module.exports = patch(clone(fs))
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
module.exports = patch(fs)
fs.__patched = true;
}
function patch (fs) {
// Everything that references the open() function needs to be in here
polyfills(fs)
fs.gracefulify = patch
fs.createReadStream = createReadStream
fs.createWriteStream = createWriteStream
var fs$readFile = fs.readFile
fs.readFile = readFile
function readFile (path, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$readFile(path, options, cb)
function go$readFile (path, options, cb) {
return fs$readFile(path, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readFile, [path, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$writeFile = fs.writeFile
fs.writeFile = writeFile
function writeFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$writeFile(path, data, options, cb)
function go$writeFile (path, data, options, cb) {
return fs$writeFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$writeFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$appendFile = fs.appendFile
if (fs$appendFile)
fs.appendFile = appendFile
function appendFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$appendFile(path, data, options, cb)
function go$appendFile (path, data, options, cb) {
return fs$appendFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$appendFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$readdir = fs.readdir
fs.readdir = readdir
function readdir (path, options, cb) {
var args = [path]
if (typeof options !== 'function') {
args.push(options)
} else {
cb = options
}
args.push(go$readdir$cb)
return go$readdir(args)
function go$readdir$cb (err, files) {
if (files && files.sort)
files.sort()
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [args]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
}
}
function go$readdir (args) {
return fs$readdir.apply(fs, args)
}
if (process.version.substr(0, 4) === 'v0.8') {
var legStreams = legacy(fs)
ReadStream = legStreams.ReadStream
WriteStream = legStreams.WriteStream
}
var fs$ReadStream = fs.ReadStream
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
ReadStream.prototype.open = ReadStream$open
}
var fs$WriteStream = fs.WriteStream
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
WriteStream.prototype.open = WriteStream$open
}
Object.defineProperty(fs, 'ReadStream', {
get: function () {
return ReadStream
},
set: function (val) {
ReadStream = val
},
enumerable: true,
configurable: true
})
Object.defineProperty(fs, 'WriteStream', {
get: function () {
return WriteStream
},
set: function (val) {
WriteStream = val
},
enumerable: true,
configurable: true
})
// legacy names
var FileReadStream = ReadStream
Object.defineProperty(fs, 'FileReadStream', {
get: function () {
return FileReadStream
},
set: function (val) {
FileReadStream = val
},
enumerable: true,
configurable: true
})
var FileWriteStream = WriteStream
Object.defineProperty(fs, 'FileWriteStream', {
get: function () {
return FileWriteStream
},
set: function (val) {
FileWriteStream = val
},
enumerable: true,
configurable: true
})
function ReadStream (path, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
}
function ReadStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
if (that.autoClose)
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
that.read()
}
})
}
function WriteStream (path, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
}
function WriteStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
}
})
}
function createReadStream (path, options) {
return new fs.ReadStream(path, options)
}
function createWriteStream (path, options) {
return new fs.WriteStream(path, options)
}
var fs$open = fs.open
fs.open = open
function open (path, flags, mode, cb) {
if (typeof mode === 'function')
cb = mode, mode = null
return go$open(path, flags, mode, cb)
function go$open (path, flags, mode, cb) {
return fs$open(path, flags, mode, function (err, fd) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$open, [path, flags, mode, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
return fs
}
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
global[gracefulQueue].push(elem)
}
function retry () {
var elem = global[gracefulQueue].shift()
if (elem) {
debug('RETRY', elem[0].name, elem[1])
elem[0].apply(null, elem[1])
}
}
/***/ }),
/* 87 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _home_runner_work_TypeScriptToLua_github_io_TypeScriptToLua_github_io_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(177);
/* harmony import */ var _docusaurus_isInternalUrl__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(132);
/* harmony import */ var _docusaurus_ExecutionEnvironment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(224);
/* harmony import */ var _docusaurus_ExecutionEnvironment__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_docusaurus_ExecutionEnvironment__WEBPACK_IMPORTED_MODULE_4__);
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function Link(props){const{to,href}=props;const targetLink=to||href;const isInternal=Object(_docusaurus_isInternalUrl__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(targetLink);const preloaded=Object(react__WEBPACK_IMPORTED_MODULE_1__["useRef"])(false);const IOSupported=_docusaurus_ExecutionEnvironment__WEBPACK_IMPORTED_MODULE_4___default.a.canUseIntersectionObserver;let io;const handleIntersection=(el,cb)=>{io=new window.IntersectionObserver(entries=>{entries.forEach(entry=>{if(el===entry.target){// If element is in viewport, stop listening/observing and run callback.
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
if(entry.isIntersecting||entry.intersectionRatio>0){io.unobserve(el);io.disconnect();cb();}}});});// Add element to the observer.
io.observe(el);};const handleRef=ref=>{if(IOSupported&&ref&&isInternal){// If IO supported and element reference found, setup Observer functionality.
handleIntersection(ref,()=>{window.docusaurus.prefetch(targetLink);});}};const onMouseEnter=()=>{if(!preloaded.current){window.docusaurus.preload(targetLink);preloaded.current=true;}};Object(react__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(()=>{// If IO is not supported. We prefetch by default (only once).
if(!IOSupported&&isInternal){window.docusaurus.prefetch(targetLink);}// When unmounting, stop intersection observer from watching.
return()=>{if(IOSupported&&io){io.disconnect();}};},[targetLink,IOSupported,isInternal]);return!targetLink||!isInternal?/*#__PURE__*/ // eslint-disable-next-line jsx-a11y/anchor-has-content
react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("a",Object(_home_runner_work_TypeScriptToLua_github_io_TypeScriptToLua_github_io_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({},props,{href:targetLink})):/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_2__[/* NavLink */ "a"],Object(_home_runner_work_TypeScriptToLua_github_io_TypeScriptToLua_github_io_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({},props,{onMouseEnter:onMouseEnter,innerRef:handleRef,to:targetLink}));}/* harmony default export */ __webpack_exports__["a"] = (Link);
/***/ }),
/* 88 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return KeybindingsRegistry; });
/* unused harmony export Extensions */
/* harmony import */ var _base_common_keyCodes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(39);
/* harmony import */ var _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/* harmony import */ var _commands_common_commands_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28);
/* harmony import */ var _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(57);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var KeybindingsRegistryImpl = /** @class */ (function () {
function KeybindingsRegistryImpl() {
this._coreKeybindings = [];
this._extensionKeybindings = [];
this._cachedMergedKeybindings = null;
}
/**
* Take current platform into account and reduce to primary & secondary.
*/
KeybindingsRegistryImpl.bindToCurrentPlatform = function (kb) {
if (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* OS */ "a"] === 1 /* Windows */) {
if (kb && kb.win) {
return kb.win;
}
}
else if (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* OS */ "a"] === 2 /* Macintosh */) {
if (kb && kb.mac) {
return kb.mac;
}
}
else {
if (kb && kb.linux) {
return kb.linux;
}
}
return kb;
};
KeybindingsRegistryImpl.prototype.registerKeybindingRule = function (rule) {
var actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule);
if (actualKb && actualKb.primary) {
var kk = Object(_base_common_keyCodes_js__WEBPACK_IMPORTED_MODULE_0__[/* createKeybinding */ "f"])(actualKb.primary, _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* OS */ "a"]);
if (kk) {
this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, 0, rule.when);
}
}
if (actualKb && Array.isArray(actualKb.secondary)) {
for (var i = 0, len = actualKb.secondary.length; i < len; i++) {
var k = actualKb.secondary[i];
var kk = Object(_base_common_keyCodes_js__WEBPACK_IMPORTED_MODULE_0__[/* createKeybinding */ "f"])(k, _base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* OS */ "a"]);
if (kk) {
this._registerDefaultKeybinding(kk, rule.id, rule.args, rule.weight, -i - 1, rule.when);
}
}
}
};
KeybindingsRegistryImpl.prototype.registerCommandAndKeybindingRule = function (desc) {
this.registerKeybindingRule(desc);
_commands_common_commands_js__WEBPACK_IMPORTED_MODULE_2__[/* CommandsRegistry */ "a"].registerCommand(desc);
};
KeybindingsRegistryImpl._mightProduceChar = function (keyCode) {
if (keyCode >= 21 /* KEY_0 */ && keyCode <= 30 /* KEY_9 */) {
return true;
}
if (keyCode >= 31 /* KEY_A */ && keyCode <= 56 /* KEY_Z */) {
return true;
}
return (keyCode === 80 /* US_SEMICOLON */
|| keyCode === 81 /* US_EQUAL */
|| keyCode === 82 /* US_COMMA */
|| keyCode === 83 /* US_MINUS */
|| keyCode === 84 /* US_DOT */
|| keyCode === 85 /* US_SLASH */
|| keyCode === 86 /* US_BACKTICK */
|| keyCode === 110 /* ABNT_C1 */
|| keyCode === 111 /* ABNT_C2 */
|| keyCode === 87 /* US_OPEN_SQUARE_BRACKET */
|| keyCode === 88 /* US_BACKSLASH */
|| keyCode === 89 /* US_CLOSE_SQUARE_BRACKET */
|| keyCode === 90 /* US_QUOTE */
|| keyCode === 91 /* OEM_8 */
|| keyCode === 92 /* OEM_102 */);
};
KeybindingsRegistryImpl.prototype._assertNoCtrlAlt = function (keybinding, commandId) {
if (keybinding.ctrlKey && keybinding.altKey && !keybinding.metaKey) {
if (KeybindingsRegistryImpl._mightProduceChar(keybinding.keyCode)) {
console.warn('Ctrl+Alt+ keybindings should not be used by default under Windows. Offender: ', keybinding, ' for ', commandId);
}
}
};
KeybindingsRegistryImpl.prototype._registerDefaultKeybinding = function (keybinding, commandId, commandArgs, weight1, weight2, when) {
if (_base_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* OS */ "a"] === 1 /* Windows */) {
this._assertNoCtrlAlt(keybinding.parts[0], commandId);
}
this._coreKeybindings.push({
keybinding: keybinding,
command: commandId,
commandArgs: commandArgs,
when: when,
weight1: weight1,
weight2: weight2
});
this._cachedMergedKeybindings = null;
};
KeybindingsRegistryImpl.prototype.getDefaultKeybindings = function () {
if (!this._cachedMergedKeybindings) {
this._cachedMergedKeybindings = [].concat(this._coreKeybindings).concat(this._extensionKeybindings);
this._cachedMergedKeybindings.sort(sorter);
}
return this._cachedMergedKeybindings.slice(0);
};
return KeybindingsRegistryImpl;
}());
var KeybindingsRegistry = new KeybindingsRegistryImpl();
// Define extension point ids
var Extensions = {
EditorModes: 'platform.keybindingsRegistry'
};
_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_3__[/* Registry */ "a"].add(Extensions.EditorModes, KeybindingsRegistry);
function sorter(a, b) {
if (a.weight1 !== b.weight1) {
return a.weight1 - b.weight1;
}
if (a.command < b.command) {
return -1;
}
if (a.command > b.command) {
return 1;
}
return a.weight2 - b.weight2;
}
/***/ }),
/* 89 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return standardMouseMoveMerger; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GlobalMouseMoveMonitor; });
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25);
/* harmony import */ var _iframe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(196);
/* harmony import */ var _mouseEvent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(46);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4);
/* harmony import */ var _canIUse_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(120);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function standardMouseMoveMerger(lastEvent, currentEvent) {
var ev = new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_4__[/* StandardMouseEvent */ "b"](currentEvent);
ev.preventDefault();
return {
leftButton: ev.leftButton,
buttons: ev.buttons,
posx: ev.posx,
posy: ev.posy
};
}
var GlobalMouseMoveMonitor = /** @class */ (function () {
function GlobalMouseMoveMonitor() {
this._hooks = new _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_5__[/* DisposableStore */ "b"]();
this._mouseMoveEventMerger = null;
this._mouseMoveCallback = null;
this._onStopCallback = null;
}
GlobalMouseMoveMonitor.prototype.dispose = function () {
this.stopMonitoring(false);
this._hooks.dispose();
};
GlobalMouseMoveMonitor.prototype.stopMonitoring = function (invokeStopCallback) {
if (!this.isMonitoring()) {
// Not monitoring
return;
}
// Unhook
this._hooks.clear();
this._mouseMoveEventMerger = null;
this._mouseMoveCallback = null;
var onStopCallback = this._onStopCallback;
this._onStopCallback = null;
if (invokeStopCallback && onStopCallback) {
onStopCallback();
}
};
GlobalMouseMoveMonitor.prototype.isMonitoring = function () {
return !!this._mouseMoveEventMerger;
};
GlobalMouseMoveMonitor.prototype.startMonitoring = function (initialElement, initialButtons, mouseMoveEventMerger, mouseMoveCallback, onStopCallback) {
var _this = this;
if (this.isMonitoring()) {
// I am already hooked
return;
}
this._mouseMoveEventMerger = mouseMoveEventMerger;
this._mouseMoveCallback = mouseMoveCallback;
this._onStopCallback = onStopCallback;
var windowChain = _iframe_js__WEBPACK_IMPORTED_MODULE_3__[/* IframeUtils */ "a"].getSameOriginWindowChain();
var mouseMove = _common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isIOS */ "c"] && _canIUse_js__WEBPACK_IMPORTED_MODULE_6__[/* BrowserFeatures */ "a"].pointerEvents ? 'pointermove' : 'mousemove';
var mouseUp = _common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isIOS */ "c"] && _canIUse_js__WEBPACK_IMPORTED_MODULE_6__[/* BrowserFeatures */ "a"].pointerEvents ? 'pointerup' : 'mouseup';
var listenTo = windowChain.map(function (element) { return element.window.document; });
var shadowRoot = _dom_js__WEBPACK_IMPORTED_MODULE_0__[/* getShadowRoot */ "E"](initialElement);
if (shadowRoot) {
listenTo.unshift(shadowRoot);
}
for (var _i = 0, listenTo_1 = listenTo; _i < listenTo_1.length; _i++) {
var element = listenTo_1[_i];
this._hooks.add(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableThrottledListener */ "m"](element, mouseMove, function (data) {
if (!_browser_js__WEBPACK_IMPORTED_MODULE_2__[/* isIE */ "i"] && data.buttons !== initialButtons) {
// Buttons state has changed in the meantime
_this.stopMonitoring(true);
return;
}
_this._mouseMoveCallback(data);
}, function (lastEvent, currentEvent) { return _this._mouseMoveEventMerger(lastEvent, currentEvent); }));
this._hooks.add(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](element, mouseUp, function (e) { return _this.stopMonitoring(true); }));
}
if (_iframe_js__WEBPACK_IMPORTED_MODULE_3__[/* IframeUtils */ "a"].hasDifferentOriginAncestor()) {
var lastSameOriginAncestor = windowChain[windowChain.length - 1];
// We might miss a mouse up if it happens outside the iframe
// This one is for Chrome
this._hooks.add(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](lastSameOriginAncestor.window.document, 'mouseout', function (browserEvent) {
var e = new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_4__[/* StandardMouseEvent */ "b"](browserEvent);
if (e.target.tagName.toLowerCase() === 'html') {
_this.stopMonitoring(true);
}
}));
// This one is for FF
this._hooks.add(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](lastSameOriginAncestor.window.document, 'mouseover', function (browserEvent) {
var e = new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_4__[/* StandardMouseEvent */ "b"](browserEvent);
if (e.target.tagName.toLowerCase() === 'html') {
_this.stopMonitoring(true);
}
}));
// This one is for IE
this._hooks.add(_dom_js__WEBPACK_IMPORTED_MODULE_0__[/* addDisposableListener */ "j"](lastSameOriginAncestor.window.document.body, 'mouseleave', function (browserEvent) {
_this.stopMonitoring(true);
}));
}
};
return GlobalMouseMoveMonitor;
}());
/***/ }),
/* 90 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Range; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Range;
(function (Range) {
/**
* Returns the intersection between two ranges as a range itself.
* Returns `{ start: 0, end: 0 }` if the intersection is empty.
*/
function intersect(one, other) {
if (one.start >= other.end || other.start >= one.end) {
return { start: 0, end: 0 };
}
var start = Math.max(one.start, other.start);
var end = Math.min(one.end, other.end);
if (end - start <= 0) {
return { start: 0, end: 0 };
}
return { start: start, end: end };
}
Range.intersect = intersect;
function isEmpty(range) {
return range.end - range.start <= 0;
}
Range.isEmpty = isEmpty;
function intersects(one, other) {
return !isEmpty(intersect(one, other));
}
Range.intersects = intersects;
function relativeComplement(one, other) {
var result = [];
var first = { start: one.start, end: Math.min(other.start, one.end) };
var second = { start: Math.max(other.end, one.start), end: one.end };
if (!isEmpty(first)) {
result.push(first);
}
if (!isEmpty(second)) {
result.push(second);
}
return result;
}
Range.relativeComplement = relativeComplement;
})(Range || (Range = {}));
/***/ }),
/* 91 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IStorageService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return WillSaveStateReason; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return InMemoryStorageService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
/* harmony import */ var _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var IStorageService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('storageService');
var WillSaveStateReason;
(function (WillSaveStateReason) {
WillSaveStateReason[WillSaveStateReason["NONE"] = 0] = "NONE";
WillSaveStateReason[WillSaveStateReason["SHUTDOWN"] = 1] = "SHUTDOWN";
})(WillSaveStateReason || (WillSaveStateReason = {}));
var InMemoryStorageService = /** @class */ (function (_super) {
__extends(InMemoryStorageService, _super);
function InMemoryStorageService() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._onDidChangeStorage = _this._register(new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onDidChangeStorage = _this._onDidChangeStorage.event;
_this._onWillSaveState = _this._register(new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onWillSaveState = _this._onWillSaveState.event;
_this.globalCache = new Map();
_this.workspaceCache = new Map();
return _this;
}
InMemoryStorageService.prototype.getCache = function (scope) {
return scope === 0 /* GLOBAL */ ? this.globalCache : this.workspaceCache;
};
InMemoryStorageService.prototype.get = function (key, scope, fallbackValue) {
var value = this.getCache(scope).get(key);
if (Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefinedOrNull */ "l"])(value)) {
return fallbackValue;
}
return value;
};
InMemoryStorageService.prototype.getBoolean = function (key, scope, fallbackValue) {
var value = this.getCache(scope).get(key);
if (Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefinedOrNull */ "l"])(value)) {
return fallbackValue;
}
return value === 'true';
};
InMemoryStorageService.prototype.store = function (key, value, scope) {
// We remove the key for undefined/null values
if (Object(_base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefinedOrNull */ "l"])(value)) {
return this.remove(key, scope);
}
// Otherwise, convert to String and store
var valueStr = String(value);
// Return early if value already set
var currentValue = this.getCache(scope).get(key);
if (currentValue === valueStr) {
return Promise.resolve();
}
// Update in cache
this.getCache(scope).set(key, valueStr);
// Events
this._onDidChangeStorage.fire({ scope: scope, key: key });
return Promise.resolve();
};
InMemoryStorageService.prototype.remove = function (key, scope) {
var wasDeleted = this.getCache(scope).delete(key);
if (!wasDeleted) {
return Promise.resolve(); // Return early if value already deleted
}
// Events
this._onDidChangeStorage.fire({ scope: scope, key: key });
return Promise.resolve();
};
return InMemoryStorageService;
}(_base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"]));
/***/ }),
/* 92 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SearchParams; });
/* unused harmony export isMultilineRegexSource */
/* unused harmony export SearchData */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return createFindMatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return TextModelSearch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isValidMatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Searcher; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _controller_wordCharacterClassifier_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
/* harmony import */ var _model_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(47);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LIMIT_FIND_COUNT = 999;
var SearchParams = /** @class */ (function () {
function SearchParams(searchString, isRegex, matchCase, wordSeparators) {
this.searchString = searchString;
this.isRegex = isRegex;
this.matchCase = matchCase;
this.wordSeparators = wordSeparators;
}
SearchParams.prototype.parseSearchRequest = function () {
if (this.searchString === '') {
return null;
}
// Try to create a RegExp out of the params
var multiline;
if (this.isRegex) {
multiline = isMultilineRegexSource(this.searchString);
}
else {
multiline = (this.searchString.indexOf('\n') >= 0);
}
var regex = null;
try {
regex = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* createRegExp */ "l"](this.searchString, this.isRegex, {
matchCase: this.matchCase,
wholeWord: false,
multiline: multiline,
global: true,
unicode: true
});
}
catch (err) {
return null;
}
if (!regex) {
return null;
}
var canUseSimpleSearch = (!this.isRegex && !multiline);
if (canUseSimpleSearch && this.searchString.toLowerCase() !== this.searchString.toUpperCase()) {
// casing might make a difference
canUseSimpleSearch = this.matchCase;
}
return new SearchData(regex, this.wordSeparators ? Object(_controller_wordCharacterClassifier_js__WEBPACK_IMPORTED_MODULE_1__[/* getMapForWordSeparators */ "a"])(this.wordSeparators) : null, canUseSimpleSearch ? this.searchString : null);
};
return SearchParams;
}());
function isMultilineRegexSource(searchString) {
if (!searchString || searchString.length === 0) {
return false;
}
for (var i = 0, len = searchString.length; i < len; i++) {
var chCode = searchString.charCodeAt(i);
if (chCode === 92 /* Backslash */) {
// move to next char
i++;
if (i >= len) {
// string ends with a \
break;
}
var nextChCode = searchString.charCodeAt(i);
if (nextChCode === 110 /* n */ || nextChCode === 114 /* r */ || nextChCode === 87 /* W */ || nextChCode === 119 /* w */) {
return true;
}
}
}
return false;
}
var SearchData = /** @class */ (function () {
function SearchData(regex, wordSeparators, simpleSearch) {
this.regex = regex;
this.wordSeparators = wordSeparators;
this.simpleSearch = simpleSearch;
}
return SearchData;
}());
function createFindMatch(range, rawMatches, captureMatches) {
if (!captureMatches) {
return new _model_js__WEBPACK_IMPORTED_MODULE_4__[/* FindMatch */ "b"](range, null);
}
var matches = [];
for (var i = 0, len = rawMatches.length; i < len; i++) {
matches[i] = rawMatches[i];
}
return new _model_js__WEBPACK_IMPORTED_MODULE_4__[/* FindMatch */ "b"](range, matches);
}
var LineFeedCounter = /** @class */ (function () {
function LineFeedCounter(text) {
var lineFeedsOffsets = [];
var lineFeedsOffsetsLen = 0;
for (var i = 0, textLen = text.length; i < textLen; i++) {
if (text.charCodeAt(i) === 10 /* LineFeed */) {
lineFeedsOffsets[lineFeedsOffsetsLen++] = i;
}
}
this._lineFeedsOffsets = lineFeedsOffsets;
}
LineFeedCounter.prototype.findLineFeedCountBeforeOffset = function (offset) {
var lineFeedsOffsets = this._lineFeedsOffsets;
var min = 0;
var max = lineFeedsOffsets.length - 1;
if (max === -1) {
// no line feeds
return 0;
}
if (offset <= lineFeedsOffsets[0]) {
// before first line feed
return 0;
}
while (min < max) {
var mid = min + ((max - min) / 2 >> 0);
if (lineFeedsOffsets[mid] >= offset) {
max = mid - 1;
}
else {
if (lineFeedsOffsets[mid + 1] >= offset) {
// bingo!
min = mid;
max = mid;
}
else {
min = mid + 1;
}
}
}
return min + 1;
};
return LineFeedCounter;
}());
var TextModelSearch = /** @class */ (function () {
function TextModelSearch() {
}
TextModelSearch.findMatches = function (model, searchParams, searchRange, captureMatches, limitResultCount) {
var 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
*/
TextModelSearch._getMultilineMatchRange = function (model, deltaOffset, text, lfCounter, matchIndex, match0) {
var startOffset;
var lineFeedCountBeforeMatch = 0;
if (lfCounter) {
lineFeedCountBeforeMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex);
startOffset = deltaOffset + matchIndex + lineFeedCountBeforeMatch /* add as many \r as there were \n */;
}
else {
startOffset = deltaOffset + matchIndex;
}
var endOffset;
if (lfCounter) {
var lineFeedCountBeforeEndOfMatch = lfCounter.findLineFeedCountBeforeOffset(matchIndex + match0.length);
var lineFeedCountInMatch = lineFeedCountBeforeEndOfMatch - lineFeedCountBeforeMatch;
endOffset = startOffset + match0.length + lineFeedCountInMatch /* add as many \r as there were \n */;
}
else {
endOffset = startOffset + match0.length;
}
var startPosition = model.getPositionAt(startOffset);
var endPosition = model.getPositionAt(endOffset);
return new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
};
TextModelSearch._doFindMatchesMultiline = function (model, searchRange, searcher, captureMatches, limitResultCount) {
var deltaOffset = model.getOffsetAt(searchRange.getStartPosition());
// We always execute multiline search over the lines joined with \n
// This makes it that \n will match the EOL for both CRLF and LF models
// We compensate for offset errors in `_getMultilineMatchRange`
var text = model.getValueInRange(searchRange, 1 /* LF */);
var lfCounter = (model.getEOL() === '\r\n' ? new LineFeedCounter(text) : null);
var result = [];
var counter = 0;
var m;
searcher.reset(0);
while ((m = searcher.next(text))) {
result[counter++] = createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);
if (counter >= limitResultCount) {
return result;
}
}
return result;
};
TextModelSearch._doFindMatchesLineByLine = function (model, searchRange, searchData, captureMatches, limitResultCount) {
var result = [];
var resultLen = 0;
// Early case for a search range that starts & stops on the same line number
if (searchRange.startLineNumber === searchRange.endLineNumber) {
var text_1 = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, text_1, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);
return result;
}
// Collect results from first line
var text = model.getLineContent(searchRange.startLineNumber).substring(searchRange.startColumn - 1);
resultLen = this._findMatchesInLine(searchData, text, searchRange.startLineNumber, searchRange.startColumn - 1, resultLen, result, captureMatches, limitResultCount);
// Collect results from middle lines
for (var lineNumber = searchRange.startLineNumber + 1; lineNumber < searchRange.endLineNumber && resultLen < limitResultCount; lineNumber++) {
resultLen = this._findMatchesInLine(searchData, model.getLineContent(lineNumber), lineNumber, 0, resultLen, result, captureMatches, limitResultCount);
}
// Collect results from last line
if (resultLen < limitResultCount) {
var text_2 = model.getLineContent(searchRange.endLineNumber).substring(0, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, text_2, searchRange.endLineNumber, 0, resultLen, result, captureMatches, limitResultCount);
}
return result;
};
TextModelSearch._findMatchesInLine = function (searchData, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {
var wordSeparators = searchData.wordSeparators;
if (!captureMatches && searchData.simpleSearch) {
var searchString = searchData.simpleSearch;
var searchStringLen = searchString.length;
var textLength = text.length;
var lastMatchIndex = -searchStringLen;
while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {
if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {
result[resultLen++] = new _model_js__WEBPACK_IMPORTED_MODULE_4__[/* FindMatch */ "b"](new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
}
return resultLen;
}
var searcher = new Searcher(searchData.wordSeparators, searchData.regex);
var m;
// Reset regex to search from the beginning
searcher.reset(0);
do {
m = searcher.next(text);
if (m) {
result[resultLen++] = createFindMatch(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
};
TextModelSearch.findNextMatch = function (model, searchParams, searchStart, captureMatches) {
var searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
var 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);
};
TextModelSearch._doFindNextMatchMultiline = function (model, searchStart, searcher, captureMatches) {
var searchTextStart = new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](searchStart.lineNumber, 1);
var deltaOffset = model.getOffsetAt(searchTextStart);
var lineCount = model.getLineCount();
// We always execute multiline search over the lines joined with \n
// This makes it that \n will match the EOL for both CRLF and LF models
// We compensate for offset errors in `_getMultilineMatchRange`
var text = model.getValueInRange(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](searchTextStart.lineNumber, searchTextStart.column, lineCount, model.getLineMaxColumn(lineCount)), 1 /* LF */);
var lfCounter = (model.getEOL() === '\r\n' ? new LineFeedCounter(text) : null);
searcher.reset(searchStart.column - 1);
var m = searcher.next(text);
if (m) {
return createFindMatch(this._getMultilineMatchRange(model, deltaOffset, text, lfCounter, m.index, m[0]), m, captureMatches);
}
if (searchStart.lineNumber !== 1 || searchStart.column !== 1) {
// Try again from the top
return this._doFindNextMatchMultiline(model, new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](1, 1), searcher, captureMatches);
}
return null;
};
TextModelSearch._doFindNextMatchLineByLine = function (model, searchStart, searcher, captureMatches) {
var lineCount = model.getLineCount();
var startLineNumber = searchStart.lineNumber;
// Look in first line
var text = model.getLineContent(startLineNumber);
var r = this._findFirstMatchInLine(searcher, text, startLineNumber, searchStart.column, captureMatches);
if (r) {
return r;
}
for (var i = 1; i <= lineCount; i++) {
var lineIndex = (startLineNumber + i - 1) % lineCount;
var text_3 = model.getLineContent(lineIndex + 1);
var r_1 = this._findFirstMatchInLine(searcher, text_3, lineIndex + 1, 1, captureMatches);
if (r_1) {
return r_1;
}
}
return null;
};
TextModelSearch._findFirstMatchInLine = function (searcher, text, lineNumber, fromColumn, captureMatches) {
// Set regex to search from column
searcher.reset(fromColumn - 1);
var m = searcher.next(text);
if (m) {
return createFindMatch(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);
}
return null;
};
TextModelSearch.findPreviousMatch = function (model, searchParams, searchStart, captureMatches) {
var searchData = searchParams.parseSearchRequest();
if (!searchData) {
return null;
}
var 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);
};
TextModelSearch._doFindPreviousMatchMultiline = function (model, searchStart, searcher, captureMatches) {
var matches = this._doFindMatchesMultiline(model, new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](1, 1, searchStart.lineNumber, searchStart.column), searcher, captureMatches, 10 * LIMIT_FIND_COUNT);
if (matches.length > 0) {
return matches[matches.length - 1];
}
var lineCount = model.getLineCount();
if (searchStart.lineNumber !== lineCount || searchStart.column !== model.getLineMaxColumn(lineCount)) {
// Try again with all content
return this._doFindPreviousMatchMultiline(model, new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](lineCount, model.getLineMaxColumn(lineCount)), searcher, captureMatches);
}
return null;
};
TextModelSearch._doFindPreviousMatchLineByLine = function (model, searchStart, searcher, captureMatches) {
var lineCount = model.getLineCount();
var startLineNumber = searchStart.lineNumber;
// Look in first line
var text = model.getLineContent(startLineNumber).substring(0, searchStart.column - 1);
var r = this._findLastMatchInLine(searcher, text, startLineNumber, captureMatches);
if (r) {
return r;
}
for (var i = 1; i <= lineCount; i++) {
var lineIndex = (lineCount + startLineNumber - i - 1) % lineCount;
var text_4 = model.getLineContent(lineIndex + 1);
var r_2 = this._findLastMatchInLine(searcher, text_4, lineIndex + 1, captureMatches);
if (r_2) {
return r_2;
}
}
return null;
};
TextModelSearch._findLastMatchInLine = function (searcher, text, lineNumber, captureMatches) {
var bestResult = null;
var m;
searcher.reset(0);
while ((m = searcher.next(text))) {
bestResult = createFindMatch(new _core_range_js__WEBPACK_IMPORTED_MODULE_3__[/* Range */ "a"](lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length), m, captureMatches);
}
return bestResult;
};
return TextModelSearch;
}());
function leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {
if (matchStartIndex === 0) {
// Match starts at start of string
return true;
}
var charBefore = text.charCodeAt(matchStartIndex - 1);
if (wordSeparators.get(charBefore) !== 0 /* Regular */) {
// The character before the match is a word separator
return true;
}
if (charBefore === 13 /* CarriageReturn */ || charBefore === 10 /* LineFeed */) {
// The character before the match is line break or carriage return.
return true;
}
if (matchLength > 0) {
var firstCharInMatch = text.charCodeAt(matchStartIndex);
if (wordSeparators.get(firstCharInMatch) !== 0 /* Regular */) {
// The first character inside the match is a word separator
return true;
}
}
return false;
}
function rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength) {
if (matchStartIndex + matchLength === textLength) {
// Match ends at end of string
return true;
}
var charAfter = text.charCodeAt(matchStartIndex + matchLength);
if (wordSeparators.get(charAfter) !== 0 /* Regular */) {
// The character after the match is a word separator
return true;
}
if (charAfter === 13 /* CarriageReturn */ || charAfter === 10 /* LineFeed */) {
// The character after the match is line break or carriage return.
return true;
}
if (matchLength > 0) {
var lastCharInMatch = text.charCodeAt(matchStartIndex + matchLength - 1);
if (wordSeparators.get(lastCharInMatch) !== 0 /* Regular */) {
// The last character in the match is a word separator
return true;
}
}
return false;
}
function isValidMatch(wordSeparators, text, textLength, matchStartIndex, matchLength) {
return (leftIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength)
&& rightIsWordBounday(wordSeparators, text, textLength, matchStartIndex, matchLength));
}
var Searcher = /** @class */ (function () {
function Searcher(wordSeparators, searchRegex) {
this._wordSeparators = wordSeparators;
this._searchRegex = searchRegex;
this._prevMatchStartIndex = -1;
this._prevMatchLength = 0;
}
Searcher.prototype.reset = function (lastIndex) {
this._searchRegex.lastIndex = lastIndex;
this._prevMatchStartIndex = -1;
this._prevMatchLength = 0;
};
Searcher.prototype.next = function (text) {
var textLength = text.length;
var m;
do {
if (this._prevMatchStartIndex + this._prevMatchLength === textLength) {
// Reached the end of the line
return null;
}
m = this._searchRegex.exec(text);
if (!m) {
return null;
}
var matchStartIndex = m.index;
var matchLength = m[0].length;
if (matchStartIndex === this._prevMatchStartIndex && matchLength === this._prevMatchLength) {
if (matchLength === 0) {
// the search result is an empty string and won't advance `regex.lastIndex`, so `regex.exec` will stuck here
// we attempt to recover from that by advancing by one
this._searchRegex.lastIndex += 1;
continue;
}
// Exit early if the regex matches the same range twice
return null;
}
this._prevMatchStartIndex = matchStartIndex;
this._prevMatchLength = matchLength;
if (!this._wordSeparators || isValidMatch(this._wordSeparators, text, textLength, matchStartIndex, matchLength)) {
return m;
}
} while (m);
return null;
};
return Searcher;
}());
/***/ }),
/* 93 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ coreCommands_CoreNavigationCommands; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ coreCommands_CoreEditingCommands; });
// UNUSED EXPORTS: CoreEditorCommand, EditorScroll_, RevealLine_
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/nls.js
var nls = __webpack_require__(1);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js
var editorExtensions = __webpack_require__(7);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js
var codeEditorService = __webpack_require__(36);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCommon.js
var cursorCommon = __webpack_require__(23);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/position.js
var position = __webpack_require__(12);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var core_range = __webpack_require__(5);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorColumnSelection.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var cursorColumnSelection_ColumnSelection = /** @class */ (function () {
function ColumnSelection() {
}
ColumnSelection.columnSelect = function (config, model, fromLineNumber, fromVisibleColumn, toLineNumber, toVisibleColumn) {
var lineCount = Math.abs(toLineNumber - fromLineNumber) + 1;
var reversed = (fromLineNumber > toLineNumber);
var isRTL = (fromVisibleColumn > toVisibleColumn);
var isLTR = (fromVisibleColumn < toVisibleColumn);
var result = [];
// console.log(`fromVisibleColumn: ${fromVisibleColumn}, toVisibleColumn: ${toVisibleColumn}`);
for (var i = 0; i < lineCount; i++) {
var lineNumber = fromLineNumber + (reversed ? -i : i);
var startColumn = cursorCommon["a" /* CursorColumns */].columnFromVisibleColumn2(config, model, lineNumber, fromVisibleColumn);
var endColumn = cursorCommon["a" /* CursorColumns */].columnFromVisibleColumn2(config, model, lineNumber, toVisibleColumn);
var visibleStartColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(config, model, new position["a" /* Position */](lineNumber, startColumn));
var visibleEndColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(config, model, new position["a" /* Position */](lineNumber, endColumn));
// console.log(`lineNumber: ${lineNumber}: visibleStartColumn: ${visibleStartColumn}, visibleEndColumn: ${visibleEndColumn}`);
if (isLTR) {
if (visibleStartColumn > toVisibleColumn) {
continue;
}
if (visibleEndColumn < fromVisibleColumn) {
continue;
}
}
if (isRTL) {
if (visibleEndColumn > fromVisibleColumn) {
continue;
}
if (visibleStartColumn < toVisibleColumn) {
continue;
}
}
result.push(new cursorCommon["f" /* SingleCursorState */](new core_range["a" /* Range */](lineNumber, startColumn, lineNumber, startColumn), 0, new position["a" /* Position */](lineNumber, endColumn), 0));
}
if (result.length === 0) {
// We are after all the lines, so add cursor at the end of each line
for (var i = 0; i < lineCount; i++) {
var lineNumber = fromLineNumber + (reversed ? -i : i);
var maxColumn = model.getLineMaxColumn(lineNumber);
result.push(new cursorCommon["f" /* SingleCursorState */](new core_range["a" /* Range */](lineNumber, maxColumn, lineNumber, maxColumn), 0, new position["a" /* Position */](lineNumber, maxColumn), 0));
}
}
return {
viewStates: result,
reversed: reversed,
fromLineNumber: fromLineNumber,
fromVisualColumn: fromVisibleColumn,
toLineNumber: toLineNumber,
toVisualColumn: toVisibleColumn
};
};
ColumnSelection.columnSelectLeft = function (config, model, prevColumnSelectData) {
var toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;
if (toViewVisualColumn > 1) {
toViewVisualColumn--;
}
return ColumnSelection.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);
};
ColumnSelection.columnSelectRight = function (config, model, prevColumnSelectData) {
var maxVisualViewColumn = 0;
var minViewLineNumber = Math.min(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);
var maxViewLineNumber = Math.max(prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.toViewLineNumber);
for (var lineNumber = minViewLineNumber; lineNumber <= maxViewLineNumber; lineNumber++) {
var lineMaxViewColumn = model.getLineMaxColumn(lineNumber);
var lineMaxVisualViewColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(config, model, new position["a" /* Position */](lineNumber, lineMaxViewColumn));
maxVisualViewColumn = Math.max(maxVisualViewColumn, lineMaxVisualViewColumn);
}
var toViewVisualColumn = prevColumnSelectData.toViewVisualColumn;
if (toViewVisualColumn < maxVisualViewColumn) {
toViewVisualColumn++;
}
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, prevColumnSelectData.toViewLineNumber, toViewVisualColumn);
};
ColumnSelection.columnSelectUp = function (config, model, prevColumnSelectData, isPaged) {
var linesCount = isPaged ? config.pageSize : 1;
var toViewLineNumber = Math.max(1, prevColumnSelectData.toViewLineNumber - linesCount);
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);
};
ColumnSelection.columnSelectDown = function (config, model, prevColumnSelectData, isPaged) {
var linesCount = isPaged ? config.pageSize : 1;
var toViewLineNumber = Math.min(model.getLineCount(), prevColumnSelectData.toViewLineNumber + linesCount);
return this.columnSelect(config, model, prevColumnSelectData.fromViewLineNumber, prevColumnSelectData.fromViewVisualColumn, toViewLineNumber, prevColumnSelectData.toViewVisualColumn);
};
return ColumnSelection;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorDeleteOperations.js
var cursorDeleteOperations = __webpack_require__(200);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorMoveCommands.js
var cursorMoveCommands = __webpack_require__(75);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorTypeOperations.js + 1 modules
var cursorTypeOperations = __webpack_require__(106);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js
var editorCommon = __webpack_require__(40);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js
var editorContextKeys = __webpack_require__(10);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
var contextkey = __webpack_require__(13);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/coreCommands.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var CORE_WEIGHT = 0 /* EditorCore */;
var CoreEditorCommand = /** @class */ (function (_super) {
__extends(CoreEditorCommand, _super);
function CoreEditorCommand() {
return _super !== null && _super.apply(this, arguments) || this;
}
CoreEditorCommand.prototype.runEditorCommand = function (accessor, editor, args) {
var cursors = editor._getCursors();
if (!cursors) {
// the editor has no view => has no cursors
return;
}
this.runCoreEditorCommand(cursors, args || {});
};
return CoreEditorCommand;
}(editorExtensions["c" /* EditorCommand */]));
var coreCommands_EditorScroll_;
(function (EditorScroll_) {
var isEditorScrollArgs = function (arg) {
if (!types["i" /* isObject */](arg)) {
return false;
}
var scrollArg = arg;
if (!types["j" /* isString */](scrollArg.to)) {
return false;
}
if (!types["k" /* isUndefined */](scrollArg.by) && !types["j" /* isString */](scrollArg.by)) {
return false;
}
if (!types["k" /* isUndefined */](scrollArg.value) && !types["h" /* isNumber */](scrollArg.value)) {
return false;
}
if (!types["k" /* isUndefined */](scrollArg.revealCursor) && !types["e" /* isBoolean */](scrollArg.revealCursor)) {
return false;
}
return true;
};
EditorScroll_.description = {
description: 'Scroll editor in the given direction',
args: [
{
name: 'Editor scroll argument object',
description: "Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory direction value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'up', 'down'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'line', 'wrappedLine', 'page', 'halfPage'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n\t\t\t\t",
constraint: isEditorScrollArgs,
schema: {
'type': 'object',
'required': ['to'],
'properties': {
'to': {
'type': 'string',
'enum': ['up', 'down']
},
'by': {
'type': 'string',
'enum': ['line', 'wrappedLine', 'page', 'halfPage']
},
'value': {
'type': 'number',
'default': 1
},
'revealCursor': {
'type': 'boolean',
}
}
}
}
]
};
/**
* Directions in the view for editor scroll command.
*/
EditorScroll_.RawDirection = {
Up: 'up',
Down: 'down',
};
/**
* Units for editor scroll 'by' argument
*/
EditorScroll_.RawUnit = {
Line: 'line',
WrappedLine: 'wrappedLine',
Page: 'page',
HalfPage: 'halfPage'
};
function parse(args) {
var direction;
switch (args.to) {
case EditorScroll_.RawDirection.Up:
direction = 1 /* Up */;
break;
case EditorScroll_.RawDirection.Down:
direction = 2 /* Down */;
break;
default:
// Illegal arguments
return null;
}
var unit;
switch (args.by) {
case EditorScroll_.RawUnit.Line:
unit = 1 /* Line */;
break;
case EditorScroll_.RawUnit.WrappedLine:
unit = 2 /* WrappedLine */;
break;
case EditorScroll_.RawUnit.Page:
unit = 3 /* Page */;
break;
case EditorScroll_.RawUnit.HalfPage:
unit = 4 /* HalfPage */;
break;
default:
unit = 2 /* WrappedLine */;
}
var value = Math.floor(args.value || 1);
var revealCursor = !!args.revealCursor;
return {
direction: direction,
unit: unit,
value: value,
revealCursor: revealCursor,
select: (!!args.select)
};
}
EditorScroll_.parse = parse;
})(coreCommands_EditorScroll_ || (coreCommands_EditorScroll_ = {}));
var coreCommands_RevealLine_;
(function (RevealLine_) {
var isRevealLineArgs = function (arg) {
if (!types["i" /* isObject */](arg)) {
return false;
}
var reveaLineArg = arg;
if (!types["h" /* isNumber */](reveaLineArg.lineNumber)) {
return false;
}
if (!types["k" /* isUndefined */](reveaLineArg.at) && !types["j" /* isString */](reveaLineArg.at)) {
return false;
}
return true;
};
RevealLine_.description = {
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:\n\t\t\t\t\t* 'lineNumber': A mandatory line number value.\n\t\t\t\t\t* 'at': Logical position at which line has to be revealed .\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'top', 'center', 'bottom'\n\t\t\t\t\t\t```\n\t\t\t\t",
constraint: isRevealLineArgs,
schema: {
'type': 'object',
'required': ['lineNumber'],
'properties': {
'lineNumber': {
'type': 'number',
},
'at': {
'type': 'string',
'enum': ['top', 'center', 'bottom']
}
}
}
}
]
};
/**
* Values for reveal line 'at' argument
*/
RevealLine_.RawAtArgument = {
Top: 'top',
Center: 'center',
Bottom: 'bottom'
};
})(coreCommands_RevealLine_ || (coreCommands_RevealLine_ = {}));
var coreCommands_CoreNavigationCommands;
(function (CoreNavigationCommands) {
var BaseMoveToCommand = /** @class */ (function (_super) {
__extends(BaseMoveToCommand, _super);
function BaseMoveToCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
BaseMoveToCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].moveTo(cursors.context, cursors.getPrimaryCursor(), this._inSelectionMode, args.position, args.viewPosition)
]);
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return BaseMoveToCommand;
}(CoreEditorCommand));
CoreNavigationCommands.MoveTo = Object(editorExtensions["g" /* registerEditorCommand */])(new BaseMoveToCommand({
id: '_moveTo',
inSelectionMode: false,
precondition: undefined
}));
CoreNavigationCommands.MoveToSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new BaseMoveToCommand({
id: '_moveToSelect',
inSelectionMode: true,
precondition: undefined
}));
var ColumnSelectCommand = /** @class */ (function (_super) {
__extends(ColumnSelectCommand, _super);
function ColumnSelectCommand() {
return _super !== null && _super.apply(this, arguments) || this;
}
ColumnSelectCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
var result = this._getColumnSelectResult(cursors.context, cursors.getPrimaryCursor(), cursors.getColumnSelectData(), args);
cursors.setStates(args.source, 3 /* Explicit */, result.viewStates.map(function (viewState) { return cursorCommon["d" /* CursorState */].fromViewState(viewState); }));
cursors.setColumnSelectData({
isReal: true,
fromViewLineNumber: result.fromLineNumber,
fromViewVisualColumn: result.fromVisualColumn,
toViewLineNumber: result.toLineNumber,
toViewVisualColumn: result.toVisualColumn
});
cursors.reveal(args.source, true, (result.reversed ? 1 /* TopMost */ : 2 /* BottomMost */), 0 /* Smooth */);
};
return ColumnSelectCommand;
}(CoreEditorCommand));
CoreNavigationCommands.ColumnSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_1, _super);
function class_1() {
return _super.call(this, {
id: 'columnSelect',
precondition: undefined
}) || this;
}
class_1.prototype._getColumnSelectResult = function (context, primary, prevColumnSelectData, args) {
// validate `args`
var validatedPosition = context.model.validatePosition(args.position);
var validatedViewPosition = context.validateViewPosition(new position["a" /* Position */](args.viewPosition.lineNumber, args.viewPosition.column), validatedPosition);
var fromViewLineNumber = args.doColumnSelect ? prevColumnSelectData.fromViewLineNumber : validatedViewPosition.lineNumber;
var fromViewVisualColumn = args.doColumnSelect ? prevColumnSelectData.fromViewVisualColumn : args.mouseColumn - 1;
return cursorColumnSelection_ColumnSelection.columnSelect(context.config, context.viewModel, fromViewLineNumber, fromViewVisualColumn, validatedViewPosition.lineNumber, args.mouseColumn - 1);
};
return class_1;
}(ColumnSelectCommand)));
CoreNavigationCommands.CursorColumnSelectLeft = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_2, _super);
function class_2() {
return _super.call(this, {
id: 'cursorColumnSelectLeft',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 15 /* LeftArrow */,
linux: { primary: 0 }
}
}) || this;
}
class_2.prototype._getColumnSelectResult = function (context, primary, prevColumnSelectData, args) {
return cursorColumnSelection_ColumnSelection.columnSelectLeft(context.config, context.viewModel, prevColumnSelectData);
};
return class_2;
}(ColumnSelectCommand)));
CoreNavigationCommands.CursorColumnSelectRight = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_3, _super);
function class_3() {
return _super.call(this, {
id: 'cursorColumnSelectRight',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 17 /* RightArrow */,
linux: { primary: 0 }
}
}) || this;
}
class_3.prototype._getColumnSelectResult = function (context, primary, prevColumnSelectData, args) {
return cursorColumnSelection_ColumnSelection.columnSelectRight(context.config, context.viewModel, prevColumnSelectData);
};
return class_3;
}(ColumnSelectCommand)));
var ColumnSelectUpCommand = /** @class */ (function (_super) {
__extends(ColumnSelectUpCommand, _super);
function ColumnSelectUpCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._isPaged = opts.isPaged;
return _this;
}
ColumnSelectUpCommand.prototype._getColumnSelectResult = function (context, primary, prevColumnSelectData, args) {
return cursorColumnSelection_ColumnSelection.columnSelectUp(context.config, context.viewModel, prevColumnSelectData, this._isPaged);
};
return ColumnSelectUpCommand;
}(ColumnSelectCommand));
CoreNavigationCommands.CursorColumnSelectUp = Object(editorExtensions["g" /* registerEditorCommand */])(new ColumnSelectUpCommand({
isPaged: false,
id: 'cursorColumnSelectUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 16 /* UpArrow */,
linux: { primary: 0 }
}
}));
CoreNavigationCommands.CursorColumnSelectPageUp = Object(editorExtensions["g" /* registerEditorCommand */])(new ColumnSelectUpCommand({
isPaged: true,
id: 'cursorColumnSelectPageUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 11 /* PageUp */,
linux: { primary: 0 }
}
}));
var ColumnSelectDownCommand = /** @class */ (function (_super) {
__extends(ColumnSelectDownCommand, _super);
function ColumnSelectDownCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._isPaged = opts.isPaged;
return _this;
}
ColumnSelectDownCommand.prototype._getColumnSelectResult = function (context, primary, prevColumnSelectData, args) {
return cursorColumnSelection_ColumnSelection.columnSelectDown(context.config, context.viewModel, prevColumnSelectData, this._isPaged);
};
return ColumnSelectDownCommand;
}(ColumnSelectCommand));
CoreNavigationCommands.CursorColumnSelectDown = Object(editorExtensions["g" /* registerEditorCommand */])(new ColumnSelectDownCommand({
isPaged: false,
id: 'cursorColumnSelectDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 18 /* DownArrow */,
linux: { primary: 0 }
}
}));
CoreNavigationCommands.CursorColumnSelectPageDown = Object(editorExtensions["g" /* registerEditorCommand */])(new ColumnSelectDownCommand({
isPaged: true,
id: 'cursorColumnSelectPageDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 512 /* Alt */ | 12 /* PageDown */,
linux: { primary: 0 }
}
}));
var CursorMoveImpl = /** @class */ (function (_super) {
__extends(CursorMoveImpl, _super);
function CursorMoveImpl() {
return _super.call(this, {
id: 'cursorMove',
precondition: undefined,
description: cursorMoveCommands["a" /* CursorMove */].description
}) || this;
}
CursorMoveImpl.prototype.runCoreEditorCommand = function (cursors, args) {
var parsed = cursorMoveCommands["a" /* CursorMove */].parse(args);
if (!parsed) {
// illegal arguments
return;
}
this._runCursorMove(cursors, args.source, parsed);
};
CursorMoveImpl.prototype._runCursorMove = function (cursors, source, args) {
cursors.context.model.pushStackElement();
cursors.setStates(source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].move(cursors.context, cursors.getAll(), args));
cursors.reveal(source, true, 0 /* Primary */, 0 /* Smooth */);
};
return CursorMoveImpl;
}(CoreEditorCommand));
CoreNavigationCommands.CursorMoveImpl = CursorMoveImpl;
CoreNavigationCommands.CursorMove = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveImpl());
var CursorMoveBasedCommand = /** @class */ (function (_super) {
__extends(CursorMoveBasedCommand, _super);
function CursorMoveBasedCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._staticArgs = opts.args;
return _this;
}
CursorMoveBasedCommand.prototype.runCoreEditorCommand = function (cursors, dynamicArgs) {
var args = this._staticArgs;
if (this._staticArgs.value === -1 /* PAGE_SIZE_MARKER */) {
// -1 is a marker for page size
args = {
direction: this._staticArgs.direction,
unit: this._staticArgs.unit,
select: this._staticArgs.select,
value: cursors.context.config.pageSize
};
}
CoreNavigationCommands.CursorMove._runCursorMove(cursors, dynamicArgs.source, args);
};
return CursorMoveBasedCommand;
}(CoreEditorCommand));
CoreNavigationCommands.CursorLeft = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 0 /* Left */,
unit: 0 /* None */,
select: false,
value: 1
},
id: 'cursorLeft',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 15 /* LeftArrow */,
mac: { primary: 15 /* LeftArrow */, secondary: [256 /* WinCtrl */ | 32 /* KEY_B */] }
}
}));
CoreNavigationCommands.CursorLeftSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 0 /* Left */,
unit: 0 /* None */,
select: true,
value: 1
},
id: 'cursorLeftSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 15 /* LeftArrow */
}
}));
CoreNavigationCommands.CursorRight = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 1 /* Right */,
unit: 0 /* None */,
select: false,
value: 1
},
id: 'cursorRight',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 17 /* RightArrow */,
mac: { primary: 17 /* RightArrow */, secondary: [256 /* WinCtrl */ | 36 /* KEY_F */] }
}
}));
CoreNavigationCommands.CursorRightSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 1 /* Right */,
unit: 0 /* None */,
select: true,
value: 1
},
id: 'cursorRightSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 17 /* RightArrow */
}
}));
CoreNavigationCommands.CursorUp = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 2 /* Up */,
unit: 2 /* WrappedLine */,
select: false,
value: 1
},
id: 'cursorUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 16 /* UpArrow */,
mac: { primary: 16 /* UpArrow */, secondary: [256 /* WinCtrl */ | 46 /* KEY_P */] }
}
}));
CoreNavigationCommands.CursorUpSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 2 /* Up */,
unit: 2 /* WrappedLine */,
select: true,
value: 1
},
id: 'cursorUpSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 16 /* UpArrow */,
secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 16 /* UpArrow */],
mac: { primary: 1024 /* Shift */ | 16 /* UpArrow */ },
linux: { primary: 1024 /* Shift */ | 16 /* UpArrow */ }
}
}));
CoreNavigationCommands.CursorPageUp = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 2 /* Up */,
unit: 2 /* WrappedLine */,
select: false,
value: -1 /* PAGE_SIZE_MARKER */
},
id: 'cursorPageUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 11 /* PageUp */
}
}));
CoreNavigationCommands.CursorPageUpSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 2 /* Up */,
unit: 2 /* WrappedLine */,
select: true,
value: -1 /* PAGE_SIZE_MARKER */
},
id: 'cursorPageUpSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 11 /* PageUp */
}
}));
CoreNavigationCommands.CursorDown = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 3 /* Down */,
unit: 2 /* WrappedLine */,
select: false,
value: 1
},
id: 'cursorDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 18 /* DownArrow */,
mac: { primary: 18 /* DownArrow */, secondary: [256 /* WinCtrl */ | 44 /* KEY_N */] }
}
}));
CoreNavigationCommands.CursorDownSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 3 /* Down */,
unit: 2 /* WrappedLine */,
select: true,
value: 1
},
id: 'cursorDownSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 18 /* DownArrow */,
secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 18 /* DownArrow */],
mac: { primary: 1024 /* Shift */ | 18 /* DownArrow */ },
linux: { primary: 1024 /* Shift */ | 18 /* DownArrow */ }
}
}));
CoreNavigationCommands.CursorPageDown = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 3 /* Down */,
unit: 2 /* WrappedLine */,
select: false,
value: -1 /* PAGE_SIZE_MARKER */
},
id: 'cursorPageDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 12 /* PageDown */
}
}));
CoreNavigationCommands.CursorPageDownSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new CursorMoveBasedCommand({
args: {
direction: 3 /* Down */,
unit: 2 /* WrappedLine */,
select: true,
value: -1 /* PAGE_SIZE_MARKER */
},
id: 'cursorPageDownSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 12 /* PageDown */
}
}));
CoreNavigationCommands.CreateCursor = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_4, _super);
function class_4() {
return _super.call(this, {
id: 'createCursor',
precondition: undefined
}) || this;
}
class_4.prototype.runCoreEditorCommand = function (cursors, args) {
var context = cursors.context;
var newState;
if (args.wholeLine) {
newState = cursorMoveCommands["b" /* CursorMoveCommands */].line(context, cursors.getPrimaryCursor(), false, args.position, args.viewPosition);
}
else {
newState = cursorMoveCommands["b" /* CursorMoveCommands */].moveTo(context, cursors.getPrimaryCursor(), false, args.position, args.viewPosition);
}
var states = cursors.getAll();
// Check if we should remove a cursor (sort of like a toggle)
if (states.length > 1) {
var newModelPosition = (newState.modelState ? newState.modelState.position : null);
var newViewPosition = (newState.viewState ? newState.viewState.position : null);
for (var i = 0, len = states.length; i < len; i++) {
var state = states[i];
if (newModelPosition && !state.modelState.selection.containsPosition(newModelPosition)) {
continue;
}
if (newViewPosition && !state.viewState.selection.containsPosition(newViewPosition)) {
continue;
}
// => Remove the cursor
states.splice(i, 1);
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, states);
return;
}
}
// => Add the new cursor
states.push(newState);
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, states);
};
return class_4;
}(CoreEditorCommand)));
CoreNavigationCommands.LastCursorMoveToSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_5, _super);
function class_5() {
return _super.call(this, {
id: '_lastCursorMoveToSelect',
precondition: undefined
}) || this;
}
class_5.prototype.runCoreEditorCommand = function (cursors, args) {
var context = cursors.context;
var lastAddedCursorIndex = cursors.getLastAddedCursorIndex();
var states = cursors.getAll();
var newStates = states.slice(0);
newStates[lastAddedCursorIndex] = cursorMoveCommands["b" /* CursorMoveCommands */].moveTo(context, states[lastAddedCursorIndex], true, args.position, args.viewPosition);
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, newStates);
};
return class_5;
}(CoreEditorCommand)));
var HomeCommand = /** @class */ (function (_super) {
__extends(HomeCommand, _super);
function HomeCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
HomeCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].moveToBeginningOfLine(cursors.context, cursors.getAll(), this._inSelectionMode));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return HomeCommand;
}(CoreEditorCommand));
CoreNavigationCommands.CursorHome = Object(editorExtensions["g" /* registerEditorCommand */])(new HomeCommand({
inSelectionMode: false,
id: 'cursorHome',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 14 /* Home */,
mac: { primary: 14 /* Home */, secondary: [2048 /* CtrlCmd */ | 15 /* LeftArrow */] }
}
}));
CoreNavigationCommands.CursorHomeSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new HomeCommand({
inSelectionMode: true,
id: 'cursorHomeSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 14 /* Home */,
mac: { primary: 1024 /* Shift */ | 14 /* Home */, secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 15 /* LeftArrow */] }
}
}));
CoreNavigationCommands.CursorLineStart = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_6, _super);
function class_6() {
return _super.call(this, {
id: 'cursorLineStart',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 0,
mac: { primary: 256 /* WinCtrl */ | 31 /* KEY_A */ }
}
}) || this;
}
class_6.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, this._exec(cursors.context, cursors.getAll()));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
class_6.prototype._exec = function (context, cursors) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var lineNumber = cursor.modelState.position.lineNumber;
result[i] = cursorCommon["d" /* CursorState */].fromModelState(cursor.modelState.move(false, lineNumber, 1, 0));
}
return result;
};
return class_6;
}(CoreEditorCommand)));
var EndCommand = /** @class */ (function (_super) {
__extends(EndCommand, _super);
function EndCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
EndCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].moveToEndOfLine(cursors.context, cursors.getAll(), this._inSelectionMode));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return EndCommand;
}(CoreEditorCommand));
CoreNavigationCommands.CursorEnd = Object(editorExtensions["g" /* registerEditorCommand */])(new EndCommand({
inSelectionMode: false,
id: 'cursorEnd',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 13 /* End */,
mac: { primary: 13 /* End */, secondary: [2048 /* CtrlCmd */ | 17 /* RightArrow */] }
}
}));
CoreNavigationCommands.CursorEndSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new EndCommand({
inSelectionMode: true,
id: 'cursorEndSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1024 /* Shift */ | 13 /* End */,
mac: { primary: 1024 /* Shift */ | 13 /* End */, secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 17 /* RightArrow */] }
}
}));
CoreNavigationCommands.CursorLineEnd = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_7, _super);
function class_7() {
return _super.call(this, {
id: 'cursorLineEnd',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 0,
mac: { primary: 256 /* WinCtrl */ | 35 /* KEY_E */ }
}
}) || this;
}
class_7.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, this._exec(cursors.context, cursors.getAll()));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
class_7.prototype._exec = function (context, cursors) {
var result = [];
for (var i = 0, len = cursors.length; i < len; i++) {
var cursor = cursors[i];
var lineNumber = cursor.modelState.position.lineNumber;
var maxColumn = context.model.getLineMaxColumn(lineNumber);
result[i] = cursorCommon["d" /* CursorState */].fromModelState(cursor.modelState.move(false, lineNumber, maxColumn, 0));
}
return result;
};
return class_7;
}(CoreEditorCommand)));
var TopCommand = /** @class */ (function (_super) {
__extends(TopCommand, _super);
function TopCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
TopCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].moveToBeginningOfBuffer(cursors.context, cursors.getAll(), this._inSelectionMode));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return TopCommand;
}(CoreEditorCommand));
CoreNavigationCommands.CursorTop = Object(editorExtensions["g" /* registerEditorCommand */])(new TopCommand({
inSelectionMode: false,
id: 'cursorTop',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 14 /* Home */,
mac: { primary: 2048 /* CtrlCmd */ | 16 /* UpArrow */ }
}
}));
CoreNavigationCommands.CursorTopSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new TopCommand({
inSelectionMode: true,
id: 'cursorTopSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 14 /* Home */,
mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 16 /* UpArrow */ }
}
}));
var BottomCommand = /** @class */ (function (_super) {
__extends(BottomCommand, _super);
function BottomCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
BottomCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].moveToEndOfBuffer(cursors.context, cursors.getAll(), this._inSelectionMode));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return BottomCommand;
}(CoreEditorCommand));
CoreNavigationCommands.CursorBottom = Object(editorExtensions["g" /* registerEditorCommand */])(new BottomCommand({
inSelectionMode: false,
id: 'cursorBottom',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 13 /* End */,
mac: { primary: 2048 /* CtrlCmd */ | 18 /* DownArrow */ }
}
}));
CoreNavigationCommands.CursorBottomSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new BottomCommand({
inSelectionMode: true,
id: 'cursorBottomSelect',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 13 /* End */,
mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 18 /* DownArrow */ }
}
}));
var EditorScrollImpl = /** @class */ (function (_super) {
__extends(EditorScrollImpl, _super);
function EditorScrollImpl() {
return _super.call(this, {
id: 'editorScroll',
precondition: undefined,
description: coreCommands_EditorScroll_.description
}) || this;
}
EditorScrollImpl.prototype.runCoreEditorCommand = function (cursors, args) {
var parsed = coreCommands_EditorScroll_.parse(args);
if (!parsed) {
// illegal arguments
return;
}
this._runEditorScroll(cursors, args.source, parsed);
};
EditorScrollImpl.prototype._runEditorScroll = function (cursors, source, args) {
var desiredScrollTop = this._computeDesiredScrollTop(cursors.context, args);
if (args.revealCursor) {
// must ensure cursor is in new visible range
var desiredVisibleViewRange = cursors.context.getCompletelyVisibleViewRangeAtScrollTop(desiredScrollTop);
cursors.setStates(source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].findPositionInViewportIfOutside(cursors.context, cursors.getPrimaryCursor(), desiredVisibleViewRange, args.select)
]);
}
cursors.scrollTo(desiredScrollTop);
};
EditorScrollImpl.prototype._computeDesiredScrollTop = function (context, args) {
if (args.unit === 1 /* Line */) {
// scrolling by model lines
var visibleModelRange = context.getCompletelyVisibleModelRange();
var desiredTopModelLineNumber = void 0;
if (args.direction === 1 /* Up */) {
// must go x model lines up
desiredTopModelLineNumber = Math.max(1, visibleModelRange.startLineNumber - args.value);
}
else {
// must go x model lines down
desiredTopModelLineNumber = Math.min(context.model.getLineCount(), visibleModelRange.startLineNumber + args.value);
}
var desiredTopViewPosition = context.convertModelPositionToViewPosition(new position["a" /* Position */](desiredTopModelLineNumber, 1));
return context.getVerticalOffsetForViewLine(desiredTopViewPosition.lineNumber);
}
var noOfLines;
if (args.unit === 3 /* Page */) {
noOfLines = context.config.pageSize * args.value;
}
else if (args.unit === 4 /* HalfPage */) {
noOfLines = Math.round(context.config.pageSize / 2) * args.value;
}
else {
noOfLines = args.value;
}
var deltaLines = (args.direction === 1 /* Up */ ? -1 : 1) * noOfLines;
return context.getCurrentScrollTop() + deltaLines * context.config.lineHeight;
};
return EditorScrollImpl;
}(CoreEditorCommand));
CoreNavigationCommands.EditorScrollImpl = EditorScrollImpl;
CoreNavigationCommands.EditorScroll = Object(editorExtensions["g" /* registerEditorCommand */])(new EditorScrollImpl());
CoreNavigationCommands.ScrollLineUp = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_8, _super);
function class_8() {
return _super.call(this, {
id: 'scrollLineUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 16 /* UpArrow */,
mac: { primary: 256 /* WinCtrl */ | 11 /* PageUp */ }
}
}) || this;
}
class_8.prototype.runCoreEditorCommand = function (cursors, args) {
CoreNavigationCommands.EditorScroll._runEditorScroll(cursors, args.source, {
direction: 1 /* Up */,
unit: 2 /* WrappedLine */,
value: 1,
revealCursor: false,
select: false
});
};
return class_8;
}(CoreEditorCommand)));
CoreNavigationCommands.ScrollPageUp = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_9, _super);
function class_9() {
return _super.call(this, {
id: 'scrollPageUp',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 11 /* PageUp */,
win: { primary: 512 /* Alt */ | 11 /* PageUp */ },
linux: { primary: 512 /* Alt */ | 11 /* PageUp */ }
}
}) || this;
}
class_9.prototype.runCoreEditorCommand = function (cursors, args) {
CoreNavigationCommands.EditorScroll._runEditorScroll(cursors, args.source, {
direction: 1 /* Up */,
unit: 3 /* Page */,
value: 1,
revealCursor: false,
select: false
});
};
return class_9;
}(CoreEditorCommand)));
CoreNavigationCommands.ScrollLineDown = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_10, _super);
function class_10() {
return _super.call(this, {
id: 'scrollLineDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 18 /* DownArrow */,
mac: { primary: 256 /* WinCtrl */ | 12 /* PageDown */ }
}
}) || this;
}
class_10.prototype.runCoreEditorCommand = function (cursors, args) {
CoreNavigationCommands.EditorScroll._runEditorScroll(cursors, args.source, {
direction: 2 /* Down */,
unit: 2 /* WrappedLine */,
value: 1,
revealCursor: false,
select: false
});
};
return class_10;
}(CoreEditorCommand)));
CoreNavigationCommands.ScrollPageDown = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_11, _super);
function class_11() {
return _super.call(this, {
id: 'scrollPageDown',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 12 /* PageDown */,
win: { primary: 512 /* Alt */ | 12 /* PageDown */ },
linux: { primary: 512 /* Alt */ | 12 /* PageDown */ }
}
}) || this;
}
class_11.prototype.runCoreEditorCommand = function (cursors, args) {
CoreNavigationCommands.EditorScroll._runEditorScroll(cursors, args.source, {
direction: 2 /* Down */,
unit: 3 /* Page */,
value: 1,
revealCursor: false,
select: false
});
};
return class_11;
}(CoreEditorCommand)));
var WordCommand = /** @class */ (function (_super) {
__extends(WordCommand, _super);
function WordCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
WordCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].word(cursors.context, cursors.getPrimaryCursor(), this._inSelectionMode, args.position)
]);
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return WordCommand;
}(CoreEditorCommand));
CoreNavigationCommands.WordSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new WordCommand({
inSelectionMode: false,
id: '_wordSelect',
precondition: undefined
}));
CoreNavigationCommands.WordSelectDrag = Object(editorExtensions["g" /* registerEditorCommand */])(new WordCommand({
inSelectionMode: true,
id: '_wordSelectDrag',
precondition: undefined
}));
CoreNavigationCommands.LastCursorWordSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_12, _super);
function class_12() {
return _super.call(this, {
id: 'lastCursorWordSelect',
precondition: undefined
}) || this;
}
class_12.prototype.runCoreEditorCommand = function (cursors, args) {
var context = cursors.context;
var lastAddedCursorIndex = cursors.getLastAddedCursorIndex();
var states = cursors.getAll();
var newStates = states.slice(0);
var lastAddedState = states[lastAddedCursorIndex];
newStates[lastAddedCursorIndex] = cursorMoveCommands["b" /* CursorMoveCommands */].word(context, lastAddedState, lastAddedState.modelState.hasSelection(), args.position);
context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, newStates);
};
return class_12;
}(CoreEditorCommand)));
var LineCommand = /** @class */ (function (_super) {
__extends(LineCommand, _super);
function LineCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
LineCommand.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].line(cursors.context, cursors.getPrimaryCursor(), this._inSelectionMode, args.position, args.viewPosition)
]);
cursors.reveal(args.source, false, 0 /* Primary */, 0 /* Smooth */);
};
return LineCommand;
}(CoreEditorCommand));
CoreNavigationCommands.LineSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new LineCommand({
inSelectionMode: false,
id: '_lineSelect',
precondition: undefined
}));
CoreNavigationCommands.LineSelectDrag = Object(editorExtensions["g" /* registerEditorCommand */])(new LineCommand({
inSelectionMode: true,
id: '_lineSelectDrag',
precondition: undefined
}));
var LastCursorLineCommand = /** @class */ (function (_super) {
__extends(LastCursorLineCommand, _super);
function LastCursorLineCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._inSelectionMode = opts.inSelectionMode;
return _this;
}
LastCursorLineCommand.prototype.runCoreEditorCommand = function (cursors, args) {
var lastAddedCursorIndex = cursors.getLastAddedCursorIndex();
var states = cursors.getAll();
var newStates = states.slice(0);
newStates[lastAddedCursorIndex] = cursorMoveCommands["b" /* CursorMoveCommands */].line(cursors.context, states[lastAddedCursorIndex], this._inSelectionMode, args.position, args.viewPosition);
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, newStates);
};
return LastCursorLineCommand;
}(CoreEditorCommand));
CoreNavigationCommands.LastCursorLineSelect = Object(editorExtensions["g" /* registerEditorCommand */])(new LastCursorLineCommand({
inSelectionMode: false,
id: 'lastCursorLineSelect',
precondition: undefined
}));
CoreNavigationCommands.LastCursorLineSelectDrag = Object(editorExtensions["g" /* registerEditorCommand */])(new LastCursorLineCommand({
inSelectionMode: true,
id: 'lastCursorLineSelectDrag',
precondition: undefined
}));
CoreNavigationCommands.ExpandLineSelection = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_13, _super);
function class_13() {
return _super.call(this, {
id: 'expandLineSelection',
precondition: undefined,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 42 /* KEY_L */
}
}) || this;
}
class_13.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, cursorMoveCommands["b" /* CursorMoveCommands */].expandLineSelection(cursors.context, cursors.getAll()));
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return class_13;
}(CoreEditorCommand)));
CoreNavigationCommands.CancelSelection = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_14, _super);
function class_14() {
return _super.call(this, {
id: 'cancelSelection',
precondition: editorContextKeys["a" /* EditorContextKeys */].hasNonEmptySelection,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 9 /* Escape */,
secondary: [1024 /* Shift */ | 9 /* Escape */]
}
}) || this;
}
class_14.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].cancelSelection(cursors.context, cursors.getPrimaryCursor())
]);
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return class_14;
}(CoreEditorCommand)));
CoreNavigationCommands.RemoveSecondaryCursors = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_15, _super);
function class_15() {
return _super.call(this, {
id: 'removeSecondaryCursors',
precondition: editorContextKeys["a" /* EditorContextKeys */].hasMultipleSelections,
kbOpts: {
weight: CORE_WEIGHT + 1,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 9 /* Escape */,
secondary: [1024 /* Shift */ | 9 /* Escape */]
}
}) || this;
}
class_15.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursors.getPrimaryCursor()
]);
cursors.reveal(args.source, true, 0 /* Primary */, 0 /* Smooth */);
};
return class_15;
}(CoreEditorCommand)));
CoreNavigationCommands.RevealLine = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_16, _super);
function class_16() {
return _super.call(this, {
id: 'revealLine',
precondition: undefined,
description: coreCommands_RevealLine_.description
}) || this;
}
class_16.prototype.runCoreEditorCommand = function (cursors, args) {
var revealLineArg = args;
var lineNumber = (revealLineArg.lineNumber || 0) + 1;
if (lineNumber < 1) {
lineNumber = 1;
}
var lineCount = cursors.context.model.getLineCount();
if (lineNumber > lineCount) {
lineNumber = lineCount;
}
var range = new core_range["a" /* Range */](lineNumber, 1, lineNumber, cursors.context.model.getLineMaxColumn(lineNumber));
var revealAt = 0 /* Simple */;
if (revealLineArg.at) {
switch (revealLineArg.at) {
case coreCommands_RevealLine_.RawAtArgument.Top:
revealAt = 3 /* Top */;
break;
case coreCommands_RevealLine_.RawAtArgument.Center:
revealAt = 1 /* Center */;
break;
case coreCommands_RevealLine_.RawAtArgument.Bottom:
revealAt = 4 /* Bottom */;
break;
default:
break;
}
}
var viewRange = cursors.context.convertModelRangeToViewRange(range);
cursors.revealRange(args.source, false, viewRange, revealAt, 0 /* Smooth */);
};
return class_16;
}(CoreEditorCommand)));
CoreNavigationCommands.SelectAll = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_17, _super);
function class_17() {
return _super.call(this, {
id: 'selectAll',
precondition: undefined
}) || this;
}
class_17.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorMoveCommands["b" /* CursorMoveCommands */].selectAll(cursors.context, cursors.getPrimaryCursor())
]);
};
return class_17;
}(CoreEditorCommand)));
CoreNavigationCommands.SetSelection = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_18, _super);
function class_18() {
return _super.call(this, {
id: 'setSelection',
precondition: undefined
}) || this;
}
class_18.prototype.runCoreEditorCommand = function (cursors, args) {
cursors.context.model.pushStackElement();
cursors.setStates(args.source, 3 /* Explicit */, [
cursorCommon["d" /* CursorState */].fromModelSelection(args.selection)
]);
};
return class_18;
}(CoreEditorCommand)));
})(coreCommands_CoreNavigationCommands || (coreCommands_CoreNavigationCommands = {}));
var coreCommands_CoreEditingCommands;
(function (CoreEditingCommands) {
var CoreEditingCommand = /** @class */ (function (_super) {
__extends(CoreEditingCommand, _super);
function CoreEditingCommand() {
return _super !== null && _super.apply(this, arguments) || this;
}
CoreEditingCommand.prototype.runEditorCommand = function (accessor, editor, args) {
var cursors = editor._getCursors();
if (!cursors) {
// the editor has no view => has no cursors
return;
}
this.runCoreEditingCommand(editor, cursors, args || {});
};
return CoreEditingCommand;
}(editorExtensions["c" /* EditorCommand */]));
CoreEditingCommands.CoreEditingCommand = CoreEditingCommand;
CoreEditingCommands.LineBreakInsert = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_19, _super);
function class_19() {
return _super.call(this, {
id: 'lineBreakInsert',
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 0,
mac: { primary: 256 /* WinCtrl */ | 45 /* KEY_O */ }
}
}) || this;
}
class_19.prototype.runCoreEditingCommand = function (editor, cursors, args) {
editor.pushUndoStop();
editor.executeCommands(this.id, cursorTypeOperations["a" /* TypeOperations */].lineBreakInsert(cursors.context.config, cursors.context.model, cursors.getAll().map(function (s) { return s.modelState.selection; })));
};
return class_19;
}(CoreEditingCommand)));
CoreEditingCommands.Outdent = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_20, _super);
function class_20() {
return _super.call(this, {
id: 'outdent',
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: contextkey["a" /* ContextKeyExpr */].and(editorContextKeys["a" /* EditorContextKeys */].editorTextFocus, editorContextKeys["a" /* EditorContextKeys */].tabDoesNotMoveFocus),
primary: 1024 /* Shift */ | 2 /* Tab */
}
}) || this;
}
class_20.prototype.runCoreEditingCommand = function (editor, cursors, args) {
editor.pushUndoStop();
editor.executeCommands(this.id, cursorTypeOperations["a" /* TypeOperations */].outdent(cursors.context.config, cursors.context.model, cursors.getAll().map(function (s) { return s.modelState.selection; })));
editor.pushUndoStop();
};
return class_20;
}(CoreEditingCommand)));
CoreEditingCommands.Tab = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_21, _super);
function class_21() {
return _super.call(this, {
id: 'tab',
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: contextkey["a" /* ContextKeyExpr */].and(editorContextKeys["a" /* EditorContextKeys */].editorTextFocus, editorContextKeys["a" /* EditorContextKeys */].tabDoesNotMoveFocus),
primary: 2 /* Tab */
}
}) || this;
}
class_21.prototype.runCoreEditingCommand = function (editor, cursors, args) {
editor.pushUndoStop();
editor.executeCommands(this.id, cursorTypeOperations["a" /* TypeOperations */].tab(cursors.context.config, cursors.context.model, cursors.getAll().map(function (s) { return s.modelState.selection; })));
editor.pushUndoStop();
};
return class_21;
}(CoreEditingCommand)));
CoreEditingCommands.DeleteLeft = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_22, _super);
function class_22() {
return _super.call(this, {
id: 'deleteLeft',
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 1 /* Backspace */,
secondary: [1024 /* Shift */ | 1 /* Backspace */],
mac: { primary: 1 /* Backspace */, secondary: [1024 /* Shift */ | 1 /* Backspace */, 256 /* WinCtrl */ | 38 /* KEY_H */, 256 /* WinCtrl */ | 1 /* Backspace */] }
}
}) || this;
}
class_22.prototype.runCoreEditingCommand = function (editor, cursors, args) {
var _a = cursorDeleteOperations["a" /* DeleteOperations */].deleteLeft(cursors.getPrevEditOperationType(), cursors.context.config, cursors.context.model, cursors.getAll().map(function (s) { return s.modelState.selection; })), shouldPushStackElementBefore = _a[0], commands = _a[1];
if (shouldPushStackElementBefore) {
editor.pushUndoStop();
}
editor.executeCommands(this.id, commands);
cursors.setPrevEditOperationType(2 /* DeletingLeft */);
};
return class_22;
}(CoreEditingCommand)));
CoreEditingCommands.DeleteRight = Object(editorExtensions["g" /* registerEditorCommand */])(new /** @class */ (function (_super) {
__extends(class_23, _super);
function class_23() {
return _super.call(this, {
id: 'deleteRight',
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 20 /* Delete */,
mac: { primary: 20 /* Delete */, secondary: [256 /* WinCtrl */ | 34 /* KEY_D */, 256 /* WinCtrl */ | 20 /* Delete */] }
}
}) || this;
}
class_23.prototype.runCoreEditingCommand = function (editor, cursors, args) {
var _a = cursorDeleteOperations["a" /* DeleteOperations */].deleteRight(cursors.getPrevEditOperationType(), cursors.context.config, cursors.context.model, cursors.getAll().map(function (s) { return s.modelState.selection; })), shouldPushStackElementBefore = _a[0], commands = _a[1];
if (shouldPushStackElementBefore) {
editor.pushUndoStop();
}
editor.executeCommands(this.id, commands);
cursors.setPrevEditOperationType(3 /* DeletingRight */);
};
return class_23;
}(CoreEditingCommand)));
})(coreCommands_CoreEditingCommands || (coreCommands_CoreEditingCommands = {}));
function registerCommand(command) {
command.register();
}
/**
* A command that will:
* 1. invoke a command on the focused editor.
* 2. otherwise, invoke a browser built-in command on the `activeElement`.
* 3. otherwise, invoke a command on the workbench active editor.
*/
var coreCommands_EditorOrNativeTextInputCommand = /** @class */ (function (_super) {
__extends(EditorOrNativeTextInputCommand, _super);
function EditorOrNativeTextInputCommand(opts) {
var _this = _super.call(this, opts) || this;
_this._editorHandler = opts.editorHandler;
_this._inputHandler = opts.inputHandler;
return _this;
}
EditorOrNativeTextInputCommand.prototype.runCommand = function (accessor, args) {
var focusedEditor = accessor.get(codeEditorService["a" /* ICodeEditorService */]).getFocusedCodeEditor();
// Only if editor text focus (i.e. not if editor has widget focus).
if (focusedEditor && focusedEditor.hasTextFocus()) {
return this._runEditorHandler(accessor, focusedEditor, args);
}
// Ignore this action when user is focused on an element that allows for entering text
var activeElement = document.activeElement;
if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {
document.execCommand(this._inputHandler);
return;
}
// Redirecting to active editor
var activeEditor = accessor.get(codeEditorService["a" /* ICodeEditorService */]).getActiveCodeEditor();
if (activeEditor) {
activeEditor.focus();
return this._runEditorHandler(accessor, activeEditor, args);
}
};
EditorOrNativeTextInputCommand.prototype._runEditorHandler = function (accessor, editor, args) {
var HANDLER = this._editorHandler;
if (typeof HANDLER === 'string') {
editor.trigger('keyboard', HANDLER, args);
}
else {
args = args || {};
args.source = 'keyboard';
HANDLER.runEditorCommand(accessor, editor, args);
}
};
return EditorOrNativeTextInputCommand;
}(editorExtensions["a" /* Command */]));
/**
* A command that will invoke a command on the focused editor.
*/
var coreCommands_EditorHandlerCommand = /** @class */ (function (_super) {
__extends(EditorHandlerCommand, _super);
function EditorHandlerCommand(id, handlerId, description) {
var _this = _super.call(this, {
id: id,
precondition: undefined,
description: description
}) || this;
_this._handlerId = handlerId;
return _this;
}
EditorHandlerCommand.prototype.runCommand = function (accessor, args) {
var editor = accessor.get(codeEditorService["a" /* ICodeEditorService */]).getFocusedCodeEditor();
if (!editor) {
return;
}
editor.trigger('keyboard', this._handlerId, args);
};
return EditorHandlerCommand;
}(editorExtensions["a" /* Command */]));
registerCommand(new coreCommands_EditorOrNativeTextInputCommand({
editorHandler: coreCommands_CoreNavigationCommands.SelectAll,
inputHandler: 'selectAll',
id: 'editor.action.selectAll',
precondition: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: null,
primary: 2048 /* CtrlCmd */ | 31 /* KEY_A */
},
menuOpts: {
menuId: 25 /* MenubarSelectionMenu */,
group: '1_basic',
title: nls["a" /* localize */]({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"),
order: 1
}
}));
registerCommand(new coreCommands_EditorOrNativeTextInputCommand({
editorHandler: editorCommon["b" /* Handler */].Undo,
inputHandler: 'undo',
id: editorCommon["b" /* Handler */].Undo,
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 56 /* KEY_Z */
},
menuOpts: {
menuId: 17 /* MenubarEditMenu */,
group: '1_do',
title: nls["a" /* localize */]({ key: 'miUndo', comment: ['&& denotes a mnemonic'] }, "&&Undo"),
order: 1
}
}));
registerCommand(new coreCommands_EditorHandlerCommand('default:' + editorCommon["b" /* Handler */].Undo, editorCommon["b" /* Handler */].Undo));
registerCommand(new coreCommands_EditorOrNativeTextInputCommand({
editorHandler: editorCommon["b" /* Handler */].Redo,
inputHandler: 'redo',
id: editorCommon["b" /* Handler */].Redo,
precondition: editorContextKeys["a" /* EditorContextKeys */].writable,
kbOpts: {
weight: CORE_WEIGHT,
kbExpr: editorContextKeys["a" /* EditorContextKeys */].textInputFocus,
primary: 2048 /* CtrlCmd */ | 55 /* KEY_Y */,
secondary: [2048 /* CtrlCmd */ | 1024 /* Shift */ | 56 /* KEY_Z */],
mac: { primary: 2048 /* CtrlCmd */ | 1024 /* Shift */ | 56 /* KEY_Z */ }
},
menuOpts: {
menuId: 17 /* MenubarEditMenu */,
group: '1_do',
title: nls["a" /* localize */]({ key: 'miRedo', comment: ['&& denotes a mnemonic'] }, "&&Redo"),
order: 2
}
}));
registerCommand(new coreCommands_EditorHandlerCommand('default:' + editorCommon["b" /* Handler */].Redo, editorCommon["b" /* Handler */].Redo));
function registerOverwritableCommand(handlerId, description) {
registerCommand(new coreCommands_EditorHandlerCommand('default:' + handlerId, handlerId));
registerCommand(new coreCommands_EditorHandlerCommand(handlerId, handlerId, description));
}
registerOverwritableCommand(editorCommon["b" /* Handler */].Type, {
description: "Type",
args: [{
name: 'args',
schema: {
'type': 'object',
'required': ['text'],
'properties': {
'text': {
'type': 'string'
}
},
}
}]
});
registerOverwritableCommand(editorCommon["b" /* Handler */].ReplacePreviousChar);
registerOverwritableCommand(editorCommon["b" /* Handler */].CompositionStart);
registerOverwritableCommand(editorCommon["b" /* Handler */].CompositionEnd);
registerOverwritableCommand(editorCommon["b" /* Handler */].Paste);
registerOverwritableCommand(editorCommon["b" /* Handler */].Cut);
/***/ }),
/* 94 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineTokens; });
/* unused harmony export SlicedLineTokens */
/* harmony import */ var _modes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LineTokens = /** @class */ (function () {
function LineTokens(tokens, text) {
this._tokens = tokens;
this._tokensCount = (this._tokens.length >>> 1);
this._text = text;
}
LineTokens.prototype.equals = function (other) {
if (other instanceof LineTokens) {
return this.slicedEquals(other, 0, this._tokensCount);
}
return false;
};
LineTokens.prototype.slicedEquals = function (other, sliceFromTokenIndex, sliceTokenCount) {
if (this._text !== other._text) {
return false;
}
if (this._tokensCount !== other._tokensCount) {
return false;
}
var from = (sliceFromTokenIndex << 1);
var to = from + (sliceTokenCount << 1);
for (var i = from; i < to; i++) {
if (this._tokens[i] !== other._tokens[i]) {
return false;
}
}
return true;
};
LineTokens.prototype.getLineContent = function () {
return this._text;
};
LineTokens.prototype.getCount = function () {
return this._tokensCount;
};
LineTokens.prototype.getStartOffset = function (tokenIndex) {
if (tokenIndex > 0) {
return this._tokens[(tokenIndex - 1) << 1];
}
return 0;
};
LineTokens.prototype.getMetadata = function (tokenIndex) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return metadata;
};
LineTokens.prototype.getLanguageId = function (tokenIndex) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return _modes_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenMetadata */ "A"].getLanguageId(metadata);
};
LineTokens.prototype.getStandardTokenType = function (tokenIndex) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return _modes_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenMetadata */ "A"].getTokenType(metadata);
};
LineTokens.prototype.getForeground = function (tokenIndex) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return _modes_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenMetadata */ "A"].getForeground(metadata);
};
LineTokens.prototype.getClassName = function (tokenIndex) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return _modes_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenMetadata */ "A"].getClassNameFromMetadata(metadata);
};
LineTokens.prototype.getInlineStyle = function (tokenIndex, colorMap) {
var metadata = this._tokens[(tokenIndex << 1) + 1];
return _modes_js__WEBPACK_IMPORTED_MODULE_0__[/* TokenMetadata */ "A"].getInlineStyleFromMetadata(metadata, colorMap);
};
LineTokens.prototype.getEndOffset = function (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.
*/
LineTokens.prototype.findTokenIndexAtOffset = function (offset) {
return LineTokens.findIndexInTokensArray(this._tokens, offset);
};
LineTokens.prototype.inflate = function () {
return this;
};
LineTokens.prototype.sliceAndInflate = function (startOffset, endOffset, deltaOffset) {
return new SlicedLineTokens(this, startOffset, endOffset, deltaOffset);
};
LineTokens.convertToEndOffset = function (tokens, lineTextLength) {
var tokenCount = (tokens.length >>> 1);
var lastTokenIndex = tokenCount - 1;
for (var tokenIndex = 0; tokenIndex < lastTokenIndex; tokenIndex++) {
tokens[tokenIndex << 1] = tokens[(tokenIndex + 1) << 1];
}
tokens[lastTokenIndex << 1] = lineTextLength;
};
LineTokens.findIndexInTokensArray = function (tokens, desiredIndex) {
if (tokens.length <= 2) {
return 0;
}
var low = 0;
var high = (tokens.length >>> 1) - 1;
while (low < high) {
var mid = low + Math.floor((high - low) / 2);
var 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;
};
return LineTokens;
}());
var SlicedLineTokens = /** @class */ (function () {
function SlicedLineTokens(source, startOffset, endOffset, deltaOffset) {
this._source = source;
this._startOffset = startOffset;
this._endOffset = endOffset;
this._deltaOffset = deltaOffset;
this._firstTokenIndex = source.findTokenIndexAtOffset(startOffset);
this._tokensCount = 0;
for (var i = this._firstTokenIndex, len = source.getCount(); i < len; i++) {
var tokenStartOffset = source.getStartOffset(i);
if (tokenStartOffset >= endOffset) {
break;
}
this._tokensCount++;
}
}
SlicedLineTokens.prototype.equals = function (other) {
if (other instanceof SlicedLineTokens) {
return (this._startOffset === other._startOffset
&& this._endOffset === other._endOffset
&& this._deltaOffset === other._deltaOffset
&& this._source.slicedEquals(other._source, this._firstTokenIndex, this._tokensCount));
}
return false;
};
SlicedLineTokens.prototype.getCount = function () {
return this._tokensCount;
};
SlicedLineTokens.prototype.getForeground = function (tokenIndex) {
return this._source.getForeground(this._firstTokenIndex + tokenIndex);
};
SlicedLineTokens.prototype.getEndOffset = function (tokenIndex) {
var tokenEndOffset = this._source.getEndOffset(this._firstTokenIndex + tokenIndex);
return Math.min(this._endOffset, tokenEndOffset) - this._startOffset + this._deltaOffset;
};
SlicedLineTokens.prototype.getClassName = function (tokenIndex) {
return this._source.getClassName(this._firstTokenIndex + tokenIndex);
};
SlicedLineTokens.prototype.getInlineStyle = function (tokenIndex, colorMap) {
return this._source.getInlineStyle(this._firstTokenIndex + tokenIndex, colorMap);
};
SlicedLineTokens.prototype.findTokenIndexAtOffset = function (offset) {
return this._source.findTokenIndexAtOffset(offset + this._startOffset - this._deltaOffset) - this._firstTokenIndex;
};
return SlicedLineTokens;
}());
/***/ }),
/* 95 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export createMemoizer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return memoize; });
var memoizeId = 0;
function createMemoizer() {
var memoizeKeyPrefix = "$memoize" + memoizeId++;
var self = undefined;
var result = function memoize(target, key, descriptor) {
var fnKey = null;
var 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');
}
var memoizeKey = memoizeKeyPrefix + ":" + key;
descriptor[fnKey] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
self = this;
if (!this.hasOwnProperty(memoizeKey)) {
Object.defineProperty(this, memoizeKey, {
configurable: true,
enumerable: false,
writable: true,
value: fn.apply(this, args)
});
}
return this[memoizeKey];
};
};
result.clear = function () {
if (typeof self === 'undefined') {
return;
}
Object.getOwnPropertyNames(self).forEach(function (property) {
if (property.indexOf(memoizeKeyPrefix) === 0) {
delete self[property];
}
});
};
return result;
}
function memoize(target, key, descriptor) {
return createMemoizer()(target, key, descriptor);
}
/***/ }),
/* 96 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createScopedLineTokens; });
/* unused harmony export ScopedLineTokens */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ignoreBracketsInToken; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function createScopedLineTokens(context, offset) {
var tokenCount = context.getCount();
var tokenIndex = context.findTokenIndexAtOffset(offset);
var desiredLanguageId = context.getLanguageId(tokenIndex);
var lastTokenIndex = tokenIndex;
while (lastTokenIndex + 1 < tokenCount && context.getLanguageId(lastTokenIndex + 1) === desiredLanguageId) {
lastTokenIndex++;
}
var 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));
}
var ScopedLineTokens = /** @class */ (function () {
function ScopedLineTokens(actual, languageId, firstTokenIndex, lastTokenIndex, firstCharOffset, lastCharOffset) {
this._actual = actual;
this.languageId = languageId;
this._firstTokenIndex = firstTokenIndex;
this._lastTokenIndex = lastTokenIndex;
this.firstCharOffset = firstCharOffset;
this._lastCharOffset = lastCharOffset;
}
ScopedLineTokens.prototype.getLineContent = function () {
var actualLineContent = this._actual.getLineContent();
return actualLineContent.substring(this.firstCharOffset, this._lastCharOffset);
};
ScopedLineTokens.prototype.getActualLineContentBefore = function (offset) {
var actualLineContent = this._actual.getLineContent();
return actualLineContent.substring(0, this.firstCharOffset + offset);
};
ScopedLineTokens.prototype.getTokenCount = function () {
return this._lastTokenIndex - this._firstTokenIndex;
};
ScopedLineTokens.prototype.findTokenIndexAtOffset = function (offset) {
return this._actual.findTokenIndexAtOffset(offset + this.firstCharOffset) - this._firstTokenIndex;
};
ScopedLineTokens.prototype.getStandardTokenType = function (tokenIndex) {
return this._actual.getStandardTokenType(tokenIndex + this._firstTokenIndex);
};
return ScopedLineTokens;
}());
function ignoreBracketsInToken(standardTokenType) {
return (standardTokenType & 7 /* value */) !== 0;
}
/***/ }),
/* 97 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBaseUrl; });
/* harmony import */ var _useDocusaurusContext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(66);
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function useBaseUrl(url){const{siteConfig}=Object(_useDocusaurusContext__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])();const{baseUrl='/'}=siteConfig||{};if(!url){return url;}const externalRegex=/^(https?:|\/\/)/;if(externalRegex.test(url)){return url;}if(url.startsWith('/')){return baseUrl+url.slice(1);}return baseUrl+url;}
/***/ }),
/* 98 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LinkedList; });
/* harmony import */ var _iterator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Node = /** @class */ (function () {
function Node(element) {
this.element = element;
this.next = Node.Undefined;
this.prev = Node.Undefined;
}
Node.Undefined = new Node(undefined);
return Node;
}());
var LinkedList = /** @class */ (function () {
function LinkedList() {
this._first = Node.Undefined;
this._last = Node.Undefined;
this._size = 0;
}
Object.defineProperty(LinkedList.prototype, "size", {
get: function () {
return this._size;
},
enumerable: true,
configurable: true
});
LinkedList.prototype.isEmpty = function () {
return this._first === Node.Undefined;
};
LinkedList.prototype.clear = function () {
this._first = Node.Undefined;
this._last = Node.Undefined;
this._size = 0;
};
LinkedList.prototype.unshift = function (element) {
return this._insert(element, false);
};
LinkedList.prototype.push = function (element) {
return this._insert(element, true);
};
LinkedList.prototype._insert = function (element, atTheEnd) {
var _this = this;
var newNode = new Node(element);
if (this._first === Node.Undefined) {
this._first = newNode;
this._last = newNode;
}
else if (atTheEnd) {
// push
var oldLast = this._last;
this._last = newNode;
newNode.prev = oldLast;
oldLast.next = newNode;
}
else {
// unshift
var oldFirst = this._first;
this._first = newNode;
newNode.next = oldFirst;
oldFirst.prev = newNode;
}
this._size += 1;
var didRemove = false;
return function () {
if (!didRemove) {
didRemove = true;
_this._remove(newNode);
}
};
};
LinkedList.prototype.shift = function () {
if (this._first === Node.Undefined) {
return undefined;
}
else {
var res = this._first.element;
this._remove(this._first);
return res;
}
};
LinkedList.prototype.pop = function () {
if (this._last === Node.Undefined) {
return undefined;
}
else {
var res = this._last.element;
this._remove(this._last);
return res;
}
};
LinkedList.prototype._remove = function (node) {
if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {
// middle
var 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;
};
LinkedList.prototype.iterator = function () {
var element;
var node = this._first;
return {
next: function () {
if (node === Node.Undefined) {
return _iterator_js__WEBPACK_IMPORTED_MODULE_0__[/* FIN */ "c"];
}
if (!element) {
element = { done: false, value: node.element };
}
else {
element.value = node.element;
}
node = node.next;
return element;
}
};
};
LinkedList.prototype.toArray = function () {
var result = [];
for (var node = this._first; node !== Node.Undefined; node = node.next) {
result.push(node.element);
}
return result;
};
return LinkedList;
}());
/***/ }),
/* 99 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export RichEditBracket */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return RichEditBrackets; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BracketsUtils; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var RichEditBracket = /** @class */ (function () {
function RichEditBracket(languageIdentifier, index, open, close, forwardRegex, reversedRegex) {
this.languageIdentifier = languageIdentifier;
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);
}
RichEditBracket.prototype.isOpen = function (text) {
return this._openSet.has(text);
};
RichEditBracket.prototype.isClose = function (text) {
return this._closeSet.has(text);
};
RichEditBracket._toSet = function (arr) {
var result = new Set();
for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
var element = arr_1[_i];
result.add(element);
}
return result;
};
return RichEditBracket;
}());
function groupFuzzyBrackets(brackets) {
var N = brackets.length;
brackets = brackets.map(function (b) { return [b[0].toLowerCase(), b[1].toLowerCase()]; });
var group = [];
for (var i = 0; i < N; i++) {
group[i] = i;
}
var areOverlapping = function (a, b) {
var aOpen = a[0], aClose = a[1];
var bOpen = b[0], bClose = b[1];
return (aOpen === bOpen || aOpen === bClose || aClose === bOpen || aClose === bClose);
};
var mergeGroups = function (g1, g2) {
var newG = Math.min(g1, g2);
var oldG = Math.max(g1, g2);
for (var i = 0; i < N; i++) {
if (group[i] === oldG) {
group[i] = newG;
}
}
};
// group together brackets that have the same open or the same close sequence
for (var i = 0; i < N; i++) {
var a = brackets[i];
for (var j = i + 1; j < N; j++) {
var b = brackets[j];
if (areOverlapping(a, b)) {
mergeGroups(group[i], group[j]);
}
}
}
var result = [];
for (var g = 0; g < N; g++) {
var currentOpen = [];
var currentClose = [];
for (var i = 0; i < N; i++) {
if (group[i] === g) {
var _a = brackets[i], open_1 = _a[0], close_1 = _a[1];
currentOpen.push(open_1);
currentClose.push(close_1);
}
}
if (currentOpen.length > 0) {
result.push({
open: currentOpen,
close: currentClose
});
}
}
return result;
}
var RichEditBrackets = /** @class */ (function () {
function RichEditBrackets(languageIdentifier, _brackets) {
var brackets = groupFuzzyBrackets(_brackets);
this.brackets = brackets.map(function (b, index) {
return new RichEditBracket(languageIdentifier, 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 (var _i = 0, _a = this.brackets; _i < _a.length; _i++) {
var bracket = _a[_i];
for (var _b = 0, _c = bracket.open; _b < _c.length; _b++) {
var open_2 = _c[_b];
this.textIsBracket[open_2] = bracket;
this.textIsOpenBracket[open_2] = true;
this.maxBracketLength = Math.max(this.maxBracketLength, open_2.length);
}
for (var _d = 0, _e = bracket.close; _d < _e.length; _d++) {
var close_2 = _e[_d];
this.textIsBracket[close_2] = bracket;
this.textIsOpenBracket[close_2] = false;
this.maxBracketLength = Math.max(this.maxBracketLength, close_2.length);
}
}
}
return RichEditBrackets;
}());
function collectSuperstrings(str, brackets, currentIndex, dest) {
for (var i = 0, len = brackets.length; i < len; i++) {
if (i === currentIndex) {
continue;
}
var bracket = brackets[i];
for (var _i = 0, _a = bracket.open; _i < _a.length; _i++) {
var open_3 = _a[_i];
if (open_3.indexOf(str) >= 0) {
dest.push(open_3);
}
}
for (var _b = 0, _c = bracket.close; _b < _c.length; _b++) {
var close_3 = _c[_b];
if (close_3.indexOf(str) >= 0) {
dest.push(close_3);
}
}
}
}
function lengthcmp(a, b) {
return a.length - b.length;
}
function unique(arr) {
if (arr.length <= 1) {
return arr;
}
var result = [];
var seen = new Set();
for (var _i = 0, arr_2 = arr; _i < arr_2.length; _i++) {
var element = arr_2[_i];
if (seen.has(element)) {
continue;
}
result.push(element);
seen.add(element);
}
return result;
}
function getRegexForBracketPair(open, close, brackets, currentIndex) {
// search in all brackets for other brackets that are a superstring of these brackets
var pieces = [];
pieces = pieces.concat(open);
pieces = pieces.concat(close);
for (var 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) {
// search in all brackets for other brackets that are a superstring of these brackets
var pieces = [];
pieces = pieces.concat(open);
pieces = pieces.concat(close);
for (var 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) {
var pieces = [];
for (var _i = 0, brackets_1 = brackets; _i < brackets_1.length; _i++) {
var bracket = brackets_1[_i];
for (var _a = 0, _b = bracket.open; _a < _b.length; _a++) {
var open_4 = _b[_a];
pieces.push(open_4);
}
for (var _c = 0, _d = bracket.close; _c < _d.length; _c++) {
var close_4 = _d[_c];
pieces.push(close_4);
}
}
pieces = unique(pieces);
return createBracketOrRegExp(pieces);
}
function getReversedRegexForBrackets(brackets) {
var pieces = [];
for (var _i = 0, brackets_2 = brackets; _i < brackets_2.length; _i++) {
var bracket = brackets_2[_i];
for (var _a = 0, _b = bracket.open; _a < _b.length; _a++) {
var open_5 = _b[_a];
pieces.push(open_5);
}
for (var _c = 0, _d = bracket.close; _c < _d.length; _c++) {
var close_5 = _d[_c];
pieces.push(close_5);
}
}
pieces = unique(pieces);
return createBracketOrRegExp(pieces.map(toReversedString));
}
function prepareBracketForRegExp(str) {
// This bracket pair uses letters like e.g. "begin" - "end"
var insertWordBoundaries = (/^[\w ]+$/.test(str));
str = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* escapeRegExpCharacters */ "p"](str);
return (insertWordBoundaries ? "\\b" + str + "\\b" : str);
}
function createBracketOrRegExp(pieces) {
var regexStr = "(" + pieces.map(prepareBracketForRegExp).join(')|(') + ")";
return _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* createRegExp */ "l"](regexStr, true);
}
var toReversedString = (function () {
function reverse(str) {
var reversedStr = '';
for (var i = str.length - 1; i >= 0; i--) {
reversedStr += str.charAt(i);
}
return reversedStr;
}
var lastInput = null;
var lastOutput = null;
return function toReversedString(str) {
if (lastInput !== str) {
lastInput = str;
lastOutput = reverse(lastInput);
}
return lastOutput;
};
})();
var BracketsUtils = /** @class */ (function () {
function BracketsUtils() {
}
BracketsUtils._findPrevBracketInText = function (reversedBracketRegex, lineNumber, reversedText, offset) {
var m = reversedText.match(reversedBracketRegex);
if (!m) {
return null;
}
var matchOffset = reversedText.length - (m.index || 0);
var matchLength = m[0].length;
var absoluteMatchOffset = offset + matchOffset;
return new _core_range_js__WEBPACK_IMPORTED_MODULE_1__[/* Range */ "a"](lineNumber, absoluteMatchOffset - matchLength + 1, lineNumber, absoluteMatchOffset + 1);
};
BracketsUtils.findPrevBracketInRange = function (reversedBracketRegex, lineNumber, lineText, startOffset, endOffset) {
// Because JS does not support backwards regex search, we search forwards in a reversed string with a reversed regex ;)
var reversedLineText = toReversedString(lineText);
var reversedSubstr = reversedLineText.substring(lineText.length - endOffset, lineText.length - startOffset);
return this._findPrevBracketInText(reversedBracketRegex, lineNumber, reversedSubstr, startOffset);
};
BracketsUtils.findNextBracketInText = function (bracketRegex, lineNumber, text, offset) {
var m = text.match(bracketRegex);
if (!m) {
return null;
}
var matchOffset = m.index || 0;
var matchLength = m[0].length;
if (matchLength === 0) {
return null;
}
var absoluteMatchOffset = offset + matchOffset;
return new _core_range_js__WEBPACK_IMPORTED_MODULE_1__[/* Range */ "a"](lineNumber, absoluteMatchOffset + 1, lineNumber, absoluteMatchOffset + 1 + matchLength);
};
BracketsUtils.findNextBracketInRange = function (bracketRegex, lineNumber, lineText, startOffset, endOffset) {
var substr = lineText.substring(startOffset, endOffset);
return this.findNextBracketInText(bracketRegex, lineNumber, substr, startOffset);
};
return BracketsUtils;
}());
/***/ }),
/* 100 */
/***/ (function(module, exports) {
var Marker = {
ASTERISK: '*',
AT: '@',
BACK_SLASH: '\\',
CARRIAGE_RETURN: '\r',
CLOSE_CURLY_BRACKET: '}',
CLOSE_ROUND_BRACKET: ')',
CLOSE_SQUARE_BRACKET: ']',
COLON: ':',
COMMA: ',',
DOUBLE_QUOTE: '"',
EXCLAMATION: '!',
FORWARD_SLASH: '/',
INTERNAL: '-clean-css-',
NEW_LINE_NIX: '\n',
OPEN_CURLY_BRACKET: '{',
OPEN_ROUND_BRACKET: '(',
OPEN_SQUARE_BRACKET: '[',
SEMICOLON: ';',
SINGLE_QUOTE: '\'',
SPACE: ' ',
TAB: '\t',
UNDERSCORE: '_'
};
module.exports = Marker;
/***/ }),
/* 101 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IModeService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IModeService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('modeService');
/***/ }),
/* 102 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ITextModelService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ITextModelService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('textModelService');
/***/ }),
/* 103 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CharacterClassifier; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CharacterSet; });
/* harmony import */ var _base_common_uint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(137);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* A fast character classifier that uses a compact array for ASCII values.
*/
var CharacterClassifier = /** @class */ (function () {
function CharacterClassifier(_defaultValue) {
var defaultValue = Object(_base_common_uint_js__WEBPACK_IMPORTED_MODULE_0__[/* toUint8 */ "b"])(_defaultValue);
this._defaultValue = defaultValue;
this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);
this._map = new Map();
}
CharacterClassifier._createAsciiMap = function (defaultValue) {
var asciiMap = new Uint8Array(256);
for (var i = 0; i < 256; i++) {
asciiMap[i] = defaultValue;
}
return asciiMap;
};
CharacterClassifier.prototype.set = function (charCode, _value) {
var value = Object(_base_common_uint_js__WEBPACK_IMPORTED_MODULE_0__[/* toUint8 */ "b"])(_value);
if (charCode >= 0 && charCode < 256) {
this._asciiMap[charCode] = value;
}
else {
this._map.set(charCode, value);
}
};
CharacterClassifier.prototype.get = function (charCode) {
if (charCode >= 0 && charCode < 256) {
return this._asciiMap[charCode];
}
else {
return (this._map.get(charCode) || this._defaultValue);
}
};
return CharacterClassifier;
}());
var CharacterSet = /** @class */ (function () {
function CharacterSet() {
this._actual = new CharacterClassifier(0 /* False */);
}
CharacterSet.prototype.add = function (charCode) {
this._actual.set(charCode, 1 /* True */);
};
CharacterSet.prototype.has = function (charCode) {
return (this._actual.get(charCode) === 1 /* True */);
};
return CharacterSet;
}());
/***/ }),
/* 104 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export WordCharacterClassifier */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getMapForWordSeparators; });
/* harmony import */ var _core_characterClassifier_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(103);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var WordCharacterClassifier = /** @class */ (function (_super) {
__extends(WordCharacterClassifier, _super);
function WordCharacterClassifier(wordSeparators) {
var _this = _super.call(this, 0 /* Regular */) || this;
for (var i = 0, len = wordSeparators.length; i < len; i++) {
_this.set(wordSeparators.charCodeAt(i), 2 /* WordSeparator */);
}
_this.set(32 /* Space */, 1 /* Whitespace */);
_this.set(9 /* Tab */, 1 /* Whitespace */);
return _this;
}
return WordCharacterClassifier;
}(_core_characterClassifier_js__WEBPACK_IMPORTED_MODULE_0__[/* CharacterClassifier */ "a"]));
function once(computeFn) {
var cache = {}; // TODO@Alex unbounded cache
return function (input) {
if (!cache.hasOwnProperty(input)) {
cache[input] = computeFn(input);
}
return cache[input];
};
}
var getMapForWordSeparators = once(function (input) { return new WordCharacterClassifier(input); });
/***/ }),
/* 105 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Token; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TokenizationResult; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return TokenizationResult2; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Token = /** @class */ (function () {
function Token(offset, type, language) {
this.offset = offset | 0; // @perf
this.type = type;
this.language = language;
}
Token.prototype.toString = function () {
return '(' + this.offset + ', ' + this.type + ')';
};
return Token;
}());
var TokenizationResult = /** @class */ (function () {
function TokenizationResult(tokens, endState) {
this.tokens = tokens;
this.endState = endState;
}
return TokenizationResult;
}());
var TokenizationResult2 = /** @class */ (function () {
function TokenizationResult2(tokens, endState) {
this.tokens = tokens;
this.endState = endState;
}
return TokenizationResult2;
}());
/***/ }),
/* 106 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ cursorTypeOperations_TypeOperations; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ cursorTypeOperations_TypeWithAutoClosingCommand; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/commands/replaceCommand.js
var replaceCommand = __webpack_require__(48);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/commands/shiftCommand.js
var shiftCommand = __webpack_require__(146);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var core_range = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/selection.js
var core_selection = __webpack_require__(24);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/commands/surroundSelectionCommand.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var surroundSelectionCommand_SurroundSelectionCommand = /** @class */ (function () {
function SurroundSelectionCommand(range, charBeforeSelection, charAfterSelection) {
this._range = range;
this._charBeforeSelection = charBeforeSelection;
this._charAfterSelection = charAfterSelection;
}
SurroundSelectionCommand.prototype.getEditOperations = function (model, builder) {
builder.addTrackedEditOperation(new core_range["a" /* Range */](this._range.startLineNumber, this._range.startColumn, this._range.startLineNumber, this._range.startColumn), this._charBeforeSelection);
builder.addTrackedEditOperation(new core_range["a" /* Range */](this._range.endLineNumber, this._range.endColumn, this._range.endLineNumber, this._range.endColumn), this._charAfterSelection);
};
SurroundSelectionCommand.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var firstOperationRange = inverseEditOperations[0].range;
var secondOperationRange = inverseEditOperations[1].range;
return new core_selection["a" /* Selection */](firstOperationRange.endLineNumber, firstOperationRange.endColumn, secondOperationRange.endLineNumber, secondOperationRange.endColumn - this._charAfterSelection.length);
};
return SurroundSelectionCommand;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCommon.js
var cursorCommon = __webpack_require__(23);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/wordCharacterClassifier.js
var wordCharacterClassifier = __webpack_require__(104);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfiguration.js
var languageConfiguration = __webpack_require__(56);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfigurationRegistry.js + 4 modules
var languageConfigurationRegistry = __webpack_require__(33);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorTypeOperations.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var cursorTypeOperations_TypeOperations = /** @class */ (function () {
function TypeOperations() {
}
TypeOperations.indent = function (config, model, selections) {
if (model === null || selections === null) {
return [];
}
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = new shiftCommand["a" /* ShiftCommand */](selections[i], {
isUnshift: false,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
});
}
return commands;
};
TypeOperations.outdent = function (config, model, selections) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = new shiftCommand["a" /* ShiftCommand */](selections[i], {
isUnshift: true,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
});
}
return commands;
};
TypeOperations.shiftIndent = function (config, indentation, count) {
count = count || 1;
return shiftCommand["a" /* ShiftCommand */].shiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
};
TypeOperations.unshiftIndent = function (config, indentation, count) {
count = count || 1;
return shiftCommand["a" /* ShiftCommand */].unshiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
};
TypeOperations._distributedPaste = function (config, model, selections, text) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = new replaceCommand["a" /* ReplaceCommand */](selections[i], text[i]);
}
return new cursorCommon["e" /* EditOperationResult */](0 /* Other */, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
};
TypeOperations._simplePaste = function (config, model, selections, text, pasteOnNewLine) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
var position = selection.getPosition();
if (pasteOnNewLine && !selection.isEmpty()) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && text.indexOf('\n') !== text.length - 1) {
pasteOnNewLine = false;
}
if (pasteOnNewLine) {
// Paste entire line at the beginning of line
var typeSelection = new core_range["a" /* Range */](position.lineNumber, 1, position.lineNumber, 1);
commands[i] = new replaceCommand["b" /* ReplaceCommandThatPreservesSelection */](typeSelection, text, selection, true);
}
else {
commands[i] = new replaceCommand["a" /* ReplaceCommand */](selection, text);
}
}
return new cursorCommon["e" /* EditOperationResult */](0 /* Other */, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
};
TypeOperations._distributePasteToCursors = function (config, selections, text, pasteOnNewLine, multicursorText) {
if (pasteOnNewLine) {
return null;
}
if (selections.length === 1) {
return null;
}
if (multicursorText && multicursorText.length === selections.length) {
return multicursorText;
}
if (config.multiCursorPaste === 'spread') {
// Try to spread the pasted text in case the line count matches the cursor count
// Remove trailing \n if present
if (text.charCodeAt(text.length - 1) === 10 /* LineFeed */) {
text = text.substr(0, text.length - 1);
}
// Remove trailing \r if present
if (text.charCodeAt(text.length - 1) === 13 /* CarriageReturn */) {
text = text.substr(0, text.length - 1);
}
var lines = text.split(/\r\n|\r|\n/);
if (lines.length === selections.length) {
return lines;
}
}
return null;
};
TypeOperations.paste = function (config, model, selections, text, pasteOnNewLine, multicursorText) {
var distributedPaste = this._distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText);
if (distributedPaste) {
selections = selections.sort(core_range["a" /* Range */].compareRangesUsingStarts);
return this._distributedPaste(config, model, selections, distributedPaste);
}
else {
return this._simplePaste(config, model, selections, text, pasteOnNewLine);
}
};
TypeOperations._goodIndentForLine = function (config, model, lineNumber) {
var action = null;
var indentation = '';
var expectedIndentAction = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getInheritIndentForLine(config.autoIndent, model, lineNumber, false);
if (expectedIndentAction) {
action = expectedIndentAction.action;
indentation = expectedIndentAction.indentation;
}
else if (lineNumber > 1) {
var lastLineNumber = void 0;
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
var lineText = model.getLineContent(lastLineNumber);
var nonWhitespaceIdx = strings["D" /* lastNonWhitespaceIndex */](lineText);
if (nonWhitespaceIdx >= 0) {
break;
}
}
if (lastLineNumber < 1) {
// No previous line with content found
return null;
}
var maxColumn = model.getLineMaxColumn(lastLineNumber);
var expectedEnterAction = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getEnterAction(config.autoIndent, model, new core_range["a" /* Range */](lastLineNumber, maxColumn, lastLineNumber, maxColumn));
if (expectedEnterAction) {
indentation = expectedEnterAction.indentation + expectedEnterAction.appendText;
}
}
if (action) {
if (action === languageConfiguration["a" /* IndentAction */].Indent) {
indentation = TypeOperations.shiftIndent(config, indentation);
}
if (action === languageConfiguration["a" /* IndentAction */].Outdent) {
indentation = TypeOperations.unshiftIndent(config, indentation);
}
indentation = config.normalizeIndentation(indentation);
}
if (!indentation) {
return null;
}
return indentation;
};
TypeOperations._replaceJumpToNextIndent = function (config, model, selection, insertsAutoWhitespace) {
var typeText = '';
var position = selection.getStartPosition();
if (config.insertSpaces) {
var visibleColumnFromColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(config, model, position);
var indentSize = config.indentSize;
var spacesCnt = indentSize - (visibleColumnFromColumn % indentSize);
for (var i = 0; i < spacesCnt; i++) {
typeText += ' ';
}
}
else {
typeText = '\t';
}
return new replaceCommand["a" /* ReplaceCommand */](selection, typeText, insertsAutoWhitespace);
};
TypeOperations.tab = function (config, model, selections) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
if (selection.isEmpty()) {
var lineText = model.getLineContent(selection.startLineNumber);
if (/^\s*$/.test(lineText) && model.isCheapToTokenize(selection.startLineNumber)) {
var goodIndent = this._goodIndentForLine(config, model, selection.startLineNumber);
goodIndent = goodIndent || '\t';
var possibleTypeText = config.normalizeIndentation(goodIndent);
if (!strings["N" /* startsWith */](lineText, possibleTypeText)) {
commands[i] = new replaceCommand["a" /* ReplaceCommand */](new core_range["a" /* 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) {
var lineMaxColumn = model.getLineMaxColumn(selection.startLineNumber);
if (selection.startColumn !== 1 || selection.endColumn !== lineMaxColumn) {
// This is a single line selection that is not the entire line
commands[i] = this._replaceJumpToNextIndent(config, model, selection, false);
continue;
}
}
commands[i] = new shiftCommand["a" /* ShiftCommand */](selection, {
isUnshift: false,
tabSize: config.tabSize,
indentSize: config.indentSize,
insertSpaces: config.insertSpaces,
useTabStops: config.useTabStops,
autoIndent: config.autoIndent
});
}
}
return commands;
};
TypeOperations.replacePreviousChar = function (prevEditOperationType, config, model, selections, txt, replaceCharCnt) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
if (!selection.isEmpty()) {
// looks like https://github.com/Microsoft/vscode/issues/2773
// where a cursor operation occurred before a canceled composition
// => ignore composition
commands[i] = null;
continue;
}
var pos = selection.getPosition();
var startColumn = Math.max(1, pos.column - replaceCharCnt);
var range = new core_range["a" /* Range */](pos.lineNumber, startColumn, pos.lineNumber, pos.column);
commands[i] = new replaceCommand["a" /* ReplaceCommand */](range, txt);
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: (prevEditOperationType !== 1 /* Typing */),
shouldPushStackElementAfter: false
});
};
TypeOperations._typeCommand = function (range, text, keepPosition) {
if (keepPosition) {
return new replaceCommand["e" /* ReplaceCommandWithoutChangingPosition */](range, text, true);
}
else {
return new replaceCommand["a" /* ReplaceCommand */](range, text, true);
}
};
TypeOperations._enter = function (config, model, keepPosition, range) {
if (config.autoIndent === 0 /* None */) {
return TypeOperations._typeCommand(range, '\n', keepPosition);
}
if (!model.isCheapToTokenize(range.getStartPosition().lineNumber) || config.autoIndent === 1 /* Keep */) {
var lineText_1 = model.getLineContent(range.startLineNumber);
var indentation_1 = strings["t" /* getLeadingWhitespace */](lineText_1).substring(0, range.startColumn - 1);
return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation_1), keepPosition);
}
var r = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getEnterAction(config.autoIndent, model, range);
if (r) {
if (r.indentAction === languageConfiguration["a" /* IndentAction */].None) {
// Nothing special
return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
}
else if (r.indentAction === languageConfiguration["a" /* IndentAction */].Indent) {
// Indent once
return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
}
else if (r.indentAction === languageConfiguration["a" /* IndentAction */].IndentOutdent) {
// Ultra special
var normalIndent = config.normalizeIndentation(r.indentation);
var increasedIndent = config.normalizeIndentation(r.indentation + r.appendText);
var typeText = '\n' + increasedIndent + '\n' + normalIndent;
if (keepPosition) {
return new replaceCommand["e" /* ReplaceCommandWithoutChangingPosition */](range, typeText, true);
}
else {
return new replaceCommand["d" /* ReplaceCommandWithOffsetCursorState */](range, typeText, -1, increasedIndent.length - normalIndent.length, true);
}
}
else if (r.indentAction === languageConfiguration["a" /* IndentAction */].Outdent) {
var actualIndentation = TypeOperations.unshiftIndent(config, r.indentation);
return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition);
}
}
var lineText = model.getLineContent(range.startLineNumber);
var indentation = strings["t" /* getLeadingWhitespace */](lineText).substring(0, range.startColumn - 1);
if (config.autoIndent >= 4 /* Full */) {
var ir = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getIndentForEnter(config.autoIndent, model, range, {
unshiftIndent: function (indent) {
return TypeOperations.unshiftIndent(config, indent);
},
shiftIndent: function (indent) {
return TypeOperations.shiftIndent(config, indent);
},
normalizeIndentation: function (indent) {
return config.normalizeIndentation(indent);
}
});
if (ir) {
var oldEndViewColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(config, model, range.getEndPosition());
var oldEndColumn = range.endColumn;
var beforeText = '\n';
if (indentation !== config.normalizeIndentation(ir.beforeEnter)) {
beforeText = config.normalizeIndentation(ir.beforeEnter) + lineText.substring(indentation.length, range.startColumn - 1) + '\n';
range = new core_range["a" /* Range */](range.startLineNumber, 1, range.endLineNumber, range.endColumn);
}
var newLineContent = model.getLineContent(range.endLineNumber);
var firstNonWhitespace = strings["q" /* firstNonWhitespaceIndex */](newLineContent);
if (firstNonWhitespace >= 0) {
range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1));
}
else {
range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber));
}
if (keepPosition) {
return new replaceCommand["e" /* ReplaceCommandWithoutChangingPosition */](range, beforeText + config.normalizeIndentation(ir.afterEnter), true);
}
else {
var 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 replaceCommand["d" /* ReplaceCommandWithOffsetCursorState */](range, beforeText + config.normalizeIndentation(ir.afterEnter), 0, offset, true);
}
}
}
return TypeOperations._typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition);
};
TypeOperations._isAutoIndentType = function (config, model, selections) {
if (config.autoIndent < 4 /* Full */) {
return false;
}
for (var i = 0, len = selections.length; i < len; i++) {
if (!model.isCheapToTokenize(selections[i].getEndPosition().lineNumber)) {
return false;
}
}
return true;
};
TypeOperations._runAutoIndentType = function (config, model, range, ch) {
var currentIndentation = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getIndentationAtPosition(model, range.startLineNumber, range.startColumn);
var actualIndentation = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getIndentActionForType(config.autoIndent, model, range, ch, {
shiftIndent: function (indentation) {
return TypeOperations.shiftIndent(config, indentation);
},
unshiftIndent: function (indentation) {
return TypeOperations.unshiftIndent(config, indentation);
},
});
if (actualIndentation === null) {
return null;
}
if (actualIndentation !== config.normalizeIndentation(currentIndentation)) {
var firstNonWhitespace = model.getLineFirstNonWhitespaceColumn(range.startLineNumber);
if (firstNonWhitespace === 0) {
return TypeOperations._typeCommand(new core_range["a" /* Range */](range.startLineNumber, 0, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) + ch, false);
}
else {
return TypeOperations._typeCommand(new core_range["a" /* Range */](range.startLineNumber, 0, range.endLineNumber, range.endColumn), config.normalizeIndentation(actualIndentation) +
model.getLineContent(range.startLineNumber).substring(firstNonWhitespace - 1, range.startColumn - 1) + ch, false);
}
}
return null;
};
TypeOperations._isAutoClosingOvertype = function (config, model, selections, autoClosedCharacters, ch) {
if (config.autoClosingOvertype === 'never') {
return false;
}
if (!config.autoClosingPairsClose2.has(ch)) {
return false;
}
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
if (!selection.isEmpty()) {
return false;
}
var position = selection.getPosition();
var lineText = model.getLineContent(position.lineNumber);
var afterCharacter = lineText.charAt(position.column - 1);
if (afterCharacter !== ch) {
return false;
}
// Do not over-type quotes after a backslash
var chIsQuote = Object(cursorCommon["g" /* isQuote */])(ch);
var beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : 0 /* Null */;
if (beforeCharacter === 92 /* Backslash */ && chIsQuote) {
return false;
}
// Must over-type a closing character typed by the editor
if (config.autoClosingOvertype === 'auto') {
var found = false;
for (var j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {
var autoClosedCharacter = autoClosedCharacters[j];
if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
return true;
};
TypeOperations._runAutoClosingOvertype = function (prevEditOperationType, config, model, selections, ch) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
var position = selection.getPosition();
var typeSelection = new core_range["a" /* Range */](position.lineNumber, position.column, position.lineNumber, position.column + 1);
commands[i] = new replaceCommand["a" /* ReplaceCommand */](typeSelection, ch);
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: (prevEditOperationType !== 1 /* Typing */),
shouldPushStackElementAfter: false
});
};
TypeOperations._autoClosingPairIsSymmetric = function (autoClosingPair) {
var open = autoClosingPair.open, close = autoClosingPair.close;
return (open.indexOf(close) >= 0 || close.indexOf(open) >= 0);
};
TypeOperations._isBeforeClosingBrace = function (config, autoClosingPair, characterAfter) {
var otherAutoClosingPairs = config.autoClosingPairsClose2.get(characterAfter);
if (!otherAutoClosingPairs) {
return false;
}
var thisBraceIsSymmetric = TypeOperations._autoClosingPairIsSymmetric(autoClosingPair);
for (var _i = 0, otherAutoClosingPairs_1 = otherAutoClosingPairs; _i < otherAutoClosingPairs_1.length; _i++) {
var otherAutoClosingPair = otherAutoClosingPairs_1[_i];
var otherBraceIsSymmetric = TypeOperations._autoClosingPairIsSymmetric(otherAutoClosingPair);
if (!thisBraceIsSymmetric && otherBraceIsSymmetric) {
continue;
}
return true;
}
return false;
};
TypeOperations._findAutoClosingPairOpen = function (config, model, positions, ch) {
var autoClosingPairCandidates = config.autoClosingPairsOpen2.get(ch);
if (!autoClosingPairCandidates) {
return null;
}
// Determine which auto-closing pair it is
var autoClosingPair = null;
for (var _i = 0, autoClosingPairCandidates_1 = autoClosingPairCandidates; _i < autoClosingPairCandidates_1.length; _i++) {
var autoClosingPairCandidate = autoClosingPairCandidates_1[_i];
if (autoClosingPair === null || autoClosingPairCandidate.open.length > autoClosingPair.open.length) {
var candidateIsMatch = true;
for (var _a = 0, positions_1 = positions; _a < positions_1.length; _a++) {
var position = positions_1[_a];
var relevantText = model.getValueInRange(new core_range["a" /* Range */](position.lineNumber, position.column - autoClosingPairCandidate.open.length + 1, position.lineNumber, position.column));
if (relevantText + ch !== autoClosingPairCandidate.open) {
candidateIsMatch = false;
break;
}
}
if (candidateIsMatch) {
autoClosingPair = autoClosingPairCandidate;
}
}
}
return autoClosingPair;
};
TypeOperations._isAutoClosingOpenCharType = function (config, model, selections, ch, insertOpenCharacter) {
var chIsQuote = Object(cursorCommon["g" /* isQuote */])(ch);
var autoCloseConfig = chIsQuote ? config.autoClosingQuotes : config.autoClosingBrackets;
if (autoCloseConfig === 'never') {
return null;
}
var autoClosingPair = this._findAutoClosingPairOpen(config, model, selections.map(function (s) { return s.getPosition(); }), ch);
if (!autoClosingPair) {
return null;
}
var shouldAutoCloseBefore = chIsQuote ? config.shouldAutoCloseBefore.quote : config.shouldAutoCloseBefore.bracket;
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
if (!selection.isEmpty()) {
return null;
}
var position = selection.getPosition();
var lineText = model.getLineContent(position.lineNumber);
// Only consider auto closing the pair if a space follows or if another autoclosed pair follows
if (lineText.length > position.column - 1) {
var characterAfter = lineText.charAt(position.column - 1);
var isBeforeCloseBrace = TypeOperations._isBeforeClosingBrace(config, autoClosingPair, characterAfter);
if (!isBeforeCloseBrace && !shouldAutoCloseBefore(characterAfter)) {
return null;
}
}
if (!model.isCheapToTokenize(position.lineNumber)) {
// Do not force tokenization
return null;
}
// Do not auto-close ' or " after a word character
if (autoClosingPair.open.length === 1 && chIsQuote && autoCloseConfig !== 'always') {
var wordSeparators = Object(wordCharacterClassifier["a" /* getMapForWordSeparators */])(config.wordSeparators);
if (insertOpenCharacter && position.column > 1 && wordSeparators.get(lineText.charCodeAt(position.column - 2)) === 0 /* Regular */) {
return null;
}
if (!insertOpenCharacter && position.column > 2 && wordSeparators.get(lineText.charCodeAt(position.column - 3)) === 0 /* Regular */) {
return null;
}
}
model.forceTokenization(position.lineNumber);
var lineTokens = model.getLineTokens(position.lineNumber);
var shouldAutoClosePair = false;
try {
shouldAutoClosePair = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].shouldAutoClosePair(autoClosingPair, lineTokens, insertOpenCharacter ? position.column : position.column - 1);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
if (!shouldAutoClosePair) {
return null;
}
}
return autoClosingPair;
};
TypeOperations._runAutoClosingOpenCharType = function (prevEditOperationType, config, model, selections, ch, insertOpenCharacter, autoClosingPair) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
commands[i] = new cursorTypeOperations_TypeWithAutoClosingCommand(selection, ch, insertOpenCharacter, autoClosingPair.close);
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
};
TypeOperations._shouldSurroundChar = function (config, ch) {
if (Object(cursorCommon["g" /* isQuote */])(ch)) {
return (config.autoSurround === 'quotes' || config.autoSurround === 'languageDefined');
}
else {
// Character is a bracket
return (config.autoSurround === 'brackets' || config.autoSurround === 'languageDefined');
}
};
TypeOperations._isSurroundSelectionType = function (config, model, selections, ch) {
if (!TypeOperations._shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {
return false;
}
var isTypingAQuoteCharacter = Object(cursorCommon["g" /* isQuote */])(ch);
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
if (selection.isEmpty()) {
return false;
}
var selectionContainsOnlyWhitespace = true;
for (var lineNumber = selection.startLineNumber; lineNumber <= selection.endLineNumber; lineNumber++) {
var lineText = model.getLineContent(lineNumber);
var startIndex = (lineNumber === selection.startLineNumber ? selection.startColumn - 1 : 0);
var endIndex = (lineNumber === selection.endLineNumber ? selection.endColumn - 1 : lineText.length);
var selectedText = lineText.substring(startIndex, endIndex);
if (/[^ \t]/.test(selectedText)) {
// this selected text contains something other than whitespace
selectionContainsOnlyWhitespace = false;
break;
}
}
if (selectionContainsOnlyWhitespace) {
return false;
}
if (isTypingAQuoteCharacter && selection.startLineNumber === selection.endLineNumber && selection.startColumn + 1 === selection.endColumn) {
var selectionText = model.getValueInRange(selection);
if (Object(cursorCommon["g" /* isQuote */])(selectionText)) {
// Typing a quote character on top of another quote character
// => disable surround selection type
return false;
}
}
}
return true;
};
TypeOperations._runSurroundSelectionType = function (prevEditOperationType, config, model, selections, ch) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
var closeCharacter = config.surroundingPairs[ch];
commands[i] = new surroundSelectionCommand_SurroundSelectionCommand(selection, ch, closeCharacter);
}
return new cursorCommon["e" /* EditOperationResult */](0 /* Other */, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
};
TypeOperations._isTypeInterceptorElectricChar = function (config, model, selections) {
if (selections.length === 1 && model.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {
return true;
}
return false;
};
TypeOperations._typeInterceptorElectricChar = function (prevEditOperationType, config, model, selection, ch) {
if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {
return null;
}
var position = selection.getPosition();
model.forceTokenization(position.lineNumber);
var lineTokens = model.getLineTokens(position.lineNumber);
var electricAction;
try {
electricAction = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].onElectricCharacter(ch, lineTokens, position.column);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
return null;
}
if (!electricAction) {
return null;
}
if (electricAction.matchOpenBracket) {
var endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;
var match = model.findMatchingBracketUp(electricAction.matchOpenBracket, {
lineNumber: position.lineNumber,
column: endColumn
});
if (match) {
if (match.startLineNumber === position.lineNumber) {
// matched something on the same line => no change in indentation
return null;
}
var matchLine = model.getLineContent(match.startLineNumber);
var matchLineIndentation = strings["t" /* getLeadingWhitespace */](matchLine);
var newIndentation = config.normalizeIndentation(matchLineIndentation);
var lineText = model.getLineContent(position.lineNumber);
var lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;
var prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);
var typeText = newIndentation + prefix + ch;
var typeSelection = new core_range["a" /* Range */](position.lineNumber, 1, position.lineNumber, position.column);
var command = new replaceCommand["a" /* ReplaceCommand */](typeSelection, typeText);
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, [command], {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: true
});
}
}
return null;
};
/**
* This is very similar with typing, but the character is already in the text buffer!
*/
TypeOperations.compositionEndWithInterceptors = function (prevEditOperationType, config, model, selectionsWhenCompositionStarted, selections, autoClosedCharacters) {
if (!selectionsWhenCompositionStarted || core_selection["a" /* Selection */].selectionsArrEqual(selectionsWhenCompositionStarted, selections)) {
// no content was typed
return null;
}
var ch = null;
// extract last typed character
for (var _i = 0, selections_1 = selections; _i < selections_1.length; _i++) {
var selection = selections_1[_i];
if (!selection.isEmpty()) {
return null;
}
var position = selection.getPosition();
var currentChar = model.getValueInRange(new core_range["a" /* Range */](position.lineNumber, position.column - 1, position.lineNumber, position.column));
if (ch === null) {
ch = currentChar;
}
else if (ch !== currentChar) {
return null;
}
}
if (!ch) {
return null;
}
if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
// Unfortunately, the close character is at this point "doubled", so we need to delete it...
var commands = selections.map(function (s) { return new replaceCommand["a" /* ReplaceCommand */](new core_range["a" /* Range */](s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), '', false); });
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false
});
}
var autoClosingPairOpenCharType = this._isAutoClosingOpenCharType(config, model, selections, ch, false);
if (autoClosingPairOpenCharType) {
return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, false, autoClosingPairOpenCharType);
}
return null;
};
TypeOperations.typeWithInterceptors = function (prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {
if (ch === '\n') {
var commands_1 = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands_1[i] = TypeOperations._enter(config, model, false, selections[i]);
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands_1, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false,
});
}
if (this._isAutoIndentType(config, model, selections)) {
var commands_2 = [];
var autoIndentFails = false;
for (var i = 0, len = selections.length; i < len; i++) {
commands_2[i] = this._runAutoIndentType(config, model, selections[i], ch);
if (!commands_2[i]) {
autoIndentFails = true;
break;
}
}
if (!autoIndentFails) {
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands_2, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: false,
});
}
}
if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch);
}
var autoClosingPairOpenCharType = this._isAutoClosingOpenCharType(config, model, selections, ch, true);
if (autoClosingPairOpenCharType) {
return this._runAutoClosingOpenCharType(prevEditOperationType, config, model, selections, ch, true, autoClosingPairOpenCharType);
}
if (this._isSurroundSelectionType(config, model, selections, ch)) {
return this._runSurroundSelectionType(prevEditOperationType, config, model, selections, ch);
}
// Electric characters make sense only when dealing with a single cursor,
// as multiple cursors typing brackets for example would interfer with bracket matching
if (this._isTypeInterceptorElectricChar(config, model, selections)) {
var r = this._typeInterceptorElectricChar(prevEditOperationType, config, model, selections[0], ch);
if (r) {
return r;
}
}
// A simple character type
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = new replaceCommand["a" /* ReplaceCommand */](selections[i], ch);
}
var shouldPushStackElementBefore = (prevEditOperationType !== 1 /* Typing */);
if (ch === ' ') {
shouldPushStackElementBefore = true;
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: shouldPushStackElementBefore,
shouldPushStackElementAfter: false
});
};
TypeOperations.typeWithoutInterceptors = function (prevEditOperationType, config, model, selections, str) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = new replaceCommand["a" /* ReplaceCommand */](selections[i], str);
}
return new cursorCommon["e" /* EditOperationResult */](1 /* Typing */, commands, {
shouldPushStackElementBefore: (prevEditOperationType !== 1 /* Typing */),
shouldPushStackElementAfter: false
});
};
TypeOperations.lineInsertBefore = function (config, model, selections) {
if (model === null || selections === null) {
return [];
}
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var lineNumber = selections[i].positionLineNumber;
if (lineNumber === 1) {
commands[i] = new replaceCommand["e" /* ReplaceCommandWithoutChangingPosition */](new core_range["a" /* Range */](1, 1, 1, 1), '\n');
}
else {
lineNumber--;
var column = model.getLineMaxColumn(lineNumber);
commands[i] = this._enter(config, model, false, new core_range["a" /* Range */](lineNumber, column, lineNumber, column));
}
}
return commands;
};
TypeOperations.lineInsertAfter = function (config, model, selections) {
if (model === null || selections === null) {
return [];
}
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
var lineNumber = selections[i].positionLineNumber;
var column = model.getLineMaxColumn(lineNumber);
commands[i] = this._enter(config, model, false, new core_range["a" /* Range */](lineNumber, column, lineNumber, column));
}
return commands;
};
TypeOperations.lineBreakInsert = function (config, model, selections) {
var commands = [];
for (var i = 0, len = selections.length; i < len; i++) {
commands[i] = this._enter(config, model, true, selections[i]);
}
return commands;
};
return TypeOperations;
}());
var cursorTypeOperations_TypeWithAutoClosingCommand = /** @class */ (function (_super) {
__extends(TypeWithAutoClosingCommand, _super);
function TypeWithAutoClosingCommand(selection, openCharacter, insertOpenCharacter, closeCharacter) {
var _this = _super.call(this, selection, (insertOpenCharacter ? openCharacter : '') + closeCharacter, 0, -closeCharacter.length) || this;
_this._openCharacter = openCharacter;
_this._closeCharacter = closeCharacter;
_this.closeCharacterRange = null;
_this.enclosingRange = null;
return _this;
}
TypeWithAutoClosingCommand.prototype.computeCursorState = function (model, helper) {
var inverseEditOperations = helper.getInverseEditOperations();
var range = inverseEditOperations[0].range;
this.closeCharacterRange = new core_range["a" /* Range */](range.startLineNumber, range.endColumn - this._closeCharacter.length, range.endLineNumber, range.endColumn);
this.enclosingRange = new core_range["a" /* Range */](range.startLineNumber, range.endColumn - this._openCharacter.length - this._closeCharacter.length, range.endLineNumber, range.endColumn);
return _super.prototype.computeCursorState.call(this, model, helper);
};
return TypeWithAutoClosingCommand;
}(replaceCommand["d" /* ReplaceCommandWithOffsetCursorState */]));
/***/ }),
/* 107 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TextAreaState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PagedScreenReaderStrategy; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _common_core_position_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
/* harmony import */ var _common_core_range_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var TextAreaState = /** @class */ (function () {
function TextAreaState(value, selectionStart, selectionEnd, selectionStartPosition, selectionEndPosition) {
this.value = value;
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
this.selectionStartPosition = selectionStartPosition;
this.selectionEndPosition = selectionEndPosition;
}
TextAreaState.prototype.toString = function () {
return '[ <' + this.value + '>, selectionStart: ' + this.selectionStart + ', selectionEnd: ' + this.selectionEnd + ']';
};
TextAreaState.readFromTextArea = function (textArea) {
return new TextAreaState(textArea.getValue(), textArea.getSelectionStart(), textArea.getSelectionEnd(), null, null);
};
TextAreaState.prototype.collapseSelection = function () {
return new TextAreaState(this.value, this.value.length, this.value.length, null, null);
};
TextAreaState.prototype.writeToTextArea = function (reason, textArea, select) {
// console.log(Date.now() + ': writeToTextArea ' + reason + ': ' + this.toString());
textArea.setValue(reason, this.value);
if (select) {
textArea.setSelectionRange(reason, this.selectionStart, this.selectionEnd);
}
};
TextAreaState.prototype.deduceEditorPosition = function (offset) {
if (offset <= this.selectionStart) {
var str = this.value.substring(offset, this.selectionStart);
return this._finishDeduceEditorPosition(this.selectionStartPosition, str, -1);
}
if (offset >= this.selectionEnd) {
var str = this.value.substring(this.selectionEnd, offset);
return this._finishDeduceEditorPosition(this.selectionEndPosition, str, 1);
}
var str1 = this.value.substring(this.selectionStart, offset);
if (str1.indexOf(String.fromCharCode(8230)) === -1) {
return this._finishDeduceEditorPosition(this.selectionStartPosition, str1, 1);
}
var str2 = this.value.substring(offset, this.selectionEnd);
return this._finishDeduceEditorPosition(this.selectionEndPosition, str2, -1);
};
TextAreaState.prototype._finishDeduceEditorPosition = function (anchor, deltaText, signum) {
var lineFeedCnt = 0;
var lastLineFeedIndex = -1;
while ((lastLineFeedIndex = deltaText.indexOf('\n', lastLineFeedIndex + 1)) !== -1) {
lineFeedCnt++;
}
return [anchor, signum * deltaText.length, lineFeedCnt];
};
TextAreaState.selectedText = function (text) {
return new TextAreaState(text, 0, text.length, null, null);
};
TextAreaState.deduceInput = function (previousState, currentState, couldBeEmojiInput) {
if (!previousState) {
// This is the EMPTY state
return {
text: '',
replaceCharCnt: 0
};
}
// console.log('------------------------deduceInput');
// console.log('PREVIOUS STATE: ' + previousState.toString());
// console.log('CURRENT STATE: ' + currentState.toString());
var previousValue = previousState.value;
var previousSelectionStart = previousState.selectionStart;
var previousSelectionEnd = previousState.selectionEnd;
var currentValue = currentState.value;
var currentSelectionStart = currentState.selectionStart;
var currentSelectionEnd = currentState.selectionEnd;
// Strip the previous suffix from the value (without interfering with the current selection)
var previousSuffix = previousValue.substring(previousSelectionEnd);
var currentSuffix = currentValue.substring(currentSelectionEnd);
var suffixLength = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* commonSuffixLength */ "d"](previousSuffix, currentSuffix);
currentValue = currentValue.substring(0, currentValue.length - suffixLength);
previousValue = previousValue.substring(0, previousValue.length - suffixLength);
var previousPrefix = previousValue.substring(0, previousSelectionStart);
var currentPrefix = currentValue.substring(0, currentSelectionStart);
var prefixLength = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* commonPrefixLength */ "c"](previousPrefix, currentPrefix);
currentValue = currentValue.substring(prefixLength);
previousValue = previousValue.substring(prefixLength);
currentSelectionStart -= prefixLength;
previousSelectionStart -= prefixLength;
currentSelectionEnd -= prefixLength;
previousSelectionEnd -= prefixLength;
// console.log('AFTER DIFFING PREVIOUS STATE: <' + previousValue + '>, selectionStart: ' + previousSelectionStart + ', selectionEnd: ' + previousSelectionEnd);
// console.log('AFTER DIFFING CURRENT STATE: <' + currentValue + '>, selectionStart: ' + currentSelectionStart + ', selectionEnd: ' + currentSelectionEnd);
if (couldBeEmojiInput && currentSelectionStart === currentSelectionEnd && previousValue.length > 0) {
// on OSX, emojis from the emoji picker are inserted at random locations
// the only hints we can use is that the selection is immediately after the inserted emoji
// and that none of the old text has been deleted
var potentialEmojiInput = null;
if (currentSelectionStart === currentValue.length) {
// emoji potentially inserted "somewhere" after the previous selection => it should appear at the end of `currentValue`
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* startsWith */ "N"](currentValue, previousValue)) {
// only if all of the old text is accounted for
potentialEmojiInput = currentValue.substring(previousValue.length);
}
}
else {
// emoji potentially inserted "somewhere" before the previous selection => it should appear at the start of `currentValue`
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* endsWith */ "m"](currentValue, previousValue)) {
// only if all of the old text is accounted for
potentialEmojiInput = currentValue.substring(0, currentValue.length - previousValue.length);
}
}
if (potentialEmojiInput !== null && potentialEmojiInput.length > 0) {
// now we check that this is indeed an emoji
// emojis can grow quite long, so a length check is of no help
// e.g. 1F3F4 E0067 E0062 E0065 E006E E0067 E007F ; fully-qualified # 🏴 England
// Oftentimes, emojis use Variation Selector-16 (U+FE0F), so that is a good hint
// http://emojipedia.org/variation-selector-16/
// > An invisible codepoint which specifies that the preceding character
// > should be displayed with emoji presentation. Only required if the
// > preceding character defaults to text presentation.
if (/\uFE0F/.test(potentialEmojiInput) || _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* containsEmoji */ "g"](potentialEmojiInput)) {
return {
text: potentialEmojiInput,
replaceCharCnt: 0
};
}
}
}
if (currentSelectionStart === currentSelectionEnd) {
// composition accept case (noticed in FF + Japanese)
// [blahblah] => blahblah|
if (previousValue === currentValue
&& previousSelectionStart === 0
&& previousSelectionEnd === previousValue.length
&& currentSelectionStart === currentValue.length
&& currentValue.indexOf('\n') === -1) {
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* containsFullWidthCharacter */ "h"](currentValue)) {
return {
text: '',
replaceCharCnt: 0
};
}
}
// no current selection
var replacePreviousCharacters_1 = (previousPrefix.length - prefixLength);
// console.log('REMOVE PREVIOUS: ' + (previousPrefix.length - prefixLength) + ' chars');
return {
text: currentValue,
replaceCharCnt: replacePreviousCharacters_1
};
}
// there is a current selection => composition case
var replacePreviousCharacters = previousSelectionEnd - previousSelectionStart;
return {
text: currentValue,
replaceCharCnt: replacePreviousCharacters
};
};
TextAreaState.EMPTY = new TextAreaState('', 0, 0, null, null);
return TextAreaState;
}());
var PagedScreenReaderStrategy = /** @class */ (function () {
function PagedScreenReaderStrategy() {
}
PagedScreenReaderStrategy._getPageOfLine = function (lineNumber, linesPerPage) {
return Math.floor((lineNumber - 1) / linesPerPage);
};
PagedScreenReaderStrategy._getRangeForPage = function (page, linesPerPage) {
var offset = page * linesPerPage;
var startLineNumber = offset + 1;
var endLineNumber = offset + linesPerPage;
return new _common_core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](startLineNumber, 1, endLineNumber + 1, 1);
};
PagedScreenReaderStrategy.fromEditorSelection = function (previousState, model, selection, linesPerPage, trimLongText) {
var selectionStartPage = PagedScreenReaderStrategy._getPageOfLine(selection.startLineNumber, linesPerPage);
var selectionStartPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionStartPage, linesPerPage);
var selectionEndPage = PagedScreenReaderStrategy._getPageOfLine(selection.endLineNumber, linesPerPage);
var selectionEndPageRange = PagedScreenReaderStrategy._getRangeForPage(selectionEndPage, linesPerPage);
var pretextRange = selectionStartPageRange.intersectRanges(new _common_core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](1, 1, selection.startLineNumber, selection.startColumn));
var pretext = model.getValueInRange(pretextRange, 1 /* LF */);
var lastLine = model.getLineCount();
var lastLineMaxColumn = model.getLineMaxColumn(lastLine);
var posttextRange = selectionEndPageRange.intersectRanges(new _common_core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](selection.endLineNumber, selection.endColumn, lastLine, lastLineMaxColumn));
var posttext = model.getValueInRange(posttextRange, 1 /* LF */);
var text;
if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) {
// take full selection
text = model.getValueInRange(selection, 1 /* LF */);
}
else {
var selectionRange1 = selectionStartPageRange.intersectRanges(selection);
var selectionRange2 = selectionEndPageRange.intersectRanges(selection);
text = (model.getValueInRange(selectionRange1, 1 /* LF */)
+ String.fromCharCode(8230)
+ model.getValueInRange(selectionRange2, 1 /* LF */));
}
// Chromium handles very poorly text even of a few thousand chars
// Cut text to avoid stalling the entire UI
if (trimLongText) {
var LIMIT_CHARS = 500;
if (pretext.length > LIMIT_CHARS) {
pretext = pretext.substring(pretext.length - LIMIT_CHARS, pretext.length);
}
if (posttext.length > LIMIT_CHARS) {
posttext = posttext.substring(0, LIMIT_CHARS);
}
if (text.length > 2 * LIMIT_CHARS) {
text = text.substring(0, LIMIT_CHARS) + String.fromCharCode(8230) + text.substring(text.length - LIMIT_CHARS, text.length);
}
}
return new TextAreaState(pretext + text + posttext, pretext.length, pretext.length + text.length, new _common_core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](selection.startLineNumber, selection.startColumn), new _common_core_position_js__WEBPACK_IMPORTED_MODULE_1__[/* Position */ "a"](selection.endLineNumber, selection.endColumn));
};
return PagedScreenReaderStrategy;
}());
/***/ }),
/* 108 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.6.11' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 109 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IEditorProgressService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IEditorProgressService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('editorProgressService');
/***/ }),
/* 110 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return values; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return first; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return forEach; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SetMap; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Returns an array which contains all values that reside
* in the given set.
*/
function values(from) {
var result = [];
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
result.push(from[key]);
}
}
return result;
}
function first(from) {
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
return from[key];
}
}
return undefined;
}
/**
* Iterates over each entry in the provided set. The iterator allows
* to remove elements and will stop when the callback returns {{false}}.
*/
function forEach(from, callback) {
var _loop_1 = function (key) {
if (hasOwnProperty.call(from, key)) {
var result = callback({ key: key, value: from[key] }, function () {
delete from[key];
});
if (result === false) {
return { value: void 0 };
}
}
};
for (var key in from) {
var state_1 = _loop_1(key);
if (typeof state_1 === "object")
return state_1.value;
}
}
var SetMap = /** @class */ (function () {
function SetMap() {
this.map = new Map();
}
SetMap.prototype.add = function (key, value) {
var values = this.map.get(key);
if (!values) {
values = new Set();
this.map.set(key, values);
}
values.add(value);
};
SetMap.prototype.delete = function (key, value) {
var values = this.map.get(key);
if (!values) {
return;
}
values.delete(value);
if (values.size === 0) {
this.map.delete(key);
}
};
SetMap.prototype.forEach = function (key, fn) {
var values = this.map.get(key);
if (!values) {
return;
}
values.forEach(fn);
};
return SetMap;
}());
/***/ }),
/* 111 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isCodeEditor; });
/* harmony import */ var _common_editorCommon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
*@internal
*/
function isCodeEditor(thing) {
if (thing && typeof thing.getEditorType === 'function') {
return thing.getEditorType() === _common_editorCommon_js__WEBPACK_IMPORTED_MODULE_0__[/* EditorType */ "a"].ICodeEditor;
}
else {
return false;
}
}
/***/ }),
/* 112 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return clamp; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.fromCallback = function (fn) {
return Object.defineProperty(function () {
if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments)
else {
return new Promise((resolve, reject) => {
arguments[arguments.length] = (err, res) => {
if (err) return reject(err)
resolve(res)
}
arguments.length++
fn.apply(this, arguments)
})
}
}, 'name', { value: fn.name })
}
exports.fromPromise = function (fn) {
return Object.defineProperty(function () {
const cb = arguments[arguments.length - 1]
if (typeof cb !== 'function') return fn.apply(this, arguments)
else fn.apply(this, arguments).then(r => cb(null, r), cb)
}, 'name', { value: fn.name })
}
/***/ }),
/* 114 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Extensions; });
/* unused harmony export allSettings */
/* unused harmony export applicationSettings */
/* unused harmony export machineSettings */
/* unused harmony export machineOverridableSettings */
/* unused harmony export windowSettings */
/* unused harmony export resourceSettings */
/* unused harmony export resourceLanguageSettingsSchemaId */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return OVERRIDE_PROPERTY_PATTERN; });
/* unused harmony export getDefaultValue */
/* unused harmony export validateProperty */
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
/* harmony import */ var _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(57);
/* harmony import */ var _base_common_types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21);
/* harmony import */ var _jsonschemas_common_jsonContributionRegistry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(233);
/* harmony import */ var _base_common_map_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Extensions = {
Configuration: 'base.contributions.configuration'
};
var allSettings = { properties: {}, patternProperties: {} };
var applicationSettings = { properties: {}, patternProperties: {} };
var machineSettings = { properties: {}, patternProperties: {} };
var machineOverridableSettings = { properties: {}, patternProperties: {} };
var windowSettings = { properties: {}, patternProperties: {} };
var resourceSettings = { properties: {}, patternProperties: {} };
var resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';
var contributionRegistry = _registry_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* Registry */ "a"].as(_jsonschemas_common_jsonContributionRegistry_js__WEBPACK_IMPORTED_MODULE_4__[/* Extensions */ "a"].JSONContribution);
var ConfigurationRegistry = /** @class */ (function () {
function ConfigurationRegistry() {
this.overrideIdentifiers = new Set();
this._onDidSchemaChange = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]();
this._onDidUpdateConfiguration = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]();
this.defaultOverridesConfigurationNode = {
id: 'defaultOverrides',
title: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('defaultConfigurations.title', "Default Configuration Overrides"),
properties: {}
};
this.configurationContributors = [this.defaultOverridesConfigurationNode];
this.resourceLanguageSettingsSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowTrailingCommas: true, allowComments: true };
this.configurationProperties = {};
this.excludedConfigurationProperties = {};
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
}
ConfigurationRegistry.prototype.registerConfiguration = function (configuration, validate) {
if (validate === void 0) { validate = true; }
this.registerConfigurations([configuration], validate);
};
ConfigurationRegistry.prototype.registerConfigurations = function (configurations, validate) {
var _this = this;
if (validate === void 0) { validate = true; }
var properties = [];
configurations.forEach(function (configuration) {
properties.push.apply(properties, _this.validateAndRegisterProperties(configuration, validate)); // fills in defaults
_this.configurationContributors.push(configuration);
_this.registerJSONConfiguration(configuration);
});
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
this._onDidSchemaChange.fire();
this._onDidUpdateConfiguration.fire(properties);
};
ConfigurationRegistry.prototype.registerOverrideIdentifiers = function (overrideIdentifiers) {
for (var _i = 0, overrideIdentifiers_1 = overrideIdentifiers; _i < overrideIdentifiers_1.length; _i++) {
var overrideIdentifier = overrideIdentifiers_1[_i];
this.overrideIdentifiers.add(overrideIdentifier);
}
this.updateOverridePropertyPatternKey();
};
ConfigurationRegistry.prototype.validateAndRegisterProperties = function (configuration, validate, scope) {
if (validate === void 0) { validate = true; }
if (scope === void 0) { scope = 3 /* WINDOW */; }
scope = _base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefinedOrNull */ "l"](configuration.scope) ? scope : configuration.scope;
var propertyKeys = [];
var properties = configuration.properties;
if (properties) {
for (var key in properties) {
if (validate && validateProperty(key)) {
delete properties[key];
continue;
}
// fill in default values
var property = properties[key];
var defaultValue = property.default;
if (_base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefined */ "k"](defaultValue)) {
property.default = getDefaultValue(property.type);
}
if (OVERRIDE_PROPERTY_PATTERN.test(key)) {
property.scope = undefined; // No scope for overridable properties `[${identifier}]`
}
else {
property.scope = _base_common_types_js__WEBPACK_IMPORTED_MODULE_3__[/* isUndefinedOrNull */ "l"](property.scope) ? scope : property.scope;
}
// Add to properties maps
// Property is included by default if 'included' is unspecified
if (properties[key].hasOwnProperty('included') && !properties[key].included) {
this.excludedConfigurationProperties[key] = properties[key];
delete properties[key];
continue;
}
else {
this.configurationProperties[key] = properties[key];
}
propertyKeys.push(key);
}
}
var subNodes = configuration.allOf;
if (subNodes) {
for (var _i = 0, subNodes_1 = subNodes; _i < subNodes_1.length; _i++) {
var node = subNodes_1[_i];
propertyKeys.push.apply(propertyKeys, this.validateAndRegisterProperties(node, validate, scope));
}
}
return propertyKeys;
};
ConfigurationRegistry.prototype.getConfigurationProperties = function () {
return this.configurationProperties;
};
ConfigurationRegistry.prototype.registerJSONConfiguration = function (configuration) {
var _this = this;
var register = function (configuration) {
var properties = configuration.properties;
if (properties) {
for (var key in properties) {
allSettings.properties[key] = properties[key];
switch (properties[key].scope) {
case 1 /* APPLICATION */:
applicationSettings.properties[key] = properties[key];
break;
case 2 /* MACHINE */:
machineSettings.properties[key] = properties[key];
break;
case 6 /* MACHINE_OVERRIDABLE */:
machineOverridableSettings.properties[key] = properties[key];
break;
case 3 /* WINDOW */:
windowSettings.properties[key] = properties[key];
break;
case 4 /* RESOURCE */:
resourceSettings.properties[key] = properties[key];
break;
case 5 /* LANGUAGE_OVERRIDABLE */:
resourceSettings.properties[key] = properties[key];
_this.resourceLanguageSettingsSchema.properties[key] = properties[key];
break;
}
}
}
var subNodes = configuration.allOf;
if (subNodes) {
subNodes.forEach(register);
}
};
register(configuration);
};
ConfigurationRegistry.prototype.updateOverridePropertyPatternKey = function () {
var _a;
for (var _i = 0, _b = Object(_base_common_map_js__WEBPACK_IMPORTED_MODULE_5__[/* values */ "e"])(this.overrideIdentifiers); _i < _b.length; _i++) {
var overrideIdentifier = _b[_i];
var overrideIdentifierProperty = "[" + overrideIdentifier + "]";
var resourceLanguagePropertiesSchema = {
type: 'object',
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overrideSettings.defaultDescription', "Configure editor settings to be overridden for a language."),
errorMessage: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('overrideSettings.errorMessage', "This setting does not support per-language configuration."),
$ref: resourceLanguageSettingsSchemaId,
default: (_a = this.defaultOverridesConfigurationNode.properties[overrideIdentifierProperty]) === null || _a === void 0 ? void 0 : _a.default
};
allSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
applicationSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
machineSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
machineOverridableSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
windowSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
resourceSettings.properties[overrideIdentifierProperty] = resourceLanguagePropertiesSchema;
}
this._onDidSchemaChange.fire();
};
return ConfigurationRegistry;
}());
var OVERRIDE_PROPERTY = '\\[.*\\]$';
var OVERRIDE_PROPERTY_PATTERN = new RegExp(OVERRIDE_PROPERTY);
function getDefaultValue(type) {
var t = Array.isArray(type) ? type[0] : type;
switch (t) {
case 'boolean':
return false;
case 'integer':
case 'number':
return 0;
case 'string':
return '';
case 'array':
return [];
case 'object':
return {};
default:
return null;
}
}
var configurationRegistry = new ConfigurationRegistry();
_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_2__[/* Registry */ "a"].add(Extensions.Configuration, configurationRegistry);
function validateProperty(property) {
if (OVERRIDE_PROPERTY_PATTERN.test(property)) {
return _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('config.property.languageDefault', "Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.", property);
}
if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {
return _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('config.property.duplicate', "Cannot register '{0}'. This property is already registered.", property);
}
return null;
}
/***/ }),
/* 115 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EditorZoom; });
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var EditorZoom = new /** @class */ (function () {
function class_1() {
this._zoomLevel = 0;
this._onDidChangeZoomLevel = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_0__[/* Emitter */ "a"]();
this.onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
}
class_1.prototype.getZoomLevel = function () {
return this._zoomLevel;
};
class_1.prototype.setZoomLevel = function (zoomLevel) {
zoomLevel = Math.min(Math.max(-5, zoomLevel), 20);
if (this._zoomLevel === zoomLevel) {
return;
}
this._zoomLevel = zoomLevel;
this._onDidChangeZoomLevel.fire(this._zoomLevel);
};
return class_1;
}());
/***/ }),
/* 116 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ react_router_Route; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ react_router_Router; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ react_router_StaticRouter; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ react_router_Switch; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ react_router_context; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ matchPath; });
__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ useLocation; });
__webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ withRouter; });
// UNUSED EXPORTS: MemoryRouter, Prompt, Redirect, generatePath, useHistory, useParams, useRouteMatch
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
var inheritsLoose = __webpack_require__(136);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(3);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__(42);
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
// EXTERNAL MODULE: ./node_modules/history/esm/history.js + 2 modules
var esm_history = __webpack_require__(126);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inheritsLoose.js
var helpers_inheritsLoose = __webpack_require__(281);
var inheritsLoose_default = /*#__PURE__*/__webpack_require__.n(helpers_inheritsLoose);
// EXTERNAL MODULE: ./node_modules/gud/index.js
var gud = __webpack_require__(360);
var gud_default = /*#__PURE__*/__webpack_require__.n(gud);
// CONCATENATED MODULE: ./node_modules/mini-create-react-context/dist/esm/index.js
var MAX_SIGNED_31_BIT_INT = 1073741823;
function objectIs(x, y) {
if (x === y) {
return x !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
}
function createEventEmitter(value) {
var handlers = [];
return {
on: function on(handler) {
handlers.push(handler);
},
off: function off(handler) {
handlers = handlers.filter(function (h) {
return h !== handler;
});
},
get: function get() {
return value;
},
set: function set(newValue, changedBits) {
value = newValue;
handlers.forEach(function (handler) {
return handler(value, changedBits);
});
}
};
}
function onlyChild(children) {
return Array.isArray(children) ? children[0] : children;
}
function createReactContext(defaultValue, calculateChangedBits) {
var _Provider$childContex, _Consumer$contextType;
var contextProp = '__create-react-context-' + gud_default()() + '__';
var Provider =
/*#__PURE__*/
function (_Component) {
inheritsLoose_default()(Provider, _Component);
function Provider() {
var _this;
_this = _Component.apply(this, arguments) || this;
_this.emitter = createEventEmitter(_this.props.value);
return _this;
}
var _proto = Provider.prototype;
_proto.getChildContext = function getChildContext() {
var _ref;
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
};
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (this.props.value !== nextProps.value) {
var oldValue = this.props.value;
var newValue = nextProps.value;
var changedBits;
if (objectIs(oldValue, newValue)) {
changedBits = 0;
} else {
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
if (false) {}
changedBits |= 0;
if (changedBits !== 0) {
this.emitter.set(nextProps.value, changedBits);
}
}
}
};
_proto.render = function render() {
return this.props.children;
};
return Provider;
}(react["Component"]);
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types_default.a.object.isRequired, _Provider$childContex);
var Consumer =
/*#__PURE__*/
function (_Component2) {
inheritsLoose_default()(Consumer, _Component2);
function Consumer() {
var _this2;
_this2 = _Component2.apply(this, arguments) || this;
_this2.state = {
value: _this2.getValue()
};
_this2.onUpdate = function (newValue, changedBits) {
var observedBits = _this2.observedBits | 0;
if ((observedBits & changedBits) !== 0) {
_this2.setState({
value: _this2.getValue()
});
}
};
return _this2;
}
var _proto2 = Consumer.prototype;
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var observedBits = nextProps.observedBits;
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
};
_proto2.componentDidMount = function componentDidMount() {
if (this.context[contextProp]) {
this.context[contextProp].on(this.onUpdate);
}
var observedBits = this.props.observedBits;
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
};
_proto2.componentWillUnmount = function componentWillUnmount() {
if (this.context[contextProp]) {
this.context[contextProp].off(this.onUpdate);
}
};
_proto2.getValue = function getValue() {
if (this.context[contextProp]) {
return this.context[contextProp].get();
} else {
return defaultValue;
}
};
_proto2.render = function render() {
return onlyChild(this.props.children)(this.state.value);
};
return Consumer;
}(react["Component"]);
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types_default.a.object, _Consumer$contextType);
return {
Provider: Provider,
Consumer: Consumer
};
}
var index = react_default.a.createContext || createReactContext;
/* harmony default export */ var esm = (index);
// EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js
var tiny_invariant_esm = __webpack_require__(117);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(8);
// EXTERNAL MODULE: ./node_modules/react-router/node_modules/path-to-regexp/index.js
var path_to_regexp = __webpack_require__(282);
var path_to_regexp_default = /*#__PURE__*/__webpack_require__.n(path_to_regexp);
// EXTERNAL MODULE: ./node_modules/react-is/index.js
var react_is = __webpack_require__(316);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
var objectWithoutPropertiesLoose = __webpack_require__(166);
// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var hoist_non_react_statics_cjs = __webpack_require__(361);
var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs);
// CONCATENATED MODULE: ./node_modules/react-router/esm/react-router.js
// TODO: Replace with React.createContext once we can assume React 16+
var react_router_createNamedContext = function createNamedContext(name) {
var context = esm();
context.displayName = name;
return context;
};
var react_router_context =
/*#__PURE__*/
react_router_createNamedContext("Router");
/**
* The public API for putting history on context.
*/
var react_router_Router =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(Router, _React$Component);
Router.computeRootMatch = function computeRootMatch(pathname) {
return {
path: "/",
url: "/",
params: {},
isExact: pathname === "/"
};
};
function Router(props) {
var _this;
_this = _React$Component.call(this, props) || this;
_this.state = {
location: props.history.location
}; // This is a bit of a hack. We have to start listening for location
// changes here in the constructor in case there are any s
// on the initial render. If there are, they will replace/push when
// they mount and since cDM fires in children before parents, we may
// get a new location before the is mounted.
_this._isMounted = false;
_this._pendingLocation = null;
if (!props.staticContext) {
_this.unlisten = props.history.listen(function (location) {
if (_this._isMounted) {
_this.setState({
location: location
});
} else {
_this._pendingLocation = location;
}
});
}
return _this;
}
var _proto = Router.prototype;
_proto.componentDidMount = function componentDidMount() {
this._isMounted = true;
if (this._pendingLocation) {
this.setState({
location: this._pendingLocation
});
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.unlisten) this.unlisten();
};
_proto.render = function render() {
return react_default.a.createElement(react_router_context.Provider, {
children: this.props.children || null,
value: {
history: this.props.history,
location: this.state.location,
match: Router.computeRootMatch(this.state.location.pathname),
staticContext: this.props.staticContext
}
});
};
return Router;
}(react_default.a.Component);
if (false) {}
/**
* The public API for a that stores location in memory.
*/
var react_router_MemoryRouter =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(MemoryRouter, _React$Component);
function MemoryRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = Object(esm_history["d" /* createMemoryHistory */])(_this.props);
return _this;
}
var _proto = MemoryRouter.prototype;
_proto.render = function render() {
return react_default.a.createElement(react_router_Router, {
history: this.history,
children: this.props.children
});
};
return MemoryRouter;
}(react_default.a.Component);
if (false) {}
var react_router_Lifecycle =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(Lifecycle, _React$Component);
function Lifecycle() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Lifecycle.prototype;
_proto.componentDidMount = function componentDidMount() {
if (this.props.onMount) this.props.onMount.call(this, this);
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
};
_proto.render = function render() {
return null;
};
return Lifecycle;
}(react_default.a.Component);
/**
* The public API for prompting the user before navigating away from a screen.
*/
function Prompt(_ref) {
var message = _ref.message,
_ref$when = _ref.when,
when = _ref$when === void 0 ? true : _ref$when;
return react_default.a.createElement(react_router_context.Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
if (!when || context.staticContext) return null;
var method = context.history.block;
return react_default.a.createElement(react_router_Lifecycle, {
onMount: function onMount(self) {
self.release = method(message);
},
onUpdate: function onUpdate(self, prevProps) {
if (prevProps.message !== message) {
self.release();
self.release = method(message);
}
},
onUnmount: function onUnmount(self) {
self.release();
},
message: message
});
});
}
if (false) { var messageType; }
var cache = {};
var cacheLimit = 10000;
var cacheCount = 0;
function compilePath(path) {
if (cache[path]) return cache[path];
var generator = path_to_regexp_default.a.compile(path);
if (cacheCount < cacheLimit) {
cache[path] = generator;
cacheCount++;
}
return generator;
}
/**
* Public API for generating a URL pathname from a path and parameters.
*/
function generatePath(path, params) {
if (path === void 0) {
path = "/";
}
if (params === void 0) {
params = {};
}
return path === "/" ? path : compilePath(path)(params, {
pretty: true
});
}
/**
* The public API for navigating programmatically with a component.
*/
function Redirect(_ref) {
var computedMatch = _ref.computedMatch,
to = _ref.to,
_ref$push = _ref.push,
push = _ref$push === void 0 ? false : _ref$push;
return react_default.a.createElement(react_router_context.Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
var history = context.history,
staticContext = context.staticContext;
var method = push ? history.push : history.replace;
var location = Object(esm_history["c" /* createLocation */])(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : Object(esm_extends["a" /* default */])({}, to, {
pathname: generatePath(to.pathname, computedMatch.params)
}) : to); // When rendering in a static context,
// set the new location immediately.
if (staticContext) {
method(location);
return null;
}
return react_default.a.createElement(react_router_Lifecycle, {
onMount: function onMount() {
method(location);
},
onUpdate: function onUpdate(self, prevProps) {
var prevLocation = Object(esm_history["c" /* createLocation */])(prevProps.to);
if (!Object(esm_history["f" /* locationsAreEqual */])(prevLocation, Object(esm_extends["a" /* default */])({}, location, {
key: prevLocation.key
}))) {
method(location);
}
},
to: to
});
});
}
if (false) {}
var cache$1 = {};
var cacheLimit$1 = 10000;
var cacheCount$1 = 0;
function compilePath$1(path, options) {
var cacheKey = "" + options.end + options.strict + options.sensitive;
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
if (pathCache[path]) return pathCache[path];
var keys = [];
var regexp = path_to_regexp_default()(path, keys, options);
var result = {
regexp: regexp,
keys: keys
};
if (cacheCount$1 < cacheLimit$1) {
pathCache[path] = result;
cacheCount$1++;
}
return result;
}
/**
* Public API for matching a URL pathname to a path.
*/
function matchPath(pathname, options) {
if (options === void 0) {
options = {};
}
if (typeof options === "string" || Array.isArray(options)) {
options = {
path: options
};
}
var _options = options,
path = _options.path,
_options$exact = _options.exact,
exact = _options$exact === void 0 ? false : _options$exact,
_options$strict = _options.strict,
strict = _options$strict === void 0 ? false : _options$strict,
_options$sensitive = _options.sensitive,
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
var paths = [].concat(path);
return paths.reduce(function (matched, path) {
if (!path && path !== "") return null;
if (matched) return matched;
var _compilePath = compilePath$1(path, {
end: exact,
strict: strict,
sensitive: sensitive
}),
regexp = _compilePath.regexp,
keys = _compilePath.keys;
var match = regexp.exec(pathname);
if (!match) return null;
var url = match[0],
values = match.slice(1);
var isExact = pathname === url;
if (exact && !isExact) return null;
return {
path: path,
// the path used to match
url: path === "/" && url === "" ? "/" : url,
// the matched portion of the URL
isExact: isExact,
// whether or not we matched exactly
params: keys.reduce(function (memo, key, index) {
memo[key.name] = values[index];
return memo;
}, {})
};
}, null);
}
function isEmptyChildren(children) {
return react_default.a.Children.count(children) === 0;
}
function evalChildrenDev(children, props, path) {
var value = children(props);
false ? undefined : void 0;
return value || null;
}
/**
* The public API for matching a single path and rendering.
*/
var react_router_Route =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(Route, _React$Component);
function Route() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Route.prototype;
_proto.render = function render() {
var _this = this;
return react_default.a.createElement(react_router_context.Consumer, null, function (context$1) {
!context$1 ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
var location = _this.props.location || context$1.location;
var match = _this.props.computedMatch ? _this.props.computedMatch // already computed the match for us
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
var props = Object(esm_extends["a" /* default */])({}, context$1, {
location: location,
match: match
});
var _this$props = _this.props,
children = _this$props.children,
component = _this$props.component,
render = _this$props.render; // Preact uses an empty array as children by
// default, so use null if that's the case.
if (Array.isArray(children) && children.length === 0) {
children = null;
}
return react_default.a.createElement(react_router_context.Provider, {
value: props
}, props.match ? children ? typeof children === "function" ? false ? undefined : children(props) : children : component ? react_default.a.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? false ? undefined : children(props) : null);
});
};
return Route;
}(react_default.a.Component);
if (false) {}
function addLeadingSlash(path) {
return path.charAt(0) === "/" ? path : "/" + path;
}
function addBasename(basename, location) {
if (!basename) return location;
return Object(esm_extends["a" /* default */])({}, location, {
pathname: addLeadingSlash(basename) + location.pathname
});
}
function stripBasename(basename, location) {
if (!basename) return location;
var base = addLeadingSlash(basename);
if (location.pathname.indexOf(base) !== 0) return location;
return Object(esm_extends["a" /* default */])({}, location, {
pathname: location.pathname.substr(base.length)
});
}
function createURL(location) {
return typeof location === "string" ? location : Object(esm_history["e" /* createPath */])(location);
}
function staticHandler(methodName) {
return function () {
false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) ;
};
}
function noop() {}
/**
* The public top-level API for a "static" , so-called because it
* can't actually change the current location. Instead, it just records
* location changes in a context object. Useful mainly in testing and
* server-rendering scenarios.
*/
var react_router_StaticRouter =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(StaticRouter, _React$Component);
function StaticRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.handlePush = function (location) {
return _this.navigateTo(location, "PUSH");
};
_this.handleReplace = function (location) {
return _this.navigateTo(location, "REPLACE");
};
_this.handleListen = function () {
return noop;
};
_this.handleBlock = function () {
return noop;
};
return _this;
}
var _proto = StaticRouter.prototype;
_proto.navigateTo = function navigateTo(location, action) {
var _this$props = this.props,
_this$props$basename = _this$props.basename,
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
_this$props$context = _this$props.context,
context = _this$props$context === void 0 ? {} : _this$props$context;
context.action = action;
context.location = addBasename(basename, Object(esm_history["c" /* createLocation */])(location));
context.url = createURL(context.location);
};
_proto.render = function render() {
var _this$props2 = this.props,
_this$props2$basename = _this$props2.basename,
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
_this$props2$context = _this$props2.context,
context = _this$props2$context === void 0 ? {} : _this$props2$context,
_this$props2$location = _this$props2.location,
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
rest = Object(objectWithoutPropertiesLoose["a" /* default */])(_this$props2, ["basename", "context", "location"]);
var history = {
createHref: function createHref(path) {
return addLeadingSlash(basename + createURL(path));
},
action: "POP",
location: stripBasename(basename, Object(esm_history["c" /* createLocation */])(location)),
push: this.handlePush,
replace: this.handleReplace,
go: staticHandler("go"),
goBack: staticHandler("goBack"),
goForward: staticHandler("goForward"),
listen: this.handleListen,
block: this.handleBlock
};
return react_default.a.createElement(react_router_Router, Object(esm_extends["a" /* default */])({}, rest, {
history: history,
staticContext: context
}));
};
return StaticRouter;
}(react_default.a.Component);
if (false) {}
/**
* The public API for rendering the first that matches.
*/
var react_router_Switch =
/*#__PURE__*/
function (_React$Component) {
Object(inheritsLoose["a" /* default */])(Switch, _React$Component);
function Switch() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Switch.prototype;
_proto.render = function render() {
var _this = this;
return react_default.a.createElement(react_router_context.Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
var location = _this.props.location || context.location;
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
// here because toArray adds keys to all child elements and we do not want
// to trigger an unmount/remount for two s that render the same
// component at different URLs.
react_default.a.Children.forEach(_this.props.children, function (child) {
if (match == null && react_default.a.isValidElement(child)) {
element = child;
var path = child.props.path || child.props.from;
match = path ? matchPath(location.pathname, Object(esm_extends["a" /* default */])({}, child.props, {
path: path
})) : context.match;
}
});
return match ? react_default.a.cloneElement(element, {
location: location,
computedMatch: match
}) : null;
});
};
return Switch;
}(react_default.a.Component);
if (false) {}
/**
* A public higher-order component to access the imperative API
*/
function withRouter(Component) {
var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
var C = function C(props) {
var wrappedComponentRef = props.wrappedComponentRef,
remainingProps = Object(objectWithoutPropertiesLoose["a" /* default */])(props, ["wrappedComponentRef"]);
return react_default.a.createElement(react_router_context.Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
return react_default.a.createElement(Component, Object(esm_extends["a" /* default */])({}, remainingProps, context, {
ref: wrappedComponentRef
}));
});
};
C.displayName = displayName;
C.WrappedComponent = Component;
if (false) {}
return hoist_non_react_statics_cjs_default()(C, Component);
}
var useContext = react_default.a.useContext;
function useHistory() {
if (false) {}
return useContext(react_router_context).history;
}
function useLocation() {
if (false) {}
return useContext(react_router_context).location;
}
function useParams() {
if (false) {}
var match = useContext(react_router_context).match;
return match ? match.params : {};
}
function useRouteMatch(path) {
if (false) {}
return path ? matchPath(useLocation().pathname, path) : useContext(react_router_context).match;
}
if (false) { var secondaryBuildName, initialBuildName, buildNames, key, global; }
//# sourceMappingURL=react-router.js.map
/***/ }),
/* 117 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var isProduction = "production" === 'production';
var prefix = 'Invariant failed';
function invariant(condition, message) {
if (condition) {
return;
}
if (isProduction) {
throw new Error(prefix);
}
throw new Error(prefix + ": " + (message || ''));
}
/* harmony default export */ __webpack_exports__["a"] = (invariant);
/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const u = __webpack_require__(113).fromCallback
const mkdirs = u(__webpack_require__(486))
const mkdirsSync = __webpack_require__(487)
module.exports = {
mkdirs,
mkdirsSync,
// alias
mkdirp: mkdirs,
mkdirpSync: mkdirsSync,
ensureDir: mkdirs,
ensureDirSync: mkdirsSync
}
/***/ }),
/* 119 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return registerSingleton; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getSingletonServiceDescriptors; });
/* harmony import */ var _descriptors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var _registry = [];
function registerSingleton(id, ctor, supportsDelayedInstantiation) {
_registry.push([id, new _descriptors_js__WEBPACK_IMPORTED_MODULE_0__[/* SyncDescriptor */ "a"](ctor, [], supportsDelayedInstantiation)]);
}
function getSingletonServiceDescriptors() {
return _registry;
}
/***/ }),
/* 120 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserFeatures; });
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Browser feature we can support in current platform, browser and environment.
*/
var BrowserFeatures = {
clipboard: {
writeText: (_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isNative */ "f"]
|| (document.queryCommandSupported && document.queryCommandSupported('copy'))
|| !!(navigator && navigator.clipboard && navigator.clipboard.writeText)),
readText: (_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isNative */ "f"]
|| !!(navigator && navigator.clipboard && navigator.clipboard.readText)),
richText: (function () {
if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isIE */ "i"]) {
return false;
}
if (_browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isEdge */ "e"]) {
var index = navigator.userAgent.indexOf('Edge/');
var version = parseInt(navigator.userAgent.substring(index + 5, navigator.userAgent.indexOf('.', index)), 10);
if (!version || (version >= 12 && version <= 16)) {
return false;
}
}
return true;
})()
},
keyboard: (function () {
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_1__[/* isNative */ "f"] || _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isStandalone */ "l"]) {
return 0 /* Always */;
}
if (navigator.keyboard || _browser_js__WEBPACK_IMPORTED_MODULE_0__[/* isSafari */ "k"]) {
return 1 /* FullScreen */;
}
return 2 /* None */;
})(),
touch: 'ontouchstart' in window || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0,
pointerEvents: window.PointerEvent && ('ontouchstart' in window || window.navigator.maxTouchPoints > 0 || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0)
};
/***/ }),
/* 121 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ILogService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LogLevel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NullLogService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ILogService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('logService');
var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["Trace"] = 0] = "Trace";
LogLevel[LogLevel["Debug"] = 1] = "Debug";
LogLevel[LogLevel["Info"] = 2] = "Info";
LogLevel[LogLevel["Warning"] = 3] = "Warning";
LogLevel[LogLevel["Error"] = 4] = "Error";
LogLevel[LogLevel["Critical"] = 5] = "Critical";
LogLevel[LogLevel["Off"] = 6] = "Off";
})(LogLevel || (LogLevel = {}));
var NullLogService = /** @class */ (function () {
function NullLogService() {
}
NullLogService.prototype.getLevel = function () { return LogLevel.Info; };
NullLogService.prototype.trace = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
};
NullLogService.prototype.error = function (message) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
};
NullLogService.prototype.dispose = function () { };
return NullLogService;
}());
/***/ }),
/* 122 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IStandaloneThemeService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IStandaloneThemeService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('themeService');
/***/ }),
/* 123 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return USUAL_WORD_SEPARATORS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DEFAULT_WORD_REGEXP; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ensureValidWordDefinition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getWordAtText; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var USUAL_WORD_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?';
/**
* Create a word definition regular expression based on default word separators.
* Optionally provide allowed separators that should be included in words.
*
* The default would look like this:
* /(-?\d*\.\d\w*)|([^\`\~\!\@\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
*/
function createWordRegExp(allowInWords) {
if (allowInWords === void 0) { allowInWords = ''; }
var source = '(-?\\d*\\.\\d\\w*)|([^';
for (var _i = 0, USUAL_WORD_SEPARATORS_1 = USUAL_WORD_SEPARATORS; _i < USUAL_WORD_SEPARATORS_1.length; _i++) {
var sep = USUAL_WORD_SEPARATORS_1[_i];
if (allowInWords.indexOf(sep) >= 0) {
continue;
}
source += '\\' + sep;
}
source += '\\s]+)';
return new RegExp(source, 'g');
}
// catches numbers (including floating numbers) in the first group, and alphanum in the second
var DEFAULT_WORD_REGEXP = createWordRegExp();
function ensureValidWordDefinition(wordDefinition) {
var result = DEFAULT_WORD_REGEXP;
if (wordDefinition && (wordDefinition instanceof RegExp)) {
if (!wordDefinition.global) {
var 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 getWordAtPosFast(column, wordDefinition, text, textOffset) {
// find whitespace enclosed text around column and match from there
var pos = column - 1 - textOffset;
var start = text.lastIndexOf(' ', pos - 1) + 1;
wordDefinition.lastIndex = start;
var match;
while (match = wordDefinition.exec(text)) {
var matchIndex = match.index || 0;
if (matchIndex <= pos && wordDefinition.lastIndex >= pos) {
return {
word: match[0],
startColumn: textOffset + 1 + matchIndex,
endColumn: textOffset + 1 + wordDefinition.lastIndex
};
}
}
return null;
}
function getWordAtPosSlow(column, wordDefinition, text, textOffset) {
// matches all words starting at the beginning
// of the input until it finds a match that encloses
// the desired column. slow but correct
var pos = column - 1 - textOffset;
wordDefinition.lastIndex = 0;
var match;
while (match = wordDefinition.exec(text)) {
var matchIndex = match.index || 0;
if (matchIndex > pos) {
// |nW -> matched only after the pos
return null;
}
else if (wordDefinition.lastIndex >= pos) {
// W|W -> match encloses pos
return {
word: match[0],
startColumn: textOffset + 1 + matchIndex,
endColumn: textOffset + 1 + wordDefinition.lastIndex
};
}
}
return null;
}
function getWordAtText(column, wordDefinition, text, textOffset) {
// if `words` can contain whitespace character we have to use the slow variant
// otherwise we use the fast variant of finding a word
wordDefinition.lastIndex = 0;
var match = wordDefinition.exec(text);
if (!match) {
return null;
}
// todo@joh the `match` could already be the (first) word
var ret = match[0].indexOf(' ') >= 0
// did match a word which contains a space character -> use slow word find
? getWordAtPosSlow(column, wordDefinition, text, textOffset)
// sane word definition -> use fast word find
: getWordAtPosFast(column, wordDefinition, text, textOffset);
// both (getWordAtPosFast and getWordAtPosSlow) leave the wordDefinition-RegExp
// in an undefined state and to not confuse other users of the wordDefinition
// we reset the lastIndex
wordDefinition.lastIndex = 0;
return ret;
}
/***/ }),
/* 124 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return countEOL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MultilineTokensBuilder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return SparseEncodedTokens; });
/* unused harmony export LineTokens2 */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MultilineTokens2; });
/* unused harmony export MultilineTokens */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return TokensStore2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return TokensStore; });
/* harmony import */ var _base_common_arrays_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18);
/* harmony import */ var _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(94);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
/* harmony import */ var _modes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function countEOL(text) {
var eolCount = 0;
var firstLineLength = 0;
var lastLineStart = 0;
for (var i = 0, len = text.length; i < len; i++) {
var chr = text.charCodeAt(i);
if (chr === 13 /* CarriageReturn */) {
if (eolCount === 0) {
firstLineLength = i;
}
eolCount++;
if (i + 1 < len && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
// \r\n... case
i++; // skip \n
}
else {
// \r... case
}
lastLineStart = i + 1;
}
else if (chr === 10 /* LineFeed */) {
if (eolCount === 0) {
firstLineLength = i;
}
eolCount++;
lastLineStart = i + 1;
}
}
if (eolCount === 0) {
firstLineLength = text.length;
}
return [eolCount, firstLineLength, text.length - lastLineStart];
}
function getDefaultMetadata(topLevelLanguageId) {
return ((topLevelLanguageId << 0 /* LANGUAGEID_OFFSET */)
| (0 /* Other */ << 8 /* TOKEN_TYPE_OFFSET */)
| (0 /* None */ << 11 /* FONT_STYLE_OFFSET */)
| (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)
| (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;
}
var EMPTY_LINE_TOKENS = (new Uint32Array(0)).buffer;
var MultilineTokensBuilder = /** @class */ (function () {
function MultilineTokensBuilder() {
this.tokens = [];
}
MultilineTokensBuilder.prototype.add = function (lineNumber, lineTokens) {
if (this.tokens.length > 0) {
var last = this.tokens[this.tokens.length - 1];
var lastLineNumber = last.startLineNumber + last.tokens.length - 1;
if (lastLineNumber + 1 === lineNumber) {
// append
last.tokens.push(lineTokens);
return;
}
}
this.tokens.push(new MultilineTokens(lineNumber, [lineTokens]));
};
return MultilineTokensBuilder;
}());
var SparseEncodedTokens = /** @class */ (function () {
function SparseEncodedTokens(tokens) {
this._tokens = tokens;
this._tokenCount = tokens.length / 4;
}
SparseEncodedTokens.prototype.getMaxDeltaLine = function () {
var tokenCount = this.getTokenCount();
if (tokenCount === 0) {
return -1;
}
return this.getDeltaLine(tokenCount - 1);
};
SparseEncodedTokens.prototype.getTokenCount = function () {
return this._tokenCount;
};
SparseEncodedTokens.prototype.getDeltaLine = function (tokenIndex) {
return this._tokens[4 * tokenIndex];
};
SparseEncodedTokens.prototype.getStartCharacter = function (tokenIndex) {
return this._tokens[4 * tokenIndex + 1];
};
SparseEncodedTokens.prototype.getEndCharacter = function (tokenIndex) {
return this._tokens[4 * tokenIndex + 2];
};
SparseEncodedTokens.prototype.getMetadata = function (tokenIndex) {
return this._tokens[4 * tokenIndex + 3];
};
SparseEncodedTokens.prototype.clear = function () {
this._tokenCount = 0;
};
SparseEncodedTokens.prototype.acceptDeleteRange = function (horizontalShiftForFirstLineTokens, startDeltaLine, startCharacter, endDeltaLine, endCharacter) {
// This is a bit complex, here are the cases I used to think about this:
//
// 1. The token starts before the deletion range
// 1a. The token is completely before the deletion range
// -----------
// xxxxxxxxxxx
// 1b. The token starts before, the deletion range ends after the token
// -----------
// xxxxxxxxxxx
// 1c. The token starts before, the deletion range ends precisely with the token
// ---------------
// xxxxxxxx
// 1d. The token starts before, the deletion range is inside the token
// ---------------
// xxxxx
//
// 2. The token starts at the same position with the deletion range
// 2a. The token starts at the same position, and ends inside the deletion range
// -------
// xxxxxxxxxxx
// 2b. The token starts at the same position, and ends at the same position as the deletion range
// ----------
// xxxxxxxxxx
// 2c. The token starts at the same position, and ends after the deletion range
// -------------
// xxxxxxx
//
// 3. The token starts inside the deletion range
// 3a. The token is inside the deletion range
// -------
// xxxxxxxxxxxxx
// 3b. The token starts inside the deletion range, and ends at the same position as the deletion range
// ----------
// xxxxxxxxxxxxx
// 3c. The token starts inside the deletion range, and ends after the deletion range
// ------------
// xxxxxxxxxxx
//
// 4. The token starts after the deletion range
// -----------
// xxxxxxxx
//
var tokens = this._tokens;
var tokenCount = this._tokenCount;
var deletedLineCount = (endDeltaLine - startDeltaLine);
var newTokenCount = 0;
var hasDeletedTokens = false;
for (var i = 0; i < tokenCount; i++) {
var srcOffset = 4 * i;
var tokenDeltaLine = tokens[srcOffset];
var tokenStartCharacter = tokens[srcOffset + 1];
var tokenEndCharacter = tokens[srcOffset + 2];
var tokenMetadata = tokens[srcOffset + 3];
if (tokenDeltaLine < startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter <= startCharacter)) {
// 1a. The token is completely before the deletion range
// => nothing to do
newTokenCount++;
continue;
}
else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter < startCharacter) {
// 1b, 1c, 1d
// => the token survives, but it needs to shrink
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
// 1d. The token starts before, the deletion range is inside the token
// => the token shrinks by the deletion character count
tokenEndCharacter -= (endCharacter - startCharacter);
}
else {
// 1b. The token starts before, the deletion range ends after the token
// 1c. The token starts before, the deletion range ends precisely with the token
// => the token shrinks its ending to the deletion start
tokenEndCharacter = startCharacter;
}
}
else if (tokenDeltaLine === startDeltaLine && tokenStartCharacter === startCharacter) {
// 2a, 2b, 2c
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
// 2c. The token starts at the same position, and ends after the deletion range
// => the token shrinks by the deletion character count
tokenEndCharacter -= (endCharacter - startCharacter);
}
else {
// 2a. The token starts at the same position, and ends inside the deletion range
// 2b. The token starts at the same position, and ends at the same position as the deletion range
// => the token is deleted
hasDeletedTokens = true;
continue;
}
}
else if (tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter < endCharacter)) {
// 3a, 3b, 3c
if (tokenDeltaLine === endDeltaLine && tokenEndCharacter > endCharacter) {
// 3c. The token starts inside the deletion range, and ends after the deletion range
// => the token moves left and shrinks
if (tokenDeltaLine === startDeltaLine) {
// the deletion started on the same line as the token
// => the token moves left and shrinks
tokenStartCharacter = startCharacter;
tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter);
}
else {
// the deletion started on a line above the token
// => the token moves to the beginning of the line
tokenStartCharacter = 0;
tokenEndCharacter = tokenStartCharacter + (tokenEndCharacter - endCharacter);
}
}
else {
// 3a. The token is inside the deletion range
// 3b. The token starts inside the deletion range, and ends at the same position as the deletion range
// => the token is deleted
hasDeletedTokens = true;
continue;
}
}
else if (tokenDeltaLine > endDeltaLine) {
// 4. (partial) The token starts after the deletion range, on a line below...
if (deletedLineCount === 0 && !hasDeletedTokens) {
// early stop, there is no need to walk all the tokens and do nothing...
newTokenCount = tokenCount;
break;
}
tokenDeltaLine -= deletedLineCount;
}
else if (tokenDeltaLine === endDeltaLine && tokenStartCharacter >= endCharacter) {
// 4. (continued) The token starts after the deletion range, on the last line where a deletion occurs
if (horizontalShiftForFirstLineTokens && tokenDeltaLine === 0) {
tokenStartCharacter += horizontalShiftForFirstLineTokens;
tokenEndCharacter += horizontalShiftForFirstLineTokens;
}
tokenDeltaLine -= deletedLineCount;
tokenStartCharacter -= (endCharacter - startCharacter);
tokenEndCharacter -= (endCharacter - startCharacter);
}
else {
throw new Error("Not possible!");
}
var destOffset = 4 * newTokenCount;
tokens[destOffset] = tokenDeltaLine;
tokens[destOffset + 1] = tokenStartCharacter;
tokens[destOffset + 2] = tokenEndCharacter;
tokens[destOffset + 3] = tokenMetadata;
newTokenCount++;
}
this._tokenCount = newTokenCount;
};
SparseEncodedTokens.prototype.acceptInsertText = function (deltaLine, character, eolCount, firstLineLength, lastLineLength, firstCharCode) {
// Here are the cases I used to think about this:
//
// 1. The token is completely before the insertion point
// ----------- |
// 2. The token ends precisely at the insertion point
// -----------|
// 3. The token contains the insertion point
// -----|------
// 4. The token starts precisely at the insertion point
// |-----------
// 5. The token is completely after the insertion point
// | -----------
//
var isInsertingPreciselyOneWordCharacter = (eolCount === 0
&& firstLineLength === 1
&& ((firstCharCode >= 48 /* Digit0 */ && firstCharCode <= 57 /* Digit9 */)
|| (firstCharCode >= 65 /* A */ && firstCharCode <= 90 /* Z */)
|| (firstCharCode >= 97 /* a */ && firstCharCode <= 122 /* z */)));
var tokens = this._tokens;
var tokenCount = this._tokenCount;
for (var i = 0; i < tokenCount; i++) {
var offset = 4 * i;
var tokenDeltaLine = tokens[offset];
var tokenStartCharacter = tokens[offset + 1];
var tokenEndCharacter = tokens[offset + 2];
if (tokenDeltaLine < deltaLine || (tokenDeltaLine === deltaLine && tokenEndCharacter < character)) {
// 1. The token is completely before the insertion point
// => nothing to do
continue;
}
else if (tokenDeltaLine === deltaLine && tokenEndCharacter === character) {
// 2. The token ends precisely at the insertion point
// => expand the end character only if inserting precisely one character that is a word character
if (isInsertingPreciselyOneWordCharacter) {
tokenEndCharacter += 1;
}
else {
continue;
}
}
else if (tokenDeltaLine === deltaLine && tokenStartCharacter < character && character < tokenEndCharacter) {
// 3. The token contains the insertion point
if (eolCount === 0) {
// => just expand the end character
tokenEndCharacter += firstLineLength;
}
else {
// => cut off the token
tokenEndCharacter = character;
}
}
else {
// 4. or 5.
if (tokenDeltaLine === deltaLine && tokenStartCharacter === character) {
// 4. The token starts precisely at the insertion point
// => grow the token (by keeping its start constant) only if inserting precisely one character that is a word character
// => otherwise behave as in case 5.
if (isInsertingPreciselyOneWordCharacter) {
continue;
}
}
// => the token must move and keep its size constant
if (tokenDeltaLine === deltaLine) {
tokenDeltaLine += eolCount;
// this token is on the line where the insertion is taking place
if (eolCount === 0) {
tokenStartCharacter += firstLineLength;
tokenEndCharacter += firstLineLength;
}
else {
var tokenLength = tokenEndCharacter - tokenStartCharacter;
tokenStartCharacter = lastLineLength + (tokenStartCharacter - character);
tokenEndCharacter = tokenStartCharacter + tokenLength;
}
}
else {
tokenDeltaLine += eolCount;
}
}
tokens[offset] = tokenDeltaLine;
tokens[offset + 1] = tokenStartCharacter;
tokens[offset + 2] = tokenEndCharacter;
}
};
return SparseEncodedTokens;
}());
var LineTokens2 = /** @class */ (function () {
function LineTokens2(actual, startTokenIndex, endTokenIndex) {
this._actual = actual;
this._startTokenIndex = startTokenIndex;
this._endTokenIndex = endTokenIndex;
}
LineTokens2.prototype.getCount = function () {
return this._endTokenIndex - this._startTokenIndex + 1;
};
LineTokens2.prototype.getStartCharacter = function (tokenIndex) {
return this._actual.getStartCharacter(this._startTokenIndex + tokenIndex);
};
LineTokens2.prototype.getEndCharacter = function (tokenIndex) {
return this._actual.getEndCharacter(this._startTokenIndex + tokenIndex);
};
LineTokens2.prototype.getMetadata = function (tokenIndex) {
return this._actual.getMetadata(this._startTokenIndex + tokenIndex);
};
return LineTokens2;
}());
var MultilineTokens2 = /** @class */ (function () {
function MultilineTokens2(startLineNumber, tokens) {
this.startLineNumber = startLineNumber;
this.tokens = tokens;
this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine();
}
MultilineTokens2.prototype._updateEndLineNumber = function () {
this.endLineNumber = this.startLineNumber + this.tokens.getMaxDeltaLine();
};
MultilineTokens2.prototype.getLineTokens = function (lineNumber) {
if (this.startLineNumber <= lineNumber && lineNumber <= this.endLineNumber) {
var findResult = MultilineTokens2._findTokensWithLine(this.tokens, lineNumber - this.startLineNumber);
if (findResult) {
var startTokenIndex = findResult[0], endTokenIndex = findResult[1];
return new LineTokens2(this.tokens, startTokenIndex, endTokenIndex);
}
}
return null;
};
MultilineTokens2._findTokensWithLine = function (tokens, deltaLine) {
var low = 0;
var high = tokens.getTokenCount() - 1;
while (low < high) {
var mid = low + Math.floor((high - low) / 2);
var midDeltaLine = tokens.getDeltaLine(mid);
if (midDeltaLine < deltaLine) {
low = mid + 1;
}
else if (midDeltaLine > deltaLine) {
high = mid - 1;
}
else {
var min = mid;
while (min > low && tokens.getDeltaLine(min - 1) === deltaLine) {
min--;
}
var max = mid;
while (max < high && tokens.getDeltaLine(max + 1) === deltaLine) {
max++;
}
return [min, max];
}
}
if (tokens.getDeltaLine(low) === deltaLine) {
return [low, low];
}
return null;
};
MultilineTokens2.prototype.applyEdit = function (range, text) {
var _a = countEOL(text), eolCount = _a[0], firstLineLength = _a[1], lastLineLength = _a[2];
this.acceptEdit(range, eolCount, firstLineLength, lastLineLength, text.length > 0 ? text.charCodeAt(0) : 0 /* Null */);
};
MultilineTokens2.prototype.acceptEdit = function (range, eolCount, firstLineLength, lastLineLength, firstCharCode) {
this._acceptDeleteRange(range);
this._acceptInsertText(new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](range.startLineNumber, range.startColumn), eolCount, firstLineLength, lastLineLength, firstCharCode);
this._updateEndLineNumber();
};
MultilineTokens2.prototype._acceptDeleteRange = function (range) {
if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {
// Nothing to delete
return;
}
var firstLineIndex = range.startLineNumber - this.startLineNumber;
var lastLineIndex = range.endLineNumber - this.startLineNumber;
if (lastLineIndex < 0) {
// this deletion occurs entirely before this block, so we only need to adjust line numbers
var deletedLinesCount = lastLineIndex - firstLineIndex;
this.startLineNumber -= deletedLinesCount;
return;
}
var tokenMaxDeltaLine = this.tokens.getMaxDeltaLine();
if (firstLineIndex >= tokenMaxDeltaLine + 1) {
// this deletion occurs entirely after this block, so there is nothing to do
return;
}
if (firstLineIndex < 0 && lastLineIndex >= tokenMaxDeltaLine + 1) {
// this deletion completely encompasses this block
this.startLineNumber = 0;
this.tokens.clear();
return;
}
if (firstLineIndex < 0) {
var deletedBefore = -firstLineIndex;
this.startLineNumber -= deletedBefore;
this.tokens.acceptDeleteRange(range.startColumn - 1, 0, 0, lastLineIndex, range.endColumn - 1);
}
else {
this.tokens.acceptDeleteRange(0, firstLineIndex, range.startColumn - 1, lastLineIndex, range.endColumn - 1);
}
};
MultilineTokens2.prototype._acceptInsertText = function (position, eolCount, firstLineLength, lastLineLength, firstCharCode) {
if (eolCount === 0 && firstLineLength === 0) {
// Nothing to insert
return;
}
var lineIndex = position.lineNumber - this.startLineNumber;
if (lineIndex < 0) {
// this insertion occurs before this block, so we only need to adjust line numbers
this.startLineNumber += eolCount;
return;
}
var tokenMaxDeltaLine = this.tokens.getMaxDeltaLine();
if (lineIndex >= tokenMaxDeltaLine + 1) {
// this insertion occurs after this block, so there is nothing to do
return;
}
this.tokens.acceptInsertText(lineIndex, position.column - 1, eolCount, firstLineLength, lastLineLength, firstCharCode);
};
return MultilineTokens2;
}());
var MultilineTokens = /** @class */ (function () {
function MultilineTokens(startLineNumber, tokens) {
this.startLineNumber = startLineNumber;
this.tokens = tokens;
}
return MultilineTokens;
}());
function toUint32Array(arr) {
if (arr instanceof Uint32Array) {
return arr;
}
else {
return new Uint32Array(arr);
}
}
var TokensStore2 = /** @class */ (function () {
function TokensStore2() {
this._pieces = [];
}
TokensStore2.prototype.flush = function () {
this._pieces = [];
};
TokensStore2.prototype.set = function (pieces) {
this._pieces = pieces || [];
};
TokensStore2.prototype.addSemanticTokens = function (lineNumber, aTokens) {
var pieces = this._pieces;
if (pieces.length === 0) {
return aTokens;
}
var pieceIndex = TokensStore2._findFirstPieceWithLine(pieces, lineNumber);
var bTokens = this._pieces[pieceIndex].getLineTokens(lineNumber);
if (!bTokens) {
return aTokens;
}
var aLen = aTokens.getCount();
var bLen = bTokens.getCount();
var aIndex = 0;
var result = [], resultLen = 0;
for (var bIndex = 0; bIndex < bLen; bIndex++) {
var bStartCharacter = bTokens.getStartCharacter(bIndex);
var bEndCharacter = bTokens.getEndCharacter(bIndex);
var bMetadata = bTokens.getMetadata(bIndex);
var bMask = (((bMetadata & 1 /* SEMANTIC_USE_ITALIC */) ? 2048 /* ITALIC_MASK */ : 0)
| ((bMetadata & 2 /* SEMANTIC_USE_BOLD */) ? 4096 /* BOLD_MASK */ : 0)
| ((bMetadata & 4 /* SEMANTIC_USE_UNDERLINE */) ? 8192 /* UNDERLINE_MASK */ : 0)
| ((bMetadata & 8 /* SEMANTIC_USE_FOREGROUND */) ? 8372224 /* FOREGROUND_MASK */ : 0)
| ((bMetadata & 16 /* SEMANTIC_USE_BACKGROUND */) ? 4286578688 /* BACKGROUND_MASK */ : 0)) >>> 0;
var aMask = (~bMask) >>> 0;
// push any token from `a` that is before `b`
while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) {
result[resultLen++] = aTokens.getEndOffset(aIndex);
result[resultLen++] = aTokens.getMetadata(aIndex);
aIndex++;
}
// push the token from `a` if it intersects the token from `b`
if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) {
result[resultLen++] = bStartCharacter;
result[resultLen++] = aTokens.getMetadata(aIndex);
}
// skip any tokens from `a` that are contained inside `b`
while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) {
result[resultLen++] = aTokens.getEndOffset(aIndex);
result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask);
aIndex++;
}
if (aIndex < aLen && aTokens.getEndOffset(aIndex) === bEndCharacter) {
// `a` ends exactly at the same spot as `b`!
result[resultLen++] = aTokens.getEndOffset(aIndex);
result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask);
aIndex++;
}
else {
var aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1);
// push the token from `b`
result[resultLen++] = bEndCharacter;
result[resultLen++] = (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask);
}
}
// push the remaining tokens from `a`
while (aIndex < aLen) {
result[resultLen++] = aTokens.getEndOffset(aIndex);
result[resultLen++] = aTokens.getMetadata(aIndex);
aIndex++;
}
return new _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__[/* LineTokens */ "a"](new Uint32Array(result), aTokens.getLineContent());
};
TokensStore2._findFirstPieceWithLine = function (pieces, lineNumber) {
var low = 0;
var high = pieces.length - 1;
while (low < high) {
var 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;
};
//#region Editing
TokensStore2.prototype.acceptEdit = function (range, eolCount, firstLineLength, lastLineLength, firstCharCode) {
for (var _i = 0, _a = this._pieces; _i < _a.length; _i++) {
var piece = _a[_i];
piece.acceptEdit(range, eolCount, firstLineLength, lastLineLength, firstCharCode);
}
};
return TokensStore2;
}());
var TokensStore = /** @class */ (function () {
function TokensStore() {
this._lineTokens = [];
this._len = 0;
}
TokensStore.prototype.flush = function () {
this._lineTokens = [];
this._len = 0;
};
TokensStore.prototype.getTokens = function (topLevelLanguageId, lineIndex, lineText) {
var rawLineTokens = null;
if (lineIndex < this._len) {
rawLineTokens = this._lineTokens[lineIndex];
}
if (rawLineTokens !== null && rawLineTokens !== EMPTY_LINE_TOKENS) {
return new _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__[/* LineTokens */ "a"](toUint32Array(rawLineTokens), lineText);
}
var lineTokens = new Uint32Array(2);
lineTokens[0] = lineText.length;
lineTokens[1] = getDefaultMetadata(topLevelLanguageId);
return new _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__[/* LineTokens */ "a"](lineTokens, lineText);
};
TokensStore._massageTokens = function (topLevelLanguageId, lineTextLength, _tokens) {
var tokens = _tokens ? toUint32Array(_tokens) : null;
if (lineTextLength === 0) {
var hasDifferentLanguageId = false;
if (tokens && tokens.length > 1) {
hasDifferentLanguageId = (_modes_js__WEBPACK_IMPORTED_MODULE_3__[/* TokenMetadata */ "A"].getLanguageId(tokens[1]) !== topLevelLanguageId);
}
if (!hasDifferentLanguageId) {
return EMPTY_LINE_TOKENS;
}
}
if (!tokens || tokens.length === 0) {
var tokens_1 = new Uint32Array(2);
tokens_1[0] = lineTextLength;
tokens_1[1] = getDefaultMetadata(topLevelLanguageId);
return tokens_1.buffer;
}
// Ensure the last token covers the end of the text
tokens[tokens.length - 2] = lineTextLength;
if (tokens.byteOffset === 0 && tokens.byteLength === tokens.buffer.byteLength) {
// Store directly the ArrayBuffer pointer to save an object
return tokens.buffer;
}
return tokens;
};
TokensStore.prototype._ensureLine = function (lineIndex) {
while (lineIndex >= this._len) {
this._lineTokens[this._len] = null;
this._len++;
}
};
TokensStore.prototype._deleteLines = function (start, deleteCount) {
if (deleteCount === 0) {
return;
}
if (start + deleteCount > this._len) {
deleteCount = this._len - start;
}
this._lineTokens.splice(start, deleteCount);
this._len -= deleteCount;
};
TokensStore.prototype._insertLines = function (insertIndex, insertCount) {
if (insertCount === 0) {
return;
}
var lineTokens = [];
for (var i = 0; i < insertCount; i++) {
lineTokens[i] = null;
}
this._lineTokens = _base_common_arrays_js__WEBPACK_IMPORTED_MODULE_0__[/* arrayInsert */ "a"](this._lineTokens, insertIndex, lineTokens);
this._len += insertCount;
};
TokensStore.prototype.setTokens = function (topLevelLanguageId, lineIndex, lineTextLength, _tokens) {
var tokens = TokensStore._massageTokens(topLevelLanguageId, lineTextLength, _tokens);
this._ensureLine(lineIndex);
this._lineTokens[lineIndex] = tokens;
};
//#region Editing
TokensStore.prototype.acceptEdit = function (range, eolCount, firstLineLength) {
this._acceptDeleteRange(range);
this._acceptInsertText(new _core_position_js__WEBPACK_IMPORTED_MODULE_2__[/* Position */ "a"](range.startLineNumber, range.startColumn), eolCount, firstLineLength);
};
TokensStore.prototype._acceptDeleteRange = function (range) {
var firstLineIndex = range.startLineNumber - 1;
if (firstLineIndex >= this._len) {
return;
}
if (range.startLineNumber === range.endLineNumber) {
if (range.startColumn === range.endColumn) {
// Nothing to delete
return;
}
this._lineTokens[firstLineIndex] = TokensStore._delete(this._lineTokens[firstLineIndex], range.startColumn - 1, range.endColumn - 1);
return;
}
this._lineTokens[firstLineIndex] = TokensStore._deleteEnding(this._lineTokens[firstLineIndex], range.startColumn - 1);
var lastLineIndex = range.endLineNumber - 1;
var lastLineTokens = null;
if (lastLineIndex < this._len) {
lastLineTokens = TokensStore._deleteBeginning(this._lineTokens[lastLineIndex], range.endColumn - 1);
}
// Take remaining text on last line and append it to remaining text on first line
this._lineTokens[firstLineIndex] = TokensStore._append(this._lineTokens[firstLineIndex], lastLineTokens);
// Delete middle lines
this._deleteLines(range.startLineNumber, range.endLineNumber - range.startLineNumber);
};
TokensStore.prototype._acceptInsertText = function (position, eolCount, firstLineLength) {
if (eolCount === 0 && firstLineLength === 0) {
// Nothing to insert
return;
}
var lineIndex = position.lineNumber - 1;
if (lineIndex >= this._len) {
return;
}
if (eolCount === 0) {
// Inserting text on one line
this._lineTokens[lineIndex] = TokensStore._insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);
return;
}
this._lineTokens[lineIndex] = TokensStore._deleteEnding(this._lineTokens[lineIndex], position.column - 1);
this._lineTokens[lineIndex] = TokensStore._insert(this._lineTokens[lineIndex], position.column - 1, firstLineLength);
this._insertLines(position.lineNumber, eolCount);
};
TokensStore._deleteBeginning = function (lineTokens, toChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
return TokensStore._delete(lineTokens, 0, toChIndex);
};
TokensStore._deleteEnding = function (lineTokens, fromChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
var tokens = toUint32Array(lineTokens);
var lineTextLength = tokens[tokens.length - 2];
return TokensStore._delete(lineTokens, fromChIndex, lineTextLength);
};
TokensStore._delete = function (lineTokens, fromChIndex, toChIndex) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS || fromChIndex === toChIndex) {
return lineTokens;
}
var tokens = toUint32Array(lineTokens);
var tokensCount = (tokens.length >>> 1);
// special case: deleting everything
if (fromChIndex === 0 && tokens[tokens.length - 2] === toChIndex) {
return EMPTY_LINE_TOKENS;
}
var fromTokenIndex = _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__[/* LineTokens */ "a"].findIndexInTokensArray(tokens, fromChIndex);
var fromTokenStartOffset = (fromTokenIndex > 0 ? tokens[(fromTokenIndex - 1) << 1] : 0);
var fromTokenEndOffset = tokens[fromTokenIndex << 1];
if (toChIndex < fromTokenEndOffset) {
// the delete range is inside a single token
var delta_1 = (toChIndex - fromChIndex);
for (var i = fromTokenIndex; i < tokensCount; i++) {
tokens[i << 1] -= delta_1;
}
return lineTokens;
}
var dest;
var lastEnd;
if (fromTokenStartOffset !== fromChIndex) {
tokens[fromTokenIndex << 1] = fromChIndex;
dest = ((fromTokenIndex + 1) << 1);
lastEnd = fromChIndex;
}
else {
dest = (fromTokenIndex << 1);
lastEnd = fromTokenStartOffset;
}
var delta = (toChIndex - fromChIndex);
for (var tokenIndex = fromTokenIndex + 1; tokenIndex < tokensCount; tokenIndex++) {
var tokenEndOffset = tokens[tokenIndex << 1] - delta;
if (tokenEndOffset > lastEnd) {
tokens[dest++] = tokenEndOffset;
tokens[dest++] = tokens[(tokenIndex << 1) + 1];
lastEnd = tokenEndOffset;
}
}
if (dest === tokens.length) {
// nothing to trim
return lineTokens;
}
var tmp = new Uint32Array(dest);
tmp.set(tokens.subarray(0, dest), 0);
return tmp.buffer;
};
TokensStore._append = function (lineTokens, _otherTokens) {
if (_otherTokens === EMPTY_LINE_TOKENS) {
return lineTokens;
}
if (lineTokens === EMPTY_LINE_TOKENS) {
return _otherTokens;
}
if (lineTokens === null) {
return lineTokens;
}
if (_otherTokens === null) {
// cannot determine combined line length...
return null;
}
var myTokens = toUint32Array(lineTokens);
var otherTokens = toUint32Array(_otherTokens);
var otherTokensCount = (otherTokens.length >>> 1);
var result = new Uint32Array(myTokens.length + otherTokens.length);
result.set(myTokens, 0);
var dest = myTokens.length;
var delta = myTokens[myTokens.length - 2];
for (var i = 0; i < otherTokensCount; i++) {
result[dest++] = otherTokens[(i << 1)] + delta;
result[dest++] = otherTokens[(i << 1) + 1];
}
return result.buffer;
};
TokensStore._insert = function (lineTokens, chIndex, textLength) {
if (lineTokens === null || lineTokens === EMPTY_LINE_TOKENS) {
// nothing to do
return lineTokens;
}
var tokens = toUint32Array(lineTokens);
var tokensCount = (tokens.length >>> 1);
var fromTokenIndex = _core_lineTokens_js__WEBPACK_IMPORTED_MODULE_1__[/* LineTokens */ "a"].findIndexInTokensArray(tokens, chIndex);
if (fromTokenIndex > 0) {
var fromTokenStartOffset = tokens[(fromTokenIndex - 1) << 1];
if (fromTokenStartOffset === chIndex) {
fromTokenIndex--;
}
}
for (var tokenIndex = fromTokenIndex; tokenIndex < tokensCount; tokenIndex++) {
tokens[tokenIndex << 1] += textLength;
}
return lineTokens;
};
return TokensStore;
}());
/***/ }),
/* 125 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return WordOperations; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return WordPartOperations; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
/* harmony import */ var _wordCharacterClassifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(104);
/* harmony import */ var _core_position_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var WordOperations = /** @class */ (function () {
function WordOperations() {
}
WordOperations._createWord = function (lineContent, wordType, nextCharClass, start, end) {
// console.log('WORD ==> ' + start + ' => ' + end + ':::: <<<' + lineContent.substring(start, end) + '>>>');
return { start: start, end: end, wordType: wordType, nextCharClass: nextCharClass };
};
WordOperations._findPreviousWordOnLine = function (wordSeparators, model, position) {
var lineContent = model.getLineContent(position.lineNumber);
return this._doFindPreviousWordOnLine(lineContent, wordSeparators, position);
};
WordOperations._doFindPreviousWordOnLine = function (lineContent, wordSeparators, position) {
var wordType = 0 /* None */;
for (var chIndex = position.column - 2; chIndex >= 0; chIndex--) {
var chCode = lineContent.charCodeAt(chIndex);
var chClass = wordSeparators.get(chCode);
if (chClass === 0 /* Regular */) {
if (wordType === 2 /* Separator */) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));
}
wordType = 1 /* Regular */;
}
else if (chClass === 2 /* WordSeparator */) {
if (wordType === 1 /* Regular */) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));
}
wordType = 2 /* Separator */;
}
else if (chClass === 1 /* Whitespace */) {
if (wordType !== 0 /* None */) {
return this._createWord(lineContent, wordType, chClass, chIndex + 1, this._findEndOfWord(lineContent, wordSeparators, wordType, chIndex + 1));
}
}
}
if (wordType !== 0 /* None */) {
return this._createWord(lineContent, wordType, 1 /* Whitespace */, 0, this._findEndOfWord(lineContent, wordSeparators, wordType, 0));
}
return null;
};
WordOperations._findEndOfWord = function (lineContent, wordSeparators, wordType, startIndex) {
var len = lineContent.length;
for (var chIndex = startIndex; chIndex < len; chIndex++) {
var chCode = lineContent.charCodeAt(chIndex);
var chClass = wordSeparators.get(chCode);
if (chClass === 1 /* Whitespace */) {
return chIndex;
}
if (wordType === 1 /* Regular */ && chClass === 2 /* WordSeparator */) {
return chIndex;
}
if (wordType === 2 /* Separator */ && chClass === 0 /* Regular */) {
return chIndex;
}
}
return len;
};
WordOperations._findNextWordOnLine = function (wordSeparators, model, position) {
var lineContent = model.getLineContent(position.lineNumber);
return this._doFindNextWordOnLine(lineContent, wordSeparators, position);
};
WordOperations._doFindNextWordOnLine = function (lineContent, wordSeparators, position) {
var wordType = 0 /* None */;
var len = lineContent.length;
for (var chIndex = position.column - 1; chIndex < len; chIndex++) {
var chCode = lineContent.charCodeAt(chIndex);
var chClass = wordSeparators.get(chCode);
if (chClass === 0 /* Regular */) {
if (wordType === 2 /* Separator */) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);
}
wordType = 1 /* Regular */;
}
else if (chClass === 2 /* WordSeparator */) {
if (wordType === 1 /* Regular */) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);
}
wordType = 2 /* Separator */;
}
else if (chClass === 1 /* Whitespace */) {
if (wordType !== 0 /* None */) {
return this._createWord(lineContent, wordType, chClass, this._findStartOfWord(lineContent, wordSeparators, wordType, chIndex - 1), chIndex);
}
}
}
if (wordType !== 0 /* None */) {
return this._createWord(lineContent, wordType, 1 /* Whitespace */, this._findStartOfWord(lineContent, wordSeparators, wordType, len - 1), len);
}
return null;
};
WordOperations._findStartOfWord = function (lineContent, wordSeparators, wordType, startIndex) {
for (var chIndex = startIndex; chIndex >= 0; chIndex--) {
var chCode = lineContent.charCodeAt(chIndex);
var chClass = wordSeparators.get(chCode);
if (chClass === 1 /* Whitespace */) {
return chIndex + 1;
}
if (wordType === 1 /* Regular */ && chClass === 2 /* WordSeparator */) {
return chIndex + 1;
}
if (wordType === 2 /* Separator */ && chClass === 0 /* Regular */) {
return chIndex + 1;
}
}
return 0;
};
WordOperations.moveWordLeft = function (wordSeparators, model, position, wordNavigationType) {
var lineNumber = position.lineNumber;
var column = position.column;
var movedToPreviousLine = false;
if (column === 1) {
if (lineNumber > 1) {
movedToPreviousLine = true;
lineNumber = lineNumber - 1;
column = model.getLineMaxColumn(lineNumber);
}
}
var prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column));
if (wordNavigationType === 0 /* WordStart */) {
if (prevWordOnLine && !movedToPreviousLine) {
// Special case for Visual Studio compatibility:
// when starting in the trim whitespace at the end of a line,
// go to the end of the last word
var lastWhitespaceColumn = model.getLineLastNonWhitespaceColumn(lineNumber);
if (lastWhitespaceColumn < column) {
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine.end + 1);
}
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
if (wordNavigationType === 1 /* WordStartFast */) {
if (prevWordOnLine
&& prevWordOnLine.wordType === 2 /* Separator */
&& prevWordOnLine.end - prevWordOnLine.start === 1
&& prevWordOnLine.nextCharClass === 0 /* Regular */) {
// Skip over a word made up of one single separator and followed by a regular character
prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine.start + 1));
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
if (wordNavigationType === 3 /* WordAccessibility */) {
while (prevWordOnLine
&& prevWordOnLine.wordType === 2 /* Separator */) {
// Skip over words made up of only separators
prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine.start + 1));
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1);
}
// We are stopping at the ending of words
if (prevWordOnLine && column <= prevWordOnLine.end + 1) {
prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine.start + 1));
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine ? prevWordOnLine.end + 1 : 1);
};
WordOperations._moveWordPartLeft = function (model, position) {
var lineNumber = position.lineNumber;
var maxColumn = model.getLineMaxColumn(lineNumber);
if (position.column === 1) {
return (lineNumber > 1 ? new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)) : position);
}
var lineContent = model.getLineContent(lineNumber);
for (var column = position.column - 1; column > 1; column--) {
var left = lineContent.charCodeAt(column - 2);
var right = lineContent.charCodeAt(column - 1);
if (left !== 95 /* Underline */ && right === 95 /* Underline */) {
// snake_case_variables
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isLowerAsciiLetter */ "B"](left) && _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](right)) {
// camelCaseVariables
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](left) && _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](right)) {
// thisIsACamelCaseWithOneLetterWords
if (column + 1 < maxColumn) {
var rightRight = lineContent.charCodeAt(column);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isLowerAsciiLetter */ "B"](rightRight)) {
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
}
}
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, 1);
};
WordOperations.moveWordRight = function (wordSeparators, model, position, wordNavigationType) {
var lineNumber = position.lineNumber;
var column = position.column;
var movedDown = false;
if (column === model.getLineMaxColumn(lineNumber)) {
if (lineNumber < model.getLineCount()) {
movedDown = true;
lineNumber = lineNumber + 1;
column = 1;
}
}
var nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column));
if (wordNavigationType === 2 /* WordEnd */) {
if (nextWordOnLine && nextWordOnLine.wordType === 2 /* Separator */) {
if (nextWordOnLine.end - nextWordOnLine.start === 1 && nextWordOnLine.nextCharClass === 0 /* Regular */) {
// Skip over a word made up of one single separator and followed by a regular character
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, nextWordOnLine.end + 1));
}
}
if (nextWordOnLine) {
column = nextWordOnLine.end + 1;
}
else {
column = model.getLineMaxColumn(lineNumber);
}
}
else if (wordNavigationType === 3 /* WordAccessibility */) {
if (movedDown) {
// If we move to the next line, pretend that the cursor is right before the first character.
// This is needed when the first word starts right at the first character - and in order not to miss it,
// we need to start before.
column = 0;
}
while (nextWordOnLine
&& (nextWordOnLine.wordType === 2 /* Separator */
|| nextWordOnLine.start + 1 <= column)) {
// Skip over a word made up of one single separator
// Also skip over word if it begins before current cursor position to ascertain we're moving forward at least 1 character.
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](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(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
}
else {
column = model.getLineMaxColumn(lineNumber);
}
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
};
WordOperations._moveWordPartRight = function (model, position) {
var lineNumber = position.lineNumber;
var maxColumn = model.getLineMaxColumn(lineNumber);
if (position.column === maxColumn) {
return (lineNumber < model.getLineCount() ? new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber + 1, 1) : position);
}
var lineContent = model.getLineContent(lineNumber);
for (var column = position.column + 1; column < maxColumn; column++) {
var left = lineContent.charCodeAt(column - 2);
var right = lineContent.charCodeAt(column - 1);
if (left === 95 /* Underline */ && right !== 95 /* Underline */) {
// snake_case_variables
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isLowerAsciiLetter */ "B"](left) && _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](right)) {
// camelCaseVariables
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](left) && _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isUpperAsciiLetter */ "C"](right)) {
// thisIsACamelCaseWithOneLetterWords
if (column + 1 < maxColumn) {
var rightRight = lineContent.charCodeAt(column);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isLowerAsciiLetter */ "B"](rightRight)) {
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
}
}
}
}
return new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, maxColumn);
};
WordOperations._deleteWordLeftWhitespace = function (model, position) {
var lineContent = model.getLineContent(position.lineNumber);
var startIndex = position.column - 2;
var lastNonWhitespace = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* lastNonWhitespaceIndex */ "D"](lineContent, startIndex);
if (lastNonWhitespace + 1 < startIndex) {
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](position.lineNumber, lastNonWhitespace + 2, position.lineNumber, position.column);
}
return null;
};
WordOperations.deleteWordLeft = function (wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType) {
if (!selection.isEmpty()) {
return selection;
}
var position = new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](selection.positionLineNumber, selection.positionColumn);
var lineNumber = position.lineNumber;
var column = position.column;
if (lineNumber === 1 && column === 1) {
// Ignore deleting at beginning of file
return null;
}
if (whitespaceHeuristics) {
var r = this._deleteWordLeftWhitespace(model, position);
if (r) {
return r;
}
}
var prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);
if (wordNavigationType === 0 /* WordStart */) {
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(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, prevWordOnLine.start + 1));
}
if (prevWordOnLine) {
column = prevWordOnLine.end + 1;
}
else {
if (column > 1) {
column = 1;
}
else {
lineNumber--;
column = model.getLineMaxColumn(lineNumber);
}
}
}
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](lineNumber, column, position.lineNumber, position.column);
};
WordOperations._deleteWordPartLeft = function (model, selection) {
if (!selection.isEmpty()) {
return selection;
}
var pos = selection.getPosition();
var toPosition = WordOperations._moveWordPartLeft(model, pos);
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);
};
WordOperations._findFirstNonWhitespaceChar = function (str, startIndex) {
var len = str.length;
for (var chIndex = startIndex; chIndex < len; chIndex++) {
var ch = str.charAt(chIndex);
if (ch !== ' ' && ch !== '\t') {
return chIndex;
}
}
return len;
};
WordOperations._deleteWordRightWhitespace = function (model, position) {
var lineContent = model.getLineContent(position.lineNumber);
var startIndex = position.column - 1;
var firstNonWhitespace = this._findFirstNonWhitespaceChar(lineContent, startIndex);
if (startIndex + 1 < firstNonWhitespace) {
// bingo
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](position.lineNumber, position.column, position.lineNumber, firstNonWhitespace + 1);
}
return null;
};
WordOperations.deleteWordRight = function (wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType) {
if (!selection.isEmpty()) {
return selection;
}
var position = new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](selection.positionLineNumber, selection.positionColumn);
var lineNumber = position.lineNumber;
var column = position.column;
var lineCount = model.getLineCount();
var maxColumn = model.getLineMaxColumn(lineNumber);
if (lineNumber === lineCount && column === maxColumn) {
// Ignore deleting at end of file
return null;
}
if (whitespaceHeuristics) {
var r = this._deleteWordRightWhitespace(model, position);
if (r) {
return r;
}
}
var nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, position);
if (wordNavigationType === 2 /* WordEnd */) {
if (nextWordOnLine) {
column = nextWordOnLine.end + 1;
}
else {
if (column < maxColumn || lineNumber === lineCount) {
column = maxColumn;
}
else {
lineNumber++;
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, 1));
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
}
else {
column = model.getLineMaxColumn(lineNumber);
}
}
}
}
else {
if (nextWordOnLine && column >= nextWordOnLine.start + 1) {
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
}
else {
if (column < maxColumn || lineNumber === lineCount) {
column = maxColumn;
}
else {
lineNumber++;
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, 1));
if (nextWordOnLine) {
column = nextWordOnLine.start + 1;
}
else {
column = model.getLineMaxColumn(lineNumber);
}
}
}
}
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](lineNumber, column, position.lineNumber, position.column);
};
WordOperations._deleteWordPartRight = function (model, selection) {
if (!selection.isEmpty()) {
return selection;
}
var pos = selection.getPosition();
var toPosition = WordOperations._moveWordPartRight(model, pos);
return new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](pos.lineNumber, pos.column, toPosition.lineNumber, toPosition.column);
};
WordOperations.word = function (config, model, cursor, inSelectionMode, position) {
var wordSeparators = Object(_wordCharacterClassifier_js__WEBPACK_IMPORTED_MODULE_2__[/* getMapForWordSeparators */ "a"])(config.wordSeparators);
var prevWord = WordOperations._findPreviousWordOnLine(wordSeparators, model, position);
var nextWord = WordOperations._findNextWordOnLine(wordSeparators, model, position);
if (!inSelectionMode) {
// Entering word selection for the first time
var startColumn_1;
var endColumn_1;
if (prevWord && prevWord.wordType === 1 /* Regular */ && prevWord.start <= position.column - 1 && position.column - 1 <= prevWord.end) {
// isTouchingPrevWord
startColumn_1 = prevWord.start + 1;
endColumn_1 = prevWord.end + 1;
}
else if (nextWord && nextWord.wordType === 1 /* Regular */ && nextWord.start <= position.column - 1 && position.column - 1 <= nextWord.end) {
// isTouchingNextWord
startColumn_1 = nextWord.start + 1;
endColumn_1 = nextWord.end + 1;
}
else {
if (prevWord) {
startColumn_1 = prevWord.end + 1;
}
else {
startColumn_1 = 1;
}
if (nextWord) {
endColumn_1 = nextWord.start + 1;
}
else {
endColumn_1 = model.getLineMaxColumn(position.lineNumber);
}
}
return new _cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* SingleCursorState */ "f"](new _core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"](position.lineNumber, startColumn_1, position.lineNumber, endColumn_1), 0, new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](position.lineNumber, endColumn_1), 0);
}
var startColumn;
var endColumn;
if (prevWord && prevWord.wordType === 1 /* Regular */ && prevWord.start < position.column - 1 && position.column - 1 < prevWord.end) {
// isInsidePrevWord
startColumn = prevWord.start + 1;
endColumn = prevWord.end + 1;
}
else if (nextWord && nextWord.wordType === 1 /* Regular */ && nextWord.start < position.column - 1 && position.column - 1 < nextWord.end) {
// isInsideNextWord
startColumn = nextWord.start + 1;
endColumn = nextWord.end + 1;
}
else {
startColumn = position.column;
endColumn = position.column;
}
var lineNumber = position.lineNumber;
var column;
if (cursor.selectionStart.containsPosition(position)) {
column = cursor.selectionStart.endColumn;
}
else if (position.isBeforeOrEqual(cursor.selectionStart.getStartPosition())) {
column = startColumn;
var possiblePosition = new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
if (cursor.selectionStart.containsPosition(possiblePosition)) {
column = cursor.selectionStart.endColumn;
}
}
else {
column = endColumn;
var possiblePosition = new _core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"](lineNumber, column);
if (cursor.selectionStart.containsPosition(possiblePosition)) {
column = cursor.selectionStart.startColumn;
}
}
return cursor.move(true, lineNumber, column, 0);
};
return WordOperations;
}());
var WordPartOperations = /** @class */ (function (_super) {
__extends(WordPartOperations, _super);
function WordPartOperations() {
return _super !== null && _super.apply(this, arguments) || this;
}
WordPartOperations.deleteWordPartLeft = function (wordSeparators, model, selection, whitespaceHeuristics) {
var candidates = enforceDefined([
WordOperations.deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, 0 /* WordStart */),
WordOperations.deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, 2 /* WordEnd */),
WordOperations._deleteWordPartLeft(model, selection)
]);
candidates.sort(_core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"].compareRangesUsingEnds);
return candidates[2];
};
WordPartOperations.deleteWordPartRight = function (wordSeparators, model, selection, whitespaceHeuristics) {
var candidates = enforceDefined([
WordOperations.deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, 0 /* WordStart */),
WordOperations.deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, 2 /* WordEnd */),
WordOperations._deleteWordPartRight(model, selection)
]);
candidates.sort(_core_range_js__WEBPACK_IMPORTED_MODULE_4__[/* Range */ "a"].compareRangesUsingStarts);
return candidates[0];
};
WordPartOperations.moveWordPartLeft = function (wordSeparators, model, position) {
var candidates = enforceDefined([
WordOperations.moveWordLeft(wordSeparators, model, position, 0 /* WordStart */),
WordOperations.moveWordLeft(wordSeparators, model, position, 2 /* WordEnd */),
WordOperations._moveWordPartLeft(model, position)
]);
candidates.sort(_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].compare);
return candidates[2];
};
WordPartOperations.moveWordPartRight = function (wordSeparators, model, position) {
var candidates = enforceDefined([
WordOperations.moveWordRight(wordSeparators, model, position, 0 /* WordStart */),
WordOperations.moveWordRight(wordSeparators, model, position, 2 /* WordEnd */),
WordOperations._moveWordPartRight(model, position)
]);
candidates.sort(_core_position_js__WEBPACK_IMPORTED_MODULE_3__[/* Position */ "a"].compare);
return candidates[0];
};
return WordPartOperations;
}(WordOperations));
function enforceDefined(arr) {
return arr.filter(function (el) { return Boolean(el); });
}
/***/ }),
/* 126 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createBrowserHistory; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ createHashHistory; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ createMemoryHistory; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ createLocation; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ locationsAreEqual; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ createPath; });
// UNUSED EXPORTS: parsePath
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(8);
// CONCATENATED MODULE: ./node_modules/resolve-pathname/esm/resolve-pathname.js
function isAbsolute(pathname) {
return pathname.charAt(0) === '/';
}
// About 1.5x faster than the two-arg version of Array#splice()
function spliceOne(list, index) {
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
list[i] = list[k];
}
list.pop();
}
// This implementation is based heavily on node's url.parse
function resolvePathname(to, from) {
if (from === undefined) from = '';
var toParts = (to && to.split('/')) || [];
var fromParts = (from && from.split('/')) || [];
var isToAbs = to && isAbsolute(to);
var isFromAbs = from && isAbsolute(from);
var mustEndAbs = isToAbs || isFromAbs;
if (to && isAbsolute(to)) {
// to is absolute
fromParts = toParts;
} else if (toParts.length) {
// to is relative, drop the filename
fromParts.pop();
fromParts = fromParts.concat(toParts);
}
if (!fromParts.length) return '/';
var hasTrailingSlash;
if (fromParts.length) {
var last = fromParts[fromParts.length - 1];
hasTrailingSlash = last === '.' || last === '..' || last === '';
} else {
hasTrailingSlash = false;
}
var up = 0;
for (var i = fromParts.length; i >= 0; i--) {
var part = fromParts[i];
if (part === '.') {
spliceOne(fromParts, i);
} else if (part === '..') {
spliceOne(fromParts, i);
up++;
} else if (up) {
spliceOne(fromParts, i);
up--;
}
}
if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
if (
mustEndAbs &&
fromParts[0] !== '' &&
(!fromParts[0] || !isAbsolute(fromParts[0]))
)
fromParts.unshift('');
var result = fromParts.join('/');
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
return result;
}
/* harmony default export */ var resolve_pathname = (resolvePathname);
// CONCATENATED MODULE: ./node_modules/value-equal/esm/value-equal.js
function value_equal_valueOf(obj) {
return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj);
}
function valueEqual(a, b) {
// Test for strict equality first.
if (a === b) return true;
// Otherwise, if either of them == null they are not equal.
if (a == null || b == null) return false;
if (Array.isArray(a)) {
return (
Array.isArray(b) &&
a.length === b.length &&
a.every(function(item, index) {
return valueEqual(item, b[index]);
})
);
}
if (typeof a === 'object' || typeof b === 'object') {
var aValue = value_equal_valueOf(a);
var bValue = value_equal_valueOf(b);
if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue);
return Object.keys(Object.assign({}, a, b)).every(function(key) {
return valueEqual(a[key], b[key]);
});
}
return false;
}
/* harmony default export */ var value_equal = (valueEqual);
// EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js
var tiny_invariant_esm = __webpack_require__(117);
// CONCATENATED MODULE: ./node_modules/history/esm/history.js
function addLeadingSlash(path) {
return path.charAt(0) === '/' ? path : '/' + path;
}
function stripLeadingSlash(path) {
return path.charAt(0) === '/' ? path.substr(1) : path;
}
function hasBasename(path, prefix) {
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
}
function stripBasename(path, prefix) {
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
}
function stripTrailingSlash(path) {
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
}
function parsePath(path) {
var pathname = path || '/';
var search = '';
var hash = '';
var hashIndex = pathname.indexOf('#');
if (hashIndex !== -1) {
hash = pathname.substr(hashIndex);
pathname = pathname.substr(0, hashIndex);
}
var searchIndex = pathname.indexOf('?');
if (searchIndex !== -1) {
search = pathname.substr(searchIndex);
pathname = pathname.substr(0, searchIndex);
}
return {
pathname: pathname,
search: search === '?' ? '' : search,
hash: hash === '#' ? '' : hash
};
}
function createPath(location) {
var pathname = location.pathname,
search = location.search,
hash = location.hash;
var path = pathname || '/';
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
return path;
}
function createLocation(path, state, key, currentLocation) {
var location;
if (typeof path === 'string') {
// Two-arg form: push(path, state)
location = parsePath(path);
location.state = state;
} else {
// One-arg form: push(location)
location = Object(esm_extends["a" /* default */])({}, path);
if (location.pathname === undefined) location.pathname = '';
if (location.search) {
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
} else {
location.search = '';
}
if (location.hash) {
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
} else {
location.hash = '';
}
if (state !== undefined && location.state === undefined) location.state = state;
}
try {
location.pathname = decodeURI(location.pathname);
} catch (e) {
if (e instanceof URIError) {
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
} else {
throw e;
}
}
if (key) location.key = key;
if (currentLocation) {
// Resolve incomplete/relative pathname relative to current location.
if (!location.pathname) {
location.pathname = currentLocation.pathname;
} else if (location.pathname.charAt(0) !== '/') {
location.pathname = resolve_pathname(location.pathname, currentLocation.pathname);
}
} else {
// When there is no prior location and pathname is empty, set it to /
if (!location.pathname) {
location.pathname = '/';
}
}
return location;
}
function locationsAreEqual(a, b) {
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && value_equal(a.state, b.state);
}
function createTransitionManager() {
var prompt = null;
function setPrompt(nextPrompt) {
false ? undefined : void 0;
prompt = nextPrompt;
return function () {
if (prompt === nextPrompt) prompt = null;
};
}
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
// TODO: If another transition starts while we're still confirming
// the previous one, we may end up in a weird state. Figure out the
// best way to handle this.
if (prompt != null) {
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
if (typeof result === 'string') {
if (typeof getUserConfirmation === 'function') {
getUserConfirmation(result, callback);
} else {
false ? undefined : void 0;
callback(true);
}
} else {
// Return false from a transition hook to cancel the transition.
callback(result !== false);
}
} else {
callback(true);
}
}
var listeners = [];
function appendListener(fn) {
var isActive = true;
function listener() {
if (isActive) fn.apply(void 0, arguments);
}
listeners.push(listener);
return function () {
isActive = false;
listeners = listeners.filter(function (item) {
return item !== listener;
});
};
}
function notifyListeners() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
listeners.forEach(function (listener) {
return listener.apply(void 0, args);
});
}
return {
setPrompt: setPrompt,
confirmTransitionTo: confirmTransitionTo,
appendListener: appendListener,
notifyListeners: notifyListeners
};
}
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
function getConfirmation(message, callback) {
callback(window.confirm(message)); // eslint-disable-line no-alert
}
/**
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
*
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
*/
function supportsHistory() {
var ua = window.navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
return window.history && 'pushState' in window.history;
}
/**
* Returns true if browser fires popstate on hash change.
* IE10 and IE11 do not.
*/
function supportsPopStateOnHashChange() {
return window.navigator.userAgent.indexOf('Trident') === -1;
}
/**
* Returns false if using go(n) with hash history causes a full page reload.
*/
function supportsGoWithoutReloadUsingHash() {
return window.navigator.userAgent.indexOf('Firefox') === -1;
}
/**
* Returns true if a given popstate event is an extraneous WebKit event.
* Accounts for the fact that Chrome on iOS fires real popstate events
* containing undefined state when pressing the back button.
*/
function isExtraneousPopstateEvent(event) {
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
}
var PopStateEvent = 'popstate';
var HashChangeEvent = 'hashchange';
function getHistoryState() {
try {
return window.history.state || {};
} catch (e) {
// IE 11 sometimes throws when accessing window.history.state
// See https://github.com/ReactTraining/history/pull/289
return {};
}
}
/**
* Creates a history object that uses the HTML5 history API including
* pushState, replaceState, and the popstate event.
*/
function createBrowserHistory(props) {
if (props === void 0) {
props = {};
}
!canUseDOM ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
var globalHistory = window.history;
var canUseHistory = supportsHistory();
var needsHashChangeListener = !supportsPopStateOnHashChange();
var _props = props,
_props$forceRefresh = _props.forceRefresh,
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
_props$getUserConfirm = _props.getUserConfirmation,
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
_props$keyLength = _props.keyLength,
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
function getDOMLocation(historyState) {
var _ref = historyState || {},
key = _ref.key,
state = _ref.state;
var _window$location = window.location,
pathname = _window$location.pathname,
search = _window$location.search,
hash = _window$location.hash;
var path = pathname + search + hash;
false ? undefined : void 0;
if (basename) path = stripBasename(path, basename);
return createLocation(path, state, key);
}
function createKey() {
return Math.random().toString(36).substr(2, keyLength);
}
var transitionManager = createTransitionManager();
function setState(nextState) {
Object(esm_extends["a" /* default */])(history, nextState);
history.length = globalHistory.length;
transitionManager.notifyListeners(history.location, history.action);
}
function handlePopState(event) {
// Ignore extraneous popstate events in WebKit.
if (isExtraneousPopstateEvent(event)) return;
handlePop(getDOMLocation(event.state));
}
function handleHashChange() {
handlePop(getDOMLocation(getHistoryState()));
}
var forceNextPop = false;
function handlePop(location) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
var action = 'POP';
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location
});
} else {
revertPop(location);
}
});
}
}
function revertPop(fromLocation) {
var toLocation = history.location; // TODO: We could probably make this more reliable by
// keeping a list of keys we've seen in sessionStorage.
// Instead, we just default to 0 for keys we don't know.
var toIndex = allKeys.indexOf(toLocation.key);
if (toIndex === -1) toIndex = 0;
var fromIndex = allKeys.indexOf(fromLocation.key);
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
}
var initialLocation = getDOMLocation(getHistoryState());
var allKeys = [initialLocation.key]; // Public interface
function createHref(location) {
return basename + createPath(location);
}
function push(path, state) {
false ? undefined : void 0;
var action = 'PUSH';
var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.pushState({
key: key,
state: state
}, null, href);
if (forceRefresh) {
window.location.href = href;
} else {
var prevIndex = allKeys.indexOf(history.location.key);
var nextKeys = allKeys.slice(0, prevIndex + 1);
nextKeys.push(location.key);
allKeys = nextKeys;
setState({
action: action,
location: location
});
}
} else {
false ? undefined : void 0;
window.location.href = href;
}
});
}
function replace(path, state) {
false ? undefined : void 0;
var action = 'REPLACE';
var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.replaceState({
key: key,
state: state
}, null, href);
if (forceRefresh) {
window.location.replace(href);
} else {
var prevIndex = allKeys.indexOf(history.location.key);
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
setState({
action: action,
location: location
});
}
} else {
false ? undefined : void 0;
window.location.replace(href);
}
});
}
function go(n) {
globalHistory.go(n);
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
var listenerCount = 0;
function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1 && delta === 1) {
window.addEventListener(PopStateEvent, handlePopState);
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
} else if (listenerCount === 0) {
window.removeEventListener(PopStateEvent, handlePopState);
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
}
}
var isBlocked = false;
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function () {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
}
function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function () {
checkDOMListeners(-1);
unlisten();
};
}
var history = {
length: globalHistory.length,
action: 'POP',
location: initialLocation,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
block: block,
listen: listen
};
return history;
}
var HashChangeEvent$1 = 'hashchange';
var HashPathCoders = {
hashbang: {
encodePath: function encodePath(path) {
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
},
decodePath: function decodePath(path) {
return path.charAt(0) === '!' ? path.substr(1) : path;
}
},
noslash: {
encodePath: stripLeadingSlash,
decodePath: addLeadingSlash
},
slash: {
encodePath: addLeadingSlash,
decodePath: addLeadingSlash
}
};
function stripHash(url) {
var hashIndex = url.indexOf('#');
return hashIndex === -1 ? url : url.slice(0, hashIndex);
}
function getHashPath() {
// We can't use window.location.hash here because it's not
// consistent across browsers - Firefox will pre-decode it!
var href = window.location.href;
var hashIndex = href.indexOf('#');
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
}
function pushHashPath(path) {
window.location.hash = path;
}
function replaceHashPath(path) {
window.location.replace(stripHash(window.location.href) + '#' + path);
}
function createHashHistory(props) {
if (props === void 0) {
props = {};
}
!canUseDOM ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0;
var globalHistory = window.history;
var canGoWithoutReload = supportsGoWithoutReloadUsingHash();
var _props = props,
_props$getUserConfirm = _props.getUserConfirmation,
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
_props$hashType = _props.hashType,
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
var _HashPathCoders$hashT = HashPathCoders[hashType],
encodePath = _HashPathCoders$hashT.encodePath,
decodePath = _HashPathCoders$hashT.decodePath;
function getDOMLocation() {
var path = decodePath(getHashPath());
false ? undefined : void 0;
if (basename) path = stripBasename(path, basename);
return createLocation(path);
}
var transitionManager = createTransitionManager();
function setState(nextState) {
Object(esm_extends["a" /* default */])(history, nextState);
history.length = globalHistory.length;
transitionManager.notifyListeners(history.location, history.action);
}
var forceNextPop = false;
var ignorePath = null;
function locationsAreEqual$$1(a, b) {
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
}
function handleHashChange() {
var path = getHashPath();
var encodedPath = encodePath(path);
if (path !== encodedPath) {
// Ensure we always have a properly-encoded hash.
replaceHashPath(encodedPath);
} else {
var location = getDOMLocation();
var prevLocation = history.location;
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
ignorePath = null;
handlePop(location);
}
}
function handlePop(location) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
var action = 'POP';
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location
});
} else {
revertPop(location);
}
});
}
}
function revertPop(fromLocation) {
var toLocation = history.location; // TODO: We could probably make this more reliable by
// keeping a list of paths we've seen in sessionStorage.
// Instead, we just default to 0 for paths we don't know.
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
if (toIndex === -1) toIndex = 0;
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
} // Ensure the hash is encoded properly before doing anything else.
var path = getHashPath();
var encodedPath = encodePath(path);
if (path !== encodedPath) replaceHashPath(encodedPath);
var initialLocation = getDOMLocation();
var allPaths = [createPath(initialLocation)]; // Public interface
function createHref(location) {
var baseTag = document.querySelector('base');
var href = '';
if (baseTag && baseTag.getAttribute('href')) {
href = stripHash(window.location.href);
}
return href + '#' + encodePath(basename + createPath(location));
}
function push(path, state) {
false ? undefined : void 0;
var action = 'PUSH';
var location = createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var path = createPath(location);
var encodedPath = encodePath(basename + path);
var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) {
// We cannot tell if a hashchange was caused by a PUSH, so we'd
// rather setState here and ignore the hashchange. The caveat here
// is that other hash histories in the page will consider it a POP.
ignorePath = path;
pushHashPath(encodedPath);
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
var nextPaths = allPaths.slice(0, prevIndex + 1);
nextPaths.push(path);
allPaths = nextPaths;
setState({
action: action,
location: location
});
} else {
false ? undefined : void 0;
setState();
}
});
}
function replace(path, state) {
false ? undefined : void 0;
var action = 'REPLACE';
var location = createLocation(path, undefined, undefined, history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var path = createPath(location);
var encodedPath = encodePath(basename + path);
var hashChanged = getHashPath() !== encodedPath;
if (hashChanged) {
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
// rather setState here and ignore the hashchange. The caveat here
// is that other hash histories in the page will consider it a POP.
ignorePath = path;
replaceHashPath(encodedPath);
}
var prevIndex = allPaths.indexOf(createPath(history.location));
if (prevIndex !== -1) allPaths[prevIndex] = path;
setState({
action: action,
location: location
});
});
}
function go(n) {
false ? undefined : void 0;
globalHistory.go(n);
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
var listenerCount = 0;
function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1 && delta === 1) {
window.addEventListener(HashChangeEvent$1, handleHashChange);
} else if (listenerCount === 0) {
window.removeEventListener(HashChangeEvent$1, handleHashChange);
}
}
var isBlocked = false;
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function () {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
}
function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function () {
checkDOMListeners(-1);
unlisten();
};
}
var history = {
length: globalHistory.length,
action: 'POP',
location: initialLocation,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
block: block,
listen: listen
};
return history;
}
function clamp(n, lowerBound, upperBound) {
return Math.min(Math.max(n, lowerBound), upperBound);
}
/**
* Creates a history object that stores locations in memory.
*/
function createMemoryHistory(props) {
if (props === void 0) {
props = {};
}
var _props = props,
getUserConfirmation = _props.getUserConfirmation,
_props$initialEntries = _props.initialEntries,
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
_props$initialIndex = _props.initialIndex,
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
_props$keyLength = _props.keyLength,
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
var transitionManager = createTransitionManager();
function setState(nextState) {
Object(esm_extends["a" /* default */])(history, nextState);
history.length = history.entries.length;
transitionManager.notifyListeners(history.location, history.action);
}
function createKey() {
return Math.random().toString(36).substr(2, keyLength);
}
var index = clamp(initialIndex, 0, initialEntries.length - 1);
var entries = initialEntries.map(function (entry) {
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
}); // Public interface
var createHref = createPath;
function push(path, state) {
false ? undefined : void 0;
var action = 'PUSH';
var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var prevIndex = history.index;
var nextIndex = prevIndex + 1;
var nextEntries = history.entries.slice(0);
if (nextEntries.length > nextIndex) {
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
} else {
nextEntries.push(location);
}
setState({
action: action,
location: location,
index: nextIndex,
entries: nextEntries
});
});
}
function replace(path, state) {
false ? undefined : void 0;
var action = 'REPLACE';
var location = createLocation(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
history.entries[history.index] = location;
setState({
action: action,
location: location
});
});
}
function go(n) {
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
var action = 'POP';
var location = history.entries[nextIndex];
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location,
index: nextIndex
});
} else {
// Mimic the behavior of DOM histories by
// causing a render after a cancelled POP.
setState();
}
});
}
function goBack() {
go(-1);
}
function goForward() {
go(1);
}
function canGo(n) {
var nextIndex = history.index + n;
return nextIndex >= 0 && nextIndex < history.entries.length;
}
function block(prompt) {
if (prompt === void 0) {
prompt = false;
}
return transitionManager.setPrompt(prompt);
}
function listen(listener) {
return transitionManager.appendListener(listener);
}
var history = {
length: entries.length,
action: 'POP',
location: entries[index],
index: index,
entries: entries,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
canGo: canGo,
block: block,
listen: listen
};
return history;
}
/***/ }),
/* 127 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ITelemetryService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ITelemetryService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('telemetryService');
/***/ }),
/* 128 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export computeStyles */
/* unused harmony export attachStyler */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return attachBadgeStyler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return attachQuickOpenStyler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return attachListStyler; });
/* unused harmony export defaultListStyles */
/* unused harmony export defaultMenuStyles */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return attachMenuStyler; });
/* harmony import */ var _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function computeStyles(theme, styleMap) {
var styles = Object.create(null);
for (var key in styleMap) {
var value = styleMap[key];
if (value) {
styles[key] = Object(_colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* resolveColorValue */ "Ub"])(value, theme);
}
}
return styles;
}
function attachStyler(themeService, styleMap, widgetOrCallback) {
function applyStyles(theme) {
var styles = computeStyles(themeService.getTheme(), styleMap);
if (typeof widgetOrCallback === 'function') {
widgetOrCallback(styles);
}
else {
widgetOrCallback.style(styles);
}
}
applyStyles(themeService.getTheme());
return themeService.onThemeChange(applyStyles);
}
function attachBadgeStyler(widget, themeService, style) {
return attachStyler(themeService, {
badgeBackground: (style && style.badgeBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* badgeBackground */ "c"],
badgeForeground: (style && style.badgeForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* badgeForeground */ "d"],
badgeBorder: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* contrastBorder */ "e"]
}, widget);
}
function attachQuickOpenStyler(widget, themeService, style) {
return attachStyler(themeService, {
foreground: (style && style.foreground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* foreground */ "W"],
background: (style && style.background) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* editorBackground */ "o"],
borderColor: style && style.borderColor || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* contrastBorder */ "e"],
widgetShadow: style && style.widgetShadow || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* widgetShadow */ "hc"],
progressBarBackground: style && style.progressBarBackground || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* progressBarBackground */ "Sb"],
pickerGroupForeground: style && style.pickerGroupForeground || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* pickerGroupForeground */ "Ob"],
pickerGroupBorder: style && style.pickerGroupBorder || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* pickerGroupBorder */ "Nb"],
inputBackground: (style && style.inputBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputBackground */ "Z"],
inputForeground: (style && style.inputForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputForeground */ "bb"],
inputBorder: (style && style.inputBorder) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputBorder */ "ab"],
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationInfoBorder */ "gb"],
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationInfoBackground */ "fb"],
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationInfoForeground */ "hb"],
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationWarningBorder */ "jb"],
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationWarningBackground */ "ib"],
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationWarningForeground */ "kb"],
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationErrorBorder */ "db"],
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationErrorBackground */ "cb"],
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* inputValidationErrorForeground */ "eb"],
listFocusBackground: (style && style.listFocusBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFocusBackground */ "rb"],
listFocusForeground: (style && style.listFocusForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFocusForeground */ "sb"],
listActiveSelectionBackground: (style && style.listActiveSelectionBackground) || Object(_colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* darken */ "f"])(_colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionBackground */ "lb"], 0.1),
listActiveSelectionForeground: (style && style.listActiveSelectionForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionForeground */ "mb"],
listFocusAndSelectionBackground: style && style.listFocusAndSelectionBackground || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionBackground */ "lb"],
listFocusAndSelectionForeground: (style && style.listFocusAndSelectionForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionForeground */ "mb"],
listInactiveSelectionBackground: (style && style.listInactiveSelectionBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveSelectionBackground */ "xb"],
listInactiveSelectionForeground: (style && style.listInactiveSelectionForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveSelectionForeground */ "yb"],
listInactiveFocusBackground: (style && style.listInactiveFocusBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveFocusBackground */ "wb"],
listHoverBackground: (style && style.listHoverBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listHoverBackground */ "ub"],
listHoverForeground: (style && style.listHoverForeground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listHoverForeground */ "vb"],
listDropBackground: (style && style.listDropBackground) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listDropBackground */ "nb"],
listFocusOutline: (style && style.listFocusOutline) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"],
listSelectionOutline: (style && style.listSelectionOutline) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"],
listHoverOutline: (style && style.listHoverOutline) || _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"]
}, widget);
}
function attachListStyler(widget, themeService, overrides) {
return attachStyler(themeService, __assign(__assign({}, defaultListStyles), (overrides || {})), widget);
}
var defaultListStyles = {
listFocusBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFocusBackground */ "rb"],
listFocusForeground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFocusForeground */ "sb"],
listActiveSelectionBackground: Object(_colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* darken */ "f"])(_colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionBackground */ "lb"], 0.1),
listActiveSelectionForeground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionForeground */ "mb"],
listFocusAndSelectionBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionBackground */ "lb"],
listFocusAndSelectionForeground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listActiveSelectionForeground */ "mb"],
listInactiveSelectionBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveSelectionBackground */ "xb"],
listInactiveSelectionForeground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveSelectionForeground */ "yb"],
listInactiveFocusBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listInactiveFocusBackground */ "wb"],
listHoverBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listHoverBackground */ "ub"],
listHoverForeground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listHoverForeground */ "vb"],
listDropBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listDropBackground */ "nb"],
listFocusOutline: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"],
listSelectionOutline: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"],
listHoverOutline: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* activeContrastBorder */ "b"],
listFilterWidgetBackground: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFilterWidgetBackground */ "ob"],
listFilterWidgetOutline: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFilterWidgetOutline */ "qb"],
listFilterWidgetNoMatchesOutline: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* listFilterWidgetNoMatchesOutline */ "pb"],
listMatchesShadow: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* widgetShadow */ "hc"],
treeIndentGuidesStroke: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* treeIndentGuidesStroke */ "gc"]
};
var defaultMenuStyles = {
shadowColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* widgetShadow */ "hc"],
borderColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuBorder */ "Ab"],
foregroundColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuForeground */ "Bb"],
backgroundColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuBackground */ "zb"],
selectionForegroundColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuSelectionForeground */ "Eb"],
selectionBackgroundColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuSelectionBackground */ "Cb"],
selectionBorderColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuSelectionBorder */ "Db"],
separatorColor: _colorRegistry_js__WEBPACK_IMPORTED_MODULE_0__[/* menuSeparatorBackground */ "Fb"]
};
function attachMenuStyler(widget, themeService, style) {
return attachStyler(themeService, __assign(__assign({}, defaultMenuStyles), style), widget);
}
/***/ }),
/* 129 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Extensions */
/* unused harmony export EditorModesRegistry */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModesRegistry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PLAINTEXT_MODE_ID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PLAINTEXT_LANGUAGE_IDENTIFIER; });
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
/* harmony import */ var _modes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
/* harmony import */ var _languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(33);
/* harmony import */ var _platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(57);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Define extension point ids
var Extensions = {
ModesRegistry: 'editor.modesRegistry'
};
var EditorModesRegistry = /** @class */ (function () {
function EditorModesRegistry() {
this._onDidChangeLanguages = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]();
this.onDidChangeLanguages = this._onDidChangeLanguages.event;
this._languages = [];
this._dynamicLanguages = [];
}
// --- languages
EditorModesRegistry.prototype.registerLanguage = function (def) {
this._languages.push(def);
this._onDidChangeLanguages.fire(undefined);
};
EditorModesRegistry.prototype.getLanguages = function () {
return [].concat(this._languages).concat(this._dynamicLanguages);
};
return EditorModesRegistry;
}());
var ModesRegistry = new EditorModesRegistry();
_platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_4__[/* Registry */ "a"].add(Extensions.ModesRegistry, ModesRegistry);
var PLAINTEXT_MODE_ID = 'plaintext';
var PLAINTEXT_LANGUAGE_IDENTIFIER = new _modes_js__WEBPACK_IMPORTED_MODULE_2__[/* LanguageIdentifier */ "r"](PLAINTEXT_MODE_ID, 1 /* PlainText */);
ModesRegistry.registerLanguage({
id: PLAINTEXT_MODE_ID,
extensions: ['.txt', '.gitignore'],
aliases: [_nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('plainText.alias', "Plain Text"), 'text'],
mimetypes: ['text/plain']
});
_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_3__[/* LanguageConfigurationRegistry */ "a"].register(PLAINTEXT_LANGUAGE_IDENTIFIER, {
brackets: [
['(', ')'],
['[', ']'],
['{', '}'],
],
surroundingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '<', close: '>' },
{ open: '\"', close: '\"' },
{ open: '\'', close: '\'' },
{ open: '`', close: '`' },
],
folding: {
offSide: true
}
});
/***/ }),
/* 130 */
/***/ (function(module, exports) {
// Exports
module.exports = {
"navbar": "navbar_2WwY",
"navbarVersion": "navbarVersion_WEx5",
"content": "content_13-L",
"contentPane": "contentPane_JaAR",
"outputEditor": "outputEditor_1yiM",
"outputControls": "outputControls_3yi_",
"editorOutput": "editorOutput_3sJH",
"editorOutputLineNumbers": "editorOutputLineNumbers_1Y45",
"editorOutputTerminal": "editorOutputTerminal_2Q-0"
};
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _assign = __webpack_require__(543);
var _assign2 = _interopRequireDefault(_assign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _assign2.default || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
/***/ }),
/* 132 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isInternalUrl; });
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function isInternalUrl(url){return /^(https?:|\/\/)/.test(url)===false;}
/***/ }),
/* 133 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_ThemeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(227);
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function useThemeContext(){return Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_theme_ThemeContext__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]);}/* harmony default export */ __webpack_exports__["a"] = (useThemeContext);
/***/ }),
/* 134 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ServiceCollection; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ServiceCollection = /** @class */ (function () {
function ServiceCollection() {
var entries = [];
for (var _i = 0; _i < arguments.length; _i++) {
entries[_i] = arguments[_i];
}
this._entries = new Map();
for (var _a = 0, entries_1 = entries; _a < entries_1.length; _a++) {
var _b = entries_1[_a], id = _b[0], service = _b[1];
this.set(id, service);
}
}
ServiceCollection.prototype.set = function (id, instanceOrDescriptor) {
var result = this._entries.get(id);
this._entries.set(id, instanceOrDescriptor);
return result;
};
ServiceCollection.prototype.has = function (id) {
return this._entries.has(id);
};
ServiceCollection.prototype.get = function (id) {
return this._entries.get(id);
};
return ServiceCollection;
}());
/***/ }),
/* 135 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ DefaultKeyboardNavigationDelegate; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ isSelectionSingleChangeEvent; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ isSelectionRangeChangeEvent; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ listWidget_MouseController; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ listWidget_DefaultStyleController; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ listWidget_List; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.css
var list_list = __webpack_require__(646);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/nls.js
var nls = __webpack_require__(1);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/decorators.js
var decorators = __webpack_require__(95);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/touch.js
var touch = __webpack_require__(54);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js
var keyboardEvent = __webpack_require__(53);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/event.js
var browser_event = __webpack_require__(34);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/list.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ListAriaRootRole;
(function (ListAriaRootRole) {
/** default tree structure role */
ListAriaRootRole["TREE"] = "tree";
/** role='tree' can interfere with screenreaders reading nested elements inside the tree row. Use FORM in that case. */
ListAriaRootRole["FORM"] = "form";
})(ListAriaRootRole || (ListAriaRootRole = {}));
var ListError = /** @class */ (function (_super) {
__extends(ListError, _super);
function ListError(user, message) {
return _super.call(this, "ListError [" + user + "] " + message) || this;
}
return ListError;
}(Error));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js + 2 modules
var listView = __webpack_require__(155);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/color.js
var color = __webpack_require__(15);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/objects.js
var objects = __webpack_require__(35);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/splice.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var CombinedSpliceable = /** @class */ (function () {
function CombinedSpliceable(spliceables) {
this.spliceables = spliceables;
}
CombinedSpliceable.prototype.splice = function (start, deleteCount, elements) {
this.spliceables.forEach(function (s) { return s.splice(start, deleteCount, elements); });
};
return CombinedSpliceable;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/numbers.js
var numbers = __webpack_require__(112);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/filters.js
var filters = __webpack_require__(65);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var listWidget_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __decorate = (undefined && undefined.__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;
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var listWidget_TraitRenderer = /** @class */ (function () {
function TraitRenderer(trait) {
this.trait = trait;
this.renderedElements = [];
}
Object.defineProperty(TraitRenderer.prototype, "templateId", {
get: function () {
return "template:" + this.trait.trait;
},
enumerable: true,
configurable: true
});
TraitRenderer.prototype.renderTemplate = function (container) {
return container;
};
TraitRenderer.prototype.renderElement = function (element, index, templateData) {
var renderedElementIndex = Object(arrays["k" /* firstIndex */])(this.renderedElements, function (el) { return el.templateData === templateData; });
if (renderedElementIndex >= 0) {
var rendered = this.renderedElements[renderedElementIndex];
this.trait.unrender(templateData);
rendered.index = index;
}
else {
var rendered = { index: index, templateData: templateData };
this.renderedElements.push(rendered);
}
this.trait.renderIndex(index, templateData);
};
TraitRenderer.prototype.splice = function (start, deleteCount, insertCount) {
var rendered = [];
for (var _i = 0, _a = this.renderedElements; _i < _a.length; _i++) {
var renderedElement = _a[_i];
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;
};
TraitRenderer.prototype.renderIndexes = function (indexes) {
for (var _i = 0, _a = this.renderedElements; _i < _a.length; _i++) {
var _b = _a[_i], index = _b.index, templateData = _b.templateData;
if (indexes.indexOf(index) > -1) {
this.trait.renderIndex(index, templateData);
}
}
};
TraitRenderer.prototype.disposeTemplate = function (templateData) {
var index = Object(arrays["k" /* firstIndex */])(this.renderedElements, function (el) { return el.templateData === templateData; });
if (index < 0) {
return;
}
this.renderedElements.splice(index, 1);
};
return TraitRenderer;
}());
var listWidget_Trait = /** @class */ (function () {
function Trait(_trait) {
this._trait = _trait;
this.indexes = [];
this.sortedIndexes = [];
this._onChange = new common_event["a" /* Emitter */]();
this.onChange = this._onChange.event;
}
Object.defineProperty(Trait.prototype, "trait", {
get: function () { return this._trait; },
enumerable: true,
configurable: true
});
Object.defineProperty(Trait.prototype, "renderer", {
get: function () {
return new listWidget_TraitRenderer(this);
},
enumerable: true,
configurable: true
});
Trait.prototype.splice = function (start, deleteCount, elements) {
var diff = elements.length - deleteCount;
var end = start + deleteCount;
var indexes = __spreadArrays(this.sortedIndexes.filter(function (i) { return i < start; }), elements.map(function (hasTrait, i) { return hasTrait ? i + start : -1; }).filter(function (i) { return i !== -1; }), this.sortedIndexes.filter(function (i) { return i >= end; }).map(function (i) { return i + diff; }));
this.renderer.splice(start, deleteCount, elements.length);
this._set(indexes, indexes);
};
Trait.prototype.renderIndex = function (index, container) {
dom["Y" /* toggleClass */](container, this._trait, this.contains(index));
};
Trait.prototype.unrender = function (container) {
dom["P" /* removeClass */](container, 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.
*/
Trait.prototype.set = function (indexes, browserEvent) {
return this._set(indexes, __spreadArrays(indexes).sort(numericSort), browserEvent);
};
Trait.prototype._set = function (indexes, sortedIndexes, browserEvent) {
var result = this.indexes;
var sortedResult = this.sortedIndexes;
this.indexes = indexes;
this.sortedIndexes = sortedIndexes;
var toRender = disjunction(sortedResult, indexes);
this.renderer.renderIndexes(toRender);
this._onChange.fire({ indexes: indexes, browserEvent: browserEvent });
return result;
};
Trait.prototype.get = function () {
return this.indexes;
};
Trait.prototype.contains = function (index) {
return Object(arrays["c" /* binarySearch */])(this.sortedIndexes, index, numericSort) >= 0;
};
Trait.prototype.dispose = function () {
Object(lifecycle["f" /* dispose */])(this._onChange);
};
__decorate([
decorators["a" /* memoize */]
], Trait.prototype, "renderer", null);
return Trait;
}());
var FocusTrait = /** @class */ (function (_super) {
listWidget_extends(FocusTrait, _super);
function FocusTrait() {
return _super.call(this, 'focused') || this;
}
FocusTrait.prototype.renderIndex = function (index, container) {
_super.prototype.renderIndex.call(this, index, container);
if (this.contains(index)) {
container.setAttribute('aria-selected', 'true');
}
else {
container.removeAttribute('aria-selected');
}
};
return FocusTrait;
}(listWidget_Trait));
/**
* The TraitSpliceable is used as a util class to be able
* to preserve traits across splice calls, given an identity
* provider.
*/
var TraitSpliceable = /** @class */ (function () {
function TraitSpliceable(trait, view, identityProvider) {
this.trait = trait;
this.view = view;
this.identityProvider = identityProvider;
}
TraitSpliceable.prototype.splice = function (start, deleteCount, elements) {
var _this = this;
if (!this.identityProvider) {
return this.trait.splice(start, deleteCount, elements.map(function () { return false; }));
}
var pastElementsWithTrait = this.trait.get().map(function (i) { return _this.identityProvider.getId(_this.view.element(i)).toString(); });
var elementsWithTrait = elements.map(function (e) { return pastElementsWithTrait.indexOf(_this.identityProvider.getId(e).toString()) > -1; });
this.trait.splice(start, deleteCount, elementsWithTrait);
};
return TraitSpliceable;
}());
function isInputElement(e) {
return e.tagName === 'INPUT' || e.tagName === 'TEXTAREA';
}
var listWidget_KeyboardController = /** @class */ (function () {
function KeyboardController(list, view, options) {
this.list = list;
this.view = view;
this.disposables = new lifecycle["b" /* DisposableStore */]();
var multipleSelectionSupport = options.multipleSelectionSupport !== false;
this.openController = options.openController || DefaultOpenController;
var onKeyDown = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(view.domNode, 'keydown'))
.filter(function (e) { return !isInputElement(e.target); })
.map(function (e) { return new keyboardEvent["a" /* StandardKeyboardEvent */](e); });
onKeyDown.filter(function (e) { return e.keyCode === 3 /* Enter */; }).on(this.onEnter, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 16 /* UpArrow */; }).on(this.onUpArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 18 /* DownArrow */; }).on(this.onDownArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 11 /* PageUp */; }).on(this.onPageUpArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 12 /* PageDown */; }).on(this.onPageDownArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 9 /* Escape */; }).on(this.onEscape, this, this.disposables);
if (multipleSelectionSupport) {
onKeyDown.filter(function (e) { return (platform["e" /* isMacintosh */] ? e.metaKey : e.ctrlKey) && e.keyCode === 31 /* KEY_A */; }).on(this.onCtrlA, this, this.disposables);
}
}
KeyboardController.prototype.onEnter = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.setSelection(this.list.getFocus(), e.browserEvent);
if (this.openController.shouldOpen(e.browserEvent)) {
this.list.open(this.list.getFocus(), e.browserEvent);
}
};
KeyboardController.prototype.onUpArrow = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.focusPrevious(1, false, e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
this.view.domNode.focus();
};
KeyboardController.prototype.onDownArrow = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.focusNext(1, false, e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
this.view.domNode.focus();
};
KeyboardController.prototype.onPageUpArrow = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.focusPreviousPage(e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
this.view.domNode.focus();
};
KeyboardController.prototype.onPageDownArrow = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.focusNextPage(e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
this.view.domNode.focus();
};
KeyboardController.prototype.onCtrlA = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.setSelection(Object(arrays["u" /* range */])(this.list.length), e.browserEvent);
this.view.domNode.focus();
};
KeyboardController.prototype.onEscape = function (e) {
e.preventDefault();
e.stopPropagation();
this.list.setSelection([], e.browserEvent);
this.view.domNode.focus();
};
KeyboardController.prototype.dispose = function () {
this.disposables.dispose();
};
return KeyboardController;
}());
var TypeLabelControllerState;
(function (TypeLabelControllerState) {
TypeLabelControllerState[TypeLabelControllerState["Idle"] = 0] = "Idle";
TypeLabelControllerState[TypeLabelControllerState["Typing"] = 1] = "Typing";
})(TypeLabelControllerState || (TypeLabelControllerState = {}));
var DefaultKeyboardNavigationDelegate = new /** @class */ (function () {
function class_1() {
}
class_1.prototype.mightProducePrintableCharacter = function (event) {
if (event.ctrlKey || event.metaKey || event.altKey) {
return false;
}
return (event.keyCode >= 31 /* KEY_A */ && event.keyCode <= 56 /* KEY_Z */)
|| (event.keyCode >= 21 /* KEY_0 */ && event.keyCode <= 30 /* KEY_9 */)
|| (event.keyCode >= 93 /* NUMPAD_0 */ && event.keyCode <= 102 /* NUMPAD_9 */)
|| (event.keyCode >= 80 /* US_SEMICOLON */ && event.keyCode <= 90 /* US_QUOTE */);
};
return class_1;
}());
var listWidget_TypeLabelController = /** @class */ (function () {
function TypeLabelController(list, view, keyboardNavigationLabelProvider, delegate) {
this.list = list;
this.view = view;
this.keyboardNavigationLabelProvider = keyboardNavigationLabelProvider;
this.delegate = delegate;
this.enabled = false;
this.state = TypeLabelControllerState.Idle;
this.automaticKeyboardNavigation = true;
this.triggered = false;
this.enabledDisposables = new lifecycle["b" /* DisposableStore */]();
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.updateOptions(list.options);
}
TypeLabelController.prototype.updateOptions = function (options) {
var enableKeyboardNavigation = typeof options.enableKeyboardNavigation === 'undefined' ? true : !!options.enableKeyboardNavigation;
if (enableKeyboardNavigation) {
this.enable();
}
else {
this.disable();
}
if (typeof options.automaticKeyboardNavigation !== 'undefined') {
this.automaticKeyboardNavigation = options.automaticKeyboardNavigation;
}
};
TypeLabelController.prototype.enable = function () {
var _this = this;
if (this.enabled) {
return;
}
var onChar = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(this.view.domNode, 'keydown'))
.filter(function (e) { return !isInputElement(e.target); })
.filter(function () { return _this.automaticKeyboardNavigation || _this.triggered; })
.map(function (event) { return new keyboardEvent["a" /* StandardKeyboardEvent */](event); })
.filter(function (e) { return _this.delegate.mightProducePrintableCharacter(e); })
.forEach(function (e) { e.stopPropagation(); e.preventDefault(); })
.map(function (event) { return event.browserEvent.key; })
.event;
var onClear = common_event["b" /* Event */].debounce(onChar, function () { return null; }, 800);
var onInput = common_event["b" /* Event */].reduce(common_event["b" /* Event */].any(onChar, onClear), function (r, i) { return i === null ? null : ((r || '') + i); });
onInput(this.onInput, this, this.enabledDisposables);
this.enabled = true;
this.triggered = false;
};
TypeLabelController.prototype.disable = function () {
if (!this.enabled) {
return;
}
this.enabledDisposables.clear();
this.enabled = false;
this.triggered = false;
};
TypeLabelController.prototype.onInput = function (word) {
if (!word) {
this.state = TypeLabelControllerState.Idle;
this.triggered = false;
return;
}
var focus = this.list.getFocus();
var start = focus.length > 0 ? focus[0] : 0;
var delta = this.state === TypeLabelControllerState.Idle ? 1 : 0;
this.state = TypeLabelControllerState.Typing;
for (var i = 0; i < this.list.length; i++) {
var index = (start + i + delta) % this.list.length;
var label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(index));
var labelStr = label && label.toString();
if (typeof labelStr === 'undefined' || Object(filters["g" /* matchesPrefix */])(word, labelStr)) {
this.list.setFocus([index]);
this.list.reveal(index);
return;
}
}
};
TypeLabelController.prototype.dispose = function () {
this.disable();
this.enabledDisposables.dispose();
this.disposables.dispose();
};
return TypeLabelController;
}());
var listWidget_DOMFocusController = /** @class */ (function () {
function DOMFocusController(list, view) {
this.list = list;
this.view = view;
this.disposables = new lifecycle["b" /* DisposableStore */]();
var onKeyDown = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(view.domNode, 'keydown'))
.filter(function (e) { return !isInputElement(e.target); })
.map(function (e) { return new keyboardEvent["a" /* StandardKeyboardEvent */](e); });
onKeyDown.filter(function (e) { return e.keyCode === 2 /* Tab */ && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey; })
.on(this.onTab, this, this.disposables);
}
DOMFocusController.prototype.onTab = function (e) {
if (e.target !== this.view.domNode) {
return;
}
var focus = this.list.getFocus();
if (focus.length === 0) {
return;
}
var focusedDomElement = this.view.domElement(focus[0]);
if (!focusedDomElement) {
return;
}
var tabIndexElement = focusedDomElement.querySelector('[tabIndex]');
if (!tabIndexElement || !(tabIndexElement instanceof HTMLElement) || tabIndexElement.tabIndex === -1) {
return;
}
var style = window.getComputedStyle(tabIndexElement);
if (style.visibility === 'hidden' || style.display === 'none') {
return;
}
e.preventDefault();
e.stopPropagation();
tabIndexElement.focus();
};
DOMFocusController.prototype.dispose = function () {
this.disposables.dispose();
};
return DOMFocusController;
}());
function isSelectionSingleChangeEvent(event) {
return platform["e" /* isMacintosh */] ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
}
function isSelectionRangeChangeEvent(event) {
return event.browserEvent.shiftKey;
}
function isMouseRightClick(event) {
return event instanceof MouseEvent && event.button === 2;
}
var DefaultMultipleSelectionController = {
isSelectionSingleChangeEvent: isSelectionSingleChangeEvent,
isSelectionRangeChangeEvent: isSelectionRangeChangeEvent
};
var DefaultOpenController = {
shouldOpen: function (event) {
if (event instanceof MouseEvent) {
return !isMouseRightClick(event);
}
return true;
}
};
var listWidget_MouseController = /** @class */ (function () {
function MouseController(list) {
this.list = list;
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.multipleSelectionSupport = !(list.options.multipleSelectionSupport === false);
if (this.multipleSelectionSupport) {
this.multipleSelectionController = list.options.multipleSelectionController || DefaultMultipleSelectionController;
}
this.openController = list.options.openController || DefaultOpenController;
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(touch["b" /* Gesture */].addTarget(list.getHTMLElement()));
}
list.onMouseClick(this.onPointer, this, this.disposables);
list.onMouseMiddleClick(this.onPointer, this, this.disposables);
list.onTap(this.onPointer, this, this.disposables);
}
MouseController.prototype.isSelectionSingleChangeEvent = function (event) {
if (this.multipleSelectionController) {
return this.multipleSelectionController.isSelectionSingleChangeEvent(event);
}
return platform["e" /* isMacintosh */] ? event.browserEvent.metaKey : event.browserEvent.ctrlKey;
};
MouseController.prototype.isSelectionRangeChangeEvent = function (event) {
if (this.multipleSelectionController) {
return this.multipleSelectionController.isSelectionRangeChangeEvent(event);
}
return event.browserEvent.shiftKey;
};
MouseController.prototype.isSelectionChangeEvent = function (event) {
return this.isSelectionSingleChangeEvent(event) || this.isSelectionRangeChangeEvent(event);
};
MouseController.prototype.onMouseDown = function (e) {
if (document.activeElement !== e.browserEvent.target) {
this.list.domFocus();
}
};
MouseController.prototype.onContextMenu = function (e) {
var focus = typeof e.index === 'undefined' ? [] : [e.index];
this.list.setFocus(focus, e.browserEvent);
};
MouseController.prototype.onPointer = function (e) {
if (!this.mouseSupport) {
return;
}
if (isInputElement(e.browserEvent.target)) {
return;
}
var reference = this.list.getFocus()[0];
var selection = this.list.getSelection();
reference = reference === undefined ? selection[0] : reference;
var focus = e.index;
if (typeof focus === 'undefined') {
this.list.setFocus([], e.browserEvent);
this.list.setSelection([], e.browserEvent);
return;
}
if (this.multipleSelectionSupport && this.isSelectionRangeChangeEvent(e)) {
return this.changeSelection(e, reference);
}
if (this.multipleSelectionSupport && this.isSelectionChangeEvent(e)) {
return this.changeSelection(e, reference);
}
this.list.setFocus([focus], e.browserEvent);
if (!isMouseRightClick(e.browserEvent)) {
this.list.setSelection([focus], e.browserEvent);
if (this.openController.shouldOpen(e.browserEvent)) {
this.list.open([focus], e.browserEvent);
}
}
};
MouseController.prototype.onDoubleClick = function (e) {
if (isInputElement(e.browserEvent.target)) {
return;
}
if (this.multipleSelectionSupport && this.isSelectionChangeEvent(e)) {
return;
}
var focus = this.list.getFocus();
this.list.setSelection(focus, e.browserEvent);
this.list.pin(focus);
};
MouseController.prototype.changeSelection = function (e, reference) {
var focus = e.index;
if (this.isSelectionRangeChangeEvent(e) && reference !== undefined) {
var min = Math.min(reference, focus);
var max = Math.max(reference, focus);
var rangeSelection = Object(arrays["u" /* range */])(min, max + 1);
var selection = this.list.getSelection();
var contiguousRange = getContiguousRangeContaining(disjunction(selection, [reference]), reference);
if (contiguousRange.length === 0) {
return;
}
var newSelection = disjunction(rangeSelection, relativeComplement(selection, contiguousRange));
this.list.setSelection(newSelection, e.browserEvent);
}
else if (this.isSelectionSingleChangeEvent(e)) {
var selection = this.list.getSelection();
var newSelection = selection.filter(function (i) { return i !== focus; });
this.list.setFocus([focus]);
if (selection.length === newSelection.length) {
this.list.setSelection(__spreadArrays(newSelection, [focus]), e.browserEvent);
}
else {
this.list.setSelection(newSelection, e.browserEvent);
}
}
};
MouseController.prototype.dispose = function () {
this.disposables.dispose();
};
return MouseController;
}());
var listWidget_DefaultStyleController = /** @class */ (function () {
function DefaultStyleController(styleElement, selectorSuffix) {
this.styleElement = styleElement;
this.selectorSuffix = selectorSuffix;
}
DefaultStyleController.prototype.style = function (styles) {
var suffix = this.selectorSuffix && "." + this.selectorSuffix;
var content = [];
if (styles.listBackground) {
if (styles.listBackground.isOpaque()) {
content.push(".monaco-list" + suffix + " .monaco-list-rows { background: " + styles.listBackground + "; }");
}
else if (!platform["e" /* isMacintosh */]) { // subpixel AA doesn't exist in macOS
console.warn("List with id '" + this.selectorSuffix + "' was styled with a non-opaque background color. This will break sub-pixel antialiasing.");
}
}
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 + "; }"); // overwrite :hover style in this case!
}
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 + "; }"); // overwrite :hover style in this case!
}
if (styles.listActiveSelectionForeground) {
content.push(".monaco-list" + suffix + ":focus .monaco-list-row.selected { color: " + styles.listActiveSelectionForeground + "; }");
}
if (styles.listFocusAndSelectionBackground) {
content.push("\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list" + suffix + ":focus .monaco-list-row.selected.focused { background-color: " + styles.listFocusAndSelectionBackground + "; }\n\t\t\t");
}
if (styles.listFocusAndSelectionForeground) {
content.push("\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list" + suffix + ":focus .monaco-list-row.selected.focused { color: " + styles.listFocusAndSelectionForeground + "; }\n\t\t\t");
}
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 + "; }"); // overwrite :hover style in this case!
}
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 + "; }"); // overwrite :hover style in this case!
}
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) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: " + styles.listHoverBackground + "; }");
}
if (styles.listHoverForeground) {
content.push(".monaco-list" + suffix + " .monaco-list-row:hover:not(.selected):not(.focused) { color: " + styles.listHoverForeground + "; }");
}
if (styles.listSelectionOutline) {
content.push(".monaco-list" + suffix + " .monaco-list-row.selected { outline: 1px dotted " + styles.listSelectionOutline + "; outline-offset: -1px; }");
}
if (styles.listFocusOutline) {
content.push("\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list" + suffix + ":focus .monaco-list-row.focused { outline: 1px solid " + styles.listFocusOutline + "; outline-offset: -1px; }\n\t\t\t");
}
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.listDropBackground) {
content.push("\n\t\t\t\t.monaco-list" + suffix + ".drop-target,\n\t\t\t\t.monaco-list" + suffix + " .monaco-list-rows.drop-target,\n\t\t\t\t.monaco-list" + suffix + " .monaco-list-row.drop-target { background-color: " + styles.listDropBackground + " !important; color: inherit !important; }\n\t\t\t");
}
if (styles.listFilterWidgetBackground) {
content.push(".monaco-list-type-filter { background-color: " + styles.listFilterWidgetBackground + " }");
}
if (styles.listFilterWidgetOutline) {
content.push(".monaco-list-type-filter { border: 1px solid " + styles.listFilterWidgetOutline + "; }");
}
if (styles.listFilterWidgetNoMatchesOutline) {
content.push(".monaco-list-type-filter.no-matches { border: 1px solid " + styles.listFilterWidgetNoMatchesOutline + "; }");
}
if (styles.listMatchesShadow) {
content.push(".monaco-list-type-filter { box-shadow: 1px 1px 1px " + styles.listMatchesShadow + "; }");
}
var newStyles = content.join('\n');
if (newStyles !== this.styleElement.innerHTML) {
this.styleElement.innerHTML = newStyles;
}
};
return DefaultStyleController;
}());
var defaultStyles = {
listFocusBackground: color["a" /* Color */].fromHex('#7FB0D0'),
listActiveSelectionBackground: color["a" /* Color */].fromHex('#0E639C'),
listActiveSelectionForeground: color["a" /* Color */].fromHex('#FFFFFF'),
listFocusAndSelectionBackground: color["a" /* Color */].fromHex('#094771'),
listFocusAndSelectionForeground: color["a" /* Color */].fromHex('#FFFFFF'),
listInactiveSelectionBackground: color["a" /* Color */].fromHex('#3F3F46'),
listHoverBackground: color["a" /* Color */].fromHex('#2A2D2E'),
listDropBackground: color["a" /* Color */].fromHex('#383B3D'),
treeIndentGuidesStroke: color["a" /* Color */].fromHex('#a9a9a9')
};
var DefaultOptions = {
keyboardSupport: true,
mouseSupport: true,
multipleSelectionSupport: true,
dnd: {
getDragURI: function () { return null; },
onDragStart: function () { },
onDragOver: function () { return false; },
drop: function () { }
},
ariaRootRole: ListAriaRootRole.TREE
};
// TODO@Joao: move these utils into a SortedArray class
function getContiguousRangeContaining(range, value) {
var index = range.indexOf(value);
if (index === -1) {
return [];
}
var result = [];
var i = index - 1;
while (i >= 0 && range[i] === value - (index - i)) {
result.push(range[i--]);
}
result.reverse();
i = index;
while (i < range.length && range[i] === value + (i - index)) {
result.push(range[i++]);
}
return result;
}
/**
* Given two sorted collections of numbers, returns the intersection
* between them (OR).
*/
function disjunction(one, other) {
var result = [];
var 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;
}
/**
* Given two sorted collections of numbers, returns the relative
* complement between them (XOR).
*/
function relativeComplement(one, other) {
var result = [];
var 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 numericSort = function (a, b) { return a - b; };
var PipelineRenderer = /** @class */ (function () {
function PipelineRenderer(_templateId, renderers) {
this._templateId = _templateId;
this.renderers = renderers;
}
Object.defineProperty(PipelineRenderer.prototype, "templateId", {
get: function () {
return this._templateId;
},
enumerable: true,
configurable: true
});
PipelineRenderer.prototype.renderTemplate = function (container) {
return this.renderers.map(function (r) { return r.renderTemplate(container); });
};
PipelineRenderer.prototype.renderElement = function (element, index, templateData, height) {
var i = 0;
for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {
var renderer = _a[_i];
renderer.renderElement(element, index, templateData[i++], height);
}
};
PipelineRenderer.prototype.disposeElement = function (element, index, templateData, height) {
var i = 0;
for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {
var renderer = _a[_i];
if (renderer.disposeElement) {
renderer.disposeElement(element, index, templateData[i], height);
}
i += 1;
}
};
PipelineRenderer.prototype.disposeTemplate = function (templateData) {
var i = 0;
for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {
var renderer = _a[_i];
renderer.disposeTemplate(templateData[i++]);
}
};
return PipelineRenderer;
}());
var AccessibiltyRenderer = /** @class */ (function () {
function AccessibiltyRenderer(accessibilityProvider) {
this.accessibilityProvider = accessibilityProvider;
this.templateId = 'a18n';
}
AccessibiltyRenderer.prototype.renderTemplate = function (container) {
return container;
};
AccessibiltyRenderer.prototype.renderElement = function (element, index, container) {
var ariaLabel = this.accessibilityProvider.getAriaLabel(element);
if (ariaLabel) {
container.setAttribute('aria-label', ariaLabel);
}
else {
container.removeAttribute('aria-label');
}
var ariaLevel = this.accessibilityProvider.getAriaLevel && this.accessibilityProvider.getAriaLevel(element);
if (typeof ariaLevel === 'number') {
container.setAttribute('aria-level', "" + ariaLevel);
}
else {
container.removeAttribute('aria-level');
}
};
AccessibiltyRenderer.prototype.disposeTemplate = function (templateData) {
// noop
};
return AccessibiltyRenderer;
}());
var ListViewDragAndDrop = /** @class */ (function () {
function ListViewDragAndDrop(list, dnd) {
this.list = list;
this.dnd = dnd;
}
ListViewDragAndDrop.prototype.getDragElements = function (element) {
var selection = this.list.getSelectedElements();
var elements = selection.indexOf(element) > -1 ? selection : [element];
return elements;
};
ListViewDragAndDrop.prototype.getDragURI = function (element) {
return this.dnd.getDragURI(element);
};
ListViewDragAndDrop.prototype.getDragLabel = function (elements, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(elements, originalEvent);
}
return undefined;
};
ListViewDragAndDrop.prototype.onDragStart = function (data, originalEvent) {
if (this.dnd.onDragStart) {
this.dnd.onDragStart(data, originalEvent);
}
};
ListViewDragAndDrop.prototype.onDragOver = function (data, targetElement, targetIndex, originalEvent) {
return this.dnd.onDragOver(data, targetElement, targetIndex, originalEvent);
};
ListViewDragAndDrop.prototype.onDragEnd = function (originalEvent) {
if (this.dnd.onDragEnd) {
this.dnd.onDragEnd(originalEvent);
}
};
ListViewDragAndDrop.prototype.drop = function (data, targetElement, targetIndex, originalEvent) {
this.dnd.drop(data, targetElement, targetIndex, originalEvent);
};
return ListViewDragAndDrop;
}());
var listWidget_List = /** @class */ (function () {
function List(user, container, virtualDelegate, renderers, _options) {
if (_options === void 0) { _options = DefaultOptions; }
this.user = user;
this._options = _options;
this.eventBufferer = new common_event["c" /* EventBufferer */]();
this.disposables = new lifecycle["b" /* DisposableStore */]();
this._onDidOpen = new common_event["a" /* Emitter */]();
this.onDidOpen = this._onDidOpen.event;
this._onDidPin = new common_event["a" /* Emitter */]();
this.didJustPressContextMenuKey = false;
this._onDidDispose = new common_event["a" /* Emitter */]();
this.onDidDispose = this._onDidDispose.event;
this.focus = new FocusTrait();
this.selection = new listWidget_Trait('selected');
Object(objects["g" /* mixin */])(_options, defaultStyles, false);
var baseRenderers = [this.focus.renderer, this.selection.renderer];
this.accessibilityProvider = _options.accessibilityProvider;
if (this.accessibilityProvider) {
baseRenderers.push(new AccessibiltyRenderer(this.accessibilityProvider));
if (this.accessibilityProvider.onDidChangeActiveDescendant) {
this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant, this, this.disposables);
}
}
renderers = renderers.map(function (r) { return new PipelineRenderer(r.templateId, __spreadArrays(baseRenderers, [r])); });
var viewOptions = __assign(__assign({}, _options), { dnd: _options.dnd && new ListViewDragAndDrop(this, _options.dnd) });
this.view = new listView["b" /* ListView */](container, virtualDelegate, renderers, viewOptions);
if (typeof _options.ariaRole !== 'string') {
this.view.domNode.setAttribute('role', ListAriaRootRole.TREE);
}
else {
this.view.domNode.setAttribute('role', _options.ariaRole);
}
if (_options.styleController) {
this.styleController = _options.styleController(this.view.domId);
}
else {
var styleElement = dom["w" /* createStyleSheet */](this.view.domNode);
this.styleController = new listWidget_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),
this.view
]);
this.disposables.add(this.focus);
this.disposables.add(this.selection);
this.disposables.add(this.view);
this.disposables.add(this._onDidDispose);
this.onDidFocus = common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.view.domNode, 'focus', true), function () { return null; });
this.onDidBlur = common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.view.domNode, 'blur', true), function () { return null; });
this.disposables.add(new listWidget_DOMFocusController(this, this.view));
if (typeof _options.keyboardSupport !== 'boolean' || _options.keyboardSupport) {
var controller = new listWidget_KeyboardController(this, this.view, _options);
this.disposables.add(controller);
}
if (_options.keyboardNavigationLabelProvider) {
var delegate = _options.keyboardNavigationDelegate || DefaultKeyboardNavigationDelegate;
this.typeLabelController = new listWidget_TypeLabelController(this, this.view, _options.keyboardNavigationLabelProvider, delegate);
this.disposables.add(this.typeLabelController);
}
this.disposables.add(this.createMouseController(_options));
this.onFocusChange(this._onFocusChange, this, this.disposables);
this.onSelectionChange(this._onSelectionChange, this, this.disposables);
if (_options.ariaLabel) {
this.view.domNode.setAttribute('aria-label', Object(nls["a" /* localize */])('aria list', "{0}. Use the navigation keys to navigate.", _options.ariaLabel));
}
}
Object.defineProperty(List.prototype, "onFocusChange", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(this.eventBufferer.wrapEvent(this.focus.onChange), function (e) { return _this.toListEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onSelectionChange", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(this.eventBufferer.wrapEvent(this.selection.onChange), function (e) { return _this.toListEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "domId", {
get: function () { return this.view.domId; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onMouseClick", {
get: function () { return this.view.onMouseClick; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onMouseDblClick", {
get: function () { return this.view.onMouseDblClick; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onMouseMiddleClick", {
get: function () { return this.view.onMouseMiddleClick; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onMouseDown", {
get: function () { return this.view.onMouseDown; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onTouchStart", {
get: function () { return this.view.onTouchStart; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onTap", {
get: function () { return this.view.onTap; },
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onContextMenu", {
get: function () {
var _this = this;
var fromKeydown = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(this.view.domNode, 'keydown'))
.map(function (e) { return new keyboardEvent["a" /* StandardKeyboardEvent */](e); })
.filter(function (e) { return _this.didJustPressContextMenuKey = e.keyCode === 58 /* ContextMenu */ || (e.shiftKey && e.keyCode === 68 /* F10 */); })
.filter(function (e) { e.preventDefault(); e.stopPropagation(); return false; })
.event;
var fromKeyup = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(this.view.domNode, 'keyup'))
.filter(function () {
var didJustPressContextMenuKey = _this.didJustPressContextMenuKey;
_this.didJustPressContextMenuKey = false;
return didJustPressContextMenuKey;
})
.filter(function () { return _this.getFocus().length > 0 && !!_this.view.domElement(_this.getFocus()[0]); })
.map(function (browserEvent) {
var index = _this.getFocus()[0];
var element = _this.view.element(index);
var anchor = _this.view.domElement(index);
return { index: index, element: element, anchor: anchor, browserEvent: browserEvent };
})
.event;
var fromMouse = common_event["b" /* Event */].chain(this.view.onContextMenu)
.filter(function () { return !_this.didJustPressContextMenuKey; })
.map(function (_a) {
var element = _a.element, index = _a.index, browserEvent = _a.browserEvent;
return ({ element: element, index: index, anchor: { x: browserEvent.clientX + 1, y: browserEvent.clientY }, browserEvent: browserEvent });
})
.event;
return common_event["b" /* Event */].any(fromKeydown, fromKeyup, fromMouse);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "onKeyDown", {
get: function () { return Object(browser_event["a" /* domEvent */])(this.view.domNode, 'keydown'); },
enumerable: true,
configurable: true
});
List.prototype.createMouseController = function (options) {
return new listWidget_MouseController(this);
};
List.prototype.updateOptions = function (optionsUpdate) {
if (optionsUpdate === void 0) { optionsUpdate = {}; }
this._options = __assign(__assign({}, this._options), optionsUpdate);
if (this.typeLabelController) {
this.typeLabelController.updateOptions(this._options);
}
};
Object.defineProperty(List.prototype, "options", {
get: function () {
return this._options;
},
enumerable: true,
configurable: true
});
List.prototype.splice = function (start, deleteCount, elements) {
var _this = this;
if (elements === void 0) { 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(function () { return _this.spliceable.splice(start, deleteCount, elements); });
};
List.prototype.rerender = function () {
this.view.rerender();
};
List.prototype.element = function (index) {
return this.view.element(index);
};
Object.defineProperty(List.prototype, "length", {
get: function () {
return this.view.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "contentHeight", {
get: function () {
return this.view.contentHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "scrollTop", {
get: function () {
return this.view.getScrollTop();
},
set: function (scrollTop) {
this.view.setScrollTop(scrollTop);
},
enumerable: true,
configurable: true
});
List.prototype.domFocus = function () {
this.view.domNode.focus();
};
List.prototype.layout = function (height, width) {
this.view.layout(height, width);
};
List.prototype.setSelection = function (indexes, browserEvent) {
for (var _i = 0, indexes_1 = indexes; _i < indexes_1.length; _i++) {
var index = indexes_1[_i];
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
}
this.selection.set(indexes, browserEvent);
};
List.prototype.getSelection = function () {
return this.selection.get();
};
List.prototype.getSelectedElements = function () {
var _this = this;
return this.getSelection().map(function (i) { return _this.view.element(i); });
};
List.prototype.setFocus = function (indexes, browserEvent) {
for (var _i = 0, indexes_2 = indexes; _i < indexes_2.length; _i++) {
var index = indexes_2[_i];
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
}
this.focus.set(indexes, browserEvent);
};
List.prototype.focusNext = function (n, loop, browserEvent, filter) {
if (n === void 0) { n = 1; }
if (loop === void 0) { loop = false; }
if (this.length === 0) {
return;
}
var focus = this.focus.get();
var index = this.findNextIndex(focus.length > 0 ? focus[0] + n : 0, loop, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
};
List.prototype.focusPrevious = function (n, loop, browserEvent, filter) {
if (n === void 0) { n = 1; }
if (loop === void 0) { loop = false; }
if (this.length === 0) {
return;
}
var focus = this.focus.get();
var index = this.findPreviousIndex(focus.length > 0 ? focus[0] - n : 0, loop, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
};
List.prototype.focusNextPage = function (browserEvent, filter) {
var _this = this;
var lastPageIndex = this.view.indexAt(this.view.getScrollTop() + this.view.renderHeight);
lastPageIndex = lastPageIndex === 0 ? 0 : lastPageIndex - 1;
var lastPageElement = this.view.element(lastPageIndex);
var currentlyFocusedElement = this.getFocusedElements()[0];
if (currentlyFocusedElement !== lastPageElement) {
var lastGoodPageIndex = this.findPreviousIndex(lastPageIndex, false, filter);
if (lastGoodPageIndex > -1 && currentlyFocusedElement !== this.view.element(lastGoodPageIndex)) {
this.setFocus([lastGoodPageIndex], browserEvent);
}
else {
this.setFocus([lastPageIndex], browserEvent);
}
}
else {
var previousScrollTop = this.view.getScrollTop();
this.view.setScrollTop(previousScrollTop + this.view.renderHeight - this.view.elementHeight(lastPageIndex));
if (this.view.getScrollTop() !== previousScrollTop) {
// Let the scroll event listener run
setTimeout(function () { return _this.focusNextPage(browserEvent, filter); }, 0);
}
}
};
List.prototype.focusPreviousPage = function (browserEvent, filter) {
var _this = this;
var firstPageIndex;
var scrollTop = this.view.getScrollTop();
if (scrollTop === 0) {
firstPageIndex = this.view.indexAt(scrollTop);
}
else {
firstPageIndex = this.view.indexAfter(scrollTop - 1);
}
var firstPageElement = this.view.element(firstPageIndex);
var currentlyFocusedElement = this.getFocusedElements()[0];
if (currentlyFocusedElement !== firstPageElement) {
var firstGoodPageIndex = this.findNextIndex(firstPageIndex, false, filter);
if (firstGoodPageIndex > -1 && currentlyFocusedElement !== this.view.element(firstGoodPageIndex)) {
this.setFocus([firstGoodPageIndex], browserEvent);
}
else {
this.setFocus([firstPageIndex], browserEvent);
}
}
else {
var previousScrollTop = scrollTop;
this.view.setScrollTop(scrollTop - this.view.renderHeight);
if (this.view.getScrollTop() !== previousScrollTop) {
// Let the scroll event listener run
setTimeout(function () { return _this.focusPreviousPage(browserEvent, filter); }, 0);
}
}
};
List.prototype.focusLast = function (browserEvent, filter) {
if (this.length === 0) {
return;
}
var index = this.findPreviousIndex(this.length - 1, false, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
};
List.prototype.focusFirst = function (browserEvent, filter) {
if (this.length === 0) {
return;
}
var index = this.findNextIndex(0, false, filter);
if (index > -1) {
this.setFocus([index], browserEvent);
}
};
List.prototype.findNextIndex = function (index, loop, filter) {
if (loop === void 0) { loop = false; }
for (var 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;
};
List.prototype.findPreviousIndex = function (index, loop, filter) {
if (loop === void 0) { loop = false; }
for (var 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;
};
List.prototype.getFocus = function () {
return this.focus.get();
};
List.prototype.getFocusedElements = function () {
var _this = this;
return this.getFocus().map(function (i) { return _this.view.element(i); });
};
List.prototype.reveal = function (index, relativeTop) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
var scrollTop = this.view.getScrollTop();
var elementTop = this.view.elementTop(index);
var elementHeight = this.view.elementHeight(index);
if (Object(types["h" /* isNumber */])(relativeTop)) {
// y = mx + b
var m = elementHeight - this.view.renderHeight;
this.view.setScrollTop(m * Object(numbers["a" /* clamp */])(relativeTop, 0, 1) + elementTop);
}
else {
var viewItemBottom = elementTop + elementHeight;
var wrapperBottom = scrollTop + this.view.renderHeight;
if (elementTop < scrollTop && viewItemBottom >= wrapperBottom) {
// The element is already overflowing the viewport, no-op
}
else if (elementTop < scrollTop) {
this.view.setScrollTop(elementTop);
}
else if (viewItemBottom >= wrapperBottom) {
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.
*/
List.prototype.getRelativeTop = function (index) {
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
var scrollTop = this.view.getScrollTop();
var elementTop = this.view.elementTop(index);
var elementHeight = this.view.elementHeight(index);
if (elementTop < scrollTop || elementTop + elementHeight > scrollTop + this.view.renderHeight) {
return null;
}
// y = mx + b
var m = elementHeight - this.view.renderHeight;
return Math.abs((scrollTop - elementTop) / m);
};
List.prototype.getHTMLElement = function () {
return this.view.domNode;
};
List.prototype.open = function (indexes, browserEvent) {
var _this = this;
for (var _i = 0, indexes_3 = indexes; _i < indexes_3.length; _i++) {
var index = indexes_3[_i];
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
}
this._onDidOpen.fire({ indexes: indexes, elements: indexes.map(function (i) { return _this.view.element(i); }), browserEvent: browserEvent });
};
List.prototype.pin = function (indexes, browserEvent) {
var _this = this;
for (var _i = 0, indexes_4 = indexes; _i < indexes_4.length; _i++) {
var index = indexes_4[_i];
if (index < 0 || index >= this.length) {
throw new ListError(this.user, "Invalid index " + index);
}
}
this._onDidPin.fire({ indexes: indexes, elements: indexes.map(function (i) { return _this.view.element(i); }), browserEvent: browserEvent });
};
List.prototype.style = function (styles) {
this.styleController.style(styles);
};
List.prototype.toListEvent = function (_a) {
var _this = this;
var indexes = _a.indexes, browserEvent = _a.browserEvent;
return { indexes: indexes, elements: indexes.map(function (i) { return _this.view.element(i); }), browserEvent: browserEvent };
};
List.prototype._onFocusChange = function () {
var focus = this.focus.get();
dom["Y" /* toggleClass */](this.view.domNode, 'element-focused', focus.length > 0);
this.onDidChangeActiveDescendant();
};
List.prototype.onDidChangeActiveDescendant = function () {
var _a;
var focus = this.focus.get();
if (focus.length > 0) {
var id = void 0;
if ((_a = this.accessibilityProvider) === null || _a === void 0 ? void 0 : _a.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');
}
};
List.prototype._onSelectionChange = function () {
var selection = this.selection.get();
dom["Y" /* toggleClass */](this.view.domNode, 'selection-none', selection.length === 0);
dom["Y" /* toggleClass */](this.view.domNode, 'selection-single', selection.length === 1);
dom["Y" /* toggleClass */](this.view.domNode, 'selection-multiple', selection.length > 1);
};
List.prototype.dispose = function () {
this._onDidDispose.fire();
this.disposables.dispose();
this._onDidOpen.dispose();
this._onDidPin.dispose();
this._onDidDispose.dispose();
};
__decorate([
decorators["a" /* memoize */]
], List.prototype, "onFocusChange", null);
__decorate([
decorators["a" /* memoize */]
], List.prototype, "onSelectionChange", null);
__decorate([
decorators["a" /* memoize */]
], List.prototype, "onContextMenu", null);
return List;
}());
/***/ }),
/* 136 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inheritsLoose; });
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
/***/ }),
/* 137 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return toUint8; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return toUint32; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function toUint8(v) {
if (v < 0) {
return 0;
}
if (v > 255 /* MAX_UINT_8 */) {
return 255 /* MAX_UINT_8 */;
}
return v | 0;
}
function toUint32(v) {
if (v < 0) {
return 0;
}
if (v > 4294967295 /* MAX_UINT_32 */) {
return 4294967295 /* MAX_UINT_32 */;
}
return v | 0;
}
/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const u = __webpack_require__(113).fromPromise
const fs = __webpack_require__(310)
function pathExists (path) {
return fs.access(path).then(() => true).catch(() => false)
}
module.exports = {
pathExists: u(pathExists),
pathExistsSync: fs.existsSync
}
/***/ }),
/* 139 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(267)('wks');
var uid = __webpack_require__(216);
var Symbol = __webpack_require__(148).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/* 140 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "CancellationTokenSource", function() { return /* binding */ CancellationTokenSource; });
__webpack_require__.d(__webpack_exports__, "Emitter", function() { return /* binding */ Emitter; });
__webpack_require__.d(__webpack_exports__, "KeyCode", function() { return /* binding */ editor_api_KeyCode; });
__webpack_require__.d(__webpack_exports__, "KeyMod", function() { return /* binding */ editor_api_KeyMod; });
__webpack_require__.d(__webpack_exports__, "Position", function() { return /* binding */ Position; });
__webpack_require__.d(__webpack_exports__, "Range", function() { return /* binding */ Range; });
__webpack_require__.d(__webpack_exports__, "Selection", function() { return /* binding */ Selection; });
__webpack_require__.d(__webpack_exports__, "SelectionDirection", function() { return /* binding */ editor_api_SelectionDirection; });
__webpack_require__.d(__webpack_exports__, "MarkerSeverity", function() { return /* binding */ editor_api_MarkerSeverity; });
__webpack_require__.d(__webpack_exports__, "MarkerTag", function() { return /* binding */ editor_api_MarkerTag; });
__webpack_require__.d(__webpack_exports__, "Uri", function() { return /* binding */ Uri; });
__webpack_require__.d(__webpack_exports__, "Token", function() { return /* binding */ Token; });
__webpack_require__.d(__webpack_exports__, "editor", function() { return /* binding */ editor_api_editor; });
__webpack_require__.d(__webpack_exports__, "languages", function() { return /* binding */ languages; });
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js
var editorOptions = __webpack_require__(26);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/standalone/promise-polyfill/polyfill.js
var polyfill = __webpack_require__(619);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/cancellation.js
var cancellation = __webpack_require__(31);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/keyCodes.js
var keyCodes = __webpack_require__(39);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/uri.js
var common_uri = __webpack_require__(27);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/position.js
var core_position = __webpack_require__(12);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var core_range = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/selection.js
var core_selection = __webpack_require__(24);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/token.js
var core_token = __webpack_require__(105);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneEnums.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
var AccessibilitySupport;
(function (AccessibilitySupport) {
/**
* This should be the browser case where it is not known if a screen reader is attached or no.
*/
AccessibilitySupport[AccessibilitySupport["Unknown"] = 0] = "Unknown";
AccessibilitySupport[AccessibilitySupport["Disabled"] = 1] = "Disabled";
AccessibilitySupport[AccessibilitySupport["Enabled"] = 2] = "Enabled";
})(AccessibilitySupport || (AccessibilitySupport = {}));
var CompletionItemInsertTextRule;
(function (CompletionItemInsertTextRule) {
/**
* Adjust whitespace/indentation of multiline insert texts to
* match the current line indentation.
*/
CompletionItemInsertTextRule[CompletionItemInsertTextRule["KeepWhitespace"] = 1] = "KeepWhitespace";
/**
* `insertText` is a snippet.
*/
CompletionItemInsertTextRule[CompletionItemInsertTextRule["InsertAsSnippet"] = 4] = "InsertAsSnippet";
})(CompletionItemInsertTextRule || (CompletionItemInsertTextRule = {}));
var CompletionItemKind;
(function (CompletionItemKind) {
CompletionItemKind[CompletionItemKind["Method"] = 0] = "Method";
CompletionItemKind[CompletionItemKind["Function"] = 1] = "Function";
CompletionItemKind[CompletionItemKind["Constructor"] = 2] = "Constructor";
CompletionItemKind[CompletionItemKind["Field"] = 3] = "Field";
CompletionItemKind[CompletionItemKind["Variable"] = 4] = "Variable";
CompletionItemKind[CompletionItemKind["Class"] = 5] = "Class";
CompletionItemKind[CompletionItemKind["Struct"] = 6] = "Struct";
CompletionItemKind[CompletionItemKind["Interface"] = 7] = "Interface";
CompletionItemKind[CompletionItemKind["Module"] = 8] = "Module";
CompletionItemKind[CompletionItemKind["Property"] = 9] = "Property";
CompletionItemKind[CompletionItemKind["Event"] = 10] = "Event";
CompletionItemKind[CompletionItemKind["Operator"] = 11] = "Operator";
CompletionItemKind[CompletionItemKind["Unit"] = 12] = "Unit";
CompletionItemKind[CompletionItemKind["Value"] = 13] = "Value";
CompletionItemKind[CompletionItemKind["Constant"] = 14] = "Constant";
CompletionItemKind[CompletionItemKind["Enum"] = 15] = "Enum";
CompletionItemKind[CompletionItemKind["EnumMember"] = 16] = "EnumMember";
CompletionItemKind[CompletionItemKind["Keyword"] = 17] = "Keyword";
CompletionItemKind[CompletionItemKind["Text"] = 18] = "Text";
CompletionItemKind[CompletionItemKind["Color"] = 19] = "Color";
CompletionItemKind[CompletionItemKind["File"] = 20] = "File";
CompletionItemKind[CompletionItemKind["Reference"] = 21] = "Reference";
CompletionItemKind[CompletionItemKind["Customcolor"] = 22] = "Customcolor";
CompletionItemKind[CompletionItemKind["Folder"] = 23] = "Folder";
CompletionItemKind[CompletionItemKind["TypeParameter"] = 24] = "TypeParameter";
CompletionItemKind[CompletionItemKind["Snippet"] = 25] = "Snippet";
})(CompletionItemKind || (CompletionItemKind = {}));
var CompletionItemTag;
(function (CompletionItemTag) {
CompletionItemTag[CompletionItemTag["Deprecated"] = 1] = "Deprecated";
})(CompletionItemTag || (CompletionItemTag = {}));
/**
* How a suggest provider was triggered.
*/
var CompletionTriggerKind;
(function (CompletionTriggerKind) {
CompletionTriggerKind[CompletionTriggerKind["Invoke"] = 0] = "Invoke";
CompletionTriggerKind[CompletionTriggerKind["TriggerCharacter"] = 1] = "TriggerCharacter";
CompletionTriggerKind[CompletionTriggerKind["TriggerForIncompleteCompletions"] = 2] = "TriggerForIncompleteCompletions";
})(CompletionTriggerKind || (CompletionTriggerKind = {}));
/**
* A positioning preference for rendering content widgets.
*/
var ContentWidgetPositionPreference;
(function (ContentWidgetPositionPreference) {
/**
* Place the content widget exactly at a position
*/
ContentWidgetPositionPreference[ContentWidgetPositionPreference["EXACT"] = 0] = "EXACT";
/**
* Place the content widget above a position
*/
ContentWidgetPositionPreference[ContentWidgetPositionPreference["ABOVE"] = 1] = "ABOVE";
/**
* Place the content widget below a position
*/
ContentWidgetPositionPreference[ContentWidgetPositionPreference["BELOW"] = 2] = "BELOW";
})(ContentWidgetPositionPreference || (ContentWidgetPositionPreference = {}));
/**
* Describes the reason the cursor has changed its position.
*/
var CursorChangeReason;
(function (CursorChangeReason) {
/**
* Unknown or not set.
*/
CursorChangeReason[CursorChangeReason["NotSet"] = 0] = "NotSet";
/**
* A `model.setValue()` was called.
*/
CursorChangeReason[CursorChangeReason["ContentFlush"] = 1] = "ContentFlush";
/**
* The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.
*/
CursorChangeReason[CursorChangeReason["RecoverFromMarkers"] = 2] = "RecoverFromMarkers";
/**
* There was an explicit user gesture.
*/
CursorChangeReason[CursorChangeReason["Explicit"] = 3] = "Explicit";
/**
* There was a Paste.
*/
CursorChangeReason[CursorChangeReason["Paste"] = 4] = "Paste";
/**
* There was an Undo.
*/
CursorChangeReason[CursorChangeReason["Undo"] = 5] = "Undo";
/**
* There was a Redo.
*/
CursorChangeReason[CursorChangeReason["Redo"] = 6] = "Redo";
})(CursorChangeReason || (CursorChangeReason = {}));
/**
* The default end of line to use when instantiating models.
*/
var DefaultEndOfLine;
(function (DefaultEndOfLine) {
/**
* Use line feed (\n) as the end of line character.
*/
DefaultEndOfLine[DefaultEndOfLine["LF"] = 1] = "LF";
/**
* Use carriage return and line feed (\r\n) as the end of line character.
*/
DefaultEndOfLine[DefaultEndOfLine["CRLF"] = 2] = "CRLF";
})(DefaultEndOfLine || (DefaultEndOfLine = {}));
/**
* A document highlight kind.
*/
var DocumentHighlightKind;
(function (DocumentHighlightKind) {
/**
* A textual occurrence.
*/
DocumentHighlightKind[DocumentHighlightKind["Text"] = 0] = "Text";
/**
* Read-access of a symbol, like reading a variable.
*/
DocumentHighlightKind[DocumentHighlightKind["Read"] = 1] = "Read";
/**
* Write-access of a symbol, like writing to a variable.
*/
DocumentHighlightKind[DocumentHighlightKind["Write"] = 2] = "Write";
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
/**
* Configuration options for auto indentation in the editor
*/
var EditorAutoIndentStrategy;
(function (EditorAutoIndentStrategy) {
EditorAutoIndentStrategy[EditorAutoIndentStrategy["None"] = 0] = "None";
EditorAutoIndentStrategy[EditorAutoIndentStrategy["Keep"] = 1] = "Keep";
EditorAutoIndentStrategy[EditorAutoIndentStrategy["Brackets"] = 2] = "Brackets";
EditorAutoIndentStrategy[EditorAutoIndentStrategy["Advanced"] = 3] = "Advanced";
EditorAutoIndentStrategy[EditorAutoIndentStrategy["Full"] = 4] = "Full";
})(EditorAutoIndentStrategy || (EditorAutoIndentStrategy = {}));
var EditorOption;
(function (EditorOption) {
EditorOption[EditorOption["acceptSuggestionOnCommitCharacter"] = 0] = "acceptSuggestionOnCommitCharacter";
EditorOption[EditorOption["acceptSuggestionOnEnter"] = 1] = "acceptSuggestionOnEnter";
EditorOption[EditorOption["accessibilitySupport"] = 2] = "accessibilitySupport";
EditorOption[EditorOption["accessibilityPageSize"] = 3] = "accessibilityPageSize";
EditorOption[EditorOption["ariaLabel"] = 4] = "ariaLabel";
EditorOption[EditorOption["autoClosingBrackets"] = 5] = "autoClosingBrackets";
EditorOption[EditorOption["autoClosingOvertype"] = 6] = "autoClosingOvertype";
EditorOption[EditorOption["autoClosingQuotes"] = 7] = "autoClosingQuotes";
EditorOption[EditorOption["autoIndent"] = 8] = "autoIndent";
EditorOption[EditorOption["automaticLayout"] = 9] = "automaticLayout";
EditorOption[EditorOption["autoSurround"] = 10] = "autoSurround";
EditorOption[EditorOption["codeLens"] = 11] = "codeLens";
EditorOption[EditorOption["colorDecorators"] = 12] = "colorDecorators";
EditorOption[EditorOption["comments"] = 13] = "comments";
EditorOption[EditorOption["contextmenu"] = 14] = "contextmenu";
EditorOption[EditorOption["copyWithSyntaxHighlighting"] = 15] = "copyWithSyntaxHighlighting";
EditorOption[EditorOption["cursorBlinking"] = 16] = "cursorBlinking";
EditorOption[EditorOption["cursorSmoothCaretAnimation"] = 17] = "cursorSmoothCaretAnimation";
EditorOption[EditorOption["cursorStyle"] = 18] = "cursorStyle";
EditorOption[EditorOption["cursorSurroundingLines"] = 19] = "cursorSurroundingLines";
EditorOption[EditorOption["cursorSurroundingLinesStyle"] = 20] = "cursorSurroundingLinesStyle";
EditorOption[EditorOption["cursorWidth"] = 21] = "cursorWidth";
EditorOption[EditorOption["disableLayerHinting"] = 22] = "disableLayerHinting";
EditorOption[EditorOption["disableMonospaceOptimizations"] = 23] = "disableMonospaceOptimizations";
EditorOption[EditorOption["dragAndDrop"] = 24] = "dragAndDrop";
EditorOption[EditorOption["emptySelectionClipboard"] = 25] = "emptySelectionClipboard";
EditorOption[EditorOption["extraEditorClassName"] = 26] = "extraEditorClassName";
EditorOption[EditorOption["fastScrollSensitivity"] = 27] = "fastScrollSensitivity";
EditorOption[EditorOption["find"] = 28] = "find";
EditorOption[EditorOption["fixedOverflowWidgets"] = 29] = "fixedOverflowWidgets";
EditorOption[EditorOption["folding"] = 30] = "folding";
EditorOption[EditorOption["foldingStrategy"] = 31] = "foldingStrategy";
EditorOption[EditorOption["foldingHighlight"] = 32] = "foldingHighlight";
EditorOption[EditorOption["fontFamily"] = 33] = "fontFamily";
EditorOption[EditorOption["fontInfo"] = 34] = "fontInfo";
EditorOption[EditorOption["fontLigatures"] = 35] = "fontLigatures";
EditorOption[EditorOption["fontSize"] = 36] = "fontSize";
EditorOption[EditorOption["fontWeight"] = 37] = "fontWeight";
EditorOption[EditorOption["formatOnPaste"] = 38] = "formatOnPaste";
EditorOption[EditorOption["formatOnType"] = 39] = "formatOnType";
EditorOption[EditorOption["glyphMargin"] = 40] = "glyphMargin";
EditorOption[EditorOption["gotoLocation"] = 41] = "gotoLocation";
EditorOption[EditorOption["hideCursorInOverviewRuler"] = 42] = "hideCursorInOverviewRuler";
EditorOption[EditorOption["highlightActiveIndentGuide"] = 43] = "highlightActiveIndentGuide";
EditorOption[EditorOption["hover"] = 44] = "hover";
EditorOption[EditorOption["inDiffEditor"] = 45] = "inDiffEditor";
EditorOption[EditorOption["letterSpacing"] = 46] = "letterSpacing";
EditorOption[EditorOption["lightbulb"] = 47] = "lightbulb";
EditorOption[EditorOption["lineDecorationsWidth"] = 48] = "lineDecorationsWidth";
EditorOption[EditorOption["lineHeight"] = 49] = "lineHeight";
EditorOption[EditorOption["lineNumbers"] = 50] = "lineNumbers";
EditorOption[EditorOption["lineNumbersMinChars"] = 51] = "lineNumbersMinChars";
EditorOption[EditorOption["links"] = 52] = "links";
EditorOption[EditorOption["matchBrackets"] = 53] = "matchBrackets";
EditorOption[EditorOption["minimap"] = 54] = "minimap";
EditorOption[EditorOption["mouseStyle"] = 55] = "mouseStyle";
EditorOption[EditorOption["mouseWheelScrollSensitivity"] = 56] = "mouseWheelScrollSensitivity";
EditorOption[EditorOption["mouseWheelZoom"] = 57] = "mouseWheelZoom";
EditorOption[EditorOption["multiCursorMergeOverlapping"] = 58] = "multiCursorMergeOverlapping";
EditorOption[EditorOption["multiCursorModifier"] = 59] = "multiCursorModifier";
EditorOption[EditorOption["multiCursorPaste"] = 60] = "multiCursorPaste";
EditorOption[EditorOption["occurrencesHighlight"] = 61] = "occurrencesHighlight";
EditorOption[EditorOption["overviewRulerBorder"] = 62] = "overviewRulerBorder";
EditorOption[EditorOption["overviewRulerLanes"] = 63] = "overviewRulerLanes";
EditorOption[EditorOption["parameterHints"] = 64] = "parameterHints";
EditorOption[EditorOption["peekWidgetDefaultFocus"] = 65] = "peekWidgetDefaultFocus";
EditorOption[EditorOption["quickSuggestions"] = 66] = "quickSuggestions";
EditorOption[EditorOption["quickSuggestionsDelay"] = 67] = "quickSuggestionsDelay";
EditorOption[EditorOption["readOnly"] = 68] = "readOnly";
EditorOption[EditorOption["renderControlCharacters"] = 69] = "renderControlCharacters";
EditorOption[EditorOption["renderIndentGuides"] = 70] = "renderIndentGuides";
EditorOption[EditorOption["renderFinalNewline"] = 71] = "renderFinalNewline";
EditorOption[EditorOption["renderLineHighlight"] = 72] = "renderLineHighlight";
EditorOption[EditorOption["renderValidationDecorations"] = 73] = "renderValidationDecorations";
EditorOption[EditorOption["renderWhitespace"] = 74] = "renderWhitespace";
EditorOption[EditorOption["revealHorizontalRightPadding"] = 75] = "revealHorizontalRightPadding";
EditorOption[EditorOption["roundedSelection"] = 76] = "roundedSelection";
EditorOption[EditorOption["rulers"] = 77] = "rulers";
EditorOption[EditorOption["scrollbar"] = 78] = "scrollbar";
EditorOption[EditorOption["scrollBeyondLastColumn"] = 79] = "scrollBeyondLastColumn";
EditorOption[EditorOption["scrollBeyondLastLine"] = 80] = "scrollBeyondLastLine";
EditorOption[EditorOption["selectionClipboard"] = 81] = "selectionClipboard";
EditorOption[EditorOption["selectionHighlight"] = 82] = "selectionHighlight";
EditorOption[EditorOption["selectOnLineNumbers"] = 83] = "selectOnLineNumbers";
EditorOption[EditorOption["showFoldingControls"] = 84] = "showFoldingControls";
EditorOption[EditorOption["showUnused"] = 85] = "showUnused";
EditorOption[EditorOption["snippetSuggestions"] = 86] = "snippetSuggestions";
EditorOption[EditorOption["smoothScrolling"] = 87] = "smoothScrolling";
EditorOption[EditorOption["stopRenderingLineAfter"] = 88] = "stopRenderingLineAfter";
EditorOption[EditorOption["suggest"] = 89] = "suggest";
EditorOption[EditorOption["suggestFontSize"] = 90] = "suggestFontSize";
EditorOption[EditorOption["suggestLineHeight"] = 91] = "suggestLineHeight";
EditorOption[EditorOption["suggestOnTriggerCharacters"] = 92] = "suggestOnTriggerCharacters";
EditorOption[EditorOption["suggestSelection"] = 93] = "suggestSelection";
EditorOption[EditorOption["tabCompletion"] = 94] = "tabCompletion";
EditorOption[EditorOption["useTabStops"] = 95] = "useTabStops";
EditorOption[EditorOption["wordSeparators"] = 96] = "wordSeparators";
EditorOption[EditorOption["wordWrap"] = 97] = "wordWrap";
EditorOption[EditorOption["wordWrapBreakAfterCharacters"] = 98] = "wordWrapBreakAfterCharacters";
EditorOption[EditorOption["wordWrapBreakBeforeCharacters"] = 99] = "wordWrapBreakBeforeCharacters";
EditorOption[EditorOption["wordWrapColumn"] = 100] = "wordWrapColumn";
EditorOption[EditorOption["wordWrapMinified"] = 101] = "wordWrapMinified";
EditorOption[EditorOption["wrappingIndent"] = 102] = "wrappingIndent";
EditorOption[EditorOption["wrappingStrategy"] = 103] = "wrappingStrategy";
EditorOption[EditorOption["editorClassName"] = 104] = "editorClassName";
EditorOption[EditorOption["pixelRatio"] = 105] = "pixelRatio";
EditorOption[EditorOption["tabFocusMode"] = 106] = "tabFocusMode";
EditorOption[EditorOption["layoutInfo"] = 107] = "layoutInfo";
EditorOption[EditorOption["wrappingInfo"] = 108] = "wrappingInfo";
})(EditorOption || (EditorOption = {}));
/**
* End of line character preference.
*/
var EndOfLinePreference;
(function (EndOfLinePreference) {
/**
* Use the end of line character identified in the text buffer.
*/
EndOfLinePreference[EndOfLinePreference["TextDefined"] = 0] = "TextDefined";
/**
* Use line feed (\n) as the end of line character.
*/
EndOfLinePreference[EndOfLinePreference["LF"] = 1] = "LF";
/**
* Use carriage return and line feed (\r\n) as the end of line character.
*/
EndOfLinePreference[EndOfLinePreference["CRLF"] = 2] = "CRLF";
})(EndOfLinePreference || (EndOfLinePreference = {}));
/**
* End of line character preference.
*/
var EndOfLineSequence;
(function (EndOfLineSequence) {
/**
* Use line feed (\n) as the end of line character.
*/
EndOfLineSequence[EndOfLineSequence["LF"] = 0] = "LF";
/**
* Use carriage return and line feed (\r\n) as the end of line character.
*/
EndOfLineSequence[EndOfLineSequence["CRLF"] = 1] = "CRLF";
})(EndOfLineSequence || (EndOfLineSequence = {}));
/**
* Describes what to do with the indentation when pressing Enter.
*/
var IndentAction;
(function (IndentAction) {
/**
* Insert new line and copy the previous line's indentation.
*/
IndentAction[IndentAction["None"] = 0] = "None";
/**
* Insert new line and indent once (relative to the previous line's indentation).
*/
IndentAction[IndentAction["Indent"] = 1] = "Indent";
/**
* Insert two new lines:
* - the first one indented which will hold the cursor
* - the second one at the same indentation level
*/
IndentAction[IndentAction["IndentOutdent"] = 2] = "IndentOutdent";
/**
* Insert new line and outdent once (relative to the previous line's indentation).
*/
IndentAction[IndentAction["Outdent"] = 3] = "Outdent";
})(IndentAction || (IndentAction = {}));
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
* But these are "more general", as they should work across browsers & OS`s.
*/
var KeyCode;
(function (KeyCode) {
/**
* Placed first to cover the 0 value of the enum.
*/
KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
KeyCode[KeyCode["Backspace"] = 1] = "Backspace";
KeyCode[KeyCode["Tab"] = 2] = "Tab";
KeyCode[KeyCode["Enter"] = 3] = "Enter";
KeyCode[KeyCode["Shift"] = 4] = "Shift";
KeyCode[KeyCode["Ctrl"] = 5] = "Ctrl";
KeyCode[KeyCode["Alt"] = 6] = "Alt";
KeyCode[KeyCode["PauseBreak"] = 7] = "PauseBreak";
KeyCode[KeyCode["CapsLock"] = 8] = "CapsLock";
KeyCode[KeyCode["Escape"] = 9] = "Escape";
KeyCode[KeyCode["Space"] = 10] = "Space";
KeyCode[KeyCode["PageUp"] = 11] = "PageUp";
KeyCode[KeyCode["PageDown"] = 12] = "PageDown";
KeyCode[KeyCode["End"] = 13] = "End";
KeyCode[KeyCode["Home"] = 14] = "Home";
KeyCode[KeyCode["LeftArrow"] = 15] = "LeftArrow";
KeyCode[KeyCode["UpArrow"] = 16] = "UpArrow";
KeyCode[KeyCode["RightArrow"] = 17] = "RightArrow";
KeyCode[KeyCode["DownArrow"] = 18] = "DownArrow";
KeyCode[KeyCode["Insert"] = 19] = "Insert";
KeyCode[KeyCode["Delete"] = 20] = "Delete";
KeyCode[KeyCode["KEY_0"] = 21] = "KEY_0";
KeyCode[KeyCode["KEY_1"] = 22] = "KEY_1";
KeyCode[KeyCode["KEY_2"] = 23] = "KEY_2";
KeyCode[KeyCode["KEY_3"] = 24] = "KEY_3";
KeyCode[KeyCode["KEY_4"] = 25] = "KEY_4";
KeyCode[KeyCode["KEY_5"] = 26] = "KEY_5";
KeyCode[KeyCode["KEY_6"] = 27] = "KEY_6";
KeyCode[KeyCode["KEY_7"] = 28] = "KEY_7";
KeyCode[KeyCode["KEY_8"] = 29] = "KEY_8";
KeyCode[KeyCode["KEY_9"] = 30] = "KEY_9";
KeyCode[KeyCode["KEY_A"] = 31] = "KEY_A";
KeyCode[KeyCode["KEY_B"] = 32] = "KEY_B";
KeyCode[KeyCode["KEY_C"] = 33] = "KEY_C";
KeyCode[KeyCode["KEY_D"] = 34] = "KEY_D";
KeyCode[KeyCode["KEY_E"] = 35] = "KEY_E";
KeyCode[KeyCode["KEY_F"] = 36] = "KEY_F";
KeyCode[KeyCode["KEY_G"] = 37] = "KEY_G";
KeyCode[KeyCode["KEY_H"] = 38] = "KEY_H";
KeyCode[KeyCode["KEY_I"] = 39] = "KEY_I";
KeyCode[KeyCode["KEY_J"] = 40] = "KEY_J";
KeyCode[KeyCode["KEY_K"] = 41] = "KEY_K";
KeyCode[KeyCode["KEY_L"] = 42] = "KEY_L";
KeyCode[KeyCode["KEY_M"] = 43] = "KEY_M";
KeyCode[KeyCode["KEY_N"] = 44] = "KEY_N";
KeyCode[KeyCode["KEY_O"] = 45] = "KEY_O";
KeyCode[KeyCode["KEY_P"] = 46] = "KEY_P";
KeyCode[KeyCode["KEY_Q"] = 47] = "KEY_Q";
KeyCode[KeyCode["KEY_R"] = 48] = "KEY_R";
KeyCode[KeyCode["KEY_S"] = 49] = "KEY_S";
KeyCode[KeyCode["KEY_T"] = 50] = "KEY_T";
KeyCode[KeyCode["KEY_U"] = 51] = "KEY_U";
KeyCode[KeyCode["KEY_V"] = 52] = "KEY_V";
KeyCode[KeyCode["KEY_W"] = 53] = "KEY_W";
KeyCode[KeyCode["KEY_X"] = 54] = "KEY_X";
KeyCode[KeyCode["KEY_Y"] = 55] = "KEY_Y";
KeyCode[KeyCode["KEY_Z"] = 56] = "KEY_Z";
KeyCode[KeyCode["Meta"] = 57] = "Meta";
KeyCode[KeyCode["ContextMenu"] = 58] = "ContextMenu";
KeyCode[KeyCode["F1"] = 59] = "F1";
KeyCode[KeyCode["F2"] = 60] = "F2";
KeyCode[KeyCode["F3"] = 61] = "F3";
KeyCode[KeyCode["F4"] = 62] = "F4";
KeyCode[KeyCode["F5"] = 63] = "F5";
KeyCode[KeyCode["F6"] = 64] = "F6";
KeyCode[KeyCode["F7"] = 65] = "F7";
KeyCode[KeyCode["F8"] = 66] = "F8";
KeyCode[KeyCode["F9"] = 67] = "F9";
KeyCode[KeyCode["F10"] = 68] = "F10";
KeyCode[KeyCode["F11"] = 69] = "F11";
KeyCode[KeyCode["F12"] = 70] = "F12";
KeyCode[KeyCode["F13"] = 71] = "F13";
KeyCode[KeyCode["F14"] = 72] = "F14";
KeyCode[KeyCode["F15"] = 73] = "F15";
KeyCode[KeyCode["F16"] = 74] = "F16";
KeyCode[KeyCode["F17"] = 75] = "F17";
KeyCode[KeyCode["F18"] = 76] = "F18";
KeyCode[KeyCode["F19"] = 77] = "F19";
KeyCode[KeyCode["NumLock"] = 78] = "NumLock";
KeyCode[KeyCode["ScrollLock"] = 79] = "ScrollLock";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ';:' key
*/
KeyCode[KeyCode["US_SEMICOLON"] = 80] = "US_SEMICOLON";
/**
* For any country/region, the '+' key
* For the US standard keyboard, the '=+' key
*/
KeyCode[KeyCode["US_EQUAL"] = 81] = "US_EQUAL";
/**
* For any country/region, the ',' key
* For the US standard keyboard, the ',<' key
*/
KeyCode[KeyCode["US_COMMA"] = 82] = "US_COMMA";
/**
* For any country/region, the '-' key
* For the US standard keyboard, the '-_' key
*/
KeyCode[KeyCode["US_MINUS"] = 83] = "US_MINUS";
/**
* For any country/region, the '.' key
* For the US standard keyboard, the '.>' key
*/
KeyCode[KeyCode["US_DOT"] = 84] = "US_DOT";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '/?' key
*/
KeyCode[KeyCode["US_SLASH"] = 85] = "US_SLASH";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '`~' key
*/
KeyCode[KeyCode["US_BACKTICK"] = 86] = "US_BACKTICK";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '[{' key
*/
KeyCode[KeyCode["US_OPEN_SQUARE_BRACKET"] = 87] = "US_OPEN_SQUARE_BRACKET";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '\|' key
*/
KeyCode[KeyCode["US_BACKSLASH"] = 88] = "US_BACKSLASH";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ']}' key
*/
KeyCode[KeyCode["US_CLOSE_SQUARE_BRACKET"] = 89] = "US_CLOSE_SQUARE_BRACKET";
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ''"' key
*/
KeyCode[KeyCode["US_QUOTE"] = 90] = "US_QUOTE";
/**
* Used for miscellaneous characters; it can vary by keyboard.
*/
KeyCode[KeyCode["OEM_8"] = 91] = "OEM_8";
/**
* Either the angle bracket key or the backslash key on the RT 102-key keyboard.
*/
KeyCode[KeyCode["OEM_102"] = 92] = "OEM_102";
KeyCode[KeyCode["NUMPAD_0"] = 93] = "NUMPAD_0";
KeyCode[KeyCode["NUMPAD_1"] = 94] = "NUMPAD_1";
KeyCode[KeyCode["NUMPAD_2"] = 95] = "NUMPAD_2";
KeyCode[KeyCode["NUMPAD_3"] = 96] = "NUMPAD_3";
KeyCode[KeyCode["NUMPAD_4"] = 97] = "NUMPAD_4";
KeyCode[KeyCode["NUMPAD_5"] = 98] = "NUMPAD_5";
KeyCode[KeyCode["NUMPAD_6"] = 99] = "NUMPAD_6";
KeyCode[KeyCode["NUMPAD_7"] = 100] = "NUMPAD_7";
KeyCode[KeyCode["NUMPAD_8"] = 101] = "NUMPAD_8";
KeyCode[KeyCode["NUMPAD_9"] = 102] = "NUMPAD_9";
KeyCode[KeyCode["NUMPAD_MULTIPLY"] = 103] = "NUMPAD_MULTIPLY";
KeyCode[KeyCode["NUMPAD_ADD"] = 104] = "NUMPAD_ADD";
KeyCode[KeyCode["NUMPAD_SEPARATOR"] = 105] = "NUMPAD_SEPARATOR";
KeyCode[KeyCode["NUMPAD_SUBTRACT"] = 106] = "NUMPAD_SUBTRACT";
KeyCode[KeyCode["NUMPAD_DECIMAL"] = 107] = "NUMPAD_DECIMAL";
KeyCode[KeyCode["NUMPAD_DIVIDE"] = 108] = "NUMPAD_DIVIDE";
/**
* Cover all key codes when IME is processing input.
*/
KeyCode[KeyCode["KEY_IN_COMPOSITION"] = 109] = "KEY_IN_COMPOSITION";
KeyCode[KeyCode["ABNT_C1"] = 110] = "ABNT_C1";
KeyCode[KeyCode["ABNT_C2"] = 111] = "ABNT_C2";
/**
* Placed last to cover the length of the enum.
* Please do not depend on this value!
*/
KeyCode[KeyCode["MAX_VALUE"] = 112] = "MAX_VALUE";
})(KeyCode || (KeyCode = {}));
var MarkerSeverity;
(function (MarkerSeverity) {
MarkerSeverity[MarkerSeverity["Hint"] = 1] = "Hint";
MarkerSeverity[MarkerSeverity["Info"] = 2] = "Info";
MarkerSeverity[MarkerSeverity["Warning"] = 4] = "Warning";
MarkerSeverity[MarkerSeverity["Error"] = 8] = "Error";
})(MarkerSeverity || (MarkerSeverity = {}));
var MarkerTag;
(function (MarkerTag) {
MarkerTag[MarkerTag["Unnecessary"] = 1] = "Unnecessary";
MarkerTag[MarkerTag["Deprecated"] = 2] = "Deprecated";
})(MarkerTag || (MarkerTag = {}));
/**
* Position in the minimap to render the decoration.
*/
var MinimapPosition;
(function (MinimapPosition) {
MinimapPosition[MinimapPosition["Inline"] = 1] = "Inline";
MinimapPosition[MinimapPosition["Gutter"] = 2] = "Gutter";
})(MinimapPosition || (MinimapPosition = {}));
/**
* Type of hit element with the mouse in the editor.
*/
var MouseTargetType;
(function (MouseTargetType) {
/**
* Mouse is on top of an unknown element.
*/
MouseTargetType[MouseTargetType["UNKNOWN"] = 0] = "UNKNOWN";
/**
* Mouse is on top of the textarea used for input.
*/
MouseTargetType[MouseTargetType["TEXTAREA"] = 1] = "TEXTAREA";
/**
* Mouse is on top of the glyph margin
*/
MouseTargetType[MouseTargetType["GUTTER_GLYPH_MARGIN"] = 2] = "GUTTER_GLYPH_MARGIN";
/**
* Mouse is on top of the line numbers
*/
MouseTargetType[MouseTargetType["GUTTER_LINE_NUMBERS"] = 3] = "GUTTER_LINE_NUMBERS";
/**
* Mouse is on top of the line decorations
*/
MouseTargetType[MouseTargetType["GUTTER_LINE_DECORATIONS"] = 4] = "GUTTER_LINE_DECORATIONS";
/**
* Mouse is on top of the whitespace left in the gutter by a view zone.
*/
MouseTargetType[MouseTargetType["GUTTER_VIEW_ZONE"] = 5] = "GUTTER_VIEW_ZONE";
/**
* Mouse is on top of text in the content.
*/
MouseTargetType[MouseTargetType["CONTENT_TEXT"] = 6] = "CONTENT_TEXT";
/**
* Mouse is on top of empty space in the content (e.g. after line text or below last line)
*/
MouseTargetType[MouseTargetType["CONTENT_EMPTY"] = 7] = "CONTENT_EMPTY";
/**
* Mouse is on top of a view zone in the content.
*/
MouseTargetType[MouseTargetType["CONTENT_VIEW_ZONE"] = 8] = "CONTENT_VIEW_ZONE";
/**
* Mouse is on top of a content widget.
*/
MouseTargetType[MouseTargetType["CONTENT_WIDGET"] = 9] = "CONTENT_WIDGET";
/**
* Mouse is on top of the decorations overview ruler.
*/
MouseTargetType[MouseTargetType["OVERVIEW_RULER"] = 10] = "OVERVIEW_RULER";
/**
* Mouse is on top of a scrollbar.
*/
MouseTargetType[MouseTargetType["SCROLLBAR"] = 11] = "SCROLLBAR";
/**
* Mouse is on top of an overlay widget.
*/
MouseTargetType[MouseTargetType["OVERLAY_WIDGET"] = 12] = "OVERLAY_WIDGET";
/**
* Mouse is outside of the editor.
*/
MouseTargetType[MouseTargetType["OUTSIDE_EDITOR"] = 13] = "OUTSIDE_EDITOR";
})(MouseTargetType || (MouseTargetType = {}));
/**
* A positioning preference for rendering overlay widgets.
*/
var OverlayWidgetPositionPreference;
(function (OverlayWidgetPositionPreference) {
/**
* Position the overlay widget in the top right corner
*/
OverlayWidgetPositionPreference[OverlayWidgetPositionPreference["TOP_RIGHT_CORNER"] = 0] = "TOP_RIGHT_CORNER";
/**
* Position the overlay widget in the bottom right corner
*/
OverlayWidgetPositionPreference[OverlayWidgetPositionPreference["BOTTOM_RIGHT_CORNER"] = 1] = "BOTTOM_RIGHT_CORNER";
/**
* Position the overlay widget in the top center
*/
OverlayWidgetPositionPreference[OverlayWidgetPositionPreference["TOP_CENTER"] = 2] = "TOP_CENTER";
})(OverlayWidgetPositionPreference || (OverlayWidgetPositionPreference = {}));
/**
* Vertical Lane in the overview ruler of the editor.
*/
var OverviewRulerLane;
(function (OverviewRulerLane) {
OverviewRulerLane[OverviewRulerLane["Left"] = 1] = "Left";
OverviewRulerLane[OverviewRulerLane["Center"] = 2] = "Center";
OverviewRulerLane[OverviewRulerLane["Right"] = 4] = "Right";
OverviewRulerLane[OverviewRulerLane["Full"] = 7] = "Full";
})(OverviewRulerLane || (OverviewRulerLane = {}));
var RenderLineNumbersType;
(function (RenderLineNumbersType) {
RenderLineNumbersType[RenderLineNumbersType["Off"] = 0] = "Off";
RenderLineNumbersType[RenderLineNumbersType["On"] = 1] = "On";
RenderLineNumbersType[RenderLineNumbersType["Relative"] = 2] = "Relative";
RenderLineNumbersType[RenderLineNumbersType["Interval"] = 3] = "Interval";
RenderLineNumbersType[RenderLineNumbersType["Custom"] = 4] = "Custom";
})(RenderLineNumbersType || (RenderLineNumbersType = {}));
var RenderMinimap;
(function (RenderMinimap) {
RenderMinimap[RenderMinimap["None"] = 0] = "None";
RenderMinimap[RenderMinimap["Text"] = 1] = "Text";
RenderMinimap[RenderMinimap["Blocks"] = 2] = "Blocks";
})(RenderMinimap || (RenderMinimap = {}));
var ScrollType;
(function (ScrollType) {
ScrollType[ScrollType["Smooth"] = 0] = "Smooth";
ScrollType[ScrollType["Immediate"] = 1] = "Immediate";
})(ScrollType || (ScrollType = {}));
var ScrollbarVisibility;
(function (ScrollbarVisibility) {
ScrollbarVisibility[ScrollbarVisibility["Auto"] = 1] = "Auto";
ScrollbarVisibility[ScrollbarVisibility["Hidden"] = 2] = "Hidden";
ScrollbarVisibility[ScrollbarVisibility["Visible"] = 3] = "Visible";
})(ScrollbarVisibility || (ScrollbarVisibility = {}));
/**
* The direction of a selection.
*/
var SelectionDirection;
(function (SelectionDirection) {
/**
* The selection starts above where it ends.
*/
SelectionDirection[SelectionDirection["LTR"] = 0] = "LTR";
/**
* The selection starts below where it ends.
*/
SelectionDirection[SelectionDirection["RTL"] = 1] = "RTL";
})(SelectionDirection || (SelectionDirection = {}));
var SignatureHelpTriggerKind;
(function (SignatureHelpTriggerKind) {
SignatureHelpTriggerKind[SignatureHelpTriggerKind["Invoke"] = 1] = "Invoke";
SignatureHelpTriggerKind[SignatureHelpTriggerKind["TriggerCharacter"] = 2] = "TriggerCharacter";
SignatureHelpTriggerKind[SignatureHelpTriggerKind["ContentChange"] = 3] = "ContentChange";
})(SignatureHelpTriggerKind || (SignatureHelpTriggerKind = {}));
/**
* A symbol kind.
*/
var SymbolKind;
(function (SymbolKind) {
SymbolKind[SymbolKind["File"] = 0] = "File";
SymbolKind[SymbolKind["Module"] = 1] = "Module";
SymbolKind[SymbolKind["Namespace"] = 2] = "Namespace";
SymbolKind[SymbolKind["Package"] = 3] = "Package";
SymbolKind[SymbolKind["Class"] = 4] = "Class";
SymbolKind[SymbolKind["Method"] = 5] = "Method";
SymbolKind[SymbolKind["Property"] = 6] = "Property";
SymbolKind[SymbolKind["Field"] = 7] = "Field";
SymbolKind[SymbolKind["Constructor"] = 8] = "Constructor";
SymbolKind[SymbolKind["Enum"] = 9] = "Enum";
SymbolKind[SymbolKind["Interface"] = 10] = "Interface";
SymbolKind[SymbolKind["Function"] = 11] = "Function";
SymbolKind[SymbolKind["Variable"] = 12] = "Variable";
SymbolKind[SymbolKind["Constant"] = 13] = "Constant";
SymbolKind[SymbolKind["String"] = 14] = "String";
SymbolKind[SymbolKind["Number"] = 15] = "Number";
SymbolKind[SymbolKind["Boolean"] = 16] = "Boolean";
SymbolKind[SymbolKind["Array"] = 17] = "Array";
SymbolKind[SymbolKind["Object"] = 18] = "Object";
SymbolKind[SymbolKind["Key"] = 19] = "Key";
SymbolKind[SymbolKind["Null"] = 20] = "Null";
SymbolKind[SymbolKind["EnumMember"] = 21] = "EnumMember";
SymbolKind[SymbolKind["Struct"] = 22] = "Struct";
SymbolKind[SymbolKind["Event"] = 23] = "Event";
SymbolKind[SymbolKind["Operator"] = 24] = "Operator";
SymbolKind[SymbolKind["TypeParameter"] = 25] = "TypeParameter";
})(SymbolKind || (SymbolKind = {}));
var SymbolTag;
(function (SymbolTag) {
SymbolTag[SymbolTag["Deprecated"] = 1] = "Deprecated";
})(SymbolTag || (SymbolTag = {}));
/**
* The kind of animation in which the editor's cursor should be rendered.
*/
var TextEditorCursorBlinkingStyle;
(function (TextEditorCursorBlinkingStyle) {
/**
* Hidden
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Hidden"] = 0] = "Hidden";
/**
* Blinking
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Blink"] = 1] = "Blink";
/**
* Blinking with smooth fading
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Smooth"] = 2] = "Smooth";
/**
* Blinking with prolonged filled state and smooth fading
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Phase"] = 3] = "Phase";
/**
* Expand collapse animation on the y axis
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Expand"] = 4] = "Expand";
/**
* No-Blinking
*/
TextEditorCursorBlinkingStyle[TextEditorCursorBlinkingStyle["Solid"] = 5] = "Solid";
})(TextEditorCursorBlinkingStyle || (TextEditorCursorBlinkingStyle = {}));
/**
* The style in which the editor's cursor should be rendered.
*/
var TextEditorCursorStyle;
(function (TextEditorCursorStyle) {
/**
* As a vertical line (sitting between two characters).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Line"] = 1] = "Line";
/**
* As a block (sitting on top of a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Block"] = 2] = "Block";
/**
* As a horizontal line (sitting under a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["Underline"] = 3] = "Underline";
/**
* As a thin vertical line (sitting between two characters).
*/
TextEditorCursorStyle[TextEditorCursorStyle["LineThin"] = 4] = "LineThin";
/**
* As an outlined block (sitting on top of a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["BlockOutline"] = 5] = "BlockOutline";
/**
* As a thin horizontal line (sitting under a character).
*/
TextEditorCursorStyle[TextEditorCursorStyle["UnderlineThin"] = 6] = "UnderlineThin";
})(TextEditorCursorStyle || (TextEditorCursorStyle = {}));
/**
* Describes the behavior of decorations when typing/editing near their edges.
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
*/
var TrackedRangeStickiness;
(function (TrackedRangeStickiness) {
TrackedRangeStickiness[TrackedRangeStickiness["AlwaysGrowsWhenTypingAtEdges"] = 0] = "AlwaysGrowsWhenTypingAtEdges";
TrackedRangeStickiness[TrackedRangeStickiness["NeverGrowsWhenTypingAtEdges"] = 1] = "NeverGrowsWhenTypingAtEdges";
TrackedRangeStickiness[TrackedRangeStickiness["GrowsOnlyWhenTypingBefore"] = 2] = "GrowsOnlyWhenTypingBefore";
TrackedRangeStickiness[TrackedRangeStickiness["GrowsOnlyWhenTypingAfter"] = 3] = "GrowsOnlyWhenTypingAfter";
})(TrackedRangeStickiness || (TrackedRangeStickiness = {}));
/**
* Describes how to indent wrapped lines.
*/
var WrappingIndent;
(function (WrappingIndent) {
/**
* No indentation => wrapped lines begin at column 1.
*/
WrappingIndent[WrappingIndent["None"] = 0] = "None";
/**
* Same => wrapped lines get the same indentation as the parent.
*/
WrappingIndent[WrappingIndent["Same"] = 1] = "Same";
/**
* Indent => wrapped lines get +1 indentation toward the parent.
*/
WrappingIndent[WrappingIndent["Indent"] = 2] = "Indent";
/**
* DeepIndent => wrapped lines get +2 indentation toward the parent.
*/
WrappingIndent[WrappingIndent["DeepIndent"] = 3] = "DeepIndent";
})(WrappingIndent || (WrappingIndent = {}));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/standalone/standaloneBase.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var standaloneBase_KeyMod = /** @class */ (function () {
function KeyMod() {
}
KeyMod.chord = function (firstPart, secondPart) {
return Object(keyCodes["a" /* KeyChord */])(firstPart, secondPart);
};
KeyMod.CtrlCmd = 2048 /* CtrlCmd */;
KeyMod.Shift = 1024 /* Shift */;
KeyMod.Alt = 512 /* Alt */;
KeyMod.WinCtrl = 256 /* WinCtrl */;
return KeyMod;
}());
function createMonacoBaseAPI() {
return {
editor: undefined,
languages: undefined,
CancellationTokenSource: cancellation["b" /* CancellationTokenSource */],
Emitter: common_event["a" /* Emitter */],
KeyCode: KeyCode,
KeyMod: standaloneBase_KeyMod,
Position: core_position["a" /* Position */],
Range: core_range["a" /* Range */],
Selection: core_selection["a" /* Selection */],
SelectionDirection: SelectionDirection,
MarkerSeverity: MarkerSeverity,
MarkerTag: MarkerTag,
Uri: common_uri["a" /* URI */],
Token: core_token["a" /* Token */]
};
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standalone-tokens.css
var standalone_tokens = __webpack_require__(620);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js
var services_codeEditorService = __webpack_require__(36);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/linkedList.js
var linkedList = __webpack_require__(98);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/marshalling.js
var marshalling = __webpack_require__(197);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/network.js
var network = __webpack_require__(37);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/resources.js
var resources = __webpack_require__(41);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js
var commands = __webpack_require__(28);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/opener/common/opener.js
var common_opener = __webpack_require__(64);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/editor/common/editor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var EditorOpenContext;
(function (EditorOpenContext) {
/**
* Default: the editor is opening via a programmatic call
* to the editor service API.
*/
EditorOpenContext[EditorOpenContext["API"] = 0] = "API";
/**
* Indicates that a user action triggered the opening, e.g.
* via mouse or keyboard use.
*/
EditorOpenContext[EditorOpenContext["USER"] = 1] = "USER";
})(EditorOpenContext || (EditorOpenContext = {}));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/openerService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __decorate = (undefined && undefined.__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;
};
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var openerService_CommandOpener = /** @class */ (function () {
function CommandOpener(_commandService) {
this._commandService = _commandService;
}
CommandOpener.prototype.open = function (target) {
return __awaiter(this, void 0, void 0, function () {
var args;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!Object(common_opener["c" /* matchesScheme */])(target, network["b" /* Schemas */].command)) {
return [2 /*return*/, false];
}
// run command or bail out if command isn't known
if (typeof target === 'string') {
target = common_uri["a" /* URI */].parse(target);
}
if (!commands["a" /* CommandsRegistry */].getCommand(target.path)) {
throw new Error("command '" + target.path + "' NOT known");
}
args = [];
try {
args = Object(marshalling["a" /* parse */])(decodeURIComponent(target.query));
}
catch (_c) {
// ignore and retry
try {
args = Object(marshalling["a" /* parse */])(target.query);
}
catch (_d) {
// ignore error
}
}
if (!Array.isArray(args)) {
args = [args];
}
return [4 /*yield*/, (_a = this._commandService).executeCommand.apply(_a, __spreadArrays([target.path], args))];
case 1:
_b.sent();
return [2 /*return*/, true];
}
});
});
};
CommandOpener = __decorate([
__param(0, commands["b" /* ICommandService */])
], CommandOpener);
return CommandOpener;
}());
var openerService_EditorOpener = /** @class */ (function () {
function EditorOpener(_editorService) {
this._editorService = _editorService;
}
EditorOpener.prototype.open = function (target, options) {
return __awaiter(this, void 0, void 0, function () {
var selection, match;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (typeof target === 'string') {
target = common_uri["a" /* URI */].parse(target);
}
selection = undefined;
match = /^L?(\d+)(?:,(\d+))?/.exec(target.fragment);
if (match) {
// support file:///some/file.js#73,84
// support file:///some/file.js#L73
selection = {
startLineNumber: parseInt(match[1]),
startColumn: match[2] ? parseInt(match[2]) : 1
};
// remove fragment
target = target.with({ fragment: '' });
}
if (target.scheme === network["b" /* Schemas */].file) {
target = Object(resources["g" /* normalizePath */])(target); // workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954)
}
return [4 /*yield*/, this._editorService.openCodeEditor({ resource: target, options: { selection: selection, context: (options === null || options === void 0 ? void 0 : options.fromUserGesture) ? EditorOpenContext.USER : EditorOpenContext.API } }, this._editorService.getFocusedCodeEditor(), options === null || options === void 0 ? void 0 : options.openToSide)];
case 1:
_a.sent();
return [2 /*return*/, true];
}
});
});
};
EditorOpener = __decorate([
__param(0, services_codeEditorService["a" /* ICodeEditorService */])
], EditorOpener);
return EditorOpener;
}());
var openerService_OpenerService = /** @class */ (function () {
function OpenerService(editorService, commandService) {
var _this = this;
this._openers = new linkedList["a" /* LinkedList */]();
this._validators = new linkedList["a" /* LinkedList */]();
this._resolvers = new linkedList["a" /* LinkedList */]();
// Default external opener is going through window.open()
this._externalOpener = {
openExternal: function (href) {
dom["ab" /* windowOpenNoOpener */](href);
return Promise.resolve(true);
}
};
// Default opener: maito, http(s), command, and catch-all-editors
this._openers.push({
open: function (target, options) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!((options === null || options === void 0 ? void 0 : options.openExternal) || Object(common_opener["c" /* matchesScheme */])(target, network["b" /* Schemas */].mailto) || Object(common_opener["c" /* matchesScheme */])(target, network["b" /* Schemas */].http) || Object(common_opener["c" /* matchesScheme */])(target, network["b" /* Schemas */].https))) return [3 /*break*/, 2];
// open externally
return [4 /*yield*/, this._doOpenExternal(target, options)];
case 1:
// open externally
_a.sent();
return [2 /*return*/, true];
case 2: return [2 /*return*/, false];
}
});
}); }
});
this._openers.push(new openerService_CommandOpener(commandService));
this._openers.push(new openerService_EditorOpener(editorService));
}
OpenerService.prototype.open = function (target, options) {
return __awaiter(this, void 0, void 0, function () {
var _i, _a, validator, _b, _c, opener_1, handled;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_i = 0, _a = this._validators.toArray();
_d.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
validator = _a[_i];
return [4 /*yield*/, validator.shouldOpen(target)];
case 2:
if (!(_d.sent())) {
return [2 /*return*/, false];
}
_d.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4:
_b = 0, _c = this._openers.toArray();
_d.label = 5;
case 5:
if (!(_b < _c.length)) return [3 /*break*/, 8];
opener_1 = _c[_b];
return [4 /*yield*/, opener_1.open(target, options)];
case 6:
handled = _d.sent();
if (handled) {
return [2 /*return*/, true];
}
_d.label = 7;
case 7:
_b++;
return [3 /*break*/, 5];
case 8: return [2 /*return*/, false];
}
});
});
};
OpenerService.prototype.resolveExternalUri = function (resource, options) {
return __awaiter(this, void 0, void 0, function () {
var _i, _a, resolver, result;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_i = 0, _a = this._resolvers.toArray();
_b.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
resolver = _a[_i];
return [4 /*yield*/, resolver.resolveExternalUri(resource, options)];
case 2:
result = _b.sent();
if (result) {
return [2 /*return*/, result];
}
_b.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/, { resolved: resource, dispose: function () { } }];
}
});
});
};
OpenerService.prototype._doOpenExternal = function (resource, options) {
return __awaiter(this, void 0, void 0, function () {
var uri, resolved;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
uri = typeof resource === 'string' ? common_uri["a" /* URI */].parse(resource) : resource;
return [4 /*yield*/, this.resolveExternalUri(uri, options)];
case 1:
resolved = (_a.sent()).resolved;
if (typeof resource === 'string' && uri.toString() === resolved.toString()) {
// open the url-string AS IS
return [2 /*return*/, this._externalOpener.openExternal(resource)];
}
else {
// open URI using the toString(noEncode)+encodeURI-trick
return [2 /*return*/, this._externalOpener.openExternal(encodeURI(resolved.toString(true)))];
}
return [2 /*return*/];
}
});
});
};
OpenerService.prototype.dispose = function () {
this._validators.clear();
};
OpenerService = __decorate([
__param(0, services_codeEditorService["a" /* ICodeEditorService */]),
__param(1, commands["b" /* ICommandService */])
], OpenerService);
return OpenerService;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/widget/diffNavigator.js
var diffNavigator = __webpack_require__(279);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/fontInfo.js
var fontInfo = __webpack_require__(153);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js
var editorCommon = __webpack_require__(40);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model.js
var common_model = __webpack_require__(47);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes.js + 3 modules
var modes = __webpack_require__(14);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/nullMode.js
var nullMode = __webpack_require__(73);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/editorWorkerService.js
var services_editorWorkerService = __webpack_require__(82);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/resolverService.js
var resolverService = __webpack_require__(102);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/async.js
var common_async = __webpack_require__(20);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/worker/simpleWorker.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var INITIALIZE = '$initialize';
var webWorkerWarningLogged = false;
function logOnceWebWorkerWarning(err) {
if (!platform["g" /* isWeb */]) {
// running tests
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);
}
var simpleWorker_SimpleWorkerProtocol = /** @class */ (function () {
function SimpleWorkerProtocol(handler) {
this._workerId = -1;
this._handler = handler;
this._lastSentReq = 0;
this._pendingReplies = Object.create(null);
}
SimpleWorkerProtocol.prototype.setWorkerId = function (workerId) {
this._workerId = workerId;
};
SimpleWorkerProtocol.prototype.sendMessage = function (method, args) {
var _this = this;
var req = String(++this._lastSentReq);
return new Promise(function (resolve, reject) {
_this._pendingReplies[req] = {
resolve: resolve,
reject: reject
};
_this._send({
vsWorker: _this._workerId,
req: req,
method: method,
args: args
});
});
};
SimpleWorkerProtocol.prototype.handleMessage = function (message) {
if (!message || !message.vsWorker) {
return;
}
if (this._workerId !== -1 && message.vsWorker !== this._workerId) {
return;
}
this._handleMessage(message);
};
SimpleWorkerProtocol.prototype._handleMessage = function (msg) {
var _this = this;
if (msg.seq) {
var replyMessage = msg;
if (!this._pendingReplies[replyMessage.seq]) {
console.warn('Got reply to unknown seq');
return;
}
var reply = this._pendingReplies[replyMessage.seq];
delete this._pendingReplies[replyMessage.seq];
if (replyMessage.err) {
var 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);
return;
}
var requestMessage = msg;
var req = requestMessage.req;
var result = this._handler.handleMessage(requestMessage.method, requestMessage.args);
result.then(function (r) {
_this._send({
vsWorker: _this._workerId,
seq: req,
res: r,
err: undefined
});
}, function (e) {
if (e.detail instanceof Error) {
// Loading errors have a detail property that points to the actual error
e.detail = Object(errors["g" /* transformErrorForSerialization */])(e.detail);
}
_this._send({
vsWorker: _this._workerId,
seq: req,
res: undefined,
err: Object(errors["g" /* transformErrorForSerialization */])(e)
});
});
};
SimpleWorkerProtocol.prototype._send = function (msg) {
var transfer = [];
if (msg.req) {
var m = msg;
for (var i = 0; i < m.args.length; i++) {
if (m.args[i] instanceof ArrayBuffer) {
transfer.push(m.args[i]);
}
}
}
else {
var m = msg;
if (m.res instanceof ArrayBuffer) {
transfer.push(m.res);
}
}
this._handler.sendMessage(msg, transfer);
};
return SimpleWorkerProtocol;
}());
/**
* Main thread side
*/
var simpleWorker_SimpleWorkerClient = /** @class */ (function (_super) {
__extends(SimpleWorkerClient, _super);
function SimpleWorkerClient(workerFactory, moduleId, host) {
var _this = _super.call(this) || this;
var lazyProxyReject = null;
_this._worker = _this._register(workerFactory.create('vs/base/common/worker/simpleWorker', function (msg) {
_this._protocol.handleMessage(msg);
}, function (err) {
// in Firefox, web workers fail lazily :(
// we will reject the proxy
if (lazyProxyReject) {
lazyProxyReject(err);
}
}));
_this._protocol = new simpleWorker_SimpleWorkerProtocol({
sendMessage: function (msg, transfer) {
_this._worker.postMessage(msg, transfer);
},
handleMessage: function (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);
}
}
});
_this._protocol.setWorkerId(_this._worker.getId());
// Gather loader configuration
var loaderConfiguration = null;
if (typeof self.require !== 'undefined' && typeof self.require.getConfig === 'function') {
// Get the configuration from the Monaco AMD Loader
loaderConfiguration = self.require.getConfig();
}
else if (typeof self.requirejs !== 'undefined') {
// Get the configuration from requirejs
loaderConfiguration = self.requirejs.s.contexts._.config;
}
var hostMethods = types["c" /* getAllMethodNames */](host);
// Send initialize message
_this._onModuleLoaded = _this._protocol.sendMessage(INITIALIZE, [
_this._worker.getId(),
JSON.parse(JSON.stringify(loaderConfiguration)),
moduleId,
hostMethods,
]);
// Create proxy to loaded code
var proxyMethodRequest = function (method, args) {
return _this._request(method, args);
};
_this._lazyProxy = new Promise(function (resolve, reject) {
lazyProxyReject = reject;
_this._onModuleLoaded.then(function (availableMethods) {
resolve(types["b" /* createProxyObject */](availableMethods, proxyMethodRequest));
}, function (e) {
reject(e);
_this._onError('Worker failed to load ' + moduleId, e);
});
});
return _this;
}
SimpleWorkerClient.prototype.getProxyObject = function () {
return this._lazyProxy;
};
SimpleWorkerClient.prototype._request = function (method, args) {
var _this = this;
return new Promise(function (resolve, reject) {
_this._onModuleLoaded.then(function () {
_this._protocol.sendMessage(method, args).then(resolve, reject);
}, reject);
});
};
SimpleWorkerClient.prototype._onError = function (message, error) {
console.error(message);
console.info(error);
};
return SimpleWorkerClient;
}(lifecycle["a" /* Disposable */]));
/**
* Worker side
*/
var simpleWorker_SimpleWorkerServer = /** @class */ (function () {
function SimpleWorkerServer(postMessage, requestHandlerFactory) {
var _this = this;
this._requestHandlerFactory = requestHandlerFactory;
this._requestHandler = null;
this._protocol = new simpleWorker_SimpleWorkerProtocol({
sendMessage: function (msg, transfer) {
postMessage(msg, transfer);
},
handleMessage: function (method, args) { return _this._handleMessage(method, args); }
});
}
SimpleWorkerServer.prototype.onmessage = function (msg) {
this._protocol.handleMessage(msg);
};
SimpleWorkerServer.prototype._handleMessage = function (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);
}
};
SimpleWorkerServer.prototype.initialize = function (workerId, loaderConfig, moduleId, hostMethods) {
var _this = this;
this._protocol.setWorkerId(workerId);
var proxyMethodRequest = function (method, args) {
return _this._protocol.sendMessage(method, args);
};
var hostProxy = types["b" /* createProxyObject */](hostMethods, proxyMethodRequest);
if (this._requestHandlerFactory) {
// static request handler
this._requestHandler = this._requestHandlerFactory(hostProxy);
return Promise.resolve(types["c" /* getAllMethodNames */](this._requestHandler));
}
if (loaderConfig) {
// Remove 'baseUrl', handling it is beyond scope for now
if (typeof loaderConfig.baseUrl !== 'undefined') {
delete loaderConfig['baseUrl'];
}
if (typeof loaderConfig.paths !== 'undefined') {
if (typeof loaderConfig.paths.vs !== 'undefined') {
delete loaderConfig.paths['vs'];
}
}
// Since this is in a web worker, enable catching errors
loaderConfig.catchError = true;
self.require.config(loaderConfig);
}
return new Promise(function (resolve, reject) {
// Use the global require to be sure to get the global config
self.require([moduleId], function (module) {
_this._requestHandler = module.create(hostProxy);
if (!_this._requestHandler) {
reject(new Error("No RequestHandler!"));
return;
}
resolve(types["c" /* getAllMethodNames */](_this._requestHandler));
}, reject);
});
};
return SimpleWorkerServer;
}());
/**
* Called on the worker side
*/
function simpleWorker_create(postMessage) {
return new simpleWorker_SimpleWorkerServer(postMessage, null);
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/worker/defaultWorkerFactory.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function getWorker(workerId, label) {
// Option for hosts to overwrite the worker script (used in the standalone editor)
if (platform["b" /* globals */].MonacoEnvironment) {
if (typeof platform["b" /* globals */].MonacoEnvironment.getWorker === 'function') {
return platform["b" /* globals */].MonacoEnvironment.getWorker(workerId, label);
}
if (typeof platform["b" /* globals */].MonacoEnvironment.getWorkerUrl === 'function') {
return new Worker(platform["b" /* globals */].MonacoEnvironment.getWorkerUrl(workerId, label));
}
}
// ESM-comment-begin
// if (typeof require === 'function') {
// // check if the JS lives on a different origin
// const workerMain = require.toUrl('./' + workerId);
// const workerUrl = getWorkerBootstrapUrl(workerMain, label);
// return new Worker(workerUrl, { name: label });
// }
// ESM-comment-end
throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker");
}
// ESM-comment-begin
// export function getWorkerBootstrapUrl(scriptPath: string, label: string): string {
// if (/^(http:)|(https:)|(file:)/.test(scriptPath)) {
// const currentUrl = String(window.location);
// const currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);
// if (scriptPath.substring(0, currentOrigin.length) !== currentOrigin) {
// // this is the cross-origin case
// // i.e. the webpage is running at a different origin than where the scripts are loaded from
// const myPath = 'vs/base/worker/defaultWorkerFactory.js';
// const workerBaseUrl = require.toUrl(myPath).slice(0, -myPath.length);
// const js = `/*${label}*/self.MonacoEnvironment={baseUrl: '${workerBaseUrl}'};importScripts('${scriptPath}');/*${label}*/`;
// const url = `data:text/javascript;charset=utf-8,${encodeURIComponent(js)}`;
// return url;
// }
// }
// return scriptPath + '#' + label;
// }
// ESM-comment-end
function isPromiseLike(obj) {
if (typeof obj.then === 'function') {
return true;
}
return false;
}
/**
* A worker that uses HTML5 web workers so that is has
* its own global scope and its own thread.
*/
var WebWorker = /** @class */ (function () {
function WebWorker(moduleId, id, label, onMessageCallback, onErrorCallback) {
this.id = id;
var workerOrPromise = getWorker('workerMain.js', label);
if (isPromiseLike(workerOrPromise)) {
this.worker = workerOrPromise;
}
else {
this.worker = Promise.resolve(workerOrPromise);
}
this.postMessage(moduleId, []);
this.worker.then(function (w) {
w.onmessage = function (ev) {
onMessageCallback(ev.data);
};
w.onmessageerror = onErrorCallback;
if (typeof w.addEventListener === 'function') {
w.addEventListener('error', onErrorCallback);
}
});
}
WebWorker.prototype.getId = function () {
return this.id;
};
WebWorker.prototype.postMessage = function (message, transfer) {
if (this.worker) {
this.worker.then(function (w) { return w.postMessage(message, transfer); });
}
};
WebWorker.prototype.dispose = function () {
if (this.worker) {
this.worker.then(function (w) { return w.terminate(); });
}
this.worker = null;
};
return WebWorker;
}());
var defaultWorkerFactory_DefaultWorkerFactory = /** @class */ (function () {
function DefaultWorkerFactory(label) {
this._label = label;
this._webWorkerFailedBeforeError = false;
}
DefaultWorkerFactory.prototype.create = function (moduleId, onMessageCallback, onErrorCallback) {
var _this = this;
var workerId = (++DefaultWorkerFactory.LAST_WORKER_ID);
if (this._webWorkerFailedBeforeError) {
throw this._webWorkerFailedBeforeError;
}
return new WebWorker(moduleId, workerId, this._label || 'anonymous' + workerId, onMessageCallback, function (err) {
logOnceWebWorkerWarning(err);
_this._webWorkerFailedBeforeError = err;
onErrorCallback(err);
});
};
DefaultWorkerFactory.LAST_WORKER_ID = 0;
return DefaultWorkerFactory;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/languageConfigurationRegistry.js + 4 modules
var languageConfigurationRegistry = __webpack_require__(33);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/diff/diff.js + 1 modules
var diff = __webpack_require__(183);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/iterator.js
var iterator = __webpack_require__(38);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/diff/diffComputer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var MINIMUM_MATCHING_CHARACTER_LENGTH = 3;
function computeDiff(originalSequence, modifiedSequence, continueProcessingPredicate, pretty) {
var diffAlgo = new diff["a" /* LcsDiff */](originalSequence, modifiedSequence, continueProcessingPredicate);
return diffAlgo.ComputeDiff(pretty);
}
var LineSequence = /** @class */ (function () {
function LineSequence(lines) {
var startColumns = [];
var endColumns = [];
for (var i = 0, length_1 = lines.length; i < length_1; i++) {
startColumns[i] = getFirstNonBlankColumn(lines[i], 1);
endColumns[i] = getLastNonBlankColumn(lines[i], 1);
}
this.lines = lines;
this._startColumns = startColumns;
this._endColumns = endColumns;
}
LineSequence.prototype.getElements = function () {
var elements = [];
for (var 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;
};
LineSequence.prototype.getStartLineNumber = function (i) {
return i + 1;
};
LineSequence.prototype.getEndLineNumber = function (i) {
return i + 1;
};
LineSequence.prototype.createCharSequence = function (shouldIgnoreTrimWhitespace, startIndex, endIndex) {
var charCodes = [];
var lineNumbers = [];
var columns = [];
var len = 0;
for (var index = startIndex; index <= endIndex; index++) {
var lineContent = this.lines[index];
var startColumn = (shouldIgnoreTrimWhitespace ? this._startColumns[index] : 1);
var endColumn = (shouldIgnoreTrimWhitespace ? this._endColumns[index] : lineContent.length + 1);
for (var col = startColumn; col < endColumn; col++) {
charCodes[len] = lineContent.charCodeAt(col - 1);
lineNumbers[len] = index + 1;
columns[len] = col;
len++;
}
}
return new CharSequence(charCodes, lineNumbers, columns);
};
return LineSequence;
}());
var CharSequence = /** @class */ (function () {
function CharSequence(charCodes, lineNumbers, columns) {
this._charCodes = charCodes;
this._lineNumbers = lineNumbers;
this._columns = columns;
}
CharSequence.prototype.getElements = function () {
return this._charCodes;
};
CharSequence.prototype.getStartLineNumber = function (i) {
return this._lineNumbers[i];
};
CharSequence.prototype.getStartColumn = function (i) {
return this._columns[i];
};
CharSequence.prototype.getEndLineNumber = function (i) {
return this._lineNumbers[i];
};
CharSequence.prototype.getEndColumn = function (i) {
return this._columns[i] + 1;
};
return CharSequence;
}());
var CharChange = /** @class */ (function () {
function CharChange(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;
}
CharChange.createFromDiffChange = function (diffChange, originalCharSequence, modifiedCharSequence) {
var originalStartLineNumber;
var originalStartColumn;
var originalEndLineNumber;
var originalEndColumn;
var modifiedStartLineNumber;
var modifiedStartColumn;
var modifiedEndLineNumber;
var modifiedEndColumn;
if (diffChange.originalLength === 0) {
originalStartLineNumber = 0;
originalStartColumn = 0;
originalEndLineNumber = 0;
originalEndColumn = 0;
}
else {
originalStartLineNumber = originalCharSequence.getStartLineNumber(diffChange.originalStart);
originalStartColumn = originalCharSequence.getStartColumn(diffChange.originalStart);
originalEndLineNumber = originalCharSequence.getEndLineNumber(diffChange.originalStart + diffChange.originalLength - 1);
originalEndColumn = originalCharSequence.getEndColumn(diffChange.originalStart + diffChange.originalLength - 1);
}
if (diffChange.modifiedLength === 0) {
modifiedStartLineNumber = 0;
modifiedStartColumn = 0;
modifiedEndLineNumber = 0;
modifiedEndColumn = 0;
}
else {
modifiedStartLineNumber = modifiedCharSequence.getStartLineNumber(diffChange.modifiedStart);
modifiedStartColumn = modifiedCharSequence.getStartColumn(diffChange.modifiedStart);
modifiedEndLineNumber = modifiedCharSequence.getEndLineNumber(diffChange.modifiedStart + diffChange.modifiedLength - 1);
modifiedEndColumn = modifiedCharSequence.getEndColumn(diffChange.modifiedStart + diffChange.modifiedLength - 1);
}
return new CharChange(originalStartLineNumber, originalStartColumn, originalEndLineNumber, originalEndColumn, modifiedStartLineNumber, modifiedStartColumn, modifiedEndLineNumber, modifiedEndColumn);
};
return CharChange;
}());
function postProcessCharChanges(rawChanges) {
if (rawChanges.length <= 1) {
return rawChanges;
}
var result = [rawChanges[0]];
var prevChange = result[0];
for (var i = 1, len = rawChanges.length; i < len; i++) {
var currChange = rawChanges[i];
var originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);
var modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);
// Both of the above should be equal, but the continueProcessingPredicate may prevent this from being true
var matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);
if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {
// Merge the current change into the previous one
prevChange.originalLength = (currChange.originalStart + currChange.originalLength) - prevChange.originalStart;
prevChange.modifiedLength = (currChange.modifiedStart + currChange.modifiedLength) - prevChange.modifiedStart;
}
else {
// Add the current change
result.push(currChange);
prevChange = currChange;
}
}
return result;
}
var LineChange = /** @class */ (function () {
function LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges) {
this.originalStartLineNumber = originalStartLineNumber;
this.originalEndLineNumber = originalEndLineNumber;
this.modifiedStartLineNumber = modifiedStartLineNumber;
this.modifiedEndLineNumber = modifiedEndLineNumber;
this.charChanges = charChanges;
}
LineChange.createFromDiffResult = function (shouldIgnoreTrimWhitespace, diffChange, originalLineSequence, modifiedLineSequence, continueCharDiff, shouldComputeCharChanges, shouldPostProcessCharChanges) {
var originalStartLineNumber;
var originalEndLineNumber;
var modifiedStartLineNumber;
var modifiedEndLineNumber;
var charChanges = undefined;
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()) {
// Compute character changes for diff chunks of at most 20 lines...
var originalCharSequence = originalLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.originalStart, diffChange.originalStart + diffChange.originalLength - 1);
var modifiedCharSequence = modifiedLineSequence.createCharSequence(shouldIgnoreTrimWhitespace, diffChange.modifiedStart, diffChange.modifiedStart + diffChange.modifiedLength - 1);
var rawChanges = computeDiff(originalCharSequence, modifiedCharSequence, continueCharDiff, true).changes;
if (shouldPostProcessCharChanges) {
rawChanges = postProcessCharChanges(rawChanges);
}
charChanges = [];
for (var i = 0, length_2 = rawChanges.length; i < length_2; i++) {
charChanges.push(CharChange.createFromDiffChange(rawChanges[i], originalCharSequence, modifiedCharSequence));
}
}
return new LineChange(originalStartLineNumber, originalEndLineNumber, modifiedStartLineNumber, modifiedEndLineNumber, charChanges);
};
return LineChange;
}());
var DiffComputer = /** @class */ (function () {
function DiffComputer(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, 5000)); // never run after 5s for character changes...
}
DiffComputer.prototype.computeDiff = function () {
if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {
// empty original => fast path
return {
quitEarly: false,
changes: [{
originalStartLineNumber: 1,
originalEndLineNumber: 1,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: this.modified.lines.length,
charChanges: [{
modifiedEndColumn: 0,
modifiedEndLineNumber: 0,
modifiedStartColumn: 0,
modifiedStartLineNumber: 0,
originalEndColumn: 0,
originalEndLineNumber: 0,
originalStartColumn: 0,
originalStartLineNumber: 0
}]
}]
};
}
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
// empty modified => fast path
return {
quitEarly: false,
changes: [{
originalStartLineNumber: 1,
originalEndLineNumber: this.original.lines.length,
modifiedStartLineNumber: 1,
modifiedEndLineNumber: 1,
charChanges: [{
modifiedEndColumn: 0,
modifiedEndLineNumber: 0,
modifiedStartColumn: 0,
modifiedStartLineNumber: 0,
originalEndColumn: 0,
originalEndLineNumber: 0,
originalStartColumn: 0,
originalStartLineNumber: 0
}]
}]
};
}
var diffResult = computeDiff(this.original, this.modified, this.continueLineDiff, this.shouldMakePrettyDiff);
var rawChanges = diffResult.changes;
var quitEarly = diffResult.quitEarly;
// The diff is always computed with ignoring trim whitespace
// This ensures we get the prettiest diff
if (this.shouldIgnoreTrimWhitespace) {
var lineChanges = [];
for (var i = 0, length_3 = rawChanges.length; i < length_3; i++) {
lineChanges.push(LineChange.createFromDiffResult(this.shouldIgnoreTrimWhitespace, rawChanges[i], this.original, this.modified, this.continueCharDiff, this.shouldComputeCharChanges, this.shouldPostProcessCharChanges));
}
return {
quitEarly: quitEarly,
changes: lineChanges
};
}
// Need to post-process and introduce changes where the trim whitespace is different
// Note that we are looping starting at -1 to also cover the lines before the first change
var result = [];
var originalLineIndex = 0;
var modifiedLineIndex = 0;
for (var i = -1 /* !!!! */, len = rawChanges.length; i < len; i++) {
var nextChange = (i + 1 < len ? rawChanges[i + 1] : null);
var originalStop = (nextChange ? nextChange.originalStart : this.originalLines.length);
var modifiedStop = (nextChange ? nextChange.modifiedStart : this.modifiedLines.length);
while (originalLineIndex < originalStop && modifiedLineIndex < modifiedStop) {
var originalLine = this.originalLines[originalLineIndex];
var modifiedLine = this.modifiedLines[modifiedLineIndex];
if (originalLine !== modifiedLine) {
// These lines differ only in trim whitespace
// Check the leading whitespace
{
var originalStartColumn = getFirstNonBlankColumn(originalLine, 1);
var modifiedStartColumn = getFirstNonBlankColumn(modifiedLine, 1);
while (originalStartColumn > 1 && modifiedStartColumn > 1) {
var originalChar = originalLine.charCodeAt(originalStartColumn - 2);
var 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);
}
}
// Check the trailing whitespace
{
var originalEndColumn = getLastNonBlankColumn(originalLine, 1);
var modifiedEndColumn = getLastNonBlankColumn(modifiedLine, 1);
var originalMaxColumn = originalLine.length + 1;
var modifiedMaxColumn = modifiedLine.length + 1;
while (originalEndColumn < originalMaxColumn && modifiedEndColumn < modifiedMaxColumn) {
var originalChar = originalLine.charCodeAt(originalEndColumn - 1);
var 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) {
// Emit the actual change
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: quitEarly,
changes: result
};
};
DiffComputer.prototype._pushTrimWhitespaceCharChange = function (result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {
if (this._mergeTrimWhitespaceCharChange(result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn)) {
// Merged into previous
return;
}
var charChanges = undefined;
if (this.shouldComputeCharChanges) {
charChanges = [new CharChange(originalLineNumber, originalStartColumn, originalLineNumber, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedLineNumber, modifiedEndColumn)];
}
result.push(new LineChange(originalLineNumber, originalLineNumber, modifiedLineNumber, modifiedLineNumber, charChanges));
};
DiffComputer.prototype._mergeTrimWhitespaceCharChange = function (result, originalLineNumber, originalStartColumn, originalEndColumn, modifiedLineNumber, modifiedStartColumn, modifiedEndColumn) {
var len = result.length;
if (len === 0) {
return false;
}
var prevChange = result[len - 1];
if (prevChange.originalEndLineNumber === 0 || prevChange.modifiedEndLineNumber === 0) {
// Don't merge with inserts/deletes
return false;
}
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;
};
return DiffComputer;
}());
function getFirstNonBlankColumn(txt, defaultValue) {
var r = strings["q" /* firstNonWhitespaceIndex */](txt);
if (r === -1) {
return defaultValue;
}
return r + 1;
}
function getLastNonBlankColumn(txt, defaultValue) {
var r = strings["D" /* lastNonWhitespaceIndex */](txt);
if (r === -1) {
return defaultValue;
}
return r + 2;
}
function createContinueProcessingPredicate(maximumRuntime) {
if (maximumRuntime === 0) {
return function () { return true; };
}
var startTime = Date.now();
return function () {
return Date.now() - startTime < maximumRuntime;
};
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/prefixSumComputer.js
var prefixSumComputer = __webpack_require__(232);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var mirrorTextModel_MirrorTextModel = /** @class */ (function () {
function MirrorTextModel(uri, lines, eol, versionId) {
this._uri = uri;
this._lines = lines;
this._eol = eol;
this._versionId = versionId;
this._lineStarts = null;
}
MirrorTextModel.prototype.dispose = function () {
this._lines.length = 0;
};
MirrorTextModel.prototype.getText = function () {
return this._lines.join(this._eol);
};
MirrorTextModel.prototype.onEvents = function (e) {
if (e.eol && e.eol !== this._eol) {
this._eol = e.eol;
this._lineStarts = null;
}
// Update my lines
var changes = e.changes;
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
var change = changes_1[_i];
this._acceptDeleteRange(change.range);
this._acceptInsertText(new core_position["a" /* Position */](change.range.startLineNumber, change.range.startColumn), change.text);
}
this._versionId = e.versionId;
};
MirrorTextModel.prototype._ensureLineStarts = function () {
if (!this._lineStarts) {
var eolLength = this._eol.length;
var linesLength = this._lines.length;
var lineStartValues = new Uint32Array(linesLength);
for (var i = 0; i < linesLength; i++) {
lineStartValues[i] = this._lines[i].length + eolLength;
}
this._lineStarts = new prefixSumComputer["a" /* PrefixSumComputer */](lineStartValues);
}
};
/**
* All changes to a line's text go through this method
*/
MirrorTextModel.prototype._setLineText = function (lineIndex, newValue) {
this._lines[lineIndex] = newValue;
if (this._lineStarts) {
// update prefix sum
this._lineStarts.changeValue(lineIndex, this._lines[lineIndex].length + this._eol.length);
}
};
MirrorTextModel.prototype._acceptDeleteRange = function (range) {
if (range.startLineNumber === range.endLineNumber) {
if (range.startColumn === range.endColumn) {
// Nothing to delete
return;
}
// Delete text on the affected line
this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)
+ this._lines[range.startLineNumber - 1].substring(range.endColumn - 1));
return;
}
// Take remaining text on last line and append it to remaining text on first line
this._setLineText(range.startLineNumber - 1, this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)
+ this._lines[range.endLineNumber - 1].substring(range.endColumn - 1));
// Delete middle lines
this._lines.splice(range.startLineNumber, range.endLineNumber - range.startLineNumber);
if (this._lineStarts) {
// update prefix sum
this._lineStarts.removeValues(range.startLineNumber, range.endLineNumber - range.startLineNumber);
}
};
MirrorTextModel.prototype._acceptInsertText = function (position, insertText) {
if (insertText.length === 0) {
// Nothing to insert
return;
}
var insertLines = insertText.split(/\r\n|\r|\n/);
if (insertLines.length === 1) {
// Inserting text on one line
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;
}
// Append overflowing text from first line to the end of text to insert
insertLines[insertLines.length - 1] += this._lines[position.lineNumber - 1].substring(position.column - 1);
// Delete overflowing text from first line and insert text on first line
this._setLineText(position.lineNumber - 1, this._lines[position.lineNumber - 1].substring(0, position.column - 1)
+ insertLines[0]);
// Insert new lines & store lengths
var newLengths = new Uint32Array(insertLines.length - 1);
for (var 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) {
// update prefix sum
this._lineStarts.insertValues(position.lineNumber, newLengths);
}
};
return MirrorTextModel;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/wordHelper.js
var wordHelper = __webpack_require__(123);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js
var characterClassifier = __webpack_require__(103);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/linkComputer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Uint8Matrix = /** @class */ (function () {
function Uint8Matrix(rows, cols, defaultValue) {
var data = new Uint8Array(rows * cols);
for (var i = 0, len = rows * cols; i < len; i++) {
data[i] = defaultValue;
}
this._data = data;
this.rows = rows;
this.cols = cols;
}
Uint8Matrix.prototype.get = function (row, col) {
return this._data[row * this.cols + col];
};
Uint8Matrix.prototype.set = function (row, col, value) {
this._data[row * this.cols + col] = value;
};
return Uint8Matrix;
}());
var StateMachine = /** @class */ (function () {
function StateMachine(edges) {
var maxCharCode = 0;
var maxState = 0 /* Invalid */;
for (var i = 0, len = edges.length; i < len; i++) {
var _a = edges[i], from = _a[0], chCode = _a[1], to = _a[2];
if (chCode > maxCharCode) {
maxCharCode = chCode;
}
if (from > maxState) {
maxState = from;
}
if (to > maxState) {
maxState = to;
}
}
maxCharCode++;
maxState++;
var states = new Uint8Matrix(maxState, maxCharCode, 0 /* Invalid */);
for (var i = 0, len = edges.length; i < len; i++) {
var _b = edges[i], from = _b[0], chCode = _b[1], to = _b[2];
states.set(from, chCode, to);
}
this._states = states;
this._maxCharCode = maxCharCode;
}
StateMachine.prototype.nextState = function (currentState, chCode) {
if (chCode < 0 || chCode >= this._maxCharCode) {
return 0 /* Invalid */;
}
return this._states.get(currentState, chCode);
};
return StateMachine;
}());
// State machine for http:// or https:// or file://
var _stateMachine = null;
function getStateMachine() {
if (_stateMachine === null) {
_stateMachine = new StateMachine([
[1 /* Start */, 104 /* h */, 2 /* H */],
[1 /* Start */, 72 /* H */, 2 /* H */],
[1 /* Start */, 102 /* f */, 6 /* F */],
[1 /* Start */, 70 /* F */, 6 /* F */],
[2 /* H */, 116 /* t */, 3 /* HT */],
[2 /* H */, 84 /* T */, 3 /* HT */],
[3 /* HT */, 116 /* t */, 4 /* HTT */],
[3 /* HT */, 84 /* T */, 4 /* HTT */],
[4 /* HTT */, 112 /* p */, 5 /* HTTP */],
[4 /* HTT */, 80 /* P */, 5 /* HTTP */],
[5 /* HTTP */, 115 /* s */, 9 /* BeforeColon */],
[5 /* HTTP */, 83 /* S */, 9 /* BeforeColon */],
[5 /* HTTP */, 58 /* Colon */, 10 /* AfterColon */],
[6 /* F */, 105 /* i */, 7 /* FI */],
[6 /* F */, 73 /* I */, 7 /* FI */],
[7 /* FI */, 108 /* l */, 8 /* FIL */],
[7 /* FI */, 76 /* L */, 8 /* FIL */],
[8 /* FIL */, 101 /* e */, 9 /* BeforeColon */],
[8 /* FIL */, 69 /* E */, 9 /* BeforeColon */],
[9 /* BeforeColon */, 58 /* Colon */, 10 /* AfterColon */],
[10 /* AfterColon */, 47 /* Slash */, 11 /* AlmostThere */],
[11 /* AlmostThere */, 47 /* Slash */, 12 /* End */],
]);
}
return _stateMachine;
}
var _classifier = null;
function getClassifier() {
if (_classifier === null) {
_classifier = new characterClassifier["a" /* CharacterClassifier */](0 /* None */);
var FORCE_TERMINATION_CHARACTERS = ' \t<>\'\"、。。、,.:;?!@#$%&*‘“〈《「『【〔([{「」}])〕】』」》〉”’`~…';
for (var i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {
_classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), 1 /* ForceTermination */);
}
var CANNOT_END_WITH_CHARACTERS = '.,;';
for (var i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) {
_classifier.set(CANNOT_END_WITH_CHARACTERS.charCodeAt(i), 2 /* CannotEndIn */);
}
}
return _classifier;
}
var LinkComputer = /** @class */ (function () {
function LinkComputer() {
}
LinkComputer._createLink = function (classifier, line, lineNumber, linkBeginIndex, linkEndIndex) {
// Do not allow to end link in certain characters...
var lastIncludedCharIndex = linkEndIndex - 1;
do {
var chCode = line.charCodeAt(lastIncludedCharIndex);
var chClass = classifier.get(chCode);
if (chClass !== 2 /* CannotEndIn */) {
break;
}
lastIncludedCharIndex--;
} while (lastIncludedCharIndex > linkBeginIndex);
// Handle links enclosed in parens, square brackets and curlys.
if (linkBeginIndex > 0) {
var charCodeBeforeLink = line.charCodeAt(linkBeginIndex - 1);
var lastCharCodeInLink = line.charCodeAt(lastIncludedCharIndex);
if ((charCodeBeforeLink === 40 /* OpenParen */ && lastCharCodeInLink === 41 /* CloseParen */)
|| (charCodeBeforeLink === 91 /* OpenSquareBracket */ && lastCharCodeInLink === 93 /* CloseSquareBracket */)
|| (charCodeBeforeLink === 123 /* OpenCurlyBrace */ && lastCharCodeInLink === 125 /* CloseCurlyBrace */)) {
// Do not end in ) if ( is before the link start
// Do not end in ] if [ is before the link start
// Do not end in } if { is before the link start
lastIncludedCharIndex--;
}
}
return {
range: {
startLineNumber: lineNumber,
startColumn: linkBeginIndex + 1,
endLineNumber: lineNumber,
endColumn: lastIncludedCharIndex + 2
},
url: line.substring(linkBeginIndex, lastIncludedCharIndex + 1)
};
};
LinkComputer.computeLinks = function (model, stateMachine) {
if (stateMachine === void 0) { stateMachine = getStateMachine(); }
var classifier = getClassifier();
var result = [];
for (var i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) {
var line = model.getLineContent(i);
var len = line.length;
var j = 0;
var linkBeginIndex = 0;
var linkBeginChCode = 0;
var state = 1 /* Start */;
var hasOpenParens = false;
var hasOpenSquareBracket = false;
var hasOpenCurlyBracket = false;
while (j < len) {
var resetStateMachine = false;
var chCode = line.charCodeAt(j);
if (state === 13 /* Accept */) {
var chClass = void 0;
switch (chCode) {
case 40 /* OpenParen */:
hasOpenParens = true;
chClass = 0 /* None */;
break;
case 41 /* CloseParen */:
chClass = (hasOpenParens ? 0 /* None */ : 1 /* ForceTermination */);
break;
case 91 /* OpenSquareBracket */:
hasOpenSquareBracket = true;
chClass = 0 /* None */;
break;
case 93 /* CloseSquareBracket */:
chClass = (hasOpenSquareBracket ? 0 /* None */ : 1 /* ForceTermination */);
break;
case 123 /* OpenCurlyBrace */:
hasOpenCurlyBracket = true;
chClass = 0 /* None */;
break;
case 125 /* CloseCurlyBrace */:
chClass = (hasOpenCurlyBracket ? 0 /* None */ : 1 /* ForceTermination */);
break;
/* The following three rules make it that ' or " or ` are allowed inside links if the link began with a different one */
case 39 /* SingleQuote */:
chClass = (linkBeginChCode === 34 /* DoubleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;
break;
case 34 /* DoubleQuote */:
chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 96 /* BackTick */) ? 0 /* None */ : 1 /* ForceTermination */;
break;
case 96 /* BackTick */:
chClass = (linkBeginChCode === 39 /* SingleQuote */ || linkBeginChCode === 34 /* DoubleQuote */) ? 0 /* None */ : 1 /* ForceTermination */;
break;
case 42 /* Asterisk */:
// `*` terminates a link if the link began with `*`
chClass = (linkBeginChCode === 42 /* Asterisk */) ? 1 /* ForceTermination */ : 0 /* None */;
break;
case 124 /* Pipe */:
// `|` terminates a link if the link began with `|`
chClass = (linkBeginChCode === 124 /* Pipe */) ? 1 /* ForceTermination */ : 0 /* None */;
break;
default:
chClass = classifier.get(chCode);
}
// Check if character terminates link
if (chClass === 1 /* ForceTermination */) {
result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));
resetStateMachine = true;
}
}
else if (state === 12 /* End */) {
var chClass = void 0;
if (chCode === 91 /* OpenSquareBracket */) {
// Allow for the authority part to contain ipv6 addresses which contain [ and ]
hasOpenSquareBracket = true;
chClass = 0 /* None */;
}
else {
chClass = classifier.get(chCode);
}
// Check if character terminates link
if (chClass === 1 /* ForceTermination */) {
resetStateMachine = true;
}
else {
state = 13 /* Accept */;
}
}
else {
state = stateMachine.nextState(state, chCode);
if (state === 0 /* Invalid */) {
resetStateMachine = true;
}
}
if (resetStateMachine) {
state = 1 /* Start */;
hasOpenParens = false;
hasOpenSquareBracket = false;
hasOpenCurlyBracket = false;
// Record where the link started
linkBeginIndex = j + 1;
linkBeginChCode = chCode;
}
j++;
}
if (state === 13 /* Accept */) {
result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, len));
}
}
return result;
};
return LinkComputer;
}());
/**
* Returns an array of all links contains in the provided
* document. *Note* that this operation is computational
* expensive and should not run in the UI thread.
*/
function computeLinks(model) {
if (!model || typeof model.getLineCount !== 'function' || typeof model.getLineContent !== 'function') {
// Unknown caller!
return [];
}
return LinkComputer.computeLinks(model);
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/inplaceReplaceSupport.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var BasicInplaceReplace = /** @class */ (function () {
function BasicInplaceReplace() {
this._defaultValueSet = [
['true', 'false'],
['True', 'False'],
['Private', 'Public', 'Friend', 'ReadOnly', 'Partial', 'Protected', 'WriteOnly'],
['public', 'protected', 'private'],
];
}
BasicInplaceReplace.prototype.navigateValueSet = function (range1, text1, range2, text2, up) {
if (range1 && text1) {
var result = this.doNavigateValueSet(text1, up);
if (result) {
return {
range: range1,
value: result
};
}
}
if (range2 && text2) {
var result = this.doNavigateValueSet(text2, up);
if (result) {
return {
range: range2,
value: result
};
}
}
return null;
};
BasicInplaceReplace.prototype.doNavigateValueSet = function (text, up) {
var numberResult = this.numberReplace(text, up);
if (numberResult !== null) {
return numberResult;
}
return this.textReplace(text, up);
};
BasicInplaceReplace.prototype.numberReplace = function (value, up) {
var precision = Math.pow(10, value.length - (value.lastIndexOf('.') + 1));
var n1 = Number(value);
var n2 = parseFloat(value);
if (!isNaN(n1) && !isNaN(n2) && n1 === n2) {
if (n1 === 0 && !up) {
return null; // don't do negative
// } else if(n1 === 9 && up) {
// return null; // don't insert 10 into a number
}
else {
n1 = Math.floor(n1 * precision);
n1 += up ? precision : -precision;
return String(n1 / precision);
}
}
return null;
};
BasicInplaceReplace.prototype.textReplace = function (value, up) {
return this.valueSetsReplace(this._defaultValueSet, value, up);
};
BasicInplaceReplace.prototype.valueSetsReplace = function (valueSets, value, up) {
var result = null;
for (var i = 0, len = valueSets.length; result === null && i < len; i++) {
result = this.valueSetReplace(valueSets[i], value, up);
}
return result;
};
BasicInplaceReplace.prototype.valueSetReplace = function (valueSet, value, up) {
var 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();
return BasicInplaceReplace;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var editorSimpleWorker_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var editorSimpleWorker_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var editorSimpleWorker_generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
/**
* @internal
*/
var editorSimpleWorker_MirrorModel = /** @class */ (function (_super) {
editorSimpleWorker_extends(MirrorModel, _super);
function MirrorModel() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(MirrorModel.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MirrorModel.prototype, "version", {
get: function () {
return this._versionId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MirrorModel.prototype, "eol", {
get: function () {
return this._eol;
},
enumerable: true,
configurable: true
});
MirrorModel.prototype.getValue = function () {
return this.getText();
};
MirrorModel.prototype.getLinesContent = function () {
return this._lines.slice(0);
};
MirrorModel.prototype.getLineCount = function () {
return this._lines.length;
};
MirrorModel.prototype.getLineContent = function (lineNumber) {
return this._lines[lineNumber - 1];
};
MirrorModel.prototype.getWordAtPosition = function (position, wordDefinition) {
var wordAtText = Object(wordHelper["d" /* getWordAtText */])(position.column, Object(wordHelper["c" /* ensureValidWordDefinition */])(wordDefinition), this._lines[position.lineNumber - 1], 0);
if (wordAtText) {
return new core_range["a" /* Range */](position.lineNumber, wordAtText.startColumn, position.lineNumber, wordAtText.endColumn);
}
return null;
};
MirrorModel.prototype.createWordIterator = function (wordDefinition) {
var _this = this;
var obj;
var lineNumber = 0;
var lineText;
var wordRangesIdx = 0;
var wordRanges = [];
var next = function () {
if (wordRangesIdx < wordRanges.length) {
var value = lineText.substring(wordRanges[wordRangesIdx].start, wordRanges[wordRangesIdx].end);
wordRangesIdx += 1;
if (!obj) {
obj = { done: false, value: value };
}
else {
obj.value = value;
}
return obj;
}
else if (lineNumber >= _this._lines.length) {
return iterator["c" /* FIN */];
}
else {
lineText = _this._lines[lineNumber];
wordRanges = _this._wordenize(lineText, wordDefinition);
wordRangesIdx = 0;
lineNumber += 1;
return next();
}
};
return { next: next };
};
MirrorModel.prototype.getLineWords = function (lineNumber, wordDefinition) {
var content = this._lines[lineNumber - 1];
var ranges = this._wordenize(content, wordDefinition);
var words = [];
for (var _i = 0, ranges_1 = ranges; _i < ranges_1.length; _i++) {
var range = ranges_1[_i];
words.push({
word: content.substring(range.start, range.end),
startColumn: range.start + 1,
endColumn: range.end + 1
});
}
return words;
};
MirrorModel.prototype._wordenize = function (content, wordDefinition) {
var result = [];
var match;
wordDefinition.lastIndex = 0; // reset lastIndex just to be sure
while (match = wordDefinition.exec(content)) {
if (match[0].length === 0) {
// it did match the empty string
break;
}
result.push({ start: match.index, end: match.index + match[0].length });
}
return result;
};
MirrorModel.prototype.getValueInRange = function (range) {
range = this._validateRange(range);
if (range.startLineNumber === range.endLineNumber) {
return this._lines[range.startLineNumber - 1].substring(range.startColumn - 1, range.endColumn - 1);
}
var lineEnding = this._eol;
var startLineIndex = range.startLineNumber - 1;
var endLineIndex = range.endLineNumber - 1;
var resultLines = [];
resultLines.push(this._lines[startLineIndex].substring(range.startColumn - 1));
for (var i = startLineIndex + 1; i < endLineIndex; i++) {
resultLines.push(this._lines[i]);
}
resultLines.push(this._lines[endLineIndex].substring(0, range.endColumn - 1));
return resultLines.join(lineEnding);
};
MirrorModel.prototype.offsetAt = function (position) {
position = this._validatePosition(position);
this._ensureLineStarts();
return this._lineStarts.getAccumulatedValue(position.lineNumber - 2) + (position.column - 1);
};
MirrorModel.prototype.positionAt = function (offset) {
offset = Math.floor(offset);
offset = Math.max(0, offset);
this._ensureLineStarts();
var out = this._lineStarts.getIndexOf(offset);
var lineLength = this._lines[out.index].length;
// Ensure we return a valid position
return {
lineNumber: 1 + out.index,
column: 1 + Math.min(out.remainder, lineLength)
};
};
MirrorModel.prototype._validateRange = function (range) {
var start = this._validatePosition({ lineNumber: range.startLineNumber, column: range.startColumn });
var end = this._validatePosition({ lineNumber: range.endLineNumber, column: range.endColumn });
if (start.lineNumber !== range.startLineNumber
|| start.column !== range.startColumn
|| end.lineNumber !== range.endLineNumber
|| end.column !== range.endColumn) {
return {
startLineNumber: start.lineNumber,
startColumn: start.column,
endLineNumber: end.lineNumber,
endColumn: end.column
};
}
return range;
};
MirrorModel.prototype._validatePosition = function (position) {
if (!core_position["a" /* Position */].isIPosition(position)) {
throw new Error('bad position');
}
var lineNumber = position.lineNumber, column = position.column;
var 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 {
var 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: lineNumber, column: column };
}
};
return MirrorModel;
}(mirrorTextModel_MirrorTextModel));
/**
* @internal
*/
var editorSimpleWorker_EditorSimpleWorker = /** @class */ (function () {
function EditorSimpleWorker(host, foreignModuleFactory) {
this._host = host;
this._models = Object.create(null);
this._foreignModuleFactory = foreignModuleFactory;
this._foreignModule = null;
}
EditorSimpleWorker.prototype.dispose = function () {
this._models = Object.create(null);
};
EditorSimpleWorker.prototype._getModel = function (uri) {
return this._models[uri];
};
EditorSimpleWorker.prototype._getModels = function () {
var _this = this;
var all = [];
Object.keys(this._models).forEach(function (key) { return all.push(_this._models[key]); });
return all;
};
EditorSimpleWorker.prototype.acceptNewModel = function (data) {
this._models[data.url] = new editorSimpleWorker_MirrorModel(common_uri["a" /* URI */].parse(data.url), data.lines, data.EOL, data.versionId);
};
EditorSimpleWorker.prototype.acceptModelChanged = function (strURL, e) {
if (!this._models[strURL]) {
return;
}
var model = this._models[strURL];
model.onEvents(e);
};
EditorSimpleWorker.prototype.acceptRemovedModel = function (strURL) {
if (!this._models[strURL]) {
return;
}
delete this._models[strURL];
};
// ---- BEGIN diff --------------------------------------------------------------------------
EditorSimpleWorker.prototype.computeDiff = function (originalUrl, modifiedUrl, ignoreTrimWhitespace, maxComputationTime) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var original, modified, originalLines, modifiedLines, diffComputer, diffResult, identical;
return editorSimpleWorker_generator(this, function (_a) {
original = this._getModel(originalUrl);
modified = this._getModel(modifiedUrl);
if (!original || !modified) {
return [2 /*return*/, null];
}
originalLines = original.getLinesContent();
modifiedLines = modified.getLinesContent();
diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldComputeCharChanges: true,
shouldPostProcessCharChanges: true,
shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
shouldMakePrettyDiff: true,
maxComputationTime: maxComputationTime
});
diffResult = diffComputer.computeDiff();
identical = (diffResult.changes.length > 0 ? false : this._modelsAreIdentical(original, modified));
return [2 /*return*/, {
quitEarly: diffResult.quitEarly,
identical: identical,
changes: diffResult.changes
}];
});
});
};
EditorSimpleWorker.prototype._modelsAreIdentical = function (original, modified) {
var originalLineCount = original.getLineCount();
var modifiedLineCount = modified.getLineCount();
if (originalLineCount !== modifiedLineCount) {
return false;
}
for (var line = 1; line <= originalLineCount; line++) {
var originalLine = original.getLineContent(line);
var modifiedLine = modified.getLineContent(line);
if (originalLine !== modifiedLine) {
return false;
}
}
return true;
};
EditorSimpleWorker.prototype.computeMoreMinimalEdits = function (modelUrl, edits) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var model, result, lastEol, _i, edits_1, _a, range, text, eol, original, changes, editOffset, _b, changes_1, change, start, end, newEdit;
return editorSimpleWorker_generator(this, function (_c) {
model = this._getModel(modelUrl);
if (!model) {
return [2 /*return*/, edits];
}
result = [];
lastEol = undefined;
edits = Object(arrays["r" /* mergeSort */])(edits, function (a, b) {
if (a.range && b.range) {
return core_range["a" /* Range */].compareRangesUsingStarts(a.range, b.range);
}
// eol only changes should go to the end
var aRng = a.range ? 0 : 1;
var bRng = b.range ? 0 : 1;
return aRng - bRng;
});
for (_i = 0, edits_1 = edits; _i < edits_1.length; _i++) {
_a = edits_1[_i], range = _a.range, text = _a.text, eol = _a.eol;
if (typeof eol === 'number') {
lastEol = eol;
}
if (core_range["a" /* Range */].isEmpty(range) && !text) {
// empty change
continue;
}
original = model.getValueInRange(range);
text = text.replace(/\r\n|\n|\r/g, model.eol);
if (original === text) {
// noop
continue;
}
// make sure diff won't take too long
if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {
result.push({ range: range, text: text });
continue;
}
changes = Object(diff["b" /* stringDiff */])(original, text, false);
editOffset = model.offsetAt(core_range["a" /* Range */].lift(range).getStartPosition());
for (_b = 0, changes_1 = changes; _b < changes_1.length; _b++) {
change = changes_1[_b];
start = model.positionAt(editOffset + change.originalStart);
end = model.positionAt(editOffset + change.originalStart + change.originalLength);
newEdit = {
text: text.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 [2 /*return*/, result];
});
});
};
// ---- END minimal edits ---------------------------------------------------------------
EditorSimpleWorker.prototype.computeLinks = function (modelUrl) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var model;
return editorSimpleWorker_generator(this, function (_a) {
model = this._getModel(modelUrl);
if (!model) {
return [2 /*return*/, null];
}
return [2 /*return*/, computeLinks(model)];
});
});
};
EditorSimpleWorker.prototype.textualSuggest = function (modelUrl, position, wordDef, wordDefFlags) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var model, words, seen, wordDefRegExp, wordAt, iter, e, word;
return editorSimpleWorker_generator(this, function (_a) {
model = this._getModel(modelUrl);
if (!model) {
return [2 /*return*/, null];
}
words = [];
seen = new Set();
wordDefRegExp = new RegExp(wordDef, wordDefFlags);
wordAt = model.getWordAtPosition(position, wordDefRegExp);
if (wordAt) {
seen.add(model.getValueInRange(wordAt));
}
for (iter = model.createWordIterator(wordDefRegExp), e = iter.next(); !e.done && seen.size <= EditorSimpleWorker._suggestionsLimit; e = iter.next()) {
word = e.value;
if (seen.has(word)) {
continue;
}
seen.add(word);
if (!isNaN(Number(word))) {
continue;
}
words.push(word);
}
return [2 /*return*/, words];
});
});
};
// ---- END suggest --------------------------------------------------------------------------
//#region -- word ranges --
EditorSimpleWorker.prototype.computeWordRanges = function (modelUrl, range, wordDef, wordDefFlags) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var model, wordDefRegExp, result, line, words, _i, words_1, word, array;
return editorSimpleWorker_generator(this, function (_a) {
model = this._getModel(modelUrl);
if (!model) {
return [2 /*return*/, Object.create(null)];
}
wordDefRegExp = new RegExp(wordDef, wordDefFlags);
result = Object.create(null);
for (line = range.startLineNumber; line < range.endLineNumber; line++) {
words = model.getLineWords(line, wordDefRegExp);
for (_i = 0, words_1 = words; _i < words_1.length; _i++) {
word = words_1[_i];
if (!isNaN(Number(word.word))) {
continue;
}
array = result[word.word];
if (!array) {
array = [];
result[word.word] = array;
}
array.push({
startLineNumber: line,
startColumn: word.startColumn,
endLineNumber: line,
endColumn: word.endColumn
});
}
}
return [2 /*return*/, result];
});
});
};
//#endregion
EditorSimpleWorker.prototype.navigateValueSet = function (modelUrl, range, up, wordDef, wordDefFlags) {
return editorSimpleWorker_awaiter(this, void 0, void 0, function () {
var model, wordDefRegExp, selectionText, wordRange, word, result;
return editorSimpleWorker_generator(this, function (_a) {
model = this._getModel(modelUrl);
if (!model) {
return [2 /*return*/, null];
}
wordDefRegExp = new RegExp(wordDef, wordDefFlags);
if (range.startColumn === range.endColumn) {
range = {
startLineNumber: range.startLineNumber,
startColumn: range.startColumn,
endLineNumber: range.endLineNumber,
endColumn: range.endColumn + 1
};
}
selectionText = model.getValueInRange(range);
wordRange = model.getWordAtPosition({ lineNumber: range.startLineNumber, column: range.startColumn }, wordDefRegExp);
if (!wordRange) {
return [2 /*return*/, null];
}
word = model.getValueInRange(wordRange);
result = BasicInplaceReplace.INSTANCE.navigateValueSet(range, selectionText, wordRange, word, up);
return [2 /*return*/, result];
});
});
};
// ---- BEGIN foreign module support --------------------------------------------------------------------------
EditorSimpleWorker.prototype.loadForeignModule = function (moduleId, createData, foreignHostMethods) {
var _this = this;
var proxyMethodRequest = function (method, args) {
return _this._host.fhr(method, args);
};
var foreignHost = types["b" /* createProxyObject */](foreignHostMethods, proxyMethodRequest);
var ctx = {
host: foreignHost,
getMirrorModels: function () {
return _this._getModels();
}
};
if (this._foreignModuleFactory) {
this._foreignModule = this._foreignModuleFactory(ctx, createData);
// static foreing module
return Promise.resolve(types["c" /* getAllMethodNames */](this._foreignModule));
}
// ESM-comment-begin
// return new Promise((resolve, reject) => {
// require([moduleId], (foreignModule: { create: IForeignModuleFactory }) => {
// this._foreignModule = foreignModule.create(ctx, createData);
//
// resolve(types.getAllMethodNames(this._foreignModule));
//
// }, reject);
// });
// ESM-comment-end
// ESM-uncomment-begin
return Promise.reject(new Error("Unexpected usage"));
// ESM-uncomment-end
};
// foreign method request
EditorSimpleWorker.prototype.fmr = function (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);
}
};
// ---- END diff --------------------------------------------------------------------------
// ---- BEGIN minimal edits ---------------------------------------------------------------
EditorSimpleWorker._diffLimit = 100000;
// ---- BEGIN suggest --------------------------------------------------------------------------
EditorSimpleWorker._suggestionsLimit = 10000;
return EditorSimpleWorker;
}());
/**
* Called on the worker side
* @internal
*/
function editorSimpleWorker_create(host) {
return new editorSimpleWorker_EditorSimpleWorker(host, null);
}
if (typeof importScripts === 'function') {
// Running in a web worker
platform["b" /* globals */].monaco = createMonacoBaseAPI();
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/modelService.js
var services_modelService = __webpack_require__(58);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/textResourceConfigurationService.js
var textResourceConfigurationService = __webpack_require__(142);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/log/common/log.js
var log = __webpack_require__(121);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/stopwatch.js
var stopwatch = __webpack_require__(180);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/editorWorkerServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var editorWorkerServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var editorWorkerServiceImpl_decorate = (undefined && undefined.__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;
};
var editorWorkerServiceImpl_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var editorWorkerServiceImpl_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var editorWorkerServiceImpl_generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
/**
* Stop syncing a model to the worker if it was not needed for 1 min.
*/
var STOP_SYNC_MODEL_DELTA_TIME_MS = 60 * 1000;
/**
* Stop the worker if it was not needed for 5 min.
*/
var STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;
function canSyncModel(modelService, resource) {
var model = modelService.getModel(resource);
if (!model) {
return false;
}
if (model.isTooLargeForSyncing()) {
return false;
}
return true;
}
var editorWorkerServiceImpl_EditorWorkerServiceImpl = /** @class */ (function (_super) {
editorWorkerServiceImpl_extends(EditorWorkerServiceImpl, _super);
function EditorWorkerServiceImpl(modelService, configurationService, logService) {
var _this = _super.call(this) || this;
_this._modelService = modelService;
_this._workerManager = _this._register(new editorWorkerServiceImpl_WorkerManager(_this._modelService));
_this._logService = logService;
// todo@joh make sure this happens only once
_this._register(modes["s" /* LinkProviderRegistry */].register('*', {
provideLinks: function (model, token) {
if (!canSyncModel(_this._modelService, model.uri)) {
return Promise.resolve({ links: [] }); // File too large
}
return _this._workerManager.withWorker().then(function (client) { return client.computeLinks(model.uri); }).then(function (links) {
return links && { links: links };
});
}
}));
_this._register(modes["d" /* CompletionProviderRegistry */].register('*', new editorWorkerServiceImpl_WordBasedCompletionItemProvider(_this._workerManager, configurationService, _this._modelService)));
return _this;
}
EditorWorkerServiceImpl.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
EditorWorkerServiceImpl.prototype.canComputeDiff = function (original, modified) {
return (canSyncModel(this._modelService, original) && canSyncModel(this._modelService, modified));
};
EditorWorkerServiceImpl.prototype.computeDiff = function (original, modified, ignoreTrimWhitespace, maxComputationTime) {
return this._workerManager.withWorker().then(function (client) { return client.computeDiff(original, modified, ignoreTrimWhitespace, maxComputationTime); });
};
EditorWorkerServiceImpl.prototype.computeMoreMinimalEdits = function (resource, edits) {
var _this = this;
if (Object(arrays["q" /* isNonEmptyArray */])(edits)) {
if (!canSyncModel(this._modelService, resource)) {
return Promise.resolve(edits); // File too large
}
var sw_1 = stopwatch["a" /* StopWatch */].create(true);
var result = this._workerManager.withWorker().then(function (client) { return client.computeMoreMinimalEdits(resource, edits); });
result.finally(function () { return _this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw_1.elapsed()); });
return result;
}
else {
return Promise.resolve(undefined);
}
};
EditorWorkerServiceImpl.prototype.canNavigateValueSet = function (resource) {
return (canSyncModel(this._modelService, resource));
};
EditorWorkerServiceImpl.prototype.navigateValueSet = function (resource, range, up) {
return this._workerManager.withWorker().then(function (client) { return client.navigateValueSet(resource, range, up); });
};
EditorWorkerServiceImpl.prototype.canComputeWordRanges = function (resource) {
return canSyncModel(this._modelService, resource);
};
EditorWorkerServiceImpl.prototype.computeWordRanges = function (resource, range) {
return this._workerManager.withWorker().then(function (client) { return client.computeWordRanges(resource, range); });
};
EditorWorkerServiceImpl = editorWorkerServiceImpl_decorate([
editorWorkerServiceImpl_param(0, services_modelService["a" /* IModelService */]),
editorWorkerServiceImpl_param(1, textResourceConfigurationService["a" /* ITextResourceConfigurationService */]),
editorWorkerServiceImpl_param(2, log["a" /* ILogService */])
], EditorWorkerServiceImpl);
return EditorWorkerServiceImpl;
}(lifecycle["a" /* Disposable */]));
var editorWorkerServiceImpl_WordBasedCompletionItemProvider = /** @class */ (function () {
function WordBasedCompletionItemProvider(workerManager, configurationService, modelService) {
this._debugDisplayName = 'wordbasedCompletions';
this._workerManager = workerManager;
this._configurationService = configurationService;
this._modelService = modelService;
}
WordBasedCompletionItemProvider.prototype.provideCompletionItems = function (model, position) {
return editorWorkerServiceImpl_awaiter(this, void 0, void 0, function () {
var wordBasedSuggestions, word, replace, insert, client, words;
return editorWorkerServiceImpl_generator(this, function (_a) {
switch (_a.label) {
case 0:
wordBasedSuggestions = this._configurationService.getValue(model.uri, position, 'editor').wordBasedSuggestions;
if (!wordBasedSuggestions) {
return [2 /*return*/, undefined];
}
if (!canSyncModel(this._modelService, model.uri)) {
return [2 /*return*/, undefined]; // File too large
}
word = model.getWordAtPosition(position);
replace = !word ? core_range["a" /* Range */].fromPositions(position) : new core_range["a" /* Range */](position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
insert = replace.setEndPosition(position.lineNumber, position.column);
return [4 /*yield*/, this._workerManager.withWorker()];
case 1:
client = _a.sent();
return [4 /*yield*/, client.textualSuggest(model.uri, position)];
case 2:
words = _a.sent();
if (!words) {
return [2 /*return*/, undefined];
}
return [2 /*return*/, {
suggestions: words.map(function (word) {
return {
kind: 18 /* Text */,
label: word,
insertText: word,
range: { insert: insert, replace: replace }
};
})
}];
}
});
});
};
return WordBasedCompletionItemProvider;
}());
var editorWorkerServiceImpl_WorkerManager = /** @class */ (function (_super) {
editorWorkerServiceImpl_extends(WorkerManager, _super);
function WorkerManager(modelService) {
var _this = _super.call(this) || this;
_this._modelService = modelService;
_this._editorWorkerClient = null;
_this._lastWorkerUsedTime = (new Date()).getTime();
var stopWorkerInterval = _this._register(new common_async["c" /* IntervalTimer */]());
stopWorkerInterval.cancelAndSet(function () { return _this._checkStopIdleWorker(); }, Math.round(STOP_WORKER_DELTA_TIME_MS / 2));
_this._register(_this._modelService.onModelRemoved(function (_) { return _this._checkStopEmptyWorker(); }));
return _this;
}
WorkerManager.prototype.dispose = function () {
if (this._editorWorkerClient) {
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
_super.prototype.dispose.call(this);
};
/**
* Check if the model service has no more models and stop the worker if that is the case.
*/
WorkerManager.prototype._checkStopEmptyWorker = function () {
if (!this._editorWorkerClient) {
return;
}
var models = this._modelService.getModels();
if (models.length === 0) {
// There are no more models => nothing possible for me to do
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
};
/**
* Check if the worker has been idle for a while and then stop it.
*/
WorkerManager.prototype._checkStopIdleWorker = function () {
if (!this._editorWorkerClient) {
return;
}
var timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;
if (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {
this._editorWorkerClient.dispose();
this._editorWorkerClient = null;
}
};
WorkerManager.prototype.withWorker = function () {
this._lastWorkerUsedTime = (new Date()).getTime();
if (!this._editorWorkerClient) {
this._editorWorkerClient = new editorWorkerServiceImpl_EditorWorkerClient(this._modelService, false, 'editorWorkerService');
}
return Promise.resolve(this._editorWorkerClient);
};
return WorkerManager;
}(lifecycle["a" /* Disposable */]));
var editorWorkerServiceImpl_EditorModelManager = /** @class */ (function (_super) {
editorWorkerServiceImpl_extends(EditorModelManager, _super);
function EditorModelManager(proxy, modelService, keepIdleModels) {
var _this = _super.call(this) || this;
_this._syncedModels = Object.create(null);
_this._syncedModelsLastUsedTime = Object.create(null);
_this._proxy = proxy;
_this._modelService = modelService;
if (!keepIdleModels) {
var timer = new common_async["c" /* IntervalTimer */]();
timer.cancelAndSet(function () { return _this._checkStopModelSync(); }, Math.round(STOP_SYNC_MODEL_DELTA_TIME_MS / 2));
_this._register(timer);
}
return _this;
}
EditorModelManager.prototype.dispose = function () {
for (var modelUrl in this._syncedModels) {
Object(lifecycle["f" /* dispose */])(this._syncedModels[modelUrl]);
}
this._syncedModels = Object.create(null);
this._syncedModelsLastUsedTime = Object.create(null);
_super.prototype.dispose.call(this);
};
EditorModelManager.prototype.ensureSyncedResources = function (resources) {
for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
var resource = resources_1[_i];
var resourceStr = resource.toString();
if (!this._syncedModels[resourceStr]) {
this._beginModelSync(resource);
}
if (this._syncedModels[resourceStr]) {
this._syncedModelsLastUsedTime[resourceStr] = (new Date()).getTime();
}
}
};
EditorModelManager.prototype._checkStopModelSync = function () {
var currentTime = (new Date()).getTime();
var toRemove = [];
for (var modelUrl in this._syncedModelsLastUsedTime) {
var elapsedTime = currentTime - this._syncedModelsLastUsedTime[modelUrl];
if (elapsedTime > STOP_SYNC_MODEL_DELTA_TIME_MS) {
toRemove.push(modelUrl);
}
}
for (var _i = 0, toRemove_1 = toRemove; _i < toRemove_1.length; _i++) {
var e = toRemove_1[_i];
this._stopModelSync(e);
}
};
EditorModelManager.prototype._beginModelSync = function (resource) {
var _this = this;
var model = this._modelService.getModel(resource);
if (!model) {
return;
}
if (model.isTooLargeForSyncing()) {
return;
}
var modelUrl = resource.toString();
this._proxy.acceptNewModel({
url: model.uri.toString(),
lines: model.getLinesContent(),
EOL: model.getEOL(),
versionId: model.getVersionId()
});
var toDispose = new lifecycle["b" /* DisposableStore */]();
toDispose.add(model.onDidChangeContent(function (e) {
_this._proxy.acceptModelChanged(modelUrl.toString(), e);
}));
toDispose.add(model.onWillDispose(function () {
_this._stopModelSync(modelUrl);
}));
toDispose.add(Object(lifecycle["h" /* toDisposable */])(function () {
_this._proxy.acceptRemovedModel(modelUrl);
}));
this._syncedModels[modelUrl] = toDispose;
};
EditorModelManager.prototype._stopModelSync = function (modelUrl) {
var toDispose = this._syncedModels[modelUrl];
delete this._syncedModels[modelUrl];
delete this._syncedModelsLastUsedTime[modelUrl];
Object(lifecycle["f" /* dispose */])(toDispose);
};
return EditorModelManager;
}(lifecycle["a" /* Disposable */]));
var SynchronousWorkerClient = /** @class */ (function () {
function SynchronousWorkerClient(instance) {
this._instance = instance;
this._proxyObj = Promise.resolve(this._instance);
}
SynchronousWorkerClient.prototype.dispose = function () {
this._instance.dispose();
};
SynchronousWorkerClient.prototype.getProxyObject = function () {
return this._proxyObj;
};
return SynchronousWorkerClient;
}());
var EditorWorkerHost = /** @class */ (function () {
function EditorWorkerHost(workerClient) {
this._workerClient = workerClient;
}
// foreign host request
EditorWorkerHost.prototype.fhr = function (method, args) {
return this._workerClient.fhr(method, args);
};
return EditorWorkerHost;
}());
var editorWorkerServiceImpl_EditorWorkerClient = /** @class */ (function (_super) {
editorWorkerServiceImpl_extends(EditorWorkerClient, _super);
function EditorWorkerClient(modelService, keepIdleModels, label) {
var _this = _super.call(this) || this;
_this._modelService = modelService;
_this._keepIdleModels = keepIdleModels;
_this._workerFactory = new defaultWorkerFactory_DefaultWorkerFactory(label);
_this._worker = null;
_this._modelManager = null;
return _this;
}
// foreign host request
EditorWorkerClient.prototype.fhr = function (method, args) {
throw new Error("Not implemented!");
};
EditorWorkerClient.prototype._getOrCreateWorker = function () {
if (!this._worker) {
try {
this._worker = this._register(new simpleWorker_SimpleWorkerClient(this._workerFactory, 'vs/editor/common/services/editorSimpleWorker', new EditorWorkerHost(this)));
}
catch (err) {
logOnceWebWorkerWarning(err);
this._worker = new SynchronousWorkerClient(new editorSimpleWorker_EditorSimpleWorker(new EditorWorkerHost(this), null));
}
}
return this._worker;
};
EditorWorkerClient.prototype._getProxy = function () {
var _this = this;
return this._getOrCreateWorker().getProxyObject().then(undefined, function (err) {
logOnceWebWorkerWarning(err);
_this._worker = new SynchronousWorkerClient(new editorSimpleWorker_EditorSimpleWorker(new EditorWorkerHost(_this), null));
return _this._getOrCreateWorker().getProxyObject();
});
};
EditorWorkerClient.prototype._getOrCreateModelManager = function (proxy) {
if (!this._modelManager) {
this._modelManager = this._register(new editorWorkerServiceImpl_EditorModelManager(proxy, this._modelService, this._keepIdleModels));
}
return this._modelManager;
};
EditorWorkerClient.prototype._withSyncedResources = function (resources) {
var _this = this;
return this._getProxy().then(function (proxy) {
_this._getOrCreateModelManager(proxy).ensureSyncedResources(resources);
return proxy;
});
};
EditorWorkerClient.prototype.computeDiff = function (original, modified, ignoreTrimWhitespace, maxComputationTime) {
return this._withSyncedResources([original, modified]).then(function (proxy) {
return proxy.computeDiff(original.toString(), modified.toString(), ignoreTrimWhitespace, maxComputationTime);
});
};
EditorWorkerClient.prototype.computeMoreMinimalEdits = function (resource, edits) {
return this._withSyncedResources([resource]).then(function (proxy) {
return proxy.computeMoreMinimalEdits(resource.toString(), edits);
});
};
EditorWorkerClient.prototype.computeLinks = function (resource) {
return this._withSyncedResources([resource]).then(function (proxy) {
return proxy.computeLinks(resource.toString());
});
};
EditorWorkerClient.prototype.textualSuggest = function (resource, position) {
var _this = this;
return this._withSyncedResources([resource]).then(function (proxy) {
var model = _this._modelService.getModel(resource);
if (!model) {
return null;
}
var wordDefRegExp = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getWordDefinition(model.getLanguageIdentifier().id);
var wordDef = wordDefRegExp.source;
var wordDefFlags = Object(strings["H" /* regExpFlags */])(wordDefRegExp);
return proxy.textualSuggest(resource.toString(), position, wordDef, wordDefFlags);
});
};
EditorWorkerClient.prototype.computeWordRanges = function (resource, range) {
var _this = this;
return this._withSyncedResources([resource]).then(function (proxy) {
var model = _this._modelService.getModel(resource);
if (!model) {
return Promise.resolve(null);
}
var wordDefRegExp = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getWordDefinition(model.getLanguageIdentifier().id);
var wordDef = wordDefRegExp.source;
var wordDefFlags = Object(strings["H" /* regExpFlags */])(wordDefRegExp);
return proxy.computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);
});
};
EditorWorkerClient.prototype.navigateValueSet = function (resource, range, up) {
var _this = this;
return this._withSyncedResources([resource]).then(function (proxy) {
var model = _this._modelService.getModel(resource);
if (!model) {
return null;
}
var wordDefRegExp = languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].getWordDefinition(model.getLanguageIdentifier().id);
var wordDef = wordDefRegExp.source;
var wordDefFlags = Object(strings["H" /* regExpFlags */])(wordDefRegExp);
return proxy.navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);
});
};
return EditorWorkerClient;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/webWorker.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var webWorker_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Create a new web worker that has model syncing capabilities built in.
* Specify an AMD module to load that will `create` an object that will be proxied.
*/
function createWebWorker(modelService, opts) {
return new webWorker_MonacoWebWorkerImpl(modelService, opts);
}
var webWorker_MonacoWebWorkerImpl = /** @class */ (function (_super) {
webWorker_extends(MonacoWebWorkerImpl, _super);
function MonacoWebWorkerImpl(modelService, opts) {
var _this = _super.call(this, modelService, opts.keepIdleModels || false, opts.label) || this;
_this._foreignModuleId = opts.moduleId;
_this._foreignModuleCreateData = opts.createData || null;
_this._foreignModuleHost = opts.host || null;
_this._foreignProxy = null;
return _this;
}
// foreign host request
MonacoWebWorkerImpl.prototype.fhr = function (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);
}
};
MonacoWebWorkerImpl.prototype._getForeignProxy = function () {
var _this = this;
if (!this._foreignProxy) {
this._foreignProxy = this._getProxy().then(function (proxy) {
var foreignHostMethods = _this._foreignModuleHost ? types["c" /* getAllMethodNames */](_this._foreignModuleHost) : [];
return proxy.loadForeignModule(_this._foreignModuleId, _this._foreignModuleCreateData, foreignHostMethods).then(function (foreignMethods) {
_this._foreignModuleCreateData = null;
var proxyMethodRequest = function (method, args) {
return proxy.fmr(method, args);
};
var createProxyMethod = function (method, proxyMethodRequest) {
return function () {
var args = Array.prototype.slice.call(arguments, 0);
return proxyMethodRequest(method, args);
};
};
var foreignProxy = {};
for (var _i = 0, foreignMethods_1 = foreignMethods; _i < foreignMethods_1.length; _i++) {
var foreignMethod = foreignMethods_1[_i];
foreignProxy[foreignMethod] = createProxyMethod(foreignMethod, proxyMethodRequest);
}
return foreignProxy;
});
});
}
return this._foreignProxy;
};
MonacoWebWorkerImpl.prototype.getProxy = function () {
return this._getForeignProxy();
};
MonacoWebWorkerImpl.prototype.withSyncedResources = function (resources) {
var _this = this;
return this._withSyncedResources(resources).then(function (_) { return _this.getProxy(); });
};
return MonacoWebWorkerImpl;
}(editorWorkerServiceImpl_EditorWorkerClient));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/lineTokens.js
var core_lineTokens = __webpack_require__(94);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js
var viewLineRenderer = __webpack_require__(74);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModel.js
var viewModel = __webpack_require__(62);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCommon.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function isFuzzyActionArr(what) {
return (Array.isArray(what));
}
function isFuzzyAction(what) {
return !isFuzzyActionArr(what);
}
function isString(what) {
return (typeof what === 'string');
}
function isIAction(what) {
return !isString(what);
}
// Small helper functions
/**
* Is a string null, undefined, or empty?
*/
function empty(s) {
return (s ? false : true);
}
/**
* Puts a string to lower case if 'ignoreCase' is set.
*/
function fixCase(lexer, str) {
return (lexer.ignoreCase && str ? str.toLowerCase() : str);
}
/**
* Ensures there are no bad characters in a CSS token class.
*/
function sanitize(s) {
return s.replace(/[&<>'"_]/g, '-'); // used on all output token CSS classes
}
// Logging
/**
* Logs a message.
*/
function monarchCommon_log(lexer, msg) {
console.log(lexer.languageId + ": " + msg);
}
// Throwing errors
function createError(lexer, msg) {
return new Error(lexer.languageId + ": " + msg);
}
// Helper functions for rule finding and substitution
/**
* substituteMatches is used on lexer strings and can substitutes predefined patterns:
* $$ => $
* $# => id
* $n => matched entry n
* @attr => contents of lexer[attr]
*
* See documentation for more info
*/
function substituteMatches(lexer, str, id, matches, state) {
var re = /\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;
var stateMatches = null;
return str.replace(re, function (full, sub, dollar, hash, n, s, attr, ofs, total) {
if (!empty(dollar)) {
return '$'; // $$
}
if (!empty(hash)) {
return fixCase(lexer, id); // default $#
}
if (!empty(n) && n < matches.length) {
return fixCase(lexer, matches[n]); // $n
}
if (!empty(attr) && lexer && typeof (lexer[attr]) === 'string') {
return lexer[attr]; //@attribute
}
if (stateMatches === null) { // split state on demand
stateMatches = state.split('.');
stateMatches.unshift(state);
}
if (!empty(s) && s < stateMatches.length) {
return fixCase(lexer, stateMatches[s]); //$Sn
}
return '';
});
}
/**
* Find the tokenizer rules for a specific state (i.e. next action)
*/
function findRules(lexer, inState) {
var state = inState;
while (state && state.length > 0) {
var rules = lexer.tokenizer[state];
if (rules) {
return rules;
}
var idx = state.lastIndexOf('.');
if (idx < 0) {
state = null; // no further parent
}
else {
state = state.substr(0, idx);
}
}
return null;
}
/**
* Is a certain state defined? In contrast to 'findRules' this works on a ILexerMin.
* This is used during compilation where we may know the defined states
* but not yet whether the corresponding rules are correct.
*/
function stateExists(lexer, inState) {
var state = inState;
while (state && state.length > 0) {
var exist = lexer.stateNames[state];
if (exist) {
return true;
}
var idx = state.lastIndexOf('.');
if (idx < 0) {
state = null; // no further parent
}
else {
state = state.substr(0, idx);
}
}
return false;
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchLexer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var CACHE_STACK_DEPTH = 5;
/**
* Reuse the same stack elements up to a certain depth.
*/
var MonarchStackElementFactory = /** @class */ (function () {
function MonarchStackElementFactory(maxCacheDepth) {
this._maxCacheDepth = maxCacheDepth;
this._entries = Object.create(null);
}
MonarchStackElementFactory.create = function (parent, state) {
return this._INSTANCE.create(parent, state);
};
MonarchStackElementFactory.prototype.create = function (parent, state) {
if (parent !== null && parent.depth >= this._maxCacheDepth) {
// no caching above a certain depth
return new MonarchStackElement(parent, state);
}
var stackElementId = MonarchStackElement.getStackElementId(parent);
if (stackElementId.length > 0) {
stackElementId += '|';
}
stackElementId += state;
var 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);
return MonarchStackElementFactory;
}());
var MonarchStackElement = /** @class */ (function () {
function MonarchStackElement(parent, state) {
this.parent = parent;
this.state = state;
this.depth = (this.parent ? this.parent.depth : 0) + 1;
}
MonarchStackElement.getStackElementId = function (element) {
var result = '';
while (element !== null) {
if (result.length > 0) {
result += '|';
}
result += element.state;
element = element.parent;
}
return result;
};
MonarchStackElement._equals = function (a, b) {
while (a !== null && b !== null) {
if (a === b) {
return true;
}
if (a.state !== b.state) {
return false;
}
a = a.parent;
b = b.parent;
}
if (a === null && b === null) {
return true;
}
return false;
};
MonarchStackElement.prototype.equals = function (other) {
return MonarchStackElement._equals(this, other);
};
MonarchStackElement.prototype.push = function (state) {
return MonarchStackElementFactory.create(this, state);
};
MonarchStackElement.prototype.pop = function () {
return this.parent;
};
MonarchStackElement.prototype.popall = function () {
var result = this;
while (result.parent) {
result = result.parent;
}
return result;
};
MonarchStackElement.prototype.switchTo = function (state) {
return MonarchStackElementFactory.create(this.parent, state);
};
return MonarchStackElement;
}());
var EmbeddedModeData = /** @class */ (function () {
function EmbeddedModeData(modeId, state) {
this.modeId = modeId;
this.state = state;
}
EmbeddedModeData.prototype.equals = function (other) {
return (this.modeId === other.modeId
&& this.state.equals(other.state));
};
EmbeddedModeData.prototype.clone = function () {
var stateClone = this.state.clone();
// save an object
if (stateClone === this.state) {
return this;
}
return new EmbeddedModeData(this.modeId, this.state);
};
return EmbeddedModeData;
}());
/**
* Reuse the same line states up to a certain depth.
*/
var MonarchLineStateFactory = /** @class */ (function () {
function MonarchLineStateFactory(maxCacheDepth) {
this._maxCacheDepth = maxCacheDepth;
this._entries = Object.create(null);
}
MonarchLineStateFactory.create = function (stack, embeddedModeData) {
return this._INSTANCE.create(stack, embeddedModeData);
};
MonarchLineStateFactory.prototype.create = function (stack, embeddedModeData) {
if (embeddedModeData !== null) {
// no caching when embedding
return new MonarchLineState(stack, embeddedModeData);
}
if (stack !== null && stack.depth >= this._maxCacheDepth) {
// no caching above a certain depth
return new MonarchLineState(stack, embeddedModeData);
}
var stackElementId = MonarchStackElement.getStackElementId(stack);
var 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);
return MonarchLineStateFactory;
}());
var MonarchLineState = /** @class */ (function () {
function MonarchLineState(stack, embeddedModeData) {
this.stack = stack;
this.embeddedModeData = embeddedModeData;
}
MonarchLineState.prototype.clone = function () {
var embeddedModeDataClone = this.embeddedModeData ? this.embeddedModeData.clone() : null;
// save an object
if (embeddedModeDataClone === this.embeddedModeData) {
return this;
}
return MonarchLineStateFactory.create(this.stack, this.embeddedModeData);
};
MonarchLineState.prototype.equals = function (other) {
if (!(other instanceof MonarchLineState)) {
return false;
}
if (!this.stack.equals(other.stack)) {
return false;
}
if (this.embeddedModeData === null && other.embeddedModeData === null) {
return true;
}
if (this.embeddedModeData === null || other.embeddedModeData === null) {
return false;
}
return this.embeddedModeData.equals(other.embeddedModeData);
};
return MonarchLineState;
}());
var monarchLexer_MonarchClassicTokensCollector = /** @class */ (function () {
function MonarchClassicTokensCollector() {
this._tokens = [];
this._language = null;
this._lastTokenType = null;
this._lastTokenLanguage = null;
}
MonarchClassicTokensCollector.prototype.enterMode = function (startOffset, modeId) {
this._language = modeId;
};
MonarchClassicTokensCollector.prototype.emit = function (startOffset, type) {
if (this._lastTokenType === type && this._lastTokenLanguage === this._language) {
return;
}
this._lastTokenType = type;
this._lastTokenLanguage = this._language;
this._tokens.push(new core_token["a" /* Token */](startOffset, type, this._language));
};
MonarchClassicTokensCollector.prototype.nestedModeTokenize = function (embeddedModeLine, embeddedModeData, offsetDelta) {
var nestedModeId = embeddedModeData.modeId;
var embeddedModeState = embeddedModeData.state;
var nestedModeTokenizationSupport = modes["B" /* TokenizationRegistry */].get(nestedModeId);
if (!nestedModeTokenizationSupport) {
this.enterMode(offsetDelta, nestedModeId);
this.emit(offsetDelta, '');
return embeddedModeState;
}
var nestedResult = nestedModeTokenizationSupport.tokenize(embeddedModeLine, embeddedModeState, offsetDelta);
this._tokens = this._tokens.concat(nestedResult.tokens);
this._lastTokenType = null;
this._lastTokenLanguage = null;
this._language = null;
return nestedResult.endState;
};
MonarchClassicTokensCollector.prototype.finalize = function (endState) {
return new core_token["b" /* TokenizationResult */](this._tokens, endState);
};
return MonarchClassicTokensCollector;
}());
var monarchLexer_MonarchModernTokensCollector = /** @class */ (function () {
function MonarchModernTokensCollector(modeService, theme) {
this._modeService = modeService;
this._theme = theme;
this._prependTokens = null;
this._tokens = [];
this._currentLanguageId = 0 /* Null */;
this._lastTokenMetadata = 0;
}
MonarchModernTokensCollector.prototype.enterMode = function (startOffset, modeId) {
this._currentLanguageId = this._modeService.getLanguageIdentifier(modeId).id;
};
MonarchModernTokensCollector.prototype.emit = function (startOffset, type) {
var metadata = this._theme.match(this._currentLanguageId, type);
if (this._lastTokenMetadata === metadata) {
return;
}
this._lastTokenMetadata = metadata;
this._tokens.push(startOffset);
this._tokens.push(metadata);
};
MonarchModernTokensCollector._merge = function (a, b, c) {
var aLen = (a !== null ? a.length : 0);
var bLen = b.length;
var 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 a;
}
var result = new Uint32Array(aLen + bLen + cLen);
if (a !== null) {
result.set(a);
}
for (var i = 0; i < bLen; i++) {
result[aLen + i] = b[i];
}
if (c !== null) {
result.set(c, aLen + bLen);
}
return result;
};
MonarchModernTokensCollector.prototype.nestedModeTokenize = function (embeddedModeLine, embeddedModeData, offsetDelta) {
var nestedModeId = embeddedModeData.modeId;
var embeddedModeState = embeddedModeData.state;
var nestedModeTokenizationSupport = modes["B" /* TokenizationRegistry */].get(nestedModeId);
if (!nestedModeTokenizationSupport) {
this.enterMode(offsetDelta, nestedModeId);
this.emit(offsetDelta, '');
return embeddedModeState;
}
var nestedResult = nestedModeTokenizationSupport.tokenize2(embeddedModeLine, embeddedModeState, offsetDelta);
this._prependTokens = MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, nestedResult.tokens);
this._tokens = [];
this._currentLanguageId = 0;
this._lastTokenMetadata = 0;
return nestedResult.endState;
};
MonarchModernTokensCollector.prototype.finalize = function (endState) {
return new core_token["c" /* TokenizationResult2 */](MonarchModernTokensCollector._merge(this._prependTokens, this._tokens, null), endState);
};
return MonarchModernTokensCollector;
}());
var monarchLexer_MonarchTokenizer = /** @class */ (function () {
function MonarchTokenizer(modeService, standaloneThemeService, modeId, lexer) {
var _this = this;
this._modeService = modeService;
this._standaloneThemeService = standaloneThemeService;
this._modeId = modeId;
this._lexer = lexer;
this._embeddedModes = Object.create(null);
this.embeddedLoaded = Promise.resolve(undefined);
// Set up listening for embedded modes
var emitting = false;
this._tokenizationRegistryListener = modes["B" /* TokenizationRegistry */].onDidChange(function (e) {
if (emitting) {
return;
}
var isOneOfMyEmbeddedModes = false;
for (var i = 0, len = e.changedLanguages.length; i < len; i++) {
var language = e.changedLanguages[i];
if (_this._embeddedModes[language]) {
isOneOfMyEmbeddedModes = true;
break;
}
}
if (isOneOfMyEmbeddedModes) {
emitting = true;
modes["B" /* TokenizationRegistry */].fire([_this._modeId]);
emitting = false;
}
});
}
MonarchTokenizer.prototype.dispose = function () {
this._tokenizationRegistryListener.dispose();
};
MonarchTokenizer.prototype.getLoadStatus = function () {
var promises = [];
for (var nestedModeId in this._embeddedModes) {
var tokenizationSupport = modes["B" /* TokenizationRegistry */].get(nestedModeId);
if (tokenizationSupport) {
// The nested mode is already loaded
if (tokenizationSupport instanceof MonarchTokenizer) {
var nestedModeStatus = tokenizationSupport.getLoadStatus();
if (nestedModeStatus.loaded === false) {
promises.push(nestedModeStatus.promise);
}
}
continue;
}
var tokenizationSupportPromise = modes["B" /* TokenizationRegistry */].getPromise(nestedModeId);
if (tokenizationSupportPromise) {
// The nested mode is in the process of being loaded
promises.push(tokenizationSupportPromise);
}
}
if (promises.length === 0) {
return {
loaded: true
};
}
return {
loaded: false,
promise: Promise.all(promises).then(function (_) { return undefined; })
};
};
MonarchTokenizer.prototype.getInitialState = function () {
var rootState = MonarchStackElementFactory.create(null, this._lexer.start);
return MonarchLineStateFactory.create(rootState, null);
};
MonarchTokenizer.prototype.tokenize = function (line, lineState, offsetDelta) {
var tokensCollector = new monarchLexer_MonarchClassicTokensCollector();
var endLineState = this._tokenize(line, lineState, offsetDelta, tokensCollector);
return tokensCollector.finalize(endLineState);
};
MonarchTokenizer.prototype.tokenize2 = function (line, lineState, offsetDelta) {
var tokensCollector = new monarchLexer_MonarchModernTokensCollector(this._modeService, this._standaloneThemeService.getTheme().tokenTheme);
var endLineState = this._tokenize(line, lineState, offsetDelta, tokensCollector);
return tokensCollector.finalize(endLineState);
};
MonarchTokenizer.prototype._tokenize = function (line, lineState, offsetDelta, collector) {
if (lineState.embeddedModeData) {
return this._nestedTokenize(line, lineState, offsetDelta, collector);
}
else {
return this._myTokenize(line, lineState, offsetDelta, collector);
}
};
MonarchTokenizer.prototype._findLeavingNestedModeOffset = function (line, state) {
var rules = this._lexer.tokenizer[state.stack.state];
if (!rules) {
rules = findRules(this._lexer, state.stack.state); // do parent matching
if (!rules) {
throw createError(this._lexer, 'tokenizer state is not defined: ' + state.stack.state);
}
}
var popOffset = -1;
var hasEmbeddedPopRule = false;
for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
var rule = rules_1[_i];
if (!isIAction(rule.action) || rule.action.nextEmbedded !== '@pop') {
continue;
}
hasEmbeddedPopRule = true;
var regex = rule.regex;
var regexSource = rule.regex.source;
if (regexSource.substr(0, 4) === '^(?:' && regexSource.substr(regexSource.length - 1, 1) === ')') {
regex = new RegExp(regexSource.substr(4, regexSource.length - 5), regex.ignoreCase ? 'i' : '');
}
var 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;
};
MonarchTokenizer.prototype._nestedTokenize = function (line, lineState, offsetDelta, tokensCollector) {
var popOffset = this._findLeavingNestedModeOffset(line, lineState);
if (popOffset === -1) {
// tokenization will not leave nested mode
var nestedEndState = tokensCollector.nestedModeTokenize(line, lineState.embeddedModeData, offsetDelta);
return MonarchLineStateFactory.create(lineState.stack, new EmbeddedModeData(lineState.embeddedModeData.modeId, nestedEndState));
}
var nestedModeLine = line.substring(0, popOffset);
if (nestedModeLine.length > 0) {
// tokenize with the nested mode
tokensCollector.nestedModeTokenize(nestedModeLine, lineState.embeddedModeData, offsetDelta);
}
var restOfTheLine = line.substring(popOffset);
return this._myTokenize(restOfTheLine, lineState, offsetDelta + popOffset, tokensCollector);
};
MonarchTokenizer.prototype._safeRuleName = function (rule) {
if (rule) {
return rule.name;
}
return '(unknown)';
};
MonarchTokenizer.prototype._myTokenize = function (line, lineState, offsetDelta, tokensCollector) {
tokensCollector.enterMode(offsetDelta, this._modeId);
var lineLength = line.length;
var embeddedModeData = lineState.embeddedModeData;
var stack = lineState.stack;
var pos = 0;
var groupMatching = null;
// See https://github.com/Microsoft/monaco-editor/issues/1235:
// Evaluate rules at least once for an empty line
var forceEvaluation = true;
while (forceEvaluation || pos < lineLength) {
var pos0 = pos;
var stackLen0 = stack.depth;
var groupLen0 = groupMatching ? groupMatching.groups.length : 0;
var state = stack.state;
var matches = null;
var matched = null;
var action = null;
var rule = null;
var enteringEmbeddedMode = null;
// check if we need to process group matches first
if (groupMatching) {
matches = groupMatching.matches;
var groupEntry = groupMatching.groups.shift();
matched = groupEntry.matched;
action = groupEntry.action;
rule = groupMatching.rule;
// cleanup if necessary
if (groupMatching.groups.length === 0) {
groupMatching = null;
}
}
else {
// otherwise we match on the token stream
if (!forceEvaluation && pos >= lineLength) {
// nothing to do
break;
}
forceEvaluation = false;
// get the rules for this state
var rules = this._lexer.tokenizer[state];
if (!rules) {
rules = findRules(this._lexer, state); // do parent matching
if (!rules) {
throw createError(this._lexer, 'tokenizer state is not defined: ' + state);
}
}
// try each rule until we match
var restOfLine = line.substr(pos);
for (var _i = 0, rules_2 = rules; _i < rules_2.length; _i++) {
var rule_1 = rules_2[_i];
if (pos === 0 || !rule_1.matchOnlyAtLineStart) {
matches = restOfLine.match(rule_1.regex);
if (matches) {
matched = matches[0];
action = rule_1.action;
break;
}
}
}
}
// We matched 'rule' with 'matches' and 'action'
if (!matches) {
matches = [''];
matched = '';
}
if (!action) {
// bad: we didn't match anything, and there is no action to take
// we need to advance the stream or we get progress trouble
if (pos < lineLength) {
matches = [line.charAt(pos)];
matched = matches[0];
}
action = this._lexer.defaultToken;
}
if (matched === null) {
// should never happen, needed for strict null checking
break;
}
// advance stream
pos += matched.length;
// maybe call action function (used for 'cases')
while (isFuzzyAction(action) && isIAction(action) && action.test) {
action = action.test(matched, matches, state, pos === lineLength);
}
var result = null;
// set the result: either a string or an array of actions
if (typeof action === 'string' || Array.isArray(action)) {
result = action;
}
else if (action.group) {
result = action.group;
}
else if (action.token !== null && action.token !== undefined) {
// do $n replacements?
if (action.tokenSubst) {
result = substituteMatches(this._lexer, action.token, matched, matches, state);
}
else {
result = action.token;
}
// enter embedded mode?
if (action.nextEmbedded) {
if (action.nextEmbedded === '@pop') {
if (!embeddedModeData) {
throw createError(this._lexer, 'cannot pop embedded mode if not inside one');
}
embeddedModeData = null;
}
else if (embeddedModeData) {
throw createError(this._lexer, 'cannot enter embedded mode from within an embedded mode');
}
else {
enteringEmbeddedMode = substituteMatches(this._lexer, action.nextEmbedded, matched, matches, state);
}
}
// state transformations
if (action.goBack) { // back up the stream..
pos = Math.max(0, pos - action.goBack);
}
if (action.switchTo && typeof action.switchTo === 'string') {
var nextState = substituteMatches(this._lexer, action.switchTo, matched, matches, state); // switch state without a push...
if (nextState[0] === '@') {
nextState = nextState.substr(1); // peel off starting '@'
}
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 {
var nextState = substituteMatches(this._lexer, action.next, matched, matches, state);
if (nextState[0] === '@') {
nextState = nextState.substr(1); // peel off starting '@'
}
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') {
monarchCommon_log(this._lexer, this._lexer.languageId + ': ' + substituteMatches(this._lexer, action.log, matched, matches, state));
}
}
// check result
if (result === null) {
throw createError(this._lexer, 'lexer rule has no well-defined action in rule: ' + this._safeRuleName(rule));
}
// is the result a group match?
if (Array.isArray(result)) {
if (groupMatching && groupMatching.groups.length > 0) {
throw createError(this._lexer, 'groups cannot be nested: ' + this._safeRuleName(rule));
}
if (matches.length !== result.length + 1) {
throw createError(this._lexer, 'matched number of groups does not match the number of actions in rule: ' + this._safeRuleName(rule));
}
var totalLen = 0;
for (var i = 1; i < matches.length; i++) {
totalLen += matches[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: rule,
matches: matches,
groups: []
};
for (var i = 0; i < result.length; i++) {
groupMatching.groups[i] = {
action: result[i],
matched: matches[i + 1]
};
}
pos -= matched.length;
// call recursively to initiate first result match
continue;
}
else {
// regular result
// check for '@rematch'
if (result === '@rematch') {
pos -= matched.length;
matched = ''; // better set the next state too..
matches = null;
result = '';
}
// check progress
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));
}
}
// return the result (and check for brace matching)
// todo: for efficiency we could pre-sanitize tokenPostfix and substitutions
var tokenType = null;
if (isString(result) && result.indexOf('@brackets') === 0) {
var rest = result.substr('@brackets'.length);
var bracket = findBracket(this._lexer, matched);
if (!bracket) {
throw createError(this._lexer, '@brackets token returned but no bracket defined as: ' + matched);
}
tokenType = sanitize(bracket.token + rest);
}
else {
var token = (result === '' ? '' : result + this._lexer.tokenPostfix);
tokenType = sanitize(token);
}
tokensCollector.emit(pos0 + offsetDelta, tokenType);
}
if (enteringEmbeddedMode !== null) {
// substitute language alias to known modes to support syntax highlighting
var enteringEmbeddedModeId = this._modeService.getModeIdForLanguageName(enteringEmbeddedMode);
if (enteringEmbeddedModeId) {
enteringEmbeddedMode = enteringEmbeddedModeId;
}
var embeddedModeData_1 = this._getNestedEmbeddedModeData(enteringEmbeddedMode);
if (pos < lineLength) {
// there is content from the embedded mode on this line
var restOfLine = line.substr(pos);
return this._nestedTokenize(restOfLine, MonarchLineStateFactory.create(stack, embeddedModeData_1), offsetDelta + pos, tokensCollector);
}
else {
return MonarchLineStateFactory.create(stack, embeddedModeData_1);
}
}
}
return MonarchLineStateFactory.create(stack, embeddedModeData);
};
MonarchTokenizer.prototype._getNestedEmbeddedModeData = function (mimetypeOrModeId) {
var nestedModeId = this._locateMode(mimetypeOrModeId);
if (nestedModeId) {
var tokenizationSupport = modes["B" /* TokenizationRegistry */].get(nestedModeId);
if (tokenizationSupport) {
return new EmbeddedModeData(nestedModeId, tokenizationSupport.getInitialState());
}
}
return new EmbeddedModeData(nestedModeId || nullMode["b" /* NULL_MODE_ID */], nullMode["c" /* NULL_STATE */]);
};
MonarchTokenizer.prototype._locateMode = function (mimetypeOrModeId) {
if (!mimetypeOrModeId || !this._modeService.isRegisteredMode(mimetypeOrModeId)) {
return null;
}
if (mimetypeOrModeId === this._modeId) {
// embedding myself...
return mimetypeOrModeId;
}
var modeId = this._modeService.getModeId(mimetypeOrModeId);
if (modeId) {
// Fire mode loading event
this._modeService.triggerMode(modeId);
this._embeddedModes[modeId] = true;
}
return modeId;
};
return MonarchTokenizer;
}());
/**
* Searches for a bracket in the 'brackets' attribute that matches the input.
*/
function findBracket(lexer, matched) {
if (!matched) {
return null;
}
matched = fixCase(lexer, matched);
var brackets = lexer.brackets;
for (var _i = 0, brackets_1 = brackets; _i < brackets_1.length; _i++) {
var bracket = brackets_1[_i];
if (bracket.open === matched) {
return { token: bracket.token, bracketType: 1 /* Open */ };
}
else if (bracket.close === matched) {
return { token: bracket.token, bracketType: -1 /* Close */ };
}
}
return null;
}
function createTokenizationSupport(modeService, standaloneThemeService, modeId, lexer) {
return new monarchLexer_MonarchTokenizer(modeService, standaloneThemeService, modeId, lexer);
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/colorizer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var colorizer_Colorizer = /** @class */ (function () {
function Colorizer() {
}
Colorizer.colorizeElement = function (themeService, modeService, domNode, options) {
options = options || {};
var theme = options.theme || 'vs';
var mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');
if (!mimeType) {
console.error('Mode not detected');
return Promise.resolve();
}
themeService.setTheme(theme);
var text = domNode.firstChild ? domNode.firstChild.nodeValue : '';
domNode.className += ' ' + theme;
var render = function (str) {
domNode.innerHTML = str;
};
return this.colorize(modeService, text || '', mimeType, options).then(render, function (err) { return console.error(err); });
};
Colorizer.colorize = function (modeService, text, mimeType, options) {
var tabSize = 4;
if (options && typeof options.tabSize === 'number') {
tabSize = options.tabSize;
}
if (strings["P" /* startsWithUTF8BOM */](text)) {
text = text.substr(1);
}
var lines = text.split(/\r\n|\r|\n/);
var language = modeService.getModeId(mimeType);
if (!language) {
return Promise.resolve(_fakeColorize(lines, tabSize));
}
// Send out the event to create the mode
modeService.triggerMode(language);
var tokenizationSupport = modes["B" /* TokenizationRegistry */].get(language);
if (tokenizationSupport) {
return _colorize(lines, tabSize, tokenizationSupport);
}
var tokenizationSupportPromise = modes["B" /* TokenizationRegistry */].getPromise(language);
if (tokenizationSupportPromise) {
// A tokenizer will be registered soon
return new Promise(function (resolve, reject) {
tokenizationSupportPromise.then(function (tokenizationSupport) {
_colorize(lines, tabSize, tokenizationSupport).then(resolve, reject);
}, reject);
});
}
return new Promise(function (resolve, reject) {
var listener = null;
var timeout = null;
var execute = function () {
if (listener) {
listener.dispose();
listener = null;
}
if (timeout) {
timeout.dispose();
timeout = null;
}
var tokenizationSupport = modes["B" /* TokenizationRegistry */].get(language);
if (tokenizationSupport) {
_colorize(lines, tabSize, tokenizationSupport).then(resolve, reject);
return;
}
resolve(_fakeColorize(lines, tabSize));
};
// wait 500ms for mode to load, then give up
timeout = new common_async["e" /* TimeoutTimer */]();
timeout.cancelAndSet(execute, 500);
listener = modes["B" /* TokenizationRegistry */].onDidChange(function (e) {
if (e.changedLanguages.indexOf(language) >= 0) {
execute();
}
});
});
};
Colorizer.colorizeLine = function (line, mightContainNonBasicASCII, mightContainRTL, tokens, tabSize) {
if (tabSize === void 0) { tabSize = 4; }
var isBasicASCII = viewModel["d" /* ViewLineRenderingData */].isBasicASCII(line, mightContainNonBasicASCII);
var containsRTL = viewModel["d" /* ViewLineRenderingData */].containsRTL(line, isBasicASCII, mightContainRTL);
var renderResult = Object(viewLineRenderer["e" /* renderViewLine2 */])(new viewLineRenderer["c" /* RenderLineInput */](false, true, line, false, isBasicASCII, containsRTL, 0, tokens, [], tabSize, 0, 0, 0, -1, 'none', false, false, null));
return renderResult.html;
};
Colorizer.colorizeModelLine = function (model, lineNumber, tabSize) {
if (tabSize === void 0) { tabSize = 4; }
var content = model.getLineContent(lineNumber);
model.forceTokenization(lineNumber);
var tokens = model.getLineTokens(lineNumber);
var inflatedTokens = tokens.inflate();
return this.colorizeLine(content, model.mightContainNonBasicASCII(), model.mightContainRTL(), inflatedTokens, tabSize);
};
return Colorizer;
}());
function _colorize(lines, tabSize, tokenizationSupport) {
return new Promise(function (c, e) {
var execute = function () {
var result = _actualColorize(lines, tabSize, tokenizationSupport);
if (tokenizationSupport instanceof monarchLexer_MonarchTokenizer) {
var status_1 = tokenizationSupport.getLoadStatus();
if (status_1.loaded === false) {
status_1.promise.then(execute, e);
return;
}
}
c(result);
};
execute();
});
}
function _fakeColorize(lines, tabSize) {
var html = [];
var defaultMetadata = ((0 /* None */ << 11 /* FONT_STYLE_OFFSET */)
| (1 /* DefaultForeground */ << 14 /* FOREGROUND_OFFSET */)
| (2 /* DefaultBackground */ << 23 /* BACKGROUND_OFFSET */)) >>> 0;
var tokens = new Uint32Array(2);
tokens[0] = 0;
tokens[1] = defaultMetadata;
for (var i = 0, length_1 = lines.length; i < length_1; i++) {
var line = lines[i];
tokens[0] = line.length;
var lineTokens = new core_lineTokens["a" /* LineTokens */](tokens, line);
var isBasicASCII = viewModel["d" /* ViewLineRenderingData */].isBasicASCII(line, /* check for basic ASCII */ true);
var containsRTL = viewModel["d" /* ViewLineRenderingData */].containsRTL(line, isBasicASCII, /* check for RTL */ true);
var renderResult = Object(viewLineRenderer["e" /* renderViewLine2 */])(new viewLineRenderer["c" /* RenderLineInput */](false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens, [], tabSize, 0, 0, 0, -1, 'none', false, false, null));
html = html.concat(renderResult.html);
html.push(' ');
}
return html.join('');
}
function _actualColorize(lines, tabSize, tokenizationSupport) {
var html = [];
var state = tokenizationSupport.getInitialState();
for (var i = 0, length_2 = lines.length; i < length_2; i++) {
var line = lines[i];
var tokenizeResult = tokenizationSupport.tokenize2(line, state, 0);
core_lineTokens["a" /* LineTokens */].convertToEndOffset(tokenizeResult.tokens, line.length);
var lineTokens = new core_lineTokens["a" /* LineTokens */](tokenizeResult.tokens, line);
var isBasicASCII = viewModel["d" /* ViewLineRenderingData */].isBasicASCII(line, /* check for basic ASCII */ true);
var containsRTL = viewModel["d" /* ViewLineRenderingData */].containsRTL(line, isBasicASCII, /* check for RTL */ true);
var renderResult = Object(viewLineRenderer["e" /* renderViewLine2 */])(new viewLineRenderer["c" /* RenderLineInput */](false, true, line, false, isBasicASCII, containsRTL, 0, lineTokens.inflate(), [], tabSize, 0, 0, 0, -1, 'none', false, false, null));
html = html.concat(renderResult.html);
html.push(' ');
state = tokenizeResult.endState;
}
return html.join('');
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js
var browser_keyboardEvent = __webpack_require__(53);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/severity.js
var common_severity = __webpack_require__(77);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/editorBrowser.js
var editorBrowser = __webpack_require__(111);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/commonEditorConfig.js
var commonEditorConfig = __webpack_require__(154);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/editOperation.js
var editOperation = __webpack_require__(59);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js
var common_configuration = __webpack_require__(43);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/map.js
var common_map = __webpack_require__(55);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/objects.js
var objects = __webpack_require__(35);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js
var configurationRegistry = __webpack_require__(114);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationModels.js
var configurationModels_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var configurationModels_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var configurationModels_ConfigurationModel = /** @class */ (function () {
function ConfigurationModel(_contents, _keys, _overrides) {
if (_contents === void 0) { _contents = {}; }
if (_keys === void 0) { _keys = []; }
if (_overrides === void 0) { _overrides = []; }
this._contents = _contents;
this._keys = _keys;
this._overrides = _overrides;
this.isFrozen = false;
}
Object.defineProperty(ConfigurationModel.prototype, "contents", {
get: function () {
return this.checkAndFreeze(this._contents);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ConfigurationModel.prototype, "overrides", {
get: function () {
return this.checkAndFreeze(this._overrides);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ConfigurationModel.prototype, "keys", {
get: function () {
return this.checkAndFreeze(this._keys);
},
enumerable: true,
configurable: true
});
ConfigurationModel.prototype.isEmpty = function () {
return this._keys.length === 0 && Object.keys(this._contents).length === 0 && this._overrides.length === 0;
};
ConfigurationModel.prototype.getValue = function (section) {
return section ? Object(common_configuration["d" /* getConfigurationValue */])(this.contents, section) : this.contents;
};
ConfigurationModel.prototype.getOverrideValue = function (section, overrideIdentifier) {
var overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
return overrideContents
? section ? Object(common_configuration["d" /* getConfigurationValue */])(overrideContents, section) : overrideContents
: undefined;
};
ConfigurationModel.prototype.override = function (identifier) {
var overrideContents = this.getContentsForOverrideIdentifer(identifier);
if (!overrideContents || typeof overrideContents !== 'object' || !Object.keys(overrideContents).length) {
// If there are no valid overrides, return self
return this;
}
var contents = {};
for (var _i = 0, _a = arrays["e" /* distinct */](configurationModels_spreadArrays(Object.keys(this.contents), Object.keys(overrideContents))); _i < _a.length; _i++) {
var key = _a[_i];
var contentsForKey = this.contents[key];
var overrideContentsForKey = overrideContents[key];
// If there are override contents for the key, clone and merge otherwise use base contents
if (overrideContentsForKey) {
// Clone and merge only if base contents and override contents are of type object otherwise just override
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
contentsForKey = objects["c" /* deepClone */](contentsForKey);
this.mergeContents(contentsForKey, overrideContentsForKey);
}
else {
contentsForKey = overrideContentsForKey;
}
}
contents[key] = contentsForKey;
}
return new ConfigurationModel(contents, this.keys, this.overrides);
};
ConfigurationModel.prototype.merge = function () {
var others = [];
for (var _i = 0; _i < arguments.length; _i++) {
others[_i] = arguments[_i];
}
var contents = objects["c" /* deepClone */](this.contents);
var overrides = objects["c" /* deepClone */](this.overrides);
var keys = configurationModels_spreadArrays(this.keys);
for (var _a = 0, others_1 = others; _a < others_1.length; _a++) {
var other = others_1[_a];
this.mergeContents(contents, other.contents);
var _loop_1 = function (otherOverride) {
var override = overrides.filter(function (o) { return arrays["g" /* equals */](o.identifiers, otherOverride.identifiers); })[0];
if (override) {
this_1.mergeContents(override.contents, otherOverride.contents);
}
else {
overrides.push(objects["c" /* deepClone */](otherOverride));
}
};
var this_1 = this;
for (var _b = 0, _c = other.overrides; _b < _c.length; _b++) {
var otherOverride = _c[_b];
_loop_1(otherOverride);
}
for (var _d = 0, _e = other.keys; _d < _e.length; _d++) {
var key = _e[_d];
if (keys.indexOf(key) === -1) {
keys.push(key);
}
}
}
return new ConfigurationModel(contents, keys, overrides);
};
ConfigurationModel.prototype.freeze = function () {
this.isFrozen = true;
return this;
};
ConfigurationModel.prototype.mergeContents = function (source, target) {
for (var _i = 0, _a = Object.keys(target); _i < _a.length; _i++) {
var key = _a[_i];
if (key in source) {
if (types["i" /* isObject */](source[key]) && types["i" /* isObject */](target[key])) {
this.mergeContents(source[key], target[key]);
continue;
}
}
source[key] = objects["c" /* deepClone */](target[key]);
}
};
ConfigurationModel.prototype.checkAndFreeze = function (data) {
if (this.isFrozen && !Object.isFrozen(data)) {
return objects["d" /* deepFreeze */](data);
}
return data;
};
ConfigurationModel.prototype.getContentsForOverrideIdentifer = function (identifier) {
for (var _i = 0, _a = this.overrides; _i < _a.length; _i++) {
var override = _a[_i];
if (override.identifiers.indexOf(identifier) !== -1) {
return override.contents;
}
}
return null;
};
ConfigurationModel.prototype.toJSON = function () {
return {
contents: this.contents,
overrides: this.overrides,
keys: this.keys
};
};
// Update methods
ConfigurationModel.prototype.setValue = function (key, value) {
this.addKey(key);
Object(common_configuration["b" /* addToValueTree */])(this.contents, key, value, function (e) { throw new Error(e); });
};
ConfigurationModel.prototype.removeValue = function (key) {
if (this.removeKey(key)) {
Object(common_configuration["h" /* removeFromValueTree */])(this.contents, key);
}
};
ConfigurationModel.prototype.addKey = function (key) {
var index = this.keys.length;
for (var i = 0; i < index; i++) {
if (key.indexOf(this.keys[i]) === 0) {
index = i;
}
}
this.keys.splice(index, 1, key);
};
ConfigurationModel.prototype.removeKey = function (key) {
var index = this.keys.indexOf(key);
if (index !== -1) {
this.keys.splice(index, 1);
return true;
}
return false;
};
return ConfigurationModel;
}());
var configurationModels_DefaultConfigurationModel = /** @class */ (function (_super) {
configurationModels_extends(DefaultConfigurationModel, _super);
function DefaultConfigurationModel() {
var _this = this;
var contents = Object(common_configuration["e" /* getDefaultValues */])();
var keys = Object(common_configuration["c" /* getConfigurationKeys */])();
var overrides = [];
for (var _i = 0, _a = Object.keys(contents); _i < _a.length; _i++) {
var key = _a[_i];
if (configurationRegistry["b" /* OVERRIDE_PROPERTY_PATTERN */].test(key)) {
overrides.push({
identifiers: [Object(common_configuration["g" /* overrideIdentifierFromKey */])(key).trim()],
keys: Object.keys(contents[key]),
contents: Object(common_configuration["i" /* toValuesTree */])(contents[key], function (message) { return console.error("Conflict in default settings file: " + message); }),
});
}
}
_this = _super.call(this, contents, keys, overrides) || this;
return _this;
}
return DefaultConfigurationModel;
}(configurationModels_ConfigurationModel));
var configurationModels_Configuration = /** @class */ (function () {
function Configuration(_defaultConfiguration, _localUserConfiguration, _remoteUserConfiguration, _workspaceConfiguration, _folderConfigurations, _memoryConfiguration, _memoryConfigurationByResource, _freeze) {
if (_remoteUserConfiguration === void 0) { _remoteUserConfiguration = new configurationModels_ConfigurationModel(); }
if (_workspaceConfiguration === void 0) { _workspaceConfiguration = new configurationModels_ConfigurationModel(); }
if (_folderConfigurations === void 0) { _folderConfigurations = new common_map["b" /* ResourceMap */](); }
if (_memoryConfiguration === void 0) { _memoryConfiguration = new configurationModels_ConfigurationModel(); }
if (_memoryConfigurationByResource === void 0) { _memoryConfigurationByResource = new common_map["b" /* ResourceMap */](); }
if (_freeze === void 0) { _freeze = true; }
this._defaultConfiguration = _defaultConfiguration;
this._localUserConfiguration = _localUserConfiguration;
this._remoteUserConfiguration = _remoteUserConfiguration;
this._workspaceConfiguration = _workspaceConfiguration;
this._folderConfigurations = _folderConfigurations;
this._memoryConfiguration = _memoryConfiguration;
this._memoryConfigurationByResource = _memoryConfigurationByResource;
this._freeze = _freeze;
this._workspaceConsolidatedConfiguration = null;
this._foldersConsolidatedConfigurations = new common_map["b" /* ResourceMap */]();
this._userConfiguration = null;
}
Configuration.prototype.getValue = function (section, overrides, workspace) {
var consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace);
return consolidateConfigurationModel.getValue(section);
};
Configuration.prototype.updateValue = function (key, value, overrides) {
if (overrides === void 0) { overrides = {}; }
var memoryConfiguration;
if (overrides.resource) {
memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
if (!memoryConfiguration) {
memoryConfiguration = new configurationModels_ConfigurationModel();
this._memoryConfigurationByResource.set(overrides.resource, memoryConfiguration);
}
}
else {
memoryConfiguration = this._memoryConfiguration;
}
if (value === undefined) {
memoryConfiguration.removeValue(key);
}
else {
memoryConfiguration.setValue(key, value);
}
if (!overrides.resource) {
this._workspaceConsolidatedConfiguration = null;
}
};
Configuration.prototype.inspect = function (key, overrides, workspace) {
var consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace);
var folderConfigurationModel = this.getFolderConfigurationModelForResource(overrides.resource, workspace);
var memoryConfigurationModel = overrides.resource ? this._memoryConfigurationByResource.get(overrides.resource) || this._memoryConfiguration : this._memoryConfiguration;
var defaultValue = overrides.overrideIdentifier ? this._defaultConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._defaultConfiguration.freeze().getValue(key);
var userValue = overrides.overrideIdentifier ? this.userConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.userConfiguration.freeze().getValue(key);
var userLocalValue = overrides.overrideIdentifier ? this.localUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.localUserConfiguration.freeze().getValue(key);
var userRemoteValue = overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this.remoteUserConfiguration.freeze().getValue(key);
var workspaceValue = workspace ? overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._workspaceConfiguration.freeze().getValue(key) : undefined; //Check on workspace exists or not because _workspaceConfiguration is never null
var workspaceFolderValue = folderConfigurationModel ? overrides.overrideIdentifier ? folderConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : folderConfigurationModel.freeze().getValue(key) : undefined;
var memoryValue = overrides.overrideIdentifier ? memoryConfigurationModel.override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.getValue(key);
var value = consolidateConfigurationModel.getValue(key);
var overrideIdentifiers = arrays["e" /* distinct */](arrays["m" /* flatten */](consolidateConfigurationModel.overrides.map(function (override) { return override.identifiers; }))).filter(function (overrideIdentifier) { return consolidateConfigurationModel.getOverrideValue(key, overrideIdentifier) !== undefined; });
return {
defaultValue: defaultValue,
userValue: userValue,
userLocalValue: userLocalValue,
userRemoteValue: userRemoteValue,
workspaceValue: workspaceValue,
workspaceFolderValue: workspaceFolderValue,
memoryValue: memoryValue,
value: value,
default: defaultValue !== undefined ? { value: this._defaultConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
user: userValue !== undefined ? { value: this.userConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.userConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
userLocal: userLocalValue !== undefined ? { value: this.localUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.localUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
userRemote: userRemoteValue !== undefined ? { value: this.remoteUserConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this.remoteUserConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
workspace: workspaceValue !== undefined ? { value: this._workspaceConfiguration.freeze().getValue(key), override: overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
workspaceFolder: workspaceFolderValue !== undefined ? { value: folderConfigurationModel === null || folderConfigurationModel === void 0 ? void 0 : folderConfigurationModel.freeze().getValue(key), override: overrides.overrideIdentifier ? folderConfigurationModel === null || folderConfigurationModel === void 0 ? void 0 : folderConfigurationModel.freeze().getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
memory: memoryValue !== undefined ? { value: memoryConfigurationModel.getValue(key), override: overrides.overrideIdentifier ? memoryConfigurationModel.getOverrideValue(key, overrides.overrideIdentifier) : undefined } : undefined,
overrideIdentifiers: overrideIdentifiers.length ? overrideIdentifiers : undefined
};
};
Object.defineProperty(Configuration.prototype, "userConfiguration", {
get: function () {
if (!this._userConfiguration) {
this._userConfiguration = this._remoteUserConfiguration.isEmpty() ? this._localUserConfiguration : this._localUserConfiguration.merge(this._remoteUserConfiguration);
if (this._freeze) {
this._userConfiguration.freeze();
}
}
return this._userConfiguration;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Configuration.prototype, "localUserConfiguration", {
get: function () {
return this._localUserConfiguration;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Configuration.prototype, "remoteUserConfiguration", {
get: function () {
return this._remoteUserConfiguration;
},
enumerable: true,
configurable: true
});
Configuration.prototype.getConsolidateConfigurationModel = function (overrides, workspace) {
var configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
return overrides.overrideIdentifier ? configurationModel.override(overrides.overrideIdentifier) : configurationModel;
};
Configuration.prototype.getConsolidatedConfigurationModelForResource = function (_a, workspace) {
var resource = _a.resource;
var consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
if (workspace && resource) {
var root = workspace.getFolder(resource);
if (root) {
consolidateConfiguration = this.getFolderConsolidatedConfiguration(root.uri) || consolidateConfiguration;
}
var memoryConfigurationForResource = this._memoryConfigurationByResource.get(resource);
if (memoryConfigurationForResource) {
consolidateConfiguration = consolidateConfiguration.merge(memoryConfigurationForResource);
}
}
return consolidateConfiguration;
};
Configuration.prototype.getWorkspaceConsolidatedConfiguration = function () {
if (!this._workspaceConsolidatedConfiguration) {
this._workspaceConsolidatedConfiguration = this._defaultConfiguration.merge(this.userConfiguration, this._workspaceConfiguration, this._memoryConfiguration);
if (this._freeze) {
this._workspaceConfiguration = this._workspaceConfiguration.freeze();
}
}
return this._workspaceConsolidatedConfiguration;
};
Configuration.prototype.getFolderConsolidatedConfiguration = function (folder) {
var folderConsolidatedConfiguration = this._foldersConsolidatedConfigurations.get(folder);
if (!folderConsolidatedConfiguration) {
var workspaceConsolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
var folderConfiguration = this._folderConfigurations.get(folder);
if (folderConfiguration) {
folderConsolidatedConfiguration = workspaceConsolidateConfiguration.merge(folderConfiguration);
if (this._freeze) {
folderConsolidatedConfiguration = folderConsolidatedConfiguration.freeze();
}
this._foldersConsolidatedConfigurations.set(folder, folderConsolidatedConfiguration);
}
else {
folderConsolidatedConfiguration = workspaceConsolidateConfiguration;
}
}
return folderConsolidatedConfiguration;
};
Configuration.prototype.getFolderConfigurationModelForResource = function (resource, workspace) {
if (workspace && resource) {
var root = workspace.getFolder(resource);
if (root) {
return this._folderConfigurations.get(root.uri);
}
}
return undefined;
};
return Configuration;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/nls.js
var nls = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var abstractKeybindingService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var abstractKeybindingService_AbstractKeybindingService = /** @class */ (function (_super) {
abstractKeybindingService_extends(AbstractKeybindingService, _super);
function AbstractKeybindingService(_contextKeyService, _commandService, _telemetryService, _notificationService) {
var _this = _super.call(this) || this;
_this._contextKeyService = _contextKeyService;
_this._commandService = _commandService;
_this._telemetryService = _telemetryService;
_this._notificationService = _notificationService;
_this._onDidUpdateKeybindings = _this._register(new common_event["a" /* Emitter */]());
_this._currentChord = null;
_this._currentChordChecker = new common_async["c" /* IntervalTimer */]();
_this._currentChordStatusMessage = null;
return _this;
}
Object.defineProperty(AbstractKeybindingService.prototype, "onDidUpdateKeybindings", {
get: function () {
return this._onDidUpdateKeybindings ? this._onDidUpdateKeybindings.event : common_event["b" /* Event */].None; // Sinon stubbing walks properties on prototype
},
enumerable: true,
configurable: true
});
AbstractKeybindingService.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
AbstractKeybindingService.prototype.getKeybindings = function () {
return this._getResolver().getKeybindings();
};
AbstractKeybindingService.prototype.lookupKeybinding = function (commandId) {
var result = this._getResolver().lookupPrimaryKeybinding(commandId);
if (!result) {
return undefined;
}
return result.resolvedKeybinding;
};
AbstractKeybindingService.prototype.softDispatch = function (e, target) {
var keybinding = this.resolveKeyboardEvent(e);
if (keybinding.isChord()) {
console.warn('Unexpected keyboard event mapped to a chord');
return null;
}
var firstPart = keybinding.getDispatchParts()[0];
if (firstPart === null) {
// cannot be dispatched, probably only modifier keys
return null;
}
var contextValue = this._contextKeyService.getContext(target);
var currentChord = this._currentChord ? this._currentChord.keypress : null;
return this._getResolver().resolve(contextValue, currentChord, firstPart);
};
AbstractKeybindingService.prototype._enterChordMode = function (firstPart, keypressLabel) {
var _this = this;
this._currentChord = {
keypress: firstPart,
label: keypressLabel
};
this._currentChordStatusMessage = this._notificationService.status(nls["a" /* localize */]('first.chord', "({0}) was pressed. Waiting for second key of chord...", keypressLabel));
var chordEnterTime = Date.now();
this._currentChordChecker.cancelAndSet(function () {
if (!_this._documentHasFocus()) {
// Focus has been lost => leave chord mode
_this._leaveChordMode();
return;
}
if (Date.now() - chordEnterTime > 5000) {
// 5 seconds elapsed => leave chord mode
_this._leaveChordMode();
}
}, 500);
};
AbstractKeybindingService.prototype._leaveChordMode = function () {
if (this._currentChordStatusMessage) {
this._currentChordStatusMessage.dispose();
this._currentChordStatusMessage = null;
}
this._currentChordChecker.cancel();
this._currentChord = null;
};
AbstractKeybindingService.prototype._dispatch = function (e, target) {
return this._doDispatch(this.resolveKeyboardEvent(e), target);
};
AbstractKeybindingService.prototype._doDispatch = function (keybinding, target) {
var _this = this;
var shouldPreventDefault = false;
if (keybinding.isChord()) {
console.warn('Unexpected keyboard event mapped to a chord');
return false;
}
var firstPart = keybinding.getDispatchParts()[0];
if (firstPart === null) {
// cannot be dispatched, probably only modifier keys
return shouldPreventDefault;
}
var contextValue = this._contextKeyService.getContext(target);
var currentChord = this._currentChord ? this._currentChord.keypress : null;
var keypressLabel = keybinding.getLabel();
var resolveResult = this._getResolver().resolve(contextValue, currentChord, firstPart);
if (resolveResult && resolveResult.enterChord) {
shouldPreventDefault = true;
this._enterChordMode(firstPart, keypressLabel);
return shouldPreventDefault;
}
if (this._currentChord) {
if (!resolveResult || !resolveResult.commandId) {
this._notificationService.status(nls["a" /* localize */]('missing.chord', "The key combination ({0}, {1}) is not a command.", this._currentChord.label, keypressLabel), { hideAfter: 10 * 1000 /* 10s */ });
shouldPreventDefault = true;
}
}
this._leaveChordMode();
if (resolveResult && resolveResult.commandId) {
if (!resolveResult.bubble) {
shouldPreventDefault = true;
}
if (typeof resolveResult.commandArgs === 'undefined') {
this._commandService.executeCommand(resolveResult.commandId).then(undefined, function (err) { return _this._notificationService.warn(err); });
}
else {
this._commandService.executeCommand(resolveResult.commandId, resolveResult.commandArgs).then(undefined, function (err) { return _this._notificationService.warn(err); });
}
this._telemetryService.publicLog2('workbenchActionExecuted', { id: resolveResult.commandId, from: 'keybinding' });
}
return shouldPreventDefault;
};
AbstractKeybindingService.prototype.mightProducePrintableCharacter = function (event) {
if (event.ctrlKey || event.metaKey) {
// ignore ctrl/cmd-combination but not shift/alt-combinatios
return false;
}
// weak check for certain ranges. this is properly implemented in a subclass
// with access to the KeyboardMapperFactory.
if ((event.keyCode >= 31 /* KEY_A */ && event.keyCode <= 56 /* KEY_Z */)
|| (event.keyCode >= 21 /* KEY_0 */ && event.keyCode <= 30 /* KEY_9 */)) {
return true;
}
return false;
};
return AbstractKeybindingService;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
var contextkey = __webpack_require__(13);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js
var keybindingResolver_KeybindingResolver = /** @class */ (function () {
function KeybindingResolver(defaultKeybindings, overrides) {
this._defaultKeybindings = defaultKeybindings;
this._defaultBoundCommands = new Map();
for (var i = 0, len = defaultKeybindings.length; i < len; i++) {
var command = defaultKeybindings[i].command;
if (command) {
this._defaultBoundCommands.set(command, true);
}
}
this._map = new Map();
this._lookupMap = new Map();
this._keybindings = KeybindingResolver.combine(defaultKeybindings, overrides);
for (var i = 0, len = this._keybindings.length; i < len; i++) {
var k = this._keybindings[i];
if (k.keypressParts.length === 0) {
// unbound
continue;
}
// TODO@chords
this._addKeyPress(k.keypressParts[0], k);
}
}
KeybindingResolver._isTargetedForRemoval = function (defaultKb, keypressFirstPart, keypressChordPart, command, when) {
if (defaultKb.command !== command) {
return false;
}
// TODO@chords
if (keypressFirstPart && defaultKb.keypressParts[0] !== keypressFirstPart) {
return false;
}
// TODO@chords
if (keypressChordPart && defaultKb.keypressParts[1] !== keypressChordPart) {
return false;
}
if (when) {
if (!defaultKb.when) {
return false;
}
if (!when.equals(defaultKb.when)) {
return false;
}
}
return true;
};
/**
* Looks for rules containing -command in `overrides` and removes them directly from `defaults`.
*/
KeybindingResolver.combine = function (defaults, rawOverrides) {
defaults = defaults.slice(0);
var overrides = [];
for (var _i = 0, rawOverrides_1 = rawOverrides; _i < rawOverrides_1.length; _i++) {
var override = rawOverrides_1[_i];
if (!override.command || override.command.length === 0 || override.command.charAt(0) !== '-') {
overrides.push(override);
continue;
}
var command = override.command.substr(1);
// TODO@chords
var keypressFirstPart = override.keypressParts[0];
var keypressChordPart = override.keypressParts[1];
var when = override.when;
for (var j = defaults.length - 1; j >= 0; j--) {
if (this._isTargetedForRemoval(defaults[j], keypressFirstPart, keypressChordPart, command, when)) {
defaults.splice(j, 1);
}
}
}
return defaults.concat(overrides);
};
KeybindingResolver.prototype._addKeyPress = function (keypress, item) {
var conflicts = this._map.get(keypress);
if (typeof conflicts === 'undefined') {
// There is no conflict so far
this._map.set(keypress, [item]);
this._addToLookupMap(item);
return;
}
for (var i = conflicts.length - 1; i >= 0; i--) {
var conflict = conflicts[i];
if (conflict.command === item.command) {
continue;
}
var conflictIsChord = (conflict.keypressParts.length > 1);
var itemIsChord = (item.keypressParts.length > 1);
// TODO@chords
if (conflictIsChord && itemIsChord && conflict.keypressParts[1] !== item.keypressParts[1]) {
// The conflict only shares the chord start with this command
continue;
}
if (KeybindingResolver.whenIsEntirelyIncluded(conflict.when, item.when)) {
// `item` completely overwrites `conflict`
// Remove conflict from the lookupMap
this._removeFromLookupMap(conflict);
}
}
conflicts.push(item);
this._addToLookupMap(item);
};
KeybindingResolver.prototype._addToLookupMap = function (item) {
if (!item.command) {
return;
}
var arr = this._lookupMap.get(item.command);
if (typeof arr === 'undefined') {
arr = [item];
this._lookupMap.set(item.command, arr);
}
else {
arr.push(item);
}
};
KeybindingResolver.prototype._removeFromLookupMap = function (item) {
if (!item.command) {
return;
}
var arr = this._lookupMap.get(item.command);
if (typeof arr === 'undefined') {
return;
}
for (var 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`.
*/
KeybindingResolver.whenIsEntirelyIncluded = function (a, b) {
if (!b) {
return true;
}
if (!a) {
return false;
}
return this._implies(a, b);
};
/**
* Returns true if it is provable `p` implies `q`.
*/
KeybindingResolver._implies = function (p, q) {
var notP = p.negate();
var terminals = function (node) {
if (node instanceof contextkey["b" /* ContextKeyOrExpr */]) {
return node.expr;
}
return [node];
};
var expr = terminals(notP).concat(terminals(q));
for (var i = 0; i < expr.length; i++) {
var a = expr[i];
var notA = a.negate();
for (var j = i + 1; j < expr.length; j++) {
var b = expr[j];
if (notA.equals(b)) {
return true;
}
}
}
return false;
};
KeybindingResolver.prototype.getKeybindings = function () {
return this._keybindings;
};
KeybindingResolver.prototype.lookupPrimaryKeybinding = function (commandId) {
var items = this._lookupMap.get(commandId);
if (typeof items === 'undefined' || items.length === 0) {
return null;
}
return items[items.length - 1];
};
KeybindingResolver.prototype.resolve = function (context, currentChord, keypress) {
var lookupMap = null;
if (currentChord !== null) {
// Fetch all chord bindings for `currentChord`
var candidates = this._map.get(currentChord);
if (typeof candidates === 'undefined') {
// No chords starting with `currentChord`
return null;
}
lookupMap = [];
for (var i = 0, len = candidates.length; i < len; i++) {
var candidate = candidates[i];
// TODO@chords
if (candidate.keypressParts[1] === keypress) {
lookupMap.push(candidate);
}
}
}
else {
var candidates = this._map.get(keypress);
if (typeof candidates === 'undefined') {
// No bindings with `keypress`
return null;
}
lookupMap = candidates;
}
var result = this._findCommand(context, lookupMap);
if (!result) {
return null;
}
// TODO@chords
if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {
return {
enterChord: true,
commandId: null,
commandArgs: null,
bubble: false
};
}
return {
enterChord: false,
commandId: result.command,
commandArgs: result.commandArgs,
bubble: result.bubble
};
};
KeybindingResolver.prototype._findCommand = function (context, matches) {
for (var i = matches.length - 1; i >= 0; i--) {
var k = matches[i];
if (!KeybindingResolver.contextMatchesRules(context, k.when)) {
continue;
}
return k;
}
return null;
};
KeybindingResolver.contextMatchesRules = function (context, rules) {
if (!rules) {
return true;
}
return rules.evaluate(context);
};
return KeybindingResolver;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js
var keybindingsRegistry = __webpack_require__(88);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ResolvedKeybindingItem = /** @class */ (function () {
function ResolvedKeybindingItem(resolvedKeybinding, command, commandArgs, when, isDefault) {
this.resolvedKeybinding = resolvedKeybinding;
this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];
this.bubble = (command ? command.charCodeAt(0) === 94 /* Caret */ : false);
this.command = this.bubble ? command.substr(1) : command;
this.commandArgs = commandArgs;
this.when = when;
this.isDefault = isDefault;
}
return ResolvedKeybindingItem;
}());
function removeElementsAfterNulls(arr) {
var result = [];
for (var i = 0, len = arr.length; i < len; i++) {
var element = arr[i];
if (!element) {
// stop processing at first encountered null
return result;
}
result.push(element);
}
return result;
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/keybindingLabels.js
var keybindingLabels = __webpack_require__(199);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var baseResolvedKeybinding_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var baseResolvedKeybinding_BaseResolvedKeybinding = /** @class */ (function (_super) {
baseResolvedKeybinding_extends(BaseResolvedKeybinding, _super);
function BaseResolvedKeybinding(os, parts) {
var _this = _super.call(this) || this;
if (parts.length === 0) {
throw Object(errors["b" /* illegalArgument */])("parts");
}
_this._os = os;
_this._parts = parts;
return _this;
}
BaseResolvedKeybinding.prototype.getLabel = function () {
var _this = this;
return keybindingLabels["b" /* UILabelProvider */].toLabel(this._os, this._parts, function (keybinding) { return _this._getLabel(keybinding); });
};
BaseResolvedKeybinding.prototype.getAriaLabel = function () {
var _this = this;
return keybindingLabels["a" /* AriaLabelProvider */].toLabel(this._os, this._parts, function (keybinding) { return _this._getAriaLabel(keybinding); });
};
BaseResolvedKeybinding.prototype.isChord = function () {
return (this._parts.length > 1);
};
BaseResolvedKeybinding.prototype.getParts = function () {
var _this = this;
return this._parts.map(function (keybinding) { return _this._getPart(keybinding); });
};
BaseResolvedKeybinding.prototype._getPart = function (keybinding) {
return new keyCodes["d" /* ResolvedKeybindingPart */](keybinding.ctrlKey, keybinding.shiftKey, keybinding.altKey, keybinding.metaKey, this._getLabel(keybinding), this._getAriaLabel(keybinding));
};
BaseResolvedKeybinding.prototype.getDispatchParts = function () {
var _this = this;
return this._parts.map(function (keybinding) { return _this._getDispatchPart(keybinding); });
};
return BaseResolvedKeybinding;
}(keyCodes["c" /* ResolvedKeybinding */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var usLayoutResolvedKeybinding_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Do not instantiate. Use KeybindingService to get a ResolvedKeybinding seeded with information about the current kb layout.
*/
var usLayoutResolvedKeybinding_USLayoutResolvedKeybinding = /** @class */ (function (_super) {
usLayoutResolvedKeybinding_extends(USLayoutResolvedKeybinding, _super);
function USLayoutResolvedKeybinding(actual, os) {
return _super.call(this, os, actual.parts) || this;
}
USLayoutResolvedKeybinding.prototype._keyCodeToUILabel = function (keyCode) {
if (this._os === 2 /* Macintosh */) {
switch (keyCode) {
case 15 /* LeftArrow */:
return '←';
case 16 /* UpArrow */:
return '↑';
case 17 /* RightArrow */:
return '→';
case 18 /* DownArrow */:
return '↓';
}
}
return keyCodes["b" /* KeyCodeUtils */].toString(keyCode);
};
USLayoutResolvedKeybinding.prototype._getLabel = function (keybinding) {
if (keybinding.isDuplicateModifierCase()) {
return '';
}
return this._keyCodeToUILabel(keybinding.keyCode);
};
USLayoutResolvedKeybinding.prototype._getAriaLabel = function (keybinding) {
if (keybinding.isDuplicateModifierCase()) {
return '';
}
return keyCodes["b" /* KeyCodeUtils */].toString(keybinding.keyCode);
};
USLayoutResolvedKeybinding.prototype._getDispatchPart = function (keybinding) {
return USLayoutResolvedKeybinding.getDispatchStr(keybinding);
};
USLayoutResolvedKeybinding.getDispatchStr = function (keybinding) {
if (keybinding.isModifierKey()) {
return null;
}
var result = '';
if (keybinding.ctrlKey) {
result += 'ctrl+';
}
if (keybinding.shiftKey) {
result += 'shift+';
}
if (keybinding.altKey) {
result += 'alt+';
}
if (keybinding.metaKey) {
result += 'meta+';
}
result += keyCodes["b" /* KeyCodeUtils */].toString(keybinding.keyCode);
return result;
};
return USLayoutResolvedKeybinding;
}(baseResolvedKeybinding_BaseResolvedKeybinding));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js
var common_notification = __webpack_require__(49);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/workspace/common/workspace.js
var common_workspace = __webpack_require__(181);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/standaloneStrings.js
var standaloneStrings = __webpack_require__(32);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/simpleServices.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var simpleServices_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var simpleServices_decorate = (undefined && undefined.__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;
};
var simpleServices_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var simpleServices_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var simpleServices_SimpleModel = /** @class */ (function () {
function SimpleModel(model) {
this.model = model;
this._onDispose = new common_event["a" /* Emitter */]();
}
Object.defineProperty(SimpleModel.prototype, "textEditorModel", {
get: function () {
return this.model;
},
enumerable: true,
configurable: true
});
SimpleModel.prototype.dispose = function () {
this._onDispose.fire();
};
return SimpleModel;
}());
function withTypedEditor(widget, codeEditorCallback, diffEditorCallback) {
if (Object(editorBrowser["a" /* isCodeEditor */])(widget)) {
// Single Editor
return codeEditorCallback(widget);
}
else {
// Diff Editor
return diffEditorCallback(widget);
}
}
var simpleServices_SimpleEditorModelResolverService = /** @class */ (function () {
function SimpleEditorModelResolverService(modelService) {
this.modelService = modelService;
}
SimpleEditorModelResolverService.prototype.setEditor = function (editor) {
this.editor = editor;
};
SimpleEditorModelResolverService.prototype.createModelReference = function (resource) {
var _this = this;
var model = null;
if (this.editor) {
model = withTypedEditor(this.editor, function (editor) { return _this.findModel(editor, resource); }, function (diffEditor) { return _this.findModel(diffEditor.getOriginalEditor(), resource) || _this.findModel(diffEditor.getModifiedEditor(), resource); });
}
if (!model) {
return Promise.reject(new Error("Model not found"));
}
return Promise.resolve(new lifecycle["c" /* ImmortalReference */](new simpleServices_SimpleModel(model)));
};
SimpleEditorModelResolverService.prototype.findModel = function (editor, resource) {
var model = this.modelService ? this.modelService.getModel(resource) : editor.getModel();
if (model && model.uri.toString() !== resource.toString()) {
return null;
}
return model;
};
return SimpleEditorModelResolverService;
}());
var SimpleEditorProgressService = /** @class */ (function () {
function SimpleEditorProgressService() {
}
SimpleEditorProgressService.prototype.show = function () {
return SimpleEditorProgressService.NULL_PROGRESS_RUNNER;
};
SimpleEditorProgressService.prototype.showWhile = function (promise, delay) {
return Promise.resolve(undefined);
};
SimpleEditorProgressService.NULL_PROGRESS_RUNNER = {
done: function () { },
total: function () { },
worked: function () { }
};
return SimpleEditorProgressService;
}());
var SimpleDialogService = /** @class */ (function () {
function SimpleDialogService() {
}
return SimpleDialogService;
}());
var simpleServices_SimpleNotificationService = /** @class */ (function () {
function SimpleNotificationService() {
}
SimpleNotificationService.prototype.info = function (message) {
return this.notify({ severity: common_severity["a" /* default */].Info, message: message });
};
SimpleNotificationService.prototype.warn = function (message) {
return this.notify({ severity: common_severity["a" /* default */].Warning, message: message });
};
SimpleNotificationService.prototype.error = function (error) {
return this.notify({ severity: common_severity["a" /* default */].Error, message: error });
};
SimpleNotificationService.prototype.notify = function (notification) {
switch (notification.severity) {
case common_severity["a" /* default */].Error:
console.error(notification.message);
break;
case common_severity["a" /* default */].Warning:
console.warn(notification.message);
break;
default:
console.log(notification.message);
break;
}
return SimpleNotificationService.NO_OP;
};
SimpleNotificationService.prototype.status = function (message, options) {
return lifecycle["a" /* Disposable */].None;
};
SimpleNotificationService.NO_OP = new common_notification["b" /* NoOpNotification */]();
return SimpleNotificationService;
}());
var simpleServices_StandaloneCommandService = /** @class */ (function () {
function StandaloneCommandService(instantiationService) {
this._onWillExecuteCommand = new common_event["a" /* Emitter */]();
this._onDidExecuteCommand = new common_event["a" /* Emitter */]();
this._instantiationService = instantiationService;
this._dynamicCommands = Object.create(null);
}
StandaloneCommandService.prototype.addCommand = function (command) {
var _this = this;
var id = command.id;
this._dynamicCommands[id] = command;
return Object(lifecycle["h" /* toDisposable */])(function () {
delete _this._dynamicCommands[id];
});
};
StandaloneCommandService.prototype.executeCommand = function (id) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var command = (commands["a" /* CommandsRegistry */].getCommand(id) || this._dynamicCommands[id]);
if (!command) {
return Promise.reject(new Error("command '" + id + "' not found"));
}
try {
this._onWillExecuteCommand.fire({ commandId: id, args: args });
var result = this._instantiationService.invokeFunction.apply(this._instantiationService, simpleServices_spreadArrays([command.handler], args));
this._onDidExecuteCommand.fire({ commandId: id, args: args });
return Promise.resolve(result);
}
catch (err) {
return Promise.reject(err);
}
};
return StandaloneCommandService;
}());
var simpleServices_StandaloneKeybindingService = /** @class */ (function (_super) {
simpleServices_extends(StandaloneKeybindingService, _super);
function StandaloneKeybindingService(contextKeyService, commandService, telemetryService, notificationService, domNode) {
var _this = _super.call(this, contextKeyService, commandService, telemetryService, notificationService) || this;
_this._cachedResolver = null;
_this._dynamicKeybindings = [];
_this._register(dom["j" /* addDisposableListener */](domNode, dom["d" /* EventType */].KEY_DOWN, function (e) {
var keyEvent = new browser_keyboardEvent["a" /* StandardKeyboardEvent */](e);
var shouldPreventDefault = _this._dispatch(keyEvent, keyEvent.target);
if (shouldPreventDefault) {
keyEvent.preventDefault();
keyEvent.stopPropagation();
}
}));
return _this;
}
StandaloneKeybindingService.prototype.addDynamicKeybinding = function (commandId, _keybinding, handler, when) {
var _this = this;
var keybinding = Object(keyCodes["f" /* createKeybinding */])(_keybinding, platform["a" /* OS */]);
var toDispose = new lifecycle["b" /* DisposableStore */]();
if (keybinding) {
this._dynamicKeybindings.push({
keybinding: keybinding,
command: commandId,
when: when,
weight1: 1000,
weight2: 0
});
toDispose.add(Object(lifecycle["h" /* toDisposable */])(function () {
for (var i = 0; i < _this._dynamicKeybindings.length; i++) {
var kb = _this._dynamicKeybindings[i];
if (kb.command === commandId) {
_this._dynamicKeybindings.splice(i, 1);
_this.updateResolver({ source: 1 /* Default */ });
return;
}
}
}));
}
var commandService = this._commandService;
if (commandService instanceof simpleServices_StandaloneCommandService) {
toDispose.add(commandService.addCommand({
id: commandId,
handler: handler
}));
}
else {
throw new Error('Unknown command service!');
}
this.updateResolver({ source: 1 /* Default */ });
return toDispose;
};
StandaloneKeybindingService.prototype.updateResolver = function (event) {
this._cachedResolver = null;
this._onDidUpdateKeybindings.fire(event);
};
StandaloneKeybindingService.prototype._getResolver = function () {
if (!this._cachedResolver) {
var defaults = this._toNormalizedKeybindingItems(keybindingsRegistry["a" /* KeybindingsRegistry */].getDefaultKeybindings(), true);
var overrides = this._toNormalizedKeybindingItems(this._dynamicKeybindings, false);
this._cachedResolver = new keybindingResolver_KeybindingResolver(defaults, overrides);
}
return this._cachedResolver;
};
StandaloneKeybindingService.prototype._documentHasFocus = function () {
return document.hasFocus();
};
StandaloneKeybindingService.prototype._toNormalizedKeybindingItems = function (items, isDefault) {
var result = [], resultLen = 0;
for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
var item = items_1[_i];
var when = item.when || undefined;
var keybinding = item.keybinding;
if (!keybinding) {
// This might be a removal keybinding item in user settings => accept it
result[resultLen++] = new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault);
}
else {
var resolvedKeybindings = this.resolveKeybinding(keybinding);
for (var _a = 0, resolvedKeybindings_1 = resolvedKeybindings; _a < resolvedKeybindings_1.length; _a++) {
var resolvedKeybinding = resolvedKeybindings_1[_a];
result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault);
}
}
}
return result;
};
StandaloneKeybindingService.prototype.resolveKeybinding = function (keybinding) {
return [new usLayoutResolvedKeybinding_USLayoutResolvedKeybinding(keybinding, platform["a" /* OS */])];
};
StandaloneKeybindingService.prototype.resolveKeyboardEvent = function (keyboardEvent) {
var keybinding = new keyCodes["e" /* SimpleKeybinding */](keyboardEvent.ctrlKey, keyboardEvent.shiftKey, keyboardEvent.altKey, keyboardEvent.metaKey, keyboardEvent.keyCode).toChord();
return new usLayoutResolvedKeybinding_USLayoutResolvedKeybinding(keybinding, platform["a" /* OS */]);
};
return StandaloneKeybindingService;
}(abstractKeybindingService_AbstractKeybindingService));
function isConfigurationOverrides(thing) {
return thing
&& typeof thing === 'object'
&& (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')
&& (!thing.resource || thing.resource instanceof common_uri["a" /* URI */]);
}
var simpleServices_SimpleConfigurationService = /** @class */ (function () {
function SimpleConfigurationService() {
this._onDidChangeConfiguration = new common_event["a" /* Emitter */]();
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
this._configuration = new configurationModels_Configuration(new configurationModels_DefaultConfigurationModel(), new configurationModels_ConfigurationModel());
}
SimpleConfigurationService.prototype.configuration = function () {
return this._configuration;
};
SimpleConfigurationService.prototype.getValue = function (arg1, arg2) {
var section = typeof arg1 === 'string' ? arg1 : undefined;
var overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
return this.configuration().getValue(section, overrides, undefined);
};
SimpleConfigurationService.prototype.updateValue = function (key, value, arg3, arg4) {
this.configuration().updateValue(key, value);
return Promise.resolve();
};
SimpleConfigurationService.prototype.inspect = function (key, options) {
if (options === void 0) { options = {}; }
return this.configuration().inspect(key, options, undefined);
};
return SimpleConfigurationService;
}());
var simpleServices_SimpleResourceConfigurationService = /** @class */ (function () {
function SimpleResourceConfigurationService(configurationService) {
var _this = this;
this.configurationService = configurationService;
this._onDidChangeConfiguration = new common_event["a" /* Emitter */]();
this.configurationService.onDidChangeConfiguration(function (e) {
_this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: function (resource, configuration) { return e.affectsConfiguration(configuration); } });
});
}
SimpleResourceConfigurationService.prototype.getValue = function (resource, arg2, arg3) {
var position = core_position["a" /* Position */].isIPosition(arg2) ? arg2 : null;
var section = position ? (typeof arg3 === 'string' ? arg3 : undefined) : (typeof arg2 === 'string' ? arg2 : undefined);
if (typeof section === 'undefined') {
return this.configurationService.getValue();
}
return this.configurationService.getValue(section);
};
return SimpleResourceConfigurationService;
}());
var simpleServices_SimpleResourcePropertiesService = /** @class */ (function () {
function SimpleResourcePropertiesService(configurationService) {
this.configurationService = configurationService;
}
SimpleResourcePropertiesService.prototype.getEOL = function (resource, language) {
var eol = this.configurationService.getValue('files.eol', { overrideIdentifier: language, resource: resource });
if (eol && eol !== 'auto') {
return eol;
}
return (platform["d" /* isLinux */] || platform["e" /* isMacintosh */]) ? '\n' : '\r\n';
};
SimpleResourcePropertiesService = simpleServices_decorate([
simpleServices_param(0, common_configuration["a" /* IConfigurationService */])
], SimpleResourcePropertiesService);
return SimpleResourcePropertiesService;
}());
var StandaloneTelemetryService = /** @class */ (function () {
function StandaloneTelemetryService() {
}
StandaloneTelemetryService.prototype.publicLog = function (eventName, data) {
return Promise.resolve(undefined);
};
StandaloneTelemetryService.prototype.publicLog2 = function (eventName, data) {
return this.publicLog(eventName, data);
};
return StandaloneTelemetryService;
}());
var simpleServices_SimpleWorkspaceContextService = /** @class */ (function () {
function SimpleWorkspaceContextService() {
var resource = common_uri["a" /* URI */].from({ scheme: SimpleWorkspaceContextService.SCHEME, authority: 'model', path: '/' });
this.workspace = { id: '4064f6ec-cb38-4ad0-af64-ee6467e63c82', folders: [new common_workspace["b" /* WorkspaceFolder */]({ uri: resource, name: '', index: 0 })] };
}
SimpleWorkspaceContextService.prototype.getWorkspace = function () {
return this.workspace;
};
SimpleWorkspaceContextService.prototype.getWorkspaceFolder = function (resource) {
return resource && resource.scheme === SimpleWorkspaceContextService.SCHEME ? this.workspace.folders[0] : null;
};
SimpleWorkspaceContextService.SCHEME = 'inmemory';
return SimpleWorkspaceContextService;
}());
function applyConfigurationValues(configurationService, source, isDiffEditor) {
if (!source) {
return;
}
if (!(configurationService instanceof simpleServices_SimpleConfigurationService)) {
return;
}
Object.keys(source).forEach(function (key) {
if (Object(commonEditorConfig["d" /* isEditorConfigurationKey */])(key)) {
configurationService.updateValue("editor." + key, source[key]);
}
if (isDiffEditor && Object(commonEditorConfig["c" /* isDiffEditorConfigurationKey */])(key)) {
configurationService.updateValue("diffEditor." + key, source[key]);
}
});
}
var simpleServices_SimpleBulkEditService = /** @class */ (function () {
function SimpleBulkEditService(_modelService) {
this._modelService = _modelService;
//
}
SimpleBulkEditService.prototype.hasPreviewHandler = function () {
return false;
};
SimpleBulkEditService.prototype.apply = function (workspaceEdit, options) {
var edits = new Map();
if (workspaceEdit.edits) {
for (var _i = 0, _a = workspaceEdit.edits; _i < _a.length; _i++) {
var edit = _a[_i];
if (!modes["D" /* WorkspaceTextEdit */].is(edit)) {
return Promise.reject(new Error('bad edit - only text edits are supported'));
}
var model = this._modelService.getModel(edit.resource);
if (!model) {
return Promise.reject(new Error('bad edit - model not found'));
}
var array = edits.get(model);
if (!array) {
array = [];
edits.set(model, array);
}
array.push(edit.edit);
}
}
var totalEdits = 0;
var totalFiles = 0;
edits.forEach(function (edits, model) {
model.pushStackElement();
model.pushEditOperations([], edits.map(function (e) { return editOperation["a" /* EditOperation */].replaceMove(core_range["a" /* Range */].lift(e.range), e.text); }), function () { return []; });
model.pushStackElement();
totalFiles += 1;
totalEdits += edits.length;
});
return Promise.resolve({
selection: undefined,
ariaSummary: strings["r" /* format */](standaloneStrings["f" /* SimpleServicesNLS */].bulkEditServiceSummary, totalEdits, totalFiles)
});
};
return SimpleBulkEditService;
}());
var SimpleUriLabelService = /** @class */ (function () {
function SimpleUriLabelService() {
}
SimpleUriLabelService.prototype.getUriLabel = function (resource, options) {
if (resource.scheme === 'file') {
return resource.fsPath;
}
return resource.path;
};
return SimpleUriLabelService;
}());
var simpleServices_SimpleLayoutService = /** @class */ (function () {
function SimpleLayoutService(_container) {
this._container = _container;
this.onLayout = common_event["b" /* Event */].None;
}
Object.defineProperty(SimpleLayoutService.prototype, "container", {
get: function () {
return this._container;
},
enumerable: true,
configurable: true
});
return SimpleLayoutService;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/browser.js
var browser = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/aria/aria.js
var aria = __webpack_require__(61);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js + 57 modules
var codeEditorWidget = __webpack_require__(164);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/widget/diffEditorWidget.js + 2 modules
var diffEditorWidget = __webpack_require__(280);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorAction.js
var editorAction = __webpack_require__(236);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/common/standaloneThemeService.js
var common_standaloneThemeService = __webpack_require__(122);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/actions/common/actions.js
var common_actions = __webpack_require__(68);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextView.js
var contextView = __webpack_require__(76);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js
var instantiation = __webpack_require__(22);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js
var common_keybinding = __webpack_require__(45);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js
var common_themeService = __webpack_require__(19);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js
var accessibility = __webpack_require__(72);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js
var common_clipboardService = __webpack_require__(165);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/progress/common/progress.js
var progress = __webpack_require__(109);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var standaloneCodeEditor_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var standaloneCodeEditor_decorate = (undefined && undefined.__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;
};
var standaloneCodeEditor_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var standaloneCodeEditor_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var LAST_GENERATED_COMMAND_ID = 0;
var ariaDomNodeCreated = false;
function createAriaDomNode() {
if (ariaDomNodeCreated) {
return;
}
ariaDomNodeCreated = true;
aria["b" /* setARIAContainer */](document.body);
}
/**
* A code editor to be used both by the standalone editor and the standalone diff editor.
*/
var standaloneCodeEditor_StandaloneCodeEditor = /** @class */ (function (_super) {
standaloneCodeEditor_extends(StandaloneCodeEditor, _super);
function StandaloneCodeEditor(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService, notificationService, accessibilityService) {
var _this = this;
options = options || {};
options.ariaLabel = options.ariaLabel || standaloneStrings["g" /* StandaloneCodeEditorNLS */].editorViewAccessibleLabel;
options.ariaLabel = options.ariaLabel + ';' + (browser["i" /* isIE */]
? standaloneStrings["g" /* StandaloneCodeEditorNLS */].accessibilityHelpMessageIE
: standaloneStrings["g" /* StandaloneCodeEditorNLS */].accessibilityHelpMessage);
_this = _super.call(this, domElement, options, {}, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService) || this;
if (keybindingService instanceof simpleServices_StandaloneKeybindingService) {
_this._standaloneKeybindingService = keybindingService;
}
else {
_this._standaloneKeybindingService = null;
}
// Create the ARIA dom node as soon as the first editor is instantiated
createAriaDomNode();
return _this;
}
StandaloneCodeEditor.prototype.addCommand = function (keybinding, handler, context) {
if (!this._standaloneKeybindingService) {
console.warn('Cannot add command because the editor is configured with an unrecognized KeybindingService');
return null;
}
var commandId = 'DYNAMIC_' + (++LAST_GENERATED_COMMAND_ID);
var whenExpression = contextkey["a" /* ContextKeyExpr */].deserialize(context);
this._standaloneKeybindingService.addDynamicKeybinding(commandId, keybinding, handler, whenExpression);
return commandId;
};
StandaloneCodeEditor.prototype.createContextKey = function (key, defaultValue) {
return this._contextKeyService.createKey(key, defaultValue);
};
StandaloneCodeEditor.prototype.addAction = function (_descriptor) {
var _this = this;
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 lifecycle["a" /* Disposable */].None;
}
// Read descriptor options
var id = _descriptor.id;
var label = _descriptor.label;
var precondition = contextkey["a" /* ContextKeyExpr */].and(contextkey["a" /* ContextKeyExpr */].equals('editorId', this.getId()), contextkey["a" /* ContextKeyExpr */].deserialize(_descriptor.precondition));
var keybindings = _descriptor.keybindings;
var keybindingsWhen = contextkey["a" /* ContextKeyExpr */].and(precondition, contextkey["a" /* ContextKeyExpr */].deserialize(_descriptor.keybindingContext));
var contextMenuGroupId = _descriptor.contextMenuGroupId || null;
var contextMenuOrder = _descriptor.contextMenuOrder || 0;
var run = function (accessor) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return Promise.resolve(_descriptor.run.apply(_descriptor, standaloneCodeEditor_spreadArrays([_this], args)));
};
var toDispose = new lifecycle["b" /* DisposableStore */]();
// Generate a unique id to allow the same descriptor.id across multiple editor instances
var uniqueId = this.getId() + ':' + id;
// Register the command
toDispose.add(commands["a" /* CommandsRegistry */].registerCommand(uniqueId, run));
// Register the context menu item
if (contextMenuGroupId) {
var menuItem = {
command: {
id: uniqueId,
title: label
},
when: precondition,
group: contextMenuGroupId,
order: contextMenuOrder
};
toDispose.add(common_actions["c" /* MenuRegistry */].appendMenuItem(7 /* EditorContext */, menuItem));
}
// Register the keybindings
if (Array.isArray(keybindings)) {
for (var _i = 0, keybindings_1 = keybindings; _i < keybindings_1.length; _i++) {
var kb = keybindings_1[_i];
toDispose.add(this._standaloneKeybindingService.addDynamicKeybinding(uniqueId, kb, run, keybindingsWhen));
}
}
// Finally, register an internal editor action
var internalAction = new editorAction["a" /* InternalEditorAction */](uniqueId, label, label, precondition, run, this._contextKeyService);
// Store it under the original id, such that trigger with the original id will work
this._actions[id] = internalAction;
toDispose.add(Object(lifecycle["h" /* toDisposable */])(function () {
delete _this._actions[id];
}));
return toDispose;
};
StandaloneCodeEditor = standaloneCodeEditor_decorate([
standaloneCodeEditor_param(2, instantiation["a" /* IInstantiationService */]),
standaloneCodeEditor_param(3, services_codeEditorService["a" /* ICodeEditorService */]),
standaloneCodeEditor_param(4, commands["b" /* ICommandService */]),
standaloneCodeEditor_param(5, contextkey["c" /* IContextKeyService */]),
standaloneCodeEditor_param(6, common_keybinding["a" /* IKeybindingService */]),
standaloneCodeEditor_param(7, common_themeService["c" /* IThemeService */]),
standaloneCodeEditor_param(8, common_notification["a" /* INotificationService */]),
standaloneCodeEditor_param(9, accessibility["b" /* IAccessibilityService */])
], StandaloneCodeEditor);
return StandaloneCodeEditor;
}(codeEditorWidget["a" /* CodeEditorWidget */]));
var standaloneCodeEditor_StandaloneEditor = /** @class */ (function (_super) {
standaloneCodeEditor_extends(StandaloneEditor, _super);
function StandaloneEditor(domElement, options, toDispose, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, contextViewService, themeService, notificationService, configurationService, accessibilityService) {
var _this = this;
applyConfigurationValues(configurationService, options, false);
var themeDomRegistration = themeService.registerEditorContainer(domElement);
options = options || {};
if (typeof options.theme === 'string') {
themeService.setTheme(options.theme);
}
var _model = options.model;
delete options.model;
_this = _super.call(this, domElement, options, instantiationService, codeEditorService, commandService, contextKeyService, keybindingService, themeService, notificationService, accessibilityService) || this;
_this._contextViewService = contextViewService;
_this._configurationService = configurationService;
_this._register(toDispose);
_this._register(themeDomRegistration);
var model;
if (typeof _model === 'undefined') {
model = self.monaco.editor.createModel(options.value || '', options.language || 'text/plain');
_this._ownsModel = true;
}
else {
model = _model;
_this._ownsModel = false;
}
_this._attachModel(model);
if (model) {
var e = {
oldModelUrl: null,
newModelUrl: model.uri
};
_this._onDidChangeModel.fire(e);
}
return _this;
}
StandaloneEditor.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
StandaloneEditor.prototype.updateOptions = function (newOptions) {
applyConfigurationValues(this._configurationService, newOptions, false);
_super.prototype.updateOptions.call(this, newOptions);
};
StandaloneEditor.prototype._attachModel = function (model) {
_super.prototype._attachModel.call(this, model);
if (this._modelData) {
this._contextViewService.setContainer(this._modelData.view.domNode.domNode);
}
};
StandaloneEditor.prototype._postDetachModelCleanup = function (detachedModel) {
_super.prototype._postDetachModelCleanup.call(this, detachedModel);
if (detachedModel && this._ownsModel) {
detachedModel.dispose();
this._ownsModel = false;
}
};
StandaloneEditor = standaloneCodeEditor_decorate([
standaloneCodeEditor_param(3, instantiation["a" /* IInstantiationService */]),
standaloneCodeEditor_param(4, services_codeEditorService["a" /* ICodeEditorService */]),
standaloneCodeEditor_param(5, commands["b" /* ICommandService */]),
standaloneCodeEditor_param(6, contextkey["c" /* IContextKeyService */]),
standaloneCodeEditor_param(7, common_keybinding["a" /* IKeybindingService */]),
standaloneCodeEditor_param(8, contextView["b" /* IContextViewService */]),
standaloneCodeEditor_param(9, common_standaloneThemeService["a" /* IStandaloneThemeService */]),
standaloneCodeEditor_param(10, common_notification["a" /* INotificationService */]),
standaloneCodeEditor_param(11, common_configuration["a" /* IConfigurationService */]),
standaloneCodeEditor_param(12, accessibility["b" /* IAccessibilityService */])
], StandaloneEditor);
return StandaloneEditor;
}(standaloneCodeEditor_StandaloneCodeEditor));
var standaloneCodeEditor_StandaloneDiffEditor = /** @class */ (function (_super) {
standaloneCodeEditor_extends(StandaloneDiffEditor, _super);
function StandaloneDiffEditor(domElement, options, toDispose, instantiationService, contextKeyService, keybindingService, contextViewService, editorWorkerService, codeEditorService, themeService, notificationService, configurationService, contextMenuService, editorProgressService, clipboardService) {
var _this = this;
applyConfigurationValues(configurationService, options, true);
var themeDomRegistration = themeService.registerEditorContainer(domElement);
options = options || {};
if (typeof options.theme === 'string') {
options.theme = themeService.setTheme(options.theme);
}
_this = _super.call(this, domElement, options, clipboardService, editorWorkerService, contextKeyService, instantiationService, codeEditorService, themeService, notificationService, contextMenuService, editorProgressService) || this;
_this._contextViewService = contextViewService;
_this._configurationService = configurationService;
_this._register(toDispose);
_this._register(themeDomRegistration);
_this._contextViewService.setContainer(_this._containerDomElement);
return _this;
}
StandaloneDiffEditor.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
StandaloneDiffEditor.prototype.updateOptions = function (newOptions) {
applyConfigurationValues(this._configurationService, newOptions, true);
_super.prototype.updateOptions.call(this, newOptions);
};
StandaloneDiffEditor.prototype._createInnerEditor = function (instantiationService, container, options) {
return instantiationService.createInstance(standaloneCodeEditor_StandaloneCodeEditor, container, options);
};
StandaloneDiffEditor.prototype.getOriginalEditor = function () {
return _super.prototype.getOriginalEditor.call(this);
};
StandaloneDiffEditor.prototype.getModifiedEditor = function () {
return _super.prototype.getModifiedEditor.call(this);
};
StandaloneDiffEditor.prototype.addCommand = function (keybinding, handler, context) {
return this.getModifiedEditor().addCommand(keybinding, handler, context);
};
StandaloneDiffEditor.prototype.createContextKey = function (key, defaultValue) {
return this.getModifiedEditor().createContextKey(key, defaultValue);
};
StandaloneDiffEditor.prototype.addAction = function (descriptor) {
return this.getModifiedEditor().addAction(descriptor);
};
StandaloneDiffEditor = standaloneCodeEditor_decorate([
standaloneCodeEditor_param(3, instantiation["a" /* IInstantiationService */]),
standaloneCodeEditor_param(4, contextkey["c" /* IContextKeyService */]),
standaloneCodeEditor_param(5, common_keybinding["a" /* IKeybindingService */]),
standaloneCodeEditor_param(6, contextView["b" /* IContextViewService */]),
standaloneCodeEditor_param(7, services_editorWorkerService["a" /* IEditorWorkerService */]),
standaloneCodeEditor_param(8, services_codeEditorService["a" /* ICodeEditorService */]),
standaloneCodeEditor_param(9, common_standaloneThemeService["a" /* IStandaloneThemeService */]),
standaloneCodeEditor_param(10, common_notification["a" /* INotificationService */]),
standaloneCodeEditor_param(11, common_configuration["a" /* IConfigurationService */]),
standaloneCodeEditor_param(12, contextView["a" /* IContextMenuService */]),
standaloneCodeEditor_param(13, progress["a" /* IEditorProgressService */]),
standaloneCodeEditor_param(14, Object(instantiation["d" /* optional */])(common_clipboardService["a" /* IClipboardService */]))
], StandaloneDiffEditor);
return StandaloneDiffEditor;
}(diffEditorWidget["a" /* DiffEditorWidget */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/bulkEditService.js
var bulkEditService = __webpack_require__(182);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/modeService.js
var services_modeService = __webpack_require__(101);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/abstractMode.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var FrankensteinMode = /** @class */ (function () {
function FrankensteinMode(languageIdentifier) {
this._languageIdentifier = languageIdentifier;
}
FrankensteinMode.prototype.getId = function () {
return this._languageIdentifier.language;
};
return FrankensteinMode;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/path.js + 1 modules
var common_path = __webpack_require__(51);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/glob.js
var glob = __webpack_require__(231);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/common/mime.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var MIME_TEXT = 'text/plain';
var MIME_UNKNOWN = 'application/unknown';
var registeredAssociations = [];
var nonUserRegisteredAssociations = [];
var userRegisteredAssociations = [];
/**
* Associate a text mime to the registry.
*/
function registerTextMime(association, warnOnOverwrite) {
if (warnOnOverwrite === void 0) { warnOnOverwrite = false; }
// Register
var associationItem = toTextMimeAssociationItem(association);
registeredAssociations.push(associationItem);
if (!associationItem.userConfigured) {
nonUserRegisteredAssociations.push(associationItem);
}
else {
userRegisteredAssociations.push(associationItem);
}
// Check for conflicts unless this is a user configured association
if (warnOnOverwrite && !associationItem.userConfigured) {
registeredAssociations.forEach(function (a) {
if (a.mime === associationItem.mime || a.userConfigured) {
return; // same mime or userConfigured is ok
}
if (associationItem.extension && a.extension === associationItem.extension) {
console.warn("Overwriting extension <<" + associationItem.extension + ">> to now point to mime <<" + associationItem.mime + ">>");
}
if (associationItem.filename && a.filename === associationItem.filename) {
console.warn("Overwriting filename <<" + associationItem.filename + ">> to now point to mime <<" + associationItem.mime + ">>");
}
if (associationItem.filepattern && a.filepattern === associationItem.filepattern) {
console.warn("Overwriting filepattern <<" + associationItem.filepattern + ">> to now point to mime <<" + associationItem.mime + ">>");
}
if (associationItem.firstline && a.firstline === associationItem.firstline) {
console.warn("Overwriting firstline <<" + associationItem.firstline + ">> to now point to mime <<" + associationItem.mime + ">>");
}
});
}
}
function toTextMimeAssociationItem(association) {
return {
id: association.id,
mime: association.mime,
filename: association.filename,
extension: association.extension,
filepattern: association.filepattern,
firstline: association.firstline,
userConfigured: association.userConfigured,
filenameLowercase: association.filename ? association.filename.toLowerCase() : undefined,
extensionLowercase: association.extension ? association.extension.toLowerCase() : undefined,
filepatternLowercase: association.filepattern ? association.filepattern.toLowerCase() : undefined,
filepatternOnPath: association.filepattern ? association.filepattern.indexOf(common_path["posix"].sep) >= 0 : false
};
}
/**
* Given a file, return the best matching mime type for it
*/
function guessMimeTypes(resource, firstLine) {
var path;
if (resource) {
switch (resource.scheme) {
case network["b" /* Schemas */].file:
path = resource.fsPath;
break;
case network["b" /* Schemas */].data:
var metadata = resources["a" /* DataUri */].parseMetaData(resource);
path = metadata.get(resources["a" /* DataUri */].META_DATA_LABEL);
break;
default:
path = resource.path;
}
}
if (!path) {
return [MIME_UNKNOWN];
}
path = path.toLowerCase();
var filename = Object(common_path["basename"])(path);
// 1.) User configured mappings have highest priority
var configuredMime = guessMimeTypeByPath(path, filename, userRegisteredAssociations);
if (configuredMime) {
return [configuredMime, MIME_TEXT];
}
// 2.) Registered mappings have middle priority
var registeredMime = guessMimeTypeByPath(path, filename, nonUserRegisteredAssociations);
if (registeredMime) {
return [registeredMime, MIME_TEXT];
}
// 3.) Firstline has lowest priority
if (firstLine) {
var firstlineMime = guessMimeTypeByFirstline(firstLine);
if (firstlineMime) {
return [firstlineMime, MIME_TEXT];
}
}
return [MIME_UNKNOWN];
}
function guessMimeTypeByPath(path, filename, associations) {
var filenameMatch = null;
var patternMatch = null;
var extensionMatch = null;
// We want to prioritize associations based on the order they are registered so that the last registered
// association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074
for (var i = associations.length - 1; i >= 0; i--) {
var association = associations[i];
// First exact name match
if (filename === association.filenameLowercase) {
filenameMatch = association;
break; // take it!
}
// Longest pattern match
if (association.filepattern) {
if (!patternMatch || association.filepattern.length > patternMatch.filepattern.length) {
var target = association.filepatternOnPath ? path : filename; // match on full path if pattern contains path separator
if (Object(glob["a" /* match */])(association.filepatternLowercase, target)) {
patternMatch = association;
}
}
}
// Longest extension match
if (association.extension) {
if (!extensionMatch || association.extension.length > extensionMatch.extension.length) {
if (Object(strings["m" /* endsWith */])(filename, association.extensionLowercase)) {
extensionMatch = association;
}
}
}
}
// 1.) Exact name match has second highest prio
if (filenameMatch) {
return filenameMatch.mime;
}
// 2.) Match on pattern
if (patternMatch) {
return patternMatch.mime;
}
// 3.) Match on extension comes next
if (extensionMatch) {
return extensionMatch.mime;
}
return null;
}
function guessMimeTypeByFirstline(firstLine) {
if (Object(strings["P" /* startsWithUTF8BOM */])(firstLine)) {
firstLine = firstLine.substr(1);
}
if (firstLine.length > 0) {
// We want to prioritize associations based on the order they are registered so that the last registered
// association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074
for (var i = registeredAssociations.length - 1; i >= 0; i--) {
var association = registeredAssociations[i];
if (!association.firstline) {
continue;
}
var matches = firstLine.match(association.firstline);
if (matches && matches.length > 0) {
return association.mime;
}
}
}
return null;
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/modesRegistry.js
var modesRegistry = __webpack_require__(129);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js
var common_platform = __webpack_require__(57);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/languagesRegistry.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var languagesRegistry_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var languagesRegistry_hasOwnProperty = Object.prototype.hasOwnProperty;
var languagesRegistry_LanguagesRegistry = /** @class */ (function (_super) {
languagesRegistry_extends(LanguagesRegistry, _super);
function LanguagesRegistry(useModesRegistry, warnOnOverwrite) {
if (useModesRegistry === void 0) { useModesRegistry = true; }
if (warnOnOverwrite === void 0) { warnOnOverwrite = false; }
var _this = _super.call(this) || this;
_this._onDidChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChange = _this._onDidChange.event;
_this._warnOnOverwrite = warnOnOverwrite;
_this._nextLanguageId2 = 1;
_this._languageIdToLanguage = [];
_this._languageToLanguageId = Object.create(null);
_this._languages = {};
_this._mimeTypesMap = {};
_this._nameMap = {};
_this._lowercaseNameMap = {};
if (useModesRegistry) {
_this._initializeFromRegistry();
_this._register(modesRegistry["a" /* ModesRegistry */].onDidChangeLanguages(function (m) { return _this._initializeFromRegistry(); }));
}
return _this;
}
LanguagesRegistry.prototype._initializeFromRegistry = function () {
this._languages = {};
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
var desc = modesRegistry["a" /* ModesRegistry */].getLanguages();
this._registerLanguages(desc);
};
LanguagesRegistry.prototype._registerLanguages = function (desc) {
var _this = this;
for (var _i = 0, desc_1 = desc; _i < desc_1.length; _i++) {
var d = desc_1[_i];
this._registerLanguage(d);
}
// Rebuild fast path maps
this._mimeTypesMap = {};
this._nameMap = {};
this._lowercaseNameMap = {};
Object.keys(this._languages).forEach(function (langId) {
var language = _this._languages[langId];
if (language.name) {
_this._nameMap[language.name] = language.identifier;
}
language.aliases.forEach(function (alias) {
_this._lowercaseNameMap[alias.toLowerCase()] = language.identifier;
});
language.mimetypes.forEach(function (mimetype) {
_this._mimeTypesMap[mimetype] = language.identifier;
});
});
common_platform["a" /* Registry */].as(configurationRegistry["a" /* Extensions */].Configuration).registerOverrideIdentifiers(modesRegistry["a" /* ModesRegistry */].getLanguages().map(function (language) { return language.id; }));
this._onDidChange.fire();
};
LanguagesRegistry.prototype._getLanguageId = function (language) {
if (this._languageToLanguageId[language]) {
return this._languageToLanguageId[language];
}
var languageId = this._nextLanguageId2++;
this._languageIdToLanguage[languageId] = language;
this._languageToLanguageId[language] = languageId;
return languageId;
};
LanguagesRegistry.prototype._registerLanguage = function (lang) {
var langId = lang.id;
var resolvedLanguage;
if (languagesRegistry_hasOwnProperty.call(this._languages, langId)) {
resolvedLanguage = this._languages[langId];
}
else {
var languageId = this._getLanguageId(langId);
resolvedLanguage = {
identifier: new modes["r" /* LanguageIdentifier */](langId, languageId),
name: null,
mimetypes: [],
aliases: [],
extensions: [],
filenames: [],
configurationFiles: []
};
this._languages[langId] = resolvedLanguage;
}
this._mergeLanguage(resolvedLanguage, lang);
};
LanguagesRegistry.prototype._mergeLanguage = function (resolvedLanguage, lang) {
var _a;
var langId = lang.id;
var primaryMime = null;
if (Array.isArray(lang.mimetypes) && lang.mimetypes.length > 0) {
(_a = resolvedLanguage.mimetypes).push.apply(_a, lang.mimetypes);
primaryMime = lang.mimetypes[0];
}
if (!primaryMime) {
primaryMime = "text/x-" + langId;
resolvedLanguage.mimetypes.push(primaryMime);
}
if (Array.isArray(lang.extensions)) {
for (var _i = 0, _b = lang.extensions; _i < _b.length; _i++) {
var extension = _b[_i];
registerTextMime({ id: langId, mime: primaryMime, extension: extension }, this._warnOnOverwrite);
resolvedLanguage.extensions.push(extension);
}
}
if (Array.isArray(lang.filenames)) {
for (var _c = 0, _d = lang.filenames; _c < _d.length; _c++) {
var filename = _d[_c];
registerTextMime({ id: langId, mime: primaryMime, filename: filename }, this._warnOnOverwrite);
resolvedLanguage.filenames.push(filename);
}
}
if (Array.isArray(lang.filenamePatterns)) {
for (var _e = 0, _f = lang.filenamePatterns; _e < _f.length; _e++) {
var filenamePattern = _f[_e];
registerTextMime({ id: langId, mime: primaryMime, filepattern: filenamePattern }, this._warnOnOverwrite);
}
}
if (typeof lang.firstLine === 'string' && lang.firstLine.length > 0) {
var firstLineRegexStr = lang.firstLine;
if (firstLineRegexStr.charAt(0) !== '^') {
firstLineRegexStr = '^' + firstLineRegexStr;
}
try {
var firstLineRegex = new RegExp(firstLineRegexStr);
if (!strings["I" /* regExpLeadsToEndlessLoop */](firstLineRegex)) {
registerTextMime({ id: langId, mime: primaryMime, firstline: firstLineRegex }, this._warnOnOverwrite);
}
}
catch (err) {
// Most likely, the regex was bad
Object(errors["e" /* onUnexpectedError */])(err);
}
}
resolvedLanguage.aliases.push(langId);
var langAliases = null;
if (typeof lang.aliases !== 'undefined' && Array.isArray(lang.aliases)) {
if (lang.aliases.length === 0) {
// signal that this language should not get a name
langAliases = [null];
}
else {
langAliases = lang.aliases;
}
}
if (langAliases !== null) {
for (var _g = 0, langAliases_1 = langAliases; _g < langAliases_1.length; _g++) {
var langAlias = langAliases_1[_g];
if (!langAlias || langAlias.length === 0) {
continue;
}
resolvedLanguage.aliases.push(langAlias);
}
}
var containsAliases = (langAliases !== null && langAliases.length > 0);
if (containsAliases && langAliases[0] === null) {
// signal that this language should not get a name
}
else {
var bestName = (containsAliases ? langAliases[0] : null) || langId;
if (containsAliases || !resolvedLanguage.name) {
resolvedLanguage.name = bestName;
}
}
if (lang.configuration) {
resolvedLanguage.configurationFiles.push(lang.configuration);
}
};
LanguagesRegistry.prototype.isRegisteredMode = function (mimetypeOrModeId) {
// Is this a known mime type ?
if (languagesRegistry_hasOwnProperty.call(this._mimeTypesMap, mimetypeOrModeId)) {
return true;
}
// Is this a known mode id ?
return languagesRegistry_hasOwnProperty.call(this._languages, mimetypeOrModeId);
};
LanguagesRegistry.prototype.getModeIdForLanguageNameLowercase = function (languageNameLower) {
if (!languagesRegistry_hasOwnProperty.call(this._lowercaseNameMap, languageNameLower)) {
return null;
}
return this._lowercaseNameMap[languageNameLower].language;
};
LanguagesRegistry.prototype.extractModeIds = function (commaSeparatedMimetypesOrCommaSeparatedIds) {
var _this = this;
if (!commaSeparatedMimetypesOrCommaSeparatedIds) {
return [];
}
return (commaSeparatedMimetypesOrCommaSeparatedIds.
split(',').
map(function (mimeTypeOrId) { return mimeTypeOrId.trim(); }).
map(function (mimeTypeOrId) {
if (languagesRegistry_hasOwnProperty.call(_this._mimeTypesMap, mimeTypeOrId)) {
return _this._mimeTypesMap[mimeTypeOrId].language;
}
return mimeTypeOrId;
}).
filter(function (modeId) {
return languagesRegistry_hasOwnProperty.call(_this._languages, modeId);
}));
};
LanguagesRegistry.prototype.getLanguageIdentifier = function (_modeId) {
if (_modeId === nullMode["b" /* NULL_MODE_ID */] || _modeId === 0 /* Null */) {
return nullMode["a" /* NULL_LANGUAGE_IDENTIFIER */];
}
var modeId;
if (typeof _modeId === 'string') {
modeId = _modeId;
}
else {
modeId = this._languageIdToLanguage[_modeId];
if (!modeId) {
return null;
}
}
if (!languagesRegistry_hasOwnProperty.call(this._languages, modeId)) {
return null;
}
return this._languages[modeId].identifier;
};
LanguagesRegistry.prototype.getModeIdsFromFilepathOrFirstLine = function (resource, firstLine) {
if (!resource && !firstLine) {
return [];
}
var mimeTypes = guessMimeTypes(resource, firstLine);
return this.extractModeIds(mimeTypes.join(','));
};
return LanguagesRegistry;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/modeServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var modeServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var modeServiceImpl_LanguageSelection = /** @class */ (function (_super) {
modeServiceImpl_extends(LanguageSelection, _super);
function LanguageSelection(onLanguagesMaybeChanged, selector) {
var _this = _super.call(this) || this;
_this._onDidChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChange = _this._onDidChange.event;
_this._selector = selector;
_this.languageIdentifier = _this._selector();
_this._register(onLanguagesMaybeChanged(function () { return _this._evaluate(); }));
return _this;
}
LanguageSelection.prototype._evaluate = function () {
var languageIdentifier = this._selector();
if (languageIdentifier.id === this.languageIdentifier.id) {
// no change
return;
}
this.languageIdentifier = languageIdentifier;
this._onDidChange.fire(this.languageIdentifier);
};
return LanguageSelection;
}(lifecycle["a" /* Disposable */]));
var modeServiceImpl_ModeServiceImpl = /** @class */ (function () {
function ModeServiceImpl(warnOnOverwrite) {
var _this = this;
if (warnOnOverwrite === void 0) { warnOnOverwrite = false; }
this._onDidCreateMode = new common_event["a" /* Emitter */]();
this.onDidCreateMode = this._onDidCreateMode.event;
this._onLanguagesMaybeChanged = new common_event["a" /* Emitter */]();
this.onLanguagesMaybeChanged = this._onLanguagesMaybeChanged.event;
this._instantiatedModes = {};
this._registry = new languagesRegistry_LanguagesRegistry(true, warnOnOverwrite);
this._registry.onDidChange(function () { return _this._onLanguagesMaybeChanged.fire(); });
}
ModeServiceImpl.prototype.isRegisteredMode = function (mimetypeOrModeId) {
return this._registry.isRegisteredMode(mimetypeOrModeId);
};
ModeServiceImpl.prototype.getModeIdForLanguageName = function (alias) {
return this._registry.getModeIdForLanguageNameLowercase(alias);
};
ModeServiceImpl.prototype.getModeIdByFilepathOrFirstLine = function (resource, firstLine) {
var modeIds = this._registry.getModeIdsFromFilepathOrFirstLine(resource, firstLine);
return Object(arrays["l" /* firstOrDefault */])(modeIds, null);
};
ModeServiceImpl.prototype.getModeId = function (commaSeparatedMimetypesOrCommaSeparatedIds) {
var modeIds = this._registry.extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds);
return Object(arrays["l" /* firstOrDefault */])(modeIds, null);
};
ModeServiceImpl.prototype.getLanguageIdentifier = function (modeId) {
return this._registry.getLanguageIdentifier(modeId);
};
// --- instantiation
ModeServiceImpl.prototype.create = function (commaSeparatedMimetypesOrCommaSeparatedIds) {
var _this = this;
return new modeServiceImpl_LanguageSelection(this.onLanguagesMaybeChanged, function () {
var modeId = _this.getModeId(commaSeparatedMimetypesOrCommaSeparatedIds);
return _this._createModeAndGetLanguageIdentifier(modeId);
});
};
ModeServiceImpl.prototype.createByFilepathOrFirstLine = function (resource, firstLine) {
var _this = this;
return new modeServiceImpl_LanguageSelection(this.onLanguagesMaybeChanged, function () {
var modeId = _this.getModeIdByFilepathOrFirstLine(resource, firstLine);
return _this._createModeAndGetLanguageIdentifier(modeId);
});
};
ModeServiceImpl.prototype._createModeAndGetLanguageIdentifier = function (modeId) {
// Fall back to plain text if no mode was found
var languageIdentifier = this.getLanguageIdentifier(modeId || 'plaintext') || nullMode["a" /* NULL_LANGUAGE_IDENTIFIER */];
this._getOrCreateMode(languageIdentifier.language);
return languageIdentifier;
};
ModeServiceImpl.prototype.triggerMode = function (commaSeparatedMimetypesOrCommaSeparatedIds) {
var modeId = this.getModeId(commaSeparatedMimetypesOrCommaSeparatedIds);
// Fall back to plain text if no mode was found
this._getOrCreateMode(modeId || 'plaintext');
};
ModeServiceImpl.prototype._getOrCreateMode = function (modeId) {
if (!this._instantiatedModes.hasOwnProperty(modeId)) {
var languageIdentifier = this.getLanguageIdentifier(modeId) || nullMode["a" /* NULL_LANGUAGE_IDENTIFIER */];
this._instantiatedModes[modeId] = new FrankensteinMode(languageIdentifier);
this._onDidCreateMode.fire(this._instantiatedModes[modeId]);
}
return this._instantiatedModes[modeId];
};
return ModeServiceImpl;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js + 9 modules
var textModel = __webpack_require__(30);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/tokensStore.js
var tokensStore = __webpack_require__(124);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/modelServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var modelServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var modelServiceImpl_decorate = (undefined && undefined.__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;
};
var modelServiceImpl_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
function MODEL_ID(resource) {
return resource.toString();
}
var modelServiceImpl_ModelData = /** @class */ (function () {
function ModelData(model, onWillDispose, onDidChangeLanguage) {
this._modelEventListeners = new lifecycle["b" /* DisposableStore */]();
this.model = model;
this._languageSelection = null;
this._languageSelectionListener = null;
this._modelEventListeners.add(model.onWillDispose(function () { return onWillDispose(model); }));
this._modelEventListeners.add(model.onDidChangeLanguage(function (e) { return onDidChangeLanguage(model, e); }));
}
ModelData.prototype._disposeLanguageSelection = function () {
if (this._languageSelectionListener) {
this._languageSelectionListener.dispose();
this._languageSelectionListener = null;
}
if (this._languageSelection) {
this._languageSelection.dispose();
this._languageSelection = null;
}
};
ModelData.prototype.dispose = function () {
this._modelEventListeners.dispose();
this._disposeLanguageSelection();
};
ModelData.prototype.setLanguage = function (languageSelection) {
var _this = this;
this._disposeLanguageSelection();
this._languageSelection = languageSelection;
this._languageSelectionListener = this._languageSelection.onDidChange(function () { return _this.model.setMode(languageSelection.languageIdentifier); });
this.model.setMode(languageSelection.languageIdentifier);
};
return ModelData;
}());
var DEFAULT_EOL = (platform["d" /* isLinux */] || platform["e" /* isMacintosh */]) ? 1 /* LF */ : 2 /* CRLF */;
var modelServiceImpl_ModelServiceImpl = /** @class */ (function (_super) {
modelServiceImpl_extends(ModelServiceImpl, _super);
function ModelServiceImpl(configurationService, resourcePropertiesService, themeService, logService) {
var _this = _super.call(this) || this;
_this._onModelAdded = _this._register(new common_event["a" /* Emitter */]());
_this.onModelAdded = _this._onModelAdded.event;
_this._onModelRemoved = _this._register(new common_event["a" /* Emitter */]());
_this.onModelRemoved = _this._onModelRemoved.event;
_this._onModelModeChanged = _this._register(new common_event["a" /* Emitter */]());
_this.onModelModeChanged = _this._onModelModeChanged.event;
_this._configurationService = configurationService;
_this._resourcePropertiesService = resourcePropertiesService;
_this._models = {};
_this._modelCreationOptionsByLanguageAndResource = Object.create(null);
_this._configurationServiceSubscription = _this._configurationService.onDidChangeConfiguration(function (e) { return _this._updateModelOptions(); });
_this._updateModelOptions();
_this._register(new SemanticColoringFeature(_this, themeService, configurationService, logService));
return _this;
}
ModelServiceImpl._readModelOptions = function (config, isForSimpleWidget) {
var tabSize = editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].tabSize;
if (config.editor && typeof config.editor.tabSize !== 'undefined') {
var parsedTabSize = parseInt(config.editor.tabSize, 10);
if (!isNaN(parsedTabSize)) {
tabSize = parsedTabSize;
}
if (tabSize < 1) {
tabSize = 1;
}
}
var indentSize = tabSize;
if (config.editor && typeof config.editor.indentSize !== 'undefined' && config.editor.indentSize !== 'tabSize') {
var parsedIndentSize = parseInt(config.editor.indentSize, 10);
if (!isNaN(parsedIndentSize)) {
indentSize = parsedIndentSize;
}
if (indentSize < 1) {
indentSize = 1;
}
}
var insertSpaces = editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].insertSpaces;
if (config.editor && typeof config.editor.insertSpaces !== 'undefined') {
insertSpaces = (config.editor.insertSpaces === 'false' ? false : Boolean(config.editor.insertSpaces));
}
var newDefaultEOL = DEFAULT_EOL;
var eol = config.eol;
if (eol === '\r\n') {
newDefaultEOL = 2 /* CRLF */;
}
else if (eol === '\n') {
newDefaultEOL = 1 /* LF */;
}
var trimAutoWhitespace = editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].trimAutoWhitespace;
if (config.editor && typeof config.editor.trimAutoWhitespace !== 'undefined') {
trimAutoWhitespace = (config.editor.trimAutoWhitespace === 'false' ? false : Boolean(config.editor.trimAutoWhitespace));
}
var detectIndentation = editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].detectIndentation;
if (config.editor && typeof config.editor.detectIndentation !== 'undefined') {
detectIndentation = (config.editor.detectIndentation === 'false' ? false : Boolean(config.editor.detectIndentation));
}
var largeFileOptimizations = editorOptions["c" /* EDITOR_MODEL_DEFAULTS */].largeFileOptimizations;
if (config.editor && typeof config.editor.largeFileOptimizations !== 'undefined') {
largeFileOptimizations = (config.editor.largeFileOptimizations === 'false' ? false : Boolean(config.editor.largeFileOptimizations));
}
return {
isForSimpleWidget: isForSimpleWidget,
tabSize: tabSize,
indentSize: indentSize,
insertSpaces: insertSpaces,
detectIndentation: detectIndentation,
defaultEOL: newDefaultEOL,
trimAutoWhitespace: trimAutoWhitespace,
largeFileOptimizations: largeFileOptimizations
};
};
ModelServiceImpl.prototype.getCreationOptions = function (language, resource, isForSimpleWidget) {
var creationOptions = this._modelCreationOptionsByLanguageAndResource[language + resource];
if (!creationOptions) {
var editor = this._configurationService.getValue('editor', { overrideIdentifier: language, resource: resource });
var eol = this._resourcePropertiesService.getEOL(resource, language);
creationOptions = ModelServiceImpl._readModelOptions({ editor: editor, eol: eol }, isForSimpleWidget);
this._modelCreationOptionsByLanguageAndResource[language + resource] = creationOptions;
}
return creationOptions;
};
ModelServiceImpl.prototype._updateModelOptions = function () {
var oldOptionsByLanguageAndResource = this._modelCreationOptionsByLanguageAndResource;
this._modelCreationOptionsByLanguageAndResource = Object.create(null);
// Update options on all models
var keys = Object.keys(this._models);
for (var i = 0, len = keys.length; i < len; i++) {
var modelId = keys[i];
var modelData = this._models[modelId];
var language = modelData.model.getLanguageIdentifier().language;
var uri = modelData.model.uri;
var oldOptions = oldOptionsByLanguageAndResource[language + uri];
var newOptions = this.getCreationOptions(language, uri, modelData.model.isForSimpleWidget);
ModelServiceImpl._setModelOptionsForModel(modelData.model, newOptions, oldOptions);
}
};
ModelServiceImpl._setModelOptionsForModel = function (model, newOptions, currentOptions) {
if (currentOptions && currentOptions.defaultEOL !== newOptions.defaultEOL && model.getLineCount() === 1) {
model.setEOL(newOptions.defaultEOL === 1 /* LF */ ? 0 /* LF */ : 1 /* CRLF */);
}
if (currentOptions
&& (currentOptions.detectIndentation === newOptions.detectIndentation)
&& (currentOptions.insertSpaces === newOptions.insertSpaces)
&& (currentOptions.tabSize === newOptions.tabSize)
&& (currentOptions.indentSize === newOptions.indentSize)
&& (currentOptions.trimAutoWhitespace === newOptions.trimAutoWhitespace)) {
// Same indent opts, no need to touch the model
return;
}
if (newOptions.detectIndentation) {
model.detectIndentation(newOptions.insertSpaces, newOptions.tabSize);
model.updateOptions({
trimAutoWhitespace: newOptions.trimAutoWhitespace
});
}
else {
model.updateOptions({
insertSpaces: newOptions.insertSpaces,
tabSize: newOptions.tabSize,
indentSize: newOptions.indentSize,
trimAutoWhitespace: newOptions.trimAutoWhitespace
});
}
};
ModelServiceImpl.prototype.dispose = function () {
this._configurationServiceSubscription.dispose();
_super.prototype.dispose.call(this);
};
// --- begin IModelService
ModelServiceImpl.prototype._createModelData = function (value, languageIdentifier, resource, isForSimpleWidget) {
var _this = this;
// create & save the model
var options = this.getCreationOptions(languageIdentifier.language, resource, isForSimpleWidget);
var model = new textModel["b" /* TextModel */](value, options, languageIdentifier, resource);
var modelId = MODEL_ID(model.uri);
if (this._models[modelId]) {
// There already exists a model with this id => this is a programmer error
throw new Error('ModelService: Cannot add model because it already exists!');
}
var modelData = new modelServiceImpl_ModelData(model, function (model) { return _this._onWillDispose(model); }, function (model, e) { return _this._onDidChangeLanguage(model, e); });
this._models[modelId] = modelData;
return modelData;
};
ModelServiceImpl.prototype.createModel = function (value, languageSelection, resource, isForSimpleWidget) {
if (isForSimpleWidget === void 0) { isForSimpleWidget = false; }
var modelData;
if (languageSelection) {
modelData = this._createModelData(value, languageSelection.languageIdentifier, resource, isForSimpleWidget);
this.setMode(modelData.model, languageSelection);
}
else {
modelData = this._createModelData(value, modesRegistry["b" /* PLAINTEXT_LANGUAGE_IDENTIFIER */], resource, isForSimpleWidget);
}
this._onModelAdded.fire(modelData.model);
return modelData.model;
};
ModelServiceImpl.prototype.setMode = function (model, languageSelection) {
if (!languageSelection) {
return;
}
var modelData = this._models[MODEL_ID(model.uri)];
if (!modelData) {
return;
}
modelData.setLanguage(languageSelection);
};
ModelServiceImpl.prototype.getModels = function () {
var ret = [];
var keys = Object.keys(this._models);
for (var i = 0, len = keys.length; i < len; i++) {
var modelId = keys[i];
ret.push(this._models[modelId].model);
}
return ret;
};
ModelServiceImpl.prototype.getModel = function (resource) {
var modelId = MODEL_ID(resource);
var modelData = this._models[modelId];
if (!modelData) {
return null;
}
return modelData.model;
};
// --- end IModelService
ModelServiceImpl.prototype._onWillDispose = function (model) {
var modelId = MODEL_ID(model.uri);
var modelData = this._models[modelId];
delete this._models[modelId];
modelData.dispose();
// clean up cache
delete this._modelCreationOptionsByLanguageAndResource[model.getLanguageIdentifier().language + model.uri];
this._onModelRemoved.fire(model);
};
ModelServiceImpl.prototype._onDidChangeLanguage = function (model, e) {
var oldModeId = e.oldLanguage;
var newModeId = model.getLanguageIdentifier().language;
var oldOptions = this.getCreationOptions(oldModeId, model.uri, model.isForSimpleWidget);
var newOptions = this.getCreationOptions(newModeId, model.uri, model.isForSimpleWidget);
ModelServiceImpl._setModelOptionsForModel(model, newOptions, oldOptions);
this._onModelModeChanged.fire({ model: model, oldModeId: oldModeId });
};
ModelServiceImpl = modelServiceImpl_decorate([
modelServiceImpl_param(0, common_configuration["a" /* IConfigurationService */]),
modelServiceImpl_param(1, textResourceConfigurationService["b" /* ITextResourcePropertiesService */]),
modelServiceImpl_param(2, common_themeService["c" /* IThemeService */]),
modelServiceImpl_param(3, log["a" /* ILogService */])
], ModelServiceImpl);
return ModelServiceImpl;
}(lifecycle["a" /* Disposable */]));
var SemanticColoringFeature = /** @class */ (function (_super) {
modelServiceImpl_extends(SemanticColoringFeature, _super);
function SemanticColoringFeature(modelService, themeService, configurationService, logService) {
var _this = _super.call(this) || this;
_this._configurationService = configurationService;
_this._watchers = Object.create(null);
_this._semanticStyling = _this._register(new SemanticStyling(themeService, logService));
var isSemanticColoringEnabled = function (model) {
var options = configurationService.getValue(SemanticColoringFeature.SETTING_ID, { overrideIdentifier: model.getLanguageIdentifier().language, resource: model.uri });
return options && options.enabled;
};
var register = function (model) {
_this._watchers[model.uri.toString()] = new modelServiceImpl_ModelSemanticColoring(model, themeService, _this._semanticStyling);
};
var deregister = function (model, modelSemanticColoring) {
modelSemanticColoring.dispose();
delete _this._watchers[model.uri.toString()];
};
_this._register(modelService.onModelAdded(function (model) {
if (isSemanticColoringEnabled(model)) {
register(model);
}
}));
_this._register(modelService.onModelRemoved(function (model) {
var curr = _this._watchers[model.uri.toString()];
if (curr) {
deregister(model, curr);
}
}));
_this._configurationService.onDidChangeConfiguration(function (e) {
if (e.affectsConfiguration(SemanticColoringFeature.SETTING_ID)) {
for (var _i = 0, _a = modelService.getModels(); _i < _a.length; _i++) {
var model = _a[_i];
var curr = _this._watchers[model.uri.toString()];
if (isSemanticColoringEnabled(model)) {
if (!curr) {
register(model);
}
}
else {
if (curr) {
deregister(model, curr);
}
}
}
}
});
return _this;
}
SemanticColoringFeature.SETTING_ID = 'editor.semanticHighlighting';
return SemanticColoringFeature;
}(lifecycle["a" /* Disposable */]));
var SemanticStyling = /** @class */ (function (_super) {
modelServiceImpl_extends(SemanticStyling, _super);
function SemanticStyling(_themeService, _logService) {
var _this = _super.call(this) || this;
_this._themeService = _themeService;
_this._logService = _logService;
_this._caches = new WeakMap();
if (_this._themeService) {
// workaround for tests which use undefined... :/
_this._register(_this._themeService.onThemeChange(function () {
_this._caches = new WeakMap();
}));
}
return _this;
}
SemanticStyling.prototype.get = function (provider) {
if (!this._caches.has(provider)) {
this._caches.set(provider, new modelServiceImpl_SemanticColoringProviderStyling(provider.getLegend(), this._themeService, this._logService));
}
return this._caches.get(provider);
};
return SemanticStyling;
}(lifecycle["a" /* Disposable */]));
var HashTableEntry = /** @class */ (function () {
function HashTableEntry(tokenTypeIndex, tokenModifierSet, metadata) {
this.tokenTypeIndex = tokenTypeIndex;
this.tokenModifierSet = tokenModifierSet;
this.metadata = metadata;
this.next = null;
}
return HashTableEntry;
}());
var HashTable = /** @class */ (function () {
function HashTable() {
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);
}
HashTable._nullOutEntries = function (entries, length) {
for (var i = 0; i < length; i++) {
entries[i] = null;
}
};
HashTable.prototype._hashFunc = function (tokenTypeIndex, tokenModifierSet) {
return ((((tokenTypeIndex << 5) - tokenTypeIndex) + tokenModifierSet) | 0) % this._currentLength; // tokenTypeIndex * 31 + tokenModifierSet, keep as int32
};
HashTable.prototype.get = function (tokenTypeIndex, tokenModifierSet) {
var hash = this._hashFunc(tokenTypeIndex, tokenModifierSet);
var p = this._elements[hash];
while (p) {
if (p.tokenTypeIndex === tokenTypeIndex && p.tokenModifierSet === tokenModifierSet) {
return p;
}
p = p.next;
}
return null;
};
HashTable.prototype.add = function (tokenTypeIndex, tokenModifierSet, metadata) {
this._elementsCount++;
if (this._growCount !== 0 && this._elementsCount >= this._growCount) {
// expand!
var 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 (var _i = 0, oldElements_1 = oldElements; _i < oldElements_1.length; _i++) {
var first = oldElements_1[_i];
var p = first;
while (p) {
var oldNext = p.next;
p.next = null;
this._add(p);
p = oldNext;
}
}
}
this._add(new HashTableEntry(tokenTypeIndex, tokenModifierSet, metadata));
};
HashTable.prototype._add = function (element) {
var hash = this._hashFunc(element.tokenTypeIndex, element.tokenModifierSet);
element.next = this._elements[hash];
this._elements[hash] = element;
};
HashTable._SIZES = [3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143];
return HashTable;
}());
var modelServiceImpl_SemanticColoringProviderStyling = /** @class */ (function () {
function SemanticColoringProviderStyling(_legend, _themeService, _logService) {
this._legend = _legend;
this._themeService = _themeService;
this._logService = _logService;
this._hashTable = new HashTable();
}
SemanticColoringProviderStyling.prototype.getMetadata = function (tokenTypeIndex, tokenModifierSet) {
var entry = this._hashTable.get(tokenTypeIndex, tokenModifierSet);
var metadata;
if (entry) {
metadata = entry.metadata;
}
else {
var tokenType = this._legend.tokenTypes[tokenTypeIndex];
var tokenModifiers = [];
var modifierSet = tokenModifierSet;
for (var modifierIndex = 0; modifierSet > 0 && modifierIndex < this._legend.tokenModifiers.length; modifierIndex++) {
if (modifierSet & 1) {
tokenModifiers.push(this._legend.tokenModifiers[modifierIndex]);
}
modifierSet = modifierSet >> 1;
}
var tokenStyle = this._themeService.getTheme().getTokenStyleMetadata(tokenType, tokenModifiers);
if (typeof tokenStyle === 'undefined') {
metadata = 2147483647 /* NO_STYLING */;
}
else {
metadata = 0;
if (typeof tokenStyle.italic !== 'undefined') {
var italicBit = (tokenStyle.italic ? 1 /* Italic */ : 0) << 11 /* FONT_STYLE_OFFSET */;
metadata |= italicBit | 1 /* SEMANTIC_USE_ITALIC */;
}
if (typeof tokenStyle.bold !== 'undefined') {
var boldBit = (tokenStyle.bold ? 2 /* Bold */ : 0) << 11 /* FONT_STYLE_OFFSET */;
metadata |= boldBit | 2 /* SEMANTIC_USE_BOLD */;
}
if (typeof tokenStyle.underline !== 'undefined') {
var underlineBit = (tokenStyle.underline ? 4 /* Underline */ : 0) << 11 /* FONT_STYLE_OFFSET */;
metadata |= underlineBit | 4 /* SEMANTIC_USE_UNDERLINE */;
}
if (tokenStyle.foreground) {
var foregroundBits = (tokenStyle.foreground) << 14 /* FOREGROUND_OFFSET */;
metadata |= foregroundBits | 8 /* SEMANTIC_USE_FOREGROUND */;
}
if (metadata === 0) {
// Nothing!
metadata = 2147483647 /* NO_STYLING */;
}
}
this._hashTable.add(tokenTypeIndex, tokenModifierSet, metadata);
}
if (this._logService.getLevel() === log["b" /* LogLevel */].Trace) {
var type = this._legend.tokenTypes[tokenTypeIndex];
var modifiers = tokenModifierSet ? ' ' + this._legend.tokenModifiers.filter(function (_, i) { return tokenModifierSet & (1 << i); }).join(' ') : '';
this._logService.trace("tokenStyleMetadata " + (entry ? '[CACHED] ' : '') + type + modifiers + ": foreground " + modes["A" /* TokenMetadata */].getForeground(metadata) + ", fontStyle " + modes["A" /* TokenMetadata */].getFontStyle(metadata).toString(2));
}
return metadata;
};
return SemanticColoringProviderStyling;
}());
var SemanticTokensResponse = /** @class */ (function () {
function SemanticTokensResponse(_provider, resultId, data) {
this._provider = _provider;
this.resultId = resultId;
this.data = data;
}
SemanticTokensResponse.prototype.dispose = function () {
this._provider.releaseDocumentSemanticTokens(this.resultId);
};
return SemanticTokensResponse;
}());
var modelServiceImpl_ModelSemanticColoring = /** @class */ (function (_super) {
modelServiceImpl_extends(ModelSemanticColoring, _super);
function ModelSemanticColoring(model, themeService, stylingProvider) {
var _this = _super.call(this) || this;
_this._isDisposed = false;
_this._model = model;
_this._semanticStyling = stylingProvider;
_this._fetchSemanticTokens = _this._register(new common_async["d" /* RunOnceScheduler */](function () { return _this._fetchSemanticTokensNow(); }, 300));
_this._currentResponse = null;
_this._currentRequestCancellationTokenSource = null;
_this._register(_this._model.onDidChangeContent(function (e) {
if (!_this._fetchSemanticTokens.isScheduled()) {
_this._fetchSemanticTokens.schedule();
}
}));
_this._register(modes["l" /* DocumentSemanticTokensProviderRegistry */].onDidChange(function (e) { return _this._fetchSemanticTokens.schedule(); }));
if (themeService) {
// workaround for tests which use undefined... :/
_this._register(themeService.onThemeChange(function (_) {
// clear out existing tokens
_this._setSemanticTokens(null, null, null, []);
_this._fetchSemanticTokens.schedule();
}));
}
_this._fetchSemanticTokens.schedule(0);
return _this;
}
ModelSemanticColoring.prototype.dispose = function () {
if (this._currentResponse) {
this._currentResponse.dispose();
this._currentResponse = null;
}
if (this._currentRequestCancellationTokenSource) {
this._currentRequestCancellationTokenSource.cancel();
this._currentRequestCancellationTokenSource = null;
}
this._setSemanticTokens(null, null, null, []);
this._isDisposed = true;
_super.prototype.dispose.call(this);
};
ModelSemanticColoring.prototype._fetchSemanticTokensNow = function () {
var _this = this;
if (this._currentRequestCancellationTokenSource) {
// there is already a request running, let it finish...
return;
}
var provider = this._getSemanticColoringProvider();
if (!provider) {
return;
}
this._currentRequestCancellationTokenSource = new cancellation["b" /* CancellationTokenSource */]();
var pendingChanges = [];
var contentChangeListener = this._model.onDidChangeContent(function (e) {
pendingChanges.push(e);
});
var styling = this._semanticStyling.get(provider);
var lastResultId = this._currentResponse ? this._currentResponse.resultId || null : null;
var request = Promise.resolve(provider.provideDocumentSemanticTokens(this._model, lastResultId, this._currentRequestCancellationTokenSource.token));
request.then(function (res) {
_this._currentRequestCancellationTokenSource = null;
contentChangeListener.dispose();
_this._setSemanticTokens(provider, res || null, styling, pendingChanges);
}, function (err) {
if (!err || typeof err.message !== 'string' || err.message.indexOf('busy') === -1) {
errors["e" /* onUnexpectedError */](err);
}
// Semantic tokens eats up all errors and considers errors to mean that the result is temporarily not available
// The API does not have a special error kind to express this...
_this._currentRequestCancellationTokenSource = null;
contentChangeListener.dispose();
if (pendingChanges.length > 0) {
// More changes occurred while the request was running
if (!_this._fetchSemanticTokens.isScheduled()) {
_this._fetchSemanticTokens.schedule();
}
}
});
};
ModelSemanticColoring._isSemanticTokens = function (v) {
return v && !!(v.data);
};
ModelSemanticColoring._isSemanticTokensEdits = function (v) {
return v && Array.isArray(v.edits);
};
ModelSemanticColoring._copy = function (src, srcOffset, dest, destOffset, length) {
for (var i = 0; i < length; i++) {
dest[destOffset + i] = src[srcOffset + i];
}
};
ModelSemanticColoring.prototype._setSemanticTokens = function (provider, tokens, styling, pendingChanges) {
var currentResponse = this._currentResponse;
if (this._currentResponse) {
this._currentResponse.dispose();
this._currentResponse = null;
}
if (this._isDisposed) {
// disposed!
if (provider && tokens) {
provider.releaseDocumentSemanticTokens(tokens.resultId);
}
return;
}
if (!provider || !tokens || !styling) {
this._model.setSemanticTokens(null);
return;
}
if (ModelSemanticColoring._isSemanticTokensEdits(tokens)) {
if (!currentResponse) {
// not possible!
this._model.setSemanticTokens(null);
return;
}
if (tokens.edits.length === 0) {
// nothing to do!
tokens = {
resultId: tokens.resultId,
data: currentResponse.data
};
}
else {
var deltaLength = 0;
for (var _i = 0, _a = tokens.edits; _i < _a.length; _i++) {
var edit = _a[_i];
deltaLength += (edit.data ? edit.data.length : 0) - edit.deleteCount;
}
var srcData = currentResponse.data;
var destData = new Uint32Array(srcData.length + deltaLength);
var srcLastStart = srcData.length;
var destLastStart = destData.length;
for (var i = tokens.edits.length - 1; i >= 0; i--) {
var edit = tokens.edits[i];
var copyCount = srcLastStart - (edit.start + edit.deleteCount);
if (copyCount > 0) {
ModelSemanticColoring._copy(srcData, srcLastStart - copyCount, destData, destLastStart - copyCount, copyCount);
destLastStart -= copyCount;
}
if (edit.data) {
ModelSemanticColoring._copy(edit.data, 0, destData, destLastStart - edit.data.length, edit.data.length);
destLastStart -= edit.data.length;
}
srcLastStart = edit.start;
}
if (srcLastStart > 0) {
ModelSemanticColoring._copy(srcData, 0, destData, 0, srcLastStart);
}
tokens = {
resultId: tokens.resultId,
data: destData
};
}
}
if (ModelSemanticColoring._isSemanticTokens(tokens)) {
this._currentResponse = new SemanticTokensResponse(provider, tokens.resultId, tokens.data);
var srcData = tokens.data;
var tokenCount = (tokens.data.length / 5) | 0;
var tokensPerArea = Math.max(Math.ceil(tokenCount / 1024 /* DesiredMaxAreas */), 400 /* DesiredTokensPerArea */);
var result = [];
var tokenIndex = 0;
var lastLineNumber = 1;
var lastStartCharacter = 0;
while (tokenIndex < tokenCount) {
var tokenStartIndex = tokenIndex;
var tokenEndIndex = Math.min(tokenStartIndex + tokensPerArea, tokenCount);
// Keep tokens on the same line in the same area...
if (tokenEndIndex < tokenCount) {
var smallTokenEndIndex = tokenEndIndex;
while (smallTokenEndIndex - 1 > tokenStartIndex && srcData[5 * smallTokenEndIndex] === 0) {
smallTokenEndIndex--;
}
if (smallTokenEndIndex - 1 === tokenStartIndex) {
// there are so many tokens on this line that our area would be empty, we must now go right
var bigTokenEndIndex = tokenEndIndex;
while (bigTokenEndIndex + 1 < tokenCount && srcData[5 * bigTokenEndIndex] === 0) {
bigTokenEndIndex++;
}
tokenEndIndex = bigTokenEndIndex;
}
else {
tokenEndIndex = smallTokenEndIndex;
}
}
var destData = new Uint32Array((tokenEndIndex - tokenStartIndex) * 4);
var destOffset = 0;
var areaLine = 0;
while (tokenIndex < tokenEndIndex) {
var srcOffset = 5 * tokenIndex;
var deltaLine = srcData[srcOffset];
var deltaCharacter = srcData[srcOffset + 1];
var lineNumber = lastLineNumber + deltaLine;
var startCharacter = (deltaLine === 0 ? lastStartCharacter + deltaCharacter : deltaCharacter);
var length_1 = srcData[srcOffset + 2];
var tokenTypeIndex = srcData[srcOffset + 3];
var tokenModifierSet = srcData[srcOffset + 4];
var metadata = styling.getMetadata(tokenTypeIndex, tokenModifierSet);
if (metadata !== 2147483647 /* NO_STYLING */) {
if (areaLine === 0) {
areaLine = lineNumber;
}
destData[destOffset] = lineNumber - areaLine;
destData[destOffset + 1] = startCharacter;
destData[destOffset + 2] = startCharacter + length_1;
destData[destOffset + 3] = metadata;
destOffset += 4;
}
lastLineNumber = lineNumber;
lastStartCharacter = startCharacter;
tokenIndex++;
}
if (destOffset !== destData.length) {
destData = destData.subarray(0, destOffset);
}
var tokens_1 = new tokensStore["a" /* MultilineTokens2 */](areaLine, new tokensStore["c" /* SparseEncodedTokens */](destData));
result.push(tokens_1);
}
// Adjust incoming semantic tokens
if (pendingChanges.length > 0) {
// More changes occurred while the request was running
// We need to:
// 1. Adjust incoming semantic tokens
// 2. Request them again
for (var _b = 0, pendingChanges_1 = pendingChanges; _b < pendingChanges_1.length; _b++) {
var change = pendingChanges_1[_b];
for (var _c = 0, result_1 = result; _c < result_1.length; _c++) {
var area = result_1[_c];
for (var _d = 0, _e = change.changes; _d < _e.length; _d++) {
var singleChange = _e[_d];
area.applyEdit(singleChange.range, singleChange.text);
}
}
}
if (!this._fetchSemanticTokens.isScheduled()) {
this._fetchSemanticTokens.schedule();
}
}
this._model.setSemanticTokens(result);
return;
}
this._model.setSemanticTokens(null);
};
ModelSemanticColoring.prototype._getSemanticColoringProvider = function () {
var result = modes["l" /* DocumentSemanticTokensProviderRegistry */].ordered(this._model);
return (result.length > 0 ? result[0] : null);
};
return ModelSemanticColoring;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/abstractCodeEditorService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var abstractCodeEditorService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var abstractCodeEditorService_AbstractCodeEditorService = /** @class */ (function (_super) {
abstractCodeEditorService_extends(AbstractCodeEditorService, _super);
function AbstractCodeEditorService() {
var _this = _super.call(this) || this;
_this._onCodeEditorAdd = _this._register(new common_event["a" /* Emitter */]());
_this.onCodeEditorAdd = _this._onCodeEditorAdd.event;
_this._onCodeEditorRemove = _this._register(new common_event["a" /* Emitter */]());
_this.onCodeEditorRemove = _this._onCodeEditorRemove.event;
_this._onDiffEditorAdd = _this._register(new common_event["a" /* Emitter */]());
_this._onDiffEditorRemove = _this._register(new common_event["a" /* Emitter */]());
_this._codeEditors = Object.create(null);
_this._diffEditors = Object.create(null);
return _this;
}
AbstractCodeEditorService.prototype.addCodeEditor = function (editor) {
this._codeEditors[editor.getId()] = editor;
this._onCodeEditorAdd.fire(editor);
};
AbstractCodeEditorService.prototype.removeCodeEditor = function (editor) {
if (delete this._codeEditors[editor.getId()]) {
this._onCodeEditorRemove.fire(editor);
}
};
AbstractCodeEditorService.prototype.listCodeEditors = function () {
var _this = this;
return Object.keys(this._codeEditors).map(function (id) { return _this._codeEditors[id]; });
};
AbstractCodeEditorService.prototype.addDiffEditor = function (editor) {
this._diffEditors[editor.getId()] = editor;
this._onDiffEditorAdd.fire(editor);
};
AbstractCodeEditorService.prototype.removeDiffEditor = function (editor) {
if (delete this._diffEditors[editor.getId()]) {
this._onDiffEditorRemove.fire(editor);
}
};
AbstractCodeEditorService.prototype.listDiffEditors = function () {
var _this = this;
return Object.keys(this._diffEditors).map(function (id) { return _this._diffEditors[id]; });
};
AbstractCodeEditorService.prototype.getFocusedCodeEditor = function () {
var editorWithWidgetFocus = null;
var editors = this.listCodeEditors();
for (var _i = 0, editors_1 = editors; _i < editors_1.length; _i++) {
var editor = editors_1[_i];
if (editor.hasTextFocus()) {
// bingo!
return editor;
}
if (editor.hasWidgetFocus()) {
editorWithWidgetFocus = editor;
}
}
return editorWithWidgetFocus;
};
return AbstractCodeEditorService;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var codeEditorServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var codeEditorServiceImpl_decorate = (undefined && undefined.__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;
};
var codeEditorServiceImpl_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var RefCountedStyleSheet = /** @class */ (function () {
function RefCountedStyleSheet(parent, editorId, styleSheet) {
this._parent = parent;
this._editorId = editorId;
this.styleSheet = styleSheet;
this._refCount = 0;
}
RefCountedStyleSheet.prototype.ref = function () {
this._refCount++;
};
RefCountedStyleSheet.prototype.unref = function () {
var _a;
this._refCount--;
if (this._refCount === 0) {
(_a = this.styleSheet.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.styleSheet);
this._parent._removeEditorStyleSheets(this._editorId);
}
};
return RefCountedStyleSheet;
}());
var GlobalStyleSheet = /** @class */ (function () {
function GlobalStyleSheet(styleSheet) {
this.styleSheet = styleSheet;
}
GlobalStyleSheet.prototype.ref = function () {
};
GlobalStyleSheet.prototype.unref = function () {
};
return GlobalStyleSheet;
}());
var codeEditorServiceImpl_CodeEditorServiceImpl = /** @class */ (function (_super) {
codeEditorServiceImpl_extends(CodeEditorServiceImpl, _super);
function CodeEditorServiceImpl(themeService, styleSheet) {
if (styleSheet === void 0) { styleSheet = null; }
var _this = _super.call(this) || this;
_this._decorationOptionProviders = new Map();
_this._editorStyleSheets = new Map();
_this._globalStyleSheet = styleSheet ? new GlobalStyleSheet(styleSheet) : null;
_this._themeService = themeService;
return _this;
}
CodeEditorServiceImpl.prototype._getOrCreateGlobalStyleSheet = function () {
if (!this._globalStyleSheet) {
this._globalStyleSheet = new GlobalStyleSheet(dom["w" /* createStyleSheet */]());
}
return this._globalStyleSheet;
};
CodeEditorServiceImpl.prototype._getOrCreateStyleSheet = function (editor) {
if (!editor) {
return this._getOrCreateGlobalStyleSheet();
}
var domNode = editor.getContainerDomNode();
if (!dom["N" /* isInShadowDOM */](domNode)) {
return this._getOrCreateGlobalStyleSheet();
}
var editorId = editor.getId();
if (!this._editorStyleSheets.has(editorId)) {
var refCountedStyleSheet = new RefCountedStyleSheet(this, editorId, dom["w" /* createStyleSheet */](domNode));
this._editorStyleSheets.set(editorId, refCountedStyleSheet);
}
return this._editorStyleSheets.get(editorId);
};
CodeEditorServiceImpl.prototype._removeEditorStyleSheets = function (editorId) {
this._editorStyleSheets.delete(editorId);
};
CodeEditorServiceImpl.prototype.registerDecorationType = function (key, options, parentTypeKey, editor) {
var provider = this._decorationOptionProviders.get(key);
if (!provider) {
var styleSheet = this._getOrCreateStyleSheet(editor);
var providerArgs = {
styleSheet: styleSheet.styleSheet,
key: key,
parentTypeKey: parentTypeKey,
options: options || Object.create(null)
};
if (!parentTypeKey) {
provider = new codeEditorServiceImpl_DecorationTypeOptionsProvider(this._themeService, styleSheet, providerArgs);
}
else {
provider = new DecorationSubTypeOptionsProvider(this._themeService, styleSheet, providerArgs);
}
this._decorationOptionProviders.set(key, provider);
}
provider.refCount++;
};
CodeEditorServiceImpl.prototype.removeDecorationType = function (key) {
var provider = this._decorationOptionProviders.get(key);
if (provider) {
provider.refCount--;
if (provider.refCount <= 0) {
this._decorationOptionProviders.delete(key);
provider.dispose();
this.listCodeEditors().forEach(function (ed) { return ed.removeDecorations(key); });
}
}
};
CodeEditorServiceImpl.prototype.resolveDecorationOptions = function (decorationTypeKey, writable) {
var provider = this._decorationOptionProviders.get(decorationTypeKey);
if (!provider) {
throw new Error('Unknown decoration type key: ' + decorationTypeKey);
}
return provider.getOptions(this, writable);
};
CodeEditorServiceImpl = codeEditorServiceImpl_decorate([
codeEditorServiceImpl_param(0, common_themeService["c" /* IThemeService */])
], CodeEditorServiceImpl);
return CodeEditorServiceImpl;
}(abstractCodeEditorService_AbstractCodeEditorService));
var DecorationSubTypeOptionsProvider = /** @class */ (function () {
function DecorationSubTypeOptionsProvider(themeService, styleSheet, providerArgs) {
this._styleSheet = styleSheet;
this._styleSheet.ref();
this._parentTypeKey = providerArgs.parentTypeKey;
this.refCount = 0;
this._beforeContentRules = new codeEditorServiceImpl_DecorationCSSRules(3 /* BeforeContentClassName */, providerArgs, themeService);
this._afterContentRules = new codeEditorServiceImpl_DecorationCSSRules(4 /* AfterContentClassName */, providerArgs, themeService);
}
DecorationSubTypeOptionsProvider.prototype.getOptions = function (codeEditorService, writable) {
var options = codeEditorService.resolveDecorationOptions(this._parentTypeKey, true);
if (this._beforeContentRules) {
options.beforeContentClassName = this._beforeContentRules.className;
}
if (this._afterContentRules) {
options.afterContentClassName = this._afterContentRules.className;
}
return options;
};
DecorationSubTypeOptionsProvider.prototype.dispose = function () {
if (this._beforeContentRules) {
this._beforeContentRules.dispose();
this._beforeContentRules = null;
}
if (this._afterContentRules) {
this._afterContentRules.dispose();
this._afterContentRules = null;
}
this._styleSheet.unref();
};
return DecorationSubTypeOptionsProvider;
}());
var codeEditorServiceImpl_DecorationTypeOptionsProvider = /** @class */ (function () {
function DecorationTypeOptionsProvider(themeService, styleSheet, providerArgs) {
var _this = this;
this._disposables = new lifecycle["b" /* DisposableStore */]();
this._styleSheet = styleSheet;
this._styleSheet.ref();
this.refCount = 0;
var createCSSRules = function (type) {
var rules = new codeEditorServiceImpl_DecorationCSSRules(type, providerArgs, themeService);
_this._disposables.add(rules);
if (rules.hasContent) {
return rules.className;
}
return undefined;
};
var createInlineCSSRules = function (type) {
var rules = new codeEditorServiceImpl_DecorationCSSRules(type, providerArgs, themeService);
_this._disposables.add(rules);
if (rules.hasContent) {
return { className: rules.className, hasLetterSpacing: rules.hasLetterSpacing };
}
return null;
};
this.className = createCSSRules(0 /* ClassName */);
var inlineData = createInlineCSSRules(1 /* InlineClassName */);
if (inlineData) {
this.inlineClassName = inlineData.className;
this.inlineClassNameAffectsLetterSpacing = inlineData.hasLetterSpacing;
}
this.beforeContentClassName = createCSSRules(3 /* BeforeContentClassName */);
this.afterContentClassName = createCSSRules(4 /* AfterContentClassName */);
this.glyphMarginClassName = createCSSRules(2 /* GlyphMarginClassName */);
var options = providerArgs.options;
this.isWholeLine = Boolean(options.isWholeLine);
this.stickiness = options.rangeBehavior;
var lightOverviewRulerColor = options.light && options.light.overviewRulerColor || options.overviewRulerColor;
var darkOverviewRulerColor = options.dark && options.dark.overviewRulerColor || options.overviewRulerColor;
if (typeof lightOverviewRulerColor !== 'undefined'
|| typeof darkOverviewRulerColor !== 'undefined') {
this.overviewRuler = {
color: lightOverviewRulerColor || darkOverviewRulerColor,
darkColor: darkOverviewRulerColor || lightOverviewRulerColor,
position: options.overviewRulerLane || common_model["d" /* OverviewRulerLane */].Center
};
}
}
DecorationTypeOptionsProvider.prototype.getOptions = function (codeEditorService, writable) {
if (!writable) {
return this;
}
return {
inlineClassName: this.inlineClassName,
beforeContentClassName: this.beforeContentClassName,
afterContentClassName: this.afterContentClassName,
className: this.className,
glyphMarginClassName: this.glyphMarginClassName,
isWholeLine: this.isWholeLine,
overviewRuler: this.overviewRuler,
stickiness: this.stickiness
};
};
DecorationTypeOptionsProvider.prototype.dispose = function () {
this._disposables.dispose();
this._styleSheet.unref();
};
return DecorationTypeOptionsProvider;
}());
var _CSS_MAP = {
color: 'color:{0} !important;',
opacity: 'opacity:{0};',
backgroundColor: 'background-color:{0};',
outline: 'outline:{0};',
outlineColor: 'outline-color:{0};',
outlineStyle: 'outline-style:{0};',
outlineWidth: 'outline-width:{0};',
border: 'border:{0};',
borderColor: 'border-color:{0};',
borderRadius: 'border-radius:{0};',
borderSpacing: 'border-spacing:{0};',
borderStyle: 'border-style:{0};',
borderWidth: 'border-width:{0};',
fontStyle: 'font-style:{0};',
fontWeight: 'font-weight:{0};',
textDecoration: 'text-decoration:{0};',
cursor: 'cursor:{0};',
letterSpacing: 'letter-spacing:{0};',
gutterIconPath: 'background:{0} center center no-repeat;',
gutterIconSize: 'background-size:{0};',
contentText: 'content:\'{0}\';',
contentIconPath: 'content:{0};',
margin: 'margin:{0};',
width: 'width:{0};',
height: 'height:{0};'
};
var codeEditorServiceImpl_DecorationCSSRules = /** @class */ (function () {
function DecorationCSSRules(ruleType, providerArgs, themeService) {
var _this = this;
this._theme = themeService.getTheme();
this._ruleType = ruleType;
this._providerArgs = providerArgs;
this._usesThemeColors = false;
this._hasContent = false;
this._hasLetterSpacing = false;
var className = CSSNameHelper.getClassName(this._providerArgs.key, ruleType);
if (this._providerArgs.parentTypeKey) {
className = className + ' ' + CSSNameHelper.getClassName(this._providerArgs.parentTypeKey, ruleType);
}
this._className = className;
this._unThemedSelector = CSSNameHelper.getSelector(this._providerArgs.key, this._providerArgs.parentTypeKey, ruleType);
this._buildCSS();
if (this._usesThemeColors) {
this._themeListener = themeService.onThemeChange(function (theme) {
_this._theme = themeService.getTheme();
_this._removeCSS();
_this._buildCSS();
});
}
else {
this._themeListener = null;
}
}
DecorationCSSRules.prototype.dispose = function () {
if (this._hasContent) {
this._removeCSS();
this._hasContent = false;
}
if (this._themeListener) {
this._themeListener.dispose();
this._themeListener = null;
}
};
Object.defineProperty(DecorationCSSRules.prototype, "hasContent", {
get: function () {
return this._hasContent;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DecorationCSSRules.prototype, "hasLetterSpacing", {
get: function () {
return this._hasLetterSpacing;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DecorationCSSRules.prototype, "className", {
get: function () {
return this._className;
},
enumerable: true,
configurable: true
});
DecorationCSSRules.prototype._buildCSS = function () {
var options = this._providerArgs.options;
var unthemedCSS, lightCSS, darkCSS;
switch (this._ruleType) {
case 0 /* ClassName */:
unthemedCSS = this.getCSSTextForModelDecorationClassName(options);
lightCSS = this.getCSSTextForModelDecorationClassName(options.light);
darkCSS = this.getCSSTextForModelDecorationClassName(options.dark);
break;
case 1 /* InlineClassName */:
unthemedCSS = this.getCSSTextForModelDecorationInlineClassName(options);
lightCSS = this.getCSSTextForModelDecorationInlineClassName(options.light);
darkCSS = this.getCSSTextForModelDecorationInlineClassName(options.dark);
break;
case 2 /* GlyphMarginClassName */:
unthemedCSS = this.getCSSTextForModelDecorationGlyphMarginClassName(options);
lightCSS = this.getCSSTextForModelDecorationGlyphMarginClassName(options.light);
darkCSS = this.getCSSTextForModelDecorationGlyphMarginClassName(options.dark);
break;
case 3 /* BeforeContentClassName */:
unthemedCSS = this.getCSSTextForModelDecorationContentClassName(options.before);
lightCSS = this.getCSSTextForModelDecorationContentClassName(options.light && options.light.before);
darkCSS = this.getCSSTextForModelDecorationContentClassName(options.dark && options.dark.before);
break;
case 4 /* AfterContentClassName */:
unthemedCSS = this.getCSSTextForModelDecorationContentClassName(options.after);
lightCSS = this.getCSSTextForModelDecorationContentClassName(options.light && options.light.after);
darkCSS = this.getCSSTextForModelDecorationContentClassName(options.dark && options.dark.after);
break;
default:
throw new Error('Unknown rule type: ' + this._ruleType);
}
var sheet = this._providerArgs.styleSheet.sheet;
var hasContent = false;
if (unthemedCSS.length > 0) {
sheet.insertRule(this._unThemedSelector + " {" + unthemedCSS + "}", 0);
hasContent = true;
}
if (lightCSS.length > 0) {
sheet.insertRule(".vs" + this._unThemedSelector + " {" + lightCSS + "}", 0);
hasContent = true;
}
if (darkCSS.length > 0) {
sheet.insertRule(".vs-dark" + this._unThemedSelector + ", .hc-black" + this._unThemedSelector + " {" + darkCSS + "}", 0);
hasContent = true;
}
this._hasContent = hasContent;
};
DecorationCSSRules.prototype._removeCSS = function () {
dom["O" /* removeCSSRulesContainingSelector */](this._unThemedSelector, this._providerArgs.styleSheet);
};
/**
* Build the CSS for decorations styled via `className`.
*/
DecorationCSSRules.prototype.getCSSTextForModelDecorationClassName = function (opts) {
if (!opts) {
return '';
}
var cssTextArr = [];
this.collectCSSText(opts, ['backgroundColor'], cssTextArr);
this.collectCSSText(opts, ['outline', 'outlineColor', 'outlineStyle', 'outlineWidth'], cssTextArr);
this.collectBorderSettingsCSSText(opts, cssTextArr);
return cssTextArr.join('');
};
/**
* Build the CSS for decorations styled via `inlineClassName`.
*/
DecorationCSSRules.prototype.getCSSTextForModelDecorationInlineClassName = function (opts) {
if (!opts) {
return '';
}
var cssTextArr = [];
this.collectCSSText(opts, ['fontStyle', 'fontWeight', 'textDecoration', 'cursor', 'color', 'opacity', 'letterSpacing'], cssTextArr);
if (opts.letterSpacing) {
this._hasLetterSpacing = true;
}
return cssTextArr.join('');
};
/**
* Build the CSS for decorations styled before or after content.
*/
DecorationCSSRules.prototype.getCSSTextForModelDecorationContentClassName = function (opts) {
if (!opts) {
return '';
}
var cssTextArr = [];
if (typeof opts !== 'undefined') {
this.collectBorderSettingsCSSText(opts, cssTextArr);
if (typeof opts.contentIconPath !== 'undefined') {
cssTextArr.push(strings["r" /* format */](_CSS_MAP.contentIconPath, dom["r" /* asCSSUrl */](common_uri["a" /* URI */].revive(opts.contentIconPath))));
}
if (typeof opts.contentText === 'string') {
var truncated = opts.contentText.match(/^.*$/m)[0]; // only take first line
var escaped = truncated.replace(/['\\]/g, '\\$&');
cssTextArr.push(strings["r" /* format */](_CSS_MAP.contentText, escaped));
}
this.collectCSSText(opts, ['fontStyle', 'fontWeight', 'textDecoration', 'color', 'opacity', 'backgroundColor', 'margin'], cssTextArr);
if (this.collectCSSText(opts, ['width', 'height'], cssTextArr)) {
cssTextArr.push('display:inline-block;');
}
}
return cssTextArr.join('');
};
/**
* Build the CSS for decorations styled via `glpyhMarginClassName`.
*/
DecorationCSSRules.prototype.getCSSTextForModelDecorationGlyphMarginClassName = function (opts) {
if (!opts) {
return '';
}
var cssTextArr = [];
if (typeof opts.gutterIconPath !== 'undefined') {
cssTextArr.push(strings["r" /* format */](_CSS_MAP.gutterIconPath, dom["r" /* asCSSUrl */](common_uri["a" /* URI */].revive(opts.gutterIconPath))));
if (typeof opts.gutterIconSize !== 'undefined') {
cssTextArr.push(strings["r" /* format */](_CSS_MAP.gutterIconSize, opts.gutterIconSize));
}
}
return cssTextArr.join('');
};
DecorationCSSRules.prototype.collectBorderSettingsCSSText = function (opts, cssTextArr) {
if (this.collectCSSText(opts, ['border', 'borderColor', 'borderRadius', 'borderSpacing', 'borderStyle', 'borderWidth'], cssTextArr)) {
cssTextArr.push(strings["r" /* format */]('box-sizing: border-box;'));
return true;
}
return false;
};
DecorationCSSRules.prototype.collectCSSText = function (opts, properties, cssTextArr) {
var lenBefore = cssTextArr.length;
for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
var property = properties_1[_i];
var value = this.resolveValue(opts[property]);
if (typeof value === 'string') {
cssTextArr.push(strings["r" /* format */](_CSS_MAP[property], value));
}
}
return cssTextArr.length !== lenBefore;
};
DecorationCSSRules.prototype.resolveValue = function (value) {
if (Object(editorCommon["c" /* isThemeColor */])(value)) {
this._usesThemeColors = true;
var color = this._theme.getColor(value.id);
if (color) {
return color.toString();
}
return 'transparent';
}
return value;
};
return DecorationCSSRules;
}());
var CSSNameHelper = /** @class */ (function () {
function CSSNameHelper() {
}
CSSNameHelper.getClassName = function (key, type) {
return 'ced-' + key + '-' + type;
};
CSSNameHelper.getSelector = function (key, parentKey, ruleType) {
var selector = '.monaco-editor .' + this.getClassName(key, ruleType);
if (parentKey) {
selector = selector + '.' + this.getClassName(parentKey, ruleType);
}
if (ruleType === 3 /* BeforeContentClassName */) {
selector += '::before';
}
else if (ruleType === 4 /* AfterContentClassName */) {
selector += '::after';
}
return selector;
};
return CSSNameHelper;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var standaloneCodeServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var standaloneCodeServiceImpl_StandaloneCodeEditorServiceImpl = /** @class */ (function (_super) {
standaloneCodeServiceImpl_extends(StandaloneCodeEditorServiceImpl, _super);
function StandaloneCodeEditorServiceImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
StandaloneCodeEditorServiceImpl.prototype.getActiveCodeEditor = function () {
return null; // not supported in the standalone case
};
StandaloneCodeEditorServiceImpl.prototype.openCodeEditor = function (input, source, sideBySide) {
if (!source) {
return Promise.resolve(null);
}
return Promise.resolve(this.doOpenEditor(source, input));
};
StandaloneCodeEditorServiceImpl.prototype.doOpenEditor = function (editor, input) {
var model = this.findModel(editor, input.resource);
if (!model) {
if (input.resource) {
var schema = input.resource.scheme;
if (schema === network["b" /* Schemas */].http || schema === network["b" /* Schemas */].https) {
// This is a fully qualified http or https URL
Object(dom["ab" /* windowOpenNoOpener */])(input.resource.toString());
return editor;
}
}
return null;
}
var selection = (input.options ? input.options.selection : null);
if (selection) {
if (typeof selection.endLineNumber === 'number' && typeof selection.endColumn === 'number') {
editor.setSelection(selection);
editor.revealRangeInCenter(selection, 1 /* Immediate */);
}
else {
var pos = {
lineNumber: selection.startLineNumber,
column: selection.startColumn
};
editor.setPosition(pos);
editor.revealPositionInCenter(pos, 1 /* Immediate */);
}
}
return editor;
};
StandaloneCodeEditorServiceImpl.prototype.findModel = function (editor, resource) {
var model = editor.getModel();
if (model && model.uri.toString() !== resource.toString()) {
return null;
}
return model;
};
return StandaloneCodeEditorServiceImpl;
}(codeEditorServiceImpl_CodeEditorServiceImpl));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/color.js
var common_color = __webpack_require__(15);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/supports/tokenization.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ParsedTokenThemeRule = /** @class */ (function () {
function ParsedTokenThemeRule(token, index, fontStyle, foreground, background) {
this.token = token;
this.index = index;
this.fontStyle = fontStyle;
this.foreground = foreground;
this.background = background;
}
return ParsedTokenThemeRule;
}());
/**
* Parse a raw theme into rules.
*/
function parseTokenTheme(source) {
if (!source || !Array.isArray(source)) {
return [];
}
var result = [], resultLen = 0;
for (var i = 0, len = source.length; i < len; i++) {
var entry = source[i];
var fontStyle = -1 /* NotSet */;
if (typeof entry.fontStyle === 'string') {
fontStyle = 0 /* None */;
var segments = entry.fontStyle.split(' ');
for (var j = 0, lenJ = segments.length; j < lenJ; j++) {
var segment = segments[j];
switch (segment) {
case 'italic':
fontStyle = fontStyle | 1 /* Italic */;
break;
case 'bold':
fontStyle = fontStyle | 2 /* Bold */;
break;
case 'underline':
fontStyle = fontStyle | 4 /* Underline */;
break;
}
}
}
var foreground = null;
if (typeof entry.foreground === 'string') {
foreground = entry.foreground;
}
var background = null;
if (typeof entry.background === 'string') {
background = entry.background;
}
result[resultLen++] = new ParsedTokenThemeRule(entry.token || '', i, fontStyle, foreground, background);
}
return result;
}
/**
* Resolve rules (i.e. inheritance).
*/
function resolveParsedTokenThemeRules(parsedThemeRules, customTokenColors) {
// Sort rules lexicographically, and then by index if necessary
parsedThemeRules.sort(function (a, b) {
var r = strcmp(a.token, b.token);
if (r !== 0) {
return r;
}
return a.index - b.index;
});
// Determine defaults
var defaultFontStyle = 0 /* None */;
var defaultForeground = '000000';
var defaultBackground = 'ffffff';
while (parsedThemeRules.length >= 1 && parsedThemeRules[0].token === '') {
var incomingDefaults = parsedThemeRules.shift();
if (incomingDefaults.fontStyle !== -1 /* NotSet */) {
defaultFontStyle = incomingDefaults.fontStyle;
}
if (incomingDefaults.foreground !== null) {
defaultForeground = incomingDefaults.foreground;
}
if (incomingDefaults.background !== null) {
defaultBackground = incomingDefaults.background;
}
}
var colorMap = new tokenization_ColorMap();
// start with token colors from custom token themes
for (var _i = 0, customTokenColors_1 = customTokenColors; _i < customTokenColors_1.length; _i++) {
var color = customTokenColors_1[_i];
colorMap.getId(color);
}
var foregroundColorId = colorMap.getId(defaultForeground);
var backgroundColorId = colorMap.getId(defaultBackground);
var defaults = new ThemeTrieElementRule(defaultFontStyle, foregroundColorId, backgroundColorId);
var root = new ThemeTrieElement(defaults);
for (var i = 0, len = parsedThemeRules.length; i < len; i++) {
var rule = parsedThemeRules[i];
root.insert(rule.token, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
}
return new TokenTheme(colorMap, root);
}
var colorRegExp = /^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;
var tokenization_ColorMap = /** @class */ (function () {
function ColorMap() {
this._lastColorId = 0;
this._id2color = [];
this._color2id = new Map();
}
ColorMap.prototype.getId = function (color) {
if (color === null) {
return 0;
}
var match = color.match(colorRegExp);
if (!match) {
throw new Error('Illegal value for token color: ' + color);
}
color = match[1].toUpperCase();
var value = this._color2id.get(color);
if (value) {
return value;
}
value = ++this._lastColorId;
this._color2id.set(color, value);
this._id2color[value] = common_color["a" /* Color */].fromHex('#' + color);
return value;
};
ColorMap.prototype.getColorMap = function () {
return this._id2color.slice(0);
};
return ColorMap;
}());
var TokenTheme = /** @class */ (function () {
function TokenTheme(colorMap, root) {
this._colorMap = colorMap;
this._root = root;
this._cache = new Map();
}
TokenTheme.createFromRawTokenTheme = function (source, customTokenColors) {
return this.createFromParsedTokenTheme(parseTokenTheme(source), customTokenColors);
};
TokenTheme.createFromParsedTokenTheme = function (source, customTokenColors) {
return resolveParsedTokenThemeRules(source, customTokenColors);
};
TokenTheme.prototype.getColorMap = function () {
return this._colorMap.getColorMap();
};
TokenTheme.prototype._match = function (token) {
return this._root.match(token);
};
TokenTheme.prototype.match = function (languageId, token) {
// The cache contains the metadata without the language bits set.
var result = this._cache.get(token);
if (typeof result === 'undefined') {
var rule = this._match(token);
var standardToken = toStandardTokenType(token);
result = (rule.metadata
| (standardToken << 8 /* TOKEN_TYPE_OFFSET */)) >>> 0;
this._cache.set(token, result);
}
return (result
| (languageId << 0 /* LANGUAGEID_OFFSET */)) >>> 0;
};
return TokenTheme;
}());
var STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|regexp)\b/;
function toStandardTokenType(tokenType) {
var m = tokenType.match(STANDARD_TOKEN_TYPE_REGEXP);
if (!m) {
return 0 /* Other */;
}
switch (m[1]) {
case 'comment':
return 1 /* Comment */;
case 'string':
return 2 /* String */;
case 'regex':
return 4 /* RegEx */;
case 'regexp':
return 4 /* RegEx */;
}
throw new Error('Unexpected match for standard token type!');
}
function strcmp(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
var ThemeTrieElementRule = /** @class */ (function () {
function ThemeTrieElementRule(fontStyle, foreground, background) {
this._fontStyle = fontStyle;
this._foreground = foreground;
this._background = background;
this.metadata = ((this._fontStyle << 11 /* FONT_STYLE_OFFSET */)
| (this._foreground << 14 /* FOREGROUND_OFFSET */)
| (this._background << 23 /* BACKGROUND_OFFSET */)) >>> 0;
}
ThemeTrieElementRule.prototype.clone = function () {
return new ThemeTrieElementRule(this._fontStyle, this._foreground, this._background);
};
ThemeTrieElementRule.prototype.acceptOverwrite = function (fontStyle, foreground, background) {
if (fontStyle !== -1 /* NotSet */) {
this._fontStyle = fontStyle;
}
if (foreground !== 0 /* None */) {
this._foreground = foreground;
}
if (background !== 0 /* None */) {
this._background = background;
}
this.metadata = ((this._fontStyle << 11 /* FONT_STYLE_OFFSET */)
| (this._foreground << 14 /* FOREGROUND_OFFSET */)
| (this._background << 23 /* BACKGROUND_OFFSET */)) >>> 0;
};
return ThemeTrieElementRule;
}());
var ThemeTrieElement = /** @class */ (function () {
function ThemeTrieElement(mainRule) {
this._mainRule = mainRule;
this._children = new Map();
}
ThemeTrieElement.prototype.match = function (token) {
if (token === '') {
return this._mainRule;
}
var dotIndex = token.indexOf('.');
var head;
var tail;
if (dotIndex === -1) {
head = token;
tail = '';
}
else {
head = token.substring(0, dotIndex);
tail = token.substring(dotIndex + 1);
}
var child = this._children.get(head);
if (typeof child !== 'undefined') {
return child.match(tail);
}
return this._mainRule;
};
ThemeTrieElement.prototype.insert = function (token, fontStyle, foreground, background) {
if (token === '') {
// Merge into the main rule
this._mainRule.acceptOverwrite(fontStyle, foreground, background);
return;
}
var dotIndex = token.indexOf('.');
var head;
var tail;
if (dotIndex === -1) {
head = token;
tail = '';
}
else {
head = token.substring(0, dotIndex);
tail = token.substring(dotIndex + 1);
}
var child = this._children.get(head);
if (typeof child === 'undefined') {
child = new ThemeTrieElement(this._mainRule.clone());
this._children.set(head, child);
}
child.insert(tail, fontStyle, foreground, background);
};
return ThemeTrieElement;
}());
function generateTokensCSSForColorMap(colorMap) {
var rules = [];
for (var i = 1, len = colorMap.length; i < len; i++) {
var 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; }');
return rules.join('\n');
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/editorColorRegistry.js
var editorColorRegistry = __webpack_require__(44);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js
var colorRegistry = __webpack_require__(6);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/common/themes.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var themes_a, themes_b, themes_c;
/* -------------------------------- Begin vs theme -------------------------------- */
var 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: 'FF00FF' },
],
colors: (themes_a = {},
themes_a[colorRegistry["o" /* editorBackground */]] = '#FFFFFE',
themes_a[colorRegistry["x" /* editorForeground */]] = '#000000',
themes_a[colorRegistry["F" /* editorInactiveSelection */]] = '#E5EBF1',
themes_a[editorColorRegistry["h" /* editorIndentGuides */]] = '#D3D3D3',
themes_a[editorColorRegistry["a" /* editorActiveIndentGuides */]] = '#939393',
themes_a[colorRegistry["M" /* editorSelectionHighlight */]] = '#ADD6FF4D',
themes_a)
};
/* -------------------------------- End vs theme -------------------------------- */
/* -------------------------------- Begin vs-dark theme -------------------------------- */
var 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: (themes_b = {},
themes_b[colorRegistry["o" /* editorBackground */]] = '#1E1E1E',
themes_b[colorRegistry["x" /* editorForeground */]] = '#D4D4D4',
themes_b[colorRegistry["F" /* editorInactiveSelection */]] = '#3A3D41',
themes_b[editorColorRegistry["h" /* editorIndentGuides */]] = '#404040',
themes_b[editorColorRegistry["a" /* editorActiveIndentGuides */]] = '#707070',
themes_b[colorRegistry["M" /* editorSelectionHighlight */]] = '#ADD6FF26',
themes_b)
};
/* -------------------------------- End vs-dark theme -------------------------------- */
/* -------------------------------- Begin hc-black theme -------------------------------- */
var 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: (themes_c = {},
themes_c[colorRegistry["o" /* editorBackground */]] = '#000000',
themes_c[colorRegistry["x" /* editorForeground */]] = '#FFFFFF',
themes_c[editorColorRegistry["h" /* editorIndentGuides */]] = '#FFFFFF',
themes_c[editorColorRegistry["a" /* editorActiveIndentGuides */]] = '#FFFFFF',
themes_c)
};
/* -------------------------------- End hc-black theme -------------------------------- */
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneThemeServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var standaloneThemeServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var VS_THEME_NAME = 'vs';
var VS_DARK_THEME_NAME = 'vs-dark';
var HC_BLACK_THEME_NAME = 'hc-black';
var standaloneThemeServiceImpl_colorRegistry = common_platform["a" /* Registry */].as(colorRegistry["a" /* Extensions */].ColorContribution);
var themingRegistry = common_platform["a" /* Registry */].as(common_themeService["a" /* Extensions */].ThemingContribution);
var standaloneThemeServiceImpl_StandaloneTheme = /** @class */ (function () {
function StandaloneTheme(name, standaloneThemeData) {
this.themeData = standaloneThemeData;
var base = standaloneThemeData.base;
if (name.length > 0) {
this.id = base + ' ' + name;
this.themeName = name;
}
else {
this.id = base;
this.themeName = base;
}
this.colors = null;
this.defaultColors = Object.create(null);
this._tokenTheme = null;
}
Object.defineProperty(StandaloneTheme.prototype, "base", {
get: function () {
return this.themeData.base;
},
enumerable: true,
configurable: true
});
StandaloneTheme.prototype.notifyBaseUpdated = function () {
if (this.themeData.inherit) {
this.colors = null;
this._tokenTheme = null;
}
};
StandaloneTheme.prototype.getColors = function () {
if (!this.colors) {
var colors = new Map();
for (var id in this.themeData.colors) {
colors.set(id, common_color["a" /* Color */].fromHex(this.themeData.colors[id]));
}
if (this.themeData.inherit) {
var baseData = getBuiltinRules(this.themeData.base);
for (var id in baseData.colors) {
if (!colors.has(id)) {
colors.set(id, common_color["a" /* Color */].fromHex(baseData.colors[id]));
}
}
}
this.colors = colors;
}
return this.colors;
};
StandaloneTheme.prototype.getColor = function (colorId, useDefault) {
var color = this.getColors().get(colorId);
if (color) {
return color;
}
if (useDefault !== false) {
return this.getDefault(colorId);
}
return undefined;
};
StandaloneTheme.prototype.getDefault = function (colorId) {
var color = this.defaultColors[colorId];
if (color) {
return color;
}
color = standaloneThemeServiceImpl_colorRegistry.resolveDefaultColor(colorId, this);
this.defaultColors[colorId] = color;
return color;
};
StandaloneTheme.prototype.defines = function (colorId) {
return Object.prototype.hasOwnProperty.call(this.getColors(), colorId);
};
Object.defineProperty(StandaloneTheme.prototype, "type", {
get: function () {
switch (this.base) {
case VS_THEME_NAME: return 'light';
case HC_BLACK_THEME_NAME: return 'hc';
default: return 'dark';
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(StandaloneTheme.prototype, "tokenTheme", {
get: function () {
if (!this._tokenTheme) {
var rules = [];
var encodedTokensColors = [];
if (this.themeData.inherit) {
var baseData = getBuiltinRules(this.themeData.base);
rules = baseData.rules;
if (baseData.encodedTokensColors) {
encodedTokensColors = baseData.encodedTokensColors;
}
}
rules = rules.concat(this.themeData.rules);
if (this.themeData.encodedTokensColors) {
encodedTokensColors = this.themeData.encodedTokensColors;
}
this._tokenTheme = TokenTheme.createFromRawTokenTheme(rules, encodedTokensColors);
}
return this._tokenTheme;
},
enumerable: true,
configurable: true
});
StandaloneTheme.prototype.getTokenStyleMetadata = function (type, modifiers) {
return undefined;
};
return StandaloneTheme;
}());
function isBuiltinTheme(themeName) {
return (themeName === VS_THEME_NAME
|| themeName === VS_DARK_THEME_NAME
|| themeName === HC_BLACK_THEME_NAME);
}
function getBuiltinRules(builtinTheme) {
switch (builtinTheme) {
case VS_THEME_NAME:
return vs;
case VS_DARK_THEME_NAME:
return vs_dark;
case HC_BLACK_THEME_NAME:
return hc_black;
}
}
function newBuiltInTheme(builtinTheme) {
var themeData = getBuiltinRules(builtinTheme);
return new standaloneThemeServiceImpl_StandaloneTheme(builtinTheme, themeData);
}
var standaloneThemeServiceImpl_StandaloneThemeServiceImpl = /** @class */ (function (_super) {
standaloneThemeServiceImpl_extends(StandaloneThemeServiceImpl, _super);
function StandaloneThemeServiceImpl() {
var _this = _super.call(this) || this;
_this._onThemeChange = _this._register(new common_event["a" /* Emitter */]());
_this.onThemeChange = _this._onThemeChange.event;
_this._environment = Object.create(null);
_this._knownThemes = new Map();
_this._knownThemes.set(VS_THEME_NAME, newBuiltInTheme(VS_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._css = '';
_this._globalStyleElement = null;
_this._styleElements = [];
_this.setTheme(VS_THEME_NAME);
return _this;
}
StandaloneThemeServiceImpl.prototype.registerEditorContainer = function (domNode) {
if (dom["N" /* isInShadowDOM */](domNode)) {
return this._registerShadowDomContainer(domNode);
}
return this._registerRegularEditorContainer();
};
StandaloneThemeServiceImpl.prototype._registerRegularEditorContainer = function () {
if (!this._globalStyleElement) {
this._globalStyleElement = dom["w" /* createStyleSheet */]();
this._globalStyleElement.className = 'monaco-colors';
this._globalStyleElement.innerHTML = this._css;
this._styleElements.push(this._globalStyleElement);
}
return lifecycle["a" /* Disposable */].None;
};
StandaloneThemeServiceImpl.prototype._registerShadowDomContainer = function (domNode) {
var _this = this;
var styleElement = dom["w" /* createStyleSheet */](domNode);
styleElement.className = 'monaco-colors';
styleElement.innerHTML = this._css;
this._styleElements.push(styleElement);
return {
dispose: function () {
for (var i = 0; i < _this._styleElements.length; i++) {
if (_this._styleElements[i] === styleElement) {
_this._styleElements.splice(i, 1);
return;
}
}
}
};
};
StandaloneThemeServiceImpl.prototype.defineTheme = function (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!');
}
// set or replace theme
this._knownThemes.set(themeName, new standaloneThemeServiceImpl_StandaloneTheme(themeName, themeData));
if (isBuiltinTheme(themeName)) {
this._knownThemes.forEach(function (theme) {
if (theme.base === themeName) {
theme.notifyBaseUpdated();
}
});
}
if (this._theme && this._theme.themeName === themeName) {
this.setTheme(themeName); // refresh theme
}
};
StandaloneThemeServiceImpl.prototype.getTheme = function () {
return this._theme;
};
StandaloneThemeServiceImpl.prototype.setTheme = function (themeName) {
var _this = this;
var theme;
if (this._knownThemes.has(themeName)) {
theme = this._knownThemes.get(themeName);
}
else {
theme = this._knownThemes.get(VS_THEME_NAME);
}
if (this._theme === theme) {
// Nothing to do
return theme.id;
}
this._theme = theme;
var cssRules = [];
var hasRule = {};
var ruleCollector = {
addRule: function (rule) {
if (!hasRule[rule]) {
cssRules.push(rule);
hasRule[rule] = true;
}
}
};
themingRegistry.getThemingParticipants().forEach(function (p) { return p(theme, ruleCollector, _this._environment); });
var tokenTheme = theme.tokenTheme;
var colorMap = tokenTheme.getColorMap();
ruleCollector.addRule(generateTokensCSSForColorMap(colorMap));
this._css = cssRules.join('\n');
this._styleElements.forEach(function (styleElement) { return styleElement.innerHTML = _this._css; });
modes["B" /* TokenizationRegistry */].setColorMap(colorMap);
this._onThemeChange.fire(theme);
return theme.id;
};
StandaloneThemeServiceImpl.prototype.getIconTheme = function () {
return {
hasFileIcons: false,
hasFolderIcons: false,
hidesExplorerArrows: false
};
};
return StandaloneThemeServiceImpl;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/browser/contextKeyService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contextKeyService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var contextKeyService_decorate = (undefined && undefined.__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;
};
var contextKeyService_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var KEYBINDING_CONTEXT_ATTR = 'data-keybinding-context';
var Context = /** @class */ (function () {
function Context(id, parent) {
this._id = id;
this._parent = parent;
this._value = Object.create(null);
this._value['_contextId'] = id;
}
Context.prototype.setValue = function (key, value) {
// console.log('SET ' + key + ' = ' + value + ' ON ' + this._id);
if (this._value[key] !== value) {
this._value[key] = value;
return true;
}
return false;
};
Context.prototype.removeValue = function (key) {
// console.log('REMOVE ' + key + ' FROM ' + this._id);
if (key in this._value) {
delete this._value[key];
return true;
}
return false;
};
Context.prototype.getValue = function (key) {
var ret = this._value[key];
if (typeof ret === 'undefined' && this._parent) {
return this._parent.getValue(key);
}
return ret;
};
return Context;
}());
var NullContext = /** @class */ (function (_super) {
contextKeyService_extends(NullContext, _super);
function NullContext() {
return _super.call(this, -1, null) || this;
}
NullContext.prototype.setValue = function (key, value) {
return false;
};
NullContext.prototype.removeValue = function (key) {
return false;
};
NullContext.prototype.getValue = function (key) {
return undefined;
};
NullContext.INSTANCE = new NullContext();
return NullContext;
}(Context));
var contextKeyService_ConfigAwareContextValuesContainer = /** @class */ (function (_super) {
contextKeyService_extends(ConfigAwareContextValuesContainer, _super);
function ConfigAwareContextValuesContainer(id, _configurationService, emitter) {
var _this = _super.call(this, id, null) || this;
_this._configurationService = _configurationService;
_this._values = new Map();
_this._listener = _this._configurationService.onDidChangeConfiguration(function (event) {
if (event.source === 6 /* DEFAULT */) {
// new setting, reset everything
var allKeys = Object(common_map["d" /* keys */])(_this._values);
_this._values.clear();
emitter.fire(new ArrayContextKeyChangeEvent(allKeys));
}
else {
var changedKeys = [];
for (var _i = 0, _a = event.affectedKeys; _i < _a.length; _i++) {
var configKey = _a[_i];
var contextKey = "config." + configKey;
if (_this._values.has(contextKey)) {
_this._values.delete(contextKey);
changedKeys.push(contextKey);
}
}
emitter.fire(new ArrayContextKeyChangeEvent(changedKeys));
}
});
return _this;
}
ConfigAwareContextValuesContainer.prototype.dispose = function () {
this._listener.dispose();
};
ConfigAwareContextValuesContainer.prototype.getValue = function (key) {
if (key.indexOf(ConfigAwareContextValuesContainer._keyPrefix) !== 0) {
return _super.prototype.getValue.call(this, key);
}
if (this._values.has(key)) {
return this._values.get(key);
}
var configKey = key.substr(ConfigAwareContextValuesContainer._keyPrefix.length);
var configValue = this._configurationService.getValue(configKey);
var value = undefined;
switch (typeof configValue) {
case 'number':
case 'boolean':
case 'string':
value = configValue;
break;
}
this._values.set(key, value);
return value;
};
ConfigAwareContextValuesContainer.prototype.setValue = function (key, value) {
return _super.prototype.setValue.call(this, key, value);
};
ConfigAwareContextValuesContainer.prototype.removeValue = function (key) {
return _super.prototype.removeValue.call(this, key);
};
ConfigAwareContextValuesContainer._keyPrefix = 'config.';
return ConfigAwareContextValuesContainer;
}(Context));
var ContextKey = /** @class */ (function () {
function ContextKey(service, key, defaultValue) {
this._service = service;
this._key = key;
this._defaultValue = defaultValue;
this.reset();
}
ContextKey.prototype.set = function (value) {
this._service.setContext(this._key, value);
};
ContextKey.prototype.reset = function () {
if (typeof this._defaultValue === 'undefined') {
this._service.removeContext(this._key);
}
else {
this._service.setContext(this._key, this._defaultValue);
}
};
ContextKey.prototype.get = function () {
return this._service.getContextKeyValue(this._key);
};
return ContextKey;
}());
var SimpleContextKeyChangeEvent = /** @class */ (function () {
function SimpleContextKeyChangeEvent(key) {
this.key = key;
}
SimpleContextKeyChangeEvent.prototype.affectsSome = function (keys) {
return keys.has(this.key);
};
return SimpleContextKeyChangeEvent;
}());
var ArrayContextKeyChangeEvent = /** @class */ (function () {
function ArrayContextKeyChangeEvent(keys) {
this.keys = keys;
}
ArrayContextKeyChangeEvent.prototype.affectsSome = function (keys) {
for (var _i = 0, _a = this.keys; _i < _a.length; _i++) {
var key = _a[_i];
if (keys.has(key)) {
return true;
}
}
return false;
};
return ArrayContextKeyChangeEvent;
}());
var CompositeContextKeyChangeEvent = /** @class */ (function () {
function CompositeContextKeyChangeEvent(events) {
this.events = events;
}
CompositeContextKeyChangeEvent.prototype.affectsSome = function (keys) {
for (var _i = 0, _a = this.events; _i < _a.length; _i++) {
var e = _a[_i];
if (e.affectsSome(keys)) {
return true;
}
}
return false;
};
return CompositeContextKeyChangeEvent;
}());
var contextKeyService_AbstractContextKeyService = /** @class */ (function () {
function AbstractContextKeyService(myContextId) {
this._onDidChangeContext = new common_event["e" /* PauseableEmitter */]({ merge: function (input) { return new CompositeContextKeyChangeEvent(input); } });
this._isDisposed = false;
this._myContextId = myContextId;
}
AbstractContextKeyService.prototype.createKey = function (key, defaultValue) {
if (this._isDisposed) {
throw new Error("AbstractContextKeyService has been disposed");
}
return new ContextKey(this, key, defaultValue);
};
Object.defineProperty(AbstractContextKeyService.prototype, "onDidChangeContext", {
get: function () {
return this._onDidChangeContext.event;
},
enumerable: true,
configurable: true
});
AbstractContextKeyService.prototype.bufferChangeEvents = function (callback) {
this._onDidChangeContext.pause();
try {
callback();
}
finally {
this._onDidChangeContext.resume();
}
};
AbstractContextKeyService.prototype.createScoped = function (domNode) {
if (this._isDisposed) {
throw new Error("AbstractContextKeyService has been disposed");
}
return new contextKeyService_ScopedContextKeyService(this, domNode);
};
AbstractContextKeyService.prototype.contextMatchesRules = function (rules) {
if (this._isDisposed) {
throw new Error("AbstractContextKeyService has been disposed");
}
var context = this.getContextValuesContainer(this._myContextId);
var result = keybindingResolver_KeybindingResolver.contextMatchesRules(context, rules);
// console.group(rules.serialize() + ' -> ' + result);
// rules.keys().forEach(key => { console.log(key, ctx[key]); });
// console.groupEnd();
return result;
};
AbstractContextKeyService.prototype.getContextKeyValue = function (key) {
if (this._isDisposed) {
return undefined;
}
return this.getContextValuesContainer(this._myContextId).getValue(key);
};
AbstractContextKeyService.prototype.setContext = function (key, value) {
if (this._isDisposed) {
return;
}
var myContext = this.getContextValuesContainer(this._myContextId);
if (!myContext) {
return;
}
if (myContext.setValue(key, value)) {
this._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));
}
};
AbstractContextKeyService.prototype.removeContext = function (key) {
if (this._isDisposed) {
return;
}
if (this.getContextValuesContainer(this._myContextId).removeValue(key)) {
this._onDidChangeContext.fire(new SimpleContextKeyChangeEvent(key));
}
};
AbstractContextKeyService.prototype.getContext = function (target) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this.getContextValuesContainer(findContextAttr(target));
};
return AbstractContextKeyService;
}());
var contextKeyService_ContextKeyService = /** @class */ (function (_super) {
contextKeyService_extends(ContextKeyService, _super);
function ContextKeyService(configurationService) {
var _this = _super.call(this, 0) || this;
_this._contexts = new Map();
_this._toDispose = new lifecycle["b" /* DisposableStore */]();
_this._lastContextId = 0;
var myContext = new contextKeyService_ConfigAwareContextValuesContainer(_this._myContextId, configurationService, _this._onDidChangeContext);
_this._contexts.set(_this._myContextId, myContext);
_this._toDispose.add(myContext);
return _this;
// Uncomment this to see the contexts continuously logged
// let lastLoggedValue: string | null = null;
// setInterval(() => {
// let values = Object.keys(this._contexts).map((key) => this._contexts[key]);
// let logValue = values.map(v => JSON.stringify(v._value, null, '\t')).join('\n');
// if (lastLoggedValue !== logValue) {
// lastLoggedValue = logValue;
// console.log(lastLoggedValue);
// }
// }, 2000);
}
ContextKeyService.prototype.dispose = function () {
this._isDisposed = true;
this._toDispose.dispose();
};
ContextKeyService.prototype.getContextValuesContainer = function (contextId) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this._contexts.get(contextId) || NullContext.INSTANCE;
};
ContextKeyService.prototype.createChildContext = function (parentContextId) {
if (parentContextId === void 0) { parentContextId = this._myContextId; }
if (this._isDisposed) {
throw new Error("ContextKeyService has been disposed");
}
var id = (++this._lastContextId);
this._contexts.set(id, new Context(id, this.getContextValuesContainer(parentContextId)));
return id;
};
ContextKeyService.prototype.disposeContext = function (contextId) {
if (!this._isDisposed) {
this._contexts.delete(contextId);
}
};
ContextKeyService = contextKeyService_decorate([
contextKeyService_param(0, common_configuration["a" /* IConfigurationService */])
], ContextKeyService);
return ContextKeyService;
}(contextKeyService_AbstractContextKeyService));
var contextKeyService_ScopedContextKeyService = /** @class */ (function (_super) {
contextKeyService_extends(ScopedContextKeyService, _super);
function ScopedContextKeyService(parent, domNode) {
var _this = _super.call(this, parent.createChildContext()) || this;
_this._parent = parent;
if (domNode) {
_this._domNode = domNode;
_this._domNode.setAttribute(KEYBINDING_CONTEXT_ATTR, String(_this._myContextId));
}
return _this;
}
ScopedContextKeyService.prototype.dispose = function () {
this._isDisposed = true;
this._parent.disposeContext(this._myContextId);
if (this._domNode) {
this._domNode.removeAttribute(KEYBINDING_CONTEXT_ATTR);
this._domNode = undefined;
}
};
Object.defineProperty(ScopedContextKeyService.prototype, "onDidChangeContext", {
get: function () {
return common_event["b" /* Event */].any(this._parent.onDidChangeContext, this._onDidChangeContext.event);
},
enumerable: true,
configurable: true
});
ScopedContextKeyService.prototype.getContextValuesContainer = function (contextId) {
if (this._isDisposed) {
return NullContext.INSTANCE;
}
return this._parent.getContextValuesContainer(contextId);
};
ScopedContextKeyService.prototype.createChildContext = function (parentContextId) {
if (parentContextId === void 0) { parentContextId = this._myContextId; }
if (this._isDisposed) {
throw new Error("ScopedContextKeyService has been disposed");
}
return this._parent.createChildContext(parentContextId);
};
ScopedContextKeyService.prototype.disposeContext = function (contextId) {
if (this._isDisposed) {
return;
}
this._parent.disposeContext(contextId);
};
return ScopedContextKeyService;
}(contextKeyService_AbstractContextKeyService));
function findContextAttr(domNode) {
while (domNode) {
if (domNode.hasAttribute(KEYBINDING_CONTEXT_ATTR)) {
var attr = domNode.getAttribute(KEYBINDING_CONTEXT_ATTR);
if (attr) {
return parseInt(attr, 10);
}
return NaN;
}
domNode = domNode.parentElement;
}
return 0;
}
commands["a" /* CommandsRegistry */].registerCommand(contextkey["e" /* SET_CONTEXT_COMMAND_ID */], function (accessor, contextKey, contextValue) {
accessor.get(contextkey["c" /* IContextKeyService */]).createKey(String(contextKey), contextValue);
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.css
var contextMenuHandler = __webpack_require__(643);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/actions.js
var base_common_actions = __webpack_require__(69);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/menu/menu.js
var menu_menu = __webpack_require__(237);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/styler.js
var styler = __webpack_require__(128);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/event.js
var browser_event = __webpack_require__(34);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js
var mouseEvent = __webpack_require__(46);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuHandler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contextMenuHandler_ContextMenuHandler = /** @class */ (function () {
function ContextMenuHandler(contextViewService, telemetryService, notificationService, keybindingService, themeService) {
this.contextViewService = contextViewService;
this.telemetryService = telemetryService;
this.notificationService = notificationService;
this.keybindingService = keybindingService;
this.themeService = themeService;
this.focusToReturn = null;
this.block = null;
this.options = { blockMouse: true };
}
ContextMenuHandler.prototype.configure = function (options) {
this.options = options;
};
ContextMenuHandler.prototype.showContextMenu = function (delegate) {
var _this = this;
var actions = delegate.getActions();
if (!actions.length) {
return; // Don't render an empty context menu
}
this.focusToReturn = document.activeElement;
var menu;
this.contextViewService.showContextView({
getAnchor: function () { return delegate.getAnchor(); },
canRelayout: false,
anchorAlignment: delegate.anchorAlignment,
render: function (container) {
var className = delegate.getMenuClassName ? delegate.getMenuClassName() : '';
if (className) {
container.className += ' ' + className;
}
// Render invisible div to block mouse interaction in the rest of the UI
if (_this.options.blockMouse) {
_this.block = container.appendChild(Object(dom["a" /* $ */])('.context-view-block'));
}
var menuDisposables = new lifecycle["b" /* DisposableStore */]();
var actionRunner = delegate.actionRunner || new base_common_actions["b" /* ActionRunner */]();
actionRunner.onDidBeforeRun(_this.onActionRun, _this, menuDisposables);
actionRunner.onDidRun(_this.onDidActionRun, _this, menuDisposables);
menu = new menu_menu["a" /* Menu */](container, actions, {
actionViewItemProvider: delegate.getActionViewItem,
context: delegate.getActionsContext ? delegate.getActionsContext() : null,
actionRunner: actionRunner,
getKeyBinding: delegate.getKeyBinding ? delegate.getKeyBinding : function (action) { return _this.keybindingService.lookupKeybinding(action.id); }
});
menuDisposables.add(Object(styler["c" /* attachMenuStyler */])(menu, _this.themeService));
menu.onDidCancel(function () { return _this.contextViewService.hideContextView(true); }, null, menuDisposables);
menu.onDidBlur(function () { return _this.contextViewService.hideContextView(true); }, null, menuDisposables);
Object(browser_event["a" /* domEvent */])(window, dom["d" /* EventType */].BLUR)(function () { _this.contextViewService.hideContextView(true); }, null, menuDisposables);
Object(browser_event["a" /* domEvent */])(window, dom["d" /* EventType */].MOUSE_DOWN)(function (e) {
if (e.defaultPrevented) {
return;
}
var event = new mouseEvent["b" /* StandardMouseEvent */](e);
var element = event.target;
// Don't do anything as we are likely creating a context menu
if (event.rightButton) {
return;
}
while (element) {
if (element === container) {
return;
}
element = element.parentElement;
}
_this.contextViewService.hideContextView(true);
}, null, menuDisposables);
return Object(lifecycle["e" /* combinedDisposable */])(menuDisposables, menu);
},
focus: function () {
if (menu) {
menu.focus(!!delegate.autoSelectFirstItem);
}
},
onHide: function (didCancel) {
if (delegate.onHide) {
delegate.onHide(!!didCancel);
}
if (_this.block) {
Object(dom["R" /* removeNode */])(_this.block);
_this.block = null;
}
if (_this.focusToReturn) {
_this.focusToReturn.focus();
}
}
});
};
ContextMenuHandler.prototype.onActionRun = function (e) {
if (this.telemetryService) {
this.telemetryService.publicLog2('workbenchActionExecuted', { id: e.action.id, from: 'contextMenu' });
}
this.contextViewService.hideContextView(false);
// Restore focus here
if (this.focusToReturn) {
this.focusToReturn.focus();
}
};
ContextMenuHandler.prototype.onDidActionRun = function (e) {
if (e.error && this.notificationService) {
this.notificationService.error(e.error);
}
};
return ContextMenuHandler;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/telemetry/common/telemetry.js
var telemetry = __webpack_require__(127);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextMenuService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contextMenuService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var contextMenuService_decorate = (undefined && undefined.__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;
};
var contextMenuService_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var contextMenuService_ContextMenuService = /** @class */ (function (_super) {
contextMenuService_extends(ContextMenuService, _super);
function ContextMenuService(telemetryService, notificationService, contextViewService, keybindingService, themeService) {
var _this = _super.call(this) || this;
_this._onDidContextMenu = _this._register(new common_event["a" /* Emitter */]());
_this.contextMenuHandler = new contextMenuHandler_ContextMenuHandler(contextViewService, telemetryService, notificationService, keybindingService, themeService);
return _this;
}
ContextMenuService.prototype.configure = function (options) {
this.contextMenuHandler.configure(options);
};
// ContextMenu
ContextMenuService.prototype.showContextMenu = function (delegate) {
this.contextMenuHandler.showContextMenu(delegate);
this._onDidContextMenu.fire();
};
ContextMenuService = contextMenuService_decorate([
contextMenuService_param(0, telemetry["a" /* ITelemetryService */]),
contextMenuService_param(1, common_notification["a" /* INotificationService */]),
contextMenuService_param(2, contextView["b" /* IContextViewService */]),
contextMenuService_param(3, common_keybinding["a" /* IKeybindingService */]),
contextMenuService_param(4, common_themeService["c" /* IThemeService */])
], ContextMenuService);
return ContextMenuService;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.css
var contextview = __webpack_require__(645);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/range.js
var common_range = __webpack_require__(90);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/canIUse.js
var canIUse = __webpack_require__(120);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/contextview/contextview.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contextview_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Lays out a one dimensional view next to an anchor in a viewport.
*
* @returns The view offset within the viewport.
*/
function layout(viewportSize, viewSize, anchor) {
var anchorEnd = anchor.offset + anchor.size;
if (anchor.position === 0 /* Before */) {
if (viewSize <= viewportSize - anchorEnd) {
return anchorEnd; // happy case, lay it out after the anchor
}
if (viewSize <= anchor.offset) {
return anchor.offset - viewSize; // ok case, lay it out before the anchor
}
return Math.max(viewportSize - viewSize, 0); // sad case, lay it over the anchor
}
else {
if (viewSize <= anchor.offset) {
return anchor.offset - viewSize; // happy case, lay it out before the anchor
}
if (viewSize <= viewportSize - anchorEnd) {
return anchorEnd; // ok case, lay it out after the anchor
}
return 0; // sad case, lay it over the anchor
}
}
var contextview_ContextView = /** @class */ (function (_super) {
contextview_extends(ContextView, _super);
function ContextView(container) {
var _this = _super.call(this) || this;
_this.container = null;
_this.delegate = null;
_this.toDisposeOnClean = lifecycle["a" /* Disposable */].None;
_this.toDisposeOnSetContainer = lifecycle["a" /* Disposable */].None;
_this.view = dom["a" /* $ */]('.context-view');
dom["J" /* hide */](_this.view);
_this.setContainer(container);
_this._register(Object(lifecycle["h" /* toDisposable */])(function () { return _this.setContainer(null); }));
return _this;
}
ContextView.prototype.setContainer = function (container) {
var _this = this;
if (this.container) {
this.toDisposeOnSetContainer.dispose();
this.container.removeChild(this.view);
this.container = null;
}
if (container) {
this.container = container;
this.container.appendChild(this.view);
var toDisposeOnSetContainer_1 = new lifecycle["b" /* DisposableStore */]();
ContextView.BUBBLE_UP_EVENTS.forEach(function (event) {
toDisposeOnSetContainer_1.add(dom["o" /* addStandardDisposableListener */](_this.container, event, function (e) {
_this.onDOMEvent(e, false);
}));
});
ContextView.BUBBLE_DOWN_EVENTS.forEach(function (event) {
toDisposeOnSetContainer_1.add(dom["o" /* addStandardDisposableListener */](_this.container, event, function (e) {
_this.onDOMEvent(e, true);
}, true));
});
this.toDisposeOnSetContainer = toDisposeOnSetContainer_1;
}
};
ContextView.prototype.show = function (delegate) {
if (this.isVisible()) {
this.hide();
}
// Show static box
dom["t" /* clearNode */](this.view);
this.view.className = 'context-view';
this.view.style.top = '0px';
this.view.style.left = '0px';
dom["X" /* show */](this.view);
// Render content
this.toDisposeOnClean = delegate.render(this.view) || lifecycle["a" /* Disposable */].None;
// Set active delegate
this.delegate = delegate;
// Layout
this.doLayout();
// Focus
if (this.delegate.focus) {
this.delegate.focus();
}
};
ContextView.prototype.layout = function () {
if (!this.isVisible()) {
return;
}
if (this.delegate.canRelayout === false && !(platform["c" /* isIOS */] && canIUse["a" /* BrowserFeatures */].pointerEvents)) {
this.hide();
return;
}
if (this.delegate.layout) {
this.delegate.layout();
}
this.doLayout();
};
ContextView.prototype.doLayout = function () {
// Check that we still have a delegate - this.delegate.layout may have hidden
if (!this.isVisible()) {
return;
}
// Get anchor
var anchor = this.delegate.getAnchor();
// Compute around
var around;
// Get the element's position and size (to anchor the view)
if (dom["L" /* isHTMLElement */](anchor)) {
var elementPosition = dom["C" /* getDomNodePagePosition */](anchor);
around = {
top: elementPosition.top,
left: elementPosition.left,
width: elementPosition.width,
height: elementPosition.height
};
}
else {
around = {
top: anchor.y,
left: anchor.x,
width: anchor.width || 1,
height: anchor.height || 2
};
}
var viewSizeWidth = dom["H" /* getTotalWidth */](this.view);
var viewSizeHeight = dom["G" /* getTotalHeight */](this.view);
var anchorPosition = this.delegate.anchorPosition || 0 /* BELOW */;
var anchorAlignment = this.delegate.anchorAlignment || 0 /* LEFT */;
var verticalAnchor = { offset: around.top - window.pageYOffset, size: around.height, position: anchorPosition === 0 /* BELOW */ ? 0 /* Before */ : 1 /* After */ };
var horizontalAnchor;
if (anchorAlignment === 0 /* LEFT */) {
horizontalAnchor = { offset: around.left, size: 0, position: 0 /* Before */ };
}
else {
horizontalAnchor = { offset: around.left + around.width, size: 0, position: 1 /* After */ };
}
var top = layout(window.innerHeight, viewSizeHeight, verticalAnchor) + window.pageYOffset;
// if view intersects vertically with anchor, shift it horizontally
if (common_range["a" /* Range */].intersects({ start: top, end: top + viewSizeHeight }, { start: verticalAnchor.offset, end: verticalAnchor.offset + verticalAnchor.size })) {
horizontalAnchor.size = around.width;
if (anchorAlignment === 1 /* RIGHT */) {
horizontalAnchor.offset = around.left;
}
}
var left = layout(window.innerWidth, viewSizeWidth, horizontalAnchor);
dom["Q" /* removeClasses */](this.view, 'top', 'bottom', 'left', 'right');
dom["f" /* addClass */](this.view, anchorPosition === 0 /* BELOW */ ? 'bottom' : 'top');
dom["f" /* addClass */](this.view, anchorAlignment === 0 /* LEFT */ ? 'left' : 'right');
var containerPosition = dom["C" /* getDomNodePagePosition */](this.container);
this.view.style.top = top - containerPosition.top + "px";
this.view.style.left = left - containerPosition.left + "px";
this.view.style.width = 'initial';
};
ContextView.prototype.hide = function (data) {
var delegate = this.delegate;
this.delegate = null;
if (delegate === null || delegate === void 0 ? void 0 : delegate.onHide) {
delegate.onHide(data);
}
this.toDisposeOnClean.dispose();
dom["J" /* hide */](this.view);
};
ContextView.prototype.isVisible = function () {
return !!this.delegate;
};
ContextView.prototype.onDOMEvent = function (e, onCapture) {
if (this.delegate) {
if (this.delegate.onDOMEvent) {
this.delegate.onDOMEvent(e, document.activeElement);
}
else if (onCapture && !dom["K" /* isAncestor */](e.target, this.container)) {
this.hide();
}
}
};
ContextView.prototype.dispose = function () {
this.hide();
_super.prototype.dispose.call(this);
};
ContextView.BUBBLE_UP_EVENTS = ['click', 'keydown', 'focus', 'blur'];
ContextView.BUBBLE_DOWN_EVENTS = ['click'];
return ContextView;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/layout/browser/layoutService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ILayoutService = Object(instantiation["c" /* createDecorator */])('layoutService');
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextview/browser/contextViewService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contextViewService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var contextViewService_decorate = (undefined && undefined.__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;
};
var contextViewService_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var contextViewService_ContextViewService = /** @class */ (function (_super) {
contextViewService_extends(ContextViewService, _super);
function ContextViewService(layoutService) {
var _this = _super.call(this) || this;
_this.layoutService = layoutService;
_this.contextView = _this._register(new contextview_ContextView(layoutService.container));
_this.layout();
_this._register(layoutService.onLayout(function () { return _this.layout(); }));
return _this;
}
// ContextView
ContextViewService.prototype.setContainer = function (container) {
this.contextView.setContainer(container);
};
ContextViewService.prototype.showContextView = function (delegate) {
this.contextView.show(delegate);
};
ContextViewService.prototype.layout = function () {
this.contextView.layout();
};
ContextViewService.prototype.hideContextView = function (data) {
this.contextView.hide(data);
};
ContextViewService = contextViewService_decorate([
contextViewService_param(0, ILayoutService)
], ContextViewService);
return ContextViewService;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/dialogs/common/dialogs.js
var IDialogService = Object(instantiation["c" /* createDecorator */])('dialogService');
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/collections.js
var collections = __webpack_require__(110);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/graph.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function newNode(data) {
return {
data: data,
incoming: Object.create(null),
outgoing: Object.create(null)
};
}
var graph_Graph = /** @class */ (function () {
function Graph(_hashFn) {
this._hashFn = _hashFn;
this._nodes = Object.create(null);
// empty
}
Graph.prototype.roots = function () {
var ret = [];
Object(collections["c" /* forEach */])(this._nodes, function (entry) {
if (Object(types["f" /* isEmptyObject */])(entry.value.outgoing)) {
ret.push(entry.value);
}
});
return ret;
};
Graph.prototype.insertEdge = function (from, to) {
var fromNode = this.lookupOrInsertNode(from), toNode = this.lookupOrInsertNode(to);
fromNode.outgoing[this._hashFn(to)] = toNode;
toNode.incoming[this._hashFn(from)] = fromNode;
};
Graph.prototype.removeNode = function (data) {
var key = this._hashFn(data);
delete this._nodes[key];
Object(collections["c" /* forEach */])(this._nodes, function (entry) {
delete entry.value.outgoing[key];
delete entry.value.incoming[key];
});
};
Graph.prototype.lookupOrInsertNode = function (data) {
var key = this._hashFn(data);
var node = this._nodes[key];
if (!node) {
node = newNode(data);
this._nodes[key] = node;
}
return node;
};
Graph.prototype.isEmpty = function () {
for (var _key in this._nodes) {
return false;
}
return true;
};
Graph.prototype.toString = function () {
var data = [];
Object(collections["c" /* forEach */])(this._nodes, function (entry) {
data.push(entry.key + ", (incoming)[" + Object.keys(entry.value.incoming).join(', ') + "], (outgoing)[" + Object.keys(entry.value.outgoing).join(',') + "]");
});
return data.join('\n');
};
return Graph;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/descriptors.js
var descriptors = __webpack_require__(156);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js
var serviceCollection = __webpack_require__(134);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiationService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var instantiationService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var instantiationService_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
// TRACING
var _enableTracing = false;
var _canUseProxy = typeof Proxy === 'function';
var CyclicDependencyError = /** @class */ (function (_super) {
instantiationService_extends(CyclicDependencyError, _super);
function CyclicDependencyError(graph) {
var _this = _super.call(this, 'cyclic dependency between services') || this;
_this.message = graph.toString();
return _this;
}
return CyclicDependencyError;
}(Error));
var instantiationService_InstantiationService = /** @class */ (function () {
function InstantiationService(services, strict, parent) {
if (services === void 0) { services = new serviceCollection["a" /* ServiceCollection */](); }
if (strict === void 0) { strict = false; }
this._services = services;
this._strict = strict;
this._parent = parent;
this._services.set(instantiation["a" /* IInstantiationService */], this);
}
InstantiationService.prototype.createChild = function (services) {
return new InstantiationService(services, this._strict, this);
};
InstantiationService.prototype.invokeFunction = function (fn) {
var _this = this;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var _trace = Trace.traceInvocation(fn);
var _done = false;
try {
var accessor = {
get: function (id, isOptional) {
if (_done) {
throw Object(errors["c" /* illegalState */])('service accessor is only valid during the invocation of its target method');
}
var result = _this._getOrCreateServiceInstance(id, _trace);
if (!result && isOptional !== instantiation["d" /* optional */]) {
throw new Error("[invokeFunction] unknown service '" + id + "'");
}
return result;
}
};
return fn.apply(undefined, instantiationService_spreadArrays([accessor], args));
}
finally {
_done = true;
_trace.stop();
}
};
InstantiationService.prototype.createInstance = function (ctorOrDescriptor) {
var rest = [];
for (var _i = 1; _i < arguments.length; _i++) {
rest[_i - 1] = arguments[_i];
}
var _trace;
var result;
if (ctorOrDescriptor instanceof descriptors["a" /* SyncDescriptor */]) {
_trace = Trace.traceCreation(ctorOrDescriptor.ctor);
result = this._createInstance(ctorOrDescriptor.ctor, ctorOrDescriptor.staticArguments.concat(rest), _trace);
}
else {
_trace = Trace.traceCreation(ctorOrDescriptor);
result = this._createInstance(ctorOrDescriptor, rest, _trace);
}
_trace.stop();
return result;
};
InstantiationService.prototype._createInstance = function (ctor, args, _trace) {
if (args === void 0) { args = []; }
// arguments defined by service decorators
var serviceDependencies = instantiation["b" /* _util */].getServiceDependencies(ctor).sort(function (a, b) { return a.index - b.index; });
var serviceArgs = [];
for (var _i = 0, serviceDependencies_1 = serviceDependencies; _i < serviceDependencies_1.length; _i++) {
var dependency = serviceDependencies_1[_i];
var service = this._getOrCreateServiceInstance(dependency.id, _trace);
if (!service && this._strict && !dependency.optional) {
throw new Error("[createInstance] " + ctor.name + " depends on UNKNOWN service " + dependency.id + ".");
}
serviceArgs.push(service);
}
var firstServiceArgPos = serviceDependencies.length > 0 ? serviceDependencies[0].index : args.length;
// check for argument mismatches, adjust static args if needed
if (args.length !== firstServiceArgPos) {
console.warn("[createInstance] First service dependency of " + ctor.name + " at position " + (firstServiceArgPos + 1) + " conflicts with " + args.length + " static arguments");
var delta = firstServiceArgPos - args.length;
if (delta > 0) {
args = args.concat(new Array(delta));
}
else {
args = args.slice(0, firstServiceArgPos);
}
}
// now create the instance
return new (ctor.bind.apply(ctor, instantiationService_spreadArrays([void 0], instantiationService_spreadArrays(args, serviceArgs))))();
};
InstantiationService.prototype._setServiceInstance = function (id, instance) {
if (this._services.get(id) instanceof descriptors["a" /* SyncDescriptor */]) {
this._services.set(id, instance);
}
else if (this._parent) {
this._parent._setServiceInstance(id, instance);
}
else {
throw new Error('illegalState - setting UNKNOWN service instance');
}
};
InstantiationService.prototype._getServiceInstanceOrDescriptor = function (id) {
var instanceOrDesc = this._services.get(id);
if (!instanceOrDesc && this._parent) {
return this._parent._getServiceInstanceOrDescriptor(id);
}
else {
return instanceOrDesc;
}
};
InstantiationService.prototype._getOrCreateServiceInstance = function (id, _trace) {
var thing = this._getServiceInstanceOrDescriptor(id);
if (thing instanceof descriptors["a" /* SyncDescriptor */]) {
return this._createAndCacheServiceInstance(id, thing, _trace.branch(id, true));
}
else {
_trace.branch(id, false);
return thing;
}
};
InstantiationService.prototype._createAndCacheServiceInstance = function (id, desc, _trace) {
var graph = new graph_Graph(function (data) { return data.id.toString(); });
var cycleCount = 0;
var stack = [{ id: id, desc: desc, _trace: _trace }];
while (stack.length) {
var item = stack.pop();
graph.lookupOrInsertNode(item);
// a weak but working heuristic for cycle checks
if (cycleCount++ > 150) {
throw new CyclicDependencyError(graph);
}
// check all dependencies for existence and if they need to be created first
for (var _i = 0, _a = instantiation["b" /* _util */].getServiceDependencies(item.desc.ctor); _i < _a.length; _i++) {
var dependency = _a[_i];
var instanceOrDesc = this._getServiceInstanceOrDescriptor(dependency.id);
if (!instanceOrDesc && !dependency.optional) {
console.warn("[createInstance] " + id + " depends on " + dependency.id + " which is NOT registered.");
}
if (instanceOrDesc instanceof descriptors["a" /* SyncDescriptor */]) {
var d = { id: dependency.id, desc: instanceOrDesc, _trace: item._trace.branch(dependency.id, true) };
graph.insertEdge(item, d);
stack.push(d);
}
}
}
while (true) {
var roots = graph.roots();
// if there is no more roots but still
// nodes in the graph we have a cycle
if (roots.length === 0) {
if (!graph.isEmpty()) {
throw new CyclicDependencyError(graph);
}
break;
}
for (var _b = 0, roots_1 = roots; _b < roots_1.length; _b++) {
var data = roots_1[_b].data;
// create instance and overwrite the service collections
var instance = this._createServiceInstanceWithOwner(data.id, data.desc.ctor, data.desc.staticArguments, data.desc.supportsDelayedInstantiation, data._trace);
this._setServiceInstance(data.id, instance);
graph.removeNode(data);
}
}
return this._getServiceInstanceOrDescriptor(id);
};
InstantiationService.prototype._createServiceInstanceWithOwner = function (id, ctor, args, supportsDelayedInstantiation, _trace) {
if (args === void 0) { args = []; }
if (this._services.get(id) instanceof descriptors["a" /* SyncDescriptor */]) {
return this._createServiceInstance(ctor, args, supportsDelayedInstantiation, _trace);
}
else if (this._parent) {
return this._parent._createServiceInstanceWithOwner(id, ctor, args, supportsDelayedInstantiation, _trace);
}
else {
throw new Error("illegalState - creating UNKNOWN service instance " + ctor.name);
}
};
InstantiationService.prototype._createServiceInstance = function (ctor, args, _supportsDelayedInstantiation, _trace) {
var _this = this;
if (args === void 0) { args = []; }
if (!_supportsDelayedInstantiation || !_canUseProxy) {
// eager instantiation or no support JS proxies (e.g. IE11)
return this._createInstance(ctor, args, _trace);
}
else {
// Return a proxy object that's backed by an idle value. That
// strategy is to instantiate services in our idle time or when actually
// needed but not when injected into a consumer
var idle_1 = new common_async["b" /* IdleValue */](function () { return _this._createInstance(ctor, args, _trace); });
return new Proxy(Object.create(null), {
get: function (target, key) {
if (key in target) {
return target[key];
}
var obj = idle_1.getValue();
var prop = obj[key];
if (typeof prop !== 'function') {
return prop;
}
prop = prop.bind(obj);
target[key] = prop;
return prop;
},
set: function (_target, p, value) {
idle_1.getValue()[p] = value;
return true;
}
});
}
};
return InstantiationService;
}());
var Trace = /** @class */ (function () {
function Trace(type, name) {
this.type = type;
this.name = name;
this._start = Date.now();
this._dep = [];
}
Trace.traceInvocation = function (ctor) {
return !_enableTracing ? Trace._None : new Trace(1 /* Invocation */, ctor.name || ctor.toString().substring(0, 42).replace(/\n/g, ''));
};
Trace.traceCreation = function (ctor) {
return !_enableTracing ? Trace._None : new Trace(0 /* Creation */, ctor.name);
};
Trace.prototype.branch = function (id, first) {
var child = new Trace(2 /* Branch */, id.toString());
this._dep.push([id, first, child]);
return child;
};
Trace.prototype.stop = function () {
var dur = Date.now() - this._start;
Trace._totals += dur;
var causedCreation = false;
function printChild(n, trace) {
var res = [];
var prefix = new Array(n + 1).join('\t');
for (var _i = 0, _a = trace._dep; _i < _a.length; _i++) {
var _b = _a[_i], id = _b[0], first = _b[1], child = _b[2];
if (first && child) {
causedCreation = true;
res.push(prefix + "CREATES -> " + id);
var nested = printChild(n + 1, child);
if (nested) {
res.push(nested);
}
}
else {
res.push(prefix + "uses -> " + id);
}
}
return res.join('\n');
}
var lines = [
(this.type === 0 /* Creation */ ? 'CREATE' : 'CALL') + " " + this.name,
"" + printChild(1, this),
"DONE, took " + dur.toFixed(2) + "ms (grand total " + Trace._totals.toFixed(2) + "ms)"
];
if (dur > 2 || causedCreation) {
console.log(lines.join('\n'));
}
};
Trace._None = new /** @class */ (function (_super) {
instantiationService_extends(class_1, _super);
function class_1() {
return _super.call(this, -1, null) || this;
}
class_1.prototype.stop = function () { };
class_1.prototype.branch = function () { return this; };
return class_1;
}(Trace));
Trace._totals = 0;
return Trace;
}());
//#endregion
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/label/common/label.js
var common_label = __webpack_require__(151);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js + 9 modules
var listService = __webpack_require__(145);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/markers/common/markers.js
var common_markers = __webpack_require__(50);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/markers/common/markerService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var markerService_MapMap;
(function (MapMap) {
function get(map, key1, key2) {
if (map[key1]) {
return map[key1][key2];
}
return undefined;
}
MapMap.get = get;
function set(map, key1, key2, value) {
if (!map[key1]) {
map[key1] = Object.create(null);
}
map[key1][key2] = value;
}
MapMap.set = set;
function remove(map, key1, key2) {
if (map[key1] && map[key1][key2]) {
delete map[key1][key2];
if (Object(types["f" /* isEmptyObject */])(map[key1])) {
delete map[key1];
}
return true;
}
return false;
}
MapMap.remove = remove;
})(markerService_MapMap || (markerService_MapMap = {}));
var markerService_MarkerStats = /** @class */ (function () {
function MarkerStats(service) {
this.errors = 0;
this.infos = 0;
this.warnings = 0;
this.unknowns = 0;
this._data = Object.create(null);
this._service = service;
this._subscription = service.onMarkerChanged(this._update, this);
}
MarkerStats.prototype.dispose = function () {
this._subscription.dispose();
this._data = undefined;
};
MarkerStats.prototype._update = function (resources) {
if (!this._data) {
return;
}
for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
var resource = resources_1[_i];
var key = resource.toString();
var oldStats = this._data[key];
if (oldStats) {
this._substract(oldStats);
}
var newStats = this._resourceStats(resource);
this._add(newStats);
this._data[key] = newStats;
}
};
MarkerStats.prototype._resourceStats = function (resource) {
var result = { errors: 0, warnings: 0, infos: 0, unknowns: 0 };
// TODO this is a hack
if (resource.scheme === network["b" /* Schemas */].inMemory || resource.scheme === network["b" /* Schemas */].walkThrough || resource.scheme === network["b" /* Schemas */].walkThroughSnippet) {
return result;
}
for (var _i = 0, _a = this._service.read({ resource: resource }); _i < _a.length; _i++) {
var severity = _a[_i].severity;
if (severity === common_markers["c" /* MarkerSeverity */].Error) {
result.errors += 1;
}
else if (severity === common_markers["c" /* MarkerSeverity */].Warning) {
result.warnings += 1;
}
else if (severity === common_markers["c" /* MarkerSeverity */].Info) {
result.infos += 1;
}
else {
result.unknowns += 1;
}
}
return result;
};
MarkerStats.prototype._substract = function (op) {
this.errors -= op.errors;
this.warnings -= op.warnings;
this.infos -= op.infos;
this.unknowns -= op.unknowns;
};
MarkerStats.prototype._add = function (op) {
this.errors += op.errors;
this.warnings += op.warnings;
this.infos += op.infos;
this.unknowns += op.unknowns;
};
return MarkerStats;
}());
var markerService_MarkerService = /** @class */ (function () {
function MarkerService() {
this._onMarkerChanged = new common_event["a" /* Emitter */]();
this._onMarkerChangedEvent = common_event["b" /* Event */].debounce(this._onMarkerChanged.event, MarkerService._debouncer, 0);
this._byResource = Object.create(null);
this._byOwner = Object.create(null);
this._stats = new markerService_MarkerStats(this);
}
MarkerService.prototype.dispose = function () {
this._stats.dispose();
};
Object.defineProperty(MarkerService.prototype, "onMarkerChanged", {
get: function () {
return this._onMarkerChangedEvent;
},
enumerable: true,
configurable: true
});
MarkerService.prototype.remove = function (owner, resources) {
for (var _i = 0, _a = resources || []; _i < _a.length; _i++) {
var resource = _a[_i];
this.changeOne(owner, resource, []);
}
};
MarkerService.prototype.changeOne = function (owner, resource, markerData) {
if (Object(arrays["p" /* isFalsyOrEmpty */])(markerData)) {
// remove marker for this (owner,resource)-tuple
var a = markerService_MapMap.remove(this._byResource, resource.toString(), owner);
var b = markerService_MapMap.remove(this._byOwner, owner, resource.toString());
if (a !== b) {
throw new Error('invalid marker service state');
}
if (a && b) {
this._onMarkerChanged.fire([resource]);
}
}
else {
// insert marker for this (owner,resource)-tuple
var markers = [];
for (var _i = 0, markerData_1 = markerData; _i < markerData_1.length; _i++) {
var data = markerData_1[_i];
var marker = MarkerService._toMarker(owner, resource, data);
if (marker) {
markers.push(marker);
}
}
markerService_MapMap.set(this._byResource, resource.toString(), owner, markers);
markerService_MapMap.set(this._byOwner, owner, resource.toString(), markers);
this._onMarkerChanged.fire([resource]);
}
};
MarkerService._toMarker = function (owner, resource, data) {
var code = data.code, severity = data.severity, message = data.message, source = data.source, startLineNumber = data.startLineNumber, startColumn = data.startColumn, endLineNumber = data.endLineNumber, endColumn = data.endColumn, relatedInformation = data.relatedInformation, tags = data.tags;
if (!message) {
return undefined;
}
// santize data
startLineNumber = startLineNumber > 0 ? startLineNumber : 1;
startColumn = startColumn > 0 ? startColumn : 1;
endLineNumber = endLineNumber >= startLineNumber ? endLineNumber : startLineNumber;
endColumn = endColumn > 0 ? endColumn : startColumn;
return {
resource: resource,
owner: owner,
code: code,
severity: severity,
message: message,
source: source,
startLineNumber: startLineNumber,
startColumn: startColumn,
endLineNumber: endLineNumber,
endColumn: endColumn,
relatedInformation: relatedInformation,
tags: tags,
};
};
MarkerService.prototype.read = function (filter) {
if (filter === void 0) { filter = Object.create(null); }
var owner = filter.owner, resource = filter.resource, severities = filter.severities, take = filter.take;
if (!take || take < 0) {
take = -1;
}
if (owner && resource) {
// exactly one owner AND resource
var data = markerService_MapMap.get(this._byResource, resource.toString(), owner);
if (!data) {
return [];
}
else {
var result = [];
for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
var marker = data_1[_i];
if (MarkerService._accept(marker, severities)) {
var newLen = result.push(marker);
if (take > 0 && newLen === take) {
break;
}
}
}
return result;
}
}
else if (!owner && !resource) {
// all
var result = [];
for (var key1 in this._byResource) {
for (var key2 in this._byResource[key1]) {
for (var _a = 0, _b = this._byResource[key1][key2]; _a < _b.length; _a++) {
var data = _b[_a];
if (MarkerService._accept(data, severities)) {
var newLen = result.push(data);
if (take > 0 && newLen === take) {
return result;
}
}
}
}
}
return result;
}
else {
// of one resource OR owner
var map = owner
? this._byOwner[owner]
: resource ? this._byResource[resource.toString()] : undefined;
if (!map) {
return [];
}
var result = [];
for (var key in map) {
for (var _c = 0, _d = map[key]; _c < _d.length; _c++) {
var data = _d[_c];
if (MarkerService._accept(data, severities)) {
var newLen = result.push(data);
if (take > 0 && newLen === take) {
return result;
}
}
}
}
return result;
}
};
MarkerService._accept = function (marker, severities) {
return severities === undefined || (severities & marker.severity) === marker.severity;
};
MarkerService._debouncer = function (last, event) {
if (!last) {
MarkerService._dedupeMap = Object.create(null);
last = [];
}
for (var _i = 0, event_1 = event; _i < event_1.length; _i++) {
var uri = event_1[_i];
if (MarkerService._dedupeMap[uri.toString()] === undefined) {
MarkerService._dedupeMap[uri.toString()] = true;
last.push(uri);
}
}
return last;
};
return MarkerService;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/storage/common/storage.js
var storage = __webpack_require__(91);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/actions/common/menuService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var menuService_decorate = (undefined && undefined.__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;
};
var menuService_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var menuService_MenuService = /** @class */ (function () {
function MenuService(_commandService) {
this._commandService = _commandService;
//
}
MenuService.prototype.createMenu = function (id, contextKeyService) {
return new menuService_Menu(id, this._commandService, contextKeyService);
};
MenuService = menuService_decorate([
menuService_param(0, commands["b" /* ICommandService */])
], MenuService);
return MenuService;
}());
var menuService_Menu = /** @class */ (function () {
function Menu(_id, _commandService, _contextKeyService) {
var _this = this;
this._id = _id;
this._commandService = _commandService;
this._contextKeyService = _contextKeyService;
this._onDidChange = new common_event["a" /* Emitter */]();
this._dispoables = new lifecycle["b" /* DisposableStore */]();
this._menuGroups = [];
this._contextKeys = new Set();
this._build();
// rebuild this menu whenever the menu registry reports an
// event for this MenuId
this._dispoables.add(common_event["b" /* Event */].debounce(common_event["b" /* Event */].filter(common_actions["c" /* MenuRegistry */].onDidChangeMenu, function (menuId) { return menuId === _this._id; }), function () { }, 50)(this._build, this));
// when context keys change we need to check if the menu also
// has changed
this._dispoables.add(common_event["b" /* Event */].debounce(this._contextKeyService.onDidChangeContext, function (last, event) { return last || event.affectsSome(_this._contextKeys); }, 50)(function (e) { return e && _this._onDidChange.fire(undefined); }, this));
}
Menu.prototype.dispose = function () {
this._dispoables.dispose();
this._onDidChange.dispose();
};
Menu.prototype._build = function () {
// reset
this._menuGroups.length = 0;
this._contextKeys.clear();
var menuItems = common_actions["c" /* MenuRegistry */].getMenuItems(this._id);
var group;
menuItems.sort(Menu._compareMenuItems);
for (var _i = 0, menuItems_1 = menuItems; _i < menuItems_1.length; _i++) {
var item = menuItems_1[_i];
// group by groupId
var groupName = item.group || '';
if (!group || group[0] !== groupName) {
group = [groupName, []];
this._menuGroups.push(group);
}
group[1].push(item);
// keep keys for eventing
Menu._fillInKbExprKeys(item.when, this._contextKeys);
// keep precondition keys for event if applicable
if (Object(common_actions["e" /* isIMenuItem */])(item) && item.command.precondition) {
Menu._fillInKbExprKeys(item.command.precondition, this._contextKeys);
}
// keep toggled keys for event if applicable
if (Object(common_actions["e" /* isIMenuItem */])(item) && item.command.toggled) {
Menu._fillInKbExprKeys(item.command.toggled, this._contextKeys);
}
}
this._onDidChange.fire(this);
};
Menu.prototype.getActions = function (options) {
var result = [];
for (var _i = 0, _a = this._menuGroups; _i < _a.length; _i++) {
var group = _a[_i];
var id = group[0], items = group[1];
var activeActions = [];
for (var _b = 0, items_1 = items; _b < items_1.length; _b++) {
var item = items_1[_b];
if (this._contextKeyService.contextMatchesRules(item.when)) {
var action = Object(common_actions["e" /* isIMenuItem */])(item)
? new common_actions["b" /* MenuItemAction */](item.command, item.alt, options, this._contextKeyService, this._commandService)
: new common_actions["d" /* SubmenuItemAction */](item);
activeActions.push(action);
}
}
if (activeActions.length > 0) {
result.push([id, activeActions]);
}
}
return result;
};
Menu._fillInKbExprKeys = function (exp, set) {
if (exp) {
for (var _i = 0, _a = exp.keys(); _i < _a.length; _i++) {
var key = _a[_i];
set.add(key);
}
}
};
Menu._compareMenuItems = function (a, b) {
var aGroup = a.group;
var bGroup = b.group;
if (aGroup !== bGroup) {
// Falsy groups come last
if (!aGroup) {
return 1;
}
else if (!bGroup) {
return -1;
}
// 'navigation' group comes first
if (aGroup === 'navigation') {
return -1;
}
else if (bGroup === 'navigation') {
return 1;
}
// lexical sort for groups
var value = aGroup.localeCompare(bGroup);
if (value !== 0) {
return value;
}
}
// sort on priority - default is 0
var aPrio = a.order || 0;
var bPrio = b.order || 0;
if (aPrio < bPrio) {
return -1;
}
else if (aPrio > bPrio) {
return 1;
}
// sort on titles
return Menu._compareTitles(Object(common_actions["e" /* isIMenuItem */])(a) ? a.command.title : a.title, Object(common_actions["e" /* isIMenuItem */])(b) ? b.command.title : b.title);
};
Menu._compareTitles = function (a, b) {
var aStr = typeof a === 'string' ? a : a.value;
var bStr = typeof b === 'string' ? b : b.value;
return aStr.localeCompare(bStr);
};
Menu = menuService_decorate([
menuService_param(1, commands["b" /* ICommandService */]),
menuService_param(2, contextkey["c" /* IContextKeyService */])
], Menu);
return Menu;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/markersDecorationService.js
var markersDecorationService = __webpack_require__(238);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/services/markerDecorationsServiceImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var markerDecorationsServiceImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var markerDecorationsServiceImpl_decorate = (undefined && undefined.__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;
};
var markerDecorationsServiceImpl_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
function markerDecorationsServiceImpl_MODEL_ID(resource) {
return resource.toString();
}
var markerDecorationsServiceImpl_MarkerDecorations = /** @class */ (function (_super) {
markerDecorationsServiceImpl_extends(MarkerDecorations, _super);
function MarkerDecorations(model) {
var _this = _super.call(this) || this;
_this.model = model;
_this._markersData = new Map();
_this._register(Object(lifecycle["h" /* toDisposable */])(function () {
_this.model.deltaDecorations(Object(common_map["d" /* keys */])(_this._markersData), []);
_this._markersData.clear();
}));
return _this;
}
MarkerDecorations.prototype.update = function (markers, newDecorations) {
var oldIds = Object(common_map["d" /* keys */])(this._markersData);
this._markersData.clear();
var ids = this.model.deltaDecorations(oldIds, newDecorations);
for (var index = 0; index < ids.length; index++) {
this._markersData.set(ids[index], markers[index]);
}
};
MarkerDecorations.prototype.getMarker = function (decoration) {
return this._markersData.get(decoration.id);
};
return MarkerDecorations;
}(lifecycle["a" /* Disposable */]));
var markerDecorationsServiceImpl_MarkerDecorationsService = /** @class */ (function (_super) {
markerDecorationsServiceImpl_extends(MarkerDecorationsService, _super);
function MarkerDecorationsService(modelService, _markerService) {
var _this = _super.call(this) || this;
_this._markerService = _markerService;
_this._onDidChangeMarker = _this._register(new common_event["a" /* Emitter */]());
_this._markerDecorations = new Map();
modelService.getModels().forEach(function (model) { return _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));
return _this;
}
MarkerDecorationsService.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._markerDecorations.forEach(function (value) { return value.dispose(); });
this._markerDecorations.clear();
};
MarkerDecorationsService.prototype.getMarker = function (model, decoration) {
var markerDecorations = this._markerDecorations.get(markerDecorationsServiceImpl_MODEL_ID(model.uri));
return markerDecorations ? Object(types["o" /* withUndefinedAsNull */])(markerDecorations.getMarker(decoration)) : null;
};
MarkerDecorationsService.prototype._handleMarkerChange = function (changedResources) {
var _this = this;
changedResources.forEach(function (resource) {
var markerDecorations = _this._markerDecorations.get(markerDecorationsServiceImpl_MODEL_ID(resource));
if (markerDecorations) {
_this._updateDecorations(markerDecorations);
}
});
};
MarkerDecorationsService.prototype._onModelAdded = function (model) {
var markerDecorations = new markerDecorationsServiceImpl_MarkerDecorations(model);
this._markerDecorations.set(markerDecorationsServiceImpl_MODEL_ID(model.uri), markerDecorations);
this._updateDecorations(markerDecorations);
};
MarkerDecorationsService.prototype._onModelRemoved = function (model) {
var _this = this;
var markerDecorations = this._markerDecorations.get(markerDecorationsServiceImpl_MODEL_ID(model.uri));
if (markerDecorations) {
markerDecorations.dispose();
this._markerDecorations.delete(markerDecorationsServiceImpl_MODEL_ID(model.uri));
}
// clean up markers for internal, transient models
if (model.uri.scheme === network["b" /* Schemas */].inMemory
|| model.uri.scheme === network["b" /* Schemas */].internal
|| model.uri.scheme === network["b" /* Schemas */].vscode) {
if (this._markerService) {
this._markerService.read({ resource: model.uri }).map(function (marker) { return marker.owner; }).forEach(function (owner) { return _this._markerService.remove(owner, [model.uri]); });
}
}
};
MarkerDecorationsService.prototype._updateDecorations = function (markerDecorations) {
var _this = this;
// Limit to the first 500 errors/warnings
var markers = this._markerService.read({ resource: markerDecorations.model.uri, take: 500 });
var newModelDecorations = markers.map(function (marker) {
return {
range: _this._createDecorationRange(markerDecorations.model, marker),
options: _this._createDecorationOption(marker)
};
});
markerDecorations.update(markers, newModelDecorations);
this._onDidChangeMarker.fire(markerDecorations.model);
};
MarkerDecorationsService.prototype._createDecorationRange = function (model, rawMarker) {
var ret = core_range["a" /* Range */].lift(rawMarker);
if (rawMarker.severity === common_markers["c" /* MarkerSeverity */].Hint && !this._hasMarkerTag(rawMarker, 1 /* Unnecessary */) && !this._hasMarkerTag(rawMarker, 2 /* Deprecated */)) {
// * never render hints on multiple lines
// * make enough space for three dots
ret = ret.setEndPosition(ret.startLineNumber, ret.startColumn + 2);
}
ret = model.validateRange(ret);
if (ret.isEmpty()) {
var word = model.getWordAtPosition(ret.getStartPosition());
if (word) {
ret = new core_range["a" /* Range */](ret.startLineNumber, word.startColumn, ret.endLineNumber, word.endColumn);
}
else {
var maxColumn = model.getLineLastNonWhitespaceColumn(ret.startLineNumber) ||
model.getLineMaxColumn(ret.startLineNumber);
if (maxColumn === 1) {
// empty line
// console.warn('marker on empty line:', marker);
}
else if (ret.endColumn >= maxColumn) {
// behind eol
ret = new core_range["a" /* Range */](ret.startLineNumber, maxColumn - 1, ret.endLineNumber, maxColumn);
}
else {
// extend marker to width = 1
ret = new core_range["a" /* Range */](ret.startLineNumber, ret.startColumn, ret.endLineNumber, ret.endColumn + 1);
}
}
}
else if (rawMarker.endColumn === Number.MAX_VALUE && rawMarker.startColumn === 1 && ret.startLineNumber === ret.endLineNumber) {
var minColumn = model.getLineFirstNonWhitespaceColumn(rawMarker.startLineNumber);
if (minColumn < ret.endColumn) {
ret = new core_range["a" /* Range */](ret.startLineNumber, minColumn, ret.endLineNumber, ret.endColumn);
rawMarker.startColumn = minColumn;
}
}
return ret;
};
MarkerDecorationsService.prototype._createDecorationOption = function (marker) {
var className;
var color = undefined;
var zIndex;
var inlineClassName = undefined;
var minimap;
switch (marker.severity) {
case common_markers["c" /* MarkerSeverity */].Hint:
if (this._hasMarkerTag(marker, 2 /* Deprecated */)) {
className = undefined;
}
else if (this._hasMarkerTag(marker, 1 /* Unnecessary */)) {
className = "squiggly-unnecessary" /* EditorUnnecessaryDecoration */;
}
else {
className = "squiggly-hint" /* EditorHintDecoration */;
}
zIndex = 0;
break;
case common_markers["c" /* MarkerSeverity */].Warning:
className = "squiggly-warning" /* EditorWarningDecoration */;
color = Object(common_themeService["f" /* themeColorFromId */])(editorColorRegistry["r" /* overviewRulerWarning */]);
zIndex = 20;
minimap = {
color: Object(common_themeService["f" /* themeColorFromId */])(colorRegistry["Jb" /* minimapWarning */]),
position: common_model["c" /* MinimapPosition */].Inline
};
break;
case common_markers["c" /* MarkerSeverity */].Info:
className = "squiggly-info" /* EditorInfoDecoration */;
color = Object(common_themeService["f" /* themeColorFromId */])(editorColorRegistry["q" /* overviewRulerInfo */]);
zIndex = 10;
break;
case common_markers["c" /* MarkerSeverity */].Error:
default:
className = "squiggly-error" /* EditorErrorDecoration */;
color = Object(common_themeService["f" /* themeColorFromId */])(editorColorRegistry["p" /* overviewRulerError */]);
zIndex = 30;
minimap = {
color: Object(common_themeService["f" /* themeColorFromId */])(colorRegistry["Gb" /* minimapError */]),
position: common_model["c" /* MinimapPosition */].Inline
};
break;
}
if (marker.tags) {
if (marker.tags.indexOf(1 /* Unnecessary */) !== -1) {
inlineClassName = "squiggly-inline-unnecessary" /* EditorUnnecessaryInlineDecoration */;
}
if (marker.tags.indexOf(2 /* Deprecated */) !== -1) {
inlineClassName = "squiggly-inline-deprecated" /* EditorDeprecatedInlineDecoration */;
}
}
return {
stickiness: 1 /* NeverGrowsWhenTypingAtEdges */,
className: className,
showIfCollapsed: true,
overviewRuler: {
color: color,
position: common_model["d" /* OverviewRulerLane */].Right
},
minimap: minimap,
zIndex: zIndex,
inlineClassName: inlineClassName,
};
};
MarkerDecorationsService.prototype._hasMarkerTag = function (marker, tag) {
if (marker.tags) {
return marker.tags.indexOf(tag) >= 0;
}
return false;
};
MarkerDecorationsService = markerDecorationsServiceImpl_decorate([
markerDecorationsServiceImpl_param(0, services_modelService["a" /* IModelService */]),
markerDecorationsServiceImpl_param(1, common_markers["b" /* IMarkerService */])
], MarkerDecorationsService);
return MarkerDecorationsService;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/extensions.js
var extensions = __webpack_require__(119);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibilityService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var accessibilityService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var accessibilityService_decorate = (undefined && undefined.__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;
};
var accessibilityService_param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var accessibilityService_AccessibilityService = /** @class */ (function (_super) {
accessibilityService_extends(AccessibilityService, _super);
function AccessibilityService(_contextKeyService, _configurationService) {
var _this = _super.call(this) || this;
_this._contextKeyService = _contextKeyService;
_this._configurationService = _configurationService;
_this._accessibilitySupport = 0 /* Unknown */;
_this._onDidChangeScreenReaderOptimized = new common_event["a" /* Emitter */]();
_this._accessibilityModeEnabledContext = accessibility["a" /* CONTEXT_ACCESSIBILITY_MODE_ENABLED */].bindTo(_this._contextKeyService);
var updateContextKey = function () { return _this._accessibilityModeEnabledContext.set(_this.isScreenReaderOptimized()); };
_this._register(_this._configurationService.onDidChangeConfiguration(function (e) {
if (e.affectsConfiguration('editor.accessibilitySupport')) {
updateContextKey();
_this._onDidChangeScreenReaderOptimized.fire();
}
}));
updateContextKey();
_this.onDidChangeScreenReaderOptimized(function () { return updateContextKey(); });
return _this;
}
Object.defineProperty(AccessibilityService.prototype, "onDidChangeScreenReaderOptimized", {
get: function () {
return this._onDidChangeScreenReaderOptimized.event;
},
enumerable: true,
configurable: true
});
AccessibilityService.prototype.isScreenReaderOptimized = function () {
var config = this._configurationService.getValue('editor.accessibilitySupport');
return config === 'on' || (config === 'auto' && this._accessibilitySupport === 2 /* Enabled */);
};
AccessibilityService.prototype.getAccessibilitySupport = function () {
return this._accessibilitySupport;
};
AccessibilityService = accessibilityService_decorate([
accessibilityService_param(0, contextkey["c" /* IContextKeyService */]),
accessibilityService_param(1, common_configuration["a" /* IConfigurationService */])
], AccessibilityService);
return AccessibilityService;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var standaloneServices_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var standaloneServices_StaticServices;
(function (StaticServices) {
var _serviceCollection = new serviceCollection["a" /* ServiceCollection */]();
var LazyStaticService = /** @class */ (function () {
function LazyStaticService(serviceId, factory) {
this._serviceId = serviceId;
this._factory = factory;
this._value = null;
}
Object.defineProperty(LazyStaticService.prototype, "id", {
get: function () { return this._serviceId; },
enumerable: true,
configurable: true
});
LazyStaticService.prototype.get = function (overrides) {
if (!this._value) {
if (overrides) {
this._value = overrides[this._serviceId.toString()];
}
if (!this._value) {
this._value = this._factory(overrides);
}
if (!this._value) {
throw new Error('Service ' + this._serviceId + ' is missing!');
}
_serviceCollection.set(this._serviceId, this._value);
}
return this._value;
};
return LazyStaticService;
}());
StaticServices.LazyStaticService = LazyStaticService;
var _all = [];
function define(serviceId, factory) {
var r = new LazyStaticService(serviceId, factory);
_all.push(r);
return r;
}
function init(overrides) {
// Create a fresh service collection
var result = new serviceCollection["a" /* ServiceCollection */]();
// make sure to add all services that use `registerSingleton`
for (var _i = 0, _a = Object(extensions["a" /* getSingletonServiceDescriptors */])(); _i < _a.length; _i++) {
var _b = _a[_i], id = _b[0], descriptor = _b[1];
result.set(id, descriptor);
}
// Initialize the service collection with the overrides
for (var serviceId in overrides) {
if (overrides.hasOwnProperty(serviceId)) {
result.set(Object(instantiation["c" /* createDecorator */])(serviceId), overrides[serviceId]);
}
}
// Make sure the same static services are present in all service collections
_all.forEach(function (service) { return result.set(service.id, service.get(overrides)); });
// Ensure the collection gets the correct instantiation service
var instantiationService = new instantiationService_InstantiationService(result, true);
result.set(instantiation["a" /* IInstantiationService */], instantiationService);
return [result, instantiationService];
}
StaticServices.init = init;
StaticServices.instantiationService = define(instantiation["a" /* IInstantiationService */], function () { return new instantiationService_InstantiationService(_serviceCollection, true); });
var configurationServiceImpl = new simpleServices_SimpleConfigurationService();
StaticServices.configurationService = define(common_configuration["a" /* IConfigurationService */], function () { return configurationServiceImpl; });
StaticServices.resourceConfigurationService = define(textResourceConfigurationService["a" /* ITextResourceConfigurationService */], function () { return new simpleServices_SimpleResourceConfigurationService(configurationServiceImpl); });
StaticServices.resourcePropertiesService = define(textResourceConfigurationService["b" /* ITextResourcePropertiesService */], function () { return new simpleServices_SimpleResourcePropertiesService(configurationServiceImpl); });
StaticServices.contextService = define(common_workspace["a" /* IWorkspaceContextService */], function () { return new simpleServices_SimpleWorkspaceContextService(); });
StaticServices.labelService = define(common_label["a" /* ILabelService */], function () { return new SimpleUriLabelService(); });
StaticServices.telemetryService = define(telemetry["a" /* ITelemetryService */], function () { return new StandaloneTelemetryService(); });
StaticServices.dialogService = define(IDialogService, function () { return new SimpleDialogService(); });
StaticServices.notificationService = define(common_notification["a" /* INotificationService */], function () { return new simpleServices_SimpleNotificationService(); });
StaticServices.markerService = define(common_markers["b" /* IMarkerService */], function () { return new markerService_MarkerService(); });
StaticServices.modeService = define(services_modeService["a" /* IModeService */], function (o) { return new modeServiceImpl_ModeServiceImpl(); });
StaticServices.standaloneThemeService = define(common_standaloneThemeService["a" /* IStandaloneThemeService */], function () { return new standaloneThemeServiceImpl_StandaloneThemeServiceImpl(); });
StaticServices.logService = define(log["a" /* ILogService */], function () { return new log["c" /* NullLogService */](); });
StaticServices.modelService = define(services_modelService["a" /* IModelService */], function (o) { return new modelServiceImpl_ModelServiceImpl(StaticServices.configurationService.get(o), StaticServices.resourcePropertiesService.get(o), StaticServices.standaloneThemeService.get(o), StaticServices.logService.get(o)); });
StaticServices.markerDecorationsService = define(markersDecorationService["a" /* IMarkerDecorationsService */], function (o) { return new markerDecorationsServiceImpl_MarkerDecorationsService(StaticServices.modelService.get(o), StaticServices.markerService.get(o)); });
StaticServices.codeEditorService = define(services_codeEditorService["a" /* ICodeEditorService */], function (o) { return new standaloneCodeServiceImpl_StandaloneCodeEditorServiceImpl(StaticServices.standaloneThemeService.get(o)); });
StaticServices.editorProgressService = define(progress["a" /* IEditorProgressService */], function () { return new SimpleEditorProgressService(); });
StaticServices.storageService = define(storage["a" /* IStorageService */], function () { return new storage["b" /* InMemoryStorageService */](); });
StaticServices.editorWorkerService = define(services_editorWorkerService["a" /* IEditorWorkerService */], function (o) { return new editorWorkerServiceImpl_EditorWorkerServiceImpl(StaticServices.modelService.get(o), StaticServices.resourceConfigurationService.get(o), StaticServices.logService.get(o)); });
})(standaloneServices_StaticServices || (standaloneServices_StaticServices = {}));
var standaloneServices_DynamicStandaloneServices = /** @class */ (function (_super) {
standaloneServices_extends(DynamicStandaloneServices, _super);
function DynamicStandaloneServices(domElement, overrides) {
var _this = _super.call(this) || this;
var _a = standaloneServices_StaticServices.init(overrides), _serviceCollection = _a[0], _instantiationService = _a[1];
_this._serviceCollection = _serviceCollection;
_this._instantiationService = _instantiationService;
var configurationService = _this.get(common_configuration["a" /* IConfigurationService */]);
var notificationService = _this.get(common_notification["a" /* INotificationService */]);
var telemetryService = _this.get(telemetry["a" /* ITelemetryService */]);
var themeService = _this.get(common_themeService["c" /* IThemeService */]);
var ensure = function (serviceId, factory) {
var value = null;
if (overrides) {
value = overrides[serviceId.toString()];
}
if (!value) {
value = factory();
}
_this._serviceCollection.set(serviceId, value);
return value;
};
var contextKeyService = ensure(contextkey["c" /* IContextKeyService */], function () { return _this._register(new contextKeyService_ContextKeyService(configurationService)); });
ensure(accessibility["b" /* IAccessibilityService */], function () { return new accessibilityService_AccessibilityService(contextKeyService, configurationService); });
ensure(listService["a" /* IListService */], function () { return new listService["b" /* ListService */](themeService); });
var commandService = ensure(commands["b" /* ICommandService */], function () { return new simpleServices_StandaloneCommandService(_this._instantiationService); });
var keybindingService = ensure(common_keybinding["a" /* IKeybindingService */], function () { return _this._register(new simpleServices_StandaloneKeybindingService(contextKeyService, commandService, telemetryService, notificationService, domElement)); });
var layoutService = ensure(ILayoutService, function () { return new simpleServices_SimpleLayoutService(domElement); });
var contextViewService = ensure(contextView["b" /* IContextViewService */], function () { return _this._register(new contextViewService_ContextViewService(layoutService)); });
ensure(contextView["a" /* IContextMenuService */], function () {
var contextMenuService = new contextMenuService_ContextMenuService(telemetryService, notificationService, contextViewService, keybindingService, themeService);
contextMenuService.configure({ blockMouse: false }); // we do not want that in the standalone editor
return _this._register(contextMenuService);
});
ensure(common_actions["a" /* IMenuService */], function () { return new menuService_MenuService(commandService); });
ensure(bulkEditService["a" /* IBulkEditService */], function () { return new simpleServices_SimpleBulkEditService(standaloneServices_StaticServices.modelService.get(services_modelService["a" /* IModelService */])); });
return _this;
}
DynamicStandaloneServices.prototype.get = function (serviceId) {
var r = this._serviceCollection.get(serviceId);
if (!r) {
throw new Error('Missing service ' + serviceId);
}
return r;
};
DynamicStandaloneServices.prototype.set = function (serviceId, instance) {
this._serviceCollection.set(serviceId, instance);
};
DynamicStandaloneServices.prototype.has = function (serviceId) {
return this._serviceCollection.has(serviceId);
};
return DynamicStandaloneServices;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/config/configuration.js + 1 modules
var config_configuration = __webpack_require__(71);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneEditor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function withAllStandaloneServices(domElement, override, callback) {
var services = new standaloneServices_DynamicStandaloneServices(domElement, override);
var simpleEditorModelResolverService = null;
if (!services.has(resolverService["a" /* ITextModelService */])) {
simpleEditorModelResolverService = new simpleServices_SimpleEditorModelResolverService(standaloneServices_StaticServices.modelService.get());
services.set(resolverService["a" /* ITextModelService */], simpleEditorModelResolverService);
}
if (!services.has(common_opener["a" /* IOpenerService */])) {
services.set(common_opener["a" /* IOpenerService */], new openerService_OpenerService(services.get(services_codeEditorService["a" /* ICodeEditorService */]), services.get(commands["b" /* ICommandService */])));
}
var result = callback(services);
if (simpleEditorModelResolverService) {
simpleEditorModelResolverService.setEditor(result);
}
return result;
}
/**
* Create a new editor under `domElement`.
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
function standaloneEditor_create(domElement, options, override) {
return withAllStandaloneServices(domElement, override || {}, function (services) {
return new standaloneCodeEditor_StandaloneEditor(domElement, options, services, services.get(instantiation["a" /* IInstantiationService */]), services.get(services_codeEditorService["a" /* ICodeEditorService */]), services.get(commands["b" /* ICommandService */]), services.get(contextkey["c" /* IContextKeyService */]), services.get(common_keybinding["a" /* IKeybindingService */]), services.get(contextView["b" /* IContextViewService */]), services.get(common_standaloneThemeService["a" /* IStandaloneThemeService */]), services.get(common_notification["a" /* INotificationService */]), services.get(common_configuration["a" /* IConfigurationService */]), services.get(accessibility["b" /* IAccessibilityService */]));
});
}
/**
* Emitted when an editor is created.
* Creating a diff editor might cause this listener to be invoked with the two editors.
* @event
*/
function onDidCreateEditor(listener) {
return standaloneServices_StaticServices.codeEditorService.get().onCodeEditorAdd(function (editor) {
listener(editor);
});
}
/**
* Create a new diff editor under `domElement`.
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
function createDiffEditor(domElement, options, override) {
return withAllStandaloneServices(domElement, override || {}, function (services) {
return new standaloneCodeEditor_StandaloneDiffEditor(domElement, options, services, services.get(instantiation["a" /* IInstantiationService */]), services.get(contextkey["c" /* IContextKeyService */]), services.get(common_keybinding["a" /* IKeybindingService */]), services.get(contextView["b" /* IContextViewService */]), services.get(services_editorWorkerService["a" /* IEditorWorkerService */]), services.get(services_codeEditorService["a" /* ICodeEditorService */]), services.get(common_standaloneThemeService["a" /* IStandaloneThemeService */]), services.get(common_notification["a" /* INotificationService */]), services.get(common_configuration["a" /* IConfigurationService */]), services.get(contextView["a" /* IContextMenuService */]), services.get(progress["a" /* IEditorProgressService */]), null);
});
}
function createDiffNavigator(diffEditor, opts) {
return new diffNavigator["a" /* DiffNavigator */](diffEditor, opts);
}
function doCreateModel(value, languageSelection, uri) {
return standaloneServices_StaticServices.modelService.get().createModel(value, languageSelection, uri);
}
/**
* Create a new editor model.
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
*/
function createModel(value, language, uri) {
value = value || '';
if (!language) {
var firstLF = value.indexOf('\n');
var firstLine = value;
if (firstLF !== -1) {
firstLine = value.substring(0, firstLF);
}
return doCreateModel(value, standaloneServices_StaticServices.modeService.get().createByFilepathOrFirstLine(uri || null, firstLine), uri);
}
return doCreateModel(value, standaloneServices_StaticServices.modeService.get().create(language), uri);
}
/**
* Change the language for a model.
*/
function setModelLanguage(model, languageId) {
standaloneServices_StaticServices.modelService.get().setMode(model, standaloneServices_StaticServices.modeService.get().create(languageId));
}
/**
* Set the markers for a model.
*/
function setModelMarkers(model, owner, markers) {
if (model) {
standaloneServices_StaticServices.markerService.get().changeOne(owner, model.uri, markers);
}
}
/**
* Get markers for owner and/or resource
*
* @returns list of markers
*/
function getModelMarkers(filter) {
return standaloneServices_StaticServices.markerService.get().read(filter);
}
/**
* Get the model that has `uri` if it exists.
*/
function getModel(uri) {
return standaloneServices_StaticServices.modelService.get().getModel(uri);
}
/**
* Get all the created models.
*/
function getModels() {
return standaloneServices_StaticServices.modelService.get().getModels();
}
/**
* Emitted when a model is created.
* @event
*/
function onDidCreateModel(listener) {
return standaloneServices_StaticServices.modelService.get().onModelAdded(listener);
}
/**
* Emitted right before a model is disposed.
* @event
*/
function onWillDisposeModel(listener) {
return standaloneServices_StaticServices.modelService.get().onModelRemoved(listener);
}
/**
* Emitted when a different language is set to a model.
* @event
*/
function onDidChangeModelLanguage(listener) {
return standaloneServices_StaticServices.modelService.get().onModelModeChanged(function (e) {
listener({
model: e.model,
oldLanguage: e.oldModeId
});
});
}
/**
* Create a new web worker that has model syncing capabilities built in.
* Specify an AMD module to load that will `create` an object that will be proxied.
*/
function standaloneEditor_createWebWorker(opts) {
return createWebWorker(standaloneServices_StaticServices.modelService.get(), opts);
}
/**
* Colorize the contents of `domNode` using attribute `data-lang`.
*/
function colorizeElement(domNode, options) {
return colorizer_Colorizer.colorizeElement(standaloneServices_StaticServices.standaloneThemeService.get(), standaloneServices_StaticServices.modeService.get(), domNode, options);
}
/**
* Colorize `text` using language `languageId`.
*/
function colorize(text, languageId, options) {
return colorizer_Colorizer.colorize(standaloneServices_StaticServices.modeService.get(), text, languageId, options);
}
/**
* Colorize a line in a model.
*/
function colorizeModelLine(model, lineNumber, tabSize) {
if (tabSize === void 0) { tabSize = 4; }
return colorizer_Colorizer.colorizeModelLine(model, lineNumber, tabSize);
}
/**
* @internal
*/
function getSafeTokenizationSupport(language) {
var tokenizationSupport = modes["B" /* TokenizationRegistry */].get(language);
if (tokenizationSupport) {
return tokenizationSupport;
}
return {
getInitialState: function () { return nullMode["c" /* NULL_STATE */]; },
tokenize: function (line, state, deltaOffset) { return Object(nullMode["d" /* nullTokenize */])(language, line, state, deltaOffset); }
};
}
/**
* Tokenize `text` using language `languageId`
*/
function tokenize(text, languageId) {
var modeService = standaloneServices_StaticServices.modeService.get();
// Needed in order to get the mode registered for subsequent look-ups
modeService.triggerMode(languageId);
var tokenizationSupport = getSafeTokenizationSupport(languageId);
var lines = text.split(/\r\n|\r|\n/);
var result = [];
var state = tokenizationSupport.getInitialState();
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
var tokenizationResult = tokenizationSupport.tokenize(line, state, 0);
result[i] = tokenizationResult.tokens;
state = tokenizationResult.endState;
}
return result;
}
/**
* Define a new theme or update an existing theme.
*/
function defineTheme(themeName, themeData) {
standaloneServices_StaticServices.standaloneThemeService.get().defineTheme(themeName, themeData);
}
/**
* Switches to a theme.
*/
function setTheme(themeName) {
standaloneServices_StaticServices.standaloneThemeService.get().setTheme(themeName);
}
/**
* Clears all cached font measurements and triggers re-measurement.
*/
function remeasureFonts() {
Object(config_configuration["b" /* clearAllFontInfos */])();
}
/**
* @internal
*/
function createMonacoEditorAPI() {
return {
// methods
create: standaloneEditor_create,
onDidCreateEditor: onDidCreateEditor,
createDiffEditor: createDiffEditor,
createDiffNavigator: createDiffNavigator,
createModel: createModel,
setModelLanguage: setModelLanguage,
setModelMarkers: setModelMarkers,
getModelMarkers: getModelMarkers,
getModels: getModels,
getModel: getModel,
onDidCreateModel: onDidCreateModel,
onWillDisposeModel: onWillDisposeModel,
onDidChangeModelLanguage: onDidChangeModelLanguage,
createWebWorker: standaloneEditor_createWebWorker,
colorizeElement: colorizeElement,
colorize: colorize,
colorizeModelLine: colorizeModelLine,
tokenize: tokenize,
defineTheme: defineTheme,
setTheme: setTheme,
remeasureFonts: remeasureFonts,
// enums
AccessibilitySupport: AccessibilitySupport,
ContentWidgetPositionPreference: ContentWidgetPositionPreference,
CursorChangeReason: CursorChangeReason,
DefaultEndOfLine: DefaultEndOfLine,
EditorAutoIndentStrategy: EditorAutoIndentStrategy,
EditorOption: EditorOption,
EndOfLinePreference: EndOfLinePreference,
EndOfLineSequence: EndOfLineSequence,
MinimapPosition: MinimapPosition,
MouseTargetType: MouseTargetType,
OverlayWidgetPositionPreference: OverlayWidgetPositionPreference,
OverviewRulerLane: OverviewRulerLane,
RenderLineNumbersType: RenderLineNumbersType,
RenderMinimap: RenderMinimap,
ScrollbarVisibility: ScrollbarVisibility,
ScrollType: ScrollType,
TextEditorCursorBlinkingStyle: TextEditorCursorBlinkingStyle,
TextEditorCursorStyle: TextEditorCursorStyle,
TrackedRangeStickiness: TrackedRangeStickiness,
WrappingIndent: WrappingIndent,
// classes
ConfigurationChangedEvent: editorOptions["a" /* ConfigurationChangedEvent */],
BareFontInfo: fontInfo["a" /* BareFontInfo */],
FontInfo: fontInfo["b" /* FontInfo */],
TextModelResolvedOptions: common_model["e" /* TextModelResolvedOptions */],
FindMatch: common_model["b" /* FindMatch */],
// vars
EditorType: editorCommon["a" /* EditorType */],
EditorOptions: editorOptions["e" /* EditorOptions */]
};
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/common/monarch/monarchCompile.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/*
* This module only exports 'compile' which compiles a JSON language definition
* into a typed and checked ILexer definition.
*/
/*
* Type helpers
*
* Note: this is just for sanity checks on the JSON description which is
* helpful for the programmer. No checks are done anymore once the lexer is
* already 'compiled and checked'.
*
*/
function isArrayOf(elemType, obj) {
if (!obj) {
return false;
}
if (!(Array.isArray(obj))) {
return false;
}
for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) {
var el = obj_1[_i];
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(array) {
var result = {};
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
var e = array_1[_i];
result[e] = true;
}
return result;
}
function createKeywordMatcher(arr, caseInsensitive) {
if (caseInsensitive === void 0) { caseInsensitive = false; }
if (caseInsensitive) {
arr = arr.map(function (x) { return x.toLowerCase(); });
}
var hash = arrayToHash(arr);
if (caseInsensitive) {
return function (word) {
return hash[word.toLowerCase()] !== undefined && hash.hasOwnProperty(word.toLowerCase());
};
}
else {
return function (word) {
return hash[word] !== undefined && hash.hasOwnProperty(word);
};
}
}
// Lexer helpers
/**
* Compiles a regular expression string, adding the 'i' flag if 'ignoreCase' is set.
* Also replaces @\w+ or sequences with the content of the specified attribute
*/
function compileRegExp(lexer, str) {
var n = 0;
while (str.indexOf('@') >= 0 && n < 5) { // at most 5 expansions
n++;
str = str.replace(/@(\w+)/g, function (s, attr) {
var sub = '';
if (typeof (lexer[attr]) === 'string') {
sub = lexer[attr];
}
else if (lexer[attr] && lexer[attr] instanceof RegExp) {
sub = lexer[attr].source;
}
else {
if (lexer[attr] === undefined) {
throw createError(lexer, 'language definition does not contain attribute \'' + attr + '\', used at: ' + str);
}
else {
throw createError(lexer, 'attribute reference \'' + attr + '\' must be a string, used at: ' + str);
}
}
return (empty(sub) ? '' : '(?:' + sub + ')');
});
}
return new RegExp(str, (lexer.ignoreCase ? 'i' : ''));
}
/**
* Compiles guard functions for case matches.
* This compiles 'cases' attributes into efficient match functions.
*
*/
function selectScrutinee(id, matches, state, num) {
if (num < 0) {
return id;
}
if (num < matches.length) {
return matches[num];
}
if (num >= 100) {
num = num - 100;
var parts = state.split('.');
parts.unshift(state);
if (num < parts.length) {
return parts[num];
}
}
return null;
}
function createGuard(lexer, ruleName, tkey, val) {
// get the scrutinee and pattern
var scrut = -1; // -1: $!, 0-99: $n, 100+n: $Sn
var oppat = tkey;
var matches = tkey.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);
if (matches) {
if (matches[3]) { // if digits
scrut = parseInt(matches[3]);
if (matches[2]) {
scrut = scrut + 100; // if [sS] present
}
}
oppat = matches[4];
}
// get operator
var op = '~';
var pat = oppat;
if (!oppat || oppat.length === 0) {
op = '!=';
pat = '';
}
else if (/^\w*$/.test(pat)) { // just a word
op = '==';
}
else {
matches = oppat.match(/^(@|!@|~|!~|==|!=)(.*)$/);
if (matches) {
op = matches[1];
pat = matches[2];
}
}
// set the tester function
var tester;
// special case a regexp that matches just words
if ((op === '~' || op === '!~') && /^(\w|\|)*$/.test(pat)) {
var inWords_1 = createKeywordMatcher(pat.split('|'), lexer.ignoreCase);
tester = function (s) { return (op === '~' ? inWords_1(s) : !inWords_1(s)); };
}
else if (op === '@' || op === '!@') {
var words = lexer[pat];
if (!words) {
throw createError(lexer, 'the @ match target \'' + pat + '\' is not defined, in rule: ' + ruleName);
}
if (!(isArrayOf(function (elem) { return (typeof (elem) === 'string'); }, words))) {
throw createError(lexer, 'the @ match target \'' + pat + '\' must be an array of strings, in rule: ' + ruleName);
}
var inWords_2 = createKeywordMatcher(words, lexer.ignoreCase);
tester = function (s) { return (op === '@' ? inWords_2(s) : !inWords_2(s)); };
}
else if (op === '~' || op === '!~') {
if (pat.indexOf('$') < 0) {
// precompile regular expression
var re_1 = compileRegExp(lexer, '^' + pat + '$');
tester = function (s) { return (op === '~' ? re_1.test(s) : !re_1.test(s)); };
}
else {
tester = function (s, id, matches, state) {
var re = compileRegExp(lexer, '^' + substituteMatches(lexer, pat, id, matches, state) + '$');
return re.test(s);
};
}
}
else { // if (op==='==' || op==='!=') {
if (pat.indexOf('$') < 0) {
var patx_1 = fixCase(lexer, pat);
tester = function (s) { return (op === '==' ? s === patx_1 : s !== patx_1); };
}
else {
var patx_2 = fixCase(lexer, pat);
tester = function (s, id, matches, state, eos) {
var patexp = substituteMatches(lexer, patx_2, id, matches, state);
return (op === '==' ? s === patexp : s !== patexp);
};
}
}
// return the branch object
if (scrut === -1) {
return {
name: tkey, value: val, test: function (id, matches, state, eos) {
return tester(id, id, matches, state, eos);
}
};
}
else {
return {
name: tkey, value: val, test: function (id, matches, state, eos) {
var scrutinee = selectScrutinee(id, matches, state, scrut);
return tester(!scrutinee ? '' : scrutinee, id, matches, state, eos);
}
};
}
}
/**
* Compiles an action: i.e. optimize regular expressions and case matches
* and do many sanity checks.
*
* This is called only during compilation but if the lexer definition
* contains user functions as actions (which is usually not allowed), then this
* may be called during lexing. It is important therefore to compile common cases efficiently
*/
function compileAction(lexer, ruleName, action) {
if (!action) {
return { token: '' };
}
else if (typeof (action) === 'string') {
return action; // { token: action };
}
else if (action.token || action.token === '') {
if (typeof (action.token) !== 'string') {
throw createError(lexer, 'a \'token\' attribute must be of type string, in rule: ' + ruleName);
}
else {
// only copy specific typed fields (only happens once during compile Lexer)
var newAction = { token: action.token };
if (action.token.indexOf('$') >= 0) {
newAction.tokenSubst = true;
}
if (typeof (action.bracket) === 'string') {
if (action.bracket === '@open') {
newAction.bracket = 1 /* Open */;
}
else if (action.bracket === '@close') {
newAction.bracket = -1 /* Close */;
}
else {
throw createError(lexer, 'a \'bracket\' attribute must be either \'@open\' or \'@close\', in rule: ' + ruleName);
}
}
if (action.next) {
if (typeof (action.next) !== 'string') {
throw createError(lexer, 'the next state must be a string value in rule: ' + ruleName);
}
else {
var next = action.next;
if (!/^(@pop|@push|@popall)$/.test(next)) {
if (next[0] === '@') {
next = next.substr(1); // peel off starting @ sign
}
if (next.indexOf('$') < 0) { // no dollar substitution, we can check if the state exists
if (!stateExists(lexer, substituteMatches(lexer, next, '', [], ''))) {
throw createError(lexer, '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;
lexer.usesEmbedded = true;
}
return newAction;
}
}
else if (Array.isArray(action)) {
var results = [];
for (var i = 0, len = action.length; i < len; i++) {
results[i] = compileAction(lexer, ruleName, action[i]);
}
return { group: results };
}
else if (action.cases) {
// build an array of test cases
var cases_1 = [];
// for each case, push a test function and result value
for (var tkey in action.cases) {
if (action.cases.hasOwnProperty(tkey)) {
var val = compileAction(lexer, ruleName, action.cases[tkey]);
// what kind of case
if (tkey === '@default' || tkey === '@' || tkey === '') {
cases_1.push({ test: undefined, value: val, name: tkey });
}
else if (tkey === '@eos') {
cases_1.push({ test: function (id, matches, state, eos) { return eos; }, value: val, name: tkey });
}
else {
cases_1.push(createGuard(lexer, ruleName, tkey, val)); // call separate function to avoid local variable capture
}
}
}
// create a matching function
var def_1 = lexer.defaultToken;
return {
test: function (id, matches, state, eos) {
for (var _i = 0, cases_2 = cases_1; _i < cases_2.length; _i++) {
var _case = cases_2[_i];
var didmatch = (!_case.test || _case.test(id, matches, state, eos));
if (didmatch) {
return _case.value;
}
}
return def_1;
}
};
}
else {
throw createError(lexer, 'an action must be a string, an object with a \'token\' or \'cases\' attribute, or an array of actions; in rule: ' + ruleName);
}
}
/**
* Helper class for creating matching rules
*/
var monarchCompile_Rule = /** @class */ (function () {
function Rule(name) {
this.regex = new RegExp('');
this.action = { token: '' };
this.matchOnlyAtLineStart = false;
this.name = '';
this.name = name;
}
Rule.prototype.setRegex = function (lexer, re) {
var sregex;
if (typeof (re) === 'string') {
sregex = re;
}
else if (re instanceof RegExp) {
sregex = re.source;
}
else {
throw createError(lexer, '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(lexer, '^(?:' + (this.matchOnlyAtLineStart ? sregex.substr(1) : sregex) + ')');
};
Rule.prototype.setAction = function (lexer, act) {
this.action = compileAction(lexer, this.name, act);
};
return Rule;
}());
/**
* Compiles a json description function into json where all regular expressions,
* case matches etc, are compiled and all include rules are expanded.
* We also compile the bracket definitions, supply defaults, and do many sanity checks.
* If the 'jsonStrict' parameter is 'false', we allow at certain locations
* regular expression objects and functions that get called during lexing.
* (Currently we have no samples that need this so perhaps we should always have
* jsonStrict to true).
*/
function compile(languageId, json) {
if (!json || typeof (json) !== 'object') {
throw new Error('Monarch: expecting a language definition object');
}
// Create our lexer
var lexer = {};
lexer.languageId = languageId;
lexer.noThrow = false; // raise exceptions during compilation
lexer.maxStack = 100;
// Set standard fields: be defensive about types
lexer.start = (typeof json.start === 'string' ? json.start : null);
lexer.ignoreCase = bool(json.ignoreCase, false);
lexer.tokenPostfix = string(json.tokenPostfix, '.' + lexer.languageId);
lexer.defaultToken = string(json.defaultToken, 'source');
lexer.usesEmbedded = false; // becomes true if we find a nextEmbedded action
// For calling compileAction later on
var lexerMin = json;
lexerMin.languageId = languageId;
lexerMin.ignoreCase = lexer.ignoreCase;
lexerMin.noThrow = lexer.noThrow;
lexerMin.usesEmbedded = lexer.usesEmbedded;
lexerMin.stateNames = json.tokenizer;
lexerMin.defaultToken = lexer.defaultToken;
// Compile an array of rules into newrules where RegExp objects are created.
function addRules(state, newrules, rules) {
for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
var rule = rules_1[_i];
var include = rule.include;
if (include) {
if (typeof (include) !== 'string') {
throw createError(lexer, 'an \'include\' attribute must be a string at: ' + state);
}
if (include[0] === '@') {
include = include.substr(1); // peel off starting @
}
if (!json.tokenizer[include]) {
throw createError(lexer, 'include target \'' + include + '\' is not defined at: ' + state);
}
addRules(state + '.' + include, newrules, json.tokenizer[include]);
}
else {
var newrule = new monarchCompile_Rule(state);
// Set up new rule attributes
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') {
var rule1 = rule[1];
rule1.next = rule[2];
newrule.setAction(lexerMin, rule1);
}
else {
throw createError(lexer, '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(lexer, '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);
}
}
}
// compile the tokenizer rules
if (!json.tokenizer || typeof (json.tokenizer) !== 'object') {
throw createError(lexer, 'a language definition must define the \'tokenizer\' attribute as an object');
}
lexer.tokenizer = [];
for (var key in json.tokenizer) {
if (json.tokenizer.hasOwnProperty(key)) {
if (!lexer.start) {
lexer.start = key;
}
var rules = json.tokenizer[key];
lexer.tokenizer[key] = new Array();
addRules('tokenizer.' + key, lexer.tokenizer[key], rules);
}
}
lexer.usesEmbedded = lexerMin.usesEmbedded; // can be set during compileAction
// Set simple brackets
if (json.brackets) {
if (!(Array.isArray(json.brackets))) {
throw createError(lexer, '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' }
];
}
var brackets = [];
for (var _i = 0, _a = json.brackets; _i < _a.length; _i++) {
var el = _a[_i];
var 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(lexer, '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 + lexer.tokenPostfix,
open: fixCase(lexer, desc.open),
close: fixCase(lexer, desc.close)
});
}
else {
throw createError(lexer, 'every element in the \'brackets\' array must be a \'{open,close,token}\' object or array');
}
}
lexer.brackets = brackets;
// Disable throw so the syntax highlighter goes, no matter what
lexer.noThrow = true;
return lexer;
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/standalone/browser/standaloneLanguages.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Register information about a new language.
*/
function register(language) {
modesRegistry["a" /* ModesRegistry */].registerLanguage(language);
}
/**
* Get the information of all the registered languages.
*/
function getLanguages() {
var result = [];
result = result.concat(modesRegistry["a" /* ModesRegistry */].getLanguages());
return result;
}
function getEncodedLanguageId(languageId) {
var lid = standaloneServices_StaticServices.modeService.get().getLanguageIdentifier(languageId);
return lid ? lid.id : 0;
}
/**
* An event emitted when a language is first time needed (e.g. a model has it set).
* @event
*/
function onLanguage(languageId, callback) {
var disposable = standaloneServices_StaticServices.modeService.get().onDidCreateMode(function (mode) {
if (mode.getId() === languageId) {
// stop listening
disposable.dispose();
// invoke actual listener
callback();
}
});
return disposable;
}
/**
* Set the editing configuration for a language.
*/
function setLanguageConfiguration(languageId, configuration) {
var languageIdentifier = standaloneServices_StaticServices.modeService.get().getLanguageIdentifier(languageId);
if (!languageIdentifier) {
throw new Error("Cannot set configuration for unknown language " + languageId);
}
return languageConfigurationRegistry["a" /* LanguageConfigurationRegistry */].register(languageIdentifier, configuration);
}
/**
* @internal
*/
var standaloneLanguages_EncodedTokenizationSupport2Adapter = /** @class */ (function () {
function EncodedTokenizationSupport2Adapter(actual) {
this._actual = actual;
}
EncodedTokenizationSupport2Adapter.prototype.getInitialState = function () {
return this._actual.getInitialState();
};
EncodedTokenizationSupport2Adapter.prototype.tokenize = function (line, state, offsetDelta) {
throw new Error('Not supported!');
};
EncodedTokenizationSupport2Adapter.prototype.tokenize2 = function (line, state) {
var result = this._actual.tokenizeEncoded(line, state);
return new core_token["c" /* TokenizationResult2 */](result.tokens, result.endState);
};
return EncodedTokenizationSupport2Adapter;
}());
/**
* @internal
*/
var standaloneLanguages_TokenizationSupport2Adapter = /** @class */ (function () {
function TokenizationSupport2Adapter(standaloneThemeService, languageIdentifier, actual) {
this._standaloneThemeService = standaloneThemeService;
this._languageIdentifier = languageIdentifier;
this._actual = actual;
}
TokenizationSupport2Adapter.prototype.getInitialState = function () {
return this._actual.getInitialState();
};
TokenizationSupport2Adapter.prototype._toClassicTokens = function (tokens, language, offsetDelta) {
var result = [];
var previousStartIndex = 0;
for (var i = 0, len = tokens.length; i < len; i++) {
var t = tokens[i];
var startIndex = t.startIndex;
// Prevent issues stemming from a buggy external tokenizer.
if (i === 0) {
// Force first token to start at first index!
startIndex = 0;
}
else if (startIndex < previousStartIndex) {
// Force tokens to be after one another!
startIndex = previousStartIndex;
}
result[i] = new core_token["a" /* Token */](startIndex + offsetDelta, t.scopes, language);
previousStartIndex = startIndex;
}
return result;
};
TokenizationSupport2Adapter.prototype.tokenize = function (line, state, offsetDelta) {
var actualResult = this._actual.tokenize(line, state);
var tokens = this._toClassicTokens(actualResult.tokens, this._languageIdentifier.language, offsetDelta);
var endState;
// try to save an object if possible
if (actualResult.endState.equals(state)) {
endState = state;
}
else {
endState = actualResult.endState;
}
return new core_token["b" /* TokenizationResult */](tokens, endState);
};
TokenizationSupport2Adapter.prototype._toBinaryTokens = function (tokens, offsetDelta) {
var languageId = this._languageIdentifier.id;
var tokenTheme = this._standaloneThemeService.getTheme().tokenTheme;
var result = [], resultLen = 0;
var previousStartIndex = 0;
for (var i = 0, len = tokens.length; i < len; i++) {
var t = tokens[i];
var metadata = tokenTheme.match(languageId, t.scopes);
if (resultLen > 0 && result[resultLen - 1] === metadata) {
// same metadata
continue;
}
var startIndex = t.startIndex;
// Prevent issues stemming from a buggy external tokenizer.
if (i === 0) {
// Force first token to start at first index!
startIndex = 0;
}
else if (startIndex < previousStartIndex) {
// Force tokens to be after one another!
startIndex = previousStartIndex;
}
result[resultLen++] = startIndex + offsetDelta;
result[resultLen++] = metadata;
previousStartIndex = startIndex;
}
var actualResult = new Uint32Array(resultLen);
for (var i = 0; i < resultLen; i++) {
actualResult[i] = result[i];
}
return actualResult;
};
TokenizationSupport2Adapter.prototype.tokenize2 = function (line, state, offsetDelta) {
var actualResult = this._actual.tokenize(line, state);
var tokens = this._toBinaryTokens(actualResult.tokens, offsetDelta);
var endState;
// try to save an object if possible
if (actualResult.endState.equals(state)) {
endState = state;
}
else {
endState = actualResult.endState;
}
return new core_token["c" /* TokenizationResult2 */](tokens, endState);
};
return TokenizationSupport2Adapter;
}());
function isEncodedTokensProvider(provider) {
return 'tokenizeEncoded' in provider;
}
function isThenable(obj) {
return obj && typeof obj.then === 'function';
}
/**
* Set the tokens provider for a language (manual implementation).
*/
function setTokensProvider(languageId, provider) {
var languageIdentifier = standaloneServices_StaticServices.modeService.get().getLanguageIdentifier(languageId);
if (!languageIdentifier) {
throw new Error("Cannot set tokens provider for unknown language " + languageId);
}
var create = function (provider) {
if (isEncodedTokensProvider(provider)) {
return new standaloneLanguages_EncodedTokenizationSupport2Adapter(provider);
}
else {
return new standaloneLanguages_TokenizationSupport2Adapter(standaloneServices_StaticServices.standaloneThemeService.get(), languageIdentifier, provider);
}
};
if (isThenable(provider)) {
return modes["B" /* TokenizationRegistry */].registerPromise(languageId, provider.then(function (provider) { return create(provider); }));
}
return modes["B" /* TokenizationRegistry */].register(languageId, create(provider));
}
/**
* Set the tokens provider for a language (monarch implementation).
*/
function setMonarchTokensProvider(languageId, languageDef) {
var create = function (languageDef) {
return createTokenizationSupport(standaloneServices_StaticServices.modeService.get(), standaloneServices_StaticServices.standaloneThemeService.get(), languageId, compile(languageId, languageDef));
};
if (isThenable(languageDef)) {
return modes["B" /* TokenizationRegistry */].registerPromise(languageId, languageDef.then(function (languageDef) { return create(languageDef); }));
}
return modes["B" /* TokenizationRegistry */].register(languageId, create(languageDef));
}
/**
* Register a reference provider (used by e.g. reference search).
*/
function registerReferenceProvider(languageId, provider) {
return modes["u" /* ReferenceProviderRegistry */].register(languageId, provider);
}
/**
* Register a rename provider (used by e.g. rename symbol).
*/
function registerRenameProvider(languageId, provider) {
return modes["v" /* RenameProviderRegistry */].register(languageId, provider);
}
/**
* Register a signature help provider (used by e.g. parameter hints).
*/
function registerSignatureHelpProvider(languageId, provider) {
return modes["x" /* SignatureHelpProviderRegistry */].register(languageId, provider);
}
/**
* Register a hover provider (used by e.g. editor hover).
*/
function registerHoverProvider(languageId, provider) {
return modes["p" /* HoverProviderRegistry */].register(languageId, {
provideHover: function (model, position, token) {
var word = model.getWordAtPosition(position);
return Promise.resolve(provider.provideHover(model, position, token)).then(function (value) {
if (!value) {
return undefined;
}
if (!value.range && word) {
value.range = new core_range["a" /* Range */](position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);
}
if (!value.range) {
value.range = new core_range["a" /* Range */](position.lineNumber, position.column, position.lineNumber, position.column);
}
return value;
});
}
});
}
/**
* Register a document symbol provider (used by e.g. outline).
*/
function registerDocumentSymbolProvider(languageId, provider) {
return modes["m" /* DocumentSymbolProviderRegistry */].register(languageId, provider);
}
/**
* Register a document highlight provider (used by e.g. highlight occurrences).
*/
function registerDocumentHighlightProvider(languageId, provider) {
return modes["i" /* DocumentHighlightProviderRegistry */].register(languageId, provider);
}
/**
* Register a definition provider (used by e.g. go to definition).
*/
function registerDefinitionProvider(languageId, provider) {
return modes["f" /* DefinitionProviderRegistry */].register(languageId, provider);
}
/**
* Register a implementation provider (used by e.g. go to implementation).
*/
function registerImplementationProvider(languageId, provider) {
return modes["q" /* ImplementationProviderRegistry */].register(languageId, provider);
}
/**
* Register a type definition provider (used by e.g. go to type definition).
*/
function registerTypeDefinitionProvider(languageId, provider) {
return modes["C" /* TypeDefinitionProviderRegistry */].register(languageId, provider);
}
/**
* Register a code lens provider (used by e.g. inline code lenses).
*/
function registerCodeLensProvider(languageId, provider) {
return modes["b" /* CodeLensProviderRegistry */].register(languageId, provider);
}
/**
* Register a code action provider (used by e.g. quick fix).
*/
function registerCodeActionProvider(languageId, provider) {
return modes["a" /* CodeActionProviderRegistry */].register(languageId, {
provideCodeActions: function (model, range, context, token) {
var markers = standaloneServices_StaticServices.markerService.get().read({ resource: model.uri }).filter(function (m) {
return core_range["a" /* Range */].areIntersectingOrTouching(m, range);
});
return provider.provideCodeActions(model, range, { markers: markers, only: context.only }, token);
}
});
}
/**
* Register a formatter that can handle only entire models.
*/
function registerDocumentFormattingEditProvider(languageId, provider) {
return modes["g" /* DocumentFormattingEditProviderRegistry */].register(languageId, provider);
}
/**
* Register a formatter that can handle a range inside a model.
*/
function registerDocumentRangeFormattingEditProvider(languageId, provider) {
return modes["j" /* DocumentRangeFormattingEditProviderRegistry */].register(languageId, provider);
}
/**
* Register a formatter than can do formatting as the user types.
*/
function registerOnTypeFormattingEditProvider(languageId, provider) {
return modes["t" /* OnTypeFormattingEditProviderRegistry */].register(languageId, provider);
}
/**
* Register a link provider that can find links in text.
*/
function registerLinkProvider(languageId, provider) {
return modes["s" /* LinkProviderRegistry */].register(languageId, provider);
}
/**
* Register a completion item provider (use by e.g. suggestions).
*/
function registerCompletionItemProvider(languageId, provider) {
return modes["d" /* CompletionProviderRegistry */].register(languageId, provider);
}
/**
* Register a document color provider (used by Color Picker, Color Decorator).
*/
function registerColorProvider(languageId, provider) {
return modes["c" /* ColorProviderRegistry */].register(languageId, provider);
}
/**
* Register a folding range provider
*/
function registerFoldingRangeProvider(languageId, provider) {
return modes["o" /* FoldingRangeProviderRegistry */].register(languageId, provider);
}
/**
* Register a declaration provider
*/
function registerDeclarationProvider(languageId, provider) {
return modes["e" /* DeclarationProviderRegistry */].register(languageId, provider);
}
/**
* Register a selection range provider
*/
function registerSelectionRangeProvider(languageId, provider) {
return modes["w" /* SelectionRangeRegistry */].register(languageId, provider);
}
/**
* Register a document semantic tokens provider
*/
function registerDocumentSemanticTokensProvider(languageId, provider) {
return modes["l" /* DocumentSemanticTokensProviderRegistry */].register(languageId, provider);
}
/**
* Register a document range semantic tokens provider
*/
function registerDocumentRangeSemanticTokensProvider(languageId, provider) {
return modes["k" /* DocumentRangeSemanticTokensProviderRegistry */].register(languageId, provider);
}
/**
* @internal
*/
function createMonacoLanguagesAPI() {
return {
register: register,
getLanguages: getLanguages,
onLanguage: onLanguage,
getEncodedLanguageId: getEncodedLanguageId,
// provider methods
setLanguageConfiguration: setLanguageConfiguration,
setTokensProvider: setTokensProvider,
setMonarchTokensProvider: setMonarchTokensProvider,
registerReferenceProvider: registerReferenceProvider,
registerRenameProvider: registerRenameProvider,
registerCompletionItemProvider: registerCompletionItemProvider,
registerSignatureHelpProvider: registerSignatureHelpProvider,
registerHoverProvider: registerHoverProvider,
registerDocumentSymbolProvider: registerDocumentSymbolProvider,
registerDocumentHighlightProvider: registerDocumentHighlightProvider,
registerDefinitionProvider: registerDefinitionProvider,
registerImplementationProvider: registerImplementationProvider,
registerTypeDefinitionProvider: registerTypeDefinitionProvider,
registerCodeLensProvider: registerCodeLensProvider,
registerCodeActionProvider: registerCodeActionProvider,
registerDocumentFormattingEditProvider: registerDocumentFormattingEditProvider,
registerDocumentRangeFormattingEditProvider: registerDocumentRangeFormattingEditProvider,
registerOnTypeFormattingEditProvider: registerOnTypeFormattingEditProvider,
registerLinkProvider: registerLinkProvider,
registerColorProvider: registerColorProvider,
registerFoldingRangeProvider: registerFoldingRangeProvider,
registerDeclarationProvider: registerDeclarationProvider,
registerSelectionRangeProvider: registerSelectionRangeProvider,
registerDocumentSemanticTokensProvider: registerDocumentSemanticTokensProvider,
registerDocumentRangeSemanticTokensProvider: registerDocumentRangeSemanticTokensProvider,
// enums
DocumentHighlightKind: DocumentHighlightKind,
CompletionItemKind: CompletionItemKind,
CompletionItemTag: CompletionItemTag,
CompletionItemInsertTextRule: CompletionItemInsertTextRule,
SymbolKind: SymbolKind,
SymbolTag: SymbolTag,
IndentAction: IndentAction,
CompletionTriggerKind: CompletionTriggerKind,
SignatureHelpTriggerKind: SignatureHelpTriggerKind,
// classes
FoldingRangeKind: modes["n" /* FoldingRangeKind */],
};
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/editor.api.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var global = self;
// Set defaults for standalone editor
editorOptions["e" /* EditorOptions */].wrappingIndent.defaultValue = 0 /* None */;
editorOptions["e" /* EditorOptions */].glyphMargin.defaultValue = false;
editorOptions["e" /* EditorOptions */].autoIndent.defaultValue = 3 /* Advanced */;
editorOptions["e" /* EditorOptions */].overviewRulerLanes.defaultValue = 2;
var api = createMonacoBaseAPI();
api.editor = createMonacoEditorAPI();
api.languages = createMonacoLanguagesAPI();
var CancellationTokenSource = api.CancellationTokenSource;
var Emitter = api.Emitter;
var editor_api_KeyCode = api.KeyCode;
var editor_api_KeyMod = api.KeyMod;
var Position = api.Position;
var Range = api.Range;
var Selection = api.Selection;
var editor_api_SelectionDirection = api.SelectionDirection;
var editor_api_MarkerSeverity = api.MarkerSeverity;
var editor_api_MarkerTag = api.MarkerTag;
var Uri = api.Uri;
var Token = api.Token;
var editor_api_editor = api.editor;
var languages = api.languages;
global.monaco = api;
if (typeof global.require !== 'undefined' && typeof global.require.config === 'function') {
global.require.config({
ignoreDuplicateModules: [
'vscode-languageserver-types',
'vscode-languageserver-types/main',
'vscode-nls',
'vscode-nls/vscode-nls',
'jsonc-parser',
'jsonc-parser/main',
'vscode-uri',
'vscode-uri/index',
'vs/basic-languages/typescript/typescript'
]
});
}
/***/ }),
/* 141 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return once; });
/*---------------------------------------------------------------------------------------------
* 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) {
var _this = this;
var didCall = false;
var result;
return function () {
if (didCall) {
return result;
}
didCall = true;
result = fn.apply(_this, arguments);
return result;
};
}
/***/ }),
/* 142 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ITextResourceConfigurationService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ITextResourcePropertiesService; });
/* harmony import */ var _platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
var ITextResourceConfigurationService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('textResourceConfigurationService');
var ITextResourcePropertiesService = Object(_platform_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('textResourcePropertiesService');
/***/ }),
/* 143 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ok; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Throws an error with the provided message if the provided value does not evaluate to a true Javascript value.
*/
function ok(value, message) {
if (!value) {
throw new Error(message ? 'Assertion failed (' + message + ')' : 'Assertion Failed');
}
}
/***/ }),
/* 144 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LineDecoration; });
/* unused harmony export DecorationSegment */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LineDecorationsNormalizer; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LineDecoration = /** @class */ (function () {
function LineDecoration(startColumn, endColumn, className, type) {
this.startColumn = startColumn;
this.endColumn = endColumn;
this.className = className;
this.type = type;
}
LineDecoration._equals = function (a, b) {
return (a.startColumn === b.startColumn
&& a.endColumn === b.endColumn
&& a.className === b.className
&& a.type === b.type);
};
LineDecoration.equalsArr = function (a, b) {
var aLen = a.length;
var bLen = b.length;
if (aLen !== bLen) {
return false;
}
for (var i = 0; i < aLen; i++) {
if (!LineDecoration._equals(a[i], b[i])) {
return false;
}
}
return true;
};
LineDecoration.filter = function (lineDecorations, lineNumber, minLineColumn, maxLineColumn) {
if (lineDecorations.length === 0) {
return [];
}
var result = [], resultLen = 0;
for (var i = 0, len = lineDecorations.length; i < len; i++) {
var d = lineDecorations[i];
var range = d.range;
if (range.endLineNumber < lineNumber || range.startLineNumber > lineNumber) {
// Ignore decorations that sit outside this line
continue;
}
if (range.isEmpty() && (d.type === 0 /* Regular */ || d.type === 3 /* RegularAffectingLetterSpacing */)) {
// Ignore empty range decorations
continue;
}
var startColumn = (range.startLineNumber === lineNumber ? range.startColumn : minLineColumn);
var endColumn = (range.endLineNumber === lineNumber ? range.endColumn : maxLineColumn);
result[resultLen++] = new LineDecoration(startColumn, endColumn, d.inlineClassName, d.type);
}
return result;
};
LineDecoration.compare = function (a, b) {
if (a.startColumn === b.startColumn) {
if (a.endColumn === b.endColumn) {
if (a.className < b.className) {
return -1;
}
if (a.className > b.className) {
return 1;
}
return 0;
}
return a.endColumn - b.endColumn;
}
return a.startColumn - b.startColumn;
};
return LineDecoration;
}());
var DecorationSegment = /** @class */ (function () {
function DecorationSegment(startOffset, endOffset, className) {
this.startOffset = startOffset;
this.endOffset = endOffset;
this.className = className;
}
return DecorationSegment;
}());
var Stack = /** @class */ (function () {
function Stack() {
this.stopOffsets = [];
this.classNames = [];
this.count = 0;
}
Stack.prototype.consumeLowerThan = function (maxStopOffset, nextStartOffset, result) {
while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {
var i = 0;
// Take all equal stopping offsets
while (i + 1 < this.count && this.stopOffsets[i] === this.stopOffsets[i + 1]) {
i++;
}
// Basically we are consuming the first i + 1 elements of the stack
result.push(new DecorationSegment(nextStartOffset, this.stopOffsets[i], this.classNames.join(' ')));
nextStartOffset = this.stopOffsets[i] + 1;
// Consume them
this.stopOffsets.splice(0, i + 1);
this.classNames.splice(0, i + 1);
this.count -= (i + 1);
}
if (this.count > 0 && nextStartOffset < maxStopOffset) {
result.push(new DecorationSegment(nextStartOffset, maxStopOffset - 1, this.classNames.join(' ')));
nextStartOffset = maxStopOffset;
}
return nextStartOffset;
};
Stack.prototype.insert = function (stopOffset, className) {
if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {
// Insert at the end
this.stopOffsets.push(stopOffset);
this.classNames.push(className);
}
else {
// Find the insertion position for `stopOffset`
for (var i = 0; i < this.count; i++) {
if (this.stopOffsets[i] >= stopOffset) {
this.stopOffsets.splice(i, 0, stopOffset);
this.classNames.splice(i, 0, className);
break;
}
}
}
this.count++;
return;
};
return Stack;
}());
var LineDecorationsNormalizer = /** @class */ (function () {
function LineDecorationsNormalizer() {
}
/**
* Normalize line decorations. Overlapping decorations will generate multiple segments
*/
LineDecorationsNormalizer.normalize = function (lineContent, lineDecorations) {
if (lineDecorations.length === 0) {
return [];
}
var result = [];
var stack = new Stack();
var nextStartOffset = 0;
for (var i = 0, len = lineDecorations.length; i < len; i++) {
var d = lineDecorations[i];
var startColumn = d.startColumn;
var endColumn = d.endColumn;
var className = d.className;
// If the position would end up in the middle of a high-low surrogate pair, we move it to before the pair
if (startColumn > 1) {
var charCodeBefore = lineContent.charCodeAt(startColumn - 2);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isHighSurrogate */ "z"](charCodeBefore)) {
startColumn--;
}
}
if (endColumn > 1) {
var charCodeBefore = lineContent.charCodeAt(endColumn - 2);
if (_base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isHighSurrogate */ "z"](charCodeBefore)) {
endColumn--;
}
}
var currentStartOffset = startColumn - 1;
var currentEndOffset = endColumn - 2;
nextStartOffset = stack.consumeLowerThan(currentStartOffset, nextStartOffset, result);
if (stack.count === 0) {
nextStartOffset = currentStartOffset;
}
stack.insert(currentEndOffset, className);
}
stack.consumeLowerThan(1073741824 /* MAX_SAFE_SMALL_INTEGER */, nextStartOffset, result);
return result;
};
return LineDecorationsNormalizer;
}());
/***/ }),
/* 145 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ IListService; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ listService_ListService; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ WorkbenchListFocusContextKey; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ listService_WorkbenchAsyncDataTree; });
// UNUSED EXPORTS: WorkbenchListSupportsMultiSelectContextKey, WorkbenchListHasSelectionOrFocus, WorkbenchListDoubleSelection, WorkbenchListMultiSelection, WorkbenchListSupportsKeyboardNavigation, WorkbenchListAutomaticKeyboardNavigationKey, WorkbenchListAutomaticKeyboardNavigation, didBindWorkbenchListAutomaticKeyboardNavigation, multiSelectModifierSettingKey, openModeSettingKey, horizontalScrollingKey, keyboardNavigationSettingKey, automaticKeyboardNavigationSettingKey, WorkbenchObjectTree, WorkbenchDataTree, WorkbenchCompressibleAsyncDataTree
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/listWidget.js + 2 modules
var listWidget = __webpack_require__(135);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/nls.js
var nls = __webpack_require__(1);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/configuration/common/configuration.js
var configuration = __webpack_require__(43);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js
var configurationRegistry = __webpack_require__(114);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
var contextkey = __webpack_require__(13);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js
var instantiation = __webpack_require__(22);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/keybinding/common/keybinding.js
var keybinding = __webpack_require__(45);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/registry/common/platform.js
var platform = __webpack_require__(57);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/styler.js
var styler = __webpack_require__(128);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js
var themeService = __webpack_require__(19);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js
var InputFocusedContextKey = 'inputFocus';
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/media/tree.css
var media_tree = __webpack_require__(647);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/keyboardEvent.js
var keyboardEvent = __webpack_require__(53);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dnd.js
var browser_dnd = __webpack_require__(79);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js + 2 modules
var listView = __webpack_require__(155);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/event.js
var browser_event = __webpack_require__(34);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/filters.js
var filters = __webpack_require__(65);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/tree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var TreeError = /** @class */ (function (_super) {
__extends(TreeError, _super);
function TreeError(user, message) {
return _super.call(this, "TreeError [" + user + "] " + message) || this;
}
return TreeError;
}(Error));
var WeakMapper = /** @class */ (function () {
function WeakMapper(fn) {
this.fn = fn;
this._map = new WeakMap();
}
WeakMapper.prototype.map = function (key) {
var result = this._map.get(key);
if (!result) {
result = this.fn(key);
this._map.set(key, result);
}
return result;
};
return WeakMapper;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/iterator.js
var common_iterator = __webpack_require__(38);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/indexTreeModel.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function isFilterResult(obj) {
return typeof obj === 'object' && 'visibility' in obj && 'data' in obj;
}
function getVisibleState(visibility) {
switch (visibility) {
case true: return 1 /* Visible */;
case false: return 0 /* Hidden */;
default: return visibility;
}
}
function isCollapsibleStateUpdate(update) {
return typeof update.collapsible === 'boolean';
}
var indexTreeModel_IndexTreeModel = /** @class */ (function () {
function IndexTreeModel(user, list, rootElement, options) {
if (options === void 0) { options = {}; }
this.user = user;
this.list = list;
this.rootRef = [];
this.eventBufferer = new common_event["c" /* EventBufferer */]();
this._onDidChangeCollapseState = new common_event["a" /* Emitter */]();
this.onDidChangeCollapseState = this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);
this._onDidChangeRenderNodeCount = new common_event["a" /* Emitter */]();
this.onDidChangeRenderNodeCount = this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);
this._onDidSplice = new common_event["a" /* Emitter */]();
this.onDidSplice = this._onDidSplice.event;
this.collapseByDefault = typeof options.collapseByDefault === 'undefined' ? false : options.collapseByDefault;
this.filter = options.filter;
this.autoExpandSingleChildren = typeof options.autoExpandSingleChildren === 'undefined' ? false : options.autoExpandSingleChildren;
this.root = {
parent: undefined,
element: rootElement,
children: [],
depth: 0,
visibleChildrenCount: 0,
visibleChildIndex: -1,
collapsible: false,
collapsed: false,
renderNodeCount: 0,
visible: true,
filterData: undefined
};
}
IndexTreeModel.prototype.splice = function (location, deleteCount, toInsert, onDidCreateNode, onDidDeleteNode) {
var _a;
var _this = this;
if (location.length === 0) {
throw new TreeError(this.user, 'Invalid tree location');
}
var _b = this.getParentNodeWithListIndex(location), parentNode = _b.parentNode, listIndex = _b.listIndex, revealed = _b.revealed, visible = _b.visible;
var treeListElementsToInsert = [];
var nodesToInsertIterator = common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].from(toInsert), function (el) { return _this.createTreeNode(el, parentNode, parentNode.visible ? 1 /* Visible */ : 0 /* Hidden */, revealed, treeListElementsToInsert, onDidCreateNode); });
var lastIndex = location[location.length - 1];
// figure out what's the visible child start index right before the
// splice point
var visibleChildStartIndex = 0;
for (var i = lastIndex; i >= 0 && i < parentNode.children.length; i--) {
var child = parentNode.children[i];
if (child.visible) {
visibleChildStartIndex = child.visibleChildIndex;
break;
}
}
var nodesToInsert = [];
var insertedVisibleChildrenCount = 0;
var renderNodeCount = 0;
common_iterator["d" /* Iterator */].forEach(nodesToInsertIterator, function (child) {
nodesToInsert.push(child);
renderNodeCount += child.renderNodeCount;
if (child.visible) {
child.visibleChildIndex = visibleChildStartIndex + insertedVisibleChildrenCount++;
}
});
var deletedNodes = (_a = parentNode.children).splice.apply(_a, __spreadArrays([lastIndex, deleteCount], nodesToInsert));
// figure out what is the count of deleted visible children
var deletedVisibleChildrenCount = 0;
for (var _i = 0, deletedNodes_1 = deletedNodes; _i < deletedNodes_1.length; _i++) {
var child = deletedNodes_1[_i];
if (child.visible) {
deletedVisibleChildrenCount++;
}
}
// and adjust for all visible children after the splice point
if (deletedVisibleChildrenCount !== 0) {
for (var i = lastIndex + nodesToInsert.length; i < parentNode.children.length; i++) {
var child = parentNode.children[i];
if (child.visible) {
child.visibleChildIndex -= deletedVisibleChildrenCount;
}
}
}
// update parent's visible children count
parentNode.visibleChildrenCount += insertedVisibleChildrenCount - deletedVisibleChildrenCount;
if (revealed && visible) {
var visibleDeleteCount = deletedNodes.reduce(function (r, node) { return r + (node.visible ? node.renderNodeCount : 0); }, 0);
this._updateAncestorsRenderNodeCount(parentNode, renderNodeCount - visibleDeleteCount);
this.list.splice(listIndex, visibleDeleteCount, treeListElementsToInsert);
}
if (deletedNodes.length > 0 && onDidDeleteNode) {
var visit_1 = function (node) {
onDidDeleteNode(node);
node.children.forEach(visit_1);
};
deletedNodes.forEach(visit_1);
}
this._onDidSplice.fire({ insertedNodes: nodesToInsert, deletedNodes: deletedNodes });
};
IndexTreeModel.prototype.rerender = function (location) {
if (location.length === 0) {
throw new TreeError(this.user, 'Invalid tree location');
}
var _a = this.getTreeNodeWithListIndex(location), node = _a.node, listIndex = _a.listIndex, revealed = _a.revealed;
if (revealed) {
this.list.splice(listIndex, 1, [node]);
}
};
IndexTreeModel.prototype.has = function (location) {
return this.hasTreeNode(location);
};
IndexTreeModel.prototype.getListIndex = function (location) {
var _a = this.getTreeNodeWithListIndex(location), listIndex = _a.listIndex, visible = _a.visible, revealed = _a.revealed;
return visible && revealed ? listIndex : -1;
};
IndexTreeModel.prototype.getListRenderCount = function (location) {
return this.getTreeNode(location).renderNodeCount;
};
IndexTreeModel.prototype.isCollapsible = function (location) {
return this.getTreeNode(location).collapsible;
};
IndexTreeModel.prototype.setCollapsible = function (location, collapsible) {
var _this = this;
var node = this.getTreeNode(location);
if (typeof collapsible === 'undefined') {
collapsible = !node.collapsible;
}
var update = { collapsible: collapsible };
return this.eventBufferer.bufferEvents(function () { return _this._setCollapseState(location, update); });
};
IndexTreeModel.prototype.isCollapsed = function (location) {
return this.getTreeNode(location).collapsed;
};
IndexTreeModel.prototype.setCollapsed = function (location, collapsed, recursive) {
var _this = this;
var node = this.getTreeNode(location);
if (typeof collapsed === 'undefined') {
collapsed = !node.collapsed;
}
var update = { collapsed: collapsed, recursive: recursive || false };
return this.eventBufferer.bufferEvents(function () { return _this._setCollapseState(location, update); });
};
IndexTreeModel.prototype._setCollapseState = function (location, update) {
var _a = this.getTreeNodeWithListIndex(location), node = _a.node, listIndex = _a.listIndex, revealed = _a.revealed;
var result = this._setListNodeCollapseState(node, listIndex, revealed, update);
if (node !== this.root && this.autoExpandSingleChildren && result && !isCollapsibleStateUpdate(update) && node.collapsible && !node.collapsed && !update.recursive) {
var onlyVisibleChildIndex = -1;
for (var i = 0; i < node.children.length; i++) {
var child = node.children[i];
if (child.visible) {
if (onlyVisibleChildIndex > -1) {
onlyVisibleChildIndex = -1;
break;
}
else {
onlyVisibleChildIndex = i;
}
}
}
if (onlyVisibleChildIndex > -1) {
this._setCollapseState(__spreadArrays(location, [onlyVisibleChildIndex]), update);
}
}
return result;
};
IndexTreeModel.prototype._setListNodeCollapseState = function (node, listIndex, revealed, update) {
var result = this._setNodeCollapseState(node, update, false);
if (!revealed || !node.visible || !result) {
return result;
}
var previousRenderNodeCount = node.renderNodeCount;
var toInsert = this.updateNodeAfterCollapseChange(node);
var deleteCount = previousRenderNodeCount - (listIndex === -1 ? 0 : 1);
this.list.splice(listIndex + 1, deleteCount, toInsert.slice(1));
return result;
};
IndexTreeModel.prototype._setNodeCollapseState = function (node, update, deep) {
var 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: node, deep: deep });
}
}
if (!isCollapsibleStateUpdate(update) && update.recursive) {
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
var child = _a[_i];
result = this._setNodeCollapseState(child, update, true) || result;
}
}
return result;
};
IndexTreeModel.prototype.expandTo = function (location) {
var _this = this;
this.eventBufferer.bufferEvents(function () {
var 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 });
}
}
});
};
IndexTreeModel.prototype.refilter = function () {
var previousRenderNodeCount = this.root.renderNodeCount;
var toInsert = this.updateNodeAfterFilterChange(this.root);
this.list.splice(0, previousRenderNodeCount, toInsert);
};
IndexTreeModel.prototype.createTreeNode = function (treeElement, parent, parentVisibility, revealed, treeListElements, onDidCreateNode) {
var _this = this;
var node = {
parent: 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,
visible: true,
filterData: undefined
};
var visibility = this._filterNode(node, parentVisibility);
if (revealed) {
treeListElements.push(node);
}
var childElements = common_iterator["d" /* Iterator */].from(treeElement.children);
var childRevealed = revealed && visibility !== 0 /* Hidden */ && !node.collapsed;
var childNodes = common_iterator["d" /* Iterator */].map(childElements, function (el) { return _this.createTreeNode(el, node, visibility, childRevealed, treeListElements, onDidCreateNode); });
var visibleChildrenCount = 0;
var renderNodeCount = 1;
common_iterator["d" /* Iterator */].forEach(childNodes, function (child) {
node.children.push(child);
renderNodeCount += child.renderNodeCount;
if (child.visible) {
child.visibleChildIndex = visibleChildrenCount++;
}
});
node.collapsible = node.collapsible || node.children.length > 0;
node.visibleChildrenCount = visibleChildrenCount;
node.visible = visibility === 2 /* Recurse */ ? visibleChildrenCount > 0 : (visibility === 1 /* Visible */);
if (!node.visible) {
node.renderNodeCount = 0;
if (revealed) {
treeListElements.pop();
}
}
else if (!node.collapsed) {
node.renderNodeCount = renderNodeCount;
}
if (onDidCreateNode) {
onDidCreateNode(node);
}
return node;
};
IndexTreeModel.prototype.updateNodeAfterCollapseChange = function (node) {
var previousRenderNodeCount = node.renderNodeCount;
var result = [];
this._updateNodeAfterCollapseChange(node, result);
this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount);
return result;
};
IndexTreeModel.prototype._updateNodeAfterCollapseChange = function (node, result) {
if (node.visible === false) {
return 0;
}
result.push(node);
node.renderNodeCount = 1;
if (!node.collapsed) {
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
var child = _a[_i];
node.renderNodeCount += this._updateNodeAfterCollapseChange(child, result);
}
}
this._onDidChangeRenderNodeCount.fire(node);
return node.renderNodeCount;
};
IndexTreeModel.prototype.updateNodeAfterFilterChange = function (node) {
var previousRenderNodeCount = node.renderNodeCount;
var result = [];
this._updateNodeAfterFilterChange(node, node.visible ? 1 /* Visible */ : 0 /* Hidden */, result);
this._updateAncestorsRenderNodeCount(node.parent, result.length - previousRenderNodeCount);
return result;
};
IndexTreeModel.prototype._updateNodeAfterFilterChange = function (node, parentVisibility, result, revealed) {
if (revealed === void 0) { revealed = true; }
var visibility;
if (node !== this.root) {
visibility = this._filterNode(node, parentVisibility);
if (visibility === 0 /* Hidden */) {
node.visible = false;
node.renderNodeCount = 0;
return false;
}
if (revealed) {
result.push(node);
}
}
var resultStartLength = result.length;
node.renderNodeCount = node === this.root ? 0 : 1;
var hasVisibleDescendants = false;
if (!node.collapsed || visibility !== 0 /* Hidden */) {
var visibleChildIndex = 0;
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
var child = _a[_i];
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 /* Recurse */ ? hasVisibleDescendants : (visibility === 1 /* Visible */);
}
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;
};
IndexTreeModel.prototype._updateAncestorsRenderNodeCount = function (node, diff) {
if (diff === 0) {
return;
}
while (node) {
node.renderNodeCount += diff;
this._onDidChangeRenderNodeCount.fire(node);
node = node.parent;
}
};
IndexTreeModel.prototype._filterNode = function (node, parentVisibility) {
var result = this.filter ? this.filter.filter(node.element, parentVisibility) : 1 /* Visible */;
if (typeof result === 'boolean') {
node.filterData = undefined;
return result ? 1 /* Visible */ : 0 /* Hidden */;
}
else if (isFilterResult(result)) {
node.filterData = result.data;
return getVisibleState(result.visibility);
}
else {
node.filterData = undefined;
return getVisibleState(result);
}
};
// cheap
IndexTreeModel.prototype.hasTreeNode = function (location, node) {
if (node === void 0) { node = this.root; }
if (!location || location.length === 0) {
return true;
}
var index = location[0], rest = location.slice(1);
if (index < 0 || index > node.children.length) {
return false;
}
return this.hasTreeNode(rest, node.children[index]);
};
// cheap
IndexTreeModel.prototype.getTreeNode = function (location, node) {
if (node === void 0) { node = this.root; }
if (!location || location.length === 0) {
return node;
}
var index = location[0], rest = location.slice(1);
if (index < 0 || index > node.children.length) {
throw new TreeError(this.user, 'Invalid tree location');
}
return this.getTreeNode(rest, node.children[index]);
};
// expensive
IndexTreeModel.prototype.getTreeNodeWithListIndex = function (location) {
if (location.length === 0) {
return { node: this.root, listIndex: -1, revealed: true, visible: false };
}
var _a = this.getParentNodeWithListIndex(location), parentNode = _a.parentNode, listIndex = _a.listIndex, revealed = _a.revealed, visible = _a.visible;
var index = location[location.length - 1];
if (index < 0 || index > parentNode.children.length) {
throw new TreeError(this.user, 'Invalid tree location');
}
var node = parentNode.children[index];
return { node: node, listIndex: listIndex, revealed: revealed, visible: visible && node.visible };
};
IndexTreeModel.prototype.getParentNodeWithListIndex = function (location, node, listIndex, revealed, visible) {
if (node === void 0) { node = this.root; }
if (listIndex === void 0) { listIndex = 0; }
if (revealed === void 0) { revealed = true; }
if (visible === void 0) { visible = true; }
var index = location[0], rest = location.slice(1);
if (index < 0 || index > node.children.length) {
throw new TreeError(this.user, 'Invalid tree location');
}
// TODO@joao perf!
for (var 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: listIndex, revealed: revealed, visible: visible };
}
return this.getParentNodeWithListIndex(rest, node.children[index], listIndex + 1, revealed, visible);
};
IndexTreeModel.prototype.getNode = function (location) {
if (location === void 0) { location = []; }
return this.getTreeNode(location);
};
// TODO@joao perf!
IndexTreeModel.prototype.getNodeLocation = function (node) {
var location = [];
var indexTreeNode = node; // typing woes
while (indexTreeNode.parent) {
location.push(indexTreeNode.parent.children.indexOf(indexTreeNode));
indexTreeNode = indexTreeNode.parent;
}
return location.reverse();
};
IndexTreeModel.prototype.getParentNodeLocation = function (location) {
if (location.length === 0) {
return undefined;
}
else if (location.length === 1) {
return [];
}
else {
return Object(arrays["w" /* tail2 */])(location)[0];
}
};
return IndexTreeModel;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/async.js
var common_async = __webpack_require__(20);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var common_platform = __webpack_require__(17);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/map.js
var map = __webpack_require__(55);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/numbers.js
var numbers = __webpack_require__(112);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/collections.js
var collections = __webpack_require__(110);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/abstractTree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var abstractTree_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var abstractTree_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var TreeElementsDragAndDropData = /** @class */ (function (_super) {
abstractTree_extends(TreeElementsDragAndDropData, _super);
function TreeElementsDragAndDropData(data) {
var _this = _super.call(this, data.elements.map(function (node) { return node.element; })) || this;
_this.data = data;
return _this;
}
return TreeElementsDragAndDropData;
}(listView["a" /* ElementsDragAndDropData */]));
function asTreeDragAndDropData(data) {
if (data instanceof listView["a" /* ElementsDragAndDropData */]) {
return new TreeElementsDragAndDropData(data);
}
return data;
}
var abstractTree_TreeNodeListDragAndDrop = /** @class */ (function () {
function TreeNodeListDragAndDrop(modelProvider, dnd) {
this.modelProvider = modelProvider;
this.dnd = dnd;
this.autoExpandDisposable = lifecycle["a" /* Disposable */].None;
}
TreeNodeListDragAndDrop.prototype.getDragURI = function (node) {
return this.dnd.getDragURI(node.element);
};
TreeNodeListDragAndDrop.prototype.getDragLabel = function (nodes, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(nodes.map(function (node) { return node.element; }), originalEvent);
}
return undefined;
};
TreeNodeListDragAndDrop.prototype.onDragStart = function (data, originalEvent) {
if (this.dnd.onDragStart) {
this.dnd.onDragStart(asTreeDragAndDropData(data), originalEvent);
}
};
TreeNodeListDragAndDrop.prototype.onDragOver = function (data, targetNode, targetIndex, originalEvent, raw) {
var _this = this;
if (raw === void 0) { raw = true; }
var result = this.dnd.onDragOver(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, originalEvent);
var 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 = Object(common_async["g" /* disposableTimeout */])(function () {
var model = _this.modelProvider();
var ref = model.getNodeLocation(targetNode);
if (model.isCollapsed(ref)) {
model.setCollapsed(ref, false);
}
_this.autoExpandNode = undefined;
}, 500);
}
if (typeof result === 'boolean' || !result.accept || typeof result.bubble === 'undefined' || result.feedback) {
if (!raw) {
var accept = typeof result === 'boolean' ? result : result.accept;
var effect = typeof result === 'boolean' ? undefined : result.effect;
return { accept: accept, effect: effect, feedback: [targetIndex] };
}
return result;
}
if (result.bubble === 1 /* Up */) {
var model_1 = this.modelProvider();
var ref_1 = model_1.getNodeLocation(targetNode);
var parentRef = model_1.getParentNodeLocation(ref_1);
var parentNode = model_1.getNode(parentRef);
var parentIndex = parentRef && model_1.getListIndex(parentRef);
return this.onDragOver(data, parentNode, parentIndex, originalEvent, false);
}
var model = this.modelProvider();
var ref = model.getNodeLocation(targetNode);
var start = model.getListIndex(ref);
var length = model.getListRenderCount(ref);
return __assign(__assign({}, result), { feedback: Object(arrays["u" /* range */])(start, start + length) });
};
TreeNodeListDragAndDrop.prototype.drop = function (data, targetNode, targetIndex, originalEvent) {
this.autoExpandDisposable.dispose();
this.autoExpandNode = undefined;
this.dnd.drop(asTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, originalEvent);
};
TreeNodeListDragAndDrop.prototype.onDragEnd = function (originalEvent) {
if (this.dnd.onDragEnd) {
this.dnd.onDragEnd(originalEvent);
}
};
return TreeNodeListDragAndDrop;
}());
function asListOptions(modelProvider, options) {
return options && __assign(__assign({}, options), { identityProvider: options.identityProvider && {
getId: function (el) {
return options.identityProvider.getId(el.element);
}
}, dnd: options.dnd && new abstractTree_TreeNodeListDragAndDrop(modelProvider, options.dnd), multipleSelectionController: options.multipleSelectionController && {
isSelectionSingleChangeEvent: function (e) {
return options.multipleSelectionController.isSelectionSingleChangeEvent(__assign(__assign({}, e), { element: e.element }));
},
isSelectionRangeChangeEvent: function (e) {
return options.multipleSelectionController.isSelectionRangeChangeEvent(__assign(__assign({}, e), { element: e.element }));
}
}, accessibilityProvider: options.accessibilityProvider && __assign(__assign({}, options.accessibilityProvider), { getAriaLabel: function (e) {
return options.accessibilityProvider.getAriaLabel(e.element);
},
getAriaLevel: function (node) {
return node.depth;
}, getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (function (node) {
return options.accessibilityProvider.getActiveDescendantId(node.element);
}) }), keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && __assign(__assign({}, options.keyboardNavigationLabelProvider), { getKeyboardNavigationLabel: function (node) {
return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(node.element);
} }), enableKeyboardNavigation: options.simpleKeyboardNavigation, ariaProvider: {
getSetSize: function (node) {
var model = modelProvider();
var ref = model.getNodeLocation(node);
var parentRef = model.getParentNodeLocation(ref);
var parentNode = model.getNode(parentRef);
return parentNode.visibleChildrenCount;
},
getPosInSet: function (node) {
return node.visibleChildIndex + 1;
},
isChecked: options.ariaProvider && options.ariaProvider.isChecked ? function (node) {
return options.ariaProvider.isChecked(node.element);
} : undefined,
getRole: options.ariaProvider && options.ariaProvider.getRole ? function (node) {
return options.ariaProvider.getRole(node.element);
} : undefined
} });
}
var ComposedTreeDelegate = /** @class */ (function () {
function ComposedTreeDelegate(delegate) {
this.delegate = delegate;
}
ComposedTreeDelegate.prototype.getHeight = function (element) {
return this.delegate.getHeight(element.element);
};
ComposedTreeDelegate.prototype.getTemplateId = function (element) {
return this.delegate.getTemplateId(element.element);
};
ComposedTreeDelegate.prototype.hasDynamicHeight = function (element) {
return !!this.delegate.hasDynamicHeight && this.delegate.hasDynamicHeight(element.element);
};
ComposedTreeDelegate.prototype.setDynamicHeight = function (element, height) {
if (this.delegate.setDynamicHeight) {
this.delegate.setDynamicHeight(element.element, height);
}
};
return ComposedTreeDelegate;
}());
var RenderIndentGuides;
(function (RenderIndentGuides) {
RenderIndentGuides["None"] = "none";
RenderIndentGuides["OnHover"] = "onHover";
RenderIndentGuides["Always"] = "always";
})(RenderIndentGuides || (RenderIndentGuides = {}));
var abstractTree_EventCollection = /** @class */ (function () {
function EventCollection(onDidChange, _elements) {
var _this = this;
if (_elements === void 0) { _elements = []; }
this._elements = _elements;
this.onDidChange = common_event["b" /* Event */].forEach(onDidChange, function (elements) { return _this._elements = elements; });
}
Object.defineProperty(EventCollection.prototype, "elements", {
get: function () {
return this._elements;
},
enumerable: true,
configurable: true
});
return EventCollection;
}());
var abstractTree_TreeRenderer = /** @class */ (function () {
function TreeRenderer(renderer, modelProvider, onDidChangeCollapseState, activeNodes, options) {
if (options === void 0) { options = {}; }
this.renderer = renderer;
this.modelProvider = modelProvider;
this.activeNodes = activeNodes;
this.renderedElements = new Map();
this.renderedNodes = new Map();
this.indent = TreeRenderer.DefaultIndent;
this.hideTwistiesOfChildlessElements = false;
this.shouldRenderIndentGuides = false;
this.renderedIndentGuides = new collections["a" /* SetMap */]();
this.activeIndentNodes = new Set();
this.indentGuidesDisposable = lifecycle["a" /* Disposable */].None;
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.templateId = renderer.templateId;
this.updateOptions(options);
common_event["b" /* Event */].map(onDidChangeCollapseState, function (e) { return e.node; })(this.onDidChangeNodeTwistieState, this, this.disposables);
if (renderer.onDidChangeTwistieState) {
renderer.onDidChangeTwistieState(this.onDidChangeTwistieState, this, this.disposables);
}
}
TreeRenderer.prototype.updateOptions = function (options) {
if (options === void 0) { options = {}; }
if (typeof options.indent !== 'undefined') {
this.indent = Object(numbers["a" /* clamp */])(options.indent, 0, 40);
}
if (typeof options.renderIndentGuides !== 'undefined') {
var shouldRenderIndentGuides = options.renderIndentGuides !== RenderIndentGuides.None;
if (shouldRenderIndentGuides !== this.shouldRenderIndentGuides) {
this.shouldRenderIndentGuides = shouldRenderIndentGuides;
this.indentGuidesDisposable.dispose();
if (shouldRenderIndentGuides) {
var disposables = new lifecycle["b" /* DisposableStore */]();
this.activeNodes.onDidChange(this._onDidChangeActiveNodes, this, disposables);
this.indentGuidesDisposable = disposables;
this._onDidChangeActiveNodes(this.activeNodes.elements);
}
}
}
if (typeof options.hideTwistiesOfChildlessElements !== 'undefined') {
this.hideTwistiesOfChildlessElements = options.hideTwistiesOfChildlessElements;
}
};
TreeRenderer.prototype.renderTemplate = function (container) {
var el = Object(dom["q" /* append */])(container, Object(dom["a" /* $ */])('.monaco-tl-row'));
var indent = Object(dom["q" /* append */])(el, Object(dom["a" /* $ */])('.monaco-tl-indent'));
var twistie = Object(dom["q" /* append */])(el, Object(dom["a" /* $ */])('.monaco-tl-twistie'));
var contents = Object(dom["q" /* append */])(el, Object(dom["a" /* $ */])('.monaco-tl-contents'));
var templateData = this.renderer.renderTemplate(contents);
return { container: container, indent: indent, twistie: twistie, indentGuidesDisposable: lifecycle["a" /* Disposable */].None, templateData: templateData };
};
TreeRenderer.prototype.renderElement = function (node, index, templateData, height) {
if (typeof height === 'number') {
this.renderedNodes.set(node, { templateData: templateData, height: height });
this.renderedElements.set(node.element, node);
}
var indent = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent;
templateData.twistie.style.paddingLeft = indent + "px";
templateData.indent.style.width = indent + this.indent - 16 + "px";
this.renderTwistie(node, templateData);
if (typeof height === 'number') {
this.renderIndentGuides(node, templateData);
}
this.renderer.renderElement(node, index, templateData.templateData, height);
};
TreeRenderer.prototype.disposeElement = function (node, index, templateData, height) {
templateData.indentGuidesDisposable.dispose();
if (this.renderer.disposeElement) {
this.renderer.disposeElement(node, index, templateData.templateData, height);
}
if (typeof height === 'number') {
this.renderedNodes.delete(node);
this.renderedElements.delete(node.element);
}
};
TreeRenderer.prototype.disposeTemplate = function (templateData) {
this.renderer.disposeTemplate(templateData.templateData);
};
TreeRenderer.prototype.onDidChangeTwistieState = function (element) {
var node = this.renderedElements.get(element);
if (!node) {
return;
}
this.onDidChangeNodeTwistieState(node);
};
TreeRenderer.prototype.onDidChangeNodeTwistieState = function (node) {
var data = this.renderedNodes.get(node);
if (!data) {
return;
}
this.renderTwistie(node, data.templateData);
this._onDidChangeActiveNodes(this.activeNodes.elements);
this.renderIndentGuides(node, data.templateData);
};
TreeRenderer.prototype.renderTwistie = function (node, templateData) {
if (this.renderer.renderTwistie) {
this.renderer.renderTwistie(node.element, templateData.twistie);
}
if (node.collapsible && (!this.hideTwistiesOfChildlessElements || node.visibleChildrenCount > 0)) {
Object(dom["g" /* addClasses */])(templateData.twistie, 'codicon', 'codicon-chevron-down', 'collapsible');
Object(dom["Y" /* toggleClass */])(templateData.twistie, 'collapsed', node.collapsed);
}
else {
Object(dom["Q" /* removeClasses */])(templateData.twistie, 'codicon', 'codicon-chevron-down', 'collapsible', 'collapsed');
}
if (node.collapsible) {
templateData.container.setAttribute('aria-expanded', String(!node.collapsed));
}
else {
templateData.container.removeAttribute('aria-expanded');
}
};
TreeRenderer.prototype.renderIndentGuides = function (target, templateData) {
var _this = this;
Object(dom["t" /* clearNode */])(templateData.indent);
templateData.indentGuidesDisposable.dispose();
if (!this.shouldRenderIndentGuides) {
return;
}
var disposableStore = new lifecycle["b" /* DisposableStore */]();
var model = this.modelProvider();
var node = target;
var _loop_1 = function () {
var ref = model.getNodeLocation(node);
var parentRef = model.getParentNodeLocation(ref);
if (!parentRef) {
return "break";
}
var parent_1 = model.getNode(parentRef);
var guide = Object(dom["a" /* $ */])('.indent-guide', { style: "width: " + this_1.indent + "px" });
if (this_1.activeIndentNodes.has(parent_1)) {
Object(dom["f" /* addClass */])(guide, 'active');
}
if (templateData.indent.childElementCount === 0) {
templateData.indent.appendChild(guide);
}
else {
templateData.indent.insertBefore(guide, templateData.indent.firstElementChild);
}
this_1.renderedIndentGuides.add(parent_1, guide);
disposableStore.add(Object(lifecycle["h" /* toDisposable */])(function () { return _this.renderedIndentGuides.delete(parent_1, guide); }));
node = parent_1;
};
var this_1 = this;
while (true) {
var state_1 = _loop_1();
if (state_1 === "break")
break;
}
templateData.indentGuidesDisposable = disposableStore;
};
TreeRenderer.prototype._onDidChangeActiveNodes = function (nodes) {
var _this = this;
if (!this.shouldRenderIndentGuides) {
return;
}
var set = new Set();
var model = this.modelProvider();
nodes.forEach(function (node) {
var ref = model.getNodeLocation(node);
try {
var 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 (_a) {
// noop
}
});
this.activeIndentNodes.forEach(function (node) {
if (!set.has(node)) {
_this.renderedIndentGuides.forEach(node, function (line) { return Object(dom["P" /* removeClass */])(line, 'active'); });
}
});
set.forEach(function (node) {
if (!_this.activeIndentNodes.has(node)) {
_this.renderedIndentGuides.forEach(node, function (line) { return Object(dom["f" /* addClass */])(line, 'active'); });
}
});
this.activeIndentNodes = set;
};
TreeRenderer.prototype.dispose = function () {
this.renderedNodes.clear();
this.renderedElements.clear();
this.indentGuidesDisposable.dispose();
Object(lifecycle["f" /* dispose */])(this.disposables);
};
TreeRenderer.DefaultIndent = 8;
return TreeRenderer;
}());
var abstractTree_TypeFilter = /** @class */ (function () {
function TypeFilter(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 lifecycle["b" /* DisposableStore */]();
tree.onWillRefilter(this.reset, this, this.disposables);
}
Object.defineProperty(TypeFilter.prototype, "totalCount", {
get: function () { return this._totalCount; },
enumerable: true,
configurable: true
});
Object.defineProperty(TypeFilter.prototype, "matchCount", {
get: function () { return this._matchCount; },
enumerable: true,
configurable: true
});
Object.defineProperty(TypeFilter.prototype, "pattern", {
set: function (pattern) {
this._pattern = pattern;
this._lowercasePattern = pattern.toLowerCase();
},
enumerable: true,
configurable: true
});
TypeFilter.prototype.filter = function (element, parentVisibility) {
if (this._filter) {
var result = this._filter.filter(element, parentVisibility);
if (this.tree.options.simpleKeyboardNavigation) {
return result;
}
var visibility = void 0;
if (typeof result === 'boolean') {
visibility = result ? 1 /* Visible */ : 0 /* Hidden */;
}
else if (isFilterResult(result)) {
visibility = getVisibleState(result.visibility);
}
else {
visibility = result;
}
if (visibility === 0 /* Hidden */) {
return false;
}
}
this._totalCount++;
if (this.tree.options.simpleKeyboardNavigation || !this._pattern) {
this._matchCount++;
return { data: filters["a" /* FuzzyScore */].Default, visibility: true };
}
var label = this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(element);
var labelStr = label && label.toString();
if (typeof labelStr === 'undefined') {
return { data: filters["a" /* FuzzyScore */].Default, visibility: true };
}
var score = Object(filters["d" /* fuzzyScore */])(this._pattern, this._lowercasePattern, 0, labelStr, labelStr.toLowerCase(), 0, true);
if (!score) {
if (this.tree.options.filterOnType) {
return 2 /* Recurse */;
}
else {
return { data: filters["a" /* FuzzyScore */].Default, visibility: true };
}
// DEMO: smarter filter ?
// return parentVisibility === TreeVisibility.Visible ? true : TreeVisibility.Recurse;
}
this._matchCount++;
return { data: score, visibility: true };
};
TypeFilter.prototype.reset = function () {
this._totalCount = 0;
this._matchCount = 0;
};
TypeFilter.prototype.dispose = function () {
Object(lifecycle["f" /* dispose */])(this.disposables);
};
return TypeFilter;
}());
var abstractTree_TypeFilterController = /** @class */ (function () {
function TypeFilterController(tree, model, view, filter, keyboardNavigationDelegate) {
this.tree = tree;
this.view = view;
this.filter = filter;
this.keyboardNavigationDelegate = keyboardNavigationDelegate;
this._enabled = false;
this._pattern = '';
this._empty = false;
this._onDidChangeEmptyState = new common_event["a" /* Emitter */]();
this.positionClassName = 'ne';
this.automaticKeyboardNavigation = true;
this.triggered = false;
this._onDidChangePattern = new common_event["a" /* Emitter */]();
this.enabledDisposables = new lifecycle["b" /* DisposableStore */]();
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.domNode = Object(dom["a" /* $ */])(".monaco-list-type-filter." + this.positionClassName);
this.domNode.draggable = true;
Object(browser_event["a" /* domEvent */])(this.domNode, 'dragstart')(this.onDragStart, this, this.disposables);
this.messageDomNode = Object(dom["q" /* append */])(view.getHTMLElement(), Object(dom["a" /* $ */])(".monaco-list-type-filter-message"));
this.labelDomNode = Object(dom["q" /* append */])(this.domNode, Object(dom["a" /* $ */])('span.label'));
var controls = Object(dom["q" /* append */])(this.domNode, Object(dom["a" /* $ */])('.controls'));
this._filterOnType = !!tree.options.filterOnType;
this.filterOnTypeDomNode = Object(dom["q" /* append */])(controls, Object(dom["a" /* $ */])('input.filter.codicon.codicon-list-selection'));
this.filterOnTypeDomNode.type = 'checkbox';
this.filterOnTypeDomNode.checked = this._filterOnType;
this.filterOnTypeDomNode.tabIndex = -1;
this.updateFilterOnTypeTitle();
Object(browser_event["a" /* domEvent */])(this.filterOnTypeDomNode, 'input')(this.onDidChangeFilterOnType, this, this.disposables);
this.clearDomNode = Object(dom["q" /* append */])(controls, Object(dom["a" /* $ */])('button.clear.codicon.codicon-close'));
this.clearDomNode.tabIndex = -1;
this.clearDomNode.title = Object(nls["a" /* localize */])('clear', "Clear");
this.keyboardNavigationEventFilter = tree.options.keyboardNavigationEventFilter;
model.onDidSplice(this.onDidSpliceModel, this, this.disposables);
this.updateOptions(tree.options);
}
Object.defineProperty(TypeFilterController.prototype, "enabled", {
get: function () { return this._enabled; },
enumerable: true,
configurable: true
});
Object.defineProperty(TypeFilterController.prototype, "pattern", {
get: function () { return this._pattern; },
enumerable: true,
configurable: true
});
Object.defineProperty(TypeFilterController.prototype, "filterOnType", {
get: function () { return this._filterOnType; },
enumerable: true,
configurable: true
});
TypeFilterController.prototype.updateOptions = function (options) {
if (options.simpleKeyboardNavigation) {
this.disable();
}
else {
this.enable();
}
if (typeof options.filterOnType !== 'undefined') {
this._filterOnType = !!options.filterOnType;
this.filterOnTypeDomNode.checked = this._filterOnType;
}
if (typeof options.automaticKeyboardNavigation !== 'undefined') {
this.automaticKeyboardNavigation = options.automaticKeyboardNavigation;
}
this.tree.refilter();
this.render();
if (!this.automaticKeyboardNavigation) {
this.onEventOrInput('');
}
};
TypeFilterController.prototype.enable = function () {
var _this = this;
if (this._enabled) {
return;
}
var onKeyDown = common_event["b" /* Event */].chain(Object(browser_event["a" /* domEvent */])(this.view.getHTMLElement(), 'keydown'))
.filter(function (e) { return !isInputElement(e.target) || e.target === _this.filterOnTypeDomNode; })
.filter(function (e) { return e.key !== 'Dead' && !/^Media/.test(e.key); })
.map(function (e) { return new keyboardEvent["a" /* StandardKeyboardEvent */](e); })
.filter(this.keyboardNavigationEventFilter || (function () { return true; }))
.filter(function () { return _this.automaticKeyboardNavigation || _this.triggered; })
.filter(function (e) { return _this.keyboardNavigationDelegate.mightProducePrintableCharacter(e) || ((_this.pattern.length > 0 || _this.triggered) && ((e.keyCode === 9 /* Escape */ || e.keyCode === 1 /* Backspace */) && !e.altKey && !e.ctrlKey && !e.metaKey) || (e.keyCode === 1 /* Backspace */ && (common_platform["e" /* isMacintosh */] ? (e.altKey && !e.metaKey) : e.ctrlKey) && !e.shiftKey)); })
.forEach(function (e) { e.stopPropagation(); e.preventDefault(); })
.event;
var onClear = Object(browser_event["a" /* domEvent */])(this.clearDomNode, 'click');
common_event["b" /* Event */].chain(common_event["b" /* Event */].any(onKeyDown, onClear))
.event(this.onEventOrInput, this, this.enabledDisposables);
this.filter.pattern = '';
this.tree.refilter();
this.render();
this._enabled = true;
this.triggered = false;
};
TypeFilterController.prototype.disable = function () {
if (!this._enabled) {
return;
}
this.domNode.remove();
this.enabledDisposables.clear();
this.tree.refilter();
this.render();
this._enabled = false;
this.triggered = false;
};
TypeFilterController.prototype.onEventOrInput = function (e) {
if (typeof e === 'string') {
this.onInput(e);
}
else if (e instanceof MouseEvent || e.keyCode === 9 /* Escape */ || (e.keyCode === 1 /* Backspace */ && (common_platform["e" /* isMacintosh */] ? e.altKey : e.ctrlKey))) {
this.onInput('');
}
else if (e.keyCode === 1 /* Backspace */) {
this.onInput(this.pattern.length === 0 ? '' : this.pattern.substr(0, this.pattern.length - 1));
}
else {
this.onInput(this.pattern + e.browserEvent.key);
}
};
TypeFilterController.prototype.onInput = function (pattern) {
var container = this.view.getHTMLElement();
if (pattern && !this.domNode.parentElement) {
container.append(this.domNode);
}
else if (!pattern && this.domNode.parentElement) {
this.domNode.remove();
this.tree.domFocus();
}
this._pattern = pattern;
this._onDidChangePattern.fire(pattern);
this.filter.pattern = pattern;
this.tree.refilter();
if (pattern) {
this.tree.focusNext(0, true, undefined, function (node) { return !filters["a" /* FuzzyScore */].isDefault(node.filterData); });
}
var focus = this.tree.getFocus();
if (focus.length > 0) {
var element = focus[0];
if (this.tree.getRelativeTop(element) === null) {
this.tree.reveal(element, 0.5);
}
}
this.render();
if (!pattern) {
this.triggered = false;
}
};
TypeFilterController.prototype.onDragStart = function () {
var _this = this;
var container = this.view.getHTMLElement();
var left = Object(dom["C" /* getDomNodePagePosition */])(container).left;
var containerWidth = container.clientWidth;
var midContainerWidth = containerWidth / 2;
var width = this.domNode.clientWidth;
var disposables = new lifecycle["b" /* DisposableStore */]();
var positionClassName = this.positionClassName;
var updatePosition = function () {
switch (positionClassName) {
case 'nw':
_this.domNode.style.top = "4px";
_this.domNode.style.left = "4px";
break;
case 'ne':
_this.domNode.style.top = "4px";
_this.domNode.style.left = containerWidth - width - 6 + "px";
break;
}
};
var onDragOver = function (event) {
event.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
var x = event.screenX - left;
if (event.dataTransfer) {
event.dataTransfer.dropEffect = 'none';
}
if (x < midContainerWidth) {
positionClassName = 'nw';
}
else {
positionClassName = 'ne';
}
updatePosition();
};
var onDragEnd = function () {
_this.positionClassName = positionClassName;
_this.domNode.className = "monaco-list-type-filter " + _this.positionClassName;
_this.domNode.style.top = '';
_this.domNode.style.left = '';
Object(lifecycle["f" /* dispose */])(disposables);
};
updatePosition();
Object(dom["P" /* removeClass */])(this.domNode, positionClassName);
Object(dom["f" /* addClass */])(this.domNode, 'dragging');
disposables.add(Object(lifecycle["h" /* toDisposable */])(function () { return Object(dom["P" /* removeClass */])(_this.domNode, 'dragging'); }));
Object(browser_event["a" /* domEvent */])(document, 'dragover')(onDragOver, null, disposables);
Object(browser_event["a" /* domEvent */])(this.domNode, 'dragend')(onDragEnd, null, disposables);
browser_dnd["c" /* StaticDND */].CurrentDragAndDropData = new browser_dnd["b" /* DragAndDropData */]('vscode-ui');
disposables.add(Object(lifecycle["h" /* toDisposable */])(function () { return browser_dnd["c" /* StaticDND */].CurrentDragAndDropData = undefined; }));
};
TypeFilterController.prototype.onDidSpliceModel = function () {
if (!this._enabled || this.pattern.length === 0) {
return;
}
this.tree.refilter();
this.render();
};
TypeFilterController.prototype.onDidChangeFilterOnType = function () {
this.tree.updateOptions({ filterOnType: this.filterOnTypeDomNode.checked });
this.tree.refilter();
this.tree.domFocus();
this.render();
this.updateFilterOnTypeTitle();
};
TypeFilterController.prototype.updateFilterOnTypeTitle = function () {
if (this.filterOnType) {
this.filterOnTypeDomNode.title = Object(nls["a" /* localize */])('disable filter on type', "Disable Filter on Type");
}
else {
this.filterOnTypeDomNode.title = Object(nls["a" /* localize */])('enable filter on type', "Enable Filter on Type");
}
};
TypeFilterController.prototype.render = function () {
var noMatches = this.filter.totalCount > 0 && this.filter.matchCount === 0;
if (this.pattern && this.tree.options.filterOnType && noMatches) {
this.messageDomNode.textContent = Object(nls["a" /* localize */])('empty', "No elements found");
this._empty = true;
}
else {
this.messageDomNode.innerHTML = '';
this._empty = false;
}
Object(dom["Y" /* toggleClass */])(this.domNode, 'no-matches', noMatches);
this.domNode.title = Object(nls["a" /* localize */])('found', "Matched {0} out of {1} elements", this.filter.matchCount, this.filter.totalCount);
this.labelDomNode.textContent = this.pattern.length > 16 ? '…' + this.pattern.substr(this.pattern.length - 16) : this.pattern;
this._onDidChangeEmptyState.fire(this._empty);
};
TypeFilterController.prototype.shouldAllowFocus = function (node) {
if (!this.enabled || !this.pattern || this.filterOnType) {
return true;
}
if (this.filter.totalCount > 0 && this.filter.matchCount <= 1) {
return true;
}
return !filters["a" /* FuzzyScore */].isDefault(node.filterData);
};
TypeFilterController.prototype.dispose = function () {
if (this._enabled) {
this.domNode.remove();
this.enabledDisposables.dispose();
this._enabled = false;
this.triggered = false;
}
this._onDidChangePattern.dispose();
Object(lifecycle["f" /* dispose */])(this.disposables);
};
return TypeFilterController;
}());
function isInputElement(e) {
return e.tagName === 'INPUT' || e.tagName === 'TEXTAREA';
}
function asTreeEvent(event) {
return {
elements: event.elements.map(function (node) { return node.element; }),
browserEvent: event.browserEvent
};
}
function dfs(node, fn) {
fn(node);
node.children.forEach(function (child) { return dfs(child, fn); });
}
/**
* The trait concept needs to exist at the tree level, because collapsed
* tree nodes will not be known by the list.
*/
var abstractTree_Trait = /** @class */ (function () {
function Trait(identityProvider) {
this.identityProvider = identityProvider;
this.nodes = [];
this._onDidChange = new common_event["a" /* Emitter */]();
this.onDidChange = this._onDidChange.event;
}
Object.defineProperty(Trait.prototype, "nodeSet", {
get: function () {
if (!this._nodeSet) {
this._nodeSet = this.createNodeSet();
}
return this._nodeSet;
},
enumerable: true,
configurable: true
});
Trait.prototype.set = function (nodes, browserEvent) {
if (Object(arrays["g" /* equals */])(this.nodes, nodes)) {
return;
}
this._set(nodes, false, browserEvent);
};
Trait.prototype._set = function (nodes, silent, browserEvent) {
this.nodes = abstractTree_spreadArrays(nodes);
this.elements = undefined;
this._nodeSet = undefined;
if (!silent) {
var that_1 = this;
this._onDidChange.fire({ get elements() { return that_1.get(); }, browserEvent: browserEvent });
}
};
Trait.prototype.get = function () {
if (!this.elements) {
this.elements = this.nodes.map(function (node) { return node.element; });
}
return abstractTree_spreadArrays(this.elements);
};
Trait.prototype.getNodes = function () {
return this.nodes;
};
Trait.prototype.has = function (node) {
return this.nodeSet.has(node);
};
Trait.prototype.onDidModelSplice = function (_a) {
var _this = this;
var insertedNodes = _a.insertedNodes, deletedNodes = _a.deletedNodes;
if (!this.identityProvider) {
var set_1 = this.createNodeSet();
var visit_1 = function (node) { return set_1.delete(node); };
deletedNodes.forEach(function (node) { return dfs(node, visit_1); });
this.set(Object(map["e" /* values */])(set_1));
return;
}
var deletedNodesIdSet = new Set();
var deletedNodesVisitor = function (node) { return deletedNodesIdSet.add(_this.identityProvider.getId(node.element).toString()); };
deletedNodes.forEach(function (node) { return dfs(node, deletedNodesVisitor); });
var insertedNodesMap = new Map();
var insertedNodesVisitor = function (node) { return insertedNodesMap.set(_this.identityProvider.getId(node.element).toString(), node); };
insertedNodes.forEach(function (node) { return dfs(node, insertedNodesVisitor); });
var nodes = [];
for (var _i = 0, _b = this.nodes; _i < _b.length; _i++) {
var node = _b[_i];
var id = this.identityProvider.getId(node.element).toString();
var wasDeleted = deletedNodesIdSet.has(id);
if (!wasDeleted) {
nodes.push(node);
}
else {
var insertedNode = insertedNodesMap.get(id);
if (insertedNode) {
nodes.push(insertedNode);
}
}
}
this._set(nodes, true);
};
Trait.prototype.createNodeSet = function () {
var set = new Set();
for (var _i = 0, _a = this.nodes; _i < _a.length; _i++) {
var node = _a[_i];
set.add(node);
}
return set;
};
return Trait;
}());
var abstractTree_TreeNodeListMouseController = /** @class */ (function (_super) {
abstractTree_extends(TreeNodeListMouseController, _super);
function TreeNodeListMouseController(list, tree) {
var _this = _super.call(this, list) || this;
_this.tree = tree;
return _this;
}
TreeNodeListMouseController.prototype.onPointer = function (e) {
if (isInputElement(e.browserEvent.target)) {
return;
}
var node = e.element;
if (!node) {
return _super.prototype.onPointer.call(this, e);
}
if (this.isSelectionRangeChangeEvent(e) || this.isSelectionSingleChangeEvent(e)) {
return _super.prototype.onPointer.call(this, e);
}
var onTwistie = Object(dom["I" /* hasClass */])(e.browserEvent.target, 'monaco-tl-twistie');
if (!this.tree.openOnSingleClick && e.browserEvent.detail !== 2 && !onTwistie) {
return _super.prototype.onPointer.call(this, e);
}
var expandOnlyOnTwistieClick = false;
if (typeof this.tree.expandOnlyOnTwistieClick === 'function') {
expandOnlyOnTwistieClick = this.tree.expandOnlyOnTwistieClick(node.element);
}
else {
expandOnlyOnTwistieClick = !!this.tree.expandOnlyOnTwistieClick;
}
if (expandOnlyOnTwistieClick && !onTwistie) {
return _super.prototype.onPointer.call(this, e);
}
if (node.collapsible) {
var model = this.tree.model; // internal
var location_1 = model.getNodeLocation(node);
var recursive = e.browserEvent.altKey;
model.setCollapsed(location_1, undefined, recursive);
if (expandOnlyOnTwistieClick && onTwistie) {
return;
}
}
_super.prototype.onPointer.call(this, e);
};
TreeNodeListMouseController.prototype.onDoubleClick = function (e) {
var onTwistie = Object(dom["I" /* hasClass */])(e.browserEvent.target, 'monaco-tl-twistie');
if (onTwistie) {
return;
}
_super.prototype.onDoubleClick.call(this, e);
};
return TreeNodeListMouseController;
}(listWidget["d" /* MouseController */]));
/**
* We use this List subclass to restore selection and focus as nodes
* get rendered in the list, possibly due to a node expand() call.
*/
var abstractTree_TreeNodeList = /** @class */ (function (_super) {
abstractTree_extends(TreeNodeList, _super);
function TreeNodeList(user, container, virtualDelegate, renderers, focusTrait, selectionTrait, options) {
var _this = _super.call(this, user, container, virtualDelegate, renderers, options) || this;
_this.focusTrait = focusTrait;
_this.selectionTrait = selectionTrait;
return _this;
}
TreeNodeList.prototype.createMouseController = function (options) {
return new abstractTree_TreeNodeListMouseController(this, options.tree);
};
TreeNodeList.prototype.splice = function (start, deleteCount, elements) {
var _this = this;
if (elements === void 0) { elements = []; }
_super.prototype.splice.call(this, start, deleteCount, elements);
if (elements.length === 0) {
return;
}
var additionalFocus = [];
var additionalSelection = [];
elements.forEach(function (node, index) {
if (_this.focusTrait.has(node)) {
additionalFocus.push(start + index);
}
if (_this.selectionTrait.has(node)) {
additionalSelection.push(start + index);
}
});
if (additionalFocus.length > 0) {
_super.prototype.setFocus.call(this, Object(arrays["f" /* distinctES6 */])(abstractTree_spreadArrays(_super.prototype.getFocus.call(this), additionalFocus)));
}
if (additionalSelection.length > 0) {
_super.prototype.setSelection.call(this, Object(arrays["f" /* distinctES6 */])(abstractTree_spreadArrays(_super.prototype.getSelection.call(this), additionalSelection)));
}
};
TreeNodeList.prototype.setFocus = function (indexes, browserEvent, fromAPI) {
var _this = this;
if (fromAPI === void 0) { fromAPI = false; }
_super.prototype.setFocus.call(this, indexes, browserEvent);
if (!fromAPI) {
this.focusTrait.set(indexes.map(function (i) { return _this.element(i); }), browserEvent);
}
};
TreeNodeList.prototype.setSelection = function (indexes, browserEvent, fromAPI) {
var _this = this;
if (fromAPI === void 0) { fromAPI = false; }
_super.prototype.setSelection.call(this, indexes, browserEvent);
if (!fromAPI) {
this.selectionTrait.set(indexes.map(function (i) { return _this.element(i); }), browserEvent);
}
};
return TreeNodeList;
}(listWidget["c" /* List */]));
var abstractTree_AbstractTree = /** @class */ (function () {
function AbstractTree(user, container, delegate, renderers, _options) {
var _this = this;
if (_options === void 0) { _options = {}; }
this._options = _options;
this.eventBufferer = new common_event["c" /* EventBufferer */]();
this.disposables = new lifecycle["b" /* DisposableStore */]();
this._onWillRefilter = new common_event["a" /* Emitter */]();
this.onWillRefilter = this._onWillRefilter.event;
this._onDidUpdateOptions = new common_event["a" /* Emitter */]();
var treeDelegate = new ComposedTreeDelegate(delegate);
var onDidChangeCollapseStateRelay = new common_event["f" /* Relay */]();
var onDidChangeActiveNodes = new common_event["f" /* Relay */]();
var activeNodes = new abstractTree_EventCollection(onDidChangeActiveNodes.event);
this.renderers = renderers.map(function (r) { return new abstractTree_TreeRenderer(r, function () { return _this.model; }, onDidChangeCollapseStateRelay.event, activeNodes, _options); });
for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {
var r = _a[_i];
this.disposables.add(r);
}
var filter;
if (_options.keyboardNavigationLabelProvider) {
filter = new abstractTree_TypeFilter(this, _options.keyboardNavigationLabelProvider, _options.filter);
_options = __assign(__assign({}, _options), { filter: filter }); // TODO need typescript help here
this.disposables.add(filter);
}
this.focus = new abstractTree_Trait(_options.identityProvider);
this.selection = new abstractTree_Trait(_options.identityProvider);
this.view = new abstractTree_TreeNodeList(user, container, treeDelegate, this.renderers, this.focus, this.selection, __assign(__assign({}, asListOptions(function () { return _this.model; }, _options)), { tree: this }));
this.model = this.createModel(user, this.view, _options);
onDidChangeCollapseStateRelay.input = this.model.onDidChangeCollapseState;
var onDidModelSplice = common_event["b" /* Event */].forEach(this.model.onDidSplice, function (e) {
_this.eventBufferer.bufferEvents(function () {
_this.focus.onDidModelSplice(e);
_this.selection.onDidModelSplice(e);
});
});
// Make sure the `forEach` always runs
onDidModelSplice(function () { return null; }, null, this.disposables);
// Active nodes can change when the model changes or when focus or selection change.
// We debounce it with 0 delay since these events may fire in the same stack and we only
// want to run this once. It also doesn't matter if it runs on the next tick since it's only
// a nice to have UI feature.
onDidChangeActiveNodes.input = common_event["b" /* Event */].chain(common_event["b" /* Event */].any(onDidModelSplice, this.focus.onDidChange, this.selection.onDidChange))
.debounce(function () { return null; }, 0)
.map(function () {
var set = new Set();
for (var _i = 0, _a = _this.focus.getNodes(); _i < _a.length; _i++) {
var node = _a[_i];
set.add(node);
}
for (var _b = 0, _c = _this.selection.getNodes(); _b < _c.length; _b++) {
var node = _c[_b];
set.add(node);
}
return Object(arrays["n" /* fromSet */])(set);
}).event;
if (_options.keyboardSupport !== false) {
var onKeyDown = common_event["b" /* Event */].chain(this.view.onKeyDown)
.filter(function (e) { return !isInputElement(e.target); })
.map(function (e) { return new keyboardEvent["a" /* StandardKeyboardEvent */](e); });
onKeyDown.filter(function (e) { return e.keyCode === 15 /* LeftArrow */; }).on(this.onLeftArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 17 /* RightArrow */; }).on(this.onRightArrow, this, this.disposables);
onKeyDown.filter(function (e) { return e.keyCode === 10 /* Space */; }).on(this.onSpace, this, this.disposables);
}
if (_options.keyboardNavigationLabelProvider) {
var delegate_1 = _options.keyboardNavigationDelegate || listWidget["a" /* DefaultKeyboardNavigationDelegate */];
this.typeFilterController = new abstractTree_TypeFilterController(this, this.model, this.view, filter, delegate_1);
this.focusNavigationFilter = function (node) { return _this.typeFilterController.shouldAllowFocus(node); };
this.disposables.add(this.typeFilterController);
}
this.styleElement = Object(dom["w" /* createStyleSheet */])(this.view.getHTMLElement());
Object(dom["Y" /* toggleClass */])(this.getHTMLElement(), 'always', this._options.renderIndentGuides === RenderIndentGuides.Always);
}
Object.defineProperty(AbstractTree.prototype, "onDidChangeFocus", {
get: function () { return this.eventBufferer.wrapEvent(this.focus.onDidChange); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "onDidChangeSelection", {
get: function () { return this.eventBufferer.wrapEvent(this.selection.onDidChange); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "onDidOpen", {
get: function () { return common_event["b" /* Event */].map(this.view.onDidOpen, asTreeEvent); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "onDidFocus", {
get: function () { return this.view.onDidFocus; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "onDidChangeCollapseState", {
get: function () { return this.model.onDidChangeCollapseState; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "openOnSingleClick", {
get: function () { return typeof this._options.openOnSingleClick === 'undefined' ? true : this._options.openOnSingleClick; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "expandOnlyOnTwistieClick", {
get: function () { return typeof this._options.expandOnlyOnTwistieClick === 'undefined' ? false : this._options.expandOnlyOnTwistieClick; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractTree.prototype, "onDidDispose", {
get: function () { return this.view.onDidDispose; },
enumerable: true,
configurable: true
});
AbstractTree.prototype.updateOptions = function (optionsUpdate) {
if (optionsUpdate === void 0) { optionsUpdate = {}; }
this._options = __assign(__assign({}, this._options), optionsUpdate);
for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {
var renderer = _a[_i];
renderer.updateOptions(optionsUpdate);
}
this.view.updateOptions({
enableKeyboardNavigation: this._options.simpleKeyboardNavigation,
automaticKeyboardNavigation: this._options.automaticKeyboardNavigation
});
if (this.typeFilterController) {
this.typeFilterController.updateOptions(this._options);
}
this._onDidUpdateOptions.fire(this._options);
Object(dom["Y" /* toggleClass */])(this.getHTMLElement(), 'always', this._options.renderIndentGuides === RenderIndentGuides.Always);
};
Object.defineProperty(AbstractTree.prototype, "options", {
get: function () {
return this._options;
},
enumerable: true,
configurable: true
});
// Widget
AbstractTree.prototype.getHTMLElement = function () {
return this.view.getHTMLElement();
};
Object.defineProperty(AbstractTree.prototype, "scrollTop", {
get: function () {
return this.view.scrollTop;
},
set: function (scrollTop) {
this.view.scrollTop = scrollTop;
},
enumerable: true,
configurable: true
});
AbstractTree.prototype.domFocus = function () {
this.view.domFocus();
};
AbstractTree.prototype.layout = function (height, width) {
this.view.layout(height, width);
};
AbstractTree.prototype.style = function (styles) {
var suffix = "." + this.view.domId;
var 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.treeIndentGuidesStroke.transparent(0.4) + "; }");
content.push(".monaco-list" + suffix + " .monaco-tl-indent > .indent-guide.active { border-color: " + styles.treeIndentGuidesStroke + "; }");
}
var newStyles = content.join('\n');
if (newStyles !== this.styleElement.innerHTML) {
this.styleElement.innerHTML = newStyles;
}
this.view.style(styles);
};
AbstractTree.prototype.collapse = function (location, recursive) {
if (recursive === void 0) { recursive = false; }
return this.model.setCollapsed(location, true, recursive);
};
AbstractTree.prototype.expand = function (location, recursive) {
if (recursive === void 0) { recursive = false; }
return this.model.setCollapsed(location, false, recursive);
};
AbstractTree.prototype.isCollapsible = function (location) {
return this.model.isCollapsible(location);
};
AbstractTree.prototype.setCollapsible = function (location, collapsible) {
return this.model.setCollapsible(location, collapsible);
};
AbstractTree.prototype.isCollapsed = function (location) {
return this.model.isCollapsed(location);
};
AbstractTree.prototype.refilter = function () {
this._onWillRefilter.fire(undefined);
this.model.refilter();
};
AbstractTree.prototype.setSelection = function (elements, browserEvent) {
var _this = this;
var nodes = elements.map(function (e) { return _this.model.getNode(e); });
this.selection.set(nodes, browserEvent);
var indexes = elements.map(function (e) { return _this.model.getListIndex(e); }).filter(function (i) { return i > -1; });
this.view.setSelection(indexes, browserEvent, true);
};
AbstractTree.prototype.getSelection = function () {
return this.selection.get();
};
AbstractTree.prototype.setFocus = function (elements, browserEvent) {
var _this = this;
var nodes = elements.map(function (e) { return _this.model.getNode(e); });
this.focus.set(nodes, browserEvent);
var indexes = elements.map(function (e) { return _this.model.getListIndex(e); }).filter(function (i) { return i > -1; });
this.view.setFocus(indexes, browserEvent, true);
};
AbstractTree.prototype.focusNext = function (n, loop, browserEvent, filter) {
if (n === void 0) { n = 1; }
if (loop === void 0) { loop = false; }
if (filter === void 0) { filter = this.focusNavigationFilter; }
this.view.focusNext(n, loop, browserEvent, filter);
};
AbstractTree.prototype.getFocus = function () {
return this.focus.get();
};
AbstractTree.prototype.reveal = function (location, relativeTop) {
this.model.expandTo(location);
var index = this.model.getListIndex(location);
if (index === -1) {
return;
}
this.view.reveal(index, relativeTop);
};
/**
* Returns the relative position of an element rendered in the list.
* Returns `null` if the element isn't *entirely* in the visible viewport.
*/
AbstractTree.prototype.getRelativeTop = function (location) {
var index = this.model.getListIndex(location);
if (index === -1) {
return null;
}
return this.view.getRelativeTop(index);
};
// List
AbstractTree.prototype.onLeftArrow = function (e) {
e.preventDefault();
e.stopPropagation();
var nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
var node = nodes[0];
var location = this.model.getNodeLocation(node);
var didChange = this.model.setCollapsed(location, true);
if (!didChange) {
var parentLocation = this.model.getParentNodeLocation(location);
if (!parentLocation) {
return;
}
var parentListIndex = this.model.getListIndex(parentLocation);
this.view.reveal(parentListIndex);
this.view.setFocus([parentListIndex]);
}
};
AbstractTree.prototype.onRightArrow = function (e) {
e.preventDefault();
e.stopPropagation();
var nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
var node = nodes[0];
var location = this.model.getNodeLocation(node);
var didChange = this.model.setCollapsed(location, false);
if (!didChange) {
if (!node.children.some(function (child) { return child.visible; })) {
return;
}
var focusedIndex = this.view.getFocus()[0];
var firstChildIndex = focusedIndex + 1;
this.view.reveal(firstChildIndex);
this.view.setFocus([firstChildIndex]);
}
};
AbstractTree.prototype.onSpace = function (e) {
e.preventDefault();
e.stopPropagation();
var nodes = this.view.getFocusedElements();
if (nodes.length === 0) {
return;
}
var node = nodes[0];
var location = this.model.getNodeLocation(node);
var recursive = e.browserEvent.altKey;
this.model.setCollapsed(location, undefined, recursive);
};
AbstractTree.prototype.dispose = function () {
Object(lifecycle["f" /* dispose */])(this.disposables);
this.view.dispose();
};
return AbstractTree;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTreeModel.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var objectTreeModel_assign = (undefined && undefined.__assign) || function () {
objectTreeModel_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return objectTreeModel_assign.apply(this, arguments);
};
var objectTreeModel_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var objectTreeModel_ObjectTreeModel = /** @class */ (function () {
function ObjectTreeModel(user, list, options) {
if (options === void 0) { options = {}; }
this.user = user;
this.nodes = new Map();
this.nodesByIdentity = new Map();
this.model = new indexTreeModel_IndexTreeModel(user, list, null, options);
this.onDidSplice = this.model.onDidSplice;
this.onDidChangeCollapseState = this.model.onDidChangeCollapseState;
this.onDidChangeRenderNodeCount = this.model.onDidChangeRenderNodeCount;
if (options.sorter) {
this.sorter = {
compare: function (a, b) {
return options.sorter.compare(a.element, b.element);
}
};
}
this.identityProvider = options.identityProvider;
}
ObjectTreeModel.prototype.setChildren = function (element, children, onDidCreateNode, onDidDeleteNode) {
var location = this.getElementLocation(element);
this._setChildren(location, this.preserveCollapseState(children), onDidCreateNode, onDidDeleteNode);
};
ObjectTreeModel.prototype._setChildren = function (location, children, onDidCreateNode, onDidDeleteNode) {
var _this = this;
var insertedElements = new Set();
var insertedElementIds = new Set();
var _onDidCreateNode = function (node) {
insertedElements.add(node.element);
_this.nodes.set(node.element, node);
if (_this.identityProvider) {
var id = _this.identityProvider.getId(node.element).toString();
insertedElementIds.add(id);
_this.nodesByIdentity.set(id, node);
}
if (onDidCreateNode) {
onDidCreateNode(node);
}
};
var _onDidDeleteNode = function (node) {
if (!insertedElements.has(node.element)) {
_this.nodes.delete(node.element);
}
if (_this.identityProvider) {
var id = _this.identityProvider.getId(node.element).toString();
if (!insertedElementIds.has(id)) {
_this.nodesByIdentity.delete(id);
}
}
if (onDidDeleteNode) {
onDidDeleteNode(node);
}
};
this.model.splice(objectTreeModel_spreadArrays(location, [0]), Number.MAX_VALUE, children, _onDidCreateNode, _onDidDeleteNode);
};
ObjectTreeModel.prototype.preserveCollapseState = function (elements) {
var _this = this;
var iterator = elements ? Object(common_iterator["f" /* getSequenceIterator */])(elements) : common_iterator["d" /* Iterator */].empty();
if (this.sorter) {
iterator = common_iterator["d" /* Iterator */].fromArray(Object(arrays["r" /* mergeSort */])(common_iterator["d" /* Iterator */].collect(iterator), this.sorter.compare.bind(this.sorter)));
}
return common_iterator["d" /* Iterator */].map(iterator, function (treeElement) {
var node = _this.nodes.get(treeElement.element);
if (!node && _this.identityProvider) {
var id = _this.identityProvider.getId(treeElement.element).toString();
node = _this.nodesByIdentity.get(id);
}
if (!node) {
return objectTreeModel_assign(objectTreeModel_assign({}, treeElement), { children: _this.preserveCollapseState(treeElement.children) });
}
var collapsible = typeof treeElement.collapsible === 'boolean' ? treeElement.collapsible : node.collapsible;
var collapsed = typeof treeElement.collapsed !== 'undefined' ? treeElement.collapsed : node.collapsed;
return objectTreeModel_assign(objectTreeModel_assign({}, treeElement), { collapsible: collapsible,
collapsed: collapsed, children: _this.preserveCollapseState(treeElement.children) });
});
};
ObjectTreeModel.prototype.rerender = function (element) {
var location = this.getElementLocation(element);
this.model.rerender(location);
};
ObjectTreeModel.prototype.has = function (element) {
return this.nodes.has(element);
};
ObjectTreeModel.prototype.getListIndex = function (element) {
var location = this.getElementLocation(element);
return this.model.getListIndex(location);
};
ObjectTreeModel.prototype.getListRenderCount = function (element) {
var location = this.getElementLocation(element);
return this.model.getListRenderCount(location);
};
ObjectTreeModel.prototype.isCollapsible = function (element) {
var location = this.getElementLocation(element);
return this.model.isCollapsible(location);
};
ObjectTreeModel.prototype.setCollapsible = function (element, collapsible) {
var location = this.getElementLocation(element);
return this.model.setCollapsible(location, collapsible);
};
ObjectTreeModel.prototype.isCollapsed = function (element) {
var location = this.getElementLocation(element);
return this.model.isCollapsed(location);
};
ObjectTreeModel.prototype.setCollapsed = function (element, collapsed, recursive) {
var location = this.getElementLocation(element);
return this.model.setCollapsed(location, collapsed, recursive);
};
ObjectTreeModel.prototype.expandTo = function (element) {
var location = this.getElementLocation(element);
this.model.expandTo(location);
};
ObjectTreeModel.prototype.refilter = function () {
this.model.refilter();
};
ObjectTreeModel.prototype.getNode = function (element) {
if (element === void 0) { element = null; }
if (element === null) {
return this.model.getNode(this.model.rootRef);
}
var node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, "Tree element not found: " + element);
}
return node;
};
ObjectTreeModel.prototype.getNodeLocation = function (node) {
return node.element;
};
ObjectTreeModel.prototype.getParentNodeLocation = function (element) {
if (element === null) {
throw new TreeError(this.user, "Invalid getParentNodeLocation call");
}
var node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, "Tree element not found: " + element);
}
var location = this.model.getNodeLocation(node);
var parentLocation = this.model.getParentNodeLocation(location);
var parent = this.model.getNode(parentLocation);
return parent.element;
};
ObjectTreeModel.prototype.getElementLocation = function (element) {
if (element === null) {
return [];
}
var node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, "Tree element not found: " + element);
}
return this.model.getNodeLocation(node);
};
return ObjectTreeModel;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var compressedObjectTreeModel_assign = (undefined && undefined.__assign) || function () {
compressedObjectTreeModel_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return compressedObjectTreeModel_assign.apply(this, arguments);
};
function noCompress(element) {
var elements = [element.element];
var incompressible = element.incompressible || false;
return {
element: { elements: elements, incompressible: incompressible },
children: common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].from(element.children), noCompress),
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
// Exported only for test reasons, do not use directly
function compress(element) {
var elements = [element.element];
var incompressible = element.incompressible || false;
var childrenIterator;
var children;
while (true) {
childrenIterator = common_iterator["d" /* Iterator */].from(element.children);
children = common_iterator["d" /* Iterator */].collect(childrenIterator, 2);
if (children.length !== 1) {
break;
}
element = children[0];
if (element.incompressible) {
break;
}
elements.push(element.element);
}
return {
element: { elements: elements, incompressible: incompressible },
children: common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].concat(common_iterator["d" /* Iterator */].fromArray(children), childrenIterator), compress),
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
function _decompress(element, index) {
if (index === void 0) { index = 0; }
var children;
if (index < element.element.elements.length - 1) {
children = common_iterator["d" /* Iterator */].single(_decompress(element, index + 1));
}
else {
children = common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].from(element.children), function (el) { return _decompress(el, 0); });
}
if (index === 0 && element.element.incompressible) {
return {
element: element.element.elements[index],
children: children,
incompressible: true,
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
return {
element: element.element.elements[index],
children: children,
collapsible: element.collapsible,
collapsed: element.collapsed
};
}
// Exported only for test reasons, do not use directly
function decompress(element) {
return _decompress(element, 0);
}
function splice(treeElement, element, children) {
if (treeElement.element === element) {
return compressedObjectTreeModel_assign(compressedObjectTreeModel_assign({}, treeElement), { children: children });
}
return compressedObjectTreeModel_assign(compressedObjectTreeModel_assign({}, treeElement), { children: common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].from(treeElement.children), function (e) { return splice(e, element, children); }) });
}
// Exported only for test reasons, do not use directly
var compressedObjectTreeModel_CompressedObjectTreeModel = /** @class */ (function () {
function CompressedObjectTreeModel(user, list, options) {
if (options === void 0) { options = {}; }
this.user = user;
this.nodes = new Map();
this.model = new objectTreeModel_ObjectTreeModel(user, list, options);
this.enabled = typeof options.compressionEnabled === 'undefined' ? true : options.compressionEnabled;
}
Object.defineProperty(CompressedObjectTreeModel.prototype, "onDidSplice", {
get: function () { return this.model.onDidSplice; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedObjectTreeModel.prototype, "onDidChangeCollapseState", {
get: function () { return this.model.onDidChangeCollapseState; },
enumerable: true,
configurable: true
});
CompressedObjectTreeModel.prototype.setChildren = function (element, children) {
if (element === null) {
var compressedChildren = common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].from(children), this.enabled ? compress : noCompress);
this._setChildren(null, compressedChildren);
return;
}
var compressedNode = this.nodes.get(element);
if (!compressedNode) {
throw new Error('Unknown compressed tree node');
}
var node = this.model.getNode(compressedNode);
var compressedParentNode = this.model.getParentNodeLocation(compressedNode);
var parent = this.model.getNode(compressedParentNode);
var decompressedElement = decompress(node);
var splicedElement = splice(decompressedElement, element, common_iterator["d" /* Iterator */].from(children));
var recompressedElement = (this.enabled ? compress : noCompress)(splicedElement);
var parentChildren = parent.children
.map(function (child) { return child === node ? recompressedElement : child; });
this._setChildren(parent.element, parentChildren);
};
CompressedObjectTreeModel.prototype.setCompressionEnabled = function (enabled) {
if (enabled === this.enabled) {
return;
}
this.enabled = enabled;
var root = this.model.getNode();
var rootChildren = common_iterator["d" /* Iterator */].from(root.children);
var decompressedRootChildren = common_iterator["d" /* Iterator */].map(rootChildren, decompress);
var recompressedRootChildren = common_iterator["d" /* Iterator */].map(decompressedRootChildren, enabled ? compress : noCompress);
this._setChildren(null, recompressedRootChildren);
};
CompressedObjectTreeModel.prototype._setChildren = function (node, children) {
var _this = this;
var insertedElements = new Set();
var _onDidCreateNode = function (node) {
for (var _i = 0, _a = node.element.elements; _i < _a.length; _i++) {
var element = _a[_i];
insertedElements.add(element);
_this.nodes.set(element, node.element);
}
};
var _onDidDeleteNode = function (node) {
for (var _i = 0, _a = node.element.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!insertedElements.has(element)) {
_this.nodes.delete(element);
}
}
};
this.model.setChildren(node, children, _onDidCreateNode, _onDidDeleteNode);
};
CompressedObjectTreeModel.prototype.has = function (element) {
return this.nodes.has(element);
};
CompressedObjectTreeModel.prototype.getListIndex = function (location) {
var node = this.getCompressedNode(location);
return this.model.getListIndex(node);
};
CompressedObjectTreeModel.prototype.getListRenderCount = function (location) {
var node = this.getCompressedNode(location);
return this.model.getListRenderCount(node);
};
CompressedObjectTreeModel.prototype.getNode = function (location) {
if (typeof location === 'undefined') {
return this.model.getNode();
}
var node = this.getCompressedNode(location);
return this.model.getNode(node);
};
// TODO: review this
CompressedObjectTreeModel.prototype.getNodeLocation = function (node) {
var compressedNode = this.model.getNodeLocation(node);
if (compressedNode === null) {
return null;
}
return compressedNode.elements[compressedNode.elements.length - 1];
};
// TODO: review this
CompressedObjectTreeModel.prototype.getParentNodeLocation = function (location) {
var compressedNode = this.getCompressedNode(location);
var parentNode = this.model.getParentNodeLocation(compressedNode);
if (parentNode === null) {
return null;
}
return parentNode.elements[parentNode.elements.length - 1];
};
CompressedObjectTreeModel.prototype.isCollapsible = function (location) {
var compressedNode = this.getCompressedNode(location);
return this.model.isCollapsible(compressedNode);
};
CompressedObjectTreeModel.prototype.setCollapsible = function (location, collapsible) {
var compressedNode = this.getCompressedNode(location);
return this.model.setCollapsible(compressedNode, collapsible);
};
CompressedObjectTreeModel.prototype.isCollapsed = function (location) {
var compressedNode = this.getCompressedNode(location);
return this.model.isCollapsed(compressedNode);
};
CompressedObjectTreeModel.prototype.setCollapsed = function (location, collapsed, recursive) {
var compressedNode = this.getCompressedNode(location);
return this.model.setCollapsed(compressedNode, collapsed, recursive);
};
CompressedObjectTreeModel.prototype.expandTo = function (location) {
var compressedNode = this.getCompressedNode(location);
this.model.expandTo(compressedNode);
};
CompressedObjectTreeModel.prototype.rerender = function (location) {
var compressedNode = this.getCompressedNode(location);
this.model.rerender(compressedNode);
};
CompressedObjectTreeModel.prototype.refilter = function () {
this.model.refilter();
};
CompressedObjectTreeModel.prototype.getCompressedNode = function (element) {
if (element === null) {
return null;
}
var node = this.nodes.get(element);
if (!node) {
throw new TreeError(this.user, "Tree element not found: " + element);
}
return node;
};
return CompressedObjectTreeModel;
}());
var DefaultElementMapper = function (elements) { return elements[elements.length - 1]; };
var CompressedTreeNodeWrapper = /** @class */ (function () {
function CompressedTreeNodeWrapper(unwrapper, node) {
this.unwrapper = unwrapper;
this.node = node;
}
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "element", {
get: function () { return this.node.element === null ? null : this.unwrapper(this.node.element); },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "children", {
get: function () {
var _this = this;
return this.node.children.map(function (node) { return new CompressedTreeNodeWrapper(_this.unwrapper, node); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "depth", {
get: function () { return this.node.depth; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "visibleChildrenCount", {
get: function () { return this.node.visibleChildrenCount; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "visibleChildIndex", {
get: function () { return this.node.visibleChildIndex; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "collapsible", {
get: function () { return this.node.collapsible; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "collapsed", {
get: function () { return this.node.collapsed; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "visible", {
get: function () { return this.node.visible; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressedTreeNodeWrapper.prototype, "filterData", {
get: function () { return this.node.filterData; },
enumerable: true,
configurable: true
});
return CompressedTreeNodeWrapper;
}());
function mapList(nodeMapper, list) {
return {
splice: function (start, deleteCount, toInsert) {
list.splice(start, deleteCount, toInsert.map(function (node) { return nodeMapper.map(node); }));
}
};
}
function mapOptions(compressedNodeUnwrapper, options) {
return compressedObjectTreeModel_assign(compressedObjectTreeModel_assign({}, options), { sorter: options.sorter && {
compare: function (node, otherNode) {
return options.sorter.compare(node.elements[0], otherNode.elements[0]);
}
}, identityProvider: options.identityProvider && {
getId: function (node) {
return options.identityProvider.getId(compressedNodeUnwrapper(node));
}
}, filter: options.filter && {
filter: function (node, parentVisibility) {
return options.filter.filter(compressedNodeUnwrapper(node), parentVisibility);
}
} });
}
var compressedObjectTreeModel_CompressibleObjectTreeModel = /** @class */ (function () {
function CompressibleObjectTreeModel(user, list, options) {
var _this = this;
if (options === void 0) { options = {}; }
this.elementMapper = options.elementMapper || DefaultElementMapper;
var compressedNodeUnwrapper = function (node) { return _this.elementMapper(node.elements); };
this.nodeMapper = new WeakMapper(function (node) { return new CompressedTreeNodeWrapper(compressedNodeUnwrapper, node); });
this.model = new compressedObjectTreeModel_CompressedObjectTreeModel(user, mapList(this.nodeMapper, list), mapOptions(compressedNodeUnwrapper, options));
}
Object.defineProperty(CompressibleObjectTreeModel.prototype, "onDidSplice", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(this.model.onDidSplice, function (_a) {
var insertedNodes = _a.insertedNodes, deletedNodes = _a.deletedNodes;
return ({
insertedNodes: insertedNodes.map(function (node) { return _this.nodeMapper.map(node); }),
deletedNodes: deletedNodes.map(function (node) { return _this.nodeMapper.map(node); }),
});
});
},
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleObjectTreeModel.prototype, "onDidChangeCollapseState", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(this.model.onDidChangeCollapseState, function (_a) {
var node = _a.node, deep = _a.deep;
return ({
node: _this.nodeMapper.map(node),
deep: deep
});
});
},
enumerable: true,
configurable: true
});
CompressibleObjectTreeModel.prototype.setChildren = function (element, children) {
this.model.setChildren(element, children);
};
CompressibleObjectTreeModel.prototype.setCompressionEnabled = function (enabled) {
this.model.setCompressionEnabled(enabled);
};
CompressibleObjectTreeModel.prototype.has = function (location) {
return this.model.has(location);
};
CompressibleObjectTreeModel.prototype.getListIndex = function (location) {
return this.model.getListIndex(location);
};
CompressibleObjectTreeModel.prototype.getListRenderCount = function (location) {
return this.model.getListRenderCount(location);
};
CompressibleObjectTreeModel.prototype.getNode = function (location) {
return this.nodeMapper.map(this.model.getNode(location));
};
CompressibleObjectTreeModel.prototype.getNodeLocation = function (node) {
return node.element;
};
CompressibleObjectTreeModel.prototype.getParentNodeLocation = function (location) {
return this.model.getParentNodeLocation(location);
};
CompressibleObjectTreeModel.prototype.isCollapsible = function (location) {
return this.model.isCollapsible(location);
};
CompressibleObjectTreeModel.prototype.setCollapsible = function (location, collapsed) {
return this.model.setCollapsible(location, collapsed);
};
CompressibleObjectTreeModel.prototype.isCollapsed = function (location) {
return this.model.isCollapsed(location);
};
CompressibleObjectTreeModel.prototype.setCollapsed = function (location, collapsed, recursive) {
return this.model.setCollapsed(location, collapsed, recursive);
};
CompressibleObjectTreeModel.prototype.expandTo = function (location) {
return this.model.expandTo(location);
};
CompressibleObjectTreeModel.prototype.rerender = function (location) {
return this.model.rerender(location);
};
CompressibleObjectTreeModel.prototype.refilter = function () {
return this.model.refilter();
};
CompressibleObjectTreeModel.prototype.getCompressedTreeNode = function (location) {
if (location === void 0) { location = null; }
return this.model.getNode(location);
};
return CompressibleObjectTreeModel;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/decorators.js
var decorators = __webpack_require__(95);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/objectTree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var objectTree_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var objectTree_assign = (undefined && undefined.__assign) || function () {
objectTree_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return objectTree_assign.apply(this, arguments);
};
var __decorate = (undefined && undefined.__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;
};
var objectTree_ObjectTree = /** @class */ (function (_super) {
objectTree_extends(ObjectTree, _super);
function ObjectTree(user, container, delegate, renderers, options) {
if (options === void 0) { options = {}; }
return _super.call(this, user, container, delegate, renderers, options) || this;
}
Object.defineProperty(ObjectTree.prototype, "onDidChangeCollapseState", {
get: function () { return this.model.onDidChangeCollapseState; },
enumerable: true,
configurable: true
});
ObjectTree.prototype.setChildren = function (element, children) {
this.model.setChildren(element, children);
};
ObjectTree.prototype.rerender = function (element) {
if (element === undefined) {
this.view.rerender();
return;
}
this.model.rerender(element);
};
ObjectTree.prototype.hasElement = function (element) {
return this.model.has(element);
};
ObjectTree.prototype.createModel = function (user, view, options) {
return new objectTreeModel_ObjectTreeModel(user, view, options);
};
return ObjectTree;
}(abstractTree_AbstractTree));
var objectTree_CompressibleRenderer = /** @class */ (function () {
function CompressibleRenderer(_compressedTreeNodeProvider, renderer) {
this._compressedTreeNodeProvider = _compressedTreeNodeProvider;
this.renderer = renderer;
this.templateId = renderer.templateId;
if (renderer.onDidChangeTwistieState) {
this.onDidChangeTwistieState = renderer.onDidChangeTwistieState;
}
}
Object.defineProperty(CompressibleRenderer.prototype, "compressedTreeNodeProvider", {
get: function () {
return this._compressedTreeNodeProvider();
},
enumerable: true,
configurable: true
});
CompressibleRenderer.prototype.renderTemplate = function (container) {
var data = this.renderer.renderTemplate(container);
return { compressedTreeNode: undefined, data: data };
};
CompressibleRenderer.prototype.renderElement = function (node, index, templateData, height) {
var compressedTreeNode = this.compressedTreeNodeProvider.getCompressedTreeNode(node.element);
if (compressedTreeNode.element.elements.length === 1) {
templateData.compressedTreeNode = undefined;
this.renderer.renderElement(node, index, templateData.data, height);
}
else {
templateData.compressedTreeNode = compressedTreeNode;
this.renderer.renderCompressedElements(compressedTreeNode, index, templateData.data, height);
}
};
CompressibleRenderer.prototype.disposeElement = function (node, index, templateData, height) {
if (templateData.compressedTreeNode) {
if (this.renderer.disposeCompressedElements) {
this.renderer.disposeCompressedElements(templateData.compressedTreeNode, index, templateData.data, height);
}
}
else {
if (this.renderer.disposeElement) {
this.renderer.disposeElement(node, index, templateData.data, height);
}
}
};
CompressibleRenderer.prototype.disposeTemplate = function (templateData) {
this.renderer.disposeTemplate(templateData.data);
};
CompressibleRenderer.prototype.renderTwistie = function (element, twistieElement) {
if (this.renderer.renderTwistie) {
this.renderer.renderTwistie(element, twistieElement);
}
};
__decorate([
decorators["a" /* memoize */]
], CompressibleRenderer.prototype, "compressedTreeNodeProvider", null);
return CompressibleRenderer;
}());
function asObjectTreeOptions(compressedTreeNodeProvider, options) {
return options && objectTree_assign(objectTree_assign({}, options), { keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && {
getKeyboardNavigationLabel: function (e) {
var compressedTreeNode;
try {
compressedTreeNode = compressedTreeNodeProvider().getCompressedTreeNode(e);
}
catch (_a) {
return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e);
}
if (compressedTreeNode.element.elements.length === 1) {
return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e);
}
else {
return options.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(compressedTreeNode.element.elements);
}
}
} });
}
var objectTree_CompressibleObjectTree = /** @class */ (function (_super) {
objectTree_extends(CompressibleObjectTree, _super);
function CompressibleObjectTree(user, container, delegate, renderers, options) {
if (options === void 0) { options = {}; }
var _this = this;
var compressedTreeNodeProvider = function () { return _this; };
var compressibleRenderers = renderers.map(function (r) { return new objectTree_CompressibleRenderer(compressedTreeNodeProvider, r); });
_this = _super.call(this, user, container, delegate, compressibleRenderers, asObjectTreeOptions(compressedTreeNodeProvider, options)) || this;
return _this;
}
CompressibleObjectTree.prototype.setChildren = function (element, children) {
this.model.setChildren(element, children);
};
CompressibleObjectTree.prototype.createModel = function (user, view, options) {
return new compressedObjectTreeModel_CompressibleObjectTreeModel(user, view, options);
};
CompressibleObjectTree.prototype.updateOptions = function (optionsUpdate) {
if (optionsUpdate === void 0) { optionsUpdate = {}; }
_super.prototype.updateOptions.call(this, optionsUpdate);
if (typeof optionsUpdate.compressionEnabled !== 'undefined') {
this.model.setCompressionEnabled(optionsUpdate.compressionEnabled);
}
};
CompressibleObjectTree.prototype.getCompressedTreeNode = function (element) {
if (element === void 0) { element = null; }
return this.model.getCompressedTreeNode(element);
};
return CompressibleObjectTree;
}(objectTree_ObjectTree));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/asyncDataTree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var asyncDataTree_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var asyncDataTree_assign = (undefined && undefined.__assign) || function () {
asyncDataTree_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return asyncDataTree_assign.apply(this, arguments);
};
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var asyncDataTree_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function createAsyncDataTreeNode(props) {
return asyncDataTree_assign(asyncDataTree_assign({}, props), { children: [], refreshPromise: undefined, stale: true, slow: false, collapsedByDefault: undefined });
}
function isAncestor(ancestor, descendant) {
if (!descendant.parent) {
return false;
}
else if (descendant.parent === ancestor) {
return true;
}
else {
return isAncestor(ancestor, descendant.parent);
}
}
function intersects(node, other) {
return node === other || isAncestor(node, other) || isAncestor(other, node);
}
var AsyncDataTreeNodeWrapper = /** @class */ (function () {
function AsyncDataTreeNodeWrapper(node) {
this.node = node;
}
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "element", {
get: function () { return this.node.element.element; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "children", {
get: function () { return this.node.children.map(function (node) { return new AsyncDataTreeNodeWrapper(node); }); },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "depth", {
get: function () { return this.node.depth; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "visibleChildrenCount", {
get: function () { return this.node.visibleChildrenCount; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "visibleChildIndex", {
get: function () { return this.node.visibleChildIndex; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "collapsible", {
get: function () { return this.node.collapsible; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "collapsed", {
get: function () { return this.node.collapsed; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "visible", {
get: function () { return this.node.visible; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTreeNodeWrapper.prototype, "filterData", {
get: function () { return this.node.filterData; },
enumerable: true,
configurable: true
});
return AsyncDataTreeNodeWrapper;
}());
var asyncDataTree_AsyncDataTreeRenderer = /** @class */ (function () {
function AsyncDataTreeRenderer(renderer, nodeMapper, onDidChangeTwistieState) {
this.renderer = renderer;
this.nodeMapper = nodeMapper;
this.onDidChangeTwistieState = onDidChangeTwistieState;
this.renderedNodes = new Map();
this.templateId = renderer.templateId;
}
AsyncDataTreeRenderer.prototype.renderTemplate = function (container) {
var templateData = this.renderer.renderTemplate(container);
return { templateData: templateData };
};
AsyncDataTreeRenderer.prototype.renderElement = function (node, index, templateData, height) {
this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height);
};
AsyncDataTreeRenderer.prototype.renderTwistie = function (element, twistieElement) {
Object(dom["Y" /* toggleClass */])(twistieElement, 'codicon-loading', element.slow);
return false;
};
AsyncDataTreeRenderer.prototype.disposeElement = function (node, index, templateData, height) {
if (this.renderer.disposeElement) {
this.renderer.disposeElement(this.nodeMapper.map(node), index, templateData.templateData, height);
}
};
AsyncDataTreeRenderer.prototype.disposeTemplate = function (templateData) {
this.renderer.disposeTemplate(templateData.templateData);
};
AsyncDataTreeRenderer.prototype.dispose = function () {
this.renderedNodes.clear();
};
return AsyncDataTreeRenderer;
}());
function asyncDataTree_asTreeEvent(e) {
return {
browserEvent: e.browserEvent,
elements: e.elements.map(function (e) { return e.element; })
};
}
var AsyncDataTreeElementsDragAndDropData = /** @class */ (function (_super) {
asyncDataTree_extends(AsyncDataTreeElementsDragAndDropData, _super);
function AsyncDataTreeElementsDragAndDropData(data) {
var _this = _super.call(this, data.elements.map(function (node) { return node.element; })) || this;
_this.data = data;
return _this;
}
return AsyncDataTreeElementsDragAndDropData;
}(listView["a" /* ElementsDragAndDropData */]));
function asAsyncDataTreeDragAndDropData(data) {
if (data instanceof listView["a" /* ElementsDragAndDropData */]) {
return new AsyncDataTreeElementsDragAndDropData(data);
}
return data;
}
var AsyncDataTreeNodeListDragAndDrop = /** @class */ (function () {
function AsyncDataTreeNodeListDragAndDrop(dnd) {
this.dnd = dnd;
}
AsyncDataTreeNodeListDragAndDrop.prototype.getDragURI = function (node) {
return this.dnd.getDragURI(node.element);
};
AsyncDataTreeNodeListDragAndDrop.prototype.getDragLabel = function (nodes, originalEvent) {
if (this.dnd.getDragLabel) {
return this.dnd.getDragLabel(nodes.map(function (node) { return node.element; }), originalEvent);
}
return undefined;
};
AsyncDataTreeNodeListDragAndDrop.prototype.onDragStart = function (data, originalEvent) {
if (this.dnd.onDragStart) {
this.dnd.onDragStart(asAsyncDataTreeDragAndDropData(data), originalEvent);
}
};
AsyncDataTreeNodeListDragAndDrop.prototype.onDragOver = function (data, targetNode, targetIndex, originalEvent, raw) {
if (raw === void 0) { raw = true; }
return this.dnd.onDragOver(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, originalEvent);
};
AsyncDataTreeNodeListDragAndDrop.prototype.drop = function (data, targetNode, targetIndex, originalEvent) {
this.dnd.drop(asAsyncDataTreeDragAndDropData(data), targetNode && targetNode.element, targetIndex, originalEvent);
};
AsyncDataTreeNodeListDragAndDrop.prototype.onDragEnd = function (originalEvent) {
if (this.dnd.onDragEnd) {
this.dnd.onDragEnd(originalEvent);
}
};
return AsyncDataTreeNodeListDragAndDrop;
}());
function asyncDataTree_asObjectTreeOptions(options) {
return options && asyncDataTree_assign(asyncDataTree_assign({}, options), { collapseByDefault: true, identityProvider: options.identityProvider && {
getId: function (el) {
return options.identityProvider.getId(el.element);
}
}, dnd: options.dnd && new AsyncDataTreeNodeListDragAndDrop(options.dnd), multipleSelectionController: options.multipleSelectionController && {
isSelectionSingleChangeEvent: function (e) {
return options.multipleSelectionController.isSelectionSingleChangeEvent(asyncDataTree_assign(asyncDataTree_assign({}, e), { element: e.element }));
},
isSelectionRangeChangeEvent: function (e) {
return options.multipleSelectionController.isSelectionRangeChangeEvent(asyncDataTree_assign(asyncDataTree_assign({}, e), { element: e.element }));
}
}, accessibilityProvider: options.accessibilityProvider && asyncDataTree_assign(asyncDataTree_assign({}, options.accessibilityProvider), { getAriaLabel: function (e) {
return options.accessibilityProvider.getAriaLabel(e.element);
}, getAriaLevel: options.accessibilityProvider.getAriaLevel && (function (node) {
return options.accessibilityProvider.getAriaLevel(node.element);
}), getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (function (node) {
return options.accessibilityProvider.getActiveDescendantId(node.element);
}) }), filter: options.filter && {
filter: function (e, parentVisibility) {
return options.filter.filter(e.element, parentVisibility);
}
}, keyboardNavigationLabelProvider: options.keyboardNavigationLabelProvider && asyncDataTree_assign(asyncDataTree_assign({}, options.keyboardNavigationLabelProvider), { getKeyboardNavigationLabel: function (e) {
return options.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element);
} }), sorter: undefined, expandOnlyOnTwistieClick: typeof options.expandOnlyOnTwistieClick === 'undefined' ? undefined : (typeof options.expandOnlyOnTwistieClick !== 'function' ? options.expandOnlyOnTwistieClick : (function (e) { return options.expandOnlyOnTwistieClick(e.element); })), ariaProvider: options.ariaProvider && {
getPosInSet: function (el, index) {
return options.ariaProvider.getPosInSet(el.element, index);
},
getSetSize: function (el, index, listLength) {
return options.ariaProvider.getSetSize(el.element, index, listLength);
},
getRole: options.ariaProvider.getRole ? function (el) {
return options.ariaProvider.getRole(el.element);
} : undefined,
isChecked: options.ariaProvider.isChecked ? function (e) {
var _a;
return ((_a = options.ariaProvider) === null || _a === void 0 ? void 0 : _a.isChecked)(e.element);
} : undefined
}, additionalScrollHeight: options.additionalScrollHeight });
}
function asyncDataTree_dfs(node, fn) {
fn(node);
node.children.forEach(function (child) { return asyncDataTree_dfs(child, fn); });
}
var asyncDataTree_AsyncDataTree = /** @class */ (function () {
function AsyncDataTree(user, container, delegate, renderers, dataSource, options) {
if (options === void 0) { options = {}; }
this.user = user;
this.dataSource = dataSource;
this.nodes = new Map();
this.subTreeRefreshPromises = new Map();
this.refreshPromises = new Map();
this._onDidRender = new common_event["a" /* Emitter */]();
this._onDidChangeNodeSlowState = new common_event["a" /* Emitter */]();
this.nodeMapper = new WeakMapper(function (node) { return new AsyncDataTreeNodeWrapper(node); });
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.identityProvider = options.identityProvider;
this.autoExpandSingleChildren = typeof options.autoExpandSingleChildren === 'undefined' ? false : options.autoExpandSingleChildren;
this.sorter = options.sorter;
this.collapseByDefault = options.collapseByDefault;
this.tree = this.createTree(user, container, delegate, renderers, options);
this.root = createAsyncDataTreeNode({
element: undefined,
parent: null,
hasChildren: true
});
if (this.identityProvider) {
this.root = asyncDataTree_assign(asyncDataTree_assign({}, this.root), { id: null });
}
this.nodes.set(null, this.root);
this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState, this, this.disposables);
}
Object.defineProperty(AsyncDataTree.prototype, "onDidChangeFocus", {
get: function () { return common_event["b" /* Event */].map(this.tree.onDidChangeFocus, asyncDataTree_asTreeEvent); },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTree.prototype, "onDidChangeSelection", {
get: function () { return common_event["b" /* Event */].map(this.tree.onDidChangeSelection, asyncDataTree_asTreeEvent); },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTree.prototype, "onDidOpen", {
get: function () { return common_event["b" /* Event */].map(this.tree.onDidOpen, asyncDataTree_asTreeEvent); },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTree.prototype, "onDidFocus", {
get: function () { return this.tree.onDidFocus; },
enumerable: true,
configurable: true
});
Object.defineProperty(AsyncDataTree.prototype, "onDidDispose", {
get: function () { return this.tree.onDidDispose; },
enumerable: true,
configurable: true
});
AsyncDataTree.prototype.createTree = function (user, container, delegate, renderers, options) {
var _this = this;
var objectTreeDelegate = new ComposedTreeDelegate(delegate);
var objectTreeRenderers = renderers.map(function (r) { return new asyncDataTree_AsyncDataTreeRenderer(r, _this.nodeMapper, _this._onDidChangeNodeSlowState.event); });
var objectTreeOptions = asyncDataTree_asObjectTreeOptions(options) || {};
return new objectTree_ObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
};
AsyncDataTree.prototype.updateOptions = function (options) {
if (options === void 0) { options = {}; }
this.tree.updateOptions(options);
};
// Widget
AsyncDataTree.prototype.getHTMLElement = function () {
return this.tree.getHTMLElement();
};
Object.defineProperty(AsyncDataTree.prototype, "scrollTop", {
get: function () {
return this.tree.scrollTop;
},
set: function (scrollTop) {
this.tree.scrollTop = scrollTop;
},
enumerable: true,
configurable: true
});
AsyncDataTree.prototype.domFocus = function () {
this.tree.domFocus();
};
AsyncDataTree.prototype.layout = function (height, width) {
this.tree.layout(height, width);
};
AsyncDataTree.prototype.style = function (styles) {
this.tree.style(styles);
};
// Model
AsyncDataTree.prototype.getInput = function () {
return this.root.element;
};
AsyncDataTree.prototype.setInput = function (input, viewState) {
return __awaiter(this, void 0, void 0, function () {
var viewStateContext;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.refreshPromises.forEach(function (promise) { return promise.cancel(); });
this.refreshPromises.clear();
this.root.element = input;
viewStateContext = viewState && { viewState: viewState, focus: [], selection: [] };
return [4 /*yield*/, this._updateChildren(input, true, false, viewStateContext)];
case 1:
_a.sent();
if (viewStateContext) {
this.tree.setFocus(viewStateContext.focus);
this.tree.setSelection(viewStateContext.selection);
}
if (viewState && typeof viewState.scrollTop === 'number') {
this.scrollTop = viewState.scrollTop;
}
return [2 /*return*/];
}
});
});
};
AsyncDataTree.prototype._updateChildren = function (element, recursive, rerender, viewStateContext) {
if (element === void 0) { element = this.root.element; }
if (recursive === void 0) { recursive = true; }
if (rerender === void 0) { rerender = false; }
return __awaiter(this, void 0, void 0, function () {
var node;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (typeof this.root.element === 'undefined') {
throw new TreeError(this.user, 'Tree input not set');
}
if (!this.root.refreshPromise) return [3 /*break*/, 3];
return [4 /*yield*/, this.root.refreshPromise];
case 1:
_a.sent();
return [4 /*yield*/, common_event["b" /* Event */].toPromise(this._onDidRender.event)];
case 2:
_a.sent();
_a.label = 3;
case 3:
node = this.getDataNode(element);
return [4 /*yield*/, this.refreshAndRenderNode(node, recursive, viewStateContext)];
case 4:
_a.sent();
if (rerender) {
try {
this.tree.rerender(node);
}
catch (_b) {
// missing nodes are fine, this could've resulted from
// parallel refresh calls, removing `node` altogether
}
}
return [2 /*return*/];
}
});
});
};
// View
AsyncDataTree.prototype.rerender = function (element) {
if (element === undefined || element === this.root.element) {
this.tree.rerender();
return;
}
var node = this.getDataNode(element);
this.tree.rerender(node);
};
AsyncDataTree.prototype.collapse = function (element, recursive) {
if (recursive === void 0) { recursive = false; }
var node = this.getDataNode(element);
return this.tree.collapse(node === this.root ? null : node, recursive);
};
AsyncDataTree.prototype.expand = function (element, recursive) {
if (recursive === void 0) { recursive = false; }
return __awaiter(this, void 0, void 0, function () {
var node, result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (typeof this.root.element === 'undefined') {
throw new TreeError(this.user, 'Tree input not set');
}
if (!this.root.refreshPromise) return [3 /*break*/, 3];
return [4 /*yield*/, this.root.refreshPromise];
case 1:
_a.sent();
return [4 /*yield*/, common_event["b" /* Event */].toPromise(this._onDidRender.event)];
case 2:
_a.sent();
_a.label = 3;
case 3:
node = this.getDataNode(element);
if (this.tree.hasElement(node) && !this.tree.isCollapsible(node)) {
return [2 /*return*/, false];
}
if (!node.refreshPromise) return [3 /*break*/, 6];
return [4 /*yield*/, this.root.refreshPromise];
case 4:
_a.sent();
return [4 /*yield*/, common_event["b" /* Event */].toPromise(this._onDidRender.event)];
case 5:
_a.sent();
_a.label = 6;
case 6:
if (node !== this.root && !node.refreshPromise && !this.tree.isCollapsed(node)) {
return [2 /*return*/, false];
}
result = this.tree.expand(node === this.root ? null : node, recursive);
if (!node.refreshPromise) return [3 /*break*/, 9];
return [4 /*yield*/, this.root.refreshPromise];
case 7:
_a.sent();
return [4 /*yield*/, common_event["b" /* Event */].toPromise(this._onDidRender.event)];
case 8:
_a.sent();
_a.label = 9;
case 9: return [2 /*return*/, result];
}
});
});
};
AsyncDataTree.prototype.setSelection = function (elements, browserEvent) {
var _this = this;
var nodes = elements.map(function (e) { return _this.getDataNode(e); });
this.tree.setSelection(nodes, browserEvent);
};
AsyncDataTree.prototype.getSelection = function () {
var nodes = this.tree.getSelection();
return nodes.map(function (n) { return n.element; });
};
AsyncDataTree.prototype.setFocus = function (elements, browserEvent) {
var _this = this;
var nodes = elements.map(function (e) { return _this.getDataNode(e); });
this.tree.setFocus(nodes, browserEvent);
};
AsyncDataTree.prototype.getFocus = function () {
var nodes = this.tree.getFocus();
return nodes.map(function (n) { return n.element; });
};
AsyncDataTree.prototype.reveal = function (element, relativeTop) {
this.tree.reveal(this.getDataNode(element), relativeTop);
};
// Implementation
AsyncDataTree.prototype.getDataNode = function (element) {
var 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;
};
AsyncDataTree.prototype.refreshAndRenderNode = function (node, recursive, viewStateContext) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.refreshNode(node, recursive, viewStateContext)];
case 1:
_a.sent();
this.render(node, viewStateContext);
return [2 /*return*/];
}
});
});
};
AsyncDataTree.prototype.refreshNode = function (node, recursive, viewStateContext) {
return __awaiter(this, void 0, void 0, function () {
var result;
var _this = this;
return __generator(this, function (_a) {
this.subTreeRefreshPromises.forEach(function (refreshPromise, refreshNode) {
if (!result && intersects(refreshNode, node)) {
result = refreshPromise.then(function () { return _this.refreshNode(node, recursive, viewStateContext); });
}
});
if (result) {
return [2 /*return*/, result];
}
return [2 /*return*/, this.doRefreshSubTree(node, recursive, viewStateContext)];
});
});
};
AsyncDataTree.prototype.doRefreshSubTree = function (node, recursive, viewStateContext) {
return __awaiter(this, void 0, void 0, function () {
var done, childrenToRefresh;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
node.refreshPromise = new Promise(function (c) { return done = c; });
this.subTreeRefreshPromises.set(node, node.refreshPromise);
node.refreshPromise.finally(function () {
node.refreshPromise = undefined;
_this.subTreeRefreshPromises.delete(node);
});
_a.label = 1;
case 1:
_a.trys.push([1, , 4, 5]);
return [4 /*yield*/, this.doRefreshNode(node, recursive, viewStateContext)];
case 2:
childrenToRefresh = _a.sent();
node.stale = false;
return [4 /*yield*/, Promise.all(childrenToRefresh.map(function (child) { return _this.doRefreshSubTree(child, recursive, viewStateContext); }))];
case 3:
_a.sent();
return [3 /*break*/, 5];
case 4:
done();
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}
});
});
};
AsyncDataTree.prototype.doRefreshNode = function (node, recursive, viewStateContext) {
return __awaiter(this, void 0, void 0, function () {
var childrenPromise, slowTimeout_1, children, err_1;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
node.hasChildren = !!this.dataSource.hasChildren(node.element);
if (!node.hasChildren) {
childrenPromise = Promise.resolve([]);
}
else {
slowTimeout_1 = Object(common_async["l" /* timeout */])(800);
slowTimeout_1.then(function () {
node.slow = true;
_this._onDidChangeNodeSlowState.fire(node);
}, function (_) { return null; });
childrenPromise = this.doGetChildren(node)
.finally(function () { return slowTimeout_1.cancel(); });
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, 4, 5]);
return [4 /*yield*/, childrenPromise];
case 2:
children = _a.sent();
return [2 /*return*/, this.setChildren(node, children, recursive, viewStateContext)];
case 3:
err_1 = _a.sent();
if (node !== this.root) {
this.tree.collapse(node === this.root ? null : node);
}
if (Object(errors["d" /* isPromiseCanceledError */])(err_1)) {
return [2 /*return*/, []];
}
throw err_1;
case 4:
if (node.slow) {
node.slow = false;
this._onDidChangeNodeSlowState.fire(node);
}
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}
});
});
};
AsyncDataTree.prototype.doGetChildren = function (node) {
var _this = this;
var result = this.refreshPromises.get(node);
if (result) {
return result;
}
result = Object(common_async["f" /* createCancelablePromise */])(function () { return __awaiter(_this, void 0, void 0, function () {
var children;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.dataSource.getChildren(node.element)];
case 1:
children = _a.sent();
return [2 /*return*/, this.processChildren(children)];
}
});
}); });
this.refreshPromises.set(node, result);
return result.finally(function () { return _this.refreshPromises.delete(node); });
};
AsyncDataTree.prototype._onDidChangeCollapseState = function (_a) {
var node = _a.node, deep = _a.deep;
if (!node.collapsed && node.element.stale) {
if (deep) {
this.collapse(node.element.element);
}
else {
this.refreshAndRenderNode(node.element, false)
.catch(errors["e" /* onUnexpectedError */]);
}
}
};
AsyncDataTree.prototype.setChildren = function (node, childrenElements, recursive, viewStateContext) {
var _a;
var _this = this;
// perf: if the node was and still is a leaf, avoid all this hassle
if (node.children.length === 0 && childrenElements.length === 0) {
return [];
}
var nodesToForget = new Map();
var childrenTreeNodesById = new Map();
for (var _i = 0, _b = node.children; _i < _b.length; _i++) {
var child = _b[_i];
nodesToForget.set(child.element, child);
if (this.identityProvider) {
var collapsed = this.tree.isCollapsed(child);
childrenTreeNodesById.set(child.id, { node: child, collapsed: collapsed });
}
}
var childrenToRefresh = [];
var children = childrenElements.map(function (element) {
var hasChildren = !!_this.dataSource.hasChildren(element);
if (!_this.identityProvider) {
var asyncDataTreeNode = createAsyncDataTreeNode({ element: element, parent: node, hasChildren: hasChildren });
if (hasChildren && _this.collapseByDefault && !_this.collapseByDefault(element)) {
asyncDataTreeNode.collapsedByDefault = false;
childrenToRefresh.push(asyncDataTreeNode);
}
return asyncDataTreeNode;
}
var id = _this.identityProvider.getId(element).toString();
var result = childrenTreeNodesById.get(id);
if (result) {
var 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(function (node) { return asyncDataTree_dfs(node, function (node) { return _this.nodes.delete(node.element); }); });
asyncDataTreeNode.children.splice(0, asyncDataTreeNode.children.length);
asyncDataTreeNode.stale = true;
}
else {
childrenToRefresh.push(asyncDataTreeNode);
}
}
else if (hasChildren && _this.collapseByDefault && !_this.collapseByDefault(element)) {
asyncDataTreeNode.collapsedByDefault = false;
childrenToRefresh.push(asyncDataTreeNode);
}
return asyncDataTreeNode;
}
var childAsyncDataTreeNode = createAsyncDataTreeNode({ element: element, parent: node, id: id, hasChildren: hasChildren });
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 && _this.collapseByDefault && !_this.collapseByDefault(element)) {
childAsyncDataTreeNode.collapsedByDefault = false;
childrenToRefresh.push(childAsyncDataTreeNode);
}
return childAsyncDataTreeNode;
});
for (var _c = 0, _d = Object(map["e" /* values */])(nodesToForget); _c < _d.length; _c++) {
var node_1 = _d[_c];
asyncDataTree_dfs(node_1, function (node) { return _this.nodes.delete(node.element); });
}
for (var _e = 0, children_1 = children; _e < children_1.length; _e++) {
var child = children_1[_e];
this.nodes.set(child.element, child);
}
(_a = node.children).splice.apply(_a, asyncDataTree_spreadArrays([0, node.children.length], children));
// TODO@joao this doesn't take filter into account
if (node !== this.root && this.autoExpandSingleChildren && children.length === 1 && childrenToRefresh.length === 0) {
children[0].collapsedByDefault = false;
childrenToRefresh.push(children[0]);
}
return childrenToRefresh;
};
AsyncDataTree.prototype.render = function (node, viewStateContext) {
var _this = this;
var children = node.children.map(function (node) { return _this.asTreeElement(node, viewStateContext); });
this.tree.setChildren(node === this.root ? null : node, children);
if (node !== this.root) {
this.tree.setCollapsible(node, node.hasChildren);
}
this._onDidRender.fire();
};
AsyncDataTree.prototype.asTreeElement = function (node, viewStateContext) {
var _this = this;
if (node.stale) {
return {
element: node,
collapsible: node.hasChildren,
collapsed: true
};
}
var collapsed;
if (viewStateContext && viewStateContext.viewState.expanded && node.id && viewStateContext.viewState.expanded.indexOf(node.id) > -1) {
collapsed = false;
}
else {
collapsed = node.collapsedByDefault;
}
node.collapsedByDefault = undefined;
return {
element: node,
children: node.hasChildren ? common_iterator["d" /* Iterator */].map(common_iterator["d" /* Iterator */].fromArray(node.children), function (child) { return _this.asTreeElement(child, viewStateContext); }) : [],
collapsible: node.hasChildren,
collapsed: collapsed
};
};
AsyncDataTree.prototype.processChildren = function (children) {
if (this.sorter) {
children.sort(this.sorter.compare.bind(this.sorter));
}
return children;
};
AsyncDataTree.prototype.dispose = function () {
this.disposables.dispose();
};
return AsyncDataTree;
}());
var CompressibleAsyncDataTreeNodeWrapper = /** @class */ (function () {
function CompressibleAsyncDataTreeNodeWrapper(node) {
this.node = node;
}
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "element", {
get: function () {
return {
elements: this.node.element.elements.map(function (e) { return e.element; }),
incompressible: this.node.element.incompressible
};
},
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "children", {
get: function () { return this.node.children.map(function (node) { return new CompressibleAsyncDataTreeNodeWrapper(node); }); },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "depth", {
get: function () { return this.node.depth; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "visibleChildrenCount", {
get: function () { return this.node.visibleChildrenCount; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "visibleChildIndex", {
get: function () { return this.node.visibleChildIndex; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "collapsible", {
get: function () { return this.node.collapsible; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "collapsed", {
get: function () { return this.node.collapsed; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "visible", {
get: function () { return this.node.visible; },
enumerable: true,
configurable: true
});
Object.defineProperty(CompressibleAsyncDataTreeNodeWrapper.prototype, "filterData", {
get: function () { return this.node.filterData; },
enumerable: true,
configurable: true
});
return CompressibleAsyncDataTreeNodeWrapper;
}());
var asyncDataTree_CompressibleAsyncDataTreeRenderer = /** @class */ (function () {
function CompressibleAsyncDataTreeRenderer(renderer, nodeMapper, compressibleNodeMapperProvider, onDidChangeTwistieState) {
this.renderer = renderer;
this.nodeMapper = nodeMapper;
this.compressibleNodeMapperProvider = compressibleNodeMapperProvider;
this.onDidChangeTwistieState = onDidChangeTwistieState;
this.renderedNodes = new Map();
this.disposables = [];
this.templateId = renderer.templateId;
}
CompressibleAsyncDataTreeRenderer.prototype.renderTemplate = function (container) {
var templateData = this.renderer.renderTemplate(container);
return { templateData: templateData };
};
CompressibleAsyncDataTreeRenderer.prototype.renderElement = function (node, index, templateData, height) {
this.renderer.renderElement(this.nodeMapper.map(node), index, templateData.templateData, height);
};
CompressibleAsyncDataTreeRenderer.prototype.renderCompressedElements = function (node, index, templateData, height) {
this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height);
};
CompressibleAsyncDataTreeRenderer.prototype.renderTwistie = function (element, twistieElement) {
Object(dom["Y" /* toggleClass */])(twistieElement, 'codicon-loading', element.slow);
return false;
};
CompressibleAsyncDataTreeRenderer.prototype.disposeElement = function (node, index, templateData, height) {
if (this.renderer.disposeElement) {
this.renderer.disposeElement(this.nodeMapper.map(node), index, templateData.templateData, height);
}
};
CompressibleAsyncDataTreeRenderer.prototype.disposeCompressedElements = function (node, index, templateData, height) {
if (this.renderer.disposeCompressedElements) {
this.renderer.disposeCompressedElements(this.compressibleNodeMapperProvider().map(node), index, templateData.templateData, height);
}
};
CompressibleAsyncDataTreeRenderer.prototype.disposeTemplate = function (templateData) {
this.renderer.disposeTemplate(templateData.templateData);
};
CompressibleAsyncDataTreeRenderer.prototype.dispose = function () {
this.renderedNodes.clear();
this.disposables = Object(lifecycle["f" /* dispose */])(this.disposables);
};
return CompressibleAsyncDataTreeRenderer;
}());
function asCompressibleObjectTreeOptions(options) {
var objectTreeOptions = options && asyncDataTree_asObjectTreeOptions(options);
return objectTreeOptions && asyncDataTree_assign(asyncDataTree_assign({}, objectTreeOptions), { keyboardNavigationLabelProvider: objectTreeOptions.keyboardNavigationLabelProvider && asyncDataTree_assign(asyncDataTree_assign({}, objectTreeOptions.keyboardNavigationLabelProvider), { getCompressedNodeKeyboardNavigationLabel: function (els) {
return options.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(els.map(function (e) { return e.element; }));
} }) });
}
var asyncDataTree_CompressibleAsyncDataTree = /** @class */ (function (_super) {
asyncDataTree_extends(CompressibleAsyncDataTree, _super);
function CompressibleAsyncDataTree(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this, user, container, virtualDelegate, renderers, dataSource, options) || this;
_this.compressionDelegate = compressionDelegate;
_this.compressibleNodeMapper = new WeakMapper(function (node) { return new CompressibleAsyncDataTreeNodeWrapper(node); });
_this.filter = options.filter;
return _this;
}
CompressibleAsyncDataTree.prototype.createTree = function (user, container, delegate, renderers, options) {
var _this = this;
var objectTreeDelegate = new ComposedTreeDelegate(delegate);
var objectTreeRenderers = renderers.map(function (r) { return new asyncDataTree_CompressibleAsyncDataTreeRenderer(r, _this.nodeMapper, function () { return _this.compressibleNodeMapper; }, _this._onDidChangeNodeSlowState.event); });
var objectTreeOptions = asCompressibleObjectTreeOptions(options) || {};
return new objectTree_CompressibleObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions);
};
CompressibleAsyncDataTree.prototype.asTreeElement = function (node, viewStateContext) {
return asyncDataTree_assign({ incompressible: this.compressionDelegate.isIncompressible(node.element) }, _super.prototype.asTreeElement.call(this, node, viewStateContext));
};
CompressibleAsyncDataTree.prototype.updateOptions = function (options) {
if (options === void 0) { options = {}; }
this.tree.updateOptions(options);
};
CompressibleAsyncDataTree.prototype.render = function (node, viewStateContext) {
var _this = this;
if (!this.identityProvider) {
return _super.prototype.render.call(this, node, viewStateContext);
}
// Preserve traits across compressions. Hacky but does the trick.
// This is hard to fix properly since it requires rewriting the traits
// across trees and lists. Let's just keep it this way for now.
var getId = function (element) { return _this.identityProvider.getId(element).toString(); };
var getUncompressedIds = function (nodes) {
var result = new Set();
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node_2 = nodes_1[_i];
var compressedNode = _this.tree.getCompressedTreeNode(node_2 === _this.root ? null : node_2);
if (!compressedNode.element) {
continue;
}
for (var _a = 0, _b = compressedNode.element.elements; _a < _b.length; _a++) {
var node_3 = _b[_a];
result.add(getId(node_3.element));
}
}
return result;
};
var oldSelection = getUncompressedIds(this.tree.getSelection());
var oldFocus = getUncompressedIds(this.tree.getFocus());
_super.prototype.render.call(this, node, viewStateContext);
var selection = this.getSelection();
var didChangeSelection = false;
var focus = this.getFocus();
var didChangeFocus = false;
var visit = function (node) {
var compressedNode = node.element;
if (compressedNode) {
for (var i = 0; i < compressedNode.elements.length; i++) {
var id = getId(compressedNode.elements[i].element);
var element = compressedNode.elements[compressedNode.elements.length - 1].element;
// github.com/microsoft/vscode/issues/85938
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;
}
}
}
node.children.forEach(visit);
};
visit(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
CompressibleAsyncDataTree.prototype.processChildren = function (children) {
var _this = this;
if (this.filter) {
children = children.filter(function (e) {
var result = _this.filter.filter(e, 1 /* Visible */);
var visibility = getVisibility(result);
if (visibility === 2 /* Recurse */) {
throw new Error('Recursive tree visibility not supported in async data compressed trees');
}
return visibility === 1 /* Visible */;
});
}
return _super.prototype.processChildren.call(this, children);
};
return CompressibleAsyncDataTree;
}(asyncDataTree_AsyncDataTree));
function getVisibility(filterResult) {
if (typeof filterResult === 'boolean') {
return filterResult ? 1 /* Visible */ : 0 /* Hidden */;
}
else if (isFilterResult(filterResult)) {
return getVisibleState(filterResult.visibility);
}
else {
return getVisibleState(filterResult);
}
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/tree/dataTree.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var dataTree_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var dataTree_DataTree = /** @class */ (function (_super) {
dataTree_extends(DataTree, _super);
function DataTree(user, container, delegate, renderers, dataSource, options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this, user, container, delegate, renderers, options) || this;
_this.user = user;
_this.dataSource = dataSource;
_this.identityProvider = options.identityProvider;
return _this;
}
DataTree.prototype.createModel = function (user, view, options) {
return new objectTreeModel_ObjectTreeModel(user, view, options);
};
return DataTree;
}(abstractTree_AbstractTree));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js
var accessibility = __webpack_require__(72);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/platform/list/browser/listService.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var listService_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var listService_assign = (undefined && undefined.__assign) || function () {
listService_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return listService_assign.apply(this, arguments);
};
var listService_decorate = (undefined && undefined.__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;
};
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var listService_a;
var IListService = Object(instantiation["c" /* createDecorator */])('listService');
var listService_ListService = /** @class */ (function () {
function ListService(_themeService) {
this._themeService = _themeService;
this.disposables = new lifecycle["b" /* DisposableStore */]();
this.lists = [];
this._lastFocusedWidget = undefined;
this._hasCreatedStyleController = false;
}
Object.defineProperty(ListService.prototype, "lastFocusedList", {
get: function () {
return this._lastFocusedWidget;
},
enumerable: true,
configurable: true
});
ListService.prototype.register = function (widget, extraContextKeys) {
var _this = this;
if (!this._hasCreatedStyleController) {
this._hasCreatedStyleController = true;
// create a shared default tree style sheet for performance reasons
var styleController = new listWidget["b" /* DefaultStyleController */](Object(dom["w" /* createStyleSheet */])(), '');
this.disposables.add(Object(styler["b" /* attachListStyler */])(styleController, this._themeService));
}
if (this.lists.some(function (l) { return l.widget === widget; })) {
throw new Error('Cannot register the same widget multiple times');
}
// Keep in our lists list
var registeredList = { widget: widget, extraContextKeys: extraContextKeys };
this.lists.push(registeredList);
// Check for currently being focused
if (widget.getHTMLElement() === document.activeElement) {
this._lastFocusedWidget = widget;
}
return Object(lifecycle["e" /* combinedDisposable */])(widget.onDidFocus(function () { return _this._lastFocusedWidget = widget; }), Object(lifecycle["h" /* toDisposable */])(function () { return _this.lists.splice(_this.lists.indexOf(registeredList), 1); }), widget.onDidDispose(function () {
_this.lists = _this.lists.filter(function (l) { return l !== registeredList; });
if (_this._lastFocusedWidget === widget) {
_this._lastFocusedWidget = undefined;
}
}));
};
ListService.prototype.dispose = function () {
this.disposables.dispose();
};
ListService = listService_decorate([
__param(0, themeService["c" /* IThemeService */])
], ListService);
return ListService;
}());
var RawWorkbenchListFocusContextKey = new contextkey["d" /* RawContextKey */]('listFocus', true);
var WorkbenchListSupportsMultiSelectContextKey = new contextkey["d" /* RawContextKey */]('listSupportsMultiselect', true);
var WorkbenchListFocusContextKey = contextkey["a" /* ContextKeyExpr */].and(RawWorkbenchListFocusContextKey, contextkey["a" /* ContextKeyExpr */].not(InputFocusedContextKey));
var WorkbenchListHasSelectionOrFocus = new contextkey["d" /* RawContextKey */]('listHasSelectionOrFocus', false);
var WorkbenchListDoubleSelection = new contextkey["d" /* RawContextKey */]('listDoubleSelection', false);
var WorkbenchListMultiSelection = new contextkey["d" /* RawContextKey */]('listMultiSelection', false);
var WorkbenchListSupportsKeyboardNavigation = new contextkey["d" /* RawContextKey */]('listSupportsKeyboardNavigation', true);
var WorkbenchListAutomaticKeyboardNavigationKey = 'listAutomaticKeyboardNavigation';
var WorkbenchListAutomaticKeyboardNavigation = new contextkey["d" /* RawContextKey */](WorkbenchListAutomaticKeyboardNavigationKey, true);
var didBindWorkbenchListAutomaticKeyboardNavigation = false;
function createScopedContextKeyService(contextKeyService, widget) {
var result = contextKeyService.createScoped(widget.getHTMLElement());
RawWorkbenchListFocusContextKey.bindTo(result);
return result;
}
var multiSelectModifierSettingKey = 'workbench.list.multiSelectModifier';
var openModeSettingKey = 'workbench.list.openMode';
var horizontalScrollingKey = 'workbench.list.horizontalScrolling';
var keyboardNavigationSettingKey = 'workbench.list.keyboardNavigation';
var automaticKeyboardNavigationSettingKey = 'workbench.list.automaticKeyboardNavigation';
var treeIndentKey = 'workbench.tree.indent';
var treeRenderIndentGuidesKey = 'workbench.tree.renderIndentGuides';
function getHorizontalScrollingSetting(configurationService) {
return Object(configuration["f" /* getMigratedSettingValue */])(configurationService, horizontalScrollingKey, 'workbench.tree.horizontalScrolling');
}
function useAltAsMultipleSelectionModifier(configurationService) {
return configurationService.getValue(multiSelectModifierSettingKey) === 'alt';
}
function useSingleClickToOpen(configurationService) {
return configurationService.getValue(openModeSettingKey) !== 'doubleClick';
}
var listService_MultipleSelectionController = /** @class */ (function (_super) {
listService_extends(MultipleSelectionController, _super);
function MultipleSelectionController(configurationService) {
var _this = _super.call(this) || this;
_this.configurationService = configurationService;
_this.useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
_this.registerListeners();
return _this;
}
MultipleSelectionController.prototype.registerListeners = function () {
var _this = this;
this._register(this.configurationService.onDidChangeConfiguration(function (e) {
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
_this.useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(_this.configurationService);
}
}));
};
MultipleSelectionController.prototype.isSelectionSingleChangeEvent = function (event) {
if (this.useAltAsMultipleSelectionModifier) {
return event.browserEvent.altKey;
}
return Object(listWidget["f" /* isSelectionSingleChangeEvent */])(event);
};
MultipleSelectionController.prototype.isSelectionRangeChangeEvent = function (event) {
return Object(listWidget["e" /* isSelectionRangeChangeEvent */])(event);
};
return MultipleSelectionController;
}(lifecycle["a" /* Disposable */]));
var WorkbenchOpenController = /** @class */ (function (_super) {
listService_extends(WorkbenchOpenController, _super);
function WorkbenchOpenController(configurationService, existingOpenController) {
var _this = _super.call(this) || this;
_this.configurationService = configurationService;
_this.existingOpenController = existingOpenController;
_this.openOnSingleClick = useSingleClickToOpen(configurationService);
_this.registerListeners();
return _this;
}
WorkbenchOpenController.prototype.registerListeners = function () {
var _this = this;
this._register(this.configurationService.onDidChangeConfiguration(function (e) {
if (e.affectsConfiguration(openModeSettingKey)) {
_this.openOnSingleClick = useSingleClickToOpen(_this.configurationService);
}
}));
};
WorkbenchOpenController.prototype.shouldOpen = function (event) {
if (event instanceof MouseEvent) {
var isLeftButton = event.button === 0;
var isDoubleClick = event.detail === 2;
if (isLeftButton && !this.openOnSingleClick && !isDoubleClick) {
return false;
}
if (isLeftButton /* left mouse button */ || event.button === 1 /* middle mouse button */) {
return this.existingOpenController ? this.existingOpenController.shouldOpen(event) : true;
}
return false;
}
return this.existingOpenController ? this.existingOpenController.shouldOpen(event) : true;
};
return WorkbenchOpenController;
}(lifecycle["a" /* Disposable */]));
function toWorkbenchListOptions(options, configurationService, keybindingService) {
var disposables = new lifecycle["b" /* DisposableStore */]();
var result = listService_assign({}, options);
if (options.multipleSelectionSupport !== false && !options.multipleSelectionController) {
var multipleSelectionController = new listService_MultipleSelectionController(configurationService);
result.multipleSelectionController = multipleSelectionController;
disposables.add(multipleSelectionController);
}
var openController = new WorkbenchOpenController(configurationService, options.openController);
result.openController = openController;
disposables.add(openController);
result.keyboardNavigationDelegate = {
mightProducePrintableCharacter: function (e) {
return keybindingService.mightProducePrintableCharacter(e);
}
};
return [result, disposables];
}
function createKeyboardNavigationEventFilter(container, keybindingService) {
var inChord = false;
return function (event) {
if (inChord) {
inChord = false;
return false;
}
var result = keybindingService.softDispatch(event, container);
if (result && result.enterChord) {
inChord = true;
return false;
}
inChord = false;
return true;
};
}
var listService_WorkbenchObjectTree = /** @class */ (function (_super) {
listService_extends(WorkbenchObjectTree, _super);
function WorkbenchObjectTree(user, container, delegate, renderers, options, contextKeyService, listService, themeService, configurationService, keybindingService, accessibilityService) {
var _this = this;
var _a = workbenchTreeDataPreamble(container, options, contextKeyService, configurationService, keybindingService, accessibilityService), treeOptions = _a.options, getAutomaticKeyboardNavigation = _a.getAutomaticKeyboardNavigation, disposable = _a.disposable;
_this = _super.call(this, user, container, delegate, renderers, treeOptions) || this;
_this.disposables.add(disposable);
_this.internals = new listService_WorkbenchTreeInternals(_this, treeOptions, getAutomaticKeyboardNavigation, options.overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService);
_this.disposables.add(_this.internals);
return _this;
}
WorkbenchObjectTree = listService_decorate([
__param(5, contextkey["c" /* IContextKeyService */]),
__param(6, IListService),
__param(7, themeService["c" /* IThemeService */]),
__param(8, configuration["a" /* IConfigurationService */]),
__param(9, keybinding["a" /* IKeybindingService */]),
__param(10, accessibility["b" /* IAccessibilityService */])
], WorkbenchObjectTree);
return WorkbenchObjectTree;
}(objectTree_ObjectTree));
var listService_WorkbenchDataTree = /** @class */ (function (_super) {
listService_extends(WorkbenchDataTree, _super);
function WorkbenchDataTree(user, container, delegate, renderers, dataSource, options, contextKeyService, listService, themeService, configurationService, keybindingService, accessibilityService) {
var _this = this;
var _a = workbenchTreeDataPreamble(container, options, contextKeyService, configurationService, keybindingService, accessibilityService), treeOptions = _a.options, getAutomaticKeyboardNavigation = _a.getAutomaticKeyboardNavigation, disposable = _a.disposable;
_this = _super.call(this, user, container, delegate, renderers, dataSource, treeOptions) || this;
_this.disposables.add(disposable);
_this.internals = new listService_WorkbenchTreeInternals(_this, treeOptions, getAutomaticKeyboardNavigation, options.overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService);
_this.disposables.add(_this.internals);
return _this;
}
WorkbenchDataTree.prototype.updateOptions = function (options) {
if (options === void 0) { options = {}; }
_super.prototype.updateOptions.call(this, options);
if (options.overrideStyles) {
this.internals.updateStyleOverrides(options.overrideStyles);
}
};
WorkbenchDataTree = listService_decorate([
__param(6, contextkey["c" /* IContextKeyService */]),
__param(7, IListService),
__param(8, themeService["c" /* IThemeService */]),
__param(9, configuration["a" /* IConfigurationService */]),
__param(10, keybinding["a" /* IKeybindingService */]),
__param(11, accessibility["b" /* IAccessibilityService */])
], WorkbenchDataTree);
return WorkbenchDataTree;
}(dataTree_DataTree));
var listService_WorkbenchAsyncDataTree = /** @class */ (function (_super) {
listService_extends(WorkbenchAsyncDataTree, _super);
function WorkbenchAsyncDataTree(user, container, delegate, renderers, dataSource, options, contextKeyService, listService, themeService, configurationService, keybindingService, accessibilityService) {
var _this = this;
var _a = workbenchTreeDataPreamble(container, options, contextKeyService, configurationService, keybindingService, accessibilityService), treeOptions = _a.options, getAutomaticKeyboardNavigation = _a.getAutomaticKeyboardNavigation, disposable = _a.disposable;
_this = _super.call(this, user, container, delegate, renderers, dataSource, treeOptions) || this;
_this.disposables.add(disposable);
_this.internals = new listService_WorkbenchTreeInternals(_this, treeOptions, getAutomaticKeyboardNavigation, options.overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService);
_this.disposables.add(_this.internals);
return _this;
}
WorkbenchAsyncDataTree.prototype.updateOptions = function (options) {
if (options === void 0) { options = {}; }
_super.prototype.updateOptions.call(this, options);
if (options.overrideStyles) {
this.internals.updateStyleOverrides(options.overrideStyles);
}
};
WorkbenchAsyncDataTree = listService_decorate([
__param(6, contextkey["c" /* IContextKeyService */]),
__param(7, IListService),
__param(8, themeService["c" /* IThemeService */]),
__param(9, configuration["a" /* IConfigurationService */]),
__param(10, keybinding["a" /* IKeybindingService */]),
__param(11, accessibility["b" /* IAccessibilityService */])
], WorkbenchAsyncDataTree);
return WorkbenchAsyncDataTree;
}(asyncDataTree_AsyncDataTree));
var listService_WorkbenchCompressibleAsyncDataTree = /** @class */ (function (_super) {
listService_extends(WorkbenchCompressibleAsyncDataTree, _super);
function WorkbenchCompressibleAsyncDataTree(user, container, virtualDelegate, compressionDelegate, renderers, dataSource, options, contextKeyService, listService, themeService, configurationService, keybindingService, accessibilityService) {
var _this = this;
var _a = workbenchTreeDataPreamble(container, options, contextKeyService, configurationService, keybindingService, accessibilityService), treeOptions = _a.options, getAutomaticKeyboardNavigation = _a.getAutomaticKeyboardNavigation, disposable = _a.disposable;
_this = _super.call(this, user, container, virtualDelegate, compressionDelegate, renderers, dataSource, treeOptions) || this;
_this.disposables.add(disposable);
_this.internals = new listService_WorkbenchTreeInternals(_this, treeOptions, getAutomaticKeyboardNavigation, options.overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService);
_this.disposables.add(_this.internals);
return _this;
}
WorkbenchCompressibleAsyncDataTree = listService_decorate([
__param(7, contextkey["c" /* IContextKeyService */]),
__param(8, IListService),
__param(9, themeService["c" /* IThemeService */]),
__param(10, configuration["a" /* IConfigurationService */]),
__param(11, keybinding["a" /* IKeybindingService */]),
__param(12, accessibility["b" /* IAccessibilityService */])
], WorkbenchCompressibleAsyncDataTree);
return WorkbenchCompressibleAsyncDataTree;
}(asyncDataTree_CompressibleAsyncDataTree));
function workbenchTreeDataPreamble(container, options, contextKeyService, configurationService, keybindingService, accessibilityService) {
WorkbenchListSupportsKeyboardNavigation.bindTo(contextKeyService);
if (!didBindWorkbenchListAutomaticKeyboardNavigation) {
WorkbenchListAutomaticKeyboardNavigation.bindTo(contextKeyService);
didBindWorkbenchListAutomaticKeyboardNavigation = true;
}
var getAutomaticKeyboardNavigation = function () {
// give priority to the context key value to disable this completely
var automaticKeyboardNavigation = contextKeyService.getContextKeyValue(WorkbenchListAutomaticKeyboardNavigationKey);
if (automaticKeyboardNavigation) {
automaticKeyboardNavigation = configurationService.getValue(automaticKeyboardNavigationSettingKey);
}
return automaticKeyboardNavigation;
};
var accessibilityOn = accessibilityService.isScreenReaderOptimized();
var keyboardNavigation = accessibilityOn ? 'simple' : configurationService.getValue(keyboardNavigationSettingKey);
var horizontalScrolling = typeof options.horizontalScrolling !== 'undefined' ? options.horizontalScrolling : getHorizontalScrollingSetting(configurationService);
var openOnSingleClick = useSingleClickToOpen(configurationService);
var _a = toWorkbenchListOptions(options, configurationService, keybindingService), workbenchListOptions = _a[0], disposable = _a[1];
var additionalScrollHeight = options.additionalScrollHeight;
return {
getAutomaticKeyboardNavigation: getAutomaticKeyboardNavigation,
disposable: disposable,
options: listService_assign(listService_assign({
// ...options, // TODO@Joao why is this not splatted here?
keyboardSupport: false }, workbenchListOptions), { indent: configurationService.getValue(treeIndentKey), renderIndentGuides: configurationService.getValue(treeRenderIndentGuidesKey), automaticKeyboardNavigation: getAutomaticKeyboardNavigation(), simpleKeyboardNavigation: keyboardNavigation === 'simple', filterOnType: keyboardNavigation === 'filter', horizontalScrolling: horizontalScrolling,
openOnSingleClick: openOnSingleClick, keyboardNavigationEventFilter: createKeyboardNavigationEventFilter(container, keybindingService), additionalScrollHeight: additionalScrollHeight, hideTwistiesOfChildlessElements: options.hideTwistiesOfChildlessElements })
};
}
var listService_WorkbenchTreeInternals = /** @class */ (function () {
function WorkbenchTreeInternals(tree, options, getAutomaticKeyboardNavigation, overrideStyles, contextKeyService, listService, themeService, configurationService, accessibilityService) {
var _this = this;
this.tree = tree;
this.themeService = themeService;
this.disposables = [];
this.contextKeyService = createScopedContextKeyService(contextKeyService, tree);
var listSupportsMultiSelect = WorkbenchListSupportsMultiSelectContextKey.bindTo(this.contextKeyService);
listSupportsMultiSelect.set(!(options.multipleSelectionSupport === false));
this.hasSelectionOrFocus = WorkbenchListHasSelectionOrFocus.bindTo(this.contextKeyService);
this.hasDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
this.hasMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
var interestingContextKeys = new Set();
interestingContextKeys.add(WorkbenchListAutomaticKeyboardNavigationKey);
var updateKeyboardNavigation = function () {
var accessibilityOn = accessibilityService.isScreenReaderOptimized();
var keyboardNavigation = accessibilityOn ? 'simple' : configurationService.getValue(keyboardNavigationSettingKey);
tree.updateOptions({
simpleKeyboardNavigation: keyboardNavigation === 'simple',
filterOnType: keyboardNavigation === 'filter'
});
};
this.updateStyleOverrides(overrideStyles);
this.disposables.push(this.contextKeyService, listService.register(tree), tree.onDidChangeSelection(function () {
var selection = tree.getSelection();
var focus = tree.getFocus();
_this.hasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
_this.hasMultiSelection.set(selection.length > 1);
_this.hasDoubleSelection.set(selection.length === 2);
}), tree.onDidChangeFocus(function () {
var selection = tree.getSelection();
var focus = tree.getFocus();
_this.hasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
}), configurationService.onDidChangeConfiguration(function (e) {
if (e.affectsConfiguration(openModeSettingKey)) {
tree.updateOptions({ openOnSingleClick: useSingleClickToOpen(configurationService) });
}
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
_this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
}
if (e.affectsConfiguration(treeIndentKey)) {
var indent = configurationService.getValue(treeIndentKey);
tree.updateOptions({ indent: indent });
}
if (e.affectsConfiguration(treeRenderIndentGuidesKey)) {
var renderIndentGuides = configurationService.getValue(treeRenderIndentGuidesKey);
tree.updateOptions({ renderIndentGuides: renderIndentGuides });
}
if (e.affectsConfiguration(keyboardNavigationSettingKey)) {
updateKeyboardNavigation();
}
if (e.affectsConfiguration(automaticKeyboardNavigationSettingKey)) {
tree.updateOptions({ automaticKeyboardNavigation: getAutomaticKeyboardNavigation() });
}
}), this.contextKeyService.onDidChangeContext(function (e) {
if (e.affectsSome(interestingContextKeys)) {
tree.updateOptions({ automaticKeyboardNavigation: getAutomaticKeyboardNavigation() });
}
}), accessibilityService.onDidChangeScreenReaderOptimized(function () { return updateKeyboardNavigation(); }));
}
WorkbenchTreeInternals.prototype.updateStyleOverrides = function (overrideStyles) {
Object(lifecycle["f" /* dispose */])(this.styler);
this.styler = overrideStyles ? Object(styler["b" /* attachListStyler */])(this.tree, this.themeService, overrideStyles) : lifecycle["a" /* Disposable */].None;
};
WorkbenchTreeInternals.prototype.dispose = function () {
this.disposables = Object(lifecycle["f" /* dispose */])(this.disposables);
this.styler = Object(lifecycle["f" /* dispose */])(this.styler);
};
WorkbenchTreeInternals = listService_decorate([
__param(4, contextkey["c" /* IContextKeyService */]),
__param(5, IListService),
__param(6, themeService["c" /* IThemeService */]),
__param(7, configuration["a" /* IConfigurationService */]),
__param(8, accessibility["b" /* IAccessibilityService */])
], WorkbenchTreeInternals);
return WorkbenchTreeInternals;
}());
var listService_configurationRegistry = platform["a" /* Registry */].as(configurationRegistry["a" /* Extensions */].Configuration);
listService_configurationRegistry.registerConfiguration({
'id': 'workbench',
'order': 7,
'title': Object(nls["a" /* localize */])('workbenchConfigurationTitle', "Workbench"),
'type': 'object',
'properties': (listService_a = {},
listService_a[multiSelectModifierSettingKey] = {
'type': 'string',
'enum': ['ctrlCmd', 'alt'],
'enumDescriptions': [
Object(nls["a" /* localize */])('multiSelectModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
Object(nls["a" /* localize */])('multiSelectModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
],
'default': 'ctrlCmd',
'description': Object(nls["a" /* 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.")
},
listService_a[openModeSettingKey] = {
'type': 'string',
'enum': ['singleClick', 'doubleClick'],
'default': 'singleClick',
'description': Object(nls["a" /* 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). For parents with children in trees, this setting will control if a single click expands the parent or a double click. Note that some trees and lists might choose to ignore this setting if it is not applicable. ")
},
listService_a[horizontalScrollingKey] = {
'type': 'boolean',
'default': false,
'description': Object(nls["a" /* localize */])('horizontalScrolling setting', "Controls whether lists and trees support horizontal scrolling in the workbench.")
},
listService_a['workbench.tree.horizontalScrolling'] = {
'type': 'boolean',
'default': false,
'description': Object(nls["a" /* localize */])('tree horizontalScrolling setting', "Controls whether trees support horizontal scrolling in the workbench."),
'deprecationMessage': Object(nls["a" /* localize */])('deprecated', "This setting is deprecated, please use '{0}' instead.", horizontalScrollingKey)
},
listService_a[treeIndentKey] = {
'type': 'number',
'default': 8,
minimum: 0,
maximum: 40,
'description': Object(nls["a" /* localize */])('tree indent setting', "Controls tree indentation in pixels.")
},
listService_a[treeRenderIndentGuidesKey] = {
type: 'string',
enum: ['none', 'onHover', 'always'],
default: 'onHover',
description: Object(nls["a" /* localize */])('render tree indent guides', "Controls whether the tree should render indent guides.")
},
listService_a[keyboardNavigationSettingKey] = {
'type': 'string',
'enum': ['simple', 'highlight', 'filter'],
'enumDescriptions': [
Object(nls["a" /* localize */])('keyboardNavigationSettingKey.simple', "Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),
Object(nls["a" /* localize */])('keyboardNavigationSettingKey.highlight', "Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),
Object(nls["a" /* localize */])('keyboardNavigationSettingKey.filter', "Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")
],
'default': 'highlight',
'description': Object(nls["a" /* localize */])('keyboardNavigationSettingKey', "Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter.")
},
listService_a[automaticKeyboardNavigationSettingKey] = {
'type': 'boolean',
'default': true,
markdownDescription: Object(nls["a" /* localize */])('automatic keyboard navigation setting', "Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to `false`, keyboard navigation is only triggered when executing the `list.toggleKeyboardNavigation` command, for which you can assign a keyboard shortcut.")
},
listService_a)
});
/***/ }),
/* 146 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export cachedStringRepeat */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ShiftCommand; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony import */ var _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
/* harmony import */ var _core_range_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
/* harmony import */ var _core_selection_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24);
/* harmony import */ var _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var repeatCache = Object.create(null);
function cachedStringRepeat(str, count) {
if (!repeatCache[str]) {
repeatCache[str] = ['', str];
}
var cache = repeatCache[str];
for (var i = cache.length; i <= count; i++) {
cache[i] = cache[i - 1] + str;
}
return cache[count];
}
var ShiftCommand = /** @class */ (function () {
function ShiftCommand(range, opts) {
this._opts = opts;
this._selection = range;
this._selectionId = null;
this._useLastEditRangeForCursorEndPosition = false;
this._selectionStartColumnStaysPut = false;
}
ShiftCommand.unshiftIndent = function (line, column, tabSize, indentSize, insertSpaces) {
// Determine the visible column where the content starts
var contentStartVisibleColumn = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].visibleColumnFromColumn(line, column, tabSize);
if (insertSpaces) {
var indent = cachedStringRepeat(' ', indentSize);
var desiredTabStop = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].prevIndentTabStop(contentStartVisibleColumn, indentSize);
var indentCount = desiredTabStop / indentSize; // will be an integer
return cachedStringRepeat(indent, indentCount);
}
else {
var indent = '\t';
var desiredTabStop = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].prevRenderTabStop(contentStartVisibleColumn, tabSize);
var indentCount = desiredTabStop / tabSize; // will be an integer
return cachedStringRepeat(indent, indentCount);
}
};
ShiftCommand.shiftIndent = function (line, column, tabSize, indentSize, insertSpaces) {
// Determine the visible column where the content starts
var contentStartVisibleColumn = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].visibleColumnFromColumn(line, column, tabSize);
if (insertSpaces) {
var indent = cachedStringRepeat(' ', indentSize);
var desiredTabStop = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].nextIndentTabStop(contentStartVisibleColumn, indentSize);
var indentCount = desiredTabStop / indentSize; // will be an integer
return cachedStringRepeat(indent, indentCount);
}
else {
var indent = '\t';
var desiredTabStop = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].nextRenderTabStop(contentStartVisibleColumn, tabSize);
var indentCount = desiredTabStop / tabSize; // will be an integer
return cachedStringRepeat(indent, indentCount);
}
};
ShiftCommand.prototype._addEditOperation = function (builder, range, text) {
if (this._useLastEditRangeForCursorEndPosition) {
builder.addTrackedEditOperation(range, text);
}
else {
builder.addEditOperation(range, text);
}
};
ShiftCommand.prototype.getEditOperations = function (model, builder) {
var startLine = this._selection.startLineNumber;
var endLine = this._selection.endLineNumber;
if (this._selection.endColumn === 1 && startLine !== endLine) {
endLine = endLine - 1;
}
var _a = this._opts, tabSize = _a.tabSize, indentSize = _a.indentSize, insertSpaces = _a.insertSpaces;
var shouldIndentEmptyLines = (startLine === endLine);
// if indenting or outdenting on a whitespace only line
if (this._selection.isEmpty()) {
if (/^\s*$/.test(model.getLineContent(startLine))) {
this._useLastEditRangeForCursorEndPosition = true;
}
}
if (this._opts.useTabStops) {
// keep track of previous line's "miss-alignment"
var previousLineExtraSpaces = 0, extraSpaces = 0;
for (var lineNumber = startLine; lineNumber <= endLine; lineNumber++, previousLineExtraSpaces = extraSpaces) {
extraSpaces = 0;
var lineText = model.getLineContent(lineNumber);
var indentationEndIndex = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* firstNonWhitespaceIndex */ "q"](lineText);
if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {
// empty line or line with no leading whitespace => nothing to do
continue;
}
if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {
// do not indent empty lines => nothing to do
continue;
}
if (indentationEndIndex === -1) {
// the entire line is whitespace
indentationEndIndex = lineText.length;
}
if (lineNumber > 1) {
var contentStartVisibleColumn = _controller_cursorCommon_js__WEBPACK_IMPORTED_MODULE_1__[/* CursorColumns */ "a"].visibleColumnFromColumn(lineText, indentationEndIndex + 1, tabSize);
if (contentStartVisibleColumn % indentSize !== 0) {
// The current line is "miss-aligned", so let's see if this is expected...
// This can only happen when it has trailing commas in the indent
if (model.isCheapToTokenize(lineNumber - 1)) {
var enterAction = _modes_languageConfigurationRegistry_js__WEBPACK_IMPORTED_MODULE_4__[/* LanguageConfigurationRegistry */ "a"].getEnterAction(this._opts.autoIndent, model, new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](lineNumber - 1, model.getLineMaxColumn(lineNumber - 1), lineNumber - 1, model.getLineMaxColumn(lineNumber - 1)));
if (enterAction) {
extraSpaces = previousLineExtraSpaces;
if (enterAction.appendText) {
for (var j = 0, lenJ = enterAction.appendText.length; j < lenJ && extraSpaces < indentSize; j++) {
if (enterAction.appendText.charCodeAt(j) === 32 /* Space */) {
extraSpaces++;
}
else {
break;
}
}
}
if (enterAction.removeText) {
extraSpaces = Math.max(0, extraSpaces - enterAction.removeText);
}
// Act as if `prefixSpaces` is not part of the indentation
for (var j = 0; j < extraSpaces; j++) {
if (indentationEndIndex === 0 || lineText.charCodeAt(indentationEndIndex - 1) !== 32 /* Space */) {
break;
}
indentationEndIndex--;
}
}
}
}
}
if (this._opts.isUnshift && indentationEndIndex === 0) {
// line with no leading whitespace => nothing to do
continue;
}
var desiredIndent = void 0;
if (this._opts.isUnshift) {
desiredIndent = ShiftCommand.unshiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);
}
else {
desiredIndent = ShiftCommand.shiftIndent(lineText, indentationEndIndex + 1, tabSize, indentSize, insertSpaces);
}
this._addEditOperation(builder, new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](lineNumber, 1, lineNumber, indentationEndIndex + 1), desiredIndent);
if (lineNumber === startLine && !this._selection.isEmpty()) {
// Force the startColumn to stay put because we're inserting after it
this._selectionStartColumnStaysPut = (this._selection.startColumn <= indentationEndIndex + 1);
}
}
}
else {
var oneIndent = (insertSpaces ? cachedStringRepeat(' ', indentSize) : '\t');
for (var lineNumber = startLine; lineNumber <= endLine; lineNumber++) {
var lineText = model.getLineContent(lineNumber);
var indentationEndIndex = _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* firstNonWhitespaceIndex */ "q"](lineText);
if (this._opts.isUnshift && (lineText.length === 0 || indentationEndIndex === 0)) {
// empty line or line with no leading whitespace => nothing to do
continue;
}
if (!shouldIndentEmptyLines && !this._opts.isUnshift && lineText.length === 0) {
// do not indent empty lines => nothing to do
continue;
}
if (indentationEndIndex === -1) {
// the entire line is whitespace
indentationEndIndex = lineText.length;
}
if (this._opts.isUnshift && indentationEndIndex === 0) {
// line with no leading whitespace => nothing to do
continue;
}
if (this._opts.isUnshift) {
indentationEndIndex = Math.min(indentationEndIndex, indentSize);
for (var i = 0; i < indentationEndIndex; i++) {
var chr = lineText.charCodeAt(i);
if (chr === 9 /* Tab */) {
indentationEndIndex = i + 1;
break;
}
}
this._addEditOperation(builder, new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](lineNumber, 1, lineNumber, indentationEndIndex + 1), '');
}
else {
this._addEditOperation(builder, new _core_range_js__WEBPACK_IMPORTED_MODULE_2__[/* Range */ "a"](lineNumber, 1, lineNumber, 1), oneIndent);
if (lineNumber === startLine && !this._selection.isEmpty()) {
// Force the startColumn to stay put because we're inserting after it
this._selectionStartColumnStaysPut = (this._selection.startColumn === 1);
}
}
}
}
this._selectionId = builder.trackSelection(this._selection);
};
ShiftCommand.prototype.computeCursorState = function (model, helper) {
if (this._useLastEditRangeForCursorEndPosition) {
var lastOp = helper.getInverseEditOperations()[0];
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_3__[/* Selection */ "a"](lastOp.range.endLineNumber, lastOp.range.endColumn, lastOp.range.endLineNumber, lastOp.range.endColumn);
}
var result = helper.getTrackedSelection(this._selectionId);
if (this._selectionStartColumnStaysPut) {
// The selection start should not move
var initialStartColumn = this._selection.startColumn;
var resultStartColumn = result.startColumn;
if (resultStartColumn <= initialStartColumn) {
return result;
}
if (result.getDirection() === 0 /* LTR */) {
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_3__[/* Selection */ "a"](result.startLineNumber, initialStartColumn, result.endLineNumber, result.endColumn);
}
return new _core_selection_js__WEBPACK_IMPORTED_MODULE_3__[/* Selection */ "a"](result.endLineNumber, result.endColumn, result.startLineNumber, initialStartColumn);
}
return result;
};
return ShiftCommand;
}());
/***/ }),
/* 147 */
/***/ (function(module, exports, __webpack_require__) {
var roundingPrecisionFrom = __webpack_require__(289).roundingPrecisionFrom;
var override = __webpack_require__(170);
var OptimizationLevel = {
Zero: '0',
One: '1',
Two: '2'
};
var DEFAULTS = {};
DEFAULTS[OptimizationLevel.Zero] = {};
DEFAULTS[OptimizationLevel.One] = {
cleanupCharsets: true,
normalizeUrls: true,
optimizeBackground: true,
optimizeBorderRadius: true,
optimizeFilter: true,
optimizeFontWeight: true,
optimizeOutline: true,
removeEmpty: true,
removeNegativePaddings: true,
removeQuotes: true,
removeWhitespace: true,
replaceMultipleZeros: true,
replaceTimeUnits: true,
replaceZeroUnits: true,
roundingPrecision: roundingPrecisionFrom(undefined),
selectorsSortingMethod: 'standard',
specialComments: 'all',
tidyAtRules: true,
tidyBlockScopes: true,
tidySelectors: true,
transform: noop
};
DEFAULTS[OptimizationLevel.Two] = {
mergeAdjacentRules: true,
mergeIntoShorthands: true,
mergeMedia: true,
mergeNonAdjacentRules: true,
mergeSemantically: false,
overrideProperties: true,
removeEmpty: true,
reduceNonAdjacentRules: true,
removeDuplicateFontRules: true,
removeDuplicateMediaBlocks: true,
removeDuplicateRules: true,
removeUnusedAtRules: false,
restructureRules: false,
skipProperties: []
};
var ALL_KEYWORD_1 = '*';
var ALL_KEYWORD_2 = 'all';
var FALSE_KEYWORD_1 = 'false';
var FALSE_KEYWORD_2 = 'off';
var TRUE_KEYWORD_1 = 'true';
var TRUE_KEYWORD_2 = 'on';
var LIST_VALUE_SEPARATOR = ',';
var OPTION_SEPARATOR = ';';
var OPTION_VALUE_SEPARATOR = ':';
function noop() {}
function optimizationLevelFrom(source) {
var level = override(DEFAULTS, {});
var Zero = OptimizationLevel.Zero;
var One = OptimizationLevel.One;
var Two = OptimizationLevel.Two;
if (undefined === source) {
delete level[Two];
return level;
}
if (typeof source == 'string') {
source = parseInt(source);
}
if (typeof source == 'number' && source === parseInt(Two)) {
return level;
}
if (typeof source == 'number' && source === parseInt(One)) {
delete level[Two];
return level;
}
if (typeof source == 'number' && source === parseInt(Zero)) {
delete level[Two];
delete level[One];
return level;
}
if (typeof source == 'object') {
source = covertValuesToHashes(source);
}
if (One in source && 'roundingPrecision' in source[One]) {
source[One].roundingPrecision = roundingPrecisionFrom(source[One].roundingPrecision);
}
if (Two in source && 'skipProperties' in source[Two] && typeof(source[Two].skipProperties) == 'string') {
source[Two].skipProperties = source[Two].skipProperties.split(LIST_VALUE_SEPARATOR);
}
if (Zero in source || One in source || Two in source) {
level[Zero] = override(level[Zero], source[Zero]);
}
if (One in source && ALL_KEYWORD_1 in source[One]) {
level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_1])));
delete source[One][ALL_KEYWORD_1];
}
if (One in source && ALL_KEYWORD_2 in source[One]) {
level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_2])));
delete source[One][ALL_KEYWORD_2];
}
if (One in source || Two in source) {
level[One] = override(level[One], source[One]);
} else {
delete level[One];
}
if (Two in source && ALL_KEYWORD_1 in source[Two]) {
level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_1])));
delete source[Two][ALL_KEYWORD_1];
}
if (Two in source && ALL_KEYWORD_2 in source[Two]) {
level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_2])));
delete source[Two][ALL_KEYWORD_2];
}
if (Two in source) {
level[Two] = override(level[Two], source[Two]);
} else {
delete level[Two];
}
return level;
}
function defaults(level, value) {
var options = override(DEFAULTS[level], {});
var key;
for (key in options) {
if (typeof options[key] == 'boolean') {
options[key] = value;
}
}
return options;
}
function normalizeValue(value) {
switch (value) {
case FALSE_KEYWORD_1:
case FALSE_KEYWORD_2:
return false;
case TRUE_KEYWORD_1:
case TRUE_KEYWORD_2:
return true;
default:
return value;
}
}
function covertValuesToHashes(source) {
var clonedSource = override(source, {});
var level;
var i;
for (i = 0; i <= 2; i++) {
level = '' + i;
if (level in clonedSource && (clonedSource[level] === undefined || clonedSource[level] === false)) {
delete clonedSource[level];
}
if (level in clonedSource && clonedSource[level] === true) {
clonedSource[level] = {};
}
if (level in clonedSource && typeof clonedSource[level] == 'string') {
clonedSource[level] = covertToHash(clonedSource[level], level);
}
}
return clonedSource;
}
function covertToHash(asString, level) {
return asString
.split(OPTION_SEPARATOR)
.reduce(function (accumulator, directive) {
var parts = directive.split(OPTION_VALUE_SEPARATOR);
var name = parts[0];
var value = parts[1];
var normalizedValue = normalizeValue(value);
if (ALL_KEYWORD_1 == name || ALL_KEYWORD_2 == name) {
accumulator = override(accumulator, defaults(level, normalizedValue));
} else {
accumulator[name] = normalizedValue;
}
return accumulator;
}, {});
}
module.exports = {
OptimizationLevel: OptimizationLevel,
optimizationLevelFrom: optimizationLevelFrom,
};
/***/ }),
/* 148 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 149 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createStringBuilder; });
/* harmony import */ var _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var createStringBuilder;
if (typeof TextDecoder !== 'undefined') {
createStringBuilder = function (capacity) { return new StringBuilder(capacity); };
}
else {
createStringBuilder = function (capacity) { return new CompatStringBuilder(); };
}
var StringBuilder = /** @class */ (function () {
function StringBuilder(capacity) {
this._decoder = new TextDecoder('UTF-16LE');
this._capacity = capacity | 0;
this._buffer = new Uint16Array(this._capacity);
this._completedStrings = null;
this._bufferLength = 0;
}
StringBuilder.prototype.reset = function () {
this._completedStrings = null;
this._bufferLength = 0;
};
StringBuilder.prototype.build = function () {
if (this._completedStrings !== null) {
this._flushBuffer();
return this._completedStrings.join('');
}
return this._buildBuffer();
};
StringBuilder.prototype._buildBuffer = function () {
if (this._bufferLength === 0) {
return '';
}
var view = new Uint16Array(this._buffer.buffer, 0, this._bufferLength);
return this._decoder.decode(view);
};
StringBuilder.prototype._flushBuffer = function () {
var bufferString = this._buildBuffer();
this._bufferLength = 0;
if (this._completedStrings === null) {
this._completedStrings = [bufferString];
}
else {
this._completedStrings[this._completedStrings.length] = bufferString;
}
};
StringBuilder.prototype.write1 = function (charCode) {
var remainingSpace = this._capacity - this._bufferLength;
if (remainingSpace <= 1) {
if (remainingSpace === 0 || _base_common_strings_js__WEBPACK_IMPORTED_MODULE_0__[/* isHighSurrogate */ "z"](charCode)) {
this._flushBuffer();
}
}
this._buffer[this._bufferLength++] = charCode;
};
StringBuilder.prototype.appendASCII = function (charCode) {
if (this._bufferLength === this._capacity) {
// buffer is full
this._flushBuffer();
}
this._buffer[this._bufferLength++] = charCode;
};
StringBuilder.prototype.appendASCIIString = function (str) {
var strLen = str.length;
if (this._bufferLength + strLen >= this._capacity) {
// This string does not fit in the remaining buffer space
this._flushBuffer();
this._completedStrings[this._completedStrings.length] = str;
return;
}
for (var i = 0; i < strLen; i++) {
this._buffer[this._bufferLength++] = str.charCodeAt(i);
}
};
return StringBuilder;
}());
var CompatStringBuilder = /** @class */ (function () {
function CompatStringBuilder() {
this._pieces = [];
this._piecesLen = 0;
}
CompatStringBuilder.prototype.reset = function () {
this._pieces = [];
this._piecesLen = 0;
};
CompatStringBuilder.prototype.build = function () {
return this._pieces.join('');
};
CompatStringBuilder.prototype.write1 = function (charCode) {
this._pieces[this._piecesLen++] = String.fromCharCode(charCode);
};
CompatStringBuilder.prototype.appendASCII = function (charCode) {
this._pieces[this._piecesLen++] = String.fromCharCode(charCode);
};
CompatStringBuilder.prototype.appendASCIIString = function (str) {
this._pieces[this._piecesLen++] = str;
};
return CompatStringBuilder;
}());
/***/ }),
/* 150 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Sash; });
/* harmony import */ var _sash_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(640);
/* harmony import */ var _sash_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_sash_css__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
/* harmony import */ var _browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25);
/* harmony import */ var _common_platform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17);
/* harmony import */ var _common_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21);
/* harmony import */ var _touch_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(54);
/* harmony import */ var _mouseEvent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(46);
/* harmony import */ var _common_event_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9);
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2);
/* harmony import */ var _event_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(34);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var DEBUG = false;
var Sash = /** @class */ (function (_super) {
__extends(Sash, _super);
function Sash(container, layoutProvider, options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this._state = 3 /* Enabled */;
_this._onDidEnablementChange = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_7__[/* Emitter */ "a"]());
_this.onDidEnablementChange = _this._onDidEnablementChange.event;
_this._onDidStart = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_7__[/* Emitter */ "a"]());
_this.onDidStart = _this._onDidStart.event;
_this._onDidChange = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_7__[/* Emitter */ "a"]());
_this.onDidChange = _this._onDidChange.event;
_this._onDidReset = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_7__[/* Emitter */ "a"]());
_this.onDidReset = _this._onDidReset.event;
_this._onDidEnd = _this._register(new _common_event_js__WEBPACK_IMPORTED_MODULE_7__[/* Emitter */ "a"]());
_this.onDidEnd = _this._onDidEnd.event;
_this.linkedSash = undefined;
_this.orthogonalStartSashDisposables = _this._register(new _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* DisposableStore */ "b"]());
_this.orthogonalEndSashDisposables = _this._register(new _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* DisposableStore */ "b"]());
_this.el = Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* append */ "q"])(container, Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* $ */ "a"])('.monaco-sash'));
if (_common_platform_js__WEBPACK_IMPORTED_MODULE_3__[/* isMacintosh */ "e"]) {
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addClass */ "f"])(_this.el, 'mac');
}
_this._register(Object(_event_js__WEBPACK_IMPORTED_MODULE_9__[/* domEvent */ "a"])(_this.el, 'mousedown')(_this.onMouseDown, _this));
_this._register(Object(_event_js__WEBPACK_IMPORTED_MODULE_9__[/* domEvent */ "a"])(_this.el, 'dblclick')(_this.onMouseDoubleClick, _this));
_this._register(_touch_js__WEBPACK_IMPORTED_MODULE_5__[/* Gesture */ "b"].addTarget(_this.el));
_this._register(Object(_event_js__WEBPACK_IMPORTED_MODULE_9__[/* domEvent */ "a"])(_this.el, _touch_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "a"].Start)(_this.onTouchStart, _this));
if (_browser_js__WEBPACK_IMPORTED_MODULE_2__[/* isIPad */ "j"]) {
// see also https://ux.stackexchange.com/questions/39023/what-is-the-optimum-button-size-of-touch-screen-applications
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addClass */ "f"])(_this.el, 'touch');
}
_this.setOrientation(options.orientation || 0 /* VERTICAL */);
_this.hidden = false;
_this.layoutProvider = layoutProvider;
_this.orthogonalStartSash = options.orthogonalStartSash;
_this.orthogonalEndSash = options.orthogonalEndSash;
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(_this.el, 'debug', DEBUG);
return _this;
}
Object.defineProperty(Sash.prototype, "state", {
get: function () { return this._state; },
set: function (state) {
if (this._state === state) {
return;
}
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(this.el, 'disabled', state === 0 /* Disabled */);
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(this.el, 'minimum', state === 1 /* Minimum */);
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(this.el, 'maximum', state === 2 /* Maximum */);
this._state = state;
this._onDidEnablementChange.fire(state);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Sash.prototype, "orthogonalStartSash", {
get: function () { return this._orthogonalStartSash; },
set: function (sash) {
this.orthogonalStartSashDisposables.clear();
if (sash) {
this.orthogonalStartSashDisposables.add(sash.onDidEnablementChange(this.onOrthogonalStartSashEnablementChange, this));
this.onOrthogonalStartSashEnablementChange(sash.state);
}
else {
this.onOrthogonalStartSashEnablementChange(0 /* Disabled */);
}
this._orthogonalStartSash = sash;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Sash.prototype, "orthogonalEndSash", {
get: function () { return this._orthogonalEndSash; },
set: function (sash) {
this.orthogonalEndSashDisposables.clear();
if (sash) {
this.orthogonalEndSashDisposables.add(sash.onDidEnablementChange(this.onOrthogonalEndSashEnablementChange, this));
this.onOrthogonalEndSashEnablementChange(sash.state);
}
else {
this.onOrthogonalEndSashEnablementChange(0 /* Disabled */);
}
this._orthogonalEndSash = sash;
},
enumerable: true,
configurable: true
});
Sash.prototype.setOrientation = function (orientation) {
this.orientation = orientation;
if (this.orientation === 1 /* HORIZONTAL */) {
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addClass */ "f"])(this.el, 'horizontal');
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* removeClass */ "P"])(this.el, 'vertical');
}
else {
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* removeClass */ "P"])(this.el, 'horizontal');
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addClass */ "f"])(this.el, 'vertical');
}
if (this.layoutProvider) {
this.layout();
}
};
Sash.prototype.onMouseDown = function (e) {
var _this = this;
_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* EventHelper */ "c"].stop(e, false);
var isMultisashResize = false;
if (!e.__orthogonalSashEvent) {
var orthogonalSash = this.getOrthogonalSash(e);
if (orthogonalSash) {
isMultisashResize = true;
e.__orthogonalSashEvent = true;
orthogonalSash.onMouseDown(e);
}
}
if (this.linkedSash && !e.__linkedSashEvent) {
e.__linkedSashEvent = true;
this.linkedSash.onMouseDown(e);
}
if (!this.state) {
return;
}
// Select both iframes and webviews; internally Electron nests an iframe
// in its component, but this isn't queryable.
var iframes = __spreadArrays(Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* getElementsByTagName */ "D"])('iframe'), Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* getElementsByTagName */ "D"])('webview'));
for (var _i = 0, iframes_1 = iframes; _i < iframes_1.length; _i++) {
var iframe = iframes_1[_i];
iframe.style.pointerEvents = 'none'; // disable mouse events on iframes as long as we drag the sash
}
var mouseDownEvent = new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_6__[/* StandardMouseEvent */ "b"](e);
var startX = mouseDownEvent.posx;
var startY = mouseDownEvent.posy;
var altKey = mouseDownEvent.altKey;
var startEvent = { startX: startX, currentX: startX, startY: startY, currentY: startY, altKey: altKey };
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addClass */ "f"])(this.el, 'active');
this._onDidStart.fire(startEvent);
// fix https://github.com/Microsoft/vscode/issues/21675
var style = Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* createStyleSheet */ "w"])(this.el);
var updateStyle = function () {
var cursor = '';
if (isMultisashResize) {
cursor = 'all-scroll';
}
else if (_this.orientation === 1 /* HORIZONTAL */) {
if (_this.state === 1 /* Minimum */) {
cursor = 's-resize';
}
else if (_this.state === 2 /* Maximum */) {
cursor = 'n-resize';
}
else {
cursor = _common_platform_js__WEBPACK_IMPORTED_MODULE_3__[/* isMacintosh */ "e"] ? 'row-resize' : 'ns-resize';
}
}
else {
if (_this.state === 1 /* Minimum */) {
cursor = 'e-resize';
}
else if (_this.state === 2 /* Maximum */) {
cursor = 'w-resize';
}
else {
cursor = _common_platform_js__WEBPACK_IMPORTED_MODULE_3__[/* isMacintosh */ "e"] ? 'col-resize' : 'ew-resize';
}
}
style.innerHTML = "* { cursor: " + cursor + " !important; }";
};
var disposables = new _common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* DisposableStore */ "b"]();
updateStyle();
if (!isMultisashResize) {
this.onDidEnablementChange(updateStyle, null, disposables);
}
var onMouseMove = function (e) {
_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* EventHelper */ "c"].stop(e, false);
var mouseMoveEvent = new _mouseEvent_js__WEBPACK_IMPORTED_MODULE_6__[/* StandardMouseEvent */ "b"](e);
var event = { startX: startX, currentX: mouseMoveEvent.posx, startY: startY, currentY: mouseMoveEvent.posy, altKey: altKey };
_this._onDidChange.fire(event);
};
var onMouseUp = function (e) {
_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* EventHelper */ "c"].stop(e, false);
_this.el.removeChild(style);
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* removeClass */ "P"])(_this.el, 'active');
_this._onDidEnd.fire();
disposables.dispose();
for (var _i = 0, iframes_2 = iframes; _i < iframes_2.length; _i++) {
var iframe = iframes_2[_i];
iframe.style.pointerEvents = 'auto';
}
};
Object(_event_js__WEBPACK_IMPORTED_MODULE_9__[/* domEvent */ "a"])(window, 'mousemove')(onMouseMove, null, disposables);
Object(_event_js__WEBPACK_IMPORTED_MODULE_9__[/* domEvent */ "a"])(window, 'mouseup')(onMouseUp, null, disposables);
};
Sash.prototype.onMouseDoubleClick = function (e) {
var orthogonalSash = this.getOrthogonalSash(e);
if (orthogonalSash) {
orthogonalSash._onDidReset.fire();
}
if (this.linkedSash) {
this.linkedSash._onDidReset.fire();
}
this._onDidReset.fire();
};
Sash.prototype.onTouchStart = function (event) {
var _this = this;
_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* EventHelper */ "c"].stop(event);
var listeners = [];
var startX = event.pageX;
var startY = event.pageY;
var altKey = event.altKey;
this._onDidStart.fire({
startX: startX,
currentX: startX,
startY: startY,
currentY: startY,
altKey: altKey
});
listeners.push(Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addDisposableListener */ "j"])(this.el, _touch_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "a"].Change, function (event) {
if (_common_types_js__WEBPACK_IMPORTED_MODULE_4__[/* isNumber */ "h"](event.pageX) && _common_types_js__WEBPACK_IMPORTED_MODULE_4__[/* isNumber */ "h"](event.pageY)) {
_this._onDidChange.fire({
startX: startX,
currentX: event.pageX,
startY: startY,
currentY: event.pageY,
altKey: altKey
});
}
}));
listeners.push(Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* addDisposableListener */ "j"])(this.el, _touch_js__WEBPACK_IMPORTED_MODULE_5__[/* EventType */ "a"].End, function (event) {
_this._onDidEnd.fire();
Object(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* dispose */ "f"])(listeners);
}));
};
Sash.prototype.layout = function () {
var size = _browser_js__WEBPACK_IMPORTED_MODULE_2__[/* isIPad */ "j"] ? 20 : 4;
if (this.orientation === 0 /* VERTICAL */) {
var verticalProvider = this.layoutProvider;
this.el.style.left = verticalProvider.getVerticalSashLeft(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 {
var horizontalProvider = this.layoutProvider;
this.el.style.top = horizontalProvider.getHorizontalSashTop(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';
}
}
};
Sash.prototype.hide = function () {
this.hidden = true;
this.el.style.display = 'none';
this.el.setAttribute('aria-hidden', 'true');
};
Sash.prototype.onOrthogonalStartSashEnablementChange = function (state) {
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(this.el, 'orthogonal-start', state !== 0 /* Disabled */);
};
Sash.prototype.onOrthogonalEndSashEnablementChange = function (state) {
Object(_dom_js__WEBPACK_IMPORTED_MODULE_8__[/* toggleClass */ "Y"])(this.el, 'orthogonal-end', state !== 0 /* Disabled */);
};
Sash.prototype.getOrthogonalSash = function (e) {
if (this.orientation === 0 /* VERTICAL */) {
if (e.offsetY <= 4) {
return this.orthogonalStartSash;
}
else if (e.offsetY >= this.el.clientHeight - 4) {
return this.orthogonalEndSash;
}
}
else {
if (e.offsetX <= 4) {
return this.orthogonalStartSash;
}
else if (e.offsetX >= this.el.clientWidth - 4) {
return this.orthogonalEndSash;
}
}
return undefined;
};
Sash.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.el.remove();
};
return Sash;
}(_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__[/* Disposable */ "a"]));
/***/ }),
/* 151 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ILabelService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var LABEL_SERVICE_ID = 'label';
var ILabelService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])(LABEL_SERVICE_ID);
/***/ }),
/* 152 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(3);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/Head.js
var Head = __webpack_require__(222);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/isInternalUrl.js
var isInternalUrl = __webpack_require__(132);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/useDocusaurusContext.js
var useDocusaurusContext = __webpack_require__(66);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/useBaseUrl.js
var useBaseUrl = __webpack_require__(97);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useTheme.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const themes={light:'',dark:'dark'};const useTheme=()=>{const{siteConfig:{themeConfig:{disableDarkMode}}={}}=Object(useDocusaurusContext["a" /* default */])();const[theme,setTheme]=Object(react["useState"])(typeof document!=='undefined'?document.documentElement.getAttribute('data-theme'):themes.light);const setThemeSyncWithLocalStorage=Object(react["useCallback"])(newTheme=>{try{localStorage.setItem('theme',newTheme);}catch(err){console.error(err);}},[setTheme]);const setLightTheme=Object(react["useCallback"])(()=>{setTheme(themes.light);setThemeSyncWithLocalStorage(themes.light);},[]);const setDarkTheme=Object(react["useCallback"])(()=>{setTheme(themes.dark);setThemeSyncWithLocalStorage(themes.dark);},[]);Object(react["useEffect"])(()=>{document.documentElement.setAttribute('data-theme',theme);},[theme]);Object(react["useEffect"])(()=>{if(disableDarkMode){return;}try{const localStorageTheme=localStorage.getItem('theme');if(localStorageTheme!==null){setTheme(localStorageTheme);}}catch(err){console.error(err);}},[setTheme]);Object(react["useEffect"])(()=>{if(disableDarkMode){return;}window.matchMedia('(prefers-color-scheme: dark)').addListener(({matches})=>{setTheme(matches?themes.dark:themes.light);});},[]);return{isDarkTheme:theme===themes.dark,setLightTheme,setDarkTheme};};/* harmony default export */ var hooks_useTheme = (useTheme);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/ThemeContext.js
var ThemeContext = __webpack_require__(227);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/ThemeProvider/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function ThemeProvider(props){const{isDarkTheme,setLightTheme,setDarkTheme}=hooks_useTheme();return/*#__PURE__*/react_default.a.createElement(ThemeContext["a" /* default */].Provider,{value:{isDarkTheme,setLightTheme,setDarkTheme}},props.children);}/* harmony default export */ var theme_ThemeProvider = (ThemeProvider);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useTabGroupChoice.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const TAB_CHOICE_PREFIX='docusaurus.tab.';const useTabGroupChoice=()=>{const[tabGroupChoices,setChoices]=Object(react["useState"])({});const setChoiceSyncWithLocalStorage=Object(react["useCallback"])((groupId,newChoice)=>{try{localStorage.setItem(`${TAB_CHOICE_PREFIX}${groupId}`,newChoice);}catch(err){console.error(err);}},[]);Object(react["useEffect"])(()=>{try{const localStorageChoices={};for(let i=0;i{setChoices(oldChoices=>({...oldChoices,[groupId]:newChoice}));setChoiceSyncWithLocalStorage(groupId,newChoice);}};};/* harmony default export */ var hooks_useTabGroupChoice = (useTabGroupChoice);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/TabGroupChoiceContext.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const TabGroupChoiceContext=Object(react["createContext"])({tabGroupChoices:{},setTabGroupChoices:()=>{}});/* harmony default export */ var theme_TabGroupChoiceContext = (TabGroupChoiceContext);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/TabGroupChoiceProvider/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function TabGroupChoiceProvider(props){const{tabGroupChoices,setTabGroupChoices}=hooks_useTabGroupChoice();return/*#__PURE__*/react_default.a.createElement(theme_TabGroupChoiceContext.Provider,{value:{tabGroupChoices,setTabGroupChoices}},props.children);}/* harmony default export */ var theme_TabGroupChoiceProvider = (TabGroupChoiceProvider);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/AnnouncementBar/styles.module.css
var styles_module = __webpack_require__(240);
var styles_module_default = /*#__PURE__*/__webpack_require__.n(styles_module);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/AnnouncementBar/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const STORAGE_DISMISS_KEY='docusaurus.announcement.dismiss';const STORAGE_ID_KEY='docusaurus.announcement.id';function AnnouncementBar(){const{siteConfig:{themeConfig:{announcementBar={}}}={}}=Object(useDocusaurusContext["a" /* default */])();const{id,content,backgroundColor,textColor}=announcementBar;const[isClosed,setClosed]=Object(react["useState"])(true);const handleClose=()=>{localStorage.setItem(STORAGE_DISMISS_KEY,true);setClosed(true);};Object(react["useEffect"])(()=>{const viewedId=localStorage.getItem(STORAGE_ID_KEY);const isNewAnnouncement=id!==viewedId;localStorage.setItem(STORAGE_ID_KEY,id);if(isNewAnnouncement){localStorage.setItem(STORAGE_DISMISS_KEY,false);}if(isNewAnnouncement||localStorage.getItem(STORAGE_DISMISS_KEY)==='false'){setClosed(false);}},[]);if(!content||isClosed){return null;}return/*#__PURE__*/react_default.a.createElement("div",{className:styles_module_default.a.announcementBar,style:{backgroundColor,color:textColor},role:"banner"},/*#__PURE__*/react_default.a.createElement("div",{className:styles_module_default.a.announcementBarContent,dangerouslySetInnerHTML:{__html:content}}),/*#__PURE__*/react_default.a.createElement("button",{type:"button",className:styles_module_default.a.announcementBarClose,onClick:handleClose,"aria-label":"Close"},/*#__PURE__*/react_default.a.createElement("span",{"aria-hidden":"true"},"\xD7")));}/* harmony default export */ var theme_AnnouncementBar = (AnnouncementBar);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__(8);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(78);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/Link.js
var Link = __webpack_require__(87);
// CONCATENATED MODULE: ./node_modules/@docusaurus/core/lib/client/exports/Noop.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*//* harmony default export */ var Noop = (()=>null);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/SearchBar.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// EXTERNAL MODULE: ./node_modules/react-toggle/dist/component/index.js
var component = __webpack_require__(362);
var component_default = /*#__PURE__*/__webpack_require__.n(component);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Toggle/styles.module.css
var Toggle_styles_module = __webpack_require__(203);
var Toggle_styles_module_default = /*#__PURE__*/__webpack_require__.n(Toggle_styles_module);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Toggle/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const Moon=()=>/*#__PURE__*/react_default.a.createElement("span",{className:classnames_default()(Toggle_styles_module_default.a.toggle,Toggle_styles_module_default.a.moon)});const Sun=()=>/*#__PURE__*/react_default.a.createElement("span",{className:classnames_default()(Toggle_styles_module_default.a.toggle,Toggle_styles_module_default.a.sun)});/* harmony default export */ var Toggle = (function(props){const{isClient}=Object(useDocusaurusContext["a" /* default */])();return/*#__PURE__*/react_default.a.createElement(component_default.a,Object(esm_extends["a" /* default */])({disabled:!isClient,icons:{checked:/*#__PURE__*/react_default.a.createElement(Moon,null),unchecked:/*#__PURE__*/react_default.a.createElement(Sun,null)}},props));});
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useThemeContext.js
var useThemeContext = __webpack_require__(133);
// EXTERNAL MODULE: ./node_modules/@docusaurus/core/lib/client/exports/router.js
var router = __webpack_require__(228);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useLocationHash.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function useLocationHash(initialHash){const[hash,setHash]=Object(react["useState"])(initialHash);Object(react["useEffect"])(()=>{const handleHashChange=()=>setHash(window.location.hash);window.addEventListener('hashchange',handleHashChange);return()=>window.removeEventListener('hashchange',handleHashChange);},[]);return[hash,setHash];}/* harmony default export */ var hooks_useLocationHash = (useLocationHash);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useHideableNavbar.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/const useHideableNavbar=hideOnScroll=>{const[isNavbarVisible,setIsNavbarVisible]=Object(react["useState"])(true);const[isFocusedAnchor,setIsFocusedAnchor]=Object(react["useState"])(false);const[lastScrollTop,setLastScrollTop]=Object(react["useState"])(0);const[navbarHeight,setNavbarHeight]=Object(react["useState"])(0);const navbarRef=Object(react["useCallback"])(node=>{if(node!==null){setNavbarHeight(node.getBoundingClientRect().height);}},[]);const location=Object(router["b" /* useLocation */])();const[hash,setHash]=hooks_useLocationHash(location.hash);const handleScroll=()=>{const scrollTop=window.pageYOffset||document.documentElement.scrollTop;if(scrollTop===0){setIsNavbarVisible(true);}if(scrollTop=lastScrollTop){setIsNavbarVisible(false);}else if(scrollTop+windowHeight{if(!hideOnScroll){return undefined;}window.addEventListener('scroll',handleScroll);return()=>{window.removeEventListener('scroll',handleScroll);};},[lastScrollTop,navbarHeight]);Object(react["useEffect"])(()=>{if(!hideOnScroll){return;}setIsNavbarVisible(true);setHash(location.hash);},[location]);Object(react["useEffect"])(()=>{if(!hideOnScroll){return;}if(!hash){return;}setIsFocusedAnchor(true);},[hash]);return{navbarRef,isNavbarVisible};};/* harmony default export */ var hooks_useHideableNavbar = (useHideableNavbar);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useLockBodyScroll.js
var useLockBodyScroll = __webpack_require__(229);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/hooks/useLogo.js
var useLogo = __webpack_require__(230);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Navbar/styles.module.css
var Navbar_styles_module = __webpack_require__(204);
var Navbar_styles_module_default = /*#__PURE__*/__webpack_require__.n(Navbar_styles_module);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Navbar/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function NavLink({activeBasePath,to,href,label,position,...props}){const toUrl=Object(useBaseUrl["a" /* default */])(to);const activeBaseUrl=Object(useBaseUrl["a" /* default */])(activeBasePath);return/*#__PURE__*/react_default.a.createElement(Link["a" /* default */],Object(esm_extends["a" /* default */])({},href?{target:'_blank',rel:'noopener noreferrer',href}:{activeClassName:'navbar__link--active',to:toUrl,...(activeBasePath?{isActive:(_match,location)=>location.pathname.startsWith(activeBaseUrl)}:null)},props),label);}function NavItem({items,position,...props}){if(!items){return/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"navbar__item navbar__link"},props));}return/*#__PURE__*/react_default.a.createElement("div",{className:classnames_default()('navbar__item','dropdown','dropdown--hoverable',{'dropdown--left':position==='left','dropdown--right':position==='right'})},/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"navbar__item navbar__link"},props),props.label),/*#__PURE__*/react_default.a.createElement("ul",{className:"dropdown__menu"},items.map((linkItemInner,i)=>/*#__PURE__*/react_default.a.createElement("li",{key:i},/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"navbar__item navbar__link"},linkItemInner))))));}function MobileNavItem({items,...props}){if(!items){return/*#__PURE__*/react_default.a.createElement("li",{className:"menu__list-item"},/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"menu__link"},props)));}return/*#__PURE__*/react_default.a.createElement("li",{className:"menu__list-item"},/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"menu__link menu__link--sublist"},props),props.label),/*#__PURE__*/react_default.a.createElement("ul",{className:"menu__list"},items.map((linkItemInner,i)=>/*#__PURE__*/react_default.a.createElement("li",{className:"menu__list-item",key:i},/*#__PURE__*/react_default.a.createElement(NavLink,Object(esm_extends["a" /* default */])({className:"menu__link"},linkItemInner))))));}function Navbar(){const{siteConfig:{themeConfig:{navbar:{title,links=[],hideOnScroll=false}={},disableDarkMode=false}},isClient}=Object(useDocusaurusContext["a" /* default */])();const[sidebarShown,setSidebarShown]=Object(react["useState"])(false);const[isSearchBarExpanded,setIsSearchBarExpanded]=Object(react["useState"])(false);const{isDarkTheme,setLightTheme,setDarkTheme}=Object(useThemeContext["a" /* default */])();const{navbarRef,isNavbarVisible}=hooks_useHideableNavbar(hideOnScroll);const{logoLink,logoLinkProps,logoImageUrl,logoAlt}=Object(useLogo["a" /* default */])();Object(useLockBodyScroll["a" /* default */])(sidebarShown);const showSidebar=Object(react["useCallback"])(()=>{setSidebarShown(true);},[setSidebarShown]);const hideSidebar=Object(react["useCallback"])(()=>{setSidebarShown(false);},[setSidebarShown]);const onToggleChange=Object(react["useCallback"])(e=>e.target.checked?setDarkTheme():setLightTheme(),[setLightTheme,setDarkTheme]);return/*#__PURE__*/react_default.a.createElement("nav",{ref:navbarRef,className:classnames_default()('navbar','navbar--light','navbar--fixed-top',{'navbar-sidebar--show':sidebarShown,[Navbar_styles_module_default.a.navbarHideable]:hideOnScroll,[Navbar_styles_module_default.a.navbarHidden]:!isNavbarVisible})},/*#__PURE__*/react_default.a.createElement("div",{className:"navbar__inner"},/*#__PURE__*/react_default.a.createElement("div",{className:"navbar__items"},/*#__PURE__*/react_default.a.createElement("div",{"aria-label":"Navigation bar toggle",className:"navbar__toggle",role:"button",tabIndex:0,onClick:showSidebar,onKeyDown:showSidebar},/*#__PURE__*/react_default.a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",role:"img",focusable:"false"},/*#__PURE__*/react_default.a.createElement("title",null,"Menu"),/*#__PURE__*/react_default.a.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))),/*#__PURE__*/react_default.a.createElement(Link["a" /* default */],Object(esm_extends["a" /* default */])({className:"navbar__brand",to:logoLink},logoLinkProps),logoImageUrl!=null&&/*#__PURE__*/react_default.a.createElement("img",{key:isClient,className:"navbar__logo",src:logoImageUrl,alt:logoAlt}),title!=null&&/*#__PURE__*/react_default.a.createElement("strong",{className:classnames_default()('navbar__title',{[Navbar_styles_module_default.a.hideLogoText]:isSearchBarExpanded})},title)),links.filter(linkItem=>linkItem.position==='left').map((linkItem,i)=>/*#__PURE__*/react_default.a.createElement(NavItem,Object(esm_extends["a" /* default */])({},linkItem,{key:i})))),/*#__PURE__*/react_default.a.createElement("div",{className:"navbar__items navbar__items--right"},links.filter(linkItem=>linkItem.position==='right').map((linkItem,i)=>/*#__PURE__*/react_default.a.createElement(NavItem,Object(esm_extends["a" /* default */])({},linkItem,{key:i}))),!disableDarkMode&&/*#__PURE__*/react_default.a.createElement(Toggle,{className:Navbar_styles_module_default.a.displayOnlyInLargeViewport,"aria-label":"Dark mode toggle",checked:isDarkTheme,onChange:onToggleChange}),/*#__PURE__*/react_default.a.createElement(Noop,{handleSearchBarToggle:setIsSearchBarExpanded,isSearchBarExpanded:isSearchBarExpanded}))),/*#__PURE__*/react_default.a.createElement("div",{role:"presentation",className:"navbar-sidebar__backdrop",onClick:hideSidebar}),/*#__PURE__*/react_default.a.createElement("div",{className:"navbar-sidebar"},/*#__PURE__*/react_default.a.createElement("div",{className:"navbar-sidebar__brand"},/*#__PURE__*/react_default.a.createElement(Link["a" /* default */],Object(esm_extends["a" /* default */])({className:"navbar__brand",onClick:hideSidebar,to:logoLink},logoLinkProps),logoImageUrl!=null&&/*#__PURE__*/react_default.a.createElement("img",{key:isClient,className:"navbar__logo",src:logoImageUrl,alt:logoAlt}),title!=null&&/*#__PURE__*/react_default.a.createElement("strong",{className:"navbar__title"},title)),!disableDarkMode&&sidebarShown&&/*#__PURE__*/react_default.a.createElement(Toggle,{"aria-label":"Dark mode toggle in sidebar",checked:isDarkTheme,onChange:onToggleChange})),/*#__PURE__*/react_default.a.createElement("div",{className:"navbar-sidebar__items"},/*#__PURE__*/react_default.a.createElement("div",{className:"menu"},/*#__PURE__*/react_default.a.createElement("ul",{className:"menu__list"},links.map((linkItem,i)=>/*#__PURE__*/react_default.a.createElement(MobileNavItem,Object(esm_extends["a" /* default */])({},linkItem,{onClick:hideSidebar,key:i}))))))));}/* harmony default export */ var theme_Navbar = (Navbar);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Footer/styles.module.css
var Footer_styles_module = __webpack_require__(363);
var Footer_styles_module_default = /*#__PURE__*/__webpack_require__.n(Footer_styles_module);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Footer/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function FooterLink({to,href,label,...props}){const toUrl=Object(useBaseUrl["a" /* default */])(to);return/*#__PURE__*/react_default.a.createElement(Link["a" /* default */],Object(esm_extends["a" /* default */])({className:"footer__link-item"},href?{target:'_blank',rel:'noopener noreferrer',href}:{to:toUrl},props),label);}const FooterLogo=({url,alt})=>/*#__PURE__*/react_default.a.createElement("img",{className:"footer__logo",alt:alt,src:url});function Footer(){const context=Object(useDocusaurusContext["a" /* default */])();const{siteConfig={}}=context;const{themeConfig={}}=siteConfig;const{footer}=themeConfig;const{copyright,links=[],logo={}}=footer||{};const logoUrl=Object(useBaseUrl["a" /* default */])(logo.src);if(!footer){return null;}return/*#__PURE__*/react_default.a.createElement("footer",{className:classnames_default()('footer',{'footer--dark':footer.style==='dark'})},/*#__PURE__*/react_default.a.createElement("div",{className:"container"},links&&links.length>0&&/*#__PURE__*/react_default.a.createElement("div",{className:"row footer__links"},links.map((linkItem,i)=>/*#__PURE__*/react_default.a.createElement("div",{key:i,className:"col footer__col"},linkItem.title!=null?/*#__PURE__*/react_default.a.createElement("h4",{className:"footer__title"},linkItem.title):null,linkItem.items!=null&&Array.isArray(linkItem.items)&&linkItem.items.length>0?/*#__PURE__*/react_default.a.createElement("ul",{className:"footer__items"},linkItem.items.map((item,key)=>item.html?/*#__PURE__*/react_default.a.createElement("li",{key:key,className:"footer__item",dangerouslySetInnerHTML:{__html:item.html}}):/*#__PURE__*/react_default.a.createElement("li",{key:item.href||item.to,className:"footer__item"},/*#__PURE__*/react_default.a.createElement(FooterLink,item)))):null))),(logo||copyright)&&/*#__PURE__*/react_default.a.createElement("div",{className:"text--center"},logo&&logo.src&&/*#__PURE__*/react_default.a.createElement("div",{className:"margin-bottom--sm"},logo.href?/*#__PURE__*/react_default.a.createElement("a",{href:logo.href,target:"_blank",rel:"noopener noreferrer",className:Footer_styles_module_default.a.footerLogoLink},/*#__PURE__*/react_default.a.createElement(FooterLogo,{alt:logo.alt,url:logoUrl})):/*#__PURE__*/react_default.a.createElement(FooterLogo,{alt:logo.alt,url:logoUrl})),/*#__PURE__*/react_default.a.createElement("div",{dangerouslySetInnerHTML:{__html:copyright}}))));}/* harmony default export */ var theme_Footer = (Footer);
// EXTERNAL MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Layout/styles.css
var styles = __webpack_require__(512);
// CONCATENATED MODULE: ./node_modules/@docusaurus/theme-classic/src/theme/Layout/index.js
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function Layout(props){const{siteConfig={}}=Object(useDocusaurusContext["a" /* default */])();const{favicon,title:siteTitle,themeConfig:{image:defaultImage},url:siteUrl}=siteConfig;const{children,title,noFooter,description,image,keywords,permalink,version}=props;const metaTitle=title?`${title} | ${siteTitle}`:siteTitle;const metaImage=image||defaultImage;let metaImageUrl=siteUrl+Object(useBaseUrl["a" /* default */])(metaImage);if(!Object(isInternalUrl["a" /* default */])(metaImage)){metaImageUrl=metaImage;}const faviconUrl=Object(useBaseUrl["a" /* default */])(favicon);return/*#__PURE__*/react_default.a.createElement(theme_ThemeProvider,null,/*#__PURE__*/react_default.a.createElement(theme_TabGroupChoiceProvider,null,/*#__PURE__*/react_default.a.createElement(Head["a" /* default */],null,/*#__PURE__*/react_default.a.createElement("html",{lang:"en"}),metaTitle&&/*#__PURE__*/react_default.a.createElement("title",null,metaTitle),metaTitle&&/*#__PURE__*/react_default.a.createElement("meta",{property:"og:title",content:metaTitle}),favicon&&/*#__PURE__*/react_default.a.createElement("link",{rel:"shortcut icon",href:faviconUrl}),description&&/*#__PURE__*/react_default.a.createElement("meta",{name:"description",content:description}),description&&/*#__PURE__*/react_default.a.createElement("meta",{property:"og:description",content:description}),version&&/*#__PURE__*/react_default.a.createElement("meta",{name:"docsearch:version",content:version}),keywords&&keywords.length&&/*#__PURE__*/react_default.a.createElement("meta",{name:"keywords",content:keywords.join(',')}),metaImage&&/*#__PURE__*/react_default.a.createElement("meta",{property:"og:image",content:metaImageUrl}),metaImage&&/*#__PURE__*/react_default.a.createElement("meta",{property:"twitter:image",content:metaImageUrl}),metaImage&&/*#__PURE__*/react_default.a.createElement("meta",{name:"twitter:image:alt",content:`Image for ${metaTitle}`}),permalink&&/*#__PURE__*/react_default.a.createElement("meta",{property:"og:url",content:siteUrl+permalink}),/*#__PURE__*/react_default.a.createElement("meta",{name:"twitter:card",content:"summary_large_image"})),/*#__PURE__*/react_default.a.createElement(theme_AnnouncementBar,null),/*#__PURE__*/react_default.a.createElement(theme_Navbar,null),/*#__PURE__*/react_default.a.createElement("div",{className:"main-wrapper"},children),!noFooter&&/*#__PURE__*/react_default.a.createElement(theme_Footer,null)));}/* harmony default export */ var theme_Layout = __webpack_exports__["a"] = (Layout);
/***/ }),
/* 153 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BareFontInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FontInfo; });
/* harmony import */ var _base_common_platform_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17);
/* harmony import */ var _editorZoom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(115);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Determined from empirical observations.
* @internal
*/
var GOLDEN_LINE_HEIGHT_RATIO = _base_common_platform_js__WEBPACK_IMPORTED_MODULE_0__[/* isMacintosh */ "e"] ? 1.5 : 1.35;
/**
* @internal
*/
var MINIMUM_LINE_HEIGHT = 8;
var BareFontInfo = /** @class */ (function () {
/**
* @internal
*/
function BareFontInfo(opts) {
this.zoomLevel = opts.zoomLevel;
this.fontFamily = String(opts.fontFamily);
this.fontWeight = String(opts.fontWeight);
this.fontSize = opts.fontSize;
this.fontFeatureSettings = opts.fontFeatureSettings;
this.lineHeight = opts.lineHeight | 0;
this.letterSpacing = opts.letterSpacing;
}
/**
* @internal
*/
BareFontInfo.createFromValidatedSettings = function (options, zoomLevel, ignoreEditorZoom) {
var fontFamily = options.get(33 /* fontFamily */);
var fontWeight = options.get(37 /* fontWeight */);
var fontSize = options.get(36 /* fontSize */);
var fontFeatureSettings = options.get(35 /* fontLigatures */);
var lineHeight = options.get(49 /* lineHeight */);
var letterSpacing = options.get(46 /* letterSpacing */);
return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, lineHeight, letterSpacing, zoomLevel, ignoreEditorZoom);
};
/**
* @internal
*/
BareFontInfo._create = function (fontFamily, fontWeight, fontSize, fontFeatureSettings, lineHeight, letterSpacing, zoomLevel, ignoreEditorZoom) {
if (lineHeight === 0) {
lineHeight = Math.round(GOLDEN_LINE_HEIGHT_RATIO * fontSize);
}
else if (lineHeight < MINIMUM_LINE_HEIGHT) {
lineHeight = MINIMUM_LINE_HEIGHT;
}
var editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : _editorZoom_js__WEBPACK_IMPORTED_MODULE_1__[/* EditorZoom */ "a"].getZoomLevel() * 0.1);
fontSize *= editorZoomLevelMultiplier;
lineHeight *= editorZoomLevelMultiplier;
return new BareFontInfo({
zoomLevel: zoomLevel,
fontFamily: fontFamily,
fontWeight: fontWeight,
fontSize: fontSize,
fontFeatureSettings: fontFeatureSettings,
lineHeight: lineHeight,
letterSpacing: letterSpacing
});
};
/**
* @internal
*/
BareFontInfo.prototype.getId = function () {
return this.zoomLevel + '-' + this.fontFamily + '-' + this.fontWeight + '-' + this.fontSize + '-' + this.fontFeatureSettings + '-' + this.lineHeight + '-' + this.letterSpacing;
};
/**
* @internal
*/
BareFontInfo.prototype.getMassagedFontFamily = function () {
if (/[,"']/.test(this.fontFamily)) {
// Looks like the font family might be already escaped
return this.fontFamily;
}
if (/[+ ]/.test(this.fontFamily)) {
// Wrap a font family using + or with quotes
return "\"" + this.fontFamily + "\"";
}
return this.fontFamily;
};
return BareFontInfo;
}());
var FontInfo = /** @class */ (function (_super) {
__extends(FontInfo, _super);
/**
* @internal
*/
function FontInfo(opts, isTrusted) {
var _this = _super.call(this, opts) || this;
_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.maxDigitWidth = opts.maxDigitWidth;
return _this;
}
/**
* @internal
*/
FontInfo.prototype.equals = function (other) {
return (this.fontFamily === other.fontFamily
&& this.fontWeight === other.fontWeight
&& this.fontSize === other.fontSize
&& this.fontFeatureSettings === other.fontFeatureSettings
&& 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.maxDigitWidth === other.maxDigitWidth);
};
return FontInfo;
}(BareFontInfo));
/***/ }),
/* 154 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TabFocus; });
/* unused harmony export ComputedEditorOptions */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CommonEditorConfiguration; });
/* unused harmony export editorConfigurationBaseNode */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isEditorConfigurationKey; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isDiffEditorConfigurationKey; });
/* harmony import */ var _nls_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
/* harmony import */ var _base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _base_common_objects_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35);
/* harmony import */ var _base_common_arrays_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18);
/* harmony import */ var _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(26);
/* harmony import */ var _editorZoom_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(115);
/* harmony import */ var _fontInfo_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(153);
/* harmony import */ var _platform_configuration_common_configurationRegistry_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(114);
/* harmony import */ var _platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(57);
/* harmony import */ var _base_common_collections_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(110);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var TabFocus = new /** @class */ (function () {
function class_1() {
this._tabFocus = false;
this._onDidChangeTabFocus = new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]();
this.onDidChangeTabFocus = this._onDidChangeTabFocus.event;
}
class_1.prototype.getTabFocusMode = function () {
return this._tabFocus;
};
class_1.prototype.setTabFocusMode = function (tabFocusMode) {
if (this._tabFocus === tabFocusMode) {
return;
}
this._tabFocus = tabFocusMode;
this._onDidChangeTabFocus.fire(this._tabFocus);
};
return class_1;
}());
var hasOwnProperty = Object.hasOwnProperty;
var ComputedEditorOptions = /** @class */ (function () {
function ComputedEditorOptions() {
this._values = [];
}
ComputedEditorOptions.prototype._read = function (id) {
return this._values[id];
};
ComputedEditorOptions.prototype.get = function (id) {
return this._values[id];
};
ComputedEditorOptions.prototype._write = function (id, value) {
this._values[id] = value;
};
return ComputedEditorOptions;
}());
var RawEditorOptions = /** @class */ (function () {
function RawEditorOptions() {
this._values = [];
}
RawEditorOptions.prototype._read = function (id) {
return this._values[id];
};
RawEditorOptions.prototype._write = function (id, value) {
this._values[id] = value;
};
return RawEditorOptions;
}());
var EditorConfiguration2 = /** @class */ (function () {
function EditorConfiguration2() {
}
EditorConfiguration2.readOptions = function (_options) {
var options = _options;
var result = new RawEditorOptions();
for (var _i = 0, editorOptionsRegistry_2 = _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* editorOptionsRegistry */ "i"]; _i < editorOptionsRegistry_2.length; _i++) {
var editorOption = editorOptionsRegistry_2[_i];
var value = (editorOption.name === '_never_' ? undefined : options[editorOption.name]);
result._write(editorOption.id, value);
}
return result;
};
EditorConfiguration2.validateOptions = function (options) {
var result = new _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* ValidatedEditorOptions */ "h"]();
for (var _i = 0, editorOptionsRegistry_3 = _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* editorOptionsRegistry */ "i"]; _i < editorOptionsRegistry_3.length; _i++) {
var editorOption = editorOptionsRegistry_3[_i];
result._write(editorOption.id, editorOption.validate(options._read(editorOption.id)));
}
return result;
};
EditorConfiguration2.computeOptions = function (options, env) {
var result = new ComputedEditorOptions();
for (var _i = 0, editorOptionsRegistry_4 = _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* editorOptionsRegistry */ "i"]; _i < editorOptionsRegistry_4.length; _i++) {
var editorOption = editorOptionsRegistry_4[_i];
result._write(editorOption.id, editorOption.compute(env, result, options._read(editorOption.id)));
}
return result;
};
EditorConfiguration2._deepEquals = function (a, b) {
if (typeof a !== 'object' || typeof b !== 'object') {
return (a === b);
}
if (Array.isArray(a) || Array.isArray(b)) {
return (Array.isArray(a) && Array.isArray(b) ? _base_common_arrays_js__WEBPACK_IMPORTED_MODULE_4__[/* equals */ "g"](a, b) : false);
}
for (var key in a) {
if (!EditorConfiguration2._deepEquals(a[key], b[key])) {
return false;
}
}
return true;
};
EditorConfiguration2.checkEquals = function (a, b) {
var result = [];
var somethingChanged = false;
for (var _i = 0, editorOptionsRegistry_5 = _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* editorOptionsRegistry */ "i"]; _i < editorOptionsRegistry_5.length; _i++) {
var editorOption = editorOptionsRegistry_5[_i];
var changed = !EditorConfiguration2._deepEquals(a._read(editorOption.id), b._read(editorOption.id));
result[editorOption.id] = changed;
if (changed) {
somethingChanged = true;
}
}
return (somethingChanged ? new _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* ConfigurationChangedEvent */ "a"](result) : null);
};
return EditorConfiguration2;
}());
/**
* Compatibility with old options
*/
function migrateOptions(options) {
var wordWrap = options.wordWrap;
if (wordWrap === true) {
options.wordWrap = 'on';
}
else if (wordWrap === false) {
options.wordWrap = 'off';
}
var lineNumbers = options.lineNumbers;
if (lineNumbers === true) {
options.lineNumbers = 'on';
}
else if (lineNumbers === false) {
options.lineNumbers = 'off';
}
var autoClosingBrackets = options.autoClosingBrackets;
if (autoClosingBrackets === false) {
options.autoClosingBrackets = 'never';
options.autoClosingQuotes = 'never';
options.autoSurround = 'never';
}
var cursorBlinking = options.cursorBlinking;
if (cursorBlinking === 'visible') {
options.cursorBlinking = 'solid';
}
var renderWhitespace = options.renderWhitespace;
if (renderWhitespace === true) {
options.renderWhitespace = 'boundary';
}
else if (renderWhitespace === false) {
options.renderWhitespace = 'none';
}
var renderLineHighlight = options.renderLineHighlight;
if (renderLineHighlight === true) {
options.renderLineHighlight = 'line';
}
else if (renderLineHighlight === false) {
options.renderLineHighlight = 'none';
}
var acceptSuggestionOnEnter = options.acceptSuggestionOnEnter;
if (acceptSuggestionOnEnter === true) {
options.acceptSuggestionOnEnter = 'on';
}
else if (acceptSuggestionOnEnter === false) {
options.acceptSuggestionOnEnter = 'off';
}
var tabCompletion = options.tabCompletion;
if (tabCompletion === false) {
options.tabCompletion = 'off';
}
else if (tabCompletion === true) {
options.tabCompletion = 'onlySnippets';
}
var suggest = options.suggest;
if (suggest && typeof suggest.filteredTypes === 'object' && suggest.filteredTypes) {
var mapping = {};
mapping['method'] = 'showMethods';
mapping['function'] = 'showFunctions';
mapping['constructor'] = 'showConstructors';
mapping['field'] = 'showFields';
mapping['variable'] = 'showVariables';
mapping['class'] = 'showClasses';
mapping['struct'] = 'showStructs';
mapping['interface'] = 'showInterfaces';
mapping['module'] = 'showModules';
mapping['property'] = 'showProperties';
mapping['event'] = 'showEvents';
mapping['operator'] = 'showOperators';
mapping['unit'] = 'showUnits';
mapping['value'] = 'showValues';
mapping['constant'] = 'showConstants';
mapping['enum'] = 'showEnums';
mapping['enumMember'] = 'showEnumMembers';
mapping['keyword'] = 'showKeywords';
mapping['text'] = 'showWords';
mapping['color'] = 'showColors';
mapping['file'] = 'showFiles';
mapping['reference'] = 'showReferences';
mapping['folder'] = 'showFolders';
mapping['typeParameter'] = 'showTypeParameters';
mapping['snippet'] = 'showSnippets';
Object(_base_common_collections_js__WEBPACK_IMPORTED_MODULE_10__[/* forEach */ "c"])(mapping, function (entry) {
var value = suggest.filteredTypes[entry.key];
if (value === false) {
suggest[entry.value] = value;
}
});
// delete (suggest).filteredTypes;
}
var hover = options.hover;
if (hover === true) {
options.hover = {
enabled: true
};
}
else if (hover === false) {
options.hover = {
enabled: false
};
}
var parameterHints = options.parameterHints;
if (parameterHints === true) {
options.parameterHints = {
enabled: true
};
}
else if (parameterHints === false) {
options.parameterHints = {
enabled: false
};
}
var autoIndent = options.autoIndent;
if (autoIndent === true) {
options.autoIndent = 'full';
}
else if (autoIndent === false) {
options.autoIndent = 'advanced';
}
var matchBrackets = options.matchBrackets;
if (matchBrackets === true) {
options.matchBrackets = 'always';
}
else if (matchBrackets === false) {
options.matchBrackets = 'never';
}
}
function deepCloneAndMigrateOptions(_options) {
var options = _base_common_objects_js__WEBPACK_IMPORTED_MODULE_3__[/* deepClone */ "c"](_options);
migrateOptions(options);
return options;
}
var CommonEditorConfiguration = /** @class */ (function (_super) {
__extends(CommonEditorConfiguration, _super);
function CommonEditorConfiguration(isSimpleWidget, _options) {
var _this = _super.call(this) || this;
_this._onDidChange = _this._register(new _base_common_event_js__WEBPACK_IMPORTED_MODULE_1__[/* Emitter */ "a"]());
_this.onDidChange = _this._onDidChange.event;
_this.isSimpleWidget = isSimpleWidget;
_this._isDominatedByLongLines = false;
_this._lineNumbersDigitCount = 1;
_this._rawOptions = deepCloneAndMigrateOptions(_options);
_this._readOptions = EditorConfiguration2.readOptions(_this._rawOptions);
_this._validatedOptions = EditorConfiguration2.validateOptions(_this._readOptions);
_this._register(_editorZoom_js__WEBPACK_IMPORTED_MODULE_6__[/* EditorZoom */ "a"].onDidChangeZoomLevel(function (_) { return _this._recomputeOptions(); }));
_this._register(TabFocus.onDidChangeTabFocus(function (_) { return _this._recomputeOptions(); }));
return _this;
}
CommonEditorConfiguration.prototype.observeReferenceElement = function (dimension) {
};
CommonEditorConfiguration.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
CommonEditorConfiguration.prototype._recomputeOptions = function () {
var oldOptions = this.options;
var newOptions = this._computeInternalOptions();
if (!oldOptions) {
this.options = newOptions;
}
else {
var changeEvent = EditorConfiguration2.checkEquals(oldOptions, newOptions);
if (changeEvent === null) {
// nothing changed!
return;
}
this.options = newOptions;
this._onDidChange.fire(changeEvent);
}
};
CommonEditorConfiguration.prototype.getRawOptions = function () {
return this._rawOptions;
};
CommonEditorConfiguration.prototype._computeInternalOptions = function () {
var partialEnv = this._getEnvConfiguration();
var bareFontInfo = _fontInfo_js__WEBPACK_IMPORTED_MODULE_7__[/* BareFontInfo */ "a"].createFromValidatedSettings(this._validatedOptions, partialEnv.zoomLevel, this.isSimpleWidget);
var env = {
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight,
fontInfo: this.readConfiguration(bareFontInfo),
extraEditorClassName: partialEnv.extraEditorClassName,
isDominatedByLongLines: this._isDominatedByLongLines,
lineNumbersDigitCount: this._lineNumbersDigitCount,
emptySelectionClipboard: partialEnv.emptySelectionClipboard,
pixelRatio: partialEnv.pixelRatio,
tabFocusMode: TabFocus.getTabFocusMode(),
accessibilitySupport: partialEnv.accessibilitySupport
};
return EditorConfiguration2.computeOptions(this._validatedOptions, env);
};
CommonEditorConfiguration._subsetEquals = function (base, subset) {
for (var key in subset) {
if (hasOwnProperty.call(subset, key)) {
var subsetValue = subset[key];
var baseValue = base[key];
if (baseValue === subsetValue) {
continue;
}
if (Array.isArray(baseValue) && Array.isArray(subsetValue)) {
if (!_base_common_arrays_js__WEBPACK_IMPORTED_MODULE_4__[/* equals */ "g"](baseValue, subsetValue)) {
return false;
}
continue;
}
if (typeof baseValue === 'object' && typeof subsetValue === 'object') {
if (!this._subsetEquals(baseValue, subsetValue)) {
return false;
}
continue;
}
return false;
}
}
return true;
};
CommonEditorConfiguration.prototype.updateOptions = function (_newOptions) {
if (typeof _newOptions === 'undefined') {
return;
}
var newOptions = deepCloneAndMigrateOptions(_newOptions);
if (CommonEditorConfiguration._subsetEquals(this._rawOptions, newOptions)) {
return;
}
this._rawOptions = _base_common_objects_js__WEBPACK_IMPORTED_MODULE_3__[/* mixin */ "g"](this._rawOptions, newOptions || {});
this._readOptions = EditorConfiguration2.readOptions(this._rawOptions);
this._validatedOptions = EditorConfiguration2.validateOptions(this._readOptions);
this._recomputeOptions();
};
CommonEditorConfiguration.prototype.setIsDominatedByLongLines = function (isDominatedByLongLines) {
this._isDominatedByLongLines = isDominatedByLongLines;
this._recomputeOptions();
};
CommonEditorConfiguration.prototype.setMaxLineNumber = function (maxLineNumber) {
var digitCount = CommonEditorConfiguration._digitCount(maxLineNumber);
if (this._lineNumbersDigitCount === digitCount) {
return;
}
this._lineNumbersDigitCount = digitCount;
this._recomputeOptions();
};
CommonEditorConfiguration._digitCount = function (n) {
var r = 0;
while (n) {
n = Math.floor(n / 10);
r++;
}
return r ? r : 1;
};
return CommonEditorConfiguration;
}(_base_common_lifecycle_js__WEBPACK_IMPORTED_MODULE_2__[/* Disposable */ "a"]));
var editorConfigurationBaseNode = Object.freeze({
id: 'editor',
order: 5,
type: 'object',
title: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('editorConfigurationTitle', "Editor"),
scope: 5 /* LANGUAGE_OVERRIDABLE */,
});
var configurationRegistry = _platform_registry_common_platform_js__WEBPACK_IMPORTED_MODULE_9__[/* Registry */ "a"].as(_platform_configuration_common_configurationRegistry_js__WEBPACK_IMPORTED_MODULE_8__[/* Extensions */ "a"].Configuration);
var editorConfiguration = __assign(__assign({}, editorConfigurationBaseNode), { properties: {
'editor.tabSize': {
type: 'number',
default: _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* EDITOR_MODEL_DEFAULTS */ "c"].tabSize,
minimum: 1,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('tabSize', "The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
},
// 'editor.indentSize': {
// 'anyOf': [
// {
// type: 'string',
// enum: ['tabSize']
// },
// {
// type: 'number',
// minimum: 1
// }
// ],
// default: 'tabSize',
// markdownDescription: nls.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: _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* EDITOR_MODEL_DEFAULTS */ "c"].insertSpaces,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('insertSpaces', "Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
},
'editor.detectIndentation': {
type: 'boolean',
default: _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* EDITOR_MODEL_DEFAULTS */ "c"].detectIndentation,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('detectIndentation', "Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.")
},
'editor.trimAutoWhitespace': {
type: 'boolean',
default: _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* EDITOR_MODEL_DEFAULTS */ "c"].trimAutoWhitespace,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('trimAutoWhitespace', "Remove trailing auto inserted whitespace.")
},
'editor.largeFileOptimizations': {
type: 'boolean',
default: _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* EDITOR_MODEL_DEFAULTS */ "c"].largeFileOptimizations,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('largeFileOptimizations', "Special handling for large files to disable certain memory intensive features.")
},
'editor.wordBasedSuggestions': {
type: 'boolean',
default: true,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
},
'editor.semanticHighlighting.enabled': {
type: 'boolean',
default: false,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('semanticHighlighting.enabled', "Controls whether the semanticHighlighting is shown for the languages that support it.")
},
'editor.stablePeek': {
type: 'boolean',
default: false,
markdownDescription: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('stablePeek', "Keep peek editors open even when double clicking their content or when hitting `Escape`.")
},
'editor.maxTokenizationLineLength': {
type: 'integer',
default: 20000,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('maxTokenizationLineLength', "Lines above this length will not be tokenized for performance reasons")
},
'diffEditor.maxComputationTime': {
type: 'number',
default: 5000,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('maxComputationTime', "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")
},
'diffEditor.renderSideBySide': {
type: 'boolean',
default: true,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('sideBySide', "Controls whether the diff editor shows the diff side by side or inline.")
},
'diffEditor.ignoreTrimWhitespace': {
type: 'boolean',
default: true,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('ignoreTrimWhitespace', "Controls whether the diff editor shows changes in leading or trailing whitespace as diffs.")
},
'diffEditor.renderIndicators': {
type: 'boolean',
default: true,
description: _nls_js__WEBPACK_IMPORTED_MODULE_0__[/* localize */ "a"]('renderIndicators', "Controls whether the diff editor shows +/- indicators for added/removed changes.")
}
} });
function isConfigurationPropertySchema(x) {
return (typeof x.type !== 'undefined' || typeof x.anyOf !== 'undefined');
}
// Add properties from the Editor Option Registry
for (var _i = 0, editorOptionsRegistry_1 = _editorOptions_js__WEBPACK_IMPORTED_MODULE_5__[/* editorOptionsRegistry */ "i"]; _i < editorOptionsRegistry_1.length; _i++) {
var editorOption = editorOptionsRegistry_1[_i];
var schema = editorOption.schema;
if (typeof schema !== 'undefined') {
if (isConfigurationPropertySchema(schema)) {
// This is a single schema contribution
editorConfiguration.properties["editor." + editorOption.name] = schema;
}
else {
for (var key in schema) {
if (hasOwnProperty.call(schema, key)) {
editorConfiguration.properties[key] = schema[key];
}
}
}
}
}
var cachedEditorConfigurationKeys = null;
function getEditorConfigurationKeys() {
if (cachedEditorConfigurationKeys === null) {
cachedEditorConfigurationKeys = Object.create(null);
Object.keys(editorConfiguration.properties).forEach(function (prop) {
cachedEditorConfigurationKeys[prop] = true;
});
}
return cachedEditorConfigurationKeys;
}
function isEditorConfigurationKey(key) {
var editorConfigurationKeys = getEditorConfigurationKeys();
return (editorConfigurationKeys["editor." + key] || false);
}
function isDiffEditorConfigurationKey(key) {
var editorConfigurationKeys = getEditorConfigurationKeys();
return (editorConfigurationKeys["diffEditor." + key] || false);
}
configurationRegistry.registerConfiguration(editorConfiguration);
/***/ }),
/* 155 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ElementsDragAndDropData; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ listView_ListView; });
// UNUSED EXPORTS: ExternalElementsDragAndDropData, DesktopDragAndDropData
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/objects.js
var objects = __webpack_require__(35);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/touch.js
var touch = __webpack_require__(54);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/event.js
var browser_event = __webpack_require__(34);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js + 6 modules
var scrollableElement = __webpack_require__(81);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/range.js
var common_range = __webpack_require__(90);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/rangeMap.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Returns the intersection between a ranged group and a range.
* Returns `[]` if the intersection is empty.
*/
function groupIntersect(range, groups) {
var result = [];
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var r = groups_1[_i];
if (range.start >= r.range.end) {
continue;
}
if (range.end < r.range.start) {
break;
}
var intersection = common_range["a" /* Range */].intersect(range, r.range);
if (common_range["a" /* Range */].isEmpty(intersection)) {
continue;
}
result.push({
range: intersection,
size: r.size
});
}
return result;
}
/**
* Shifts a range by that `much`.
*/
function shift(_a, much) {
var start = _a.start, end = _a.end;
return { start: start + much, end: end + much };
}
/**
* Consolidates a collection of ranged groups.
*
* Consolidation is the process of merging consecutive ranged groups
* that share the same `size`.
*/
function consolidate(groups) {
var result = [];
var previousGroup = null;
for (var _i = 0, groups_2 = groups; _i < groups_2.length; _i++) {
var group = groups_2[_i];
var start = group.range.start;
var end = group.range.end;
var size = group.size;
if (previousGroup && size === previousGroup.size) {
previousGroup.range.end = end;
continue;
}
previousGroup = { range: { start: start, end: end }, size: size };
result.push(previousGroup);
}
return result;
}
/**
* Concatenates several collections of ranged groups into a single
* collection.
*/
function concat() {
var groups = [];
for (var _i = 0; _i < arguments.length; _i++) {
groups[_i] = arguments[_i];
}
return consolidate(groups.reduce(function (r, g) { return r.concat(g); }, []));
}
var RangeMap = /** @class */ (function () {
function RangeMap() {
this.groups = [];
this._size = 0;
}
RangeMap.prototype.splice = function (index, deleteCount, items) {
if (items === void 0) { items = []; }
var diff = items.length - deleteCount;
var before = groupIntersect({ start: 0, end: index }, this.groups);
var after = groupIntersect({ start: index + deleteCount, end: Number.POSITIVE_INFINITY }, this.groups)
.map(function (g) { return ({ range: shift(g.range, diff), size: g.size }); });
var middle = items.map(function (item, i) { return ({
range: { start: index + i, end: index + i + 1 },
size: item.size
}); });
this.groups = concat(before, middle, after);
this._size = this.groups.reduce(function (t, g) { return t + (g.size * (g.range.end - g.range.start)); }, 0);
};
Object.defineProperty(RangeMap.prototype, "count", {
/**
* Returns the number of items in the range map.
*/
get: function () {
var len = this.groups.length;
if (!len) {
return 0;
}
return this.groups[len - 1].range.end;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RangeMap.prototype, "size", {
/**
* Returns the sum of the sizes of all items in the range map.
*/
get: function () {
return this._size;
},
enumerable: true,
configurable: true
});
/**
* Returns the index of the item at the given position.
*/
RangeMap.prototype.indexAt = function (position) {
if (position < 0) {
return -1;
}
var index = 0;
var size = 0;
for (var _i = 0, _a = this.groups; _i < _a.length; _i++) {
var group = _a[_i];
var count = group.range.end - group.range.start;
var newSize = size + (count * group.size);
if (position < newSize) {
return index + Math.floor((position - size) / group.size);
}
index += count;
size = newSize;
}
return index;
};
/**
* Returns the index of the item right after the item at the
* index of the given position.
*/
RangeMap.prototype.indexAfter = function (position) {
return Math.min(this.indexAt(position) + 1, this.count);
};
/**
* Returns the start position of the item at the given index.
*/
RangeMap.prototype.positionAt = function (index) {
if (index < 0) {
return -1;
}
var position = 0;
var count = 0;
for (var _i = 0, _a = this.groups; _i < _a.length; _i++) {
var group = _a[_i];
var groupCount = group.range.end - group.range.start;
var newCount = count + groupCount;
if (index < newCount) {
return position + ((index - count) * group.size);
}
position += groupCount * group.size;
count = newCount;
}
return -1;
};
return RangeMap;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/rowCache.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function removeFromParent(element) {
try {
if (element.parentElement) {
element.parentElement.removeChild(element);
}
}
catch (e) {
// this will throw if this happens due to a blur event, nasty business
}
}
var rowCache_RowCache = /** @class */ (function () {
function RowCache(renderers) {
this.renderers = renderers;
this.cache = new Map();
}
/**
* Returns a row either by creating a new one or reusing
* a previously released row which shares the same templateId.
*/
RowCache.prototype.alloc = function (templateId) {
var result = this.getTemplateCache(templateId).pop();
if (!result) {
var domNode = Object(dom["a" /* $ */])('.monaco-list-row');
var renderer = this.getRenderer(templateId);
var templateData = renderer.renderTemplate(domNode);
result = { domNode: domNode, templateId: templateId, templateData: templateData };
}
return result;
};
/**
* Releases the row for eventual reuse.
*/
RowCache.prototype.release = function (row) {
if (!row) {
return;
}
this.releaseRow(row);
};
RowCache.prototype.releaseRow = function (row) {
var domNode = row.domNode, templateId = row.templateId;
if (domNode) {
Object(dom["P" /* removeClass */])(domNode, 'scrolling');
removeFromParent(domNode);
}
var cache = this.getTemplateCache(templateId);
cache.push(row);
};
RowCache.prototype.getTemplateCache = function (templateId) {
var result = this.cache.get(templateId);
if (!result) {
result = [];
this.cache.set(templateId, result);
}
return result;
};
RowCache.prototype.dispose = function () {
var _this = this;
this.cache.forEach(function (cachedRows, templateId) {
for (var _i = 0, cachedRows_1 = cachedRows; _i < cachedRows_1.length; _i++) {
var cachedRow = cachedRows_1[_i];
var renderer = _this.getRenderer(templateId);
renderer.disposeTemplate(cachedRow.templateData);
cachedRow.domNode = null;
cachedRow.templateData = null;
}
});
this.cache.clear();
};
RowCache.prototype.getRenderer = function (templateId) {
var renderer = this.renderers.get(templateId);
if (!renderer) {
throw new Error("No renderer found for " + templateId);
}
return renderer;
};
return RowCache;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/decorators.js
var decorators = __webpack_require__(95);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dnd.js
var dnd = __webpack_require__(79);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/async.js
var common_async = __webpack_require__(20);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/browser.js
var browser = __webpack_require__(25);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/list/listView.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __decorate = (undefined && undefined.__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;
};
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var DefaultOptions = {
useShadows: true,
verticalScrollMode: 1 /* Auto */,
setRowLineHeight: true,
supportDynamicHeights: false,
dnd: {
getDragElements: function (e) { return [e]; },
getDragURI: function () { return null; },
onDragStart: function () { },
onDragOver: function () { return false; },
drop: function () { }
},
horizontalScrolling: false
};
var ElementsDragAndDropData = /** @class */ (function () {
function ElementsDragAndDropData(elements) {
this.elements = elements;
}
ElementsDragAndDropData.prototype.update = function () { };
ElementsDragAndDropData.prototype.getData = function () {
return this.elements;
};
return ElementsDragAndDropData;
}());
var ExternalElementsDragAndDropData = /** @class */ (function () {
function ExternalElementsDragAndDropData(elements) {
this.elements = elements;
}
ExternalElementsDragAndDropData.prototype.update = function () { };
ExternalElementsDragAndDropData.prototype.getData = function () {
return this.elements;
};
return ExternalElementsDragAndDropData;
}());
var DesktopDragAndDropData = /** @class */ (function () {
function DesktopDragAndDropData() {
this.types = [];
this.files = [];
}
DesktopDragAndDropData.prototype.update = function (dataTransfer) {
var _a;
if (dataTransfer.types) {
(_a = this.types).splice.apply(_a, __spreadArrays([0, this.types.length], dataTransfer.types));
}
if (dataTransfer.files) {
this.files.splice(0, this.files.length);
for (var i = 0; i < dataTransfer.files.length; i++) {
var file = dataTransfer.files.item(i);
if (file && (file.size || file.type)) {
this.files.push(file);
}
}
}
};
DesktopDragAndDropData.prototype.getData = function () {
return {
types: this.types,
files: this.files
};
};
return DesktopDragAndDropData;
}());
function equalsDragFeedback(f1, f2) {
if (Array.isArray(f1) && Array.isArray(f2)) {
return Object(arrays["g" /* equals */])(f1, f2);
}
return f1 === f2;
}
var listView_ListView = /** @class */ (function () {
function ListView(container, virtualDelegate, renderers, options) {
var _this = this;
if (options === void 0) { options = DefaultOptions; }
this.virtualDelegate = virtualDelegate;
this.domId = "list_id_" + ++ListView.InstanceCount;
this.renderers = new Map();
this.renderWidth = 0;
this._scrollHeight = 0;
this.scrollableElementUpdateDisposable = null;
this.scrollableElementWidthDelayer = new common_async["a" /* Delayer */](50);
this.splicing = false;
this.dragOverAnimationStopDisposable = lifecycle["a" /* Disposable */].None;
this.dragOverMouseY = 0;
this.canDrop = false;
this.currentDragFeedbackDisposable = lifecycle["a" /* Disposable */].None;
this.onDragLeaveTimeout = lifecycle["a" /* Disposable */].None;
this.disposables = new lifecycle["b" /* DisposableStore */]();
this._onDidChangeContentHeight = new common_event["a" /* Emitter */]();
if (options.horizontalScrolling && options.supportDynamicHeights) {
throw new Error('Horizontal scrolling and dynamic heights not supported simultaneously');
}
this.items = [];
this.itemId = 0;
this.rangeMap = new RangeMap();
for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) {
var renderer = renderers_1[_i];
this.renderers.set(renderer.templateId, renderer);
}
this.cache = this.disposables.add(new rowCache_RowCache(this.renderers));
this.lastRenderTop = 0;
this.lastRenderHeight = 0;
this.domNode = document.createElement('div');
this.domNode.className = 'monaco-list';
dom["f" /* addClass */](this.domNode, this.domId);
this.domNode.tabIndex = 0;
dom["Y" /* toggleClass */](this.domNode, 'mouse-support', typeof options.mouseSupport === 'boolean' ? options.mouseSupport : true);
this.horizontalScrolling = Object(objects["f" /* getOrDefault */])(options, function (o) { return o.horizontalScrolling; }, DefaultOptions.horizontalScrolling);
dom["Y" /* toggleClass */](this.domNode, 'horizontal-scrolling', this.horizontalScrolling);
this.additionalScrollHeight = typeof options.additionalScrollHeight === 'undefined' ? 0 : options.additionalScrollHeight;
this.ariaProvider = options.ariaProvider || { getSetSize: function (e, i, length) { return length; }, getPosInSet: function (_, index) { return index + 1; } };
this.rowsContainer = document.createElement('div');
this.rowsContainer.className = 'monaco-list-rows';
this.rowsContainer.style.transform = 'translate3d(0px, 0px, 0px)';
this.disposables.add(touch["b" /* Gesture */].addTarget(this.rowsContainer));
this.scrollableElement = this.disposables.add(new scrollableElement["b" /* ScrollableElement */](this.rowsContainer, {
alwaysConsumeMouseWheel: true,
horizontal: this.horizontalScrolling ? 1 /* Auto */ : 2 /* Hidden */,
vertical: Object(objects["f" /* getOrDefault */])(options, function (o) { return o.verticalScrollMode; }, DefaultOptions.verticalScrollMode),
useShadows: Object(objects["f" /* getOrDefault */])(options, function (o) { return o.useShadows; }, DefaultOptions.useShadows)
}));
this.domNode.appendChild(this.scrollableElement.getDomNode());
container.appendChild(this.domNode);
this.scrollableElement.onScroll(this.onScroll, this, this.disposables);
Object(browser_event["a" /* domEvent */])(this.rowsContainer, touch["a" /* EventType */].Change)(this.onTouchChange, this, this.disposables);
// Prevent the monaco-scrollable-element from scrolling
// https://github.com/Microsoft/vscode/issues/44181
Object(browser_event["a" /* domEvent */])(this.scrollableElement.getDomNode(), 'scroll')(function (e) { return e.target.scrollTop = 0; }, null, this.disposables);
common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'dragover'), function (e) { return _this.toDragEvent(e); })(this.onDragOver, this, this.disposables);
common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'drop'), function (e) { return _this.toDragEvent(e); })(this.onDrop, this, this.disposables);
Object(browser_event["a" /* domEvent */])(this.domNode, 'dragleave')(this.onDragLeave, this, this.disposables);
Object(browser_event["a" /* domEvent */])(window, 'dragend')(this.onDragEnd, this, this.disposables);
this.setRowLineHeight = Object(objects["f" /* getOrDefault */])(options, function (o) { return o.setRowLineHeight; }, DefaultOptions.setRowLineHeight);
this.supportDynamicHeights = Object(objects["f" /* getOrDefault */])(options, function (o) { return o.supportDynamicHeights; }, DefaultOptions.supportDynamicHeights);
this.dnd = Object(objects["f" /* getOrDefault */])(options, function (o) { return o.dnd; }, DefaultOptions.dnd);
this.layout();
}
Object.defineProperty(ListView.prototype, "contentHeight", {
get: function () { return this.rangeMap.size; },
enumerable: true,
configurable: true
});
ListView.prototype.splice = function (start, deleteCount, elements) {
if (elements === void 0) { 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);
}
};
ListView.prototype._splice = function (start, deleteCount, elements) {
var _a;
var _this = this;
if (elements === void 0) { elements = []; }
var previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
var deleteRange = { start: start, end: start + deleteCount };
var removeRange = common_range["a" /* Range */].intersect(previousRenderRange, deleteRange);
for (var i = removeRange.start; i < removeRange.end; i++) {
this.removeItemFromDOM(i);
}
var previousRestRange = { start: start + deleteCount, end: this.items.length };
var previousRenderedRestRange = common_range["a" /* Range */].intersect(previousRestRange, previousRenderRange);
var previousUnrenderedRestRanges = common_range["a" /* Range */].relativeComplement(previousRestRange, previousRenderRange);
var inserted = elements.map(function (element) { return ({
id: String(_this.itemId++),
element: element,
templateId: _this.virtualDelegate.getTemplateId(element),
size: _this.virtualDelegate.getHeight(element),
width: undefined,
hasDynamicHeight: !!_this.virtualDelegate.hasDynamicHeight && _this.virtualDelegate.hasDynamicHeight(element),
lastDynamicHeightWidth: undefined,
row: null,
uri: undefined,
dropTarget: false,
dragStartDisposable: lifecycle["a" /* Disposable */].None
}); });
var deleted;
// TODO@joao: improve this optimization to catch even more cases
if (start === 0 && deleteCount >= this.items.length) {
this.rangeMap = new RangeMap();
this.rangeMap.splice(0, 0, inserted);
this.items = inserted;
deleted = [];
}
else {
this.rangeMap.splice(start, deleteCount, inserted);
deleted = (_a = this.items).splice.apply(_a, __spreadArrays([start, deleteCount], inserted));
}
var delta = elements.length - deleteCount;
var renderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
var renderedRestRange = shift(previousRenderedRestRange, delta);
var updateRange = common_range["a" /* Range */].intersect(renderRange, renderedRestRange);
for (var i = updateRange.start; i < updateRange.end; i++) {
this.updateItemInDOM(this.items[i], i);
}
var removeRanges = common_range["a" /* Range */].relativeComplement(renderedRestRange, renderRange);
for (var _i = 0, removeRanges_1 = removeRanges; _i < removeRanges_1.length; _i++) {
var range = removeRanges_1[_i];
for (var i = range.start; i < range.end; i++) {
this.removeItemFromDOM(i);
}
}
var unrenderedRestRanges = previousUnrenderedRestRanges.map(function (r) { return shift(r, delta); });
var elementsRange = { start: start, end: start + elements.length };
var insertRanges = __spreadArrays([elementsRange], unrenderedRestRanges).map(function (r) { return common_range["a" /* Range */].intersect(renderRange, r); });
var beforeElement = this.getNextToLastElement(insertRanges);
for (var _b = 0, insertRanges_1 = insertRanges; _b < insertRanges_1.length; _b++) {
var range = insertRanges_1[_b];
for (var i = range.start; i < range.end; i++) {
this.insertItemInDOM(i, beforeElement);
}
}
this.eventuallyUpdateScrollDimensions();
if (this.supportDynamicHeights) {
this._rerender(this.scrollTop, this.renderHeight);
}
return deleted.map(function (i) { return i.element; });
};
ListView.prototype.eventuallyUpdateScrollDimensions = function () {
var _this = this;
this._scrollHeight = this.contentHeight;
this.rowsContainer.style.height = this._scrollHeight + "px";
if (!this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable = dom["W" /* scheduleAtNextAnimationFrame */](function () {
_this.scrollableElement.setScrollDimensions({ scrollHeight: _this.scrollHeight });
_this.updateScrollWidth();
_this.scrollableElementUpdateDisposable = null;
});
}
};
ListView.prototype.eventuallyUpdateScrollWidth = function () {
var _this = this;
if (!this.horizontalScrolling) {
return;
}
this.scrollableElementWidthDelayer.trigger(function () { return _this.updateScrollWidth(); });
};
ListView.prototype.updateScrollWidth = function () {
if (!this.horizontalScrolling) {
return;
}
if (this.items.length === 0) {
this.scrollableElement.setScrollDimensions({ scrollWidth: 0 });
}
var scrollWidth = 0;
for (var _i = 0, _a = this.items; _i < _a.length; _i++) {
var item = _a[_i];
if (typeof item.width !== 'undefined') {
scrollWidth = Math.max(scrollWidth, item.width);
}
}
this.scrollWidth = scrollWidth;
this.scrollableElement.setScrollDimensions({ scrollWidth: scrollWidth + 10 });
};
ListView.prototype.rerender = function () {
if (!this.supportDynamicHeights) {
return;
}
for (var _i = 0, _a = this.items; _i < _a.length; _i++) {
var item = _a[_i];
item.lastDynamicHeightWidth = undefined;
}
this._rerender(this.lastRenderTop, this.lastRenderHeight);
};
Object.defineProperty(ListView.prototype, "length", {
get: function () {
return this.items.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "renderHeight", {
get: function () {
var scrollDimensions = this.scrollableElement.getScrollDimensions();
return scrollDimensions.height;
},
enumerable: true,
configurable: true
});
ListView.prototype.element = function (index) {
return this.items[index].element;
};
ListView.prototype.domElement = function (index) {
var row = this.items[index].row;
return row && row.domNode;
};
ListView.prototype.elementHeight = function (index) {
return this.items[index].size;
};
ListView.prototype.elementTop = function (index) {
return this.rangeMap.positionAt(index);
};
ListView.prototype.indexAt = function (position) {
return this.rangeMap.indexAt(position);
};
ListView.prototype.indexAfter = function (position) {
return this.rangeMap.indexAfter(position);
};
ListView.prototype.layout = function (height, width) {
var scrollDimensions = {
height: typeof height === 'number' ? height : dom["A" /* getContentHeight */](this.domNode)
};
if (this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable.dispose();
this.scrollableElementUpdateDisposable = null;
scrollDimensions.scrollHeight = this.scrollHeight;
}
this.scrollableElement.setScrollDimensions(scrollDimensions);
if (typeof width !== 'undefined') {
this.renderWidth = width;
if (this.supportDynamicHeights) {
this._rerender(this.scrollTop, this.renderHeight);
}
if (this.horizontalScrolling) {
this.scrollableElement.setScrollDimensions({
width: typeof width === 'number' ? width : dom["B" /* getContentWidth */](this.domNode)
});
}
}
};
// Render
ListView.prototype.render = function (renderTop, renderHeight, renderLeft, scrollWidth) {
var previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
var renderRange = this.getRenderRange(renderTop, renderHeight);
var rangesToInsert = common_range["a" /* Range */].relativeComplement(renderRange, previousRenderRange);
var rangesToRemove = common_range["a" /* Range */].relativeComplement(previousRenderRange, renderRange);
var beforeElement = this.getNextToLastElement(rangesToInsert);
for (var _i = 0, rangesToInsert_1 = rangesToInsert; _i < rangesToInsert_1.length; _i++) {
var range = rangesToInsert_1[_i];
for (var i = range.start; i < range.end; i++) {
this.insertItemInDOM(i, beforeElement);
}
}
for (var _a = 0, rangesToRemove_1 = rangesToRemove; _a < rangesToRemove_1.length; _a++) {
var range = rangesToRemove_1[_a];
for (var i = range.start; i < range.end; i++) {
this.removeItemFromDOM(i);
}
}
this.rowsContainer.style.left = "-" + renderLeft + "px";
this.rowsContainer.style.top = "-" + renderTop + "px";
if (this.horizontalScrolling) {
this.rowsContainer.style.width = Math.max(scrollWidth, this.renderWidth) + "px";
}
this.lastRenderTop = renderTop;
this.lastRenderHeight = renderHeight;
};
// DOM operations
ListView.prototype.insertItemInDOM = function (index, beforeElement) {
var _this = this;
var item = this.items[index];
if (!item.row) {
item.row = this.cache.alloc(item.templateId);
var role = this.ariaProvider.getRole ? this.ariaProvider.getRole(item.element) : 'treeitem';
item.row.domNode.setAttribute('role', role);
var checked = this.ariaProvider.isChecked ? this.ariaProvider.isChecked(item.element) : undefined;
if (typeof checked !== 'undefined') {
item.row.domNode.setAttribute('aria-checked', String(checked));
}
}
if (!item.row.domNode.parentElement) {
if (beforeElement) {
this.rowsContainer.insertBefore(item.row.domNode, beforeElement);
}
else {
this.rowsContainer.appendChild(item.row.domNode);
}
}
this.updateItemInDOM(item, index);
var renderer = this.renderers.get(item.templateId);
if (!renderer) {
throw new Error("No renderer found for template id " + item.templateId);
}
if (renderer) {
renderer.renderElement(item.element, index, item.row.templateData, item.size);
}
var uri = this.dnd.getDragURI(item.element);
item.dragStartDisposable.dispose();
item.row.domNode.draggable = !!uri;
if (uri) {
var onDragStart = Object(browser_event["a" /* domEvent */])(item.row.domNode, 'dragstart');
item.dragStartDisposable = onDragStart(function (event) { return _this.onDragStart(item.element, uri, event); });
}
if (this.horizontalScrolling) {
this.measureItemWidth(item);
this.eventuallyUpdateScrollWidth();
}
};
ListView.prototype.measureItemWidth = function (item) {
if (!item.row || !item.row.domNode) {
return;
}
item.row.domNode.style.width = browser["h" /* isFirefox */] ? '-moz-fit-content' : 'fit-content';
item.width = dom["B" /* getContentWidth */](item.row.domNode);
var style = window.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 = '';
};
ListView.prototype.updateItemInDOM = function (item, index) {
item.row.domNode.style.top = this.elementTop(index) + "px";
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('aria-setsize', String(this.ariaProvider.getSetSize(item.element, index, this.length)));
item.row.domNode.setAttribute('aria-posinset', String(this.ariaProvider.getPosInSet(item.element, index)));
item.row.domNode.setAttribute('id', this.getElementDomId(index));
dom["Y" /* toggleClass */](item.row.domNode, 'drop-target', item.dropTarget);
};
ListView.prototype.removeItemFromDOM = function (index) {
var item = this.items[index];
item.dragStartDisposable.dispose();
var 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();
}
};
ListView.prototype.getScrollTop = function () {
var scrollPosition = this.scrollableElement.getScrollPosition();
return scrollPosition.scrollTop;
};
ListView.prototype.setScrollTop = function (scrollTop) {
if (this.scrollableElementUpdateDisposable) {
this.scrollableElementUpdateDisposable.dispose();
this.scrollableElementUpdateDisposable = null;
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
}
this.scrollableElement.setScrollPosition({ scrollTop: scrollTop });
};
Object.defineProperty(ListView.prototype, "scrollTop", {
get: function () {
return this.getScrollTop();
},
set: function (scrollTop) {
this.setScrollTop(scrollTop);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "scrollHeight", {
get: function () {
return this._scrollHeight + (this.horizontalScrolling ? 10 : 0) + this.additionalScrollHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onMouseClick", {
// Events
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'click'), function (e) { return _this.toMouseEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onMouseDblClick", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'dblclick'), function (e) { return _this.toMouseEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onMouseMiddleClick", {
get: function () {
var _this = this;
return common_event["b" /* Event */].filter(common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'auxclick'), function (e) { return _this.toMouseEvent(e); }), function (e) { return e.browserEvent.button === 1; });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onMouseDown", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'mousedown'), function (e) { return _this.toMouseEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onContextMenu", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'contextmenu'), function (e) { return _this.toMouseEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onTouchStart", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.domNode, 'touchstart'), function (e) { return _this.toTouchEvent(e); });
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListView.prototype, "onTap", {
get: function () {
var _this = this;
return common_event["b" /* Event */].map(Object(browser_event["a" /* domEvent */])(this.rowsContainer, touch["a" /* EventType */].Tap), function (e) { return _this.toGestureEvent(e); });
},
enumerable: true,
configurable: true
});
ListView.prototype.toMouseEvent = function (browserEvent) {
var index = this.getItemIndexFromEventTarget(browserEvent.target || null);
var item = typeof index === 'undefined' ? undefined : this.items[index];
var element = item && item.element;
return { browserEvent: browserEvent, index: index, element: element };
};
ListView.prototype.toTouchEvent = function (browserEvent) {
var index = this.getItemIndexFromEventTarget(browserEvent.target || null);
var item = typeof index === 'undefined' ? undefined : this.items[index];
var element = item && item.element;
return { browserEvent: browserEvent, index: index, element: element };
};
ListView.prototype.toGestureEvent = function (browserEvent) {
var index = this.getItemIndexFromEventTarget(browserEvent.initialTarget || null);
var item = typeof index === 'undefined' ? undefined : this.items[index];
var element = item && item.element;
return { browserEvent: browserEvent, index: index, element: element };
};
ListView.prototype.toDragEvent = function (browserEvent) {
var index = this.getItemIndexFromEventTarget(browserEvent.target || null);
var item = typeof index === 'undefined' ? undefined : this.items[index];
var element = item && item.element;
return { browserEvent: browserEvent, index: index, element: element };
};
ListView.prototype.onScroll = function (e) {
try {
this.render(e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
if (this.supportDynamicHeights) {
this._rerender(e.scrollTop, e.height);
}
}
catch (err) {
console.error('Got bad scroll event:', e);
throw err;
}
};
ListView.prototype.onTouchChange = function (event) {
event.preventDefault();
event.stopPropagation();
this.scrollTop -= event.translationY;
};
// DND
ListView.prototype.onDragStart = function (element, uri, event) {
if (!event.dataTransfer) {
return;
}
var elements = this.dnd.getDragElements(element);
event.dataTransfer.effectAllowed = 'copyMove';
event.dataTransfer.setData(dnd["a" /* DataTransfers */].RESOURCES, JSON.stringify([uri]));
if (event.dataTransfer.setDragImage) {
var label = void 0;
if (this.dnd.getDragLabel) {
label = this.dnd.getDragLabel(elements, event);
}
if (typeof label === 'undefined') {
label = String(elements.length);
}
var dragImage_1 = dom["a" /* $ */]('.monaco-drag-image');
dragImage_1.textContent = label;
document.body.appendChild(dragImage_1);
event.dataTransfer.setDragImage(dragImage_1, -10, -10);
setTimeout(function () { return document.body.removeChild(dragImage_1); }, 0);
}
this.currentDragData = new ElementsDragAndDropData(elements);
dnd["c" /* StaticDND */].CurrentDragAndDropData = new ExternalElementsDragAndDropData(elements);
if (this.dnd.onDragStart) {
this.dnd.onDragStart(this.currentDragData, event);
}
};
ListView.prototype.onDragOver = function (event) {
var _this = this;
event.browserEvent.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
this.onDragLeaveTimeout.dispose();
if (dnd["c" /* StaticDND */].CurrentDragAndDropData && dnd["c" /* StaticDND */].CurrentDragAndDropData.getData() === 'vscode-ui') {
return false;
}
this.setupDragAndDropScrollTopAnimation(event.browserEvent);
if (!event.browserEvent.dataTransfer) {
return false;
}
// Drag over from outside
if (!this.currentDragData) {
if (dnd["c" /* StaticDND */].CurrentDragAndDropData) {
// Drag over from another list
this.currentDragData = dnd["c" /* StaticDND */].CurrentDragAndDropData;
}
else {
// Drag over from the desktop
if (!event.browserEvent.dataTransfer.types) {
return false;
}
this.currentDragData = new DesktopDragAndDropData();
}
}
var result = this.dnd.onDragOver(this.currentDragData, event.element, event.index, event.browserEvent);
this.canDrop = typeof result === 'boolean' ? result : result.accept;
if (!this.canDrop) {
this.currentDragFeedback = undefined;
this.currentDragFeedbackDisposable.dispose();
return false;
}
event.browserEvent.dataTransfer.dropEffect = (typeof result !== 'boolean' && result.effect === 0 /* Copy */) ? 'copy' : 'move';
var feedback;
if (typeof result !== 'boolean' && result.feedback) {
feedback = result.feedback;
}
else {
if (typeof event.index === 'undefined') {
feedback = [-1];
}
else {
feedback = [event.index];
}
}
// sanitize feedback list
feedback = Object(arrays["e" /* distinct */])(feedback).filter(function (i) { return i >= -1 && i < _this.length; }).sort(function (a, b) { return a - b; });
feedback = feedback[0] === -1 ? [-1] : feedback;
if (equalsDragFeedback(this.currentDragFeedback, feedback)) {
return true;
}
this.currentDragFeedback = feedback;
this.currentDragFeedbackDisposable.dispose();
if (feedback[0] === -1) { // entire list feedback
dom["f" /* addClass */](this.domNode, 'drop-target');
dom["f" /* addClass */](this.rowsContainer, 'drop-target');
this.currentDragFeedbackDisposable = Object(lifecycle["h" /* toDisposable */])(function () {
dom["P" /* removeClass */](_this.domNode, 'drop-target');
dom["P" /* removeClass */](_this.rowsContainer, 'drop-target');
});
}
else {
for (var _i = 0, feedback_1 = feedback; _i < feedback_1.length; _i++) {
var index = feedback_1[_i];
var item = this.items[index];
item.dropTarget = true;
if (item.row && item.row.domNode) {
dom["f" /* addClass */](item.row.domNode, 'drop-target');
}
}
this.currentDragFeedbackDisposable = Object(lifecycle["h" /* toDisposable */])(function () {
for (var _i = 0, feedback_2 = feedback; _i < feedback_2.length; _i++) {
var index = feedback_2[_i];
var item = _this.items[index];
item.dropTarget = false;
if (item.row && item.row.domNode) {
dom["P" /* removeClass */](item.row.domNode, 'drop-target');
}
}
});
}
return true;
};
ListView.prototype.onDragLeave = function () {
var _this = this;
this.onDragLeaveTimeout.dispose();
this.onDragLeaveTimeout = Object(common_async["g" /* disposableTimeout */])(function () { return _this.clearDragOverFeedback(); }, 100);
};
ListView.prototype.onDrop = function (event) {
if (!this.canDrop) {
return;
}
var dragData = this.currentDragData;
this.teardownDragAndDropScrollTopAnimation();
this.clearDragOverFeedback();
this.currentDragData = undefined;
dnd["c" /* StaticDND */].CurrentDragAndDropData = undefined;
if (!dragData || !event.browserEvent.dataTransfer) {
return;
}
event.browserEvent.preventDefault();
dragData.update(event.browserEvent.dataTransfer);
this.dnd.drop(dragData, event.element, event.index, event.browserEvent);
};
ListView.prototype.onDragEnd = function (event) {
this.canDrop = false;
this.teardownDragAndDropScrollTopAnimation();
this.clearDragOverFeedback();
this.currentDragData = undefined;
dnd["c" /* StaticDND */].CurrentDragAndDropData = undefined;
if (this.dnd.onDragEnd) {
this.dnd.onDragEnd(event);
}
};
ListView.prototype.clearDragOverFeedback = function () {
this.currentDragFeedback = undefined;
this.currentDragFeedbackDisposable.dispose();
this.currentDragFeedbackDisposable = lifecycle["a" /* Disposable */].None;
};
// DND scroll top animation
ListView.prototype.setupDragAndDropScrollTopAnimation = function (event) {
var _this = this;
if (!this.dragOverAnimationDisposable) {
var viewTop = dom["F" /* getTopLeftOffset */](this.domNode).top;
this.dragOverAnimationDisposable = dom["p" /* animate */](this.animateDragAndDropScrollTop.bind(this, viewTop));
}
this.dragOverAnimationStopDisposable.dispose();
this.dragOverAnimationStopDisposable = Object(common_async["g" /* disposableTimeout */])(function () {
if (_this.dragOverAnimationDisposable) {
_this.dragOverAnimationDisposable.dispose();
_this.dragOverAnimationDisposable = undefined;
}
}, 1000);
this.dragOverMouseY = event.pageY;
};
ListView.prototype.animateDragAndDropScrollTop = function (viewTop) {
if (this.dragOverMouseY === undefined) {
return;
}
var diff = this.dragOverMouseY - viewTop;
var 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)));
}
};
ListView.prototype.teardownDragAndDropScrollTopAnimation = function () {
this.dragOverAnimationStopDisposable.dispose();
if (this.dragOverAnimationDisposable) {
this.dragOverAnimationDisposable.dispose();
this.dragOverAnimationDisposable = undefined;
}
};
// Util
ListView.prototype.getItemIndexFromEventTarget = function (target) {
var element = target;
while (element instanceof HTMLElement && element !== this.rowsContainer) {
var rawIndex = element.getAttribute('data-index');
if (rawIndex) {
var index = Number(rawIndex);
if (!isNaN(index)) {
return index;
}
}
element = element.parentElement;
}
return undefined;
};
ListView.prototype.getRenderRange = function (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.
*/
ListView.prototype._rerender = function (renderTop, renderHeight) {
var previousRenderRange = this.getRenderRange(renderTop, renderHeight);
// Let's remember the second element's position, this helps in scrolling up
// and preserving a linear upwards scroll movement
var anchorElementIndex;
var 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;
}
var heightDiff = 0;
while (true) {
var renderRange = this.getRenderRange(renderTop, renderHeight);
var didChange = false;
for (var i = renderRange.start; i < renderRange.end; i++) {
var diff = this.probeDynamicHeight(i);
if (diff !== 0) {
this.rangeMap.splice(i, 1, [this.items[i]]);
}
heightDiff += diff;
didChange = didChange || diff !== 0;
}
if (!didChange) {
if (heightDiff !== 0) {
this.eventuallyUpdateScrollDimensions();
}
var unrenderRanges = common_range["a" /* Range */].relativeComplement(previousRenderRange, renderRange);
for (var _i = 0, unrenderRanges_1 = unrenderRanges; _i < unrenderRanges_1.length; _i++) {
var range = unrenderRanges_1[_i];
for (var i = range.start; i < range.end; i++) {
if (this.items[i].row) {
this.removeItemFromDOM(i);
}
}
}
var renderRanges = common_range["a" /* Range */].relativeComplement(renderRange, previousRenderRange);
for (var _a = 0, renderRanges_1 = renderRanges; _a < renderRanges_1.length; _a++) {
var range = renderRanges_1[_a];
for (var i = range.start; i < range.end; i++) {
var afterIndex = i + 1;
var beforeRow = afterIndex < this.items.length ? this.items[afterIndex].row : null;
var beforeElement = beforeRow ? beforeRow.domNode : null;
this.insertItemInDOM(i, beforeElement);
}
}
for (var i = renderRange.start; i < renderRange.end; i++) {
if (this.items[i].row) {
this.updateItemInDOM(this.items[i], i);
}
}
if (typeof anchorElementIndex === 'number') {
this.scrollTop = this.elementTop(anchorElementIndex) - anchorElementTopDelta;
}
this._onDidChangeContentHeight.fire(this.contentHeight);
return;
}
}
};
ListView.prototype.probeDynamicHeight = function (index) {
var item = this.items[index];
if (!item.hasDynamicHeight || item.lastDynamicHeightWidth === this.renderWidth) {
return 0;
}
var size = item.size;
var row = this.cache.alloc(item.templateId);
row.domNode.style.height = '';
this.rowsContainer.appendChild(row.domNode);
var renderer = this.renderers.get(item.templateId);
if (renderer) {
renderer.renderElement(item.element, index, row.templateData, undefined);
if (renderer.disposeElement) {
renderer.disposeElement(item.element, index, row.templateData, undefined);
}
}
item.size = row.domNode.offsetHeight;
if (this.virtualDelegate.setDynamicHeight) {
this.virtualDelegate.setDynamicHeight(item.element, item.size);
}
item.lastDynamicHeightWidth = this.renderWidth;
this.rowsContainer.removeChild(row.domNode);
this.cache.release(row);
return item.size - size;
};
ListView.prototype.getNextToLastElement = function (ranges) {
var lastRange = ranges[ranges.length - 1];
if (!lastRange) {
return null;
}
var nextToLastItem = this.items[lastRange.end];
if (!nextToLastItem) {
return null;
}
if (!nextToLastItem.row) {
return null;
}
return nextToLastItem.row.domNode;
};
ListView.prototype.getElementDomId = function (index) {
return this.domId + "_" + index;
};
// Dispose
ListView.prototype.dispose = function () {
if (this.items) {
for (var _i = 0, _a = this.items; _i < _a.length; _i++) {
var item = _a[_i];
if (item.row) {
var renderer = this.renderers.get(item.row.templateId);
if (renderer) {
renderer.disposeTemplate(item.row.templateData);
}
}
}
this.items = [];
}
if (this.domNode && this.domNode.parentNode) {
this.domNode.parentNode.removeChild(this.domNode);
}
Object(lifecycle["f" /* dispose */])(this.disposables);
};
ListView.InstanceCount = 0;
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onMouseClick", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onMouseDblClick", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onMouseMiddleClick", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onMouseDown", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onContextMenu", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onTouchStart", null);
__decorate([
decorators["a" /* memoize */]
], ListView.prototype, "onTap", null);
return ListView;
}());
/***/ }),
/* 156 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SyncDescriptor; });
var SyncDescriptor = /** @class */ (function () {
function SyncDescriptor(ctor, staticArguments, supportsDelayedInstantiation) {
if (staticArguments === void 0) { staticArguments = []; }
if (supportsDelayedInstantiation === void 0) { supportsDelayedInstantiation = false; }
this.ctor = ctor;
this.staticArguments = staticArguments;
this.supportsDelayedInstantiation = supportsDelayedInstantiation;
}
return SyncDescriptor;
}());
/***/ }),
/* 157 */
/***/ (function(module, exports) {
module.exports = require("fs");
/***/ }),
/* 158 */
/***/ (function(module, exports) {
module.exports = require("url");
/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {
// Contains the interpretation of CSS properties, as used by the property optimizer
var breakUp = __webpack_require__(402);
var canOverride = __webpack_require__(403);
var restore = __webpack_require__(405);
var override = __webpack_require__(170);
// Properties to process
// Extend this object in order to add support for more properties in the optimizer.
//
// Each key in this object represents a CSS property and should be an object.
// Such an object contains properties that describe how the represented CSS property should be handled.
// Possible options:
//
// * components: array (Only specify for shorthand properties.)
// Contains the names of the granular properties this shorthand compacts.
//
// * canOverride: function
// Returns whether two tokens of this property can be merged with each other.
// This property has no meaning for shorthands.
//
// * defaultValue: string
// Specifies the default value of the property according to the CSS standard.
// For shorthand, this is used when every component is set to its default value, therefore it should be the shortest possible default value of all the components.
//
// * shortestValue: string
// Specifies the shortest possible value the property can possibly have.
// (Falls back to defaultValue if unspecified.)
//
// * breakUp: function (Only specify for shorthand properties.)
// Breaks the shorthand up to its components.
//
// * restore: function (Only specify for shorthand properties.)
// Puts the shorthand together from its components.
//
var compactable = {
'animation': {
canOverride: canOverride.generic.components([
canOverride.generic.time,
canOverride.generic.timingFunction,
canOverride.generic.time,
canOverride.property.animationIterationCount,
canOverride.property.animationDirection,
canOverride.property.animationFillMode,
canOverride.property.animationPlayState,
canOverride.property.animationName
]),
components: [
'animation-duration',
'animation-timing-function',
'animation-delay',
'animation-iteration-count',
'animation-direction',
'animation-fill-mode',
'animation-play-state',
'animation-name'
],
breakUp: breakUp.multiplex(breakUp.animation),
defaultValue: 'none',
restore: restore.multiplex(restore.withoutDefaults),
shorthand: true,
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-delay': {
canOverride: canOverride.generic.time,
componentOf: [
'animation'
],
defaultValue: '0s',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-direction': {
canOverride: canOverride.property.animationDirection,
componentOf: [
'animation'
],
defaultValue: 'normal',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-duration': {
canOverride: canOverride.generic.time,
componentOf: [
'animation'
],
defaultValue: '0s',
intoMultiplexMode: 'real',
keepUnlessDefault: 'animation-delay',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-fill-mode': {
canOverride: canOverride.property.animationFillMode,
componentOf: [
'animation'
],
defaultValue: 'none',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-iteration-count': {
canOverride: canOverride.property.animationIterationCount,
componentOf: [
'animation'
],
defaultValue: '1',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-name': {
canOverride: canOverride.property.animationName,
componentOf: [
'animation'
],
defaultValue: 'none',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-play-state': {
canOverride: canOverride.property.animationPlayState,
componentOf: [
'animation'
],
defaultValue: 'running',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'animation-timing-function': {
canOverride: canOverride.generic.timingFunction,
componentOf: [
'animation'
],
defaultValue: 'ease',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'background': {
canOverride: canOverride.generic.components([
canOverride.generic.image,
canOverride.property.backgroundPosition,
canOverride.property.backgroundSize,
canOverride.property.backgroundRepeat,
canOverride.property.backgroundAttachment,
canOverride.property.backgroundOrigin,
canOverride.property.backgroundClip,
canOverride.generic.color
]),
components: [
'background-image',
'background-position',
'background-size',
'background-repeat',
'background-attachment',
'background-origin',
'background-clip',
'background-color'
],
breakUp: breakUp.multiplex(breakUp.background),
defaultValue: '0 0',
restore: restore.multiplex(restore.background),
shortestValue: '0',
shorthand: true
},
'background-attachment': {
canOverride: canOverride.property.backgroundAttachment,
componentOf: [
'background'
],
defaultValue: 'scroll',
intoMultiplexMode: 'real'
},
'background-clip': {
canOverride: canOverride.property.backgroundClip,
componentOf: [
'background'
],
defaultValue: 'border-box',
intoMultiplexMode: 'real',
shortestValue: 'border-box'
},
'background-color': {
canOverride: canOverride.generic.color,
componentOf: [
'background'
],
defaultValue: 'transparent',
intoMultiplexMode: 'real', // otherwise real color will turn into default since color appears in last multiplex only
multiplexLastOnly: true,
nonMergeableValue: 'none',
shortestValue: 'red'
},
'background-image': {
canOverride: canOverride.generic.image,
componentOf: [
'background'
],
defaultValue: 'none',
intoMultiplexMode: 'default'
},
'background-origin': {
canOverride: canOverride.property.backgroundOrigin,
componentOf: [
'background'
],
defaultValue: 'padding-box',
intoMultiplexMode: 'real',
shortestValue: 'border-box'
},
'background-position': {
canOverride: canOverride.property.backgroundPosition,
componentOf: [
'background'
],
defaultValue: ['0', '0'],
doubleValues: true,
intoMultiplexMode: 'real',
shortestValue: '0'
},
'background-repeat': {
canOverride: canOverride.property.backgroundRepeat,
componentOf: [
'background'
],
defaultValue: ['repeat'],
doubleValues: true,
intoMultiplexMode: 'real'
},
'background-size': {
canOverride: canOverride.property.backgroundSize,
componentOf: [
'background'
],
defaultValue: ['auto'],
doubleValues: true,
intoMultiplexMode: 'real',
shortestValue: '0 0'
},
'bottom': {
canOverride: canOverride.property.bottom,
defaultValue: 'auto'
},
'border': {
breakUp: breakUp.border,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.property.borderStyle,
canOverride.generic.color
]),
components: [
'border-width',
'border-style',
'border-color'
],
defaultValue: 'none',
overridesShorthands: [
'border-bottom',
'border-left',
'border-right',
'border-top'
],
restore: restore.withoutDefaults,
shorthand: true,
shorthandComponents: true
},
'border-bottom': {
breakUp: breakUp.border,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.property.borderStyle,
canOverride.generic.color
]),
components: [
'border-bottom-width',
'border-bottom-style',
'border-bottom-color'
],
defaultValue: 'none',
restore: restore.withoutDefaults,
shorthand: true
},
'border-bottom-color': {
canOverride: canOverride.generic.color,
componentOf: [
'border-bottom',
'border-color'
],
defaultValue: 'none'
},
'border-bottom-left-radius': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-radius'
],
defaultValue: '0',
vendorPrefixes: [
'-moz-',
'-o-'
]
},
'border-bottom-right-radius': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-radius'
],
defaultValue: '0',
vendorPrefixes: [
'-moz-',
'-o-'
]
},
'border-bottom-style': {
canOverride: canOverride.property.borderStyle,
componentOf: [
'border-bottom',
'border-style'
],
defaultValue: 'none'
},
'border-bottom-width': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-bottom',
'border-width'
],
defaultValue: 'medium',
oppositeTo: 'border-top-width',
shortestValue: '0'
},
'border-collapse': {
canOverride: canOverride.property.borderCollapse,
defaultValue: 'separate'
},
'border-color': {
breakUp: breakUp.fourValues,
canOverride: canOverride.generic.components([
canOverride.generic.color,
canOverride.generic.color,
canOverride.generic.color,
canOverride.generic.color
]),
componentOf: [
'border'
],
components: [
'border-top-color',
'border-right-color',
'border-bottom-color',
'border-left-color'
],
defaultValue: 'none',
restore: restore.fourValues,
shortestValue: 'red',
shorthand: true
},
'border-left': {
breakUp: breakUp.border,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.property.borderStyle,
canOverride.generic.color
]),
components: [
'border-left-width',
'border-left-style',
'border-left-color'
],
defaultValue: 'none',
restore: restore.withoutDefaults,
shorthand: true
},
'border-left-color': {
canOverride: canOverride.generic.color,
componentOf: [
'border-color',
'border-left'
],
defaultValue: 'none'
},
'border-left-style': {
canOverride: canOverride.property.borderStyle,
componentOf: [
'border-left',
'border-style'
],
defaultValue: 'none'
},
'border-left-width': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-left',
'border-width'
],
defaultValue: 'medium',
oppositeTo: 'border-right-width',
shortestValue: '0'
},
'border-radius': {
breakUp: breakUp.borderRadius,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit
]),
components: [
'border-top-left-radius',
'border-top-right-radius',
'border-bottom-right-radius',
'border-bottom-left-radius'
],
defaultValue: '0',
restore: restore.borderRadius,
shorthand: true,
vendorPrefixes: [
'-moz-',
'-o-'
]
},
'border-right': {
breakUp: breakUp.border,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.property.borderStyle,
canOverride.generic.color
]),
components: [
'border-right-width',
'border-right-style',
'border-right-color'
],
defaultValue: 'none',
restore: restore.withoutDefaults,
shorthand: true
},
'border-right-color': {
canOverride: canOverride.generic.color,
componentOf: [
'border-color',
'border-right'
],
defaultValue: 'none'
},
'border-right-style': {
canOverride: canOverride.property.borderStyle,
componentOf: [
'border-right',
'border-style'
],
defaultValue: 'none'
},
'border-right-width': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-right',
'border-width'
],
defaultValue: 'medium',
oppositeTo: 'border-left-width',
shortestValue: '0'
},
'border-style': {
breakUp: breakUp.fourValues,
canOverride: canOverride.generic.components([
canOverride.property.borderStyle,
canOverride.property.borderStyle,
canOverride.property.borderStyle,
canOverride.property.borderStyle
]),
componentOf: [
'border'
],
components: [
'border-top-style',
'border-right-style',
'border-bottom-style',
'border-left-style'
],
defaultValue: 'none',
restore: restore.fourValues,
shorthand: true
},
'border-top': {
breakUp: breakUp.border,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.property.borderStyle,
canOverride.generic.color
]),
components: [
'border-top-width',
'border-top-style',
'border-top-color'
],
defaultValue: 'none',
restore: restore.withoutDefaults,
shorthand: true
},
'border-top-color': {
canOverride: canOverride.generic.color,
componentOf: [
'border-color',
'border-top'
],
defaultValue: 'none'
},
'border-top-left-radius': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-radius'
],
defaultValue: '0',
vendorPrefixes: [
'-moz-',
'-o-'
]
},
'border-top-right-radius': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-radius'
],
defaultValue: '0',
vendorPrefixes: [
'-moz-',
'-o-'
]
},
'border-top-style': {
canOverride: canOverride.property.borderStyle,
componentOf: [
'border-style',
'border-top'
],
defaultValue: 'none'
},
'border-top-width': {
canOverride: canOverride.generic.unit,
componentOf: [
'border-top',
'border-width'
],
defaultValue: 'medium',
oppositeTo: 'border-bottom-width',
shortestValue: '0'
},
'border-width': {
breakUp: breakUp.fourValues,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit
]),
componentOf: [
'border'
],
components: [
'border-top-width',
'border-right-width',
'border-bottom-width',
'border-left-width'
],
defaultValue: 'medium',
restore: restore.fourValues,
shortestValue: '0',
shorthand: true
},
'clear': {
canOverride: canOverride.property.clear,
defaultValue: 'none'
},
'color': {
canOverride: canOverride.generic.color,
defaultValue: 'transparent',
shortestValue: 'red'
},
'cursor': {
canOverride: canOverride.property.cursor,
defaultValue: 'auto'
},
'display': {
canOverride: canOverride.property.display,
},
'float': {
canOverride: canOverride.property.float,
defaultValue: 'none'
},
'font': {
breakUp: breakUp.font,
canOverride: canOverride.generic.components([
canOverride.property.fontStyle,
canOverride.property.fontVariant,
canOverride.property.fontWeight,
canOverride.property.fontStretch,
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.property.fontFamily
]),
components: [
'font-style',
'font-variant',
'font-weight',
'font-stretch',
'font-size',
'line-height',
'font-family'
],
restore: restore.font,
shorthand: true
},
'font-family': {
canOverride: canOverride.property.fontFamily,
defaultValue: 'user|agent|specific'
},
'font-size': {
canOverride: canOverride.generic.unit,
defaultValue: 'medium',
shortestValue: '0'
},
'font-stretch': {
canOverride: canOverride.property.fontStretch,
defaultValue: 'normal'
},
'font-style': {
canOverride: canOverride.property.fontStyle,
defaultValue: 'normal'
},
'font-variant': {
canOverride: canOverride.property.fontVariant,
defaultValue: 'normal'
},
'font-weight': {
canOverride: canOverride.property.fontWeight,
defaultValue: 'normal',
shortestValue: '400'
},
'height': {
canOverride: canOverride.generic.unit,
defaultValue: 'auto',
shortestValue: '0'
},
'left': {
canOverride: canOverride.property.left,
defaultValue: 'auto'
},
'line-height': {
canOverride: canOverride.generic.unitOrNumber,
defaultValue: 'normal',
shortestValue: '0'
},
'list-style': {
canOverride: canOverride.generic.components([
canOverride.property.listStyleType,
canOverride.property.listStylePosition,
canOverride.property.listStyleImage
]),
components: [
'list-style-type',
'list-style-position',
'list-style-image'
],
breakUp: breakUp.listStyle,
restore: restore.withoutDefaults,
defaultValue: 'outside', // can't use 'disc' because that'd override default 'decimal' for
shortestValue: 'none',
shorthand: true
},
'list-style-image' : {
canOverride: canOverride.generic.image,
componentOf: [
'list-style'
],
defaultValue: 'none'
},
'list-style-position' : {
canOverride: canOverride.property.listStylePosition,
componentOf: [
'list-style'
],
defaultValue: 'outside',
shortestValue: 'inside'
},
'list-style-type' : {
canOverride: canOverride.property.listStyleType,
componentOf: [
'list-style'
],
// NOTE: we can't tell the real default value here, it's 'disc' for
and 'decimal' for
// this is a hack, but it doesn't matter because this value will be either overridden or
// it will disappear at the final step anyway
defaultValue: 'decimal|disc',
shortestValue: 'none'
},
'margin': {
breakUp: breakUp.fourValues,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit
]),
components: [
'margin-top',
'margin-right',
'margin-bottom',
'margin-left'
],
defaultValue: '0',
restore: restore.fourValues,
shorthand: true
},
'margin-bottom': {
canOverride: canOverride.generic.unit,
componentOf: [
'margin'
],
defaultValue: '0',
oppositeTo: 'margin-top'
},
'margin-left': {
canOverride: canOverride.generic.unit,
componentOf: [
'margin'
],
defaultValue: '0',
oppositeTo: 'margin-right'
},
'margin-right': {
canOverride: canOverride.generic.unit,
componentOf: [
'margin'
],
defaultValue: '0',
oppositeTo: 'margin-left'
},
'margin-top': {
canOverride: canOverride.generic.unit,
componentOf: [
'margin'
],
defaultValue: '0',
oppositeTo: 'margin-bottom'
},
'outline': {
canOverride: canOverride.generic.components([
canOverride.generic.color,
canOverride.property.outlineStyle,
canOverride.generic.unit
]),
components: [
'outline-color',
'outline-style',
'outline-width'
],
breakUp: breakUp.outline,
restore: restore.withoutDefaults,
defaultValue: '0',
shorthand: true
},
'outline-color': {
canOverride: canOverride.generic.color,
componentOf: [
'outline'
],
defaultValue: 'invert',
shortestValue: 'red'
},
'outline-style': {
canOverride: canOverride.property.outlineStyle,
componentOf: [
'outline'
],
defaultValue: 'none'
},
'outline-width': {
canOverride: canOverride.generic.unit,
componentOf: [
'outline'
],
defaultValue: 'medium',
shortestValue: '0'
},
'overflow': {
canOverride: canOverride.property.overflow,
defaultValue: 'visible'
},
'overflow-x': {
canOverride: canOverride.property.overflow,
defaultValue: 'visible'
},
'overflow-y': {
canOverride: canOverride.property.overflow,
defaultValue: 'visible'
},
'padding': {
breakUp: breakUp.fourValues,
canOverride: canOverride.generic.components([
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit,
canOverride.generic.unit
]),
components: [
'padding-top',
'padding-right',
'padding-bottom',
'padding-left'
],
defaultValue: '0',
restore: restore.fourValues,
shorthand: true
},
'padding-bottom': {
canOverride: canOverride.generic.unit,
componentOf: [
'padding'
],
defaultValue: '0',
oppositeTo: 'padding-top'
},
'padding-left': {
canOverride: canOverride.generic.unit,
componentOf: [
'padding'
],
defaultValue: '0',
oppositeTo: 'padding-right'
},
'padding-right': {
canOverride: canOverride.generic.unit,
componentOf: [
'padding'
],
defaultValue: '0',
oppositeTo: 'padding-left'
},
'padding-top': {
canOverride: canOverride.generic.unit,
componentOf: [
'padding'
],
defaultValue: '0',
oppositeTo: 'padding-bottom'
},
'position': {
canOverride: canOverride.property.position,
defaultValue: 'static'
},
'right': {
canOverride: canOverride.property.right,
defaultValue: 'auto'
},
'text-align': {
canOverride: canOverride.property.textAlign,
// NOTE: we can't tell the real default value here, as it depends on default text direction
// this is a hack, but it doesn't matter because this value will be either overridden or
// it will disappear anyway
defaultValue: 'left|right'
},
'text-decoration': {
canOverride: canOverride.property.textDecoration,
defaultValue: 'none'
},
'text-overflow': {
canOverride: canOverride.property.textOverflow,
defaultValue: 'none'
},
'text-shadow': {
canOverride: canOverride.property.textShadow,
defaultValue: 'none'
},
'top': {
canOverride: canOverride.property.top,
defaultValue: 'auto'
},
'transform': {
canOverride: canOverride.property.transform,
vendorPrefixes: [
'-moz-',
'-ms-',
'-webkit-'
]
},
'transition': {
breakUp: breakUp.multiplex(breakUp.transition),
canOverride: canOverride.generic.components([
canOverride.property.transitionProperty,
canOverride.generic.time,
canOverride.generic.timingFunction,
canOverride.generic.time
]),
components: [
'transition-property',
'transition-duration',
'transition-timing-function',
'transition-delay'
],
defaultValue: 'none',
restore: restore.multiplex(restore.withoutDefaults),
shorthand: true,
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'transition-delay': {
canOverride: canOverride.generic.time,
componentOf: [
'transition'
],
defaultValue: '0s',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'transition-duration': {
canOverride: canOverride.generic.time,
componentOf: [
'transition'
],
defaultValue: '0s',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'transition-property': {
canOverride: canOverride.generic.propertyName,
componentOf: [
'transition'
],
defaultValue: 'all',
intoMultiplexMode: 'placeholder',
placeholderValue: '_', // it's a short value that won't match any property and still be a valid `transition-property`
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'transition-timing-function': {
canOverride: canOverride.generic.timingFunction,
componentOf: [
'transition'
],
defaultValue: 'ease',
intoMultiplexMode: 'real',
vendorPrefixes: [
'-moz-',
'-o-',
'-webkit-'
]
},
'vertical-align': {
canOverride: canOverride.property.verticalAlign,
defaultValue: 'baseline'
},
'visibility': {
canOverride: canOverride.property.visibility,
defaultValue: 'visible'
},
'white-space': {
canOverride: canOverride.property.whiteSpace,
defaultValue: 'normal'
},
'width': {
canOverride: canOverride.generic.unit,
defaultValue: 'auto',
shortestValue: '0'
},
'z-index': {
canOverride: canOverride.property.zIndex,
defaultValue: 'auto'
}
};
function cloneDescriptor(propertyName, prefix) {
var clonedDescriptor = override(compactable[propertyName], {});
if ('componentOf' in clonedDescriptor) {
clonedDescriptor.componentOf = clonedDescriptor.componentOf.map(function (shorthandName) {
return prefix + shorthandName;
});
}
if ('components' in clonedDescriptor) {
clonedDescriptor.components = clonedDescriptor.components.map(function (longhandName) {
return prefix + longhandName;
});
}
if ('keepUnlessDefault' in clonedDescriptor) {
clonedDescriptor.keepUnlessDefault = prefix + clonedDescriptor.keepUnlessDefault;
}
return clonedDescriptor;
}
// generate vendor-prefixed properties
var vendorPrefixedCompactable = {};
for (var propertyName in compactable) {
var descriptor = compactable[propertyName];
if (!('vendorPrefixes' in descriptor)) {
continue;
}
for (var i = 0; i < descriptor.vendorPrefixes.length; i++) {
var prefix = descriptor.vendorPrefixes[i];
var clonedDescriptor = cloneDescriptor(propertyName, prefix);
delete clonedDescriptor.vendorPrefixes;
vendorPrefixedCompactable[prefix + propertyName] = clonedDescriptor;
}
delete descriptor.vendorPrefixes;
}
module.exports = override(compactable, vendorPrefixedCompactable);
/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(148);
var core = __webpack_require__(108);
var ctx = __webpack_require__(323);
var hide = __webpack_require__(172);
var has = __webpack_require__(163);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && has(exports, key)) continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 161 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(175)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 163 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 164 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ codeEditorWidget_CodeEditorWidget; });
// UNUSED EXPORTS: BooleanEventEmitter, EditorModeContext
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/widget/media/editor.css
var media_editor = __webpack_require__(622);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/nls.js
var nls = __webpack_require__(1);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/dom.js
var dom = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/errors.js
var errors = __webpack_require__(16);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/event.js
var common_event = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/lifecycle.js
var lifecycle = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/network.js
var network = __webpack_require__(37);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/config/configuration.js + 1 modules
var config_configuration = __webpack_require__(71);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/editorExtensions.js
var editorExtensions = __webpack_require__(7);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/services/codeEditorService.js
var services_codeEditorService = __webpack_require__(36);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/fastDomNode.js
var fastDomNode = __webpack_require__(29);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/platform.js
var platform = __webpack_require__(17);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/touch.js
var touch = __webpack_require__(54);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/browser.js
var browser = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/mouseEvent.js
var mouseEvent = __webpack_require__(46);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/async.js
var common_async = __webpack_require__(20);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/globalMouseMoveMonitor.js
var globalMouseMoveMonitor = __webpack_require__(89);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/editorDom.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Coordinates relative to the whole document (e.g. mouse event's pageX and pageY)
*/
var editorDom_PageCoordinates = /** @class */ (function () {
function PageCoordinates(x, y) {
this.x = x;
this.y = y;
}
PageCoordinates.prototype.toClientCoordinates = function () {
return new editorDom_ClientCoordinates(this.x - dom["e" /* StandardWindow */].scrollX, this.y - dom["e" /* StandardWindow */].scrollY);
};
return PageCoordinates;
}());
/**
* Coordinates within the application's client area (i.e. origin is document's scroll position).
*
* For example, clicking in the top-left corner of the client area will
* always result in a mouse event with a client.x value of 0, regardless
* of whether the page is scrolled horizontally.
*/
var editorDom_ClientCoordinates = /** @class */ (function () {
function ClientCoordinates(clientX, clientY) {
this.clientX = clientX;
this.clientY = clientY;
}
ClientCoordinates.prototype.toPageCoordinates = function () {
return new editorDom_PageCoordinates(this.clientX + dom["e" /* StandardWindow */].scrollX, this.clientY + dom["e" /* StandardWindow */].scrollY);
};
return ClientCoordinates;
}());
/**
* The position of the editor in the page.
*/
var EditorPagePosition = /** @class */ (function () {
function EditorPagePosition(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
return EditorPagePosition;
}());
function createEditorPagePosition(editorViewDomNode) {
var editorPos = dom["C" /* getDomNodePagePosition */](editorViewDomNode);
return new EditorPagePosition(editorPos.left, editorPos.top, editorPos.width, editorPos.height);
}
var EditorMouseEvent = /** @class */ (function (_super) {
__extends(EditorMouseEvent, _super);
function EditorMouseEvent(e, editorViewDomNode) {
var _this = _super.call(this, e) || this;
_this.pos = new editorDom_PageCoordinates(_this.posx, _this.posy);
_this.editorPos = createEditorPagePosition(editorViewDomNode);
return _this;
}
return EditorMouseEvent;
}(mouseEvent["b" /* StandardMouseEvent */]));
var editorDom_EditorMouseEventFactory = /** @class */ (function () {
function EditorMouseEventFactory(editorViewDomNode) {
this._editorViewDomNode = editorViewDomNode;
}
EditorMouseEventFactory.prototype._create = function (e) {
return new EditorMouseEvent(e, this._editorViewDomNode);
};
EditorMouseEventFactory.prototype.onContextMenu = function (target, callback) {
var _this = this;
return dom["j" /* addDisposableListener */](target, 'contextmenu', function (e) {
callback(_this._create(e));
});
};
EditorMouseEventFactory.prototype.onMouseUp = function (target, callback) {
var _this = this;
return dom["j" /* addDisposableListener */](target, 'mouseup', function (e) {
callback(_this._create(e));
});
};
EditorMouseEventFactory.prototype.onMouseDown = function (target, callback) {
var _this = this;
return dom["j" /* addDisposableListener */](target, 'mousedown', function (e) {
callback(_this._create(e));
});
};
EditorMouseEventFactory.prototype.onMouseLeave = function (target, callback) {
var _this = this;
return dom["k" /* addDisposableNonBubblingMouseOutListener */](target, function (e) {
callback(_this._create(e));
});
};
EditorMouseEventFactory.prototype.onMouseMoveThrottled = function (target, callback, merger, minimumTimeMs) {
var _this = this;
var myMerger = function (lastEvent, currentEvent) {
return merger(lastEvent, _this._create(currentEvent));
};
return dom["m" /* addDisposableThrottledListener */](target, 'mousemove', callback, myMerger, minimumTimeMs);
};
return EditorMouseEventFactory;
}());
var editorDom_EditorPointerEventFactory = /** @class */ (function () {
function EditorPointerEventFactory(editorViewDomNode) {
this._editorViewDomNode = editorViewDomNode;
}
EditorPointerEventFactory.prototype._create = function (e) {
return new EditorMouseEvent(e, this._editorViewDomNode);
};
EditorPointerEventFactory.prototype.onPointerUp = function (target, callback) {
var _this = this;
return dom["j" /* addDisposableListener */](target, 'pointerup', function (e) {
callback(_this._create(e));
});
};
EditorPointerEventFactory.prototype.onPointerDown = function (target, callback) {
var _this = this;
return dom["j" /* addDisposableListener */](target, 'pointerdown', function (e) {
callback(_this._create(e));
});
};
EditorPointerEventFactory.prototype.onPointerLeave = function (target, callback) {
var _this = this;
return dom["l" /* addDisposableNonBubblingPointerOutListener */](target, function (e) {
callback(_this._create(e));
});
};
EditorPointerEventFactory.prototype.onPointerMoveThrottled = function (target, callback, merger, minimumTimeMs) {
var _this = this;
var myMerger = function (lastEvent, currentEvent) {
return merger(lastEvent, _this._create(currentEvent));
};
return dom["m" /* addDisposableThrottledListener */](target, 'pointermove', callback, myMerger, minimumTimeMs);
};
return EditorPointerEventFactory;
}());
var editorDom_GlobalEditorMouseMoveMonitor = /** @class */ (function (_super) {
__extends(GlobalEditorMouseMoveMonitor, _super);
function GlobalEditorMouseMoveMonitor(editorViewDomNode) {
var _this = _super.call(this) || this;
_this._editorViewDomNode = editorViewDomNode;
_this._globalMouseMoveMonitor = _this._register(new globalMouseMoveMonitor["a" /* GlobalMouseMoveMonitor */]());
_this._keydownListener = null;
return _this;
}
GlobalEditorMouseMoveMonitor.prototype.startMonitoring = function (initialElement, initialButtons, merger, mouseMoveCallback, onStopCallback) {
var _this = this;
// Add a <> keydown event listener that will cancel the monitoring
// if something other than a modifier key is pressed
this._keydownListener = dom["o" /* addStandardDisposableListener */](document, 'keydown', function (e) {
var kb = e.toKeybinding();
if (kb.isModifierKey()) {
// Allow modifier keys
return;
}
_this._globalMouseMoveMonitor.stopMonitoring(true);
}, true);
var myMerger = function (lastEvent, currentEvent) {
return merger(lastEvent, new EditorMouseEvent(currentEvent, _this._editorViewDomNode));
};
this._globalMouseMoveMonitor.startMonitoring(initialElement, initialButtons, myMerger, mouseMoveCallback, function () {
_this._keydownListener.dispose();
onStopCallback();
});
};
return GlobalEditorMouseMoveMonitor;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewEventHandler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewEventHandler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ViewEventHandler = /** @class */ (function (_super) {
viewEventHandler_extends(ViewEventHandler, _super);
function ViewEventHandler() {
var _this = _super.call(this) || this;
_this._shouldRender = true;
return _this;
}
ViewEventHandler.prototype.shouldRender = function () {
return this._shouldRender;
};
ViewEventHandler.prototype.forceShouldRender = function () {
this._shouldRender = true;
};
ViewEventHandler.prototype.setShouldRender = function () {
this._shouldRender = true;
};
ViewEventHandler.prototype.onDidRender = function () {
this._shouldRender = false;
};
// --- begin event handlers
ViewEventHandler.prototype.onConfigurationChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onContentSizeChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onCursorStateChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onDecorationsChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onFlushed = function (e) {
return false;
};
ViewEventHandler.prototype.onFocusChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onLanguageConfigurationChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onLineMappingChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onLinesChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onLinesDeleted = function (e) {
return false;
};
ViewEventHandler.prototype.onLinesInserted = function (e) {
return false;
};
ViewEventHandler.prototype.onRevealRangeRequest = function (e) {
return false;
};
ViewEventHandler.prototype.onScrollChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onThemeChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onTokensChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onTokensColorsChanged = function (e) {
return false;
};
ViewEventHandler.prototype.onZonesChanged = function (e) {
return false;
};
// --- end event handlers
ViewEventHandler.prototype.handleEvents = function (events) {
var shouldRender = false;
for (var i = 0, len = events.length; i < len; i++) {
var e = events[i];
switch (e.type) {
case 1 /* ViewConfigurationChanged */:
if (this.onConfigurationChanged(e)) {
shouldRender = true;
}
break;
case 2 /* ViewContentSizeChanged */:
if (this.onContentSizeChanged(e)) {
shouldRender = true;
}
break;
case 3 /* ViewCursorStateChanged */:
if (this.onCursorStateChanged(e)) {
shouldRender = true;
}
break;
case 4 /* ViewDecorationsChanged */:
if (this.onDecorationsChanged(e)) {
shouldRender = true;
}
break;
case 5 /* ViewFlushed */:
if (this.onFlushed(e)) {
shouldRender = true;
}
break;
case 6 /* ViewFocusChanged */:
if (this.onFocusChanged(e)) {
shouldRender = true;
}
break;
case 7 /* ViewLanguageConfigurationChanged */:
if (this.onLanguageConfigurationChanged(e)) {
shouldRender = true;
}
break;
case 8 /* ViewLineMappingChanged */:
if (this.onLineMappingChanged(e)) {
shouldRender = true;
}
break;
case 9 /* ViewLinesChanged */:
if (this.onLinesChanged(e)) {
shouldRender = true;
}
break;
case 10 /* ViewLinesDeleted */:
if (this.onLinesDeleted(e)) {
shouldRender = true;
}
break;
case 11 /* ViewLinesInserted */:
if (this.onLinesInserted(e)) {
shouldRender = true;
}
break;
case 12 /* ViewRevealRangeRequest */:
if (this.onRevealRangeRequest(e)) {
shouldRender = true;
}
break;
case 13 /* ViewScrollChanged */:
if (this.onScrollChanged(e)) {
shouldRender = true;
}
break;
case 15 /* ViewTokensChanged */:
if (this.onTokensChanged(e)) {
shouldRender = true;
}
break;
case 14 /* ViewThemeChanged */:
if (this.onThemeChanged(e)) {
shouldRender = true;
}
break;
case 16 /* ViewTokensColorsChanged */:
if (this.onTokensColorsChanged(e)) {
shouldRender = true;
}
break;
case 17 /* ViewZonesChanged */:
if (this.onZonesChanged(e)) {
shouldRender = true;
}
break;
default:
console.info('View received unknown event: ');
console.info(e);
}
}
if (shouldRender) {
this._shouldRender = true;
}
};
return ViewEventHandler;
}(lifecycle["a" /* Disposable */]));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewPart.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewPart_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ViewPart = /** @class */ (function (_super) {
viewPart_extends(ViewPart, _super);
function ViewPart(context) {
var _this = _super.call(this) || this;
_this._context = context;
_this._context.addEventHandler(_this);
return _this;
}
ViewPart.prototype.dispose = function () {
this._context.removeEventHandler(this);
_super.prototype.dispose.call(this);
};
return ViewPart;
}(ViewEventHandler));
var viewPart_PartFingerprints = /** @class */ (function () {
function PartFingerprints() {
}
PartFingerprints.write = function (target, partId) {
if (target instanceof fastDomNode["a" /* FastDomNode */]) {
target.setAttribute('data-mprt', String(partId));
}
else {
target.setAttribute('data-mprt', String(partId));
}
};
PartFingerprints.read = function (target) {
var r = target.getAttribute('data-mprt');
if (r === null) {
return 0 /* None */;
}
return parseInt(r, 10);
};
PartFingerprints.collect = function (child, stopAt) {
var result = [], resultLen = 0;
while (child && child !== document.body) {
if (child === stopAt) {
break;
}
if (child.nodeType === child.ELEMENT_NODE) {
result[resultLen++] = this.read(child);
}
child = child.parentElement;
}
var r = new Uint8Array(resultLen);
for (var i = 0; i < resultLen; i++) {
r[i] = result[resultLen - i - 1];
}
return r;
};
return PartFingerprints;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/renderingContext.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var renderingContext_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var RestrictedRenderingContext = /** @class */ (function () {
function RestrictedRenderingContext(viewLayout, viewportData) {
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;
var vInfo = this._viewLayout.getCurrentViewport();
this.scrollTop = vInfo.top;
this.scrollLeft = vInfo.left;
this.viewportWidth = vInfo.width;
this.viewportHeight = vInfo.height;
}
RestrictedRenderingContext.prototype.getScrolledTopFromAbsoluteTop = function (absoluteTop) {
return absoluteTop - this.scrollTop;
};
RestrictedRenderingContext.prototype.getVerticalOffsetForLineNumber = function (lineNumber) {
return this._viewLayout.getVerticalOffsetForLineNumber(lineNumber);
};
RestrictedRenderingContext.prototype.getDecorationsInViewport = function () {
return this.viewportData.getDecorationsInViewport();
};
return RestrictedRenderingContext;
}());
var RenderingContext = /** @class */ (function (_super) {
renderingContext_extends(RenderingContext, _super);
function RenderingContext(viewLayout, viewportData, viewLines) {
var _this = _super.call(this, viewLayout, viewportData) || this;
_this._viewLines = viewLines;
return _this;
}
RenderingContext.prototype.linesVisibleRangesForRange = function (range, includeNewLines) {
return this._viewLines.linesVisibleRangesForRange(range, includeNewLines);
};
RenderingContext.prototype.visibleRangeForPosition = function (position) {
return this._viewLines.visibleRangeForPosition(position);
};
return RenderingContext;
}(RestrictedRenderingContext));
var LineVisibleRanges = /** @class */ (function () {
function LineVisibleRanges(outsideRenderedLine, lineNumber, ranges) {
this.outsideRenderedLine = outsideRenderedLine;
this.lineNumber = lineNumber;
this.ranges = ranges;
}
return LineVisibleRanges;
}());
var HorizontalRange = /** @class */ (function () {
function HorizontalRange(left, width) {
this.left = Math.round(left);
this.width = Math.round(width);
}
HorizontalRange.prototype.toString = function () {
return "[" + this.left + "," + this.width + "]";
};
return HorizontalRange;
}());
var HorizontalPosition = /** @class */ (function () {
function HorizontalPosition(outsideRenderedLine, left) {
this.outsideRenderedLine = outsideRenderedLine;
this.left = Math.round(left);
}
return HorizontalPosition;
}());
var VisibleRanges = /** @class */ (function () {
function VisibleRanges(outsideRenderedLine, ranges) {
this.outsideRenderedLine = outsideRenderedLine;
this.ranges = ranges;
}
return VisibleRanges;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/rangeUtil.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var FloatHorizontalRange = /** @class */ (function () {
function FloatHorizontalRange(left, width) {
this.left = left;
this.width = width;
}
FloatHorizontalRange.prototype.toString = function () {
return "[" + this.left + "," + this.width + "]";
};
FloatHorizontalRange.compare = function (a, b) {
return a.left - b.left;
};
return FloatHorizontalRange;
}());
var rangeUtil_RangeUtil = /** @class */ (function () {
function RangeUtil() {
}
RangeUtil._createRange = function () {
if (!this._handyReadyRange) {
this._handyReadyRange = document.createRange();
}
return this._handyReadyRange;
};
RangeUtil._detachRange = function (range, endNode) {
// Move range out of the span node, IE doesn't like having many ranges in
// the same spot and will act badly for lines containing dashes ('-')
range.selectNodeContents(endNode);
};
RangeUtil._readClientRects = function (startElement, startOffset, endElement, endOffset, endNode) {
var range = this._createRange();
try {
range.setStart(startElement, startOffset);
range.setEnd(endElement, endOffset);
return range.getClientRects();
}
catch (e) {
// This is life ...
return null;
}
finally {
this._detachRange(range, endNode);
}
};
RangeUtil._mergeAdjacentRanges = function (ranges) {
if (ranges.length === 1) {
// There is nothing to merge
return [new HorizontalRange(ranges[0].left, ranges[0].width)];
}
ranges.sort(FloatHorizontalRange.compare);
var result = [], resultLen = 0;
var prevLeft = ranges[0].left;
var prevWidth = ranges[0].width;
for (var i = 1, len = ranges.length; i < len; i++) {
var range = ranges[i];
var myLeft = range.left;
var myWidth = range.width;
if (prevLeft + prevWidth + 0.9 /* account for browser's rounding errors*/ >= myLeft) {
prevWidth = Math.max(prevWidth, myLeft + myWidth - prevLeft);
}
else {
result[resultLen++] = new HorizontalRange(prevLeft, prevWidth);
prevLeft = myLeft;
prevWidth = myWidth;
}
}
result[resultLen++] = new HorizontalRange(prevLeft, prevWidth);
return result;
};
RangeUtil._createHorizontalRangesFromClientRects = function (clientRects, clientRectDeltaLeft) {
if (!clientRects || clientRects.length === 0) {
return null;
}
// We go through FloatHorizontalRange because it has been observed in bi-di text
// that the clientRects are not coming in sorted from the browser
var result = [];
for (var i = 0, len = clientRects.length; i < len; i++) {
var clientRect = clientRects[i];
result[i] = new FloatHorizontalRange(Math.max(0, clientRect.left - clientRectDeltaLeft), clientRect.width);
}
return this._mergeAdjacentRanges(result);
};
RangeUtil.readHorizontalRanges = function (domNode, startChildIndex, startOffset, endChildIndex, endOffset, clientRectDeltaLeft, endNode) {
// Panic check
var min = 0;
var 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 crossing over to a span only to select offset 0, then use the previous span's maximum offset
// Chrome is buggy and doesn't handle 0 offsets well sometimes.
if (startChildIndex !== endChildIndex) {
if (endChildIndex > 0 && endOffset === 0) {
endChildIndex--;
endOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;
}
}
var startElement = domNode.children[startChildIndex].firstChild;
var endElement = domNode.children[endChildIndex].firstChild;
if (!startElement || !endElement) {
// When having an empty (without any text content), try to move to the previous
if (!startElement && startOffset === 0 && startChildIndex > 0) {
startElement = domNode.children[startChildIndex - 1].firstChild;
startOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;
}
if (!endElement && endOffset === 0 && endChildIndex > 0) {
endElement = domNode.children[endChildIndex - 1].firstChild;
endOffset = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;
}
}
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));
var clientRects = this._readClientRects(startElement, startOffset, endElement, endOffset, endNode);
return this._createHorizontalRangesFromClientRects(clientRects, clientRectDeltaLeft);
};
return RangeUtil;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/lineDecorations.js
var lineDecorations = __webpack_require__(144);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLineRenderer.js
var viewLineRenderer = __webpack_require__(74);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/themeService.js
var common_themeService = __webpack_require__(19);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/editorOptions.js
var editorOptions = __webpack_require__(26);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLine.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewLine_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var canUseFastRenderedViewLine = (function () {
if (platform["f" /* isNative */]) {
// In VSCode we know very well when the zoom level changes
return true;
}
if (platform["d" /* isLinux */] || browser["h" /* isFirefox */] || browser["k" /* isSafari */]) {
// On Linux, it appears that zooming affects char widths (in pixels), which is unexpected.
// --
// Even though we read character widths correctly, having read them at a specific zoom level
// does not mean they are the same at the current zoom level.
// --
// This could be improved if we ever figure out how to get an event when browsers zoom,
// but until then we have to stick with reading client rects.
// --
// The same has been observed with Firefox on Windows7
// --
// The same has been oversved with Safari
return false;
}
return true;
})();
var alwaysRenderInlineSelection = (browser["f" /* isEdgeOrIE */]);
var DomReadingContext = /** @class */ (function () {
function DomReadingContext(domNode, endNode) {
this._domNode = domNode;
this._clientRectDeltaLeft = 0;
this._clientRectDeltaLeftRead = false;
this.endNode = endNode;
}
Object.defineProperty(DomReadingContext.prototype, "clientRectDeltaLeft", {
get: function () {
if (!this._clientRectDeltaLeftRead) {
this._clientRectDeltaLeftRead = true;
this._clientRectDeltaLeft = this._domNode.getBoundingClientRect().left;
}
return this._clientRectDeltaLeft;
},
enumerable: true,
configurable: true
});
return DomReadingContext;
}());
var ViewLineOptions = /** @class */ (function () {
function ViewLineOptions(config, themeType) {
this.themeType = themeType;
var options = config.options;
var fontInfo = options.get(34 /* fontInfo */);
this.renderWhitespace = options.get(74 /* renderWhitespace */);
this.renderControlCharacters = options.get(69 /* renderControlCharacters */);
this.spaceWidth = fontInfo.spaceWidth;
this.middotWidth = fontInfo.middotWidth;
this.useMonospaceOptimizations = (fontInfo.isMonospace
&& !options.get(23 /* disableMonospaceOptimizations */));
this.canUseHalfwidthRightwardsArrow = fontInfo.canUseHalfwidthRightwardsArrow;
this.lineHeight = options.get(49 /* lineHeight */);
this.stopRenderingLineAfter = options.get(88 /* stopRenderingLineAfter */);
this.fontLigatures = options.get(35 /* fontLigatures */);
}
ViewLineOptions.prototype.equals = function (other) {
return (this.themeType === other.themeType
&& this.renderWhitespace === other.renderWhitespace
&& this.renderControlCharacters === other.renderControlCharacters
&& this.spaceWidth === other.spaceWidth
&& this.middotWidth === other.middotWidth
&& this.useMonospaceOptimizations === other.useMonospaceOptimizations
&& this.canUseHalfwidthRightwardsArrow === other.canUseHalfwidthRightwardsArrow
&& this.lineHeight === other.lineHeight
&& this.stopRenderingLineAfter === other.stopRenderingLineAfter
&& this.fontLigatures === other.fontLigatures);
};
return ViewLineOptions;
}());
var viewLine_ViewLine = /** @class */ (function () {
function ViewLine(options) {
this._options = options;
this._isMaybeInvalid = true;
this._renderedViewLine = null;
}
// --- begin IVisibleLineData
ViewLine.prototype.getDomNode = function () {
if (this._renderedViewLine && this._renderedViewLine.domNode) {
return this._renderedViewLine.domNode.domNode;
}
return null;
};
ViewLine.prototype.setDomNode = function (domNode) {
if (this._renderedViewLine) {
this._renderedViewLine.domNode = Object(fastDomNode["b" /* createFastDomNode */])(domNode);
}
else {
throw new Error('I have no rendered view line to set the dom node to...');
}
};
ViewLine.prototype.onContentChanged = function () {
this._isMaybeInvalid = true;
};
ViewLine.prototype.onTokensChanged = function () {
this._isMaybeInvalid = true;
};
ViewLine.prototype.onDecorationsChanged = function () {
this._isMaybeInvalid = true;
};
ViewLine.prototype.onOptionsChanged = function (newOptions) {
this._isMaybeInvalid = true;
this._options = newOptions;
};
ViewLine.prototype.onSelectionChanged = function () {
if (alwaysRenderInlineSelection || this._options.themeType === common_themeService["b" /* HIGH_CONTRAST */] || this._options.renderWhitespace === 'selection') {
this._isMaybeInvalid = true;
return true;
}
return false;
};
ViewLine.prototype.renderLine = function (lineNumber, deltaTop, viewportData, sb) {
if (this._isMaybeInvalid === false) {
// it appears that nothing relevant has changed
return false;
}
this._isMaybeInvalid = false;
var lineData = viewportData.getViewLineRenderingData(lineNumber);
var options = this._options;
var actualInlineDecorations = lineDecorations["a" /* LineDecoration */].filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);
// Only send selection information when needed for rendering whitespace
var selectionsOnLine = null;
if (alwaysRenderInlineSelection || options.themeType === common_themeService["b" /* HIGH_CONTRAST */] || this._options.renderWhitespace === 'selection') {
var selections = viewportData.selections;
for (var _i = 0, selections_1 = selections; _i < selections_1.length; _i++) {
var selection = selections_1[_i];
if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {
// Selection does not intersect line
continue;
}
var startColumn = (selection.startLineNumber === lineNumber ? selection.startColumn : lineData.minColumn);
var endColumn = (selection.endLineNumber === lineNumber ? selection.endColumn : lineData.maxColumn);
if (startColumn < endColumn) {
if (this._options.renderWhitespace !== 'selection') {
actualInlineDecorations.push(new lineDecorations["a" /* LineDecoration */](startColumn, endColumn, 'inline-selected-text', 0 /* Regular */));
}
else {
if (!selectionsOnLine) {
selectionsOnLine = [];
}
selectionsOnLine.push(new viewLineRenderer["b" /* LineRange */](startColumn - 1, endColumn - 1));
}
}
}
}
var renderLineInput = new viewLineRenderer["c" /* RenderLineInput */](options.useMonospaceOptimizations, options.canUseHalfwidthRightwardsArrow, lineData.content, lineData.continuesWithWrappedLine, lineData.isBasicASCII, lineData.containsRTL, lineData.minColumn - 1, lineData.tokens, actualInlineDecorations, lineData.tabSize, lineData.startVisibleColumn, options.spaceWidth, options.middotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, options.fontLigatures !== editorOptions["d" /* EditorFontLigatures */].OFF, selectionsOnLine);
if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {
// no need to do anything, we have the same render input
return false;
}
sb.appendASCIIString('
');
var output = Object(viewLineRenderer["d" /* renderViewLine */])(renderLineInput, sb);
sb.appendASCIIString('
');
var renderedViewLine = null;
if (canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === 0 /* None */) {
if (lineData.content.length < 300 && renderLineInput.lineTokens.getCount() < 100) {
// Browser rounding errors have been observed in Chrome and IE, so using the fast
// view line only for short lines. Please test before removing the length check...
// ---
// Another rounding error has been observed on Linux in VSCode, where width
// rounding errors add up to an observable large number...
// ---
// Also see another example of rounding errors on Windows in
// https://github.com/Microsoft/vscode/issues/33178
renderedViewLine = new viewLine_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;
};
ViewLine.prototype.layoutLine = function (lineNumber, deltaTop) {
if (this._renderedViewLine && this._renderedViewLine.domNode) {
this._renderedViewLine.domNode.setTop(deltaTop);
this._renderedViewLine.domNode.setHeight(this._options.lineHeight);
}
};
// --- end IVisibleLineData
ViewLine.prototype.getWidth = function () {
if (!this._renderedViewLine) {
return 0;
}
return this._renderedViewLine.getWidth();
};
ViewLine.prototype.getWidthIsFast = function () {
if (!this._renderedViewLine) {
return true;
}
return this._renderedViewLine.getWidthIsFast();
};
ViewLine.prototype.getVisibleRangesForRange = function (startColumn, endColumn, context) {
if (!this._renderedViewLine) {
return null;
}
startColumn = startColumn | 0; // @perf
endColumn = endColumn | 0; // @perf
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));
var stopRenderingLineAfter = this._renderedViewLine.input.stopRenderingLineAfter | 0; // @perf
var outsideRenderedLine = false;
if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1 && endColumn > stopRenderingLineAfter + 1) {
// This range is obviously not visible
outsideRenderedLine = true;
}
if (stopRenderingLineAfter !== -1 && startColumn > stopRenderingLineAfter + 1) {
startColumn = stopRenderingLineAfter + 1;
}
if (stopRenderingLineAfter !== -1 && endColumn > stopRenderingLineAfter + 1) {
endColumn = stopRenderingLineAfter + 1;
}
var horizontalRanges = this._renderedViewLine.getVisibleRangesForRange(startColumn, endColumn, context);
if (horizontalRanges && horizontalRanges.length > 0) {
return new VisibleRanges(outsideRenderedLine, horizontalRanges);
}
return null;
};
ViewLine.prototype.getColumnOfNodeOffset = function (lineNumber, spanNode, offset) {
if (!this._renderedViewLine) {
return 1;
}
return this._renderedViewLine.getColumnOfNodeOffset(lineNumber, spanNode, offset);
};
ViewLine.CLASS_NAME = 'view-line';
return ViewLine;
}());
/**
* A rendered line which is guaranteed to contain only regular ASCII and is rendered with a monospace font.
*/
var viewLine_FastRenderedViewLine = /** @class */ (function () {
function FastRenderedViewLine(domNode, renderLineInput, characterMapping) {
this.domNode = domNode;
this.input = renderLineInput;
this._characterMapping = characterMapping;
this._charWidth = renderLineInput.spaceWidth;
}
FastRenderedViewLine.prototype.getWidth = function () {
return this._getCharPosition(this._characterMapping.length);
};
FastRenderedViewLine.prototype.getWidthIsFast = function () {
return true;
};
FastRenderedViewLine.prototype.getVisibleRangesForRange = function (startColumn, endColumn, context) {
var startPosition = this._getCharPosition(startColumn);
var endPosition = this._getCharPosition(endColumn);
return [new HorizontalRange(startPosition, endPosition - startPosition)];
};
FastRenderedViewLine.prototype._getCharPosition = function (column) {
var charOffset = this._characterMapping.getAbsoluteOffsets();
if (charOffset.length === 0) {
// No characters on this line
return 0;
}
return Math.round(this._charWidth * charOffset[column - 1]);
};
FastRenderedViewLine.prototype.getColumnOfNodeOffset = function (lineNumber, spanNode, offset) {
var spanNodeTextContentLength = spanNode.textContent.length;
var spanIndex = -1;
while (spanNode) {
spanNode = spanNode.previousSibling;
spanIndex++;
}
var charOffset = this._characterMapping.partDataToCharOffset(spanIndex, spanNodeTextContentLength, offset);
return charOffset + 1;
};
return FastRenderedViewLine;
}());
/**
* Every time we render a line, we save what we have rendered in an instance of this class.
*/
var viewLine_RenderedViewLine = /** @class */ (function () {
function RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, 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 (!containsRTL || this._characterMapping.length === 0 /* the line is empty */) {
this._pixelOffsetCache = new Int32Array(Math.max(2, this._characterMapping.length + 1));
for (var column = 0, len = this._characterMapping.length; column <= len; column++) {
this._pixelOffsetCache[column] = -1;
}
}
}
// --- Reading from the DOM methods
RenderedViewLine.prototype._getReadingTarget = function (myDomNode) {
return myDomNode.domNode.firstChild;
};
/**
* Width of the line in pixels
*/
RenderedViewLine.prototype.getWidth = function () {
if (!this.domNode) {
return 0;
}
if (this._cachedWidth === -1) {
this._cachedWidth = this._getReadingTarget(this.domNode).offsetWidth;
}
return this._cachedWidth;
};
RenderedViewLine.prototype.getWidthIsFast = function () {
if (this._cachedWidth === -1) {
return false;
}
return true;
};
/**
* Visible ranges for a model range
*/
RenderedViewLine.prototype.getVisibleRangesForRange = function (startColumn, endColumn, context) {
if (!this.domNode) {
return null;
}
if (this._pixelOffsetCache !== null) {
// the text is LTR
var startOffset = this._readPixelOffset(this.domNode, startColumn, context);
if (startOffset === -1) {
return null;
}
var endOffset = this._readPixelOffset(this.domNode, endColumn, context);
if (endOffset === -1) {
return null;
}
return [new HorizontalRange(startOffset, endOffset - startOffset)];
}
return this._readVisibleRangesForRange(this.domNode, startColumn, endColumn, context);
};
RenderedViewLine.prototype._readVisibleRangesForRange = function (domNode, startColumn, endColumn, context) {
if (startColumn === endColumn) {
var pixelOffset = this._readPixelOffset(domNode, startColumn, context);
if (pixelOffset === -1) {
return null;
}
else {
return [new HorizontalRange(pixelOffset, 0)];
}
}
else {
return this._readRawVisibleRangesForRange(domNode, startColumn, endColumn, context);
}
};
RenderedViewLine.prototype._readPixelOffset = function (domNode, column, context) {
if (this._characterMapping.length === 0) {
// This line has no content
if (this._containsForeignElements === 0 /* None */) {
// We can assume the line is really empty
return 0;
}
if (this._containsForeignElements === 2 /* After */) {
// We have foreign elements after the (empty) line
return 0;
}
if (this._containsForeignElements === 1 /* Before */) {
// We have foreign elements before the (empty) line
return this.getWidth();
}
// We have foreign elements before & after the (empty) line
var readingTarget = this._getReadingTarget(domNode);
if (readingTarget.firstChild) {
return readingTarget.firstChild.offsetWidth;
}
else {
return 0;
}
}
if (this._pixelOffsetCache !== null) {
// the text is LTR
var cachedPixelOffset = this._pixelOffsetCache[column];
if (cachedPixelOffset !== -1) {
return cachedPixelOffset;
}
var result = this._actualReadPixelOffset(domNode, column, context);
this._pixelOffsetCache[column] = result;
return result;
}
return this._actualReadPixelOffset(domNode, column, context);
};
RenderedViewLine.prototype._actualReadPixelOffset = function (domNode, column, context) {
if (this._characterMapping.length === 0) {
// This line has no content
var r_1 = rangeUtil_RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), 0, 0, 0, 0, context.clientRectDeltaLeft, context.endNode);
if (!r_1 || r_1.length === 0) {
return -1;
}
return r_1[0].left;
}
if (column === this._characterMapping.length && this._isWhitespaceOnly && this._containsForeignElements === 0 /* None */) {
// This branch helps in the case of whitespace only lines which have a width set
return this.getWidth();
}
var partData = this._characterMapping.charOffsetToPartData(column - 1);
var partIndex = viewLineRenderer["a" /* CharacterMapping */].getPartIndex(partData);
var charOffsetInPart = viewLineRenderer["a" /* CharacterMapping */].getCharIndex(partData);
var r = rangeUtil_RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), partIndex, charOffsetInPart, partIndex, charOffsetInPart, context.clientRectDeltaLeft, context.endNode);
if (!r || r.length === 0) {
return -1;
}
return r[0].left;
};
RenderedViewLine.prototype._readRawVisibleRangesForRange = function (domNode, startColumn, endColumn, context) {
if (startColumn === 1 && endColumn === this._characterMapping.length) {
// This branch helps IE with bidi text & gives a performance boost to other browsers when reading visible ranges for an entire line
return [new HorizontalRange(0, this.getWidth())];
}
var startPartData = this._characterMapping.charOffsetToPartData(startColumn - 1);
var startPartIndex = viewLineRenderer["a" /* CharacterMapping */].getPartIndex(startPartData);
var startCharOffsetInPart = viewLineRenderer["a" /* CharacterMapping */].getCharIndex(startPartData);
var endPartData = this._characterMapping.charOffsetToPartData(endColumn - 1);
var endPartIndex = viewLineRenderer["a" /* CharacterMapping */].getPartIndex(endPartData);
var endCharOffsetInPart = viewLineRenderer["a" /* CharacterMapping */].getCharIndex(endPartData);
return rangeUtil_RangeUtil.readHorizontalRanges(this._getReadingTarget(domNode), startPartIndex, startCharOffsetInPart, endPartIndex, endCharOffsetInPart, context.clientRectDeltaLeft, context.endNode);
};
/**
* Returns the column for the text found at a specific offset inside a rendered dom node
*/
RenderedViewLine.prototype.getColumnOfNodeOffset = function (lineNumber, spanNode, offset) {
var spanNodeTextContentLength = spanNode.textContent.length;
var spanIndex = -1;
while (spanNode) {
spanNode = spanNode.previousSibling;
spanIndex++;
}
var charOffset = this._characterMapping.partDataToCharOffset(spanIndex, spanNodeTextContentLength, offset);
return charOffset + 1;
};
return RenderedViewLine;
}());
var WebKitRenderedViewLine = /** @class */ (function (_super) {
viewLine_extends(WebKitRenderedViewLine, _super);
function WebKitRenderedViewLine() {
return _super !== null && _super.apply(this, arguments) || this;
}
WebKitRenderedViewLine.prototype._readVisibleRangesForRange = function (domNode, startColumn, endColumn, context) {
var output = _super.prototype._readVisibleRangesForRange.call(this, domNode, startColumn, endColumn, context);
if (!output || output.length === 0 || startColumn === endColumn || (startColumn === 1 && endColumn === this._characterMapping.length)) {
return output;
}
// WebKit is buggy and returns an expanded range (to contain words in some cases)
// The last client rect is enlarged (I think)
if (!this.input.containsRTL) {
// This is an attempt to patch things up
// Find position of last column
var endPixelOffset = this._readPixelOffset(domNode, endColumn, context);
if (endPixelOffset !== -1) {
var lastRange = output[output.length - 1];
if (lastRange.left < endPixelOffset) {
// Trim down the width of the last visible range to not go after the last column's position
lastRange.width = endPixelOffset - lastRange.left;
}
}
}
return output;
};
return WebKitRenderedViewLine;
}(viewLine_RenderedViewLine));
var createRenderedLine = (function () {
if (browser["m" /* isWebKit */]) {
return createWebKitRenderedLine;
}
return createNormalRenderedLine;
})();
function createWebKitRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {
return new WebKitRenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);
}
function createNormalRenderedLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements) {
return new viewLine_RenderedViewLine(domNode, renderLineInput, characterMapping, containsRTL, containsForeignElements);
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/position.js
var core_position = __webpack_require__(12);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/range.js
var core_range = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCommon.js
var cursorCommon = __webpack_require__(23);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var mouseTarget_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var PointerHandlerLastRenderData = /** @class */ (function () {
function PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition) {
this.lastViewCursorsRenderData = lastViewCursorsRenderData;
this.lastTextareaPosition = lastTextareaPosition;
}
return PointerHandlerLastRenderData;
}());
var mouseTarget_MouseTarget = /** @class */ (function () {
function MouseTarget(element, type, mouseColumn, position, range, detail) {
if (mouseColumn === void 0) { mouseColumn = 0; }
if (position === void 0) { position = null; }
if (range === void 0) { range = null; }
if (detail === void 0) { detail = null; }
this.element = element;
this.type = type;
this.mouseColumn = mouseColumn;
this.position = position;
if (!range && position) {
range = new core_range["a" /* Range */](position.lineNumber, position.column, position.lineNumber, position.column);
}
this.range = range;
this.detail = detail;
}
MouseTarget._typeToString = function (type) {
if (type === 1 /* TEXTAREA */) {
return 'TEXTAREA';
}
if (type === 2 /* GUTTER_GLYPH_MARGIN */) {
return 'GUTTER_GLYPH_MARGIN';
}
if (type === 3 /* GUTTER_LINE_NUMBERS */) {
return 'GUTTER_LINE_NUMBERS';
}
if (type === 4 /* GUTTER_LINE_DECORATIONS */) {
return 'GUTTER_LINE_DECORATIONS';
}
if (type === 5 /* GUTTER_VIEW_ZONE */) {
return 'GUTTER_VIEW_ZONE';
}
if (type === 6 /* CONTENT_TEXT */) {
return 'CONTENT_TEXT';
}
if (type === 7 /* CONTENT_EMPTY */) {
return 'CONTENT_EMPTY';
}
if (type === 8 /* CONTENT_VIEW_ZONE */) {
return 'CONTENT_VIEW_ZONE';
}
if (type === 9 /* CONTENT_WIDGET */) {
return 'CONTENT_WIDGET';
}
if (type === 10 /* OVERVIEW_RULER */) {
return 'OVERVIEW_RULER';
}
if (type === 11 /* SCROLLBAR */) {
return 'SCROLLBAR';
}
if (type === 12 /* OVERLAY_WIDGET */) {
return 'OVERLAY_WIDGET';
}
return 'UNKNOWN';
};
MouseTarget.toString = function (target) {
return this._typeToString(target.type) + ': ' + target.position + ' - ' + target.range + ' - ' + target.detail;
};
MouseTarget.prototype.toString = function () {
return MouseTarget.toString(this);
};
return MouseTarget;
}());
var ElementPath = /** @class */ (function () {
function ElementPath() {
}
ElementPath.isTextArea = function (path) {
return (path.length === 2
&& path[0] === 3 /* OverflowGuard */
&& path[1] === 6 /* TextArea */);
};
ElementPath.isChildOfViewLines = function (path) {
return (path.length >= 4
&& path[0] === 3 /* OverflowGuard */
&& path[3] === 7 /* ViewLines */);
};
ElementPath.isStrictChildOfViewLines = function (path) {
return (path.length > 4
&& path[0] === 3 /* OverflowGuard */
&& path[3] === 7 /* ViewLines */);
};
ElementPath.isChildOfScrollableElement = function (path) {
return (path.length >= 2
&& path[0] === 3 /* OverflowGuard */
&& path[1] === 5 /* ScrollableElement */);
};
ElementPath.isChildOfMinimap = function (path) {
return (path.length >= 2
&& path[0] === 3 /* OverflowGuard */
&& path[1] === 8 /* Minimap */);
};
ElementPath.isChildOfContentWidgets = function (path) {
return (path.length >= 4
&& path[0] === 3 /* OverflowGuard */
&& path[3] === 1 /* ContentWidgets */);
};
ElementPath.isChildOfOverflowingContentWidgets = function (path) {
return (path.length >= 1
&& path[0] === 2 /* OverflowingContentWidgets */);
};
ElementPath.isChildOfOverlayWidgets = function (path) {
return (path.length >= 2
&& path[0] === 3 /* OverflowGuard */
&& path[1] === 4 /* OverlayWidgets */);
};
return ElementPath;
}());
var mouseTarget_HitTestContext = /** @class */ (function () {
function HitTestContext(context, viewHelper, lastRenderData) {
this.model = context.model;
var options = context.configuration.options;
this.layoutInfo = options.get(107 /* layoutInfo */);
this.viewDomNode = viewHelper.viewDomNode;
this.lineHeight = options.get(49 /* lineHeight */);
this.typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
this.lastRenderData = lastRenderData;
this._context = context;
this._viewHelper = viewHelper;
}
HitTestContext.prototype.getZoneAtCoord = function (mouseVerticalOffset) {
return HitTestContext.getZoneAtCoord(this._context, mouseVerticalOffset);
};
HitTestContext.getZoneAtCoord = function (context, mouseVerticalOffset) {
// The target is either a view zone or the empty space after the last view-line
var viewZoneWhitespace = context.viewLayout.getWhitespaceAtVerticalOffset(mouseVerticalOffset);
if (viewZoneWhitespace) {
var viewZoneMiddle = viewZoneWhitespace.verticalOffset + viewZoneWhitespace.height / 2, lineCount = context.model.getLineCount(), positionBefore = null, position = void 0, positionAfter = null;
if (viewZoneWhitespace.afterLineNumber !== lineCount) {
// There are more lines after this view zone
positionAfter = new core_position["a" /* Position */](viewZoneWhitespace.afterLineNumber + 1, 1);
}
if (viewZoneWhitespace.afterLineNumber > 0) {
// There are more lines above this view zone
positionBefore = new core_position["a" /* Position */](viewZoneWhitespace.afterLineNumber, context.model.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: positionBefore,
positionAfter: positionAfter,
position: position
};
}
return null;
};
HitTestContext.prototype.getFullLineRangeAtCoord = function (mouseVerticalOffset) {
if (this._context.viewLayout.isAfterLines(mouseVerticalOffset)) {
// Below the last line
var lineNumber_1 = this._context.model.getLineCount();
var maxLineColumn_1 = this._context.model.getLineMaxColumn(lineNumber_1);
return {
range: new core_range["a" /* Range */](lineNumber_1, maxLineColumn_1, lineNumber_1, maxLineColumn_1),
isAfterLines: true
};
}
var lineNumber = this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);
var maxLineColumn = this._context.model.getLineMaxColumn(lineNumber);
return {
range: new core_range["a" /* Range */](lineNumber, 1, lineNumber, maxLineColumn),
isAfterLines: false
};
};
HitTestContext.prototype.getLineNumberAtVerticalOffset = function (mouseVerticalOffset) {
return this._context.viewLayout.getLineNumberAtVerticalOffset(mouseVerticalOffset);
};
HitTestContext.prototype.isAfterLines = function (mouseVerticalOffset) {
return this._context.viewLayout.isAfterLines(mouseVerticalOffset);
};
HitTestContext.prototype.getVerticalOffsetForLineNumber = function (lineNumber) {
return this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber);
};
HitTestContext.prototype.findAttribute = function (element, attr) {
return HitTestContext._findAttribute(element, attr, this._viewHelper.viewDomNode);
};
HitTestContext._findAttribute = function (element, attr, stopAt) {
while (element && element !== document.body) {
if (element.hasAttribute && element.hasAttribute(attr)) {
return element.getAttribute(attr);
}
if (element === stopAt) {
return null;
}
element = element.parentNode;
}
return null;
};
HitTestContext.prototype.getLineWidth = function (lineNumber) {
return this._viewHelper.getLineWidth(lineNumber);
};
HitTestContext.prototype.visibleRangeForPosition = function (lineNumber, column) {
return this._viewHelper.visibleRangeForPosition(lineNumber, column);
};
HitTestContext.prototype.getPositionFromDOMInfo = function (spanNode, offset) {
return this._viewHelper.getPositionFromDOMInfo(spanNode, offset);
};
HitTestContext.prototype.getCurrentScrollTop = function () {
return this._context.viewLayout.getCurrentScrollTop();
};
HitTestContext.prototype.getCurrentScrollLeft = function () {
return this._context.viewLayout.getCurrentScrollLeft();
};
return HitTestContext;
}());
var BareHitTestRequest = /** @class */ (function () {
function BareHitTestRequest(ctx, editorPos, pos) {
this.editorPos = editorPos;
this.pos = pos;
this.mouseVerticalOffset = Math.max(0, ctx.getCurrentScrollTop() + pos.y - editorPos.y);
this.mouseContentHorizontalOffset = ctx.getCurrentScrollLeft() + pos.x - editorPos.x - ctx.layoutInfo.contentLeft;
this.isInMarginArea = (pos.x - editorPos.x < ctx.layoutInfo.contentLeft && pos.x - editorPos.x >= ctx.layoutInfo.glyphMarginLeft);
this.isInContentArea = !this.isInMarginArea;
this.mouseColumn = Math.max(0, mouseTarget_MouseTargetFactory._getMouseColumn(this.mouseContentHorizontalOffset, ctx.typicalHalfwidthCharacterWidth));
}
return BareHitTestRequest;
}());
var mouseTarget_HitTestRequest = /** @class */ (function (_super) {
mouseTarget_extends(HitTestRequest, _super);
function HitTestRequest(ctx, editorPos, pos, target) {
var _this = _super.call(this, ctx, editorPos, pos) || this;
_this._ctx = ctx;
if (target) {
_this.target = target;
_this.targetPath = viewPart_PartFingerprints.collect(target, ctx.viewDomNode);
}
else {
_this.target = null;
_this.targetPath = new Uint8Array(0);
}
return _this;
}
HitTestRequest.prototype.toString = function () {
return "pos(" + this.pos.x + "," + this.pos.y + "), editorPos(" + this.editorPos.x + "," + this.editorPos.y + "), mouseVerticalOffset: " + this.mouseVerticalOffset + ", mouseContentHorizontalOffset: " + this.mouseContentHorizontalOffset + "\n\ttarget: " + (this.target ? this.target.outerHTML : null);
};
HitTestRequest.prototype.fulfill = function (type, position, range, detail) {
if (position === void 0) { position = null; }
if (range === void 0) { range = null; }
if (detail === void 0) { detail = null; }
var mouseColumn = this.mouseColumn;
if (position && position.column < this._ctx.model.getLineMaxColumn(position.lineNumber)) {
// Most likely, the line contains foreign decorations...
mouseColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn(this._ctx.model.getLineContent(position.lineNumber), position.column, this._ctx.model.getOptions().tabSize) + 1;
}
return new mouseTarget_MouseTarget(this.target, type, mouseColumn, position, range, detail);
};
HitTestRequest.prototype.withTarget = function (target) {
return new HitTestRequest(this._ctx, this.editorPos, this.pos, target);
};
return HitTestRequest;
}(BareHitTestRequest));
var EMPTY_CONTENT_AFTER_LINES = { isAfterLines: true };
function createEmptyContentDataInLines(horizontalDistanceToText) {
return {
isAfterLines: false,
horizontalDistanceToText: horizontalDistanceToText
};
}
var mouseTarget_MouseTargetFactory = /** @class */ (function () {
function MouseTargetFactory(context, viewHelper) {
this._context = context;
this._viewHelper = viewHelper;
}
MouseTargetFactory.prototype.mouseTargetIsWidget = function (e) {
var t = e.target;
var path = viewPart_PartFingerprints.collect(t, this._viewHelper.viewDomNode);
// Is it a content widget?
if (ElementPath.isChildOfContentWidgets(path) || ElementPath.isChildOfOverflowingContentWidgets(path)) {
return true;
}
// Is it an overlay widget?
if (ElementPath.isChildOfOverlayWidgets(path)) {
return true;
}
return false;
};
MouseTargetFactory.prototype.createMouseTarget = function (lastRenderData, editorPos, pos, target) {
var ctx = new mouseTarget_HitTestContext(this._context, this._viewHelper, lastRenderData);
var request = new mouseTarget_HitTestRequest(ctx, editorPos, pos, target);
try {
var r = MouseTargetFactory._createMouseTarget(ctx, request, false);
// console.log(r.toString());
return r;
}
catch (err) {
// console.log(err);
return request.fulfill(0 /* UNKNOWN */);
}
};
MouseTargetFactory._createMouseTarget = function (ctx, request, domHitTestExecuted) {
// console.log(`${domHitTestExecuted ? '=>' : ''}CAME IN REQUEST: ${request}`);
// First ensure the request has a target
if (request.target === null) {
if (domHitTestExecuted) {
// Still no target... and we have already executed hit test...
return request.fulfill(0 /* UNKNOWN */);
}
var hitTestResult = MouseTargetFactory._doHitTest(ctx, request);
if (hitTestResult.position) {
return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.position.lineNumber, hitTestResult.position.column);
}
return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);
}
// we know for a fact that request.target is not null
var resolvedRequest = request;
var result = null;
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, domHitTestExecuted);
result = result || MouseTargetFactory._hitTestScrollbar(ctx, resolvedRequest);
return (result || request.fulfill(0 /* UNKNOWN */));
};
MouseTargetFactory._hitTestContentWidget = function (ctx, request) {
// Is it a content widget?
if (ElementPath.isChildOfContentWidgets(request.targetPath) || ElementPath.isChildOfOverflowingContentWidgets(request.targetPath)) {
var widgetId = ctx.findAttribute(request.target, 'widgetId');
if (widgetId) {
return request.fulfill(9 /* CONTENT_WIDGET */, null, null, widgetId);
}
else {
return request.fulfill(0 /* UNKNOWN */);
}
}
return null;
};
MouseTargetFactory._hitTestOverlayWidget = function (ctx, request) {
// Is it an overlay widget?
if (ElementPath.isChildOfOverlayWidgets(request.targetPath)) {
var widgetId = ctx.findAttribute(request.target, 'widgetId');
if (widgetId) {
return request.fulfill(12 /* OVERLAY_WIDGET */, null, null, widgetId);
}
else {
return request.fulfill(0 /* UNKNOWN */);
}
}
return null;
};
MouseTargetFactory._hitTestViewCursor = function (ctx, request) {
if (request.target) {
// Check if we've hit a painted cursor
var lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;
for (var _i = 0, lastViewCursorsRenderData_1 = lastViewCursorsRenderData; _i < lastViewCursorsRenderData_1.length; _i++) {
var d = lastViewCursorsRenderData_1[_i];
if (request.target === d.domNode) {
return request.fulfill(6 /* CONTENT_TEXT */, d.position);
}
}
}
if (request.isInContentArea) {
// Edge has a bug when hit-testing the exact position of a cursor,
// instead of returning the correct dom node, it returns the
// first or last rendered view line dom node, therefore help it out
// and first check if we are on top of a cursor
var lastViewCursorsRenderData = ctx.lastRenderData.lastViewCursorsRenderData;
var mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;
var mouseVerticalOffset = request.mouseVerticalOffset;
for (var _a = 0, lastViewCursorsRenderData_2 = lastViewCursorsRenderData; _a < lastViewCursorsRenderData_2.length; _a++) {
var d = lastViewCursorsRenderData_2[_a];
if (mouseContentHorizontalOffset < d.contentLeft) {
// mouse position is to the left of the cursor
continue;
}
if (mouseContentHorizontalOffset > d.contentLeft + d.width) {
// mouse position is to the right of the cursor
continue;
}
var cursorVerticalOffset = ctx.getVerticalOffsetForLineNumber(d.position.lineNumber);
if (cursorVerticalOffset <= mouseVerticalOffset
&& mouseVerticalOffset <= cursorVerticalOffset + d.height) {
return request.fulfill(6 /* CONTENT_TEXT */, d.position);
}
}
}
return null;
};
MouseTargetFactory._hitTestViewZone = function (ctx, request) {
var viewZoneData = ctx.getZoneAtCoord(request.mouseVerticalOffset);
if (viewZoneData) {
var mouseTargetType = (request.isInContentArea ? 8 /* CONTENT_VIEW_ZONE */ : 5 /* GUTTER_VIEW_ZONE */);
return request.fulfill(mouseTargetType, viewZoneData.position, null, viewZoneData);
}
return null;
};
MouseTargetFactory._hitTestTextArea = function (ctx, request) {
// Is it the textarea?
if (ElementPath.isTextArea(request.targetPath)) {
if (ctx.lastRenderData.lastTextareaPosition) {
return request.fulfill(6 /* CONTENT_TEXT */, ctx.lastRenderData.lastTextareaPosition);
}
return request.fulfill(1 /* TEXTAREA */, ctx.lastRenderData.lastTextareaPosition);
}
return null;
};
MouseTargetFactory._hitTestMargin = function (ctx, request) {
if (request.isInMarginArea) {
var res = ctx.getFullLineRangeAtCoord(request.mouseVerticalOffset);
var pos = res.range.getStartPosition();
var offset = Math.abs(request.pos.x - request.editorPos.x);
var 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) {
// On the glyph margin
return request.fulfill(2 /* GUTTER_GLYPH_MARGIN */, pos, res.range, detail);
}
offset -= ctx.layoutInfo.glyphMarginWidth;
if (offset <= ctx.layoutInfo.lineNumbersWidth) {
// On the line numbers
return request.fulfill(3 /* GUTTER_LINE_NUMBERS */, pos, res.range, detail);
}
offset -= ctx.layoutInfo.lineNumbersWidth;
// On the line decorations
return request.fulfill(4 /* GUTTER_LINE_DECORATIONS */, pos, res.range, detail);
}
return null;
};
MouseTargetFactory._hitTestViewLines = function (ctx, request, domHitTestExecuted) {
if (!ElementPath.isChildOfViewLines(request.targetPath)) {
return null;
}
// Check if it is below any lines and any view zones
if (ctx.isAfterLines(request.mouseVerticalOffset)) {
// This most likely indicates it happened after the last view-line
var lineCount = ctx.model.getLineCount();
var maxLineColumn = ctx.model.getLineMaxColumn(lineCount);
return request.fulfill(7 /* CONTENT_EMPTY */, new core_position["a" /* Position */](lineCount, maxLineColumn), undefined, EMPTY_CONTENT_AFTER_LINES);
}
if (domHitTestExecuted) {
// Check if we are hitting a view-line (can happen in the case of inline decorations on empty lines)
// See https://github.com/Microsoft/vscode/issues/46942
if (ElementPath.isStrictChildOfViewLines(request.targetPath)) {
var lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
if (ctx.model.getLineLength(lineNumber) === 0) {
var lineWidth_1 = ctx.getLineWidth(lineNumber);
var detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth_1);
return request.fulfill(7 /* CONTENT_EMPTY */, new core_position["a" /* Position */](lineNumber, 1), undefined, detail);
}
var lineWidth = ctx.getLineWidth(lineNumber);
if (request.mouseContentHorizontalOffset >= lineWidth) {
var detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
var pos = new core_position["a" /* Position */](lineNumber, ctx.model.getLineMaxColumn(lineNumber));
return request.fulfill(7 /* CONTENT_EMPTY */, pos, undefined, detail);
}
}
// We have already executed hit test...
return request.fulfill(0 /* UNKNOWN */);
}
var hitTestResult = MouseTargetFactory._doHitTest(ctx, request);
if (hitTestResult.position) {
return MouseTargetFactory.createMouseTargetFromHitTestPosition(ctx, request, hitTestResult.position.lineNumber, hitTestResult.position.column);
}
return this._createMouseTarget(ctx, request.withTarget(hitTestResult.hitTarget), true);
};
MouseTargetFactory._hitTestMinimap = function (ctx, request) {
if (ElementPath.isChildOfMinimap(request.targetPath)) {
var possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
var maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);
return request.fulfill(11 /* SCROLLBAR */, new core_position["a" /* Position */](possibleLineNumber, maxColumn));
}
return null;
};
MouseTargetFactory._hitTestScrollbarSlider = function (ctx, request) {
if (ElementPath.isChildOfScrollableElement(request.targetPath)) {
if (request.target && request.target.nodeType === 1) {
var className = request.target.className;
if (className && /\b(slider|scrollbar)\b/.test(className)) {
var possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
var maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);
return request.fulfill(11 /* SCROLLBAR */, new core_position["a" /* Position */](possibleLineNumber, maxColumn));
}
}
}
return null;
};
MouseTargetFactory._hitTestScrollbar = function (ctx, request) {
// Is it the overview ruler?
// Is it a child of the scrollable element?
if (ElementPath.isChildOfScrollableElement(request.targetPath)) {
var possibleLineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
var maxColumn = ctx.model.getLineMaxColumn(possibleLineNumber);
return request.fulfill(11 /* SCROLLBAR */, new core_position["a" /* Position */](possibleLineNumber, maxColumn));
}
return null;
};
MouseTargetFactory.prototype.getMouseColumn = function (editorPos, pos) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
var mouseContentHorizontalOffset = this._context.viewLayout.getCurrentScrollLeft() + pos.x - editorPos.x - layoutInfo.contentLeft;
return MouseTargetFactory._getMouseColumn(mouseContentHorizontalOffset, options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth);
};
MouseTargetFactory._getMouseColumn = function (mouseContentHorizontalOffset, typicalHalfwidthCharacterWidth) {
if (mouseContentHorizontalOffset < 0) {
return 1;
}
var chars = Math.round(mouseContentHorizontalOffset / typicalHalfwidthCharacterWidth);
return (chars + 1);
};
MouseTargetFactory.createMouseTargetFromHitTestPosition = function (ctx, request, lineNumber, column) {
var pos = new core_position["a" /* Position */](lineNumber, column);
var lineWidth = ctx.getLineWidth(lineNumber);
if (request.mouseContentHorizontalOffset > lineWidth) {
if (browser["e" /* isEdge */] && pos.column === 1) {
// See https://github.com/Microsoft/vscode/issues/10875
var detail_1 = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
return request.fulfill(7 /* CONTENT_EMPTY */, new core_position["a" /* Position */](lineNumber, ctx.model.getLineMaxColumn(lineNumber)), undefined, detail_1);
}
var detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
return request.fulfill(7 /* CONTENT_EMPTY */, pos, undefined, detail);
}
var visibleRange = ctx.visibleRangeForPosition(lineNumber, column);
if (!visibleRange) {
return request.fulfill(0 /* UNKNOWN */, pos);
}
var columnHorizontalOffset = visibleRange.left;
if (request.mouseContentHorizontalOffset === columnHorizontalOffset) {
return request.fulfill(6 /* CONTENT_TEXT */, pos);
}
var points = [];
points.push({ offset: visibleRange.left, column: column });
if (column > 1) {
var visibleRange_1 = ctx.visibleRangeForPosition(lineNumber, column - 1);
if (visibleRange_1) {
points.push({ offset: visibleRange_1.left, column: column - 1 });
}
}
var lineMaxColumn = ctx.model.getLineMaxColumn(lineNumber);
if (column < lineMaxColumn) {
var visibleRange_2 = ctx.visibleRangeForPosition(lineNumber, column + 1);
if (visibleRange_2) {
points.push({ offset: visibleRange_2.left, column: column + 1 });
}
}
points.sort(function (a, b) { return a.offset - b.offset; });
for (var i = 1; i < points.length; i++) {
var prev = points[i - 1];
var curr = points[i];
if (prev.offset <= request.mouseContentHorizontalOffset && request.mouseContentHorizontalOffset <= curr.offset) {
var rng = new core_range["a" /* Range */](lineNumber, prev.column, lineNumber, curr.column);
return request.fulfill(6 /* CONTENT_TEXT */, pos, rng);
}
}
return request.fulfill(6 /* CONTENT_TEXT */, pos);
};
/**
* Most probably WebKit browsers and Edge
*/
MouseTargetFactory._doHitTestWithCaretRangeFromPoint = function (ctx, request) {
// In Chrome, especially on Linux it is possible to click between lines,
// so try to adjust the `hity` below so that it lands in the center of a line
var lineNumber = ctx.getLineNumberAtVerticalOffset(request.mouseVerticalOffset);
var lineVerticalOffset = ctx.getVerticalOffsetForLineNumber(lineNumber);
var lineCenteredVerticalOffset = lineVerticalOffset + Math.floor(ctx.lineHeight / 2);
var adjustedPageY = request.pos.y + (lineCenteredVerticalOffset - request.mouseVerticalOffset);
if (adjustedPageY <= request.editorPos.y) {
adjustedPageY = request.editorPos.y + 1;
}
if (adjustedPageY >= request.editorPos.y + ctx.layoutInfo.height) {
adjustedPageY = request.editorPos.y + ctx.layoutInfo.height - 1;
}
var adjustedPage = new editorDom_PageCoordinates(request.pos.x, adjustedPageY);
var r = this._actualDoHitTestWithCaretRangeFromPoint(ctx, adjustedPage.toClientCoordinates());
if (r.position) {
return r;
}
// Also try to hit test without the adjustment (for the edge cases that we are near the top or bottom)
return this._actualDoHitTestWithCaretRangeFromPoint(ctx, request.pos.toClientCoordinates());
};
MouseTargetFactory._actualDoHitTestWithCaretRangeFromPoint = function (ctx, coords) {
var shadowRoot = dom["E" /* getShadowRoot */](ctx.viewDomNode);
var range;
if (shadowRoot) {
if (typeof shadowRoot.caretRangeFromPoint === 'undefined') {
range = shadowCaretRangeFromPoint(shadowRoot, coords.clientX, coords.clientY);
}
else {
range = shadowRoot.caretRangeFromPoint(coords.clientX, coords.clientY);
}
}
else {
range = document.caretRangeFromPoint(coords.clientX, coords.clientY);
}
if (!range || !range.startContainer) {
return {
position: null,
hitTarget: null
};
}
// Chrome always hits a TEXT_NODE, while Edge sometimes hits a token span
var startContainer = range.startContainer;
var hitTarget = null;
if (startContainer.nodeType === startContainer.TEXT_NODE) {
// startContainer is expected to be the token text
var parent1 = startContainer.parentNode; // expected to be the token span
var parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span
var parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div
var parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;
if (parent3ClassName === viewLine_ViewLine.CLASS_NAME) {
var p = ctx.getPositionFromDOMInfo(parent1, range.startOffset);
return {
position: p,
hitTarget: null
};
}
else {
hitTarget = startContainer.parentNode;
}
}
else if (startContainer.nodeType === startContainer.ELEMENT_NODE) {
// startContainer is expected to be the token span
var parent1 = startContainer.parentNode; // expected to be the view line container span
var parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line div
var parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : null;
if (parent2ClassName === viewLine_ViewLine.CLASS_NAME) {
var p = ctx.getPositionFromDOMInfo(startContainer, startContainer.textContent.length);
return {
position: p,
hitTarget: null
};
}
else {
hitTarget = startContainer;
}
}
return {
position: null,
hitTarget: hitTarget
};
};
/**
* Most probably Gecko
*/
MouseTargetFactory._doHitTestWithCaretPositionFromPoint = function (ctx, coords) {
var hitResult = document.caretPositionFromPoint(coords.clientX, coords.clientY);
if (hitResult.offsetNode.nodeType === hitResult.offsetNode.TEXT_NODE) {
// offsetNode is expected to be the token text
var parent1 = hitResult.offsetNode.parentNode; // expected to be the token span
var parent2 = parent1 ? parent1.parentNode : null; // expected to be the view line container span
var parent3 = parent2 ? parent2.parentNode : null; // expected to be the view line div
var parent3ClassName = parent3 && parent3.nodeType === parent3.ELEMENT_NODE ? parent3.className : null;
if (parent3ClassName === viewLine_ViewLine.CLASS_NAME) {
var p = ctx.getPositionFromDOMInfo(hitResult.offsetNode.parentNode, hitResult.offset);
return {
position: p,
hitTarget: null
};
}
else {
return {
position: null,
hitTarget: hitResult.offsetNode.parentNode
};
}
}
return {
position: null,
hitTarget: hitResult.offsetNode
};
};
/**
* Most probably IE
*/
MouseTargetFactory._doHitTestWithMoveToPoint = function (ctx, coords) {
var resultPosition = null;
var resultHitTarget = null;
var textRange = document.body.createTextRange();
try {
textRange.moveToPoint(coords.clientX, coords.clientY);
}
catch (err) {
return {
position: null,
hitTarget: null
};
}
textRange.collapse(true);
// Now, let's do our best to figure out what we hit :)
var parentElement = textRange ? textRange.parentElement() : null;
var parent1 = parentElement ? parentElement.parentNode : null;
var parent2 = parent1 ? parent1.parentNode : null;
var parent2ClassName = parent2 && parent2.nodeType === parent2.ELEMENT_NODE ? parent2.className : '';
if (parent2ClassName === viewLine_ViewLine.CLASS_NAME) {
var rangeToContainEntireSpan = textRange.duplicate();
rangeToContainEntireSpan.moveToElementText(parentElement);
rangeToContainEntireSpan.setEndPoint('EndToStart', textRange);
resultPosition = ctx.getPositionFromDOMInfo(parentElement, rangeToContainEntireSpan.text.length);
// Move range out of the span node, IE doesn't like having many ranges in
// the same spot and will act badly for lines containing dashes ('-')
rangeToContainEntireSpan.moveToElementText(ctx.viewDomNode);
}
else {
// Looks like we've hit the hover or something foreign
resultHitTarget = parentElement;
}
// Move range out of the span node, IE doesn't like having many ranges in
// the same spot and will act badly for lines containing dashes ('-')
textRange.moveToElementText(ctx.viewDomNode);
return {
position: resultPosition,
hitTarget: resultHitTarget
};
};
MouseTargetFactory._doHitTest = function (ctx, request) {
// State of the art (18.10.2012):
// The spec says browsers should support document.caretPositionFromPoint, but nobody implemented it (http://dev.w3.org/csswg/cssom-view/)
// Gecko:
// - they tried to implement it once, but failed: https://bugzilla.mozilla.org/show_bug.cgi?id=654352
// - however, they do give out rangeParent/rangeOffset properties on mouse events
// Webkit:
// - they have implemented a previous version of the spec which was using document.caretRangeFromPoint
// IE:
// - they have a proprietary method on ranges, moveToPoint: https://msdn.microsoft.com/en-us/library/ie/ms536632(v=vs.85).aspx
// 24.08.2016: Edge has added WebKit's document.caretRangeFromPoint, but it is quite buggy
// - when hit testing the cursor it returns the first or the last line in the viewport
// - it inconsistently hits text nodes or span nodes, while WebKit only hits text nodes
// - when toggling render whitespace on, and hit testing in the empty content after a line, it always hits offset 0 of the first span of the line
// Thank you browsers for making this so 'easy' :)
if (typeof document.caretRangeFromPoint === 'function') {
return this._doHitTestWithCaretRangeFromPoint(ctx, request);
}
else if (document.caretPositionFromPoint) {
return this._doHitTestWithCaretPositionFromPoint(ctx, request.pos.toClientCoordinates());
}
else if (document.body.createTextRange) {
return this._doHitTestWithMoveToPoint(ctx, request.pos.toClientCoordinates());
}
return {
position: null,
hitTarget: null
};
};
return MouseTargetFactory;
}());
function shadowCaretRangeFromPoint(shadowRoot, x, y) {
var range = document.createRange();
// Get the element under the point
var el = shadowRoot.elementFromPoint(x, y);
if (el !== null) {
// Get the last child of the element until its firstChild is a text node
// This assumes that the pointer is on the right of the line, out of the tokens
// and that we want to get the offset of the last token of the line
while (el && el.firstChild && el.firstChild.nodeType !== el.firstChild.TEXT_NODE) {
el = el.lastChild;
}
// Grab its rect
var rect = el.getBoundingClientRect();
// And its font
var font = window.getComputedStyle(el, null).getPropertyValue('font');
// And also its txt content
var text = el.innerText;
// Position the pixel cursor at the left of the element
var pixelCursor = rect.left;
var offset = 0;
var step = void 0;
// If the point is on the right of the box put the cursor after the last character
if (x > rect.left + rect.width) {
offset = text.length;
}
else {
var charWidthReader = CharWidthReader.getInstance();
// Goes through all the characters of the innerText, and checks if the x of the point
// belongs to the character.
for (var i = 0; i < text.length + 1; i++) {
// The step is half the width of the character
step = charWidthReader.getCharWidth(text.charAt(i), font) / 2;
// Move to the center of the character
pixelCursor += step;
// If the x of the point is smaller that the position of the cursor, the point is over that character
if (x < pixelCursor) {
offset = i;
break;
}
// Move between the current character and the next
pixelCursor += step;
}
}
// Creates a range with the text node of the element and set the offset found
range.setStart(el.firstChild, offset);
range.setEnd(el.firstChild, offset);
}
return range;
}
var CharWidthReader = /** @class */ (function () {
function CharWidthReader() {
this._cache = {};
this._canvas = document.createElement('canvas');
}
CharWidthReader.getInstance = function () {
if (!CharWidthReader._INSTANCE) {
CharWidthReader._INSTANCE = new CharWidthReader();
}
return CharWidthReader._INSTANCE;
};
CharWidthReader.prototype.getCharWidth = function (char, font) {
var cacheKey = char + font;
if (this._cache[cacheKey]) {
return this._cache[cacheKey];
}
var context = this._canvas.getContext('2d');
context.font = font;
var metrics = context.measureText(char);
var width = metrics.width;
this._cache[cacheKey] = width;
return width;
};
CharWidthReader._INSTANCE = null;
return CharWidthReader;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/config/editorZoom.js
var editorZoom = __webpack_require__(115);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/selection.js
var core_selection = __webpack_require__(24);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/mouseHandler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var mouseHandler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Merges mouse events when mouse move events are throttled
*/
function createMouseMoveEventMerger(mouseTargetFactory) {
return function (lastEvent, currentEvent) {
var targetIsWidget = false;
if (mouseTargetFactory) {
targetIsWidget = mouseTargetFactory.mouseTargetIsWidget(currentEvent);
}
if (!targetIsWidget) {
currentEvent.preventDefault();
}
return currentEvent;
};
}
var mouseHandler_MouseHandler = /** @class */ (function (_super) {
mouseHandler_extends(MouseHandler, _super);
function MouseHandler(context, viewController, viewHelper) {
var _this = _super.call(this) || this;
_this._isFocused = false;
_this._context = context;
_this.viewController = viewController;
_this.viewHelper = viewHelper;
_this.mouseTargetFactory = new mouseTarget_MouseTargetFactory(_this._context, viewHelper);
_this._mouseDownOperation = _this._register(new mouseHandler_MouseDownOperation(_this._context, _this.viewController, _this.viewHelper, function (e, testEventTarget) { return _this._createMouseTarget(e, testEventTarget); }, function (e) { return _this._getMouseColumn(e); }));
_this._asyncFocus = _this._register(new common_async["d" /* RunOnceScheduler */](function () { return _this.viewHelper.focusTextArea(); }, 0));
_this.lastMouseLeaveTime = -1;
var mouseEvents = new editorDom_EditorMouseEventFactory(_this.viewHelper.viewDomNode);
_this._register(mouseEvents.onContextMenu(_this.viewHelper.viewDomNode, function (e) { return _this._onContextMenu(e, true); }));
_this._register(mouseEvents.onMouseMoveThrottled(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseMove(e); }, createMouseMoveEventMerger(_this.mouseTargetFactory), MouseHandler.MOUSE_MOVE_MINIMUM_TIME));
_this._register(mouseEvents.onMouseUp(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseUp(e); }));
_this._register(mouseEvents.onMouseLeave(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseLeave(e); }));
_this._register(mouseEvents.onMouseDown(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseDown(e); }));
var onMouseWheel = function (browserEvent) {
_this.viewController.emitMouseWheel(browserEvent);
if (!_this._context.configuration.options.get(57 /* mouseWheelZoom */)) {
return;
}
var e = new mouseEvent["c" /* StandardWheelEvent */](browserEvent);
if (e.browserEvent.ctrlKey || e.browserEvent.metaKey) {
var zoomLevel = editorZoom["a" /* EditorZoom */].getZoomLevel();
var delta = e.deltaY > 0 ? 1 : -1;
editorZoom["a" /* EditorZoom */].setZoomLevel(zoomLevel + delta);
e.preventDefault();
e.stopPropagation();
}
};
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.viewDomNode, browser["f" /* isEdgeOrIE */] ? 'mousewheel' : 'wheel', onMouseWheel, { capture: true, passive: false }));
_this._context.addEventHandler(_this);
return _this;
}
MouseHandler.prototype.dispose = function () {
this._context.removeEventHandler(this);
_super.prototype.dispose.call(this);
};
// --- begin event handlers
MouseHandler.prototype.onCursorStateChanged = function (e) {
this._mouseDownOperation.onCursorStateChanged(e);
return false;
};
MouseHandler.prototype.onFocusChanged = function (e) {
this._isFocused = e.isFocused;
return false;
};
MouseHandler.prototype.onScrollChanged = function (e) {
this._mouseDownOperation.onScrollChanged();
return false;
};
// --- end event handlers
MouseHandler.prototype.getTargetAtClientPoint = function (clientX, clientY) {
var clientPos = new editorDom_ClientCoordinates(clientX, clientY);
var pos = clientPos.toPageCoordinates();
var 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;
}
return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), editorPos, pos, null);
};
MouseHandler.prototype._createMouseTarget = function (e, testEventTarget) {
return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(), e.editorPos, e.pos, testEventTarget ? e.target : null);
};
MouseHandler.prototype._getMouseColumn = function (e) {
return this.mouseTargetFactory.getMouseColumn(e.editorPos, e.pos);
};
MouseHandler.prototype._onContextMenu = function (e, testEventTarget) {
this.viewController.emitContextMenu({
event: e,
target: this._createMouseTarget(e, testEventTarget)
});
};
MouseHandler.prototype._onMouseMove = function (e) {
if (this._mouseDownOperation.isActive()) {
// In selection/drag operation
return;
}
var actualMouseMoveTime = e.timestamp;
if (actualMouseMoveTime < this.lastMouseLeaveTime) {
// Due to throttling, this event occurred before the mouse left the editor, therefore ignore it.
return;
}
this.viewController.emitMouseMove({
event: e,
target: this._createMouseTarget(e, true)
});
};
MouseHandler.prototype._onMouseLeave = function (e) {
this.lastMouseLeaveTime = (new Date()).getTime();
this.viewController.emitMouseLeave({
event: e,
target: null
});
};
MouseHandler.prototype._onMouseUp = function (e) {
this.viewController.emitMouseUp({
event: e,
target: this._createMouseTarget(e, true)
});
};
MouseHandler.prototype._onMouseDown = function (e) {
var _this = this;
var t = this._createMouseTarget(e, true);
var targetIsContent = (t.type === 6 /* CONTENT_TEXT */ || t.type === 7 /* CONTENT_EMPTY */);
var targetIsGutter = (t.type === 2 /* GUTTER_GLYPH_MARGIN */ || t.type === 3 /* GUTTER_LINE_NUMBERS */ || t.type === 4 /* GUTTER_LINE_DECORATIONS */);
var targetIsLineNumbers = (t.type === 3 /* GUTTER_LINE_NUMBERS */);
var selectOnLineNumbers = this._context.configuration.options.get(83 /* selectOnLineNumbers */);
var targetIsViewZone = (t.type === 8 /* CONTENT_VIEW_ZONE */ || t.type === 5 /* GUTTER_VIEW_ZONE */);
var targetIsWidget = (t.type === 9 /* CONTENT_WIDGET */);
var shouldHandle = e.leftButton || e.middleButton;
if (platform["e" /* isMacintosh */] && e.leftButton && e.ctrlKey) {
shouldHandle = false;
}
var focus = function () {
// In IE11, if the focus is in the browser's address bar and
// then you click in the editor, calling preventDefault()
// will not move focus properly (focus remains the address bar)
if (browser["i" /* isIE */] && !_this._isFocused) {
_this._asyncFocus.schedule();
}
else {
e.preventDefault();
_this.viewHelper.focusTextArea();
}
};
if (shouldHandle && (targetIsContent || (targetIsLineNumbers && selectOnLineNumbers))) {
focus();
this._mouseDownOperation.start(t.type, e);
}
else if (targetIsGutter) {
// Do not steal focus
e.preventDefault();
}
else if (targetIsViewZone) {
var viewZoneData = t.detail;
if (this.viewHelper.shouldSuppressMouseDownOnViewZone(viewZoneData.viewZoneId)) {
focus();
this._mouseDownOperation.start(t.type, e);
e.preventDefault();
}
}
else if (targetIsWidget && this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)) {
focus();
e.preventDefault();
}
this.viewController.emitMouseDown({
event: e,
target: t
});
};
MouseHandler.MOUSE_MOVE_MINIMUM_TIME = 100; // ms
return MouseHandler;
}(ViewEventHandler));
var mouseHandler_MouseDownOperation = /** @class */ (function (_super) {
mouseHandler_extends(MouseDownOperation, _super);
function MouseDownOperation(context, viewController, viewHelper, createMouseTarget, getMouseColumn) {
var _this = _super.call(this) || this;
_this._context = context;
_this._viewController = viewController;
_this._viewHelper = viewHelper;
_this._createMouseTarget = createMouseTarget;
_this._getMouseColumn = getMouseColumn;
_this._mouseMoveMonitor = _this._register(new editorDom_GlobalEditorMouseMoveMonitor(_this._viewHelper.viewDomNode));
_this._onScrollTimeout = _this._register(new common_async["e" /* TimeoutTimer */]());
_this._mouseState = new MouseDownState();
_this._currentSelection = new core_selection["a" /* Selection */](1, 1, 1, 1);
_this._isActive = false;
_this._lastMouseEvent = null;
return _this;
}
MouseDownOperation.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
MouseDownOperation.prototype.isActive = function () {
return this._isActive;
};
MouseDownOperation.prototype._onMouseDownThenMove = function (e) {
this._lastMouseEvent = e;
this._mouseState.setModifiers(e);
var position = this._findMousePosition(e, true);
if (!position) {
// Ignoring because position is unknown
return;
}
if (this._mouseState.isDragAndDrop) {
this._viewController.emitMouseDrag({
event: e,
target: position
});
}
else {
this._dispatchMouse(position, true);
}
};
MouseDownOperation.prototype.start = function (targetType, e) {
var _this = this;
this._lastMouseEvent = e;
this._mouseState.setStartedOnLineNumbers(targetType === 3 /* GUTTER_LINE_NUMBERS */);
this._mouseState.setStartButtons(e);
this._mouseState.setModifiers(e);
var position = this._findMousePosition(e, true);
if (!position || !position.position) {
// Ignoring because position is unknown
return;
}
this._mouseState.trySetCount(e.detail, position.position);
// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.
e.detail = this._mouseState.count;
var options = this._context.configuration.options;
if (!options.get(68 /* readOnly */)
&& options.get(24 /* dragAndDrop */)
&& !this._mouseState.altKey // we don't support multiple mouse
&& e.detail < 2 // only single click on a selection can work
&& !this._isActive // the mouse is not down yet
&& !this._currentSelection.isEmpty() // we don't drag single cursor
&& (position.type === 6 /* CONTENT_TEXT */) // single click on text
&& position.position && this._currentSelection.containsPosition(position.position) // single click on a selection
) {
this._mouseState.isDragAndDrop = true;
this._isActive = true;
this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, createMouseMoveEventMerger(null), function (e) { return _this._onMouseDownThenMove(e); }, function () {
var position = _this._findMousePosition(_this._lastMouseEvent, true);
_this._viewController.emitMouseDrop({
event: _this._lastMouseEvent,
target: (position ? _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);
if (!this._isActive) {
this._isActive = true;
this._mouseMoveMonitor.startMonitoring(e.target, e.buttons, createMouseMoveEventMerger(null), function (e) { return _this._onMouseDownThenMove(e); }, function () { return _this._stop(); });
}
};
MouseDownOperation.prototype._stop = function () {
this._isActive = false;
this._onScrollTimeout.cancel();
};
MouseDownOperation.prototype.onScrollChanged = function () {
var _this = this;
if (!this._isActive) {
return;
}
this._onScrollTimeout.setIfNotSet(function () {
if (!_this._lastMouseEvent) {
return;
}
var position = _this._findMousePosition(_this._lastMouseEvent, false);
if (!position) {
// Ignoring because position is unknown
return;
}
if (_this._mouseState.isDragAndDrop) {
// Ignoring because users are dragging the text
return;
}
_this._dispatchMouse(position, true);
}, 10);
};
MouseDownOperation.prototype.onCursorStateChanged = function (e) {
this._currentSelection = e.selections[0];
};
MouseDownOperation.prototype._getPositionOutsideEditor = function (e) {
var editorContent = e.editorPos;
var model = this._context.model;
var viewLayout = this._context.viewLayout;
var mouseColumn = this._getMouseColumn(e);
if (e.posy < editorContent.y) {
var verticalOffset = Math.max(viewLayout.getCurrentScrollTop() - (editorContent.y - e.posy), 0);
var viewZoneData = mouseTarget_HitTestContext.getZoneAtCoord(this._context, verticalOffset);
if (viewZoneData) {
var newPosition = this._helpPositionJumpOverViewZone(viewZoneData);
if (newPosition) {
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, newPosition);
}
}
var aboveLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new core_position["a" /* Position */](aboveLineNumber, 1));
}
if (e.posy > editorContent.y + editorContent.height) {
var verticalOffset = viewLayout.getCurrentScrollTop() + (e.posy - editorContent.y);
var viewZoneData = mouseTarget_HitTestContext.getZoneAtCoord(this._context, verticalOffset);
if (viewZoneData) {
var newPosition = this._helpPositionJumpOverViewZone(viewZoneData);
if (newPosition) {
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, newPosition);
}
}
var belowLineNumber = viewLayout.getLineNumberAtVerticalOffset(verticalOffset);
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new core_position["a" /* Position */](belowLineNumber, model.getLineMaxColumn(belowLineNumber)));
}
var possibleLineNumber = viewLayout.getLineNumberAtVerticalOffset(viewLayout.getCurrentScrollTop() + (e.posy - editorContent.y));
if (e.posx < editorContent.x) {
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new core_position["a" /* Position */](possibleLineNumber, 1));
}
if (e.posx > editorContent.x + editorContent.width) {
return new mouseTarget_MouseTarget(null, 13 /* OUTSIDE_EDITOR */, mouseColumn, new core_position["a" /* Position */](possibleLineNumber, model.getLineMaxColumn(possibleLineNumber)));
}
return null;
};
MouseDownOperation.prototype._findMousePosition = function (e, testEventTarget) {
var positionOutsideEditor = this._getPositionOutsideEditor(e);
if (positionOutsideEditor) {
return positionOutsideEditor;
}
var t = this._createMouseTarget(e, testEventTarget);
var hintedPosition = t.position;
if (!hintedPosition) {
return null;
}
if (t.type === 8 /* CONTENT_VIEW_ZONE */ || t.type === 5 /* GUTTER_VIEW_ZONE */) {
var newPosition = this._helpPositionJumpOverViewZone(t.detail);
if (newPosition) {
return new mouseTarget_MouseTarget(t.element, t.type, t.mouseColumn, newPosition, null, t.detail);
}
}
return t;
};
MouseDownOperation.prototype._helpPositionJumpOverViewZone = function (viewZoneData) {
// Force position on view zones to go above or below depending on where selection started from
var selectionStart = new core_position["a" /* Position */](this._currentSelection.selectionStartLineNumber, this._currentSelection.selectionStartColumn);
var positionBefore = viewZoneData.positionBefore;
var positionAfter = viewZoneData.positionAfter;
if (positionBefore && positionAfter) {
if (positionBefore.isBefore(selectionStart)) {
return positionBefore;
}
else {
return positionAfter;
}
}
return null;
};
MouseDownOperation.prototype._dispatchMouse = function (position, inSelectionMode) {
if (!position.position) {
return;
}
this._viewController.dispatchMouse({
position: position.position,
mouseColumn: position.mouseColumn,
startedOnLineNumbers: this._mouseState.startedOnLineNumbers,
inSelectionMode: 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,
});
};
return MouseDownOperation;
}(lifecycle["a" /* Disposable */]));
var MouseDownState = /** @class */ (function () {
function MouseDownState() {
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;
}
Object.defineProperty(MouseDownState.prototype, "altKey", {
get: function () { return this._altKey; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "ctrlKey", {
get: function () { return this._ctrlKey; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "metaKey", {
get: function () { return this._metaKey; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "shiftKey", {
get: function () { return this._shiftKey; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "leftButton", {
get: function () { return this._leftButton; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "middleButton", {
get: function () { return this._middleButton; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "startedOnLineNumbers", {
get: function () { return this._startedOnLineNumbers; },
enumerable: true,
configurable: true
});
Object.defineProperty(MouseDownState.prototype, "count", {
get: function () {
return this._lastMouseDownCount;
},
enumerable: true,
configurable: true
});
MouseDownState.prototype.setModifiers = function (source) {
this._altKey = source.altKey;
this._ctrlKey = source.ctrlKey;
this._metaKey = source.metaKey;
this._shiftKey = source.shiftKey;
};
MouseDownState.prototype.setStartButtons = function (source) {
this._leftButton = source.leftButton;
this._middleButton = source.middleButton;
};
MouseDownState.prototype.setStartedOnLineNumbers = function (startedOnLineNumbers) {
this._startedOnLineNumbers = startedOnLineNumbers;
};
MouseDownState.prototype.trySetCount = function (setMouseDownCount, newMouseDownPosition) {
// a. Invalidate multiple clicking if too much time has passed (will be hit by IE because the detail field of mouse events contains garbage in IE10)
var currentTime = (new Date()).getTime();
if (currentTime - this._lastSetMouseDownCountTime > MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME) {
setMouseDownCount = 1;
}
this._lastSetMouseDownCountTime = currentTime;
// b. Ensure that we don't jump from single click to triple click in one go (will be hit by IE because the detail field of mouse events contains garbage in IE10)
if (setMouseDownCount > this._lastMouseDownCount + 1) {
setMouseDownCount = this._lastMouseDownCount + 1;
}
// c. Invalidate multiple clicking if the logical position is different
if (this._lastMouseDownPosition && this._lastMouseDownPosition.equals(newMouseDownPosition)) {
this._lastMouseDownPositionEqualCount++;
}
else {
this._lastMouseDownPositionEqualCount = 1;
}
this._lastMouseDownPosition = newMouseDownPosition;
// Finally set the lastMouseDownCount
this._lastMouseDownCount = Math.min(setMouseDownCount, this._lastMouseDownPositionEqualCount);
};
MouseDownState.CLEAR_MOUSE_DOWN_COUNT_TIME = 400; // ms
return MouseDownState;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/canIUse.js
var canIUse = __webpack_require__(120);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/pointerHandler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var pointerHandler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
function gestureChangeEventMerger(lastEvent, currentEvent) {
var r = {
translationY: currentEvent.translationY,
translationX: currentEvent.translationX
};
if (lastEvent) {
r.translationY += lastEvent.translationY;
r.translationX += lastEvent.translationX;
}
return r;
}
/**
* Basically IE10 and IE11
*/
var pointerHandler_MsPointerHandler = /** @class */ (function (_super) {
pointerHandler_extends(MsPointerHandler, _super);
function MsPointerHandler(context, viewController, viewHelper) {
var _this = _super.call(this, context, viewController, viewHelper) || this;
_this.viewHelper.linesContentDomNode.style.msTouchAction = 'none';
_this.viewHelper.linesContentDomNode.style.msContentZooming = 'none';
// TODO@Alex -> this expects that the view is added in 100 ms, might not be the case
// This handler should be added when the dom node is in the dom tree
_this._installGestureHandlerTimeout = window.setTimeout(function () {
_this._installGestureHandlerTimeout = -1;
if (window.MSGesture) {
var touchGesture_1 = new MSGesture();
var penGesture_1 = new MSGesture();
touchGesture_1.target = _this.viewHelper.linesContentDomNode;
penGesture_1.target = _this.viewHelper.linesContentDomNode;
_this.viewHelper.linesContentDomNode.addEventListener('MSPointerDown', function (e) {
// Circumvent IE11 breaking change in e.pointerType & TypeScript's stale definitions
var pointerType = e.pointerType;
if (pointerType === (e.MSPOINTER_TYPE_MOUSE || 'mouse')) {
_this._lastPointerType = 'mouse';
return;
}
else if (pointerType === (e.MSPOINTER_TYPE_TOUCH || 'touch')) {
_this._lastPointerType = 'touch';
touchGesture_1.addPointer(e.pointerId);
}
else {
_this._lastPointerType = 'pen';
penGesture_1.addPointer(e.pointerId);
}
});
_this._register(dom["m" /* addDisposableThrottledListener */](_this.viewHelper.linesContentDomNode, 'MSGestureChange', function (e) { return _this._onGestureChange(e); }, gestureChangeEventMerger));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, 'MSGestureTap', function (e) { return _this._onCaptureGestureTap(e); }, true));
}
}, 100);
_this._lastPointerType = 'mouse';
return _this;
}
MsPointerHandler.prototype._onMouseDown = function (e) {
if (this._lastPointerType === 'mouse') {
_super.prototype._onMouseDown.call(this, e);
}
};
MsPointerHandler.prototype._onCaptureGestureTap = function (rawEvent) {
var _this = this;
var e = new EditorMouseEvent(rawEvent, this.viewHelper.viewDomNode);
var t = this._createMouseTarget(e, false);
if (t.position) {
this.viewController.moveTo(t.position);
}
// IE does not want to focus when coming in from the browser's address bar
if (e.browserEvent.fromElement) {
e.preventDefault();
this.viewHelper.focusTextArea();
}
else {
// TODO@Alex -> cancel this is focus is lost
setTimeout(function () {
_this.viewHelper.focusTextArea();
});
}
};
MsPointerHandler.prototype._onGestureChange = function (e) {
this._context.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);
};
MsPointerHandler.prototype.dispose = function () {
window.clearTimeout(this._installGestureHandlerTimeout);
_super.prototype.dispose.call(this);
};
return MsPointerHandler;
}(mouseHandler_MouseHandler));
/**
* Basically Edge but should be modified to handle any pointerEnabled, even without support of MSGesture
*/
var pointerHandler_StandardPointerHandler = /** @class */ (function (_super) {
pointerHandler_extends(StandardPointerHandler, _super);
function StandardPointerHandler(context, viewController, viewHelper) {
var _this = _super.call(this, context, viewController, viewHelper) || this;
_this.viewHelper.linesContentDomNode.style.touchAction = 'none';
// TODO@Alex -> this expects that the view is added in 100 ms, might not be the case
// This handler should be added when the dom node is in the dom tree
_this._installGestureHandlerTimeout = window.setTimeout(function () {
_this._installGestureHandlerTimeout = -1;
// TODO@Alex: replace the usage of MSGesture here with something that works across all browsers
if (window.MSGesture) {
var touchGesture_2 = new MSGesture();
var penGesture_2 = new MSGesture();
touchGesture_2.target = _this.viewHelper.linesContentDomNode;
penGesture_2.target = _this.viewHelper.linesContentDomNode;
_this.viewHelper.linesContentDomNode.addEventListener('pointerdown', function (e) {
var pointerType = e.pointerType;
if (pointerType === 'mouse') {
_this._lastPointerType = 'mouse';
return;
}
else if (pointerType === 'touch') {
_this._lastPointerType = 'touch';
touchGesture_2.addPointer(e.pointerId);
}
else {
_this._lastPointerType = 'pen';
penGesture_2.addPointer(e.pointerId);
}
});
_this._register(dom["m" /* addDisposableThrottledListener */](_this.viewHelper.linesContentDomNode, 'MSGestureChange', function (e) { return _this._onGestureChange(e); }, gestureChangeEventMerger));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, 'MSGestureTap', function (e) { return _this._onCaptureGestureTap(e); }, true));
}
}, 100);
_this._lastPointerType = 'mouse';
return _this;
}
StandardPointerHandler.prototype._onMouseDown = function (e) {
if (this._lastPointerType === 'mouse') {
_super.prototype._onMouseDown.call(this, e);
}
};
StandardPointerHandler.prototype._onCaptureGestureTap = function (rawEvent) {
var _this = this;
var e = new EditorMouseEvent(rawEvent, this.viewHelper.viewDomNode);
var t = this._createMouseTarget(e, false);
if (t.position) {
this.viewController.moveTo(t.position);
}
// IE does not want to focus when coming in from the browser's address bar
if (e.browserEvent.fromElement) {
e.preventDefault();
this.viewHelper.focusTextArea();
}
else {
// TODO@Alex -> cancel this is focus is lost
setTimeout(function () {
_this.viewHelper.focusTextArea();
});
}
};
StandardPointerHandler.prototype._onGestureChange = function (e) {
this._context.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);
};
StandardPointerHandler.prototype.dispose = function () {
window.clearTimeout(this._installGestureHandlerTimeout);
_super.prototype.dispose.call(this);
};
return StandardPointerHandler;
}(mouseHandler_MouseHandler));
/**
* Currently only tested on iOS 13/ iPadOS.
*/
var pointerHandler_PointerEventHandler = /** @class */ (function (_super) {
pointerHandler_extends(PointerEventHandler, _super);
function PointerEventHandler(context, viewController, viewHelper) {
var _this = _super.call(this, context, viewController, viewHelper) || this;
_this._register(touch["b" /* Gesture */].addTarget(_this.viewHelper.linesContentDomNode));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Tap, function (e) { return _this.onTap(e); }));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Change, function (e) { return _this.onChange(e); }));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Contextmenu, function (e) { return _this._onContextMenu(new EditorMouseEvent(e, _this.viewHelper.viewDomNode), false); }));
_this._lastPointerType = 'mouse';
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, 'pointerdown', function (e) {
var pointerType = e.pointerType;
if (pointerType === 'mouse') {
_this._lastPointerType = 'mouse';
return;
}
else if (pointerType === 'touch') {
_this._lastPointerType = 'touch';
}
else {
_this._lastPointerType = 'pen';
}
}));
// PonterEvents
var pointerEvents = new editorDom_EditorPointerEventFactory(_this.viewHelper.viewDomNode);
_this._register(pointerEvents.onPointerMoveThrottled(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseMove(e); }, createMouseMoveEventMerger(_this.mouseTargetFactory), mouseHandler_MouseHandler.MOUSE_MOVE_MINIMUM_TIME));
_this._register(pointerEvents.onPointerUp(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseUp(e); }));
_this._register(pointerEvents.onPointerLeave(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseLeave(e); }));
_this._register(pointerEvents.onPointerDown(_this.viewHelper.viewDomNode, function (e) { return _this._onMouseDown(e); }));
return _this;
}
PointerEventHandler.prototype.onTap = function (event) {
if (!event.initialTarget || !this.viewHelper.linesContentDomNode.contains(event.initialTarget)) {
return;
}
event.preventDefault();
this.viewHelper.focusTextArea();
var target = this._createMouseTarget(new EditorMouseEvent(event, this.viewHelper.viewDomNode), false);
if (target.position) {
// this.viewController.moveTo(target.position);
this.viewController.dispatchMouse({
position: target.position,
mouseColumn: target.position.column,
startedOnLineNumbers: false,
mouseDownCount: event.tapCount,
inSelectionMode: false,
altKey: false,
ctrlKey: false,
metaKey: false,
shiftKey: false,
leftButton: false,
middleButton: false,
});
}
};
PointerEventHandler.prototype.onChange = function (e) {
if (this._lastPointerType === 'touch') {
this._context.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);
}
};
PointerEventHandler.prototype._onMouseDown = function (e) {
if (e.target && this.viewHelper.linesContentDomNode.contains(e.target) && this._lastPointerType === 'touch') {
return;
}
_super.prototype._onMouseDown.call(this, e);
};
return PointerEventHandler;
}(mouseHandler_MouseHandler));
var pointerHandler_TouchHandler = /** @class */ (function (_super) {
pointerHandler_extends(TouchHandler, _super);
function TouchHandler(context, viewController, viewHelper) {
var _this = _super.call(this, context, viewController, viewHelper) || this;
_this._register(touch["b" /* Gesture */].addTarget(_this.viewHelper.linesContentDomNode));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Tap, function (e) { return _this.onTap(e); }));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Change, function (e) { return _this.onChange(e); }));
_this._register(dom["j" /* addDisposableListener */](_this.viewHelper.linesContentDomNode, touch["a" /* EventType */].Contextmenu, function (e) { return _this._onContextMenu(new EditorMouseEvent(e, _this.viewHelper.viewDomNode), false); }));
return _this;
}
TouchHandler.prototype.onTap = function (event) {
event.preventDefault();
this.viewHelper.focusTextArea();
var target = this._createMouseTarget(new EditorMouseEvent(event, this.viewHelper.viewDomNode), false);
if (target.position) {
this.viewController.moveTo(target.position);
}
};
TouchHandler.prototype.onChange = function (e) {
this._context.viewLayout.deltaScrollNow(-e.translationX, -e.translationY);
};
return TouchHandler;
}(mouseHandler_MouseHandler));
var pointerHandler_PointerHandler = /** @class */ (function (_super) {
pointerHandler_extends(PointerHandler, _super);
function PointerHandler(context, viewController, viewHelper) {
var _this = _super.call(this) || this;
if (window.navigator.msPointerEnabled) {
_this.handler = _this._register(new pointerHandler_MsPointerHandler(context, viewController, viewHelper));
}
else if ((platform["c" /* isIOS */] && canIUse["a" /* BrowserFeatures */].pointerEvents)) {
_this.handler = _this._register(new pointerHandler_PointerEventHandler(context, viewController, viewHelper));
}
else if (window.TouchEvent) {
_this.handler = _this._register(new pointerHandler_TouchHandler(context, viewController, viewHelper));
}
else if (window.navigator.pointerEnabled || window.PointerEvent) {
_this.handler = _this._register(new pointerHandler_StandardPointerHandler(context, viewController, viewHelper));
}
else {
_this.handler = _this._register(new mouseHandler_MouseHandler(context, viewController, viewHelper));
}
return _this;
}
PointerHandler.prototype.getTargetAtClientPoint = function (clientX, clientY) {
return this.handler.getTargetAtClientPoint(clientX, clientY);
};
return PointerHandler;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.css
var textAreaHandler = __webpack_require__(623);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/strings.js
var strings = __webpack_require__(11);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaInput.js
var textAreaInput = __webpack_require__(184);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaState.js
var textAreaState = __webpack_require__(107);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.css
var lineNumbers_lineNumbers = __webpack_require__(624);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/dynamicViewOverlay.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var dynamicViewOverlay_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var DynamicViewOverlay = /** @class */ (function (_super) {
dynamicViewOverlay_extends(DynamicViewOverlay, _super);
function DynamicViewOverlay() {
return _super !== null && _super.apply(this, arguments) || this;
}
return DynamicViewOverlay;
}(ViewEventHandler));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/editorColorRegistry.js
var editorColorRegistry = __webpack_require__(44);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var lineNumbers_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var lineNumbers_LineNumbersOverlay = /** @class */ (function (_super) {
lineNumbers_extends(LineNumbersOverlay, _super);
function LineNumbersOverlay(context) {
var _this = _super.call(this) || this;
_this._context = context;
_this._readConfig();
_this._lastCursorModelPosition = new core_position["a" /* Position */](1, 1);
_this._renderResult = null;
_this._context.addEventHandler(_this);
return _this;
}
LineNumbersOverlay.prototype._readConfig = function () {
var options = this._context.configuration.options;
this._lineHeight = options.get(49 /* lineHeight */);
var lineNumbers = options.get(50 /* lineNumbers */);
this._renderLineNumbers = lineNumbers.renderType;
this._renderCustomLineNumbers = lineNumbers.renderFn;
this._renderFinalNewline = options.get(71 /* renderFinalNewline */);
var layoutInfo = options.get(107 /* layoutInfo */);
this._lineNumbersLeft = layoutInfo.lineNumbersLeft;
this._lineNumbersWidth = layoutInfo.lineNumbersWidth;
};
LineNumbersOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
this._renderResult = null;
_super.prototype.dispose.call(this);
};
// --- begin event handlers
LineNumbersOverlay.prototype.onConfigurationChanged = function (e) {
this._readConfig();
return true;
};
LineNumbersOverlay.prototype.onCursorStateChanged = function (e) {
var primaryViewPosition = e.selections[0].getPosition();
this._lastCursorModelPosition = this._context.model.coordinatesConverter.convertViewPositionToModelPosition(primaryViewPosition);
if (this._renderLineNumbers === 2 /* Relative */ || this._renderLineNumbers === 3 /* Interval */) {
return true;
}
return false;
};
LineNumbersOverlay.prototype.onFlushed = function (e) {
return true;
};
LineNumbersOverlay.prototype.onLinesChanged = function (e) {
return true;
};
LineNumbersOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
LineNumbersOverlay.prototype.onLinesInserted = function (e) {
return true;
};
LineNumbersOverlay.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged;
};
LineNumbersOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
LineNumbersOverlay.prototype._getLineRenderLineNumber = function (viewLineNumber) {
var modelPosition = this._context.model.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](viewLineNumber, 1));
if (modelPosition.column !== 1) {
return '';
}
var modelLineNumber = modelPosition.lineNumber;
if (this._renderCustomLineNumbers) {
return this._renderCustomLineNumbers(modelLineNumber);
}
if (this._renderLineNumbers === 2 /* Relative */) {
var diff = Math.abs(this._lastCursorModelPosition.lineNumber - modelLineNumber);
if (diff === 0) {
return '' + modelLineNumber + '';
}
return String(diff);
}
if (this._renderLineNumbers === 3 /* Interval */) {
if (this._lastCursorModelPosition.lineNumber === modelLineNumber) {
return String(modelLineNumber);
}
if (modelLineNumber % 10 === 0) {
return String(modelLineNumber);
}
return '';
}
return String(modelLineNumber);
};
LineNumbersOverlay.prototype.prepareRender = function (ctx) {
if (this._renderLineNumbers === 0 /* Off */) {
this._renderResult = null;
return;
}
var lineHeightClassName = (platform["d" /* isLinux */] ? (this._lineHeight % 2 === 0 ? ' lh-even' : ' lh-odd') : '');
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
var common = '
';
var lineCount = this._context.model.getLineCount();
var output = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
if (!this._renderFinalNewline) {
if (lineNumber === lineCount && this._context.model.getLineLength(lineNumber) === 0) {
// Do not render last (empty) line
output[lineIndex] = '';
continue;
}
}
var renderLineNumber = this._getLineRenderLineNumber(lineNumber);
if (renderLineNumber) {
output[lineIndex] = (common
+ renderLineNumber
+ '
');
}
else {
output[lineIndex] = '';
}
}
this._renderResult = output;
};
LineNumbersOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderResult) {
return '';
}
var lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return '';
}
return this._renderResult[lineIndex];
};
LineNumbersOverlay.CLASS_NAME = 'line-numbers';
return LineNumbersOverlay;
}(DynamicViewOverlay));
// theming
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var lineNumbers = theme.getColor(editorColorRegistry["k" /* editorLineNumbers */]);
if (lineNumbers) {
collector.addRule(".monaco-editor .line-numbers { color: " + lineNumbers + "; }");
}
var activeLineNumber = theme.getColor(editorColorRegistry["b" /* editorActiveLineNumber */]);
if (activeLineNumber) {
collector.addRule(".monaco-editor .current-line ~ .line-numbers { color: " + activeLineNumber + "; }");
}
});
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/margin/margin.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var margin_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var margin_Margin = /** @class */ (function (_super) {
margin_extends(Margin, _super);
function Margin(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._canUseLayerHinting = !options.get(22 /* disableLayerHinting */);
_this._contentLeft = layoutInfo.contentLeft;
_this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
_this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
_this._domNode = Object(fastDomNode["b" /* 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 = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._glyphMarginBackgroundDomNode.setClassName(Margin.CLASS_NAME);
_this._domNode.appendChild(_this._glyphMarginBackgroundDomNode);
return _this;
}
Margin.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
Margin.prototype.getDomNode = function () {
return this._domNode;
};
// --- begin event handlers
Margin.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._canUseLayerHinting = !options.get(22 /* disableLayerHinting */);
this._contentLeft = layoutInfo.contentLeft;
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
return true;
};
Margin.prototype.onScrollChanged = function (e) {
return _super.prototype.onScrollChanged.call(this, e) || e.scrollTopChanged;
};
// --- end event handlers
Margin.prototype.prepareRender = function (ctx) {
// Nothing to read
};
Margin.prototype.render = function (ctx) {
this._domNode.setLayerHinting(this._canUseLayerHinting);
this._domNode.setContain('strict');
var adjustedScrollTop = ctx.scrollTop - ctx.bigNumbersDelta;
this._domNode.setTop(-adjustedScrollTop);
var height = Math.min(ctx.scrollHeight, 1000000);
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';
return Margin;
}(ViewPart));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/wordCharacterClassifier.js
var wordCharacterClassifier = __webpack_require__(104);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/viewEvents.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewEvents_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ViewConfigurationChangedEvent = /** @class */ (function () {
function ViewConfigurationChangedEvent(source) {
this.type = 1 /* ViewConfigurationChanged */;
this._source = source;
}
ViewConfigurationChangedEvent.prototype.hasChanged = function (id) {
return this._source.hasChanged(id);
};
return ViewConfigurationChangedEvent;
}());
var ViewContentSizeChangedEvent = /** @class */ (function () {
function ViewContentSizeChangedEvent(source) {
this.type = 2 /* ViewContentSizeChanged */;
this.contentWidth = source.contentWidth;
this.contentHeight = source.contentHeight;
this.contentWidthChanged = source.contentWidthChanged;
this.contentHeightChanged = source.contentHeightChanged;
}
return ViewContentSizeChangedEvent;
}());
var ViewCursorStateChangedEvent = /** @class */ (function () {
function ViewCursorStateChangedEvent(selections, modelSelections) {
this.type = 3 /* ViewCursorStateChanged */;
this.selections = selections;
this.modelSelections = modelSelections;
}
return ViewCursorStateChangedEvent;
}());
var ViewDecorationsChangedEvent = /** @class */ (function () {
function ViewDecorationsChangedEvent() {
this.type = 4 /* ViewDecorationsChanged */;
// Nothing to do
}
return ViewDecorationsChangedEvent;
}());
var ViewFlushedEvent = /** @class */ (function () {
function ViewFlushedEvent() {
this.type = 5 /* ViewFlushed */;
// Nothing to do
}
return ViewFlushedEvent;
}());
var ViewFocusChangedEvent = /** @class */ (function () {
function ViewFocusChangedEvent(isFocused) {
this.type = 6 /* ViewFocusChanged */;
this.isFocused = isFocused;
}
return ViewFocusChangedEvent;
}());
var ViewLanguageConfigurationEvent = /** @class */ (function () {
function ViewLanguageConfigurationEvent() {
this.type = 7 /* ViewLanguageConfigurationChanged */;
}
return ViewLanguageConfigurationEvent;
}());
var ViewLineMappingChangedEvent = /** @class */ (function () {
function ViewLineMappingChangedEvent() {
this.type = 8 /* ViewLineMappingChanged */;
// Nothing to do
}
return ViewLineMappingChangedEvent;
}());
var ViewLinesChangedEvent = /** @class */ (function () {
function ViewLinesChangedEvent(fromLineNumber, toLineNumber) {
this.type = 9 /* ViewLinesChanged */;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
return ViewLinesChangedEvent;
}());
var ViewLinesDeletedEvent = /** @class */ (function () {
function ViewLinesDeletedEvent(fromLineNumber, toLineNumber) {
this.type = 10 /* ViewLinesDeleted */;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
return ViewLinesDeletedEvent;
}());
var ViewLinesInsertedEvent = /** @class */ (function () {
function ViewLinesInsertedEvent(fromLineNumber, toLineNumber) {
this.type = 11 /* ViewLinesInserted */;
this.fromLineNumber = fromLineNumber;
this.toLineNumber = toLineNumber;
}
return ViewLinesInsertedEvent;
}());
var ViewRevealRangeRequestEvent = /** @class */ (function () {
function ViewRevealRangeRequestEvent(source, range, verticalType, revealHorizontal, scrollType) {
this.type = 12 /* ViewRevealRangeRequest */;
this.source = source;
this.range = range;
this.verticalType = verticalType;
this.revealHorizontal = revealHorizontal;
this.scrollType = scrollType;
}
return ViewRevealRangeRequestEvent;
}());
var ViewScrollChangedEvent = /** @class */ (function () {
function ViewScrollChangedEvent(source) {
this.type = 13 /* ViewScrollChanged */;
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;
}
return ViewScrollChangedEvent;
}());
var ViewThemeChangedEvent = /** @class */ (function () {
function ViewThemeChangedEvent() {
this.type = 14 /* ViewThemeChanged */;
}
return ViewThemeChangedEvent;
}());
var ViewTokensChangedEvent = /** @class */ (function () {
function ViewTokensChangedEvent(ranges) {
this.type = 15 /* ViewTokensChanged */;
this.ranges = ranges;
}
return ViewTokensChangedEvent;
}());
var ViewTokensColorsChangedEvent = /** @class */ (function () {
function ViewTokensColorsChangedEvent() {
this.type = 16 /* ViewTokensColorsChanged */;
// Nothing to do
}
return ViewTokensColorsChangedEvent;
}());
var ViewZonesChangedEvent = /** @class */ (function () {
function ViewZonesChangedEvent() {
this.type = 17 /* ViewZonesChanged */;
// Nothing to do
}
return ViewZonesChangedEvent;
}());
var viewEvents_ViewEventEmitter = /** @class */ (function (_super) {
viewEvents_extends(ViewEventEmitter, _super);
function ViewEventEmitter() {
var _this = _super.call(this) || this;
_this._listeners = [];
_this._collector = null;
_this._collectorCnt = 0;
return _this;
}
ViewEventEmitter.prototype.dispose = function () {
this._listeners = [];
_super.prototype.dispose.call(this);
};
ViewEventEmitter.prototype._beginEmit = function () {
this._collectorCnt++;
if (this._collectorCnt === 1) {
this._collector = new ViewEventsCollector();
}
return this._collector;
};
ViewEventEmitter.prototype._endEmit = function () {
this._collectorCnt--;
if (this._collectorCnt === 0) {
var events = this._collector.finalize();
this._collector = null;
if (events.length > 0) {
this._emit(events);
}
}
};
ViewEventEmitter.prototype._emit = function (events) {
var listeners = this._listeners.slice(0);
for (var i = 0, len = listeners.length; i < len; i++) {
safeInvokeListener(listeners[i], events);
}
};
ViewEventEmitter.prototype.addEventListener = function (listener) {
var _this = this;
this._listeners.push(listener);
return Object(lifecycle["h" /* toDisposable */])(function () {
var listeners = _this._listeners;
for (var i = 0, len = listeners.length; i < len; i++) {
if (listeners[i] === listener) {
listeners.splice(i, 1);
break;
}
}
});
};
return ViewEventEmitter;
}(lifecycle["a" /* Disposable */]));
var ViewEventsCollector = /** @class */ (function () {
function ViewEventsCollector() {
this._eventsLen = 0;
this._events = [];
this._eventsLen = 0;
}
ViewEventsCollector.prototype.emit = function (event) {
this._events[this._eventsLen++] = event;
};
ViewEventsCollector.prototype.finalize = function () {
var result = this._events;
this._events = [];
return result;
};
return ViewEventsCollector;
}());
function safeInvokeListener(listener, events) {
try {
listener(events);
}
catch (e) {
errors["e" /* onUnexpectedError */](e);
}
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/textAreaHandler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var textAreaHandler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var VisibleTextAreaData = /** @class */ (function () {
function VisibleTextAreaData(top, left, width) {
this.top = top;
this.left = left;
this.width = width;
}
VisibleTextAreaData.prototype.setWidth = function (width) {
return new VisibleTextAreaData(this.top, this.left, width);
};
return VisibleTextAreaData;
}());
var canUseZeroSizeTextarea = (browser["f" /* isEdgeOrIE */] || browser["h" /* isFirefox */]);
var textAreaHandler_TextAreaHandler = /** @class */ (function (_super) {
textAreaHandler_extends(TextAreaHandler, _super);
function TextAreaHandler(context, viewController, viewHelper) {
var _this = _super.call(this, context) || this;
// --- end view API
_this._primaryCursorPosition = new core_position["a" /* Position */](1, 1);
_this._primaryCursorVisibleRange = null;
_this._viewController = viewController;
_this._viewHelper = viewHelper;
_this._scrollLeft = 0;
_this._scrollTop = 0;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._setAccessibilityOptions(options);
_this._contentLeft = layoutInfo.contentLeft;
_this._contentWidth = layoutInfo.contentWidth;
_this._contentHeight = layoutInfo.height;
_this._fontInfo = options.get(34 /* fontInfo */);
_this._lineHeight = options.get(49 /* lineHeight */);
_this._emptySelectionClipboard = options.get(25 /* emptySelectionClipboard */);
_this._copyWithSyntaxHighlighting = options.get(15 /* copyWithSyntaxHighlighting */);
_this._visibleTextArea = null;
_this._selections = [new core_selection["a" /* Selection */](1, 1, 1, 1)];
_this._modelSelections = [new core_selection["a" /* Selection */](1, 1, 1, 1)];
_this._lastRenderPosition = null;
// Text Area (The focus will always be in the textarea when the cursor is blinking)
_this.textArea = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('textarea'));
viewPart_PartFingerprints.write(_this.textArea, 6 /* TextArea */);
_this.textArea.setClassName('inputarea');
_this.textArea.setAttribute('wrap', 'off');
_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(options));
_this.textArea.setAttribute('role', 'textbox');
_this.textArea.setAttribute('aria-multiline', 'true');
_this.textArea.setAttribute('aria-haspopup', 'false');
_this.textArea.setAttribute('aria-autocomplete', 'both');
if (platform["g" /* isWeb */] && options.get(68 /* readOnly */)) {
_this.textArea.setAttribute('readonly', 'true');
}
_this.textAreaCover = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this.textAreaCover.setPosition('absolute');
var simpleModel = {
getLineCount: function () {
return _this._context.model.getLineCount();
},
getLineMaxColumn: function (lineNumber) {
return _this._context.model.getLineMaxColumn(lineNumber);
},
getValueInRange: function (range, eol) {
return _this._context.model.getValueInRange(range, eol);
}
};
var textAreaInputHost = {
getDataToCopy: function (generateHTML) {
var rawTextToCopy = _this._context.model.getPlainTextToCopy(_this._modelSelections, _this._emptySelectionClipboard, platform["h" /* isWindows */]);
var newLineCharacter = _this._context.model.getEOL();
var isFromEmptySelection = (_this._emptySelectionClipboard && _this._modelSelections.length === 1 && _this._modelSelections[0].isEmpty());
var multicursorText = (Array.isArray(rawTextToCopy) ? rawTextToCopy : null);
var text = (Array.isArray(rawTextToCopy) ? rawTextToCopy.join(newLineCharacter) : rawTextToCopy);
var html = undefined;
var mode = null;
if (generateHTML) {
if (textAreaInput["a" /* CopyOptions */].forceCopyWithSyntaxHighlighting || (_this._copyWithSyntaxHighlighting && text.length < 65536)) {
var richText = _this._context.model.getRichTextToCopy(_this._modelSelections, _this._emptySelectionClipboard);
if (richText) {
html = richText.html;
mode = richText.mode;
}
}
}
return {
isFromEmptySelection: isFromEmptySelection,
multicursorText: multicursorText,
text: text,
html: html,
mode: mode
};
},
getScreenReaderContent: function (currentState) {
if (browser["j" /* isIPad */]) {
// Do not place anything in the textarea for the iPad
return textAreaState["b" /* TextAreaState */].EMPTY;
}
if (_this._accessibilitySupport === 1 /* Disabled */) {
// We know for a fact that a screen reader is not attached
// On OSX, we write the character before the cursor to allow for "long-press" composition
// Also on OSX, we write the word before the cursor to allow for the Accessibility Keyboard to give good hints
if (platform["e" /* isMacintosh */]) {
var selection = _this._selections[0];
if (selection.isEmpty()) {
var position = selection.getStartPosition();
var textBefore = _this._getWordBeforePosition(position);
if (textBefore.length === 0) {
textBefore = _this._getCharacterBeforePosition(position);
}
if (textBefore.length > 0) {
return new textAreaState["b" /* TextAreaState */](textBefore, textBefore.length, textBefore.length, position, position);
}
}
}
return textAreaState["b" /* TextAreaState */].EMPTY;
}
return textAreaState["a" /* PagedScreenReaderStrategy */].fromEditorSelection(currentState, simpleModel, _this._selections[0], _this._accessibilityPageSize, _this._accessibilitySupport === 0 /* Unknown */);
},
deduceModelPosition: function (viewAnchorPosition, deltaOffset, lineFeedCnt) {
return _this._context.model.deduceModelPositionRelativeToViewPosition(viewAnchorPosition, deltaOffset, lineFeedCnt);
}
};
_this._textAreaInput = _this._register(new textAreaInput["b" /* TextAreaInput */](textAreaInputHost, _this.textArea));
_this._register(_this._textAreaInput.onKeyDown(function (e) {
_this._viewController.emitKeyDown(e);
}));
_this._register(_this._textAreaInput.onKeyUp(function (e) {
_this._viewController.emitKeyUp(e);
}));
_this._register(_this._textAreaInput.onPaste(function (e) {
var pasteOnNewLine = false;
var multicursorText = null;
var 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('keyboard', e.text, pasteOnNewLine, multicursorText, mode);
}));
_this._register(_this._textAreaInput.onCut(function () {
_this._viewController.cut('keyboard');
}));
_this._register(_this._textAreaInput.onType(function (e) {
if (e.replaceCharCnt) {
_this._viewController.replacePreviousChar('keyboard', e.text, e.replaceCharCnt);
}
else {
_this._viewController.type('keyboard', e.text);
}
}));
_this._register(_this._textAreaInput.onSelectionChangeRequest(function (modelSelection) {
_this._viewController.setSelection('keyboard', modelSelection);
}));
_this._register(_this._textAreaInput.onCompositionStart(function () {
var lineNumber = _this._selections[0].startLineNumber;
var column = _this._selections[0].startColumn;
_this._context.privateViewEventBus.emit(new ViewRevealRangeRequestEvent('keyboard', new core_range["a" /* Range */](lineNumber, column, lineNumber, column), 0 /* Simple */, true, 1 /* Immediate */));
// Find range pixel position
var visibleRange = _this._viewHelper.visibleRangeForPositionRelativeToEditor(lineNumber, column);
if (visibleRange) {
_this._visibleTextArea = new VisibleTextAreaData(_this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber), visibleRange.left, canUseZeroSizeTextarea ? 0 : 1);
_this._render();
}
// Show the textarea
_this.textArea.setClassName('inputarea ime-input');
_this._viewController.compositionStart('keyboard');
}));
_this._register(_this._textAreaInput.onCompositionUpdate(function (e) {
if (browser["f" /* isEdgeOrIE */]) {
// Due to isEdgeOrIE (where the textarea was not cleared initially)
// we cannot assume the text consists only of the composited text
_this._visibleTextArea = _this._visibleTextArea.setWidth(0);
}
else {
// adjust width by its size
_this._visibleTextArea = _this._visibleTextArea.setWidth(measureText(e.data, _this._fontInfo));
}
_this._render();
}));
_this._register(_this._textAreaInput.onCompositionEnd(function () {
_this._visibleTextArea = null;
_this._render();
_this.textArea.setClassName('inputarea');
_this._viewController.compositionEnd('keyboard');
}));
_this._register(_this._textAreaInput.onFocus(function () {
_this._context.privateViewEventBus.emit(new ViewFocusChangedEvent(true));
}));
_this._register(_this._textAreaInput.onBlur(function () {
_this._context.privateViewEventBus.emit(new ViewFocusChangedEvent(false));
}));
return _this;
}
TextAreaHandler.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
TextAreaHandler.prototype._getWordBeforePosition = function (position) {
var lineContent = this._context.model.getLineContent(position.lineNumber);
var wordSeparators = Object(wordCharacterClassifier["a" /* getMapForWordSeparators */])(this._context.configuration.options.get(96 /* wordSeparators */));
var column = position.column;
var distance = 0;
while (column > 1) {
var charCode = lineContent.charCodeAt(column - 2);
var charClass = wordSeparators.get(charCode);
if (charClass !== 0 /* Regular */ || distance > 50) {
return lineContent.substring(column - 1, position.column - 1);
}
distance++;
column--;
}
return lineContent.substring(0, position.column - 1);
};
TextAreaHandler.prototype._getCharacterBeforePosition = function (position) {
if (position.column > 1) {
var lineContent = this._context.model.getLineContent(position.lineNumber);
var charBefore = lineContent.charAt(position.column - 2);
if (!strings["z" /* isHighSurrogate */](charBefore.charCodeAt(0))) {
return charBefore;
}
}
return '';
};
TextAreaHandler.prototype._getAriaLabel = function (options) {
var accessibilitySupport = options.get(2 /* accessibilitySupport */);
if (accessibilitySupport === 1 /* Disabled */) {
return nls["a" /* localize */]('accessibilityOffAriaLabel', "The editor is not accessible at this time. Press Alt+F1 for options.");
}
return options.get(4 /* ariaLabel */);
};
TextAreaHandler.prototype._setAccessibilityOptions = function (options) {
this._accessibilitySupport = options.get(2 /* accessibilitySupport */);
var accessibilityPageSize = options.get(3 /* accessibilityPageSize */);
if (this._accessibilitySupport === 2 /* Enabled */ && accessibilityPageSize === editorOptions["e" /* EditorOptions */].accessibilityPageSize.defaultValue) {
// If a screen reader is attached and the default value is not set we shuold automatically increase the page size to 160 for a better experience
// If we put more than 160 lines the nvda can not handle this https://github.com/microsoft/vscode/issues/89717
this._accessibilityPageSize = 160;
}
else {
this._accessibilityPageSize = accessibilityPageSize;
}
};
// --- begin event handlers
TextAreaHandler.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._setAccessibilityOptions(options);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._contentHeight = layoutInfo.height;
this._fontInfo = options.get(34 /* fontInfo */);
this._lineHeight = options.get(49 /* lineHeight */);
this._emptySelectionClipboard = options.get(25 /* emptySelectionClipboard */);
this._copyWithSyntaxHighlighting = options.get(15 /* copyWithSyntaxHighlighting */);
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
if (platform["g" /* isWeb */] && e.hasChanged(68 /* readOnly */)) {
if (options.get(68 /* readOnly */)) {
this.textArea.setAttribute('readonly', 'true');
}
else {
this.textArea.removeAttribute('readonly');
}
}
if (e.hasChanged(2 /* accessibilitySupport */)) {
this._textAreaInput.writeScreenReaderContent('strategy changed');
}
return true;
};
TextAreaHandler.prototype.onCursorStateChanged = function (e) {
this._selections = e.selections.slice(0);
this._modelSelections = e.modelSelections.slice(0);
this._textAreaInput.writeScreenReaderContent('selection changed');
return true;
};
TextAreaHandler.prototype.onDecorationsChanged = function (e) {
// true for inline decorations that can end up relayouting text
return true;
};
TextAreaHandler.prototype.onFlushed = function (e) {
return true;
};
TextAreaHandler.prototype.onLinesChanged = function (e) {
return true;
};
TextAreaHandler.prototype.onLinesDeleted = function (e) {
return true;
};
TextAreaHandler.prototype.onLinesInserted = function (e) {
return true;
};
TextAreaHandler.prototype.onScrollChanged = function (e) {
this._scrollLeft = e.scrollLeft;
this._scrollTop = e.scrollTop;
return true;
};
TextAreaHandler.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
// --- begin view API
TextAreaHandler.prototype.isFocused = function () {
return this._textAreaInput.isFocused();
};
TextAreaHandler.prototype.focusTextArea = function () {
this._textAreaInput.focusTextArea();
};
TextAreaHandler.prototype.getLastRenderData = function () {
return this._lastRenderPosition;
};
TextAreaHandler.prototype.setAriaOptions = function (options) {
if (options.activeDescendant) {
this.textArea.setAttribute('aria-haspopup', 'true');
this.textArea.setAttribute('aria-autocomplete', 'list');
this.textArea.setAttribute('aria-activedescendant', options.activeDescendant);
}
else {
this.textArea.setAttribute('aria-haspopup', 'false');
this.textArea.setAttribute('aria-autocomplete', 'both');
this.textArea.removeAttribute('aria-activedescendant');
}
};
TextAreaHandler.prototype.prepareRender = function (ctx) {
this._primaryCursorPosition = new core_position["a" /* Position */](this._selections[0].positionLineNumber, this._selections[0].positionColumn);
this._primaryCursorVisibleRange = ctx.visibleRangeForPosition(this._primaryCursorPosition);
};
TextAreaHandler.prototype.render = function (ctx) {
this._textAreaInput.writeScreenReaderContent('render');
this._render();
};
TextAreaHandler.prototype._render = function () {
if (this._visibleTextArea) {
// The text area is visible for composition reasons
this._renderInsideEditor(null, this._visibleTextArea.top - this._scrollTop, this._contentLeft + this._visibleTextArea.left - this._scrollLeft, this._visibleTextArea.width, this._lineHeight);
return;
}
if (!this._primaryCursorVisibleRange) {
// The primary cursor is outside the viewport => place textarea to the top left
this._renderAtTopLeft();
return;
}
var left = this._contentLeft + this._primaryCursorVisibleRange.left - this._scrollLeft;
if (left < this._contentLeft || left > this._contentLeft + this._contentWidth) {
// cursor is outside the viewport
this._renderAtTopLeft();
return;
}
var top = this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber) - this._scrollTop;
if (top < 0 || top > this._contentHeight) {
// cursor is outside the viewport
this._renderAtTopLeft();
return;
}
// The primary cursor is in the viewport (at least vertically) => place textarea on the cursor
if (platform["e" /* isMacintosh */]) {
// For the popup emoji input, we will make the text area as high as the line height
// We will also make the fontSize and lineHeight the correct dimensions to help with the placement of these pickers
this._renderInsideEditor(this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, this._lineHeight);
return;
}
this._renderInsideEditor(this._primaryCursorPosition, top, left, canUseZeroSizeTextarea ? 0 : 1, canUseZeroSizeTextarea ? 0 : 1);
};
TextAreaHandler.prototype._renderInsideEditor = function (renderedPosition, top, left, width, height) {
this._lastRenderPosition = renderedPosition;
var ta = this.textArea;
var tac = this.textAreaCover;
config_configuration["a" /* Configuration */].applyFontInfo(ta, this._fontInfo);
ta.setTop(top);
ta.setLeft(left);
ta.setWidth(width);
ta.setHeight(height);
tac.setTop(0);
tac.setLeft(0);
tac.setWidth(0);
tac.setHeight(0);
};
TextAreaHandler.prototype._renderAtTopLeft = function () {
this._lastRenderPosition = null;
var ta = this.textArea;
var tac = this.textAreaCover;
config_configuration["a" /* Configuration */].applyFontInfo(ta, this._fontInfo);
ta.setTop(0);
ta.setLeft(0);
tac.setTop(0);
tac.setLeft(0);
if (canUseZeroSizeTextarea) {
ta.setWidth(0);
ta.setHeight(0);
tac.setWidth(0);
tac.setHeight(0);
return;
}
// (in WebKit the textarea is 1px by 1px because it cannot handle input to a 0x0 textarea)
// specifically, when doing Korean IME, setting the textarea to 0x0 breaks IME badly.
ta.setWidth(1);
ta.setHeight(1);
tac.setWidth(1);
tac.setHeight(1);
var options = this._context.configuration.options;
if (options.get(40 /* glyphMargin */)) {
tac.setClassName('monaco-editor-background textAreaCover ' + margin_Margin.OUTER_CLASS_NAME);
}
else {
if (options.get(50 /* lineNumbers */).renderType !== 0 /* Off */) {
tac.setClassName('monaco-editor-background textAreaCover ' + lineNumbers_LineNumbersOverlay.CLASS_NAME);
}
else {
tac.setClassName('monaco-editor-background textAreaCover');
}
}
};
return TextAreaHandler;
}(ViewPart));
function measureText(text, fontInfo) {
// adjust width by its size
var canvasElem = document.createElement('canvas');
var context = canvasElem.getContext('2d');
context.font = createFontString(fontInfo);
var metrics = context.measureText(text);
if (browser["h" /* isFirefox */]) {
return metrics.width + 2; // +2 for Japanese...
}
else {
return metrics.width;
}
}
function createFontString(bareFontInfo) {
return doCreateFontString('normal', bareFontInfo.fontWeight, bareFontInfo.fontSize, bareFontInfo.lineHeight, bareFontInfo.fontFamily);
}
function doCreateFontString(fontStyle, fontWeight, fontSize, lineHeight, fontFamily) {
// The full font syntax is:
// style | variant | weight | stretch | size/line-height | fontFamily
// (https://developer.mozilla.org/en-US/docs/Web/CSS/font)
// But it appears Edge and IE11 cannot properly parse `stretch`.
return fontStyle + " normal " + fontWeight + " " + fontSize + "px / " + lineHeight + "px " + fontFamily;
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/controller/coreCommands.js + 1 modules
var coreCommands = __webpack_require__(93);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewController.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewController_ViewController = /** @class */ (function () {
function ViewController(configuration, viewModel, outgoingEvents, commandDelegate) {
this.configuration = configuration;
this.viewModel = viewModel;
this.outgoingEvents = outgoingEvents;
this.commandDelegate = commandDelegate;
}
ViewController.prototype._execMouseCommand = function (editorCommand, args) {
args.source = 'mouse';
this.commandDelegate.executeEditorCommand(editorCommand, args);
};
ViewController.prototype.paste = function (source, text, pasteOnNewLine, multicursorText, mode) {
this.commandDelegate.paste(source, text, pasteOnNewLine, multicursorText, mode);
};
ViewController.prototype.type = function (source, text) {
this.commandDelegate.type(source, text);
};
ViewController.prototype.replacePreviousChar = function (source, text, replaceCharCnt) {
this.commandDelegate.replacePreviousChar(source, text, replaceCharCnt);
};
ViewController.prototype.compositionStart = function (source) {
this.commandDelegate.compositionStart(source);
};
ViewController.prototype.compositionEnd = function (source) {
this.commandDelegate.compositionEnd(source);
};
ViewController.prototype.cut = function (source) {
this.commandDelegate.cut(source);
};
ViewController.prototype.setSelection = function (source, modelSelection) {
this.commandDelegate.executeEditorCommand(coreCommands["b" /* CoreNavigationCommands */].SetSelection, {
source: source,
selection: modelSelection
});
};
ViewController.prototype._validateViewColumn = function (viewPosition) {
var minColumn = this.viewModel.getLineMinColumn(viewPosition.lineNumber);
if (viewPosition.column < minColumn) {
return new core_position["a" /* Position */](viewPosition.lineNumber, minColumn);
}
return viewPosition;
};
ViewController.prototype._hasMulticursorModifier = function (data) {
switch (this.configuration.options.get(59 /* multiCursorModifier */)) {
case 'altKey':
return data.altKey;
case 'ctrlKey':
return data.ctrlKey;
case 'metaKey':
return data.metaKey;
}
return false;
};
ViewController.prototype._hasNonMulticursorModifier = function (data) {
switch (this.configuration.options.get(59 /* multiCursorModifier */)) {
case 'altKey':
return data.ctrlKey || data.metaKey;
case 'ctrlKey':
return data.altKey || data.metaKey;
case 'metaKey':
return data.ctrlKey || data.altKey;
}
return false;
};
ViewController.prototype.dispatchMouse = function (data) {
var selectionClipboardIsOn = (platform["d" /* isLinux */] && this.configuration.options.get(81 /* selectionClipboard */));
if (data.middleButton && !selectionClipboardIsOn) {
this._columnSelect(data.position, data.mouseColumn, data.inSelectionMode);
}
else if (data.startedOnLineNumbers) {
// If the dragging started on the gutter, then have operations work on the entire line
if (this._hasMulticursorModifier(data)) {
if (data.inSelectionMode) {
this._lastCursorLineSelect(data.position);
}
else {
this._createCursor(data.position, true);
}
}
else {
if (data.inSelectionMode) {
this._lineSelectDrag(data.position);
}
else {
this._lineSelect(data.position);
}
}
}
else if (data.mouseDownCount >= 4) {
this._selectAll();
}
else if (data.mouseDownCount === 3) {
if (this._hasMulticursorModifier(data)) {
if (data.inSelectionMode) {
this._lastCursorLineSelectDrag(data.position);
}
else {
this._lastCursorLineSelect(data.position);
}
}
else {
if (data.inSelectionMode) {
this._lineSelectDrag(data.position);
}
else {
this._lineSelect(data.position);
}
}
}
else if (data.mouseDownCount === 2) {
if (this._hasMulticursorModifier(data)) {
this._lastCursorWordSelect(data.position);
}
else {
if (data.inSelectionMode) {
this._wordSelectDrag(data.position);
}
else {
this._wordSelect(data.position);
}
}
}
else {
if (this._hasMulticursorModifier(data)) {
if (!this._hasNonMulticursorModifier(data)) {
if (data.shiftKey) {
this._columnSelect(data.position, data.mouseColumn, true);
}
else {
// Do multi-cursor operations only when purely alt is pressed
if (data.inSelectionMode) {
this._lastCursorMoveToSelect(data.position);
}
else {
this._createCursor(data.position, false);
}
}
}
}
else {
if (data.inSelectionMode) {
if (data.altKey) {
this._columnSelect(data.position, data.mouseColumn, true);
}
else {
this._moveToSelect(data.position);
}
}
else {
this.moveTo(data.position);
}
}
}
};
ViewController.prototype._usualArgs = function (viewPosition) {
viewPosition = this._validateViewColumn(viewPosition);
return {
position: this._convertViewToModelPosition(viewPosition),
viewPosition: viewPosition
};
};
ViewController.prototype.moveTo = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].MoveTo, this._usualArgs(viewPosition));
};
ViewController.prototype._moveToSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].MoveToSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._columnSelect = function (viewPosition, mouseColumn, doColumnSelect) {
viewPosition = this._validateViewColumn(viewPosition);
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].ColumnSelect, {
position: this._convertViewToModelPosition(viewPosition),
viewPosition: viewPosition,
mouseColumn: mouseColumn,
doColumnSelect: doColumnSelect
});
};
ViewController.prototype._createCursor = function (viewPosition, wholeLine) {
viewPosition = this._validateViewColumn(viewPosition);
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].CreateCursor, {
position: this._convertViewToModelPosition(viewPosition),
viewPosition: viewPosition,
wholeLine: wholeLine
});
};
ViewController.prototype._lastCursorMoveToSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LastCursorMoveToSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._wordSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].WordSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._wordSelectDrag = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].WordSelectDrag, this._usualArgs(viewPosition));
};
ViewController.prototype._lastCursorWordSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LastCursorWordSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._lineSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LineSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._lineSelectDrag = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LineSelectDrag, this._usualArgs(viewPosition));
};
ViewController.prototype._lastCursorLineSelect = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LastCursorLineSelect, this._usualArgs(viewPosition));
};
ViewController.prototype._lastCursorLineSelectDrag = function (viewPosition) {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].LastCursorLineSelectDrag, this._usualArgs(viewPosition));
};
ViewController.prototype._selectAll = function () {
this._execMouseCommand(coreCommands["b" /* CoreNavigationCommands */].SelectAll, {});
};
// ----------------------
ViewController.prototype._convertViewToModelPosition = function (viewPosition) {
return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(viewPosition);
};
ViewController.prototype.emitKeyDown = function (e) {
this.outgoingEvents.emitKeyDown(e);
};
ViewController.prototype.emitKeyUp = function (e) {
this.outgoingEvents.emitKeyUp(e);
};
ViewController.prototype.emitContextMenu = function (e) {
this.outgoingEvents.emitContextMenu(e);
};
ViewController.prototype.emitMouseMove = function (e) {
this.outgoingEvents.emitMouseMove(e);
};
ViewController.prototype.emitMouseLeave = function (e) {
this.outgoingEvents.emitMouseLeave(e);
};
ViewController.prototype.emitMouseUp = function (e) {
this.outgoingEvents.emitMouseUp(e);
};
ViewController.prototype.emitMouseDown = function (e) {
this.outgoingEvents.emitMouseDown(e);
};
ViewController.prototype.emitMouseDrag = function (e) {
this.outgoingEvents.emitMouseDrag(e);
};
ViewController.prototype.emitMouseDrop = function (e) {
this.outgoingEvents.emitMouseDrop(e);
};
ViewController.prototype.emitMouseWheel = function (e) {
this.outgoingEvents.emitMouseWheel(e);
};
return ViewController;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewOutgoingEvents.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewOutgoingEvents_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ViewOutgoingEvents = /** @class */ (function (_super) {
viewOutgoingEvents_extends(ViewOutgoingEvents, _super);
function ViewOutgoingEvents(viewModel) {
var _this = _super.call(this) || this;
_this.onDidContentSizeChange = null;
_this.onDidScroll = null;
_this.onDidGainFocus = null;
_this.onDidLoseFocus = null;
_this.onKeyDown = null;
_this.onKeyUp = null;
_this.onContextMenu = null;
_this.onMouseMove = null;
_this.onMouseLeave = null;
_this.onMouseUp = null;
_this.onMouseDown = null;
_this.onMouseDrag = null;
_this.onMouseDrop = null;
_this.onMouseWheel = null;
_this._viewModel = viewModel;
return _this;
}
ViewOutgoingEvents.prototype.emitContentSizeChange = function (e) {
if (this.onDidContentSizeChange) {
this.onDidContentSizeChange(e);
}
};
ViewOutgoingEvents.prototype.emitScrollChanged = function (e) {
if (this.onDidScroll) {
this.onDidScroll(e);
}
};
ViewOutgoingEvents.prototype.emitViewFocusGained = function () {
if (this.onDidGainFocus) {
this.onDidGainFocus(undefined);
}
};
ViewOutgoingEvents.prototype.emitViewFocusLost = function () {
if (this.onDidLoseFocus) {
this.onDidLoseFocus(undefined);
}
};
ViewOutgoingEvents.prototype.emitKeyDown = function (e) {
if (this.onKeyDown) {
this.onKeyDown(e);
}
};
ViewOutgoingEvents.prototype.emitKeyUp = function (e) {
if (this.onKeyUp) {
this.onKeyUp(e);
}
};
ViewOutgoingEvents.prototype.emitContextMenu = function (e) {
if (this.onContextMenu) {
this.onContextMenu(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseMove = function (e) {
if (this.onMouseMove) {
this.onMouseMove(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseLeave = function (e) {
if (this.onMouseLeave) {
this.onMouseLeave(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseUp = function (e) {
if (this.onMouseUp) {
this.onMouseUp(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseDown = function (e) {
if (this.onMouseDown) {
this.onMouseDown(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseDrag = function (e) {
if (this.onMouseDrag) {
this.onMouseDrag(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseDrop = function (e) {
if (this.onMouseDrop) {
this.onMouseDrop(this._convertViewToModelMouseEvent(e));
}
};
ViewOutgoingEvents.prototype.emitMouseWheel = function (e) {
if (this.onMouseWheel) {
this.onMouseWheel(e);
}
};
ViewOutgoingEvents.prototype._convertViewToModelMouseEvent = function (e) {
if (e.target) {
return {
event: e.event,
target: this._convertViewToModelMouseTarget(e.target)
};
}
return e;
};
ViewOutgoingEvents.prototype._convertViewToModelMouseTarget = function (target) {
return ViewOutgoingEvents.convertViewToModelMouseTarget(target, this._viewModel.coordinatesConverter);
};
ViewOutgoingEvents.convertViewToModelMouseTarget = function (target, coordinatesConverter) {
return new viewOutgoingEvents_ExternalMouseTarget(target.element, target.type, target.mouseColumn, target.position ? coordinatesConverter.convertViewPositionToModelPosition(target.position) : null, target.range ? coordinatesConverter.convertViewRangeToModelRange(target.range) : null, target.detail);
};
return ViewOutgoingEvents;
}(lifecycle["a" /* Disposable */]));
var viewOutgoingEvents_ExternalMouseTarget = /** @class */ (function () {
function ExternalMouseTarget(element, type, mouseColumn, position, range, detail) {
this.element = element;
this.type = type;
this.mouseColumn = mouseColumn;
this.position = position;
this.range = range;
this.detail = detail;
}
ExternalMouseTarget.prototype.toString = function () {
return mouseTarget_MouseTarget.toString(this);
};
return ExternalMouseTarget;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/stringBuilder.js
var stringBuilder = __webpack_require__(149);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewLayer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var RenderedLinesCollection = /** @class */ (function () {
function RenderedLinesCollection(createLine) {
this._createLine = createLine;
this._set(1, []);
}
RenderedLinesCollection.prototype.flush = function () {
this._set(1, []);
};
RenderedLinesCollection.prototype._set = function (rendLineNumberStart, lines) {
this._lines = lines;
this._rendLineNumberStart = rendLineNumberStart;
};
RenderedLinesCollection.prototype._get = function () {
return {
rendLineNumberStart: this._rendLineNumberStart,
lines: this._lines
};
};
/**
* @returns Inclusive line number that is inside this collection
*/
RenderedLinesCollection.prototype.getStartLineNumber = function () {
return this._rendLineNumberStart;
};
/**
* @returns Inclusive line number that is inside this collection
*/
RenderedLinesCollection.prototype.getEndLineNumber = function () {
return this._rendLineNumberStart + this._lines.length - 1;
};
RenderedLinesCollection.prototype.getCount = function () {
return this._lines.length;
};
RenderedLinesCollection.prototype.getLine = function (lineNumber) {
var lineIndex = lineNumber - this._rendLineNumberStart;
if (lineIndex < 0 || lineIndex >= this._lines.length) {
throw new Error('Illegal value for lineNumber');
}
return this._lines[lineIndex];
};
/**
* @returns Lines that were removed from this collection
*/
RenderedLinesCollection.prototype.onLinesDeleted = function (deleteFromLineNumber, deleteToLineNumber) {
if (this.getCount() === 0) {
// no lines
return null;
}
var startLineNumber = this.getStartLineNumber();
var endLineNumber = this.getEndLineNumber();
if (deleteToLineNumber < startLineNumber) {
// deleting above the viewport
var deleteCnt = deleteToLineNumber - deleteFromLineNumber + 1;
this._rendLineNumberStart -= deleteCnt;
return null;
}
if (deleteFromLineNumber > endLineNumber) {
// deleted below the viewport
return null;
}
// Record what needs to be deleted
var deleteStartIndex = 0;
var deleteCount = 0;
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var lineIndex = lineNumber - this._rendLineNumberStart;
if (deleteFromLineNumber <= lineNumber && lineNumber <= deleteToLineNumber) {
// this is a line to be deleted
if (deleteCount === 0) {
// this is the first line to be deleted
deleteStartIndex = lineIndex;
deleteCount = 1;
}
else {
deleteCount++;
}
}
}
// Adjust this._rendLineNumberStart for lines deleted above
if (deleteFromLineNumber < startLineNumber) {
// Something was deleted above
var deleteAboveCount = 0;
if (deleteToLineNumber < startLineNumber) {
// the entire deleted lines are above
deleteAboveCount = deleteToLineNumber - deleteFromLineNumber + 1;
}
else {
deleteAboveCount = startLineNumber - deleteFromLineNumber;
}
this._rendLineNumberStart -= deleteAboveCount;
}
var deleted = this._lines.splice(deleteStartIndex, deleteCount);
return deleted;
};
RenderedLinesCollection.prototype.onLinesChanged = function (changeFromLineNumber, changeToLineNumber) {
if (this.getCount() === 0) {
// no lines
return false;
}
var startLineNumber = this.getStartLineNumber();
var endLineNumber = this.getEndLineNumber();
var someoneNotified = false;
for (var changedLineNumber = changeFromLineNumber; changedLineNumber <= changeToLineNumber; changedLineNumber++) {
if (changedLineNumber >= startLineNumber && changedLineNumber <= endLineNumber) {
// Notify the line
this._lines[changedLineNumber - this._rendLineNumberStart].onContentChanged();
someoneNotified = true;
}
}
return someoneNotified;
};
RenderedLinesCollection.prototype.onLinesInserted = function (insertFromLineNumber, insertToLineNumber) {
if (this.getCount() === 0) {
// no lines
return null;
}
var insertCnt = insertToLineNumber - insertFromLineNumber + 1;
var startLineNumber = this.getStartLineNumber();
var endLineNumber = this.getEndLineNumber();
if (insertFromLineNumber <= startLineNumber) {
// inserting above the viewport
this._rendLineNumberStart += insertCnt;
return null;
}
if (insertFromLineNumber > endLineNumber) {
// inserting below the viewport
return null;
}
if (insertCnt + insertFromLineNumber > endLineNumber) {
// insert inside the viewport in such a way that all remaining lines are pushed outside
var deleted = this._lines.splice(insertFromLineNumber - this._rendLineNumberStart, endLineNumber - insertFromLineNumber + 1);
return deleted;
}
// insert inside the viewport, push out some lines, but not all remaining lines
var newLines = [];
for (var i = 0; i < insertCnt; i++) {
newLines[i] = this._createLine();
}
var insertIndex = insertFromLineNumber - this._rendLineNumberStart;
var beforeLines = this._lines.slice(0, insertIndex);
var afterLines = this._lines.slice(insertIndex, this._lines.length - insertCnt);
var deletedLines = this._lines.slice(this._lines.length - insertCnt, this._lines.length);
this._lines = beforeLines.concat(newLines).concat(afterLines);
return deletedLines;
};
RenderedLinesCollection.prototype.onTokensChanged = function (ranges) {
if (this.getCount() === 0) {
// no lines
return false;
}
var startLineNumber = this.getStartLineNumber();
var endLineNumber = this.getEndLineNumber();
var notifiedSomeone = false;
for (var i = 0, len = ranges.length; i < len; i++) {
var rng = ranges[i];
if (rng.toLineNumber < startLineNumber || rng.fromLineNumber > endLineNumber) {
// range outside viewport
continue;
}
var from = Math.max(startLineNumber, rng.fromLineNumber);
var to = Math.min(endLineNumber, rng.toLineNumber);
for (var lineNumber = from; lineNumber <= to; lineNumber++) {
var lineIndex = lineNumber - this._rendLineNumberStart;
this._lines[lineIndex].onTokensChanged();
notifiedSomeone = true;
}
}
return notifiedSomeone;
};
return RenderedLinesCollection;
}());
var viewLayer_VisibleLinesCollection = /** @class */ (function () {
function VisibleLinesCollection(host) {
var _this = this;
this._host = host;
this.domNode = this._createDomNode();
this._linesCollection = new RenderedLinesCollection(function () { return _this._host.createVisibleLine(); });
}
VisibleLinesCollection.prototype._createDomNode = function () {
var domNode = Object(fastDomNode["b" /* 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
VisibleLinesCollection.prototype.onConfigurationChanged = function (e) {
if (e.hasChanged(107 /* layoutInfo */)) {
return true;
}
return false;
};
VisibleLinesCollection.prototype.onFlushed = function (e) {
this._linesCollection.flush();
// No need to clear the dom node because a full .innerHTML will occur in ViewLayerRenderer._render
return true;
};
VisibleLinesCollection.prototype.onLinesChanged = function (e) {
return this._linesCollection.onLinesChanged(e.fromLineNumber, e.toLineNumber);
};
VisibleLinesCollection.prototype.onLinesDeleted = function (e) {
var deleted = this._linesCollection.onLinesDeleted(e.fromLineNumber, e.toLineNumber);
if (deleted) {
// Remove from DOM
for (var i = 0, len = deleted.length; i < len; i++) {
var lineDomNode = deleted[i].getDomNode();
if (lineDomNode) {
this.domNode.domNode.removeChild(lineDomNode);
}
}
}
return true;
};
VisibleLinesCollection.prototype.onLinesInserted = function (e) {
var deleted = this._linesCollection.onLinesInserted(e.fromLineNumber, e.toLineNumber);
if (deleted) {
// Remove from DOM
for (var i = 0, len = deleted.length; i < len; i++) {
var lineDomNode = deleted[i].getDomNode();
if (lineDomNode) {
this.domNode.domNode.removeChild(lineDomNode);
}
}
}
return true;
};
VisibleLinesCollection.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged;
};
VisibleLinesCollection.prototype.onTokensChanged = function (e) {
return this._linesCollection.onTokensChanged(e.ranges);
};
VisibleLinesCollection.prototype.onZonesChanged = function (e) {
return true;
};
// ---- end view event handlers
VisibleLinesCollection.prototype.getStartLineNumber = function () {
return this._linesCollection.getStartLineNumber();
};
VisibleLinesCollection.prototype.getEndLineNumber = function () {
return this._linesCollection.getEndLineNumber();
};
VisibleLinesCollection.prototype.getVisibleLine = function (lineNumber) {
return this._linesCollection.getLine(lineNumber);
};
VisibleLinesCollection.prototype.renderLines = function (viewportData) {
var inp = this._linesCollection._get();
var renderer = new viewLayer_ViewLayerRenderer(this.domNode.domNode, this._host, viewportData);
var ctx = {
rendLineNumberStart: inp.rendLineNumberStart,
lines: inp.lines,
linesLength: inp.lines.length
};
// Decide if this render will do a single update (single large .innerHTML) or many updates (inserting/removing dom nodes)
var resCtx = renderer.render(ctx, viewportData.startLineNumber, viewportData.endLineNumber, viewportData.relativeVerticalOffset);
this._linesCollection._set(resCtx.rendLineNumberStart, resCtx.lines);
};
return VisibleLinesCollection;
}());
var viewLayer_ViewLayerRenderer = /** @class */ (function () {
function ViewLayerRenderer(domNode, host, viewportData) {
this.domNode = domNode;
this.host = host;
this.viewportData = viewportData;
}
ViewLayerRenderer.prototype.render = function (inContext, startLineNumber, stopLineNumber, deltaTop) {
var ctx = {
rendLineNumberStart: inContext.rendLineNumberStart,
lines: inContext.lines.slice(0),
linesLength: inContext.linesLength
};
if ((ctx.rendLineNumberStart + ctx.linesLength - 1 < startLineNumber) || (stopLineNumber < ctx.rendLineNumberStart)) {
// There is no overlap whatsoever
ctx.rendLineNumberStart = startLineNumber;
ctx.linesLength = stopLineNumber - startLineNumber + 1;
ctx.lines = [];
for (var x = startLineNumber; x <= stopLineNumber; x++) {
ctx.lines[x - startLineNumber] = this.host.createVisibleLine();
}
this._finishRendering(ctx, true, deltaTop);
return ctx;
}
// Update lines which will remain untouched
this._renderUntouchedLines(ctx, Math.max(startLineNumber - ctx.rendLineNumberStart, 0), Math.min(stopLineNumber - ctx.rendLineNumberStart, ctx.linesLength - 1), deltaTop, startLineNumber);
if (ctx.rendLineNumberStart > startLineNumber) {
// Insert lines before
var fromLineNumber = startLineNumber;
var 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) {
// Remove lines before
var 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) {
// Insert lines after
var fromLineNumber = ctx.rendLineNumberStart + ctx.linesLength;
var 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) {
// Remove lines after
var fromLineNumber = Math.max(0, stopLineNumber - ctx.rendLineNumberStart + 1);
var toLineNumber = ctx.linesLength - 1;
var removeCnt = toLineNumber - fromLineNumber + 1;
if (removeCnt > 0) {
this._removeLinesAfter(ctx, removeCnt);
ctx.linesLength -= removeCnt;
}
}
this._finishRendering(ctx, false, deltaTop);
return ctx;
};
ViewLayerRenderer.prototype._renderUntouchedLines = function (ctx, startIndex, endIndex, deltaTop, deltaLN) {
var rendLineNumberStart = ctx.rendLineNumberStart;
var lines = ctx.lines;
for (var i = startIndex; i <= endIndex; i++) {
var lineNumber = rendLineNumberStart + i;
lines[i].layoutLine(lineNumber, deltaTop[lineNumber - deltaLN]);
}
};
ViewLayerRenderer.prototype._insertLinesBefore = function (ctx, fromLineNumber, toLineNumber, deltaTop, deltaLN) {
var newLines = [];
var newLinesLen = 0;
for (var lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
newLines[newLinesLen++] = this.host.createVisibleLine();
}
ctx.lines = newLines.concat(ctx.lines);
};
ViewLayerRenderer.prototype._removeLinesBefore = function (ctx, removeCount) {
for (var i = 0; i < removeCount; i++) {
var lineDomNode = ctx.lines[i].getDomNode();
if (lineDomNode) {
this.domNode.removeChild(lineDomNode);
}
}
ctx.lines.splice(0, removeCount);
};
ViewLayerRenderer.prototype._insertLinesAfter = function (ctx, fromLineNumber, toLineNumber, deltaTop, deltaLN) {
var newLines = [];
var newLinesLen = 0;
for (var lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
newLines[newLinesLen++] = this.host.createVisibleLine();
}
ctx.lines = ctx.lines.concat(newLines);
};
ViewLayerRenderer.prototype._removeLinesAfter = function (ctx, removeCount) {
var removeIndex = ctx.linesLength - removeCount;
for (var i = 0; i < removeCount; i++) {
var lineDomNode = ctx.lines[removeIndex + i].getDomNode();
if (lineDomNode) {
this.domNode.removeChild(lineDomNode);
}
}
ctx.lines.splice(removeIndex, removeCount);
};
ViewLayerRenderer.prototype._finishRenderingNewLines = function (ctx, domNodeIsEmpty, newLinesHTML, wasNew) {
var lastChild = this.domNode.lastChild;
if (domNodeIsEmpty || !lastChild) {
this.domNode.innerHTML = newLinesHTML;
}
else {
lastChild.insertAdjacentHTML('afterend', newLinesHTML);
}
var currChild = this.domNode.lastChild;
for (var i = ctx.linesLength - 1; i >= 0; i--) {
var line = ctx.lines[i];
if (wasNew[i]) {
line.setDomNode(currChild);
currChild = currChild.previousSibling;
}
}
};
ViewLayerRenderer.prototype._finishRenderingInvalidLines = function (ctx, invalidLinesHTML, wasInvalid) {
var hugeDomNode = document.createElement('div');
hugeDomNode.innerHTML = invalidLinesHTML;
for (var i = 0; i < ctx.linesLength; i++) {
var line = ctx.lines[i];
if (wasInvalid[i]) {
var source = hugeDomNode.firstChild;
var lineDomNode = line.getDomNode();
lineDomNode.parentNode.replaceChild(source, lineDomNode);
line.setDomNode(source);
}
}
};
ViewLayerRenderer.prototype._finishRendering = function (ctx, domNodeIsEmpty, deltaTop) {
var sb = ViewLayerRenderer._sb;
var linesLength = ctx.linesLength;
var lines = ctx.lines;
var rendLineNumberStart = ctx.rendLineNumberStart;
var wasNew = [];
{
sb.reset();
var hadNewLine = false;
for (var i = 0; i < linesLength; i++) {
var line = lines[i];
wasNew[i] = false;
var lineDomNode = line.getDomNode();
if (lineDomNode) {
// line is not new
continue;
}
var renderResult = line.renderLine(i + rendLineNumberStart, deltaTop[i], this.viewportData, sb);
if (!renderResult) {
// line does not need rendering
continue;
}
wasNew[i] = true;
hadNewLine = true;
}
if (hadNewLine) {
this._finishRenderingNewLines(ctx, domNodeIsEmpty, sb.build(), wasNew);
}
}
{
sb.reset();
var hadInvalidLine = false;
var wasInvalid = [];
for (var i = 0; i < linesLength; i++) {
var line = lines[i];
wasInvalid[i] = false;
if (wasNew[i]) {
// line was new
continue;
}
var renderResult = line.renderLine(i + rendLineNumberStart, deltaTop[i], this.viewportData, sb);
if (!renderResult) {
// line does not need rendering
continue;
}
wasInvalid[i] = true;
hadInvalidLine = true;
}
if (hadInvalidLine) {
this._finishRenderingInvalidLines(ctx, sb.build(), wasInvalid);
}
}
};
ViewLayerRenderer._sb = Object(stringBuilder["a" /* createStringBuilder */])(100000);
return ViewLayerRenderer;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewOverlays.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewOverlays_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var viewOverlays_ViewOverlays = /** @class */ (function (_super) {
viewOverlays_extends(ViewOverlays, _super);
function ViewOverlays(context) {
var _this = _super.call(this, context) || this;
_this._visibleLines = new viewLayer_VisibleLinesCollection(_this);
_this.domNode = _this._visibleLines.domNode;
_this._dynamicOverlays = [];
_this._isFocused = false;
_this.domNode.setClassName('view-overlays');
return _this;
}
ViewOverlays.prototype.shouldRender = function () {
if (_super.prototype.shouldRender.call(this)) {
return true;
}
for (var i = 0, len = this._dynamicOverlays.length; i < len; i++) {
var dynamicOverlay = this._dynamicOverlays[i];
if (dynamicOverlay.shouldRender()) {
return true;
}
}
return false;
};
ViewOverlays.prototype.dispose = function () {
_super.prototype.dispose.call(this);
for (var i = 0, len = this._dynamicOverlays.length; i < len; i++) {
var dynamicOverlay = this._dynamicOverlays[i];
dynamicOverlay.dispose();
}
this._dynamicOverlays = [];
};
ViewOverlays.prototype.getDomNode = function () {
return this.domNode;
};
// ---- begin IVisibleLinesHost
ViewOverlays.prototype.createVisibleLine = function () {
return new viewOverlays_ViewOverlayLine(this._context.configuration, this._dynamicOverlays);
};
// ---- end IVisibleLinesHost
ViewOverlays.prototype.addDynamicOverlay = function (overlay) {
this._dynamicOverlays.push(overlay);
};
// ----- event handlers
ViewOverlays.prototype.onConfigurationChanged = function (e) {
this._visibleLines.onConfigurationChanged(e);
var startLineNumber = this._visibleLines.getStartLineNumber();
var endLineNumber = this._visibleLines.getEndLineNumber();
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var line = this._visibleLines.getVisibleLine(lineNumber);
line.onConfigurationChanged(e);
}
return true;
};
ViewOverlays.prototype.onFlushed = function (e) {
return this._visibleLines.onFlushed(e);
};
ViewOverlays.prototype.onFocusChanged = function (e) {
this._isFocused = e.isFocused;
return true;
};
ViewOverlays.prototype.onLinesChanged = function (e) {
return this._visibleLines.onLinesChanged(e);
};
ViewOverlays.prototype.onLinesDeleted = function (e) {
return this._visibleLines.onLinesDeleted(e);
};
ViewOverlays.prototype.onLinesInserted = function (e) {
return this._visibleLines.onLinesInserted(e);
};
ViewOverlays.prototype.onScrollChanged = function (e) {
return this._visibleLines.onScrollChanged(e) || true;
};
ViewOverlays.prototype.onTokensChanged = function (e) {
return this._visibleLines.onTokensChanged(e);
};
ViewOverlays.prototype.onZonesChanged = function (e) {
return this._visibleLines.onZonesChanged(e);
};
// ----- end event handlers
ViewOverlays.prototype.prepareRender = function (ctx) {
var toRender = this._dynamicOverlays.filter(function (overlay) { return overlay.shouldRender(); });
for (var i = 0, len = toRender.length; i < len; i++) {
var dynamicOverlay = toRender[i];
dynamicOverlay.prepareRender(ctx);
dynamicOverlay.onDidRender();
}
};
ViewOverlays.prototype.render = function (ctx) {
// Overwriting to bypass `shouldRender` flag
this._viewOverlaysRender(ctx);
this.domNode.toggleClassName('focused', this._isFocused);
};
ViewOverlays.prototype._viewOverlaysRender = function (ctx) {
this._visibleLines.renderLines(ctx.viewportData);
};
return ViewOverlays;
}(ViewPart));
var viewOverlays_ViewOverlayLine = /** @class */ (function () {
function ViewOverlayLine(configuration, dynamicOverlays) {
this._configuration = configuration;
this._lineHeight = this._configuration.options.get(49 /* lineHeight */);
this._dynamicOverlays = dynamicOverlays;
this._domNode = null;
this._renderedContent = null;
}
ViewOverlayLine.prototype.getDomNode = function () {
if (!this._domNode) {
return null;
}
return this._domNode.domNode;
};
ViewOverlayLine.prototype.setDomNode = function (domNode) {
this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(domNode);
};
ViewOverlayLine.prototype.onContentChanged = function () {
// Nothing
};
ViewOverlayLine.prototype.onTokensChanged = function () {
// Nothing
};
ViewOverlayLine.prototype.onConfigurationChanged = function (e) {
this._lineHeight = this._configuration.options.get(49 /* lineHeight */);
};
ViewOverlayLine.prototype.renderLine = function (lineNumber, deltaTop, viewportData, sb) {
var result = '';
for (var i = 0, len = this._dynamicOverlays.length; i < len; i++) {
var dynamicOverlay = this._dynamicOverlays[i];
result += dynamicOverlay.render(viewportData.startLineNumber, lineNumber);
}
if (this._renderedContent === result) {
// No rendering needed
return false;
}
this._renderedContent = result;
sb.appendASCIIString('
');
return true;
};
ViewOverlayLine.prototype.layoutLine = function (lineNumber, deltaTop) {
if (this._domNode) {
this._domNode.setTop(deltaTop);
this._domNode.setHeight(this._lineHeight);
}
};
return ViewOverlayLine;
}());
var ContentViewOverlays = /** @class */ (function (_super) {
viewOverlays_extends(ContentViewOverlays, _super);
function ContentViewOverlays(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._contentWidth = layoutInfo.contentWidth;
_this.domNode.setHeight(0);
return _this;
}
// --- begin event handlers
ContentViewOverlays.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._contentWidth = layoutInfo.contentWidth;
return _super.prototype.onConfigurationChanged.call(this, e) || true;
};
ContentViewOverlays.prototype.onScrollChanged = function (e) {
return _super.prototype.onScrollChanged.call(this, e) || e.scrollWidthChanged;
};
// --- end event handlers
ContentViewOverlays.prototype._viewOverlaysRender = function (ctx) {
_super.prototype._viewOverlaysRender.call(this, ctx);
this.domNode.setWidth(Math.max(ctx.scrollWidth, this._contentWidth));
};
return ContentViewOverlays;
}(viewOverlays_ViewOverlays));
var viewOverlays_MarginViewOverlays = /** @class */ (function (_super) {
viewOverlays_extends(MarginViewOverlays, _super);
function MarginViewOverlays(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._contentLeft = layoutInfo.contentLeft;
_this.domNode.setClassName('margin-view-overlays');
_this.domNode.setWidth(1);
config_configuration["a" /* Configuration */].applyFontInfo(_this.domNode, options.get(34 /* fontInfo */));
return _this;
}
MarginViewOverlays.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
config_configuration["a" /* Configuration */].applyFontInfo(this.domNode, options.get(34 /* fontInfo */));
var layoutInfo = options.get(107 /* layoutInfo */);
this._contentLeft = layoutInfo.contentLeft;
return _super.prototype.onConfigurationChanged.call(this, e) || true;
};
MarginViewOverlays.prototype.onScrollChanged = function (e) {
return _super.prototype.onScrollChanged.call(this, e) || e.scrollHeightChanged;
};
MarginViewOverlays.prototype._viewOverlaysRender = function (ctx) {
_super.prototype._viewOverlaysRender.call(this, ctx);
var height = Math.min(ctx.scrollHeight, 1000000);
this.domNode.setHeight(height);
this.domNode.setWidth(this._contentLeft);
};
return MarginViewOverlays;
}(viewOverlays_ViewOverlays));
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var contentWidgets_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Coordinate = /** @class */ (function () {
function Coordinate(top, left) {
this.top = top;
this.left = left;
}
return Coordinate;
}());
var contentWidgets_ViewContentWidgets = /** @class */ (function (_super) {
contentWidgets_extends(ViewContentWidgets, _super);
function ViewContentWidgets(context, viewDomNode) {
var _this = _super.call(this, context) || this;
_this._viewDomNode = viewDomNode;
_this._widgets = {};
_this.domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
viewPart_PartFingerprints.write(_this.domNode, 1 /* ContentWidgets */);
_this.domNode.setClassName('contentWidgets');
_this.domNode.setPosition('absolute');
_this.domNode.setTop(0);
_this.overflowingContentWidgetsDomNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
viewPart_PartFingerprints.write(_this.overflowingContentWidgetsDomNode, 2 /* OverflowingContentWidgets */);
_this.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');
return _this;
}
ViewContentWidgets.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._widgets = {};
};
// --- begin event handlers
ViewContentWidgets.prototype.onConfigurationChanged = function (e) {
var keys = Object.keys(this._widgets);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var widgetId = keys_1[_i];
this._widgets[widgetId].onConfigurationChanged(e);
}
return true;
};
ViewContentWidgets.prototype.onDecorationsChanged = function (e) {
// true for inline decorations that can end up relayouting text
return true;
};
ViewContentWidgets.prototype.onFlushed = function (e) {
return true;
};
ViewContentWidgets.prototype.onLineMappingChanged = function (e) {
var keys = Object.keys(this._widgets);
for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
var widgetId = keys_2[_i];
this._widgets[widgetId].onLineMappingChanged(e);
}
return true;
};
ViewContentWidgets.prototype.onLinesChanged = function (e) {
return true;
};
ViewContentWidgets.prototype.onLinesDeleted = function (e) {
return true;
};
ViewContentWidgets.prototype.onLinesInserted = function (e) {
return true;
};
ViewContentWidgets.prototype.onScrollChanged = function (e) {
return true;
};
ViewContentWidgets.prototype.onZonesChanged = function (e) {
return true;
};
// ---- end view event handlers
ViewContentWidgets.prototype.addWidget = function (_widget) {
var myWidget = new contentWidgets_Widget(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();
};
ViewContentWidgets.prototype.setWidgetPosition = function (widget, range, preference) {
var myWidget = this._widgets[widget.getId()];
myWidget.setPosition(range, preference);
this.setShouldRender();
};
ViewContentWidgets.prototype.removeWidget = function (widget) {
var widgetId = widget.getId();
if (this._widgets.hasOwnProperty(widgetId)) {
var myWidget = this._widgets[widgetId];
delete this._widgets[widgetId];
var domNode = myWidget.domNode.domNode;
domNode.parentNode.removeChild(domNode);
domNode.removeAttribute('monaco-visible-content-widget');
this.setShouldRender();
}
};
ViewContentWidgets.prototype.shouldSuppressMouseDownOnWidget = function (widgetId) {
if (this._widgets.hasOwnProperty(widgetId)) {
return this._widgets[widgetId].suppressMouseDown;
}
return false;
};
ViewContentWidgets.prototype.onBeforeRender = function (viewportData) {
var keys = Object.keys(this._widgets);
for (var _i = 0, keys_3 = keys; _i < keys_3.length; _i++) {
var widgetId = keys_3[_i];
this._widgets[widgetId].onBeforeRender(viewportData);
}
};
ViewContentWidgets.prototype.prepareRender = function (ctx) {
var keys = Object.keys(this._widgets);
for (var _i = 0, keys_4 = keys; _i < keys_4.length; _i++) {
var widgetId = keys_4[_i];
this._widgets[widgetId].prepareRender(ctx);
}
};
ViewContentWidgets.prototype.render = function (ctx) {
var keys = Object.keys(this._widgets);
for (var _i = 0, keys_5 = keys; _i < keys_5.length; _i++) {
var widgetId = keys_5[_i];
this._widgets[widgetId].render(ctx);
}
};
return ViewContentWidgets;
}(ViewPart));
var contentWidgets_Widget = /** @class */ (function () {
function Widget(context, viewDomNode, actual) {
this._context = context;
this._viewDomNode = viewDomNode;
this._actual = actual;
this.domNode = Object(fastDomNode["b" /* createFastDomNode */])(this._actual.getDomNode());
this.id = this._actual.getId();
this.allowEditorOverflow = this._actual.allowEditorOverflow || false;
this.suppressMouseDown = this._actual.suppressMouseDown || false;
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._fixedOverflowWidgets = options.get(29 /* fixedOverflowWidgets */);
this._contentWidth = layoutInfo.contentWidth;
this._contentLeft = layoutInfo.contentLeft;
this._lineHeight = options.get(49 /* lineHeight */);
this._range = null;
this._viewRange = null;
this._preference = [];
this._cachedDomNodeClientWidth = -1;
this._cachedDomNodeClientHeight = -1;
this._maxWidth = this._getMaxWidth();
this._isVisible = false;
this._renderData = null;
this.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');
this.domNode.setVisibility('hidden');
this.domNode.setAttribute('widgetId', this.id);
this.domNode.setMaxWidth(this._maxWidth);
}
Widget.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
this._lineHeight = options.get(49 /* lineHeight */);
if (e.hasChanged(107 /* layoutInfo */)) {
var layoutInfo = options.get(107 /* layoutInfo */);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
this._maxWidth = this._getMaxWidth();
}
};
Widget.prototype.onLineMappingChanged = function (e) {
this._setPosition(this._range);
};
Widget.prototype._setPosition = function (range) {
this._range = range;
this._viewRange = null;
if (this._range) {
// Do not trust that widgets give a valid position
var validModelRange = this._context.model.validateModelRange(this._range);
if (this._context.model.coordinatesConverter.modelPositionIsVisible(validModelRange.getStartPosition()) || this._context.model.coordinatesConverter.modelPositionIsVisible(validModelRange.getEndPosition())) {
this._viewRange = this._context.model.coordinatesConverter.convertModelRangeToViewRange(validModelRange);
}
}
};
Widget.prototype._getMaxWidth = function () {
return (this.allowEditorOverflow
? window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
: this._contentWidth);
};
Widget.prototype.setPosition = function (range, preference) {
this._setPosition(range);
this._preference = preference;
this._cachedDomNodeClientWidth = -1;
this._cachedDomNodeClientHeight = -1;
};
Widget.prototype._layoutBoxInViewport = function (topLeft, bottomLeft, width, height, ctx) {
// Our visible box is split horizontally by the current line => 2 boxes
// a) the box above the line
var aboveLineTop = topLeft.top;
var heightAboveLine = aboveLineTop;
// b) the box under the line
var underLineTop = bottomLeft.top + this._lineHeight;
var heightUnderLine = ctx.viewportHeight - underLineTop;
var aboveTop = aboveLineTop - height;
var fitsAbove = (heightAboveLine >= height);
var belowTop = underLineTop;
var fitsBelow = (heightUnderLine >= height);
// And its left
var actualAboveLeft = topLeft.left;
var actualBelowLeft = bottomLeft.left;
if (actualAboveLeft + width > ctx.scrollLeft + ctx.viewportWidth) {
actualAboveLeft = ctx.scrollLeft + ctx.viewportWidth - width;
}
if (actualBelowLeft + width > ctx.scrollLeft + ctx.viewportWidth) {
actualBelowLeft = ctx.scrollLeft + ctx.viewportWidth - width;
}
if (actualAboveLeft < ctx.scrollLeft) {
actualAboveLeft = ctx.scrollLeft;
}
if (actualBelowLeft < ctx.scrollLeft) {
actualBelowLeft = ctx.scrollLeft;
}
return {
fitsAbove: fitsAbove,
aboveTop: aboveTop,
aboveLeft: actualAboveLeft,
fitsBelow: fitsBelow,
belowTop: belowTop,
belowLeft: actualBelowLeft,
};
};
Widget.prototype._layoutHorizontalSegmentInPage = function (windowSize, domNodePosition, left, width) {
// Initially, the limits are defined as the dom node limits
var MIN_LIMIT = Math.max(0, domNodePosition.left - width);
var MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width);
var absoluteLeft = domNodePosition.left + left - dom["e" /* StandardWindow */].scrollX;
if (absoluteLeft + width > MAX_LIMIT) {
var delta = absoluteLeft - (MAX_LIMIT - width);
absoluteLeft -= delta;
left -= delta;
}
if (absoluteLeft < MIN_LIMIT) {
var delta = absoluteLeft - MIN_LIMIT;
absoluteLeft -= delta;
left -= delta;
}
return [left, absoluteLeft];
};
Widget.prototype._layoutBoxInPage = function (topLeft, bottomLeft, width, height, ctx) {
var aboveTop = topLeft.top - height;
var belowTop = bottomLeft.top + this._lineHeight;
var domNodePosition = dom["C" /* getDomNodePagePosition */](this._viewDomNode.domNode);
var absoluteAboveTop = domNodePosition.top + aboveTop - dom["e" /* StandardWindow */].scrollY;
var absoluteBelowTop = domNodePosition.top + belowTop - dom["e" /* StandardWindow */].scrollY;
var windowSize = dom["y" /* getClientArea */](document.body);
var _a = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, topLeft.left - ctx.scrollLeft + this._contentLeft, width), aboveLeft = _a[0], absoluteAboveLeft = _a[1];
var _b = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, bottomLeft.left - ctx.scrollLeft + this._contentLeft, width), belowLeft = _b[0], absoluteBelowLeft = _b[1];
// Leave some clearance to the top/bottom
var TOP_PADDING = 22;
var BOTTOM_PADDING = 22;
var fitsAbove = (absoluteAboveTop >= TOP_PADDING);
var fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING);
if (this._fixedOverflowWidgets) {
return {
fitsAbove: fitsAbove,
aboveTop: Math.max(absoluteAboveTop, TOP_PADDING),
aboveLeft: absoluteAboveLeft,
fitsBelow: fitsBelow,
belowTop: absoluteBelowTop,
belowLeft: absoluteBelowLeft
};
}
return {
fitsAbove: fitsAbove,
aboveTop: Math.max(aboveTop, TOP_PADDING),
aboveLeft: aboveLeft,
fitsBelow: fitsBelow,
belowTop: belowTop,
belowLeft: belowLeft
};
};
Widget.prototype._prepareRenderWidgetAtExactPositionOverflowing = function (topLeft) {
return new Coordinate(topLeft.top, topLeft.left + this._contentLeft);
};
/**
* Compute `this._topLeft`
*/
Widget.prototype._getTopAndBottomLeft = function (ctx) {
if (!this._viewRange) {
return [null, null];
}
var visibleRangesForRange = ctx.linesVisibleRangesForRange(this._viewRange, false);
if (!visibleRangesForRange || visibleRangesForRange.length === 0) {
return [null, null];
}
var firstLine = visibleRangesForRange[0];
var lastLine = visibleRangesForRange[0];
for (var _i = 0, visibleRangesForRange_1 = visibleRangesForRange; _i < visibleRangesForRange_1.length; _i++) {
var visibleRangesForLine = visibleRangesForRange_1[_i];
if (visibleRangesForLine.lineNumber < firstLine.lineNumber) {
firstLine = visibleRangesForLine;
}
if (visibleRangesForLine.lineNumber > lastLine.lineNumber) {
lastLine = visibleRangesForLine;
}
}
var firstLineMinLeft = 1073741824 /* MAX_SAFE_SMALL_INTEGER */; //firstLine.Constants.MAX_SAFE_SMALL_INTEGER;
for (var _a = 0, _b = firstLine.ranges; _a < _b.length; _a++) {
var visibleRange = _b[_a];
if (visibleRange.left < firstLineMinLeft) {
firstLineMinLeft = visibleRange.left;
}
}
var lastLineMinLeft = 1073741824 /* MAX_SAFE_SMALL_INTEGER */; //lastLine.Constants.MAX_SAFE_SMALL_INTEGER;
for (var _c = 0, _d = lastLine.ranges; _c < _d.length; _c++) {
var visibleRange = _d[_c];
if (visibleRange.left < lastLineMinLeft) {
lastLineMinLeft = visibleRange.left;
}
}
var topForPosition = ctx.getVerticalOffsetForLineNumber(firstLine.lineNumber) - ctx.scrollTop;
var topLeft = new Coordinate(topForPosition, firstLineMinLeft);
var topForBottomLine = ctx.getVerticalOffsetForLineNumber(lastLine.lineNumber) - ctx.scrollTop;
var bottomLeft = new Coordinate(topForBottomLine, lastLineMinLeft);
return [topLeft, bottomLeft];
};
Widget.prototype._prepareRenderWidget = function (ctx) {
var _a = this._getTopAndBottomLeft(ctx), topLeft = _a[0], bottomLeft = _a[1];
if (!topLeft || !bottomLeft) {
return null;
}
if (this._cachedDomNodeClientWidth === -1 || this._cachedDomNodeClientHeight === -1) {
var domNode = this.domNode.domNode;
this._cachedDomNodeClientWidth = domNode.clientWidth;
this._cachedDomNodeClientHeight = domNode.clientHeight;
}
var placement;
if (this.allowEditorOverflow) {
placement = this._layoutBoxInPage(topLeft, bottomLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx);
}
else {
placement = this._layoutBoxInViewport(topLeft, bottomLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx);
}
// Do two passes, first for perfect fit, second picks first option
if (this._preference) {
for (var pass = 1; pass <= 2; pass++) {
for (var _i = 0, _b = this._preference; _i < _b.length; _i++) {
var pref = _b[_i];
// placement
if (pref === 1 /* ABOVE */) {
if (!placement) {
// Widget outside of viewport
return null;
}
if (pass === 2 || placement.fitsAbove) {
return new Coordinate(placement.aboveTop, placement.aboveLeft);
}
}
else if (pref === 2 /* BELOW */) {
if (!placement) {
// Widget outside of viewport
return null;
}
if (pass === 2 || placement.fitsBelow) {
return new Coordinate(placement.belowTop, placement.belowLeft);
}
}
else {
if (this.allowEditorOverflow) {
return this._prepareRenderWidgetAtExactPositionOverflowing(topLeft);
}
else {
return topLeft;
}
}
}
}
}
return null;
};
/**
* On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.
*/
Widget.prototype.onBeforeRender = function (viewportData) {
if (!this._viewRange || !this._preference) {
return;
}
if (this._viewRange.endLineNumber < viewportData.startLineNumber || this._viewRange.startLineNumber > viewportData.endLineNumber) {
// Outside of viewport
return;
}
this.domNode.setMaxWidth(this._maxWidth);
};
Widget.prototype.prepareRender = function (ctx) {
this._renderData = this._prepareRenderWidget(ctx);
};
Widget.prototype.render = function (ctx) {
if (!this._renderData) {
// This widget should be invisible
if (this._isVisible) {
this.domNode.removeAttribute('monaco-visible-content-widget');
this._isVisible = false;
this.domNode.setVisibility('hidden');
}
return;
}
// This widget should be visible
if (this.allowEditorOverflow) {
this.domNode.setTop(this._renderData.top);
this.domNode.setLeft(this._renderData.left);
}
else {
this.domNode.setTop(this._renderData.top + ctx.scrollTop - ctx.bigNumbersDelta);
this.domNode.setLeft(this._renderData.left);
}
if (!this._isVisible) {
this.domNode.setVisibility('inherit');
this.domNode.setAttribute('monaco-visible-content-widget', 'true');
this._isVisible = true;
}
};
return Widget;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.css
var currentLineHighlight = __webpack_require__(625);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/arrays.js
var arrays = __webpack_require__(18);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var currentLineHighlight_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var isRenderedUsingBorder = true;
var currentLineHighlight_AbstractLineHighlightOverlay = /** @class */ (function (_super) {
currentLineHighlight_extends(AbstractLineHighlightOverlay, _super);
function AbstractLineHighlightOverlay(context) {
var _this = _super.call(this) || this;
_this._context = context;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._lineHeight = options.get(49 /* lineHeight */);
_this._renderLineHighlight = options.get(72 /* renderLineHighlight */);
_this._contentLeft = layoutInfo.contentLeft;
_this._contentWidth = layoutInfo.contentWidth;
_this._selectionIsEmpty = true;
_this._cursorLineNumbers = [];
_this._selections = [];
_this._renderData = null;
_this._context.addEventHandler(_this);
return _this;
}
AbstractLineHighlightOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
_super.prototype.dispose.call(this);
};
AbstractLineHighlightOverlay.prototype._readFromSelections = function () {
var hasChanged = false;
// Only render the first selection when using border
var renderSelections = isRenderedUsingBorder ? this._selections.slice(0, 1) : this._selections;
var cursorsLineNumbers = renderSelections.map(function (s) { return s.positionLineNumber; });
cursorsLineNumbers.sort(function (a, b) { return a - b; });
if (!arrays["g" /* equals */](this._cursorLineNumbers, cursorsLineNumbers)) {
this._cursorLineNumbers = cursorsLineNumbers;
hasChanged = true;
}
var selectionIsEmpty = renderSelections.every(function (s) { return s.isEmpty(); });
if (this._selectionIsEmpty !== selectionIsEmpty) {
this._selectionIsEmpty = selectionIsEmpty;
hasChanged = true;
}
return hasChanged;
};
// --- begin event handlers
AbstractLineHighlightOverlay.prototype.onThemeChanged = function (e) {
return this._readFromSelections();
};
AbstractLineHighlightOverlay.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._lineHeight = options.get(49 /* lineHeight */);
this._renderLineHighlight = options.get(72 /* renderLineHighlight */);
this._contentLeft = layoutInfo.contentLeft;
this._contentWidth = layoutInfo.contentWidth;
return true;
};
AbstractLineHighlightOverlay.prototype.onCursorStateChanged = function (e) {
this._selections = e.selections;
return this._readFromSelections();
};
AbstractLineHighlightOverlay.prototype.onFlushed = function (e) {
return true;
};
AbstractLineHighlightOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
AbstractLineHighlightOverlay.prototype.onLinesInserted = function (e) {
return true;
};
AbstractLineHighlightOverlay.prototype.onScrollChanged = function (e) {
return e.scrollWidthChanged || e.scrollTopChanged;
};
AbstractLineHighlightOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
AbstractLineHighlightOverlay.prototype.prepareRender = function (ctx) {
if (!this._shouldRenderThis()) {
this._renderData = null;
return;
}
var renderedLine = this._renderOne(ctx);
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
var len = this._cursorLineNumbers.length;
var index = 0;
var renderData = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
while (index < len && this._cursorLineNumbers[index] < lineNumber) {
index++;
}
if (index < len && this._cursorLineNumbers[index] === lineNumber) {
renderData[lineIndex] = renderedLine;
}
else {
renderData[lineIndex] = '';
}
}
this._renderData = renderData;
};
AbstractLineHighlightOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderData) {
return '';
}
var lineIndex = lineNumber - startLineNumber;
if (lineIndex >= this._renderData.length) {
return '';
}
return this._renderData[lineIndex];
};
return AbstractLineHighlightOverlay;
}(DynamicViewOverlay));
var CurrentLineHighlightOverlay = /** @class */ (function (_super) {
currentLineHighlight_extends(CurrentLineHighlightOverlay, _super);
function CurrentLineHighlightOverlay() {
return _super !== null && _super.apply(this, arguments) || this;
}
CurrentLineHighlightOverlay.prototype._renderOne = function (ctx) {
var className = 'current-line' + (this._shouldRenderOther() ? ' current-line-both' : '');
return "";
};
CurrentLineHighlightOverlay.prototype._shouldRenderThis = function () {
return ((this._renderLineHighlight === 'line' || this._renderLineHighlight === 'all')
&& this._selectionIsEmpty);
};
CurrentLineHighlightOverlay.prototype._shouldRenderOther = function () {
return ((this._renderLineHighlight === 'gutter' || this._renderLineHighlight === 'all'));
};
return CurrentLineHighlightOverlay;
}(currentLineHighlight_AbstractLineHighlightOverlay));
var CurrentLineMarginHighlightOverlay = /** @class */ (function (_super) {
currentLineHighlight_extends(CurrentLineMarginHighlightOverlay, _super);
function CurrentLineMarginHighlightOverlay() {
return _super !== null && _super.apply(this, arguments) || this;
}
CurrentLineMarginHighlightOverlay.prototype._renderOne = function (ctx) {
var className = 'current-line current-line-margin' + (this._shouldRenderOther() ? ' current-line-margin-both' : '');
return "";
};
CurrentLineMarginHighlightOverlay.prototype._shouldRenderThis = function () {
return ((this._renderLineHighlight === 'gutter' || this._renderLineHighlight === 'all'));
};
CurrentLineMarginHighlightOverlay.prototype._shouldRenderOther = function () {
return ((this._renderLineHighlight === 'line' || this._renderLineHighlight === 'all')
&& this._selectionIsEmpty);
};
return CurrentLineMarginHighlightOverlay;
}(currentLineHighlight_AbstractLineHighlightOverlay));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
isRenderedUsingBorder = false;
var lineHighlight = theme.getColor(editorColorRegistry["i" /* 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(editorColorRegistry["j" /* editorLineHighlightBorder */])) {
var lineHighlightBorder = theme.getColor(editorColorRegistry["j" /* editorLineHighlightBorder */]);
if (lineHighlightBorder) {
isRenderedUsingBorder = true;
collector.addRule(".monaco-editor .view-overlays .current-line { border: 2px solid " + lineHighlightBorder + "; }");
collector.addRule(".monaco-editor .margin-view-overlays .current-line-margin { border: 2px solid " + lineHighlightBorder + "; }");
if (theme.type === 'hc') {
collector.addRule(".monaco-editor .view-overlays .current-line { border-width: 1px; }");
collector.addRule(".monaco-editor .margin-view-overlays .current-line-margin { border-width: 1px; }");
}
}
}
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.css
var decorations_decorations = __webpack_require__(626);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/decorations/decorations.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var decorations_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var decorations_DecorationsOverlay = /** @class */ (function (_super) {
decorations_extends(DecorationsOverlay, _super);
function DecorationsOverlay(context) {
var _this = _super.call(this) || this;
_this._context = context;
var options = _this._context.configuration.options;
_this._lineHeight = options.get(49 /* lineHeight */);
_this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
_this._renderResult = null;
_this._context.addEventHandler(_this);
return _this;
}
DecorationsOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
this._renderResult = null;
_super.prototype.dispose.call(this);
};
// --- begin event handlers
DecorationsOverlay.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
this._lineHeight = options.get(49 /* lineHeight */);
this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
return true;
};
DecorationsOverlay.prototype.onDecorationsChanged = function (e) {
return true;
};
DecorationsOverlay.prototype.onFlushed = function (e) {
return true;
};
DecorationsOverlay.prototype.onLinesChanged = function (e) {
return true;
};
DecorationsOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
DecorationsOverlay.prototype.onLinesInserted = function (e) {
return true;
};
DecorationsOverlay.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged || e.scrollWidthChanged;
};
DecorationsOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
DecorationsOverlay.prototype.prepareRender = function (ctx) {
var _decorations = ctx.getDecorationsInViewport();
// Keep only decorations with `className`
var decorations = [], decorationsLen = 0;
for (var i = 0, len = _decorations.length; i < len; i++) {
var d = _decorations[i];
if (d.options.className) {
decorations[decorationsLen++] = d;
}
}
// Sort decorations for consistent render output
decorations = decorations.sort(function (a, b) {
if (a.options.zIndex < b.options.zIndex) {
return -1;
}
if (a.options.zIndex > b.options.zIndex) {
return 1;
}
var aClassName = a.options.className;
var bClassName = b.options.className;
if (aClassName < bClassName) {
return -1;
}
if (aClassName > bClassName) {
return 1;
}
return core_range["a" /* Range */].compareRangesUsingStarts(a.range, b.range);
});
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
var output = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = '';
}
// Render first whole line decorations and then regular decorations
this._renderWholeLineDecorations(ctx, decorations, output);
this._renderNormalDecorations(ctx, decorations, output);
this._renderResult = output;
};
DecorationsOverlay.prototype._renderWholeLineDecorations = function (ctx, decorations, output) {
var lineHeight = String(this._lineHeight);
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
for (var i = 0, lenI = decorations.length; i < lenI; i++) {
var d = decorations[i];
if (!d.options.isWholeLine) {
continue;
}
var decorationOutput = ('');
var startLineNumber = Math.max(d.range.startLineNumber, visibleStartLineNumber);
var endLineNumber = Math.min(d.range.endLineNumber, visibleEndLineNumber);
for (var j = startLineNumber; j <= endLineNumber; j++) {
var lineIndex = j - visibleStartLineNumber;
output[lineIndex] += decorationOutput;
}
}
};
DecorationsOverlay.prototype._renderNormalDecorations = function (ctx, decorations, output) {
var lineHeight = String(this._lineHeight);
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var prevClassName = null;
var prevShowIfCollapsed = false;
var prevRange = null;
for (var i = 0, lenI = decorations.length; i < lenI; i++) {
var d = decorations[i];
if (d.options.isWholeLine) {
continue;
}
var className = d.options.className;
var showIfCollapsed = Boolean(d.options.showIfCollapsed);
var range = d.range;
if (showIfCollapsed && range.endColumn === 1 && range.endLineNumber !== range.startLineNumber) {
range = new core_range["a" /* Range */](range.startLineNumber, range.startColumn, range.endLineNumber - 1, this._context.model.getLineMaxColumn(range.endLineNumber - 1));
}
if (prevClassName === className && prevShowIfCollapsed === showIfCollapsed && core_range["a" /* Range */].areIntersectingOrTouching(prevRange, range)) {
// merge into previous decoration
prevRange = core_range["a" /* Range */].plusRange(prevRange, range);
continue;
}
// flush previous decoration
if (prevClassName !== null) {
this._renderNormalDecoration(ctx, prevRange, prevClassName, prevShowIfCollapsed, lineHeight, visibleStartLineNumber, output);
}
prevClassName = className;
prevShowIfCollapsed = showIfCollapsed;
prevRange = range;
}
if (prevClassName !== null) {
this._renderNormalDecoration(ctx, prevRange, prevClassName, prevShowIfCollapsed, lineHeight, visibleStartLineNumber, output);
}
};
DecorationsOverlay.prototype._renderNormalDecoration = function (ctx, range, className, showIfCollapsed, lineHeight, visibleStartLineNumber, output) {
var linesVisibleRanges = ctx.linesVisibleRangesForRange(range, /*TODO@Alex*/ className === 'findMatch');
if (!linesVisibleRanges) {
return;
}
for (var j = 0, lenJ = linesVisibleRanges.length; j < lenJ; j++) {
var lineVisibleRanges = linesVisibleRanges[j];
if (lineVisibleRanges.outsideRenderedLine) {
continue;
}
var lineIndex = lineVisibleRanges.lineNumber - visibleStartLineNumber;
if (showIfCollapsed && lineVisibleRanges.ranges.length === 1) {
var singleVisibleRange = lineVisibleRanges.ranges[0];
if (singleVisibleRange.width === 0) {
// collapsed range case => make the decoration visible by faking its width
lineVisibleRanges.ranges[0] = new HorizontalRange(singleVisibleRange.left, this._typicalHalfwidthCharacterWidth);
}
}
for (var k = 0, lenK = lineVisibleRanges.ranges.length; k < lenK; k++) {
var visibleRange = lineVisibleRanges.ranges[k];
var decorationOutput = ('');
output[lineIndex] += decorationOutput;
}
}
};
DecorationsOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderResult) {
return '';
}
var lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return '';
}
return this._renderResult[lineIndex];
};
return DecorationsOverlay;
}(DynamicViewOverlay));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js + 6 modules
var scrollableElement = __webpack_require__(81);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var editorScrollbar_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var editorScrollbar_EditorScrollbar = /** @class */ (function (_super) {
editorScrollbar_extends(EditorScrollbar, _super);
function EditorScrollbar(context, linesContent, viewDomNode, overflowGuardDomNode) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var scrollbar = options.get(78 /* scrollbar */);
var mouseWheelScrollSensitivity = options.get(56 /* mouseWheelScrollSensitivity */);
var fastScrollSensitivity = options.get(27 /* fastScrollSensitivity */);
var scrollbarOptions = {
listenOnDomNode: viewDomNode.domNode,
className: 'editor-scrollable' + ' ' + Object(common_themeService["d" /* 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: mouseWheelScrollSensitivity,
fastScrollSensitivity: fastScrollSensitivity,
};
_this.scrollbar = _this._register(new scrollableElement["c" /* SmoothScrollableElement */](linesContent.domNode, scrollbarOptions, _this._context.viewLayout.getScrollable()));
viewPart_PartFingerprints.write(_this.scrollbar.getDomNode(), 5 /* ScrollableElement */);
_this.scrollbarDomNode = Object(fastDomNode["b" /* createFastDomNode */])(_this.scrollbar.getDomNode());
_this.scrollbarDomNode.setPosition('absolute');
_this._setLayout();
// When having a zone widget that calls .focus() on one of its dom elements,
// the browser will try desperately to reveal that dom node, unexpectedly
// changing the .scrollTop of this.linesContent
var onBrowserDesperateReveal = function (domNode, lookAtScrollTop, lookAtScrollLeft) {
var newScrollPosition = {};
if (lookAtScrollTop) {
var deltaTop = domNode.scrollTop;
if (deltaTop) {
newScrollPosition.scrollTop = _this._context.viewLayout.getCurrentScrollTop() + deltaTop;
domNode.scrollTop = 0;
}
}
if (lookAtScrollLeft) {
var deltaLeft = domNode.scrollLeft;
if (deltaLeft) {
newScrollPosition.scrollLeft = _this._context.viewLayout.getCurrentScrollLeft() + deltaLeft;
domNode.scrollLeft = 0;
}
}
_this._context.viewLayout.setScrollPositionNow(newScrollPosition);
};
// I've seen this happen both on the view dom node & on the lines content dom node.
_this._register(dom["j" /* addDisposableListener */](viewDomNode.domNode, 'scroll', function (e) { return onBrowserDesperateReveal(viewDomNode.domNode, true, true); }));
_this._register(dom["j" /* addDisposableListener */](linesContent.domNode, 'scroll', function (e) { return onBrowserDesperateReveal(linesContent.domNode, true, false); }));
_this._register(dom["j" /* addDisposableListener */](overflowGuardDomNode.domNode, 'scroll', function (e) { return onBrowserDesperateReveal(overflowGuardDomNode.domNode, true, false); }));
_this._register(dom["j" /* addDisposableListener */](_this.scrollbarDomNode.domNode, 'scroll', function (e) { return onBrowserDesperateReveal(_this.scrollbarDomNode.domNode, true, false); }));
return _this;
}
EditorScrollbar.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
EditorScrollbar.prototype._setLayout = function () {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this.scrollbarDomNode.setLeft(layoutInfo.contentLeft);
var minimap = options.get(54 /* minimap */);
var side = minimap.side;
if (side === 'right') {
this.scrollbarDomNode.setWidth(layoutInfo.contentWidth + layoutInfo.minimapWidth);
}
else {
this.scrollbarDomNode.setWidth(layoutInfo.contentWidth);
}
this.scrollbarDomNode.setHeight(layoutInfo.height);
};
EditorScrollbar.prototype.getOverviewRulerLayoutInfo = function () {
return this.scrollbar.getOverviewRulerLayoutInfo();
};
EditorScrollbar.prototype.getDomNode = function () {
return this.scrollbarDomNode;
};
EditorScrollbar.prototype.delegateVerticalScrollbarMouseDown = function (browserEvent) {
this.scrollbar.delegateVerticalScrollbarMouseDown(browserEvent);
};
// --- begin event handlers
EditorScrollbar.prototype.onConfigurationChanged = function (e) {
if (e.hasChanged(78 /* scrollbar */)
|| e.hasChanged(56 /* mouseWheelScrollSensitivity */)
|| e.hasChanged(27 /* fastScrollSensitivity */)) {
var options = this._context.configuration.options;
var scrollbar = options.get(78 /* scrollbar */);
var mouseWheelScrollSensitivity = options.get(56 /* mouseWheelScrollSensitivity */);
var fastScrollSensitivity = options.get(27 /* fastScrollSensitivity */);
var newOpts = {
handleMouseWheel: scrollbar.handleMouseWheel,
mouseWheelScrollSensitivity: mouseWheelScrollSensitivity,
fastScrollSensitivity: fastScrollSensitivity
};
this.scrollbar.updateOptions(newOpts);
}
if (e.hasChanged(107 /* layoutInfo */)) {
this._setLayout();
}
return true;
};
EditorScrollbar.prototype.onScrollChanged = function (e) {
return true;
};
EditorScrollbar.prototype.onThemeChanged = function (e) {
this.scrollbar.updateClassName('editor-scrollable' + ' ' + Object(common_themeService["d" /* getThemeTypeSelector */])(this._context.theme.type));
return true;
};
// --- end event handlers
EditorScrollbar.prototype.prepareRender = function (ctx) {
// Nothing to do
};
EditorScrollbar.prototype.render = function (ctx) {
this.scrollbar.renderNow();
};
return EditorScrollbar;
}(ViewPart));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.css
var glyphMargin = __webpack_require__(628);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var glyphMargin_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var DecorationToRender = /** @class */ (function () {
function DecorationToRender(startLineNumber, endLineNumber, className) {
this.startLineNumber = +startLineNumber;
this.endLineNumber = +endLineNumber;
this.className = String(className);
}
return DecorationToRender;
}());
var DedupOverlay = /** @class */ (function (_super) {
glyphMargin_extends(DedupOverlay, _super);
function DedupOverlay() {
return _super !== null && _super.apply(this, arguments) || this;
}
DedupOverlay.prototype._render = function (visibleStartLineNumber, visibleEndLineNumber, decorations) {
var output = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = [];
}
if (decorations.length === 0) {
return output;
}
decorations.sort(function (a, b) {
if (a.className === b.className) {
if (a.startLineNumber === b.startLineNumber) {
return a.endLineNumber - b.endLineNumber;
}
return a.startLineNumber - b.startLineNumber;
}
return (a.className < b.className ? -1 : 1);
});
var prevClassName = null;
var prevEndLineIndex = 0;
for (var i = 0, len = decorations.length; i < len; i++) {
var d = decorations[i];
var className = d.className;
var startLineIndex = Math.max(d.startLineNumber, visibleStartLineNumber) - visibleStartLineNumber;
var 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 (var i_1 = startLineIndex; i_1 <= prevEndLineIndex; i_1++) {
output[i_1].push(prevClassName);
}
}
return output;
};
return DedupOverlay;
}(DynamicViewOverlay));
var GlyphMarginOverlay = /** @class */ (function (_super) {
glyphMargin_extends(GlyphMarginOverlay, _super);
function GlyphMarginOverlay(context) {
var _this = _super.call(this) || this;
_this._context = context;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._lineHeight = options.get(49 /* lineHeight */);
_this._glyphMargin = options.get(40 /* glyphMargin */);
_this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
_this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
_this._renderResult = null;
_this._context.addEventHandler(_this);
return _this;
}
GlyphMarginOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
this._renderResult = null;
_super.prototype.dispose.call(this);
};
// --- begin event handlers
GlyphMarginOverlay.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._lineHeight = options.get(49 /* lineHeight */);
this._glyphMargin = options.get(40 /* glyphMargin */);
this._glyphMarginLeft = layoutInfo.glyphMarginLeft;
this._glyphMarginWidth = layoutInfo.glyphMarginWidth;
return true;
};
GlyphMarginOverlay.prototype.onDecorationsChanged = function (e) {
return true;
};
GlyphMarginOverlay.prototype.onFlushed = function (e) {
return true;
};
GlyphMarginOverlay.prototype.onLinesChanged = function (e) {
return true;
};
GlyphMarginOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
GlyphMarginOverlay.prototype.onLinesInserted = function (e) {
return true;
};
GlyphMarginOverlay.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged;
};
GlyphMarginOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
GlyphMarginOverlay.prototype._getDecorations = function (ctx) {
var decorations = ctx.getDecorationsInViewport();
var r = [], rLen = 0;
for (var i = 0, len = decorations.length; i < len; i++) {
var d = decorations[i];
var glyphMarginClassName = d.options.glyphMarginClassName;
if (glyphMarginClassName) {
r[rLen++] = new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, glyphMarginClassName);
}
}
return r;
};
GlyphMarginOverlay.prototype.prepareRender = function (ctx) {
if (!this._glyphMargin) {
this._renderResult = null;
return;
}
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
var toRender = this._render(visibleStartLineNumber, visibleEndLineNumber, this._getDecorations(ctx));
var lineHeight = this._lineHeight.toString();
var left = this._glyphMarginLeft.toString();
var width = this._glyphMarginWidth.toString();
var common = '" style="left:' + left + 'px;width:' + width + 'px' + ';height:' + lineHeight + 'px;">';
var output = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
var classNames = toRender[lineIndex];
if (classNames.length === 0) {
output[lineIndex] = '';
}
else {
output[lineIndex] = ('";
left += indentWidth;
if (left > scrollWidth || (this._maxIndentLeft > 0 && left > this._maxIndentLeft)) {
break;
}
}
}
output[lineIndex] = result;
}
this._renderResult = output;
};
IndentGuidesOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderResult) {
return '';
}
var lineIndex = lineNumber - startLineNumber;
if (lineIndex < 0 || lineIndex >= this._renderResult.length) {
return '';
}
return this._renderResult[lineIndex];
};
return IndentGuidesOverlay;
}(DynamicViewOverlay));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var editorIndentGuidesColor = theme.getColor(editorColorRegistry["h" /* editorIndentGuides */]);
if (editorIndentGuidesColor) {
collector.addRule(".monaco-editor .lines-content .cigr { box-shadow: 1px 0 0 0 " + editorIndentGuidesColor + " inset; }");
}
var editorActiveIndentGuidesColor = theme.getColor(editorColorRegistry["a" /* editorActiveIndentGuides */]) || editorIndentGuidesColor;
if (editorActiveIndentGuidesColor) {
collector.addRule(".monaco-editor .lines-content .cigra { box-shadow: 1px 0 0 0 " + editorActiveIndentGuidesColor + " inset; }");
}
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.css
var viewLines = __webpack_require__(630);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/lines/viewLines.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewLines_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var viewLines_LastRenderedData = /** @class */ (function () {
function LastRenderedData() {
this._currentVisibleRange = new core_range["a" /* Range */](1, 1, 1, 1);
}
LastRenderedData.prototype.getCurrentVisibleRange = function () {
return this._currentVisibleRange;
};
LastRenderedData.prototype.setCurrentVisibleRange = function (currentVisibleRange) {
this._currentVisibleRange = currentVisibleRange;
};
return LastRenderedData;
}());
var HorizontalRevealRequest = /** @class */ (function () {
function HorizontalRevealRequest(lineNumber, startColumn, endColumn, startScrollTop, stopScrollTop, scrollType) {
this.lineNumber = lineNumber;
this.startColumn = startColumn;
this.endColumn = endColumn;
this.startScrollTop = startScrollTop;
this.stopScrollTop = stopScrollTop;
this.scrollType = scrollType;
}
return HorizontalRevealRequest;
}());
var viewLines_ViewLines = /** @class */ (function (_super) {
viewLines_extends(ViewLines, _super);
function ViewLines(context, linesContent) {
var _this = _super.call(this, context) || this;
_this._linesContent = linesContent;
_this._textRangeRestingSpot = document.createElement('div');
_this._visibleLines = new viewLayer_VisibleLinesCollection(_this);
_this.domNode = _this._visibleLines.domNode;
var conf = _this._context.configuration;
var options = _this._context.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
var wrappingInfo = options.get(108 /* wrappingInfo */);
_this._lineHeight = options.get(49 /* lineHeight */);
_this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
_this._isViewportWrapping = wrappingInfo.isViewportWrapping;
_this._revealHorizontalRightPadding = options.get(75 /* revealHorizontalRightPadding */);
_this._cursorSurroundingLines = options.get(19 /* cursorSurroundingLines */);
_this._cursorSurroundingLinesStyle = options.get(20 /* cursorSurroundingLinesStyle */);
_this._canUseLayerHinting = !options.get(22 /* disableLayerHinting */);
_this._viewLineOptions = new ViewLineOptions(conf, _this._context.theme.type);
viewPart_PartFingerprints.write(_this.domNode, 7 /* ViewLines */);
_this.domNode.setClassName('view-lines');
config_configuration["a" /* Configuration */].applyFontInfo(_this.domNode, fontInfo);
// --- width & height
_this._maxLineWidth = 0;
_this._asyncUpdateLineWidths = new common_async["d" /* RunOnceScheduler */](function () {
_this._updateLineWidthsSlow();
}, 200);
_this._lastRenderedData = new viewLines_LastRenderedData();
_this._horizontalRevealRequest = null;
return _this;
}
ViewLines.prototype.dispose = function () {
this._asyncUpdateLineWidths.dispose();
_super.prototype.dispose.call(this);
};
ViewLines.prototype.getDomNode = function () {
return this.domNode;
};
// ---- begin IVisibleLinesHost
ViewLines.prototype.createVisibleLine = function () {
return new viewLine_ViewLine(this._viewLineOptions);
};
// ---- end IVisibleLinesHost
// ---- begin view event handlers
ViewLines.prototype.onConfigurationChanged = function (e) {
this._visibleLines.onConfigurationChanged(e);
if (e.hasChanged(108 /* wrappingInfo */)) {
this._maxLineWidth = 0;
}
var options = this._context.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
var wrappingInfo = options.get(108 /* wrappingInfo */);
this._lineHeight = options.get(49 /* lineHeight */);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._isViewportWrapping = wrappingInfo.isViewportWrapping;
this._revealHorizontalRightPadding = options.get(75 /* revealHorizontalRightPadding */);
this._cursorSurroundingLines = options.get(19 /* cursorSurroundingLines */);
this._cursorSurroundingLinesStyle = options.get(20 /* cursorSurroundingLinesStyle */);
this._canUseLayerHinting = !options.get(22 /* disableLayerHinting */);
config_configuration["a" /* Configuration */].applyFontInfo(this.domNode, fontInfo);
this._onOptionsMaybeChanged();
if (e.hasChanged(107 /* layoutInfo */)) {
this._maxLineWidth = 0;
}
return true;
};
ViewLines.prototype._onOptionsMaybeChanged = function () {
var conf = this._context.configuration;
var newViewLineOptions = new ViewLineOptions(conf, this._context.theme.type);
if (!this._viewLineOptions.equals(newViewLineOptions)) {
this._viewLineOptions = newViewLineOptions;
var startLineNumber = this._visibleLines.getStartLineNumber();
var endLineNumber = this._visibleLines.getEndLineNumber();
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var line = this._visibleLines.getVisibleLine(lineNumber);
line.onOptionsChanged(this._viewLineOptions);
}
return true;
}
return false;
};
ViewLines.prototype.onCursorStateChanged = function (e) {
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
var r = false;
for (var lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
r = this._visibleLines.getVisibleLine(lineNumber).onSelectionChanged() || r;
}
return r;
};
ViewLines.prototype.onDecorationsChanged = function (e) {
if (true /*e.inlineDecorationsChanged*/) {
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (var lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
this._visibleLines.getVisibleLine(lineNumber).onDecorationsChanged();
}
}
return true;
};
ViewLines.prototype.onFlushed = function (e) {
var shouldRender = this._visibleLines.onFlushed(e);
this._maxLineWidth = 0;
return shouldRender;
};
ViewLines.prototype.onLinesChanged = function (e) {
return this._visibleLines.onLinesChanged(e);
};
ViewLines.prototype.onLinesDeleted = function (e) {
return this._visibleLines.onLinesDeleted(e);
};
ViewLines.prototype.onLinesInserted = function (e) {
return this._visibleLines.onLinesInserted(e);
};
ViewLines.prototype.onRevealRangeRequest = function (e) {
// Using the future viewport here in order to handle multiple
// incoming reveal range requests that might all desire to be animated
var desiredScrollTop = this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(), e.source, e.range, e.verticalType);
// validate the new desired scroll top
var newScrollPosition = this._context.viewLayout.validateScrollPosition({ scrollTop: desiredScrollTop });
if (e.revealHorizontal) {
if (e.range.startLineNumber !== e.range.endLineNumber) {
// Two or more lines? => scroll to base (That's how you see most of the two lines)
newScrollPosition = {
scrollTop: newScrollPosition.scrollTop,
scrollLeft: 0
};
}
else {
// We don't necessarily know the horizontal offset of this range since the line might not be in the view...
this._horizontalRevealRequest = new HorizontalRevealRequest(e.range.startLineNumber, e.range.startColumn, e.range.endColumn, this._context.viewLayout.getCurrentScrollTop(), newScrollPosition.scrollTop, e.scrollType);
}
}
else {
this._horizontalRevealRequest = null;
}
var scrollTopDelta = Math.abs(this._context.viewLayout.getCurrentScrollTop() - newScrollPosition.scrollTop);
if (e.scrollType === 0 /* Smooth */ && scrollTopDelta > this._lineHeight) {
this._context.viewLayout.setScrollPositionSmooth(newScrollPosition);
}
else {
this._context.viewLayout.setScrollPositionNow(newScrollPosition);
}
return true;
};
ViewLines.prototype.onScrollChanged = function (e) {
if (this._horizontalRevealRequest && e.scrollLeftChanged) {
// cancel any outstanding horizontal reveal request if someone else scrolls horizontally.
this._horizontalRevealRequest = null;
}
if (this._horizontalRevealRequest && e.scrollTopChanged) {
var min = Math.min(this._horizontalRevealRequest.startScrollTop, this._horizontalRevealRequest.stopScrollTop);
var max = Math.max(this._horizontalRevealRequest.startScrollTop, this._horizontalRevealRequest.stopScrollTop);
if (e.scrollTop < min || e.scrollTop > max) {
// cancel any outstanding horizontal reveal request if someone else scrolls vertically.
this._horizontalRevealRequest = null;
}
}
this.domNode.setWidth(e.scrollWidth);
return this._visibleLines.onScrollChanged(e) || true;
};
ViewLines.prototype.onTokensChanged = function (e) {
return this._visibleLines.onTokensChanged(e);
};
ViewLines.prototype.onZonesChanged = function (e) {
this._context.viewLayout.onMaxLineWidthChanged(this._maxLineWidth);
return this._visibleLines.onZonesChanged(e);
};
ViewLines.prototype.onThemeChanged = function (e) {
return this._onOptionsMaybeChanged();
};
// ---- end view event handlers
// ----------- HELPERS FOR OTHERS
ViewLines.prototype.getPositionFromDOMInfo = function (spanNode, offset) {
var viewLineDomNode = this._getViewLineDomNode(spanNode);
if (viewLineDomNode === null) {
// Couldn't find view line node
return null;
}
var lineNumber = this._getLineNumberFor(viewLineDomNode);
if (lineNumber === -1) {
// Couldn't find view line node
return null;
}
if (lineNumber < 1 || lineNumber > this._context.model.getLineCount()) {
// lineNumber is outside range
return null;
}
if (this._context.model.getLineMaxColumn(lineNumber) === 1) {
// Line is empty
return new core_position["a" /* Position */](lineNumber, 1);
}
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
// Couldn't find line
return null;
}
var column = this._visibleLines.getVisibleLine(lineNumber).getColumnOfNodeOffset(lineNumber, spanNode, offset);
var minColumn = this._context.model.getLineMinColumn(lineNumber);
if (column < minColumn) {
column = minColumn;
}
return new core_position["a" /* Position */](lineNumber, column);
};
ViewLines.prototype._getViewLineDomNode = function (node) {
while (node && node.nodeType === 1) {
if (node.className === viewLine_ViewLine.CLASS_NAME) {
return node;
}
node = node.parentElement;
}
return null;
};
/**
* @returns the line number of this view line dom node.
*/
ViewLines.prototype._getLineNumberFor = function (domNode) {
var startLineNumber = this._visibleLines.getStartLineNumber();
var endLineNumber = this._visibleLines.getEndLineNumber();
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var line = this._visibleLines.getVisibleLine(lineNumber);
if (domNode === line.getDomNode()) {
return lineNumber;
}
}
return -1;
};
ViewLines.prototype.getLineWidth = function (lineNumber) {
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
// Couldn't find line
return -1;
}
return this._visibleLines.getVisibleLine(lineNumber).getWidth();
};
ViewLines.prototype.linesVisibleRangesForRange = function (_range, includeNewLines) {
if (this.shouldRender()) {
// Cannot read from the DOM because it is dirty
// i.e. the model & the dom are out of sync, so I'd be reading something stale
return null;
}
var originalEndLineNumber = _range.endLineNumber;
var range = core_range["a" /* Range */].intersectRanges(_range, this._lastRenderedData.getCurrentVisibleRange());
if (!range) {
return null;
}
var visibleRanges = [], visibleRangesLen = 0;
var domReadingContext = new DomReadingContext(this.domNode.domNode, this._textRangeRestingSpot);
var nextLineModelLineNumber = 0;
if (includeNewLines) {
nextLineModelLineNumber = this._context.model.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](range.startLineNumber, 1)).lineNumber;
}
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
for (var lineNumber = range.startLineNumber; lineNumber <= range.endLineNumber; lineNumber++) {
if (lineNumber < rendStartLineNumber || lineNumber > rendEndLineNumber) {
continue;
}
var startColumn = lineNumber === range.startLineNumber ? range.startColumn : 1;
var endColumn = lineNumber === range.endLineNumber ? range.endColumn : this._context.model.getLineMaxColumn(lineNumber);
var visibleRangesForLine = this._visibleLines.getVisibleLine(lineNumber).getVisibleRangesForRange(startColumn, endColumn, domReadingContext);
if (!visibleRangesForLine) {
continue;
}
if (includeNewLines && lineNumber < originalEndLineNumber) {
var currentLineModelLineNumber = nextLineModelLineNumber;
nextLineModelLineNumber = this._context.model.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](lineNumber + 1, 1)).lineNumber;
if (currentLineModelLineNumber !== nextLineModelLineNumber) {
visibleRangesForLine.ranges[visibleRangesForLine.ranges.length - 1].width += this._typicalHalfwidthCharacterWidth;
}
}
visibleRanges[visibleRangesLen++] = new LineVisibleRanges(visibleRangesForLine.outsideRenderedLine, lineNumber, visibleRangesForLine.ranges);
}
if (visibleRangesLen === 0) {
return null;
}
return visibleRanges;
};
ViewLines.prototype._visibleRangesForLineRange = function (lineNumber, startColumn, endColumn) {
if (this.shouldRender()) {
// Cannot read from the DOM because it is dirty
// i.e. the model & the dom are out of sync, so I'd be reading something stale
return null;
}
if (lineNumber < this._visibleLines.getStartLineNumber() || lineNumber > this._visibleLines.getEndLineNumber()) {
return null;
}
return this._visibleLines.getVisibleLine(lineNumber).getVisibleRangesForRange(startColumn, endColumn, new DomReadingContext(this.domNode.domNode, this._textRangeRestingSpot));
};
ViewLines.prototype.visibleRangeForPosition = function (position) {
var visibleRanges = this._visibleRangesForLineRange(position.lineNumber, position.column, position.column);
if (!visibleRanges) {
return null;
}
return new HorizontalPosition(visibleRanges.outsideRenderedLine, visibleRanges.ranges[0].left);
};
// --- implementation
ViewLines.prototype.updateLineWidths = function () {
this._updateLineWidths(false);
};
/**
* 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).
*/
ViewLines.prototype._updateLineWidthsFast = function () {
return this._updateLineWidths(true);
};
ViewLines.prototype._updateLineWidthsSlow = function () {
this._updateLineWidths(false);
};
ViewLines.prototype._updateLineWidths = function (fast) {
var rendStartLineNumber = this._visibleLines.getStartLineNumber();
var rendEndLineNumber = this._visibleLines.getEndLineNumber();
var localMaxLineWidth = 1;
var allWidthsComputed = true;
for (var lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) {
var visibleLine = this._visibleLines.getVisibleLine(lineNumber);
if (fast && !visibleLine.getWidthIsFast()) {
// Cannot compute width in a fast way for this line
allWidthsComputed = false;
continue;
}
localMaxLineWidth = Math.max(localMaxLineWidth, visibleLine.getWidth());
}
if (allWidthsComputed && rendStartLineNumber === 1 && rendEndLineNumber === this._context.model.getLineCount()) {
// we know the max line width for all the lines
this._maxLineWidth = 0;
}
this._ensureMaxLineWidth(localMaxLineWidth);
return allWidthsComputed;
};
ViewLines.prototype.prepareRender = function () {
throw new Error('Not supported');
};
ViewLines.prototype.render = function () {
throw new Error('Not supported');
};
ViewLines.prototype.renderText = function (viewportData) {
// (1) render lines - ensures lines are in the DOM
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(), 1000000));
// (2) compute horizontal scroll position:
// - this must happen after the lines are in the DOM since it might need a line that rendered just now
// - it might change `scrollWidth` and `scrollLeft`
if (this._horizontalRevealRequest) {
var revealLineNumber = this._horizontalRevealRequest.lineNumber;
var revealStartColumn = this._horizontalRevealRequest.startColumn;
var revealEndColumn = this._horizontalRevealRequest.endColumn;
var scrollType = this._horizontalRevealRequest.scrollType;
// Check that we have the line that contains the horizontal range in the viewport
if (viewportData.startLineNumber <= revealLineNumber && revealLineNumber <= viewportData.endLineNumber) {
this._horizontalRevealRequest = null;
// allow `visibleRangesForRange2` to work
this.onDidRender();
// compute new scroll position
var newScrollLeft = this._computeScrollLeftToRevealRange(revealLineNumber, revealStartColumn, revealEndColumn);
var isViewportWrapping = this._isViewportWrapping;
if (!isViewportWrapping) {
// ensure `scrollWidth` is large enough
this._ensureMaxLineWidth(newScrollLeft.maxHorizontalOffset);
}
// set `scrollLeft`
if (scrollType === 0 /* Smooth */) {
this._context.viewLayout.setScrollPositionSmooth({
scrollLeft: newScrollLeft.scrollLeft
});
}
else {
this._context.viewLayout.setScrollPositionNow({
scrollLeft: newScrollLeft.scrollLeft
});
}
}
}
// Update max line width (not so important, it is just so the horizontal scrollbar doesn't get too small)
if (!this._updateLineWidthsFast()) {
// Computing the width of some lines would be slow => delay it
this._asyncUpdateLineWidths.schedule();
}
// (3) handle scrolling
this._linesContent.setLayerHinting(this._canUseLayerHinting);
this._linesContent.setContain('strict');
var adjustedScrollTop = this._context.viewLayout.getCurrentScrollTop() - viewportData.bigNumbersDelta;
this._linesContent.setTop(-adjustedScrollTop);
this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft());
};
// --- width
ViewLines.prototype._ensureMaxLineWidth = function (lineWidth) {
var iLineWidth = Math.ceil(lineWidth);
if (this._maxLineWidth < iLineWidth) {
this._maxLineWidth = iLineWidth;
this._context.viewLayout.onMaxLineWidthChanged(this._maxLineWidth);
}
};
ViewLines.prototype._computeScrollTopToRevealRange = function (viewport, source, range, verticalType) {
var viewportStartY = viewport.top;
var viewportHeight = viewport.height;
var viewportEndY = viewportStartY + viewportHeight;
var boxStartY;
var boxEndY;
// Have a box that includes one extra line height (for the horizontal scrollbar)
boxStartY = this._context.viewLayout.getVerticalOffsetForLineNumber(range.startLineNumber);
boxEndY = this._context.viewLayout.getVerticalOffsetForLineNumber(range.endLineNumber) + this._lineHeight;
var shouldIgnoreScrollOff = source === 'mouse' && this._cursorSurroundingLinesStyle === 'default';
if (!shouldIgnoreScrollOff) {
var context = Math.min((viewportHeight / this._lineHeight) / 2, this._cursorSurroundingLines);
boxStartY -= context * this._lineHeight;
boxEndY += Math.max(0, (context - 1)) * this._lineHeight;
}
if (verticalType === 0 /* Simple */ || verticalType === 4 /* Bottom */) {
// Reveal one line more when the last line would be covered by the scrollbar - arrow down case or revealing a line explicitly at bottom
boxEndY += this._lineHeight;
}
var newScrollTop;
if (boxEndY - boxStartY > viewportHeight) {
// the box is larger than the viewport ... scroll to its top
newScrollTop = boxStartY;
}
else if (verticalType === 1 /* Center */ || verticalType === 2 /* CenterIfOutsideViewport */) {
if (verticalType === 2 /* CenterIfOutsideViewport */ && viewportStartY <= boxStartY && boxEndY <= viewportEndY) {
// Box is already in the viewport... do nothing
newScrollTop = viewportStartY;
}
else {
// Box is outside the viewport... center it
var boxMiddleY = (boxStartY + boxEndY) / 2;
newScrollTop = Math.max(0, boxMiddleY - viewportHeight / 2);
}
}
else {
newScrollTop = this._computeMinimumScrolling(viewportStartY, viewportEndY, boxStartY, boxEndY, verticalType === 3 /* Top */, verticalType === 4 /* Bottom */);
}
return newScrollTop;
};
ViewLines.prototype._computeScrollLeftToRevealRange = function (lineNumber, startColumn, endColumn) {
var maxHorizontalOffset = 0;
var viewport = this._context.viewLayout.getCurrentViewport();
var viewportStartX = viewport.left;
var viewportEndX = viewportStartX + viewport.width;
var visibleRanges = this._visibleRangesForLineRange(lineNumber, startColumn, endColumn);
var boxStartX = 1073741824 /* MAX_SAFE_SMALL_INTEGER */;
var boxEndX = 0;
if (!visibleRanges) {
// Unknown
return {
scrollLeft: viewportStartX,
maxHorizontalOffset: maxHorizontalOffset
};
}
for (var _i = 0, _a = visibleRanges.ranges; _i < _a.length; _i++) {
var visibleRange = _a[_i];
if (visibleRange.left < boxStartX) {
boxStartX = visibleRange.left;
}
if (visibleRange.left + visibleRange.width > boxEndX) {
boxEndX = visibleRange.left + visibleRange.width;
}
}
maxHorizontalOffset = boxEndX;
boxStartX = Math.max(0, boxStartX - ViewLines.HORIZONTAL_EXTRA_PX);
boxEndX += this._revealHorizontalRightPadding;
var newScrollLeft = this._computeMinimumScrolling(viewportStartX, viewportEndX, boxStartX, boxEndX);
return {
scrollLeft: newScrollLeft,
maxHorizontalOffset: maxHorizontalOffset
};
};
ViewLines.prototype._computeMinimumScrolling = function (viewportStart, viewportEnd, boxStart, boxEnd, revealAtStart, revealAtEnd) {
viewportStart = viewportStart | 0;
viewportEnd = viewportEnd | 0;
boxStart = boxStart | 0;
boxEnd = boxEnd | 0;
revealAtStart = !!revealAtStart;
revealAtEnd = !!revealAtEnd;
var viewportLength = viewportEnd - viewportStart;
var boxLength = boxEnd - boxStart;
if (boxLength < viewportLength) {
// The box would fit in the viewport
if (revealAtStart) {
return boxStart;
}
if (revealAtEnd) {
return Math.max(0, boxEnd - viewportLength);
}
if (boxStart < viewportStart) {
// The box is above the viewport
return boxStart;
}
else if (boxEnd > viewportEnd) {
// The box is below the viewport
return Math.max(0, boxEnd - viewportLength);
}
}
else {
// The box would not fit in the viewport
// Reveal the beginning of the box
return boxStart;
}
return viewportStart;
};
/**
* Adds this amount of pixels to the right of lines (no-one wants to type near the edge of the viewport)
*/
ViewLines.HORIZONTAL_EXTRA_PX = 30;
return ViewLines;
}(ViewPart));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.css
var linesDecorations = __webpack_require__(631);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var linesDecorations_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var linesDecorations_LinesDecorationsOverlay = /** @class */ (function (_super) {
linesDecorations_extends(LinesDecorationsOverlay, _super);
function LinesDecorationsOverlay(context) {
var _this = _super.call(this) || this;
_this._context = context;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._decorationsLeft = layoutInfo.decorationsLeft;
_this._decorationsWidth = layoutInfo.decorationsWidth;
_this._renderResult = null;
_this._context.addEventHandler(_this);
return _this;
}
LinesDecorationsOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
this._renderResult = null;
_super.prototype.dispose.call(this);
};
// --- begin event handlers
LinesDecorationsOverlay.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._decorationsLeft = layoutInfo.decorationsLeft;
this._decorationsWidth = layoutInfo.decorationsWidth;
return true;
};
LinesDecorationsOverlay.prototype.onDecorationsChanged = function (e) {
return true;
};
LinesDecorationsOverlay.prototype.onFlushed = function (e) {
return true;
};
LinesDecorationsOverlay.prototype.onLinesChanged = function (e) {
return true;
};
LinesDecorationsOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
LinesDecorationsOverlay.prototype.onLinesInserted = function (e) {
return true;
};
LinesDecorationsOverlay.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged;
};
LinesDecorationsOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
LinesDecorationsOverlay.prototype._getDecorations = function (ctx) {
var decorations = ctx.getDecorationsInViewport();
var r = [], rLen = 0;
for (var i = 0, len = decorations.length; i < len; i++) {
var d = decorations[i];
var linesDecorationsClassName = d.options.linesDecorationsClassName;
if (linesDecorationsClassName) {
r[rLen++] = new DecorationToRender(d.range.startLineNumber, d.range.endLineNumber, linesDecorationsClassName);
}
}
return r;
};
LinesDecorationsOverlay.prototype.prepareRender = function (ctx) {
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
var toRender = this._render(visibleStartLineNumber, visibleEndLineNumber, this._getDecorations(ctx));
var left = this._decorationsLeft.toString();
var width = this._decorationsWidth.toString();
var common = '" style="left:' + left + 'px;width:' + width + 'px;">';
var output = [];
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
var classNames = toRender[lineIndex];
var lineOutput = '';
for (var i = 0, len = classNames.length; i < len; i++) {
lineOutput += '';
}
output[lineIndex] = lineOutput;
}
this._renderResult = output;
};
MarginViewLineDecorationsOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderResult) {
return '';
}
return this._renderResult[lineNumber - startLineNumber];
};
return MarginViewLineDecorationsOverlay;
}(DedupOverlay));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.css
var minimap_minimap = __webpack_require__(633);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/rgba.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* A very VM friendly rgba datastructure.
* Please don't touch unless you take a look at the IR.
*/
var RGBA8 = /** @class */ (function () {
function RGBA8(r, g, b, a) {
this.r = RGBA8._clamp(r);
this.g = RGBA8._clamp(g);
this.b = RGBA8._clamp(b);
this.a = RGBA8._clamp(a);
}
RGBA8._clamp = function (c) {
if (c < 0) {
return 0;
}
if (c > 255) {
return 255;
}
return c | 0;
};
RGBA8.Empty = new RGBA8(0, 0, 0, 0);
return RGBA8;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes.js + 3 modules
var modes = __webpack_require__(14);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/minimapTokensColorTracker.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var minimapTokensColorTracker_MinimapTokensColorTracker = /** @class */ (function () {
function MinimapTokensColorTracker() {
var _this = this;
this._onDidChange = new common_event["a" /* Emitter */]();
this.onDidChange = this._onDidChange.event;
this._updateColorMap();
modes["B" /* TokenizationRegistry */].onDidChange(function (e) {
if (e.changedColorMap) {
_this._updateColorMap();
}
});
}
MinimapTokensColorTracker.getInstance = function () {
if (!this._INSTANCE) {
this._INSTANCE = new MinimapTokensColorTracker();
}
return this._INSTANCE;
};
MinimapTokensColorTracker.prototype._updateColorMap = function () {
var colorMap = modes["B" /* TokenizationRegistry */].getColorMap();
if (!colorMap) {
this._colors = [RGBA8.Empty];
this._backgroundIsLight = true;
return;
}
this._colors = [RGBA8.Empty];
for (var colorId = 1; colorId < colorMap.length; colorId++) {
var source = colorMap[colorId].rgba;
// Use a VM friendly data-type
this._colors[colorId] = new RGBA8(source.r, source.g, source.b, Math.round(source.a * 255));
}
var backgroundLuminosity = colorMap[2 /* DefaultBackground */].getRelativeLuminance();
this._backgroundIsLight = backgroundLuminosity >= 0.5;
this._onDidChange.fire(undefined);
};
MinimapTokensColorTracker.prototype.getColor = function (colorId) {
if (colorId < 1 || colorId >= this._colors.length) {
// background color (basically invisible)
colorId = 2 /* DefaultBackground */;
}
return this._colors[colorId];
};
MinimapTokensColorTracker.prototype.backgroundIsLight = function () {
return this._backgroundIsLight;
};
MinimapTokensColorTracker._INSTANCE = null;
return MinimapTokensColorTracker;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/theme/common/colorRegistry.js
var colorRegistry = __webpack_require__(6);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharSheet.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var allCharCodes = (function () {
var v = [];
for (var i = 32 /* START_CH_CODE */; i <= 126 /* END_CH_CODE */; i++) {
v.push(i);
}
v.push(65533 /* UNKNOWN_CODE */);
return v;
})();
var getCharIndex = function (chCode, fontScale) {
chCode -= 32 /* START_CH_CODE */;
if (chCode < 0 || chCode > 96 /* CHAR_COUNT */) {
if (fontScale <= 2) {
// for smaller scales, we can get away with using any ASCII character...
return (chCode + 96 /* CHAR_COUNT */) % 96 /* CHAR_COUNT */;
}
return 96 /* CHAR_COUNT */ - 1; // unknown symbol
}
return chCode;
};
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRenderer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var minimapCharRenderer_MinimapCharRenderer = /** @class */ (function () {
function MinimapCharRenderer(charData, scale) {
this.scale = scale;
this.charDataNormal = MinimapCharRenderer.soften(charData, 12 / 15);
this.charDataLight = MinimapCharRenderer.soften(charData, 50 / 60);
}
MinimapCharRenderer.soften = function (input, ratio) {
var result = new Uint8ClampedArray(input.length);
for (var i = 0, len = input.length; i < len; i++) {
result[i] = input[i] * ratio;
}
return result;
};
MinimapCharRenderer.prototype.renderChar = function (target, dx, dy, chCode, color, backgroundColor, fontScale, useLighterFont) {
var charWidth = 1 /* BASE_CHAR_WIDTH */ * this.scale;
var charHeight = 2 /* BASE_CHAR_HEIGHT */ * this.scale;
if (dx + charWidth > target.width || dy + charHeight > target.height) {
console.warn('bad render request outside image data');
return;
}
var charData = useLighterFont ? this.charDataLight : this.charDataNormal;
var charIndex = getCharIndex(chCode, fontScale);
var destWidth = target.width * 4 /* RGBA_CHANNELS_CNT */;
var backgroundR = backgroundColor.r;
var backgroundG = backgroundColor.g;
var backgroundB = backgroundColor.b;
var deltaR = color.r - backgroundR;
var deltaG = color.g - backgroundG;
var deltaB = color.b - backgroundB;
var dest = target.data;
var sourceOffset = charIndex * charWidth * charHeight;
var row = dy * destWidth + dx * 4 /* RGBA_CHANNELS_CNT */;
for (var y = 0; y < charHeight; y++) {
var column = row;
for (var x = 0; x < charWidth; x++) {
var c = charData[sourceOffset++] / 255;
dest[column++] = backgroundR + deltaR * c;
dest[column++] = backgroundG + deltaG * c;
dest[column++] = backgroundB + deltaB * c;
column++;
}
row += destWidth;
}
};
MinimapCharRenderer.prototype.blockRenderChar = function (target, dx, dy, color, backgroundColor, useLighterFont) {
var charWidth = 1 /* BASE_CHAR_WIDTH */ * this.scale;
var charHeight = 2 /* BASE_CHAR_HEIGHT */ * this.scale;
if (dx + charWidth > target.width || dy + charHeight > target.height) {
console.warn('bad render request outside image data');
return;
}
var destWidth = target.width * 4 /* RGBA_CHANNELS_CNT */;
var c = 0.5;
var backgroundR = backgroundColor.r;
var backgroundG = backgroundColor.g;
var backgroundB = backgroundColor.b;
var deltaR = color.r - backgroundR;
var deltaG = color.g - backgroundG;
var deltaB = color.b - backgroundB;
var colorR = backgroundR + deltaR * c;
var colorG = backgroundG + deltaG * c;
var colorB = backgroundB + deltaB * c;
var dest = target.data;
var row = dy * destWidth + dx * 4 /* RGBA_CHANNELS_CNT */;
for (var y = 0; y < charHeight; y++) {
var column = row;
for (var x = 0; x < charWidth; x++) {
dest[column++] = colorR;
dest[column++] = colorG;
dest[column++] = colorB;
column++;
}
row += destWidth;
}
};
return MinimapCharRenderer;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/functional.js
var functional = __webpack_require__(141);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapPreBaked.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var 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
};
var decodeData = function (str) {
var output = new Uint8ClampedArray(str.length / 2);
for (var i = 0; i < str.length; i += 2) {
output[i >> 1] = (charTable[str[i]] << 4) | (charTable[str[i + 1]] & 0xF);
}
return output;
};
/*
const encodeData = (data: Uint8ClampedArray, length: string) => {
const chars = '0123456789ABCDEF';
let output = '';
for (let i = 0; i < data.length; i++) {
output += chars[data[i] >> 4] + chars[data[i] & 0xf];
}
return output;
};
*/
/**
* Map of minimap scales to prebaked sample data at those scales. We don't
* sample much larger data, because then font family becomes visible, which
* is use-configurable.
*/
var prebakedMiniMaps = {
1: Object(functional["a" /* once */])(function () {
return decodeData('0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792');
}),
2: Object(functional["a" /* once */])(function () {
return decodeData('000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126');
})
};
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Creates character renderers. It takes a 'scale' that determines how large
* characters should be drawn. Using this, it draws data into a canvas and
* then downsamples the characters as necessary for the current display.
* This makes rendering more efficient, rather than drawing a full (tiny)
* font, or downsampling in real-time.
*/
var minimapCharRendererFactory_MinimapCharRendererFactory = /** @class */ (function () {
function MinimapCharRendererFactory() {
}
/**
* Creates a new character renderer factory with the given scale.
*/
MinimapCharRendererFactory.create = function (scale, fontFamily) {
// renderers are immutable. By default we'll 'create' a new minimap
// character renderer whenever we switch editors, no need to do extra work.
if (this.lastCreated && scale === this.lastCreated.scale && fontFamily === this.lastFontFamily) {
return this.lastCreated;
}
var factory;
if (prebakedMiniMaps[scale]) {
factory = new minimapCharRenderer_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.
*/
MinimapCharRendererFactory.createSampleData = function (fontFamily) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.style.height = 16 /* SAMPLED_CHAR_HEIGHT */ + "px";
canvas.height = 16 /* SAMPLED_CHAR_HEIGHT */;
canvas.width = 96 /* CHAR_COUNT */ * 10 /* SAMPLED_CHAR_WIDTH */;
canvas.style.width = 96 /* CHAR_COUNT */ * 10 /* SAMPLED_CHAR_WIDTH */ + 'px';
ctx.fillStyle = '#ffffff';
ctx.font = "bold " + 16 /* SAMPLED_CHAR_HEIGHT */ + "px " + fontFamily;
ctx.textBaseline = 'middle';
var x = 0;
for (var _i = 0, allCharCodes_1 = allCharCodes; _i < allCharCodes_1.length; _i++) {
var code = allCharCodes_1[_i];
ctx.fillText(String.fromCharCode(code), x, 16 /* SAMPLED_CHAR_HEIGHT */ / 2);
x += 10 /* SAMPLED_CHAR_WIDTH */;
}
return ctx.getImageData(0, 0, 96 /* CHAR_COUNT */ * 10 /* SAMPLED_CHAR_WIDTH */, 16 /* SAMPLED_CHAR_HEIGHT */);
};
/**
* Creates a character renderer from the canvas sample data.
*/
MinimapCharRendererFactory.createFromSampleData = function (source, scale) {
var expectedLength = 16 /* SAMPLED_CHAR_HEIGHT */ * 10 /* SAMPLED_CHAR_WIDTH */ * 4 /* RGBA_CHANNELS_CNT */ * 96 /* CHAR_COUNT */;
if (source.length !== expectedLength) {
throw new Error('Unexpected source in MinimapCharRenderer');
}
var charData = MinimapCharRendererFactory._downsample(source, scale);
return new minimapCharRenderer_MinimapCharRenderer(charData, scale);
};
MinimapCharRendererFactory._downsampleChar = function (source, sourceOffset, dest, destOffset, scale) {
var width = 1 /* BASE_CHAR_WIDTH */ * scale;
var height = 2 /* BASE_CHAR_HEIGHT */ * scale;
var targetIndex = destOffset;
var brightest = 0;
// This is essentially an ad-hoc rescaling algorithm. Standard approaches
// like bicubic interpolation are awesome for scaling between image sizes,
// but don't work so well when scaling to very small pixel values, we end
// up with blurry, indistinct forms.
//
// The approach taken here is simply mapping each source pixel to the target
// pixels, and taking the weighted values for all pixels in each, and then
// averaging them out. Finally we apply an intensity boost in _downsample,
// since when scaling to the smallest pixel sizes there's more black space
// which causes characters to be much less distinct.
for (var y = 0; y < height; y++) {
// 1. For this destination pixel, get the source pixels we're sampling
// from (x1, y1) to the next pixel (x2, y2)
var sourceY1 = (y / height) * 16 /* SAMPLED_CHAR_HEIGHT */;
var sourceY2 = ((y + 1) / height) * 16 /* SAMPLED_CHAR_HEIGHT */;
for (var x = 0; x < width; x++) {
var sourceX1 = (x / width) * 10 /* SAMPLED_CHAR_WIDTH */;
var sourceX2 = ((x + 1) / width) * 10 /* SAMPLED_CHAR_WIDTH */;
// 2. Sample all of them, summing them up and weighting them. Similar
// to bilinear interpolation.
var value = 0;
var samples = 0;
for (var sy = sourceY1; sy < sourceY2; sy++) {
var sourceRow = sourceOffset + Math.floor(sy) * 3840 /* RGBA_SAMPLED_ROW_WIDTH */;
var yBalance = 1 - (sy - Math.floor(sy));
for (var sx = sourceX1; sx < sourceX2; sx++) {
var xBalance = 1 - (sx - Math.floor(sx));
var sourceIndex = sourceRow + Math.floor(sx) * 4 /* RGBA_CHANNELS_CNT */;
var weight = xBalance * yBalance;
samples += weight;
value += ((source[sourceIndex] * source[sourceIndex + 3]) / 255) * weight;
}
}
var final = value / samples;
brightest = Math.max(brightest, final);
dest[targetIndex++] = final;
}
}
return brightest;
};
MinimapCharRendererFactory._downsample = function (data, scale) {
var pixelsPerCharacter = 2 /* BASE_CHAR_HEIGHT */ * scale * 1 /* BASE_CHAR_WIDTH */ * scale;
var resultLen = pixelsPerCharacter * 96 /* CHAR_COUNT */;
var result = new Uint8ClampedArray(resultLen);
var resultOffset = 0;
var sourceOffset = 0;
var brightest = 0;
for (var charIndex = 0; charIndex < 96 /* CHAR_COUNT */; charIndex++) {
brightest = Math.max(brightest, this._downsampleChar(data, sourceOffset, result, resultOffset, scale));
resultOffset += pixelsPerCharacter;
sourceOffset += 10 /* SAMPLED_CHAR_WIDTH */ * 4 /* RGBA_CHANNELS_CNT */;
}
if (brightest > 0) {
var adjust = 255 / brightest;
for (var i = 0; i < resultLen; i++) {
result[i] *= adjust;
}
}
return result;
};
return MinimapCharRendererFactory;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model.js
var common_model = __webpack_require__(47);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/minimap/minimap.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var minimap_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
function getMinimapLineHeight(renderMinimap, scale) {
if (renderMinimap === 1 /* Text */) {
return 2 /* BASE_CHAR_HEIGHT */ * scale;
}
// RenderMinimap.Blocks
return (2 /* BASE_CHAR_HEIGHT */ + 1) * scale;
}
function getMinimapCharWidth(renderMinimap, scale) {
if (renderMinimap === 1 /* Text */) {
return 1 /* BASE_CHAR_WIDTH */ * scale;
}
// RenderMinimap.Blocks
return 1 /* BASE_CHAR_WIDTH */ * scale;
}
/**
* The orthogonal distance to the slider at which dragging "resets". This implements "snapping"
*/
var MOUSE_DRAG_RESET_DISTANCE = 140;
var GUTTER_DECORATION_WIDTH = 2;
var minimap_MinimapOptions = /** @class */ (function () {
function MinimapOptions(configuration) {
var _this = this;
var options = configuration.options;
var pixelRatio = options.get(105 /* pixelRatio */);
var layoutInfo = options.get(107 /* layoutInfo */);
var fontInfo = options.get(34 /* fontInfo */);
this.renderMinimap = layoutInfo.renderMinimap | 0;
this.scrollBeyondLastLine = options.get(80 /* scrollBeyondLastLine */);
var minimapOpts = options.get(54 /* minimap */);
this.showSlider = minimapOpts.showSlider;
this.fontScale = Math.round(minimapOpts.scale * pixelRatio);
this.charRenderer = Object(functional["a" /* once */])(function () { return minimapCharRendererFactory_MinimapCharRendererFactory.create(_this.fontScale, fontInfo.fontFamily); });
this.pixelRatio = pixelRatio;
this.typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this.lineHeight = options.get(49 /* lineHeight */);
this.minimapLeft = layoutInfo.minimapLeft;
this.minimapWidth = layoutInfo.minimapWidth;
this.minimapHeight = layoutInfo.height;
this.canvasInnerWidth = Math.floor(pixelRatio * this.minimapWidth);
this.canvasInnerHeight = Math.floor(pixelRatio * this.minimapHeight);
this.canvasOuterWidth = this.canvasInnerWidth / pixelRatio;
this.canvasOuterHeight = this.canvasInnerHeight / pixelRatio;
}
MinimapOptions.prototype.equals = function (other) {
return (this.renderMinimap === other.renderMinimap
&& this.scrollBeyondLastLine === other.scrollBeyondLastLine
&& this.showSlider === other.showSlider
&& this.pixelRatio === other.pixelRatio
&& this.typicalHalfwidthCharacterWidth === other.typicalHalfwidthCharacterWidth
&& this.lineHeight === other.lineHeight
&& this.fontScale === other.fontScale
&& 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);
};
return MinimapOptions;
}());
var MinimapLayout = /** @class */ (function () {
function MinimapLayout(scrollTop, scrollHeight, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber) {
this.scrollTop = scrollTop;
this.scrollHeight = scrollHeight;
this._computedSliderRatio = computedSliderRatio;
this.sliderTop = sliderTop;
this.sliderHeight = sliderHeight;
this.startLineNumber = startLineNumber;
this.endLineNumber = endLineNumber;
}
/**
* Compute a desired `scrollPosition` such that the slider moves by `delta`.
*/
MinimapLayout.prototype.getDesiredScrollTopFromDelta = function (delta) {
var desiredSliderPosition = this.sliderTop + delta;
return Math.round(desiredSliderPosition / this._computedSliderRatio);
};
MinimapLayout.prototype.getDesiredScrollTopFromTouchLocation = function (pageY) {
return Math.round((pageY - this.sliderHeight / 2) / this._computedSliderRatio);
};
MinimapLayout.create = function (options, viewportStartLineNumber, viewportEndLineNumber, viewportHeight, viewportContainsWhitespaceGaps, lineCount, scrollTop, scrollHeight, previousLayout) {
var pixelRatio = options.pixelRatio;
var minimapLineHeight = getMinimapLineHeight(options.renderMinimap, options.fontScale);
var minimapLinesFitting = Math.floor(options.canvasInnerHeight / minimapLineHeight);
var lineHeight = options.lineHeight;
// The visible line count in a viewport can change due to a number of reasons:
// a) with the same viewport width, different scroll positions can result in partial lines being visible:
// e.g. for a line height of 20, and a viewport height of 600
// * scrollTop = 0 => visible lines are [1, 30]
// * scrollTop = 10 => visible lines are [1, 31] (with lines 1 and 31 partially visible)
// * scrollTop = 20 => visible lines are [2, 31]
// b) whitespace gaps might make their way in the viewport (which results in a decrease in the visible line count)
// c) we could be in the scroll beyond last line case (which also results in a decrease in the visible line count, down to possibly only one line being visible)
// We must first establish a desirable slider height.
var sliderHeight;
if (viewportContainsWhitespaceGaps && viewportEndLineNumber !== lineCount) {
// case b) from above: there are whitespace gaps in the viewport.
// In this case, the height of the slider directly reflects the visible line count.
var viewportLineCount = viewportEndLineNumber - viewportStartLineNumber + 1;
sliderHeight = Math.floor(viewportLineCount * minimapLineHeight / pixelRatio);
}
else {
// The slider has a stable height
var expectedViewportLineCount = viewportHeight / lineHeight;
sliderHeight = Math.floor(expectedViewportLineCount * minimapLineHeight / pixelRatio);
}
var maxMinimapSliderTop;
if (options.scrollBeyondLastLine) {
// The minimap slider, when dragged all the way down, will contain the last line at its top
maxMinimapSliderTop = (lineCount - 1) * minimapLineHeight / pixelRatio;
}
else {
// The minimap slider, when dragged all the way down, will contain the last line at its bottom
maxMinimapSliderTop = Math.max(0, lineCount * minimapLineHeight / pixelRatio - sliderHeight);
}
maxMinimapSliderTop = Math.min(options.minimapHeight - sliderHeight, maxMinimapSliderTop);
// The slider can move from 0 to `maxMinimapSliderTop`
// in the same way `scrollTop` can move from 0 to `scrollHeight` - `viewportHeight`.
var computedSliderRatio = (maxMinimapSliderTop) / (scrollHeight - viewportHeight);
var sliderTop = (scrollTop * computedSliderRatio);
var extraLinesAtTheBottom = 0;
if (options.scrollBeyondLastLine) {
var expectedViewportLineCount = viewportHeight / lineHeight;
extraLinesAtTheBottom = expectedViewportLineCount;
}
if (minimapLinesFitting >= lineCount + extraLinesAtTheBottom) {
// All lines fit in the minimap
var startLineNumber = 1;
var endLineNumber = lineCount;
return new MinimapLayout(scrollTop, scrollHeight, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber);
}
else {
var startLineNumber = Math.max(1, Math.floor(viewportStartLineNumber - sliderTop * pixelRatio / minimapLineHeight));
// Avoid flickering caused by a partial viewport start line
// by being consistent w.r.t. the previous layout decision
if (previousLayout && previousLayout.scrollHeight === scrollHeight) {
if (previousLayout.scrollTop > scrollTop) {
// Scrolling up => never increase `startLineNumber`
startLineNumber = Math.min(startLineNumber, previousLayout.startLineNumber);
}
if (previousLayout.scrollTop < scrollTop) {
// Scrolling down => never decrease `startLineNumber`
startLineNumber = Math.max(startLineNumber, previousLayout.startLineNumber);
}
}
var endLineNumber = Math.min(lineCount, startLineNumber + minimapLinesFitting - 1);
return new MinimapLayout(scrollTop, scrollHeight, computedSliderRatio, sliderTop, sliderHeight, startLineNumber, endLineNumber);
}
};
return MinimapLayout;
}());
var MinimapLine = /** @class */ (function () {
function MinimapLine(dy) {
this.dy = dy;
}
MinimapLine.prototype.onContentChanged = function () {
this.dy = -1;
};
MinimapLine.prototype.onTokensChanged = function () {
this.dy = -1;
};
MinimapLine.INVALID = new MinimapLine(-1);
return MinimapLine;
}());
var minimap_RenderData = /** @class */ (function () {
function RenderData(renderedLayout, imageData, lines) {
this.renderedLayout = renderedLayout;
this._imageData = imageData;
this._renderedLines = new RenderedLinesCollection(function () { return MinimapLine.INVALID; });
this._renderedLines._set(renderedLayout.startLineNumber, lines);
}
/**
* Check if the current RenderData matches accurately the new desired layout and no painting is needed.
*/
RenderData.prototype.linesEquals = function (layout) {
if (!this.scrollEquals(layout)) {
return false;
}
var tmp = this._renderedLines._get();
var lines = tmp.lines;
for (var i = 0, len = lines.length; i < len; i++) {
if (lines[i].dy === -1) {
// This line is invalid
return false;
}
}
return true;
};
/**
* Check if the current RenderData matches the new layout's scroll position
*/
RenderData.prototype.scrollEquals = function (layout) {
return this.renderedLayout.startLineNumber === layout.startLineNumber
&& this.renderedLayout.endLineNumber === layout.endLineNumber;
};
RenderData.prototype._get = function () {
var tmp = this._renderedLines._get();
return {
imageData: this._imageData,
rendLineNumberStart: tmp.rendLineNumberStart,
lines: tmp.lines
};
};
RenderData.prototype.onLinesChanged = function (e) {
return this._renderedLines.onLinesChanged(e.fromLineNumber, e.toLineNumber);
};
RenderData.prototype.onLinesDeleted = function (e) {
this._renderedLines.onLinesDeleted(e.fromLineNumber, e.toLineNumber);
};
RenderData.prototype.onLinesInserted = function (e) {
this._renderedLines.onLinesInserted(e.fromLineNumber, e.toLineNumber);
};
RenderData.prototype.onTokensChanged = function (e) {
return this._renderedLines.onTokensChanged(e.ranges);
};
return RenderData;
}());
/**
* Some sort of double buffering.
*
* Keeps two buffers around that will be rotated for painting.
* Always gives a buffer that is filled with the background color.
*/
var MinimapBuffers = /** @class */ (function () {
function MinimapBuffers(ctx, WIDTH, HEIGHT, background) {
this._backgroundFillData = MinimapBuffers._createBackgroundFillData(WIDTH, HEIGHT, background);
this._buffers = [
ctx.createImageData(WIDTH, HEIGHT),
ctx.createImageData(WIDTH, HEIGHT)
];
this._lastUsedBuffer = 0;
}
MinimapBuffers.prototype.getBuffer = function () {
// rotate buffers
this._lastUsedBuffer = 1 - this._lastUsedBuffer;
var result = this._buffers[this._lastUsedBuffer];
// fill with background color
result.data.set(this._backgroundFillData);
return result;
};
MinimapBuffers._createBackgroundFillData = function (WIDTH, HEIGHT, background) {
var backgroundR = background.r;
var backgroundG = background.g;
var backgroundB = background.b;
var result = new Uint8ClampedArray(WIDTH * HEIGHT * 4);
var offset = 0;
for (var i = 0; i < HEIGHT; i++) {
for (var j = 0; j < WIDTH; j++) {
result[offset] = backgroundR;
result[offset + 1] = backgroundG;
result[offset + 2] = backgroundB;
result[offset + 3] = 255;
offset += 4;
}
}
return result;
};
return MinimapBuffers;
}());
var minimap_Minimap = /** @class */ (function (_super) {
minimap_extends(Minimap, _super);
function Minimap(context) {
var _this = _super.call(this, context) || this;
_this._selections = [];
_this._renderDecorations = false;
_this._gestureInProgress = false;
_this._options = new minimap_MinimapOptions(_this._context.configuration);
_this._lastRenderData = null;
_this._buffers = null;
_this._selectionColor = _this._context.theme.getColor(colorRegistry["Ib" /* minimapSelection */]);
_this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
viewPart_PartFingerprints.write(_this._domNode, 8 /* Minimap */);
_this._domNode.setClassName(_this._getMinimapDomNodeClassName());
_this._domNode.setPosition('absolute');
_this._domNode.setAttribute('role', 'presentation');
_this._domNode.setAttribute('aria-hidden', 'true');
_this._shadow = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._shadow.setClassName('minimap-shadow-hidden');
_this._domNode.appendChild(_this._shadow);
_this._canvas = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('canvas'));
_this._canvas.setPosition('absolute');
_this._canvas.setLeft(0);
_this._domNode.appendChild(_this._canvas);
_this._decorationsCanvas = Object(fastDomNode["b" /* 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 = Object(fastDomNode["b" /* 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 = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._sliderHorizontal.setPosition('absolute');
_this._sliderHorizontal.setClassName('minimap-slider-horizontal');
_this._slider.appendChild(_this._sliderHorizontal);
_this._tokensColorTracker = minimapTokensColorTracker_MinimapTokensColorTracker.getInstance();
_this._applyLayout();
_this._mouseDownListener = dom["o" /* addStandardDisposableListener */](_this._domNode.domNode, 'mousedown', function (e) {
e.preventDefault();
var renderMinimap = _this._options.renderMinimap;
if (renderMinimap === 0 /* None */) {
return;
}
if (!_this._lastRenderData) {
return;
}
var minimapLineHeight = getMinimapLineHeight(renderMinimap, _this._options.fontScale);
var internalOffsetY = _this._options.pixelRatio * e.browserEvent.offsetY;
var lineIndex = Math.floor(internalOffsetY / minimapLineHeight);
var lineNumber = lineIndex + _this._lastRenderData.renderedLayout.startLineNumber;
lineNumber = Math.min(lineNumber, _this._context.model.getLineCount());
_this._context.privateViewEventBus.emit(new ViewRevealRangeRequestEvent('mouse', new core_range["a" /* Range */](lineNumber, 1, lineNumber, 1), 1 /* Center */, false, 0 /* Smooth */));
});
_this._sliderMouseMoveMonitor = new globalMouseMoveMonitor["a" /* GlobalMouseMoveMonitor */]();
_this._sliderMouseDownListener = dom["o" /* addStandardDisposableListener */](_this._slider.domNode, 'mousedown', function (e) {
e.preventDefault();
e.stopPropagation();
if (e.leftButton && _this._lastRenderData) {
var initialMousePosition_1 = e.posy;
var initialMouseOrthogonalPosition_1 = e.posx;
var initialSliderState_1 = _this._lastRenderData.renderedLayout;
_this._slider.toggleClassName('active', true);
_this._sliderMouseMoveMonitor.startMonitoring(e.target, e.buttons, globalMouseMoveMonitor["b" /* standardMouseMoveMerger */], function (mouseMoveData) {
var mouseOrthogonalDelta = Math.abs(mouseMoveData.posx - initialMouseOrthogonalPosition_1);
if (platform["h" /* isWindows */] && mouseOrthogonalDelta > MOUSE_DRAG_RESET_DISTANCE) {
// The mouse has wondered away from the scrollbar => reset dragging
_this._context.viewLayout.setScrollPositionNow({
scrollTop: initialSliderState_1.scrollTop
});
return;
}
var mouseDelta = mouseMoveData.posy - initialMousePosition_1;
_this._context.viewLayout.setScrollPositionNow({
scrollTop: initialSliderState_1.getDesiredScrollTopFromDelta(mouseDelta)
});
}, function () {
_this._slider.toggleClassName('active', false);
});
}
});
_this._gestureDisposable = touch["b" /* Gesture */].addTarget(_this._domNode.domNode);
_this._sliderTouchStartListener = dom["j" /* addDisposableListener */](_this._domNode.domNode, touch["a" /* EventType */].Start, function (e) {
e.preventDefault();
e.stopPropagation();
if (_this._lastRenderData) {
_this._slider.toggleClassName('active', true);
_this._gestureInProgress = true;
_this.scrollDueToTouchEvent(e);
}
});
_this._sliderTouchMoveListener = dom["o" /* addStandardDisposableListener */](_this._domNode.domNode, touch["a" /* EventType */].Change, function (e) {
e.preventDefault();
e.stopPropagation();
if (_this._lastRenderData && _this._gestureInProgress) {
_this.scrollDueToTouchEvent(e);
}
});
_this._sliderTouchEndListener = dom["o" /* addStandardDisposableListener */](_this._domNode.domNode, touch["a" /* EventType */].End, function (e) {
e.preventDefault();
e.stopPropagation();
_this._gestureInProgress = false;
_this._slider.toggleClassName('active', false);
});
return _this;
}
Minimap.prototype.scrollDueToTouchEvent = function (touch) {
var startY = this._domNode.domNode.getBoundingClientRect().top;
var scrollTop = this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(touch.pageY - startY);
this._context.viewLayout.setScrollPositionNow({
scrollTop: scrollTop
});
};
Minimap.prototype.dispose = function () {
this._mouseDownListener.dispose();
this._sliderMouseMoveMonitor.dispose();
this._sliderMouseDownListener.dispose();
this._gestureDisposable.dispose();
this._sliderTouchStartListener.dispose();
this._sliderTouchMoveListener.dispose();
this._sliderTouchEndListener.dispose();
_super.prototype.dispose.call(this);
};
Minimap.prototype._getMinimapDomNodeClassName = function () {
if (this._options.showSlider === 'always') {
return 'minimap slider-always';
}
return 'minimap slider-mouseover';
};
Minimap.prototype.getDomNode = function () {
return this._domNode;
};
Minimap.prototype._applyLayout = function () {
this._domNode.setLeft(this._options.minimapLeft);
this._domNode.setWidth(this._options.minimapWidth);
this._domNode.setHeight(this._options.minimapHeight);
this._shadow.setHeight(this._options.minimapHeight);
this._canvas.setWidth(this._options.canvasOuterWidth);
this._canvas.setHeight(this._options.canvasOuterHeight);
this._canvas.domNode.width = this._options.canvasInnerWidth;
this._canvas.domNode.height = this._options.canvasInnerHeight;
this._decorationsCanvas.setWidth(this._options.canvasOuterWidth);
this._decorationsCanvas.setHeight(this._options.canvasOuterHeight);
this._decorationsCanvas.domNode.width = this._options.canvasInnerWidth;
this._decorationsCanvas.domNode.height = this._options.canvasInnerHeight;
this._slider.setWidth(this._options.minimapWidth);
};
Minimap.prototype._getBuffer = function () {
if (!this._buffers) {
if (this._options.canvasInnerWidth > 0 && this._options.canvasInnerHeight > 0) {
this._buffers = new MinimapBuffers(this._canvas.domNode.getContext('2d'), this._options.canvasInnerWidth, this._options.canvasInnerHeight, this._tokensColorTracker.getColor(2 /* DefaultBackground */));
}
}
return this._buffers ? this._buffers.getBuffer() : null;
};
Minimap.prototype._onOptionsMaybeChanged = function () {
var opts = new minimap_MinimapOptions(this._context.configuration);
if (this._options.equals(opts)) {
return false;
}
this._options = opts;
this._lastRenderData = null;
this._buffers = null;
this._applyLayout();
this._domNode.setClassName(this._getMinimapDomNodeClassName());
return true;
};
// ---- begin view event handlers
Minimap.prototype.onConfigurationChanged = function (e) {
return this._onOptionsMaybeChanged();
};
Minimap.prototype.onCursorStateChanged = function (e) {
this._selections = e.selections;
this._renderDecorations = true;
return true;
};
Minimap.prototype.onFlushed = function (e) {
this._lastRenderData = null;
return true;
};
Minimap.prototype.onLinesChanged = function (e) {
if (this._lastRenderData) {
return this._lastRenderData.onLinesChanged(e);
}
return false;
};
Minimap.prototype.onLinesDeleted = function (e) {
if (this._lastRenderData) {
this._lastRenderData.onLinesDeleted(e);
}
return true;
};
Minimap.prototype.onLinesInserted = function (e) {
if (this._lastRenderData) {
this._lastRenderData.onLinesInserted(e);
}
return true;
};
Minimap.prototype.onScrollChanged = function (e) {
this._renderDecorations = true;
return true;
};
Minimap.prototype.onTokensChanged = function (e) {
if (this._lastRenderData) {
return this._lastRenderData.onTokensChanged(e);
}
return false;
};
Minimap.prototype.onTokensColorsChanged = function (e) {
this._lastRenderData = null;
this._buffers = null;
return true;
};
Minimap.prototype.onZonesChanged = function (e) {
this._lastRenderData = null;
return true;
};
Minimap.prototype.onDecorationsChanged = function (e) {
this._renderDecorations = true;
return true;
};
Minimap.prototype.onThemeChanged = function (e) {
this._context.model.invalidateMinimapColorCache();
this._selectionColor = this._context.theme.getColor(colorRegistry["Ib" /* minimapSelection */]);
this._renderDecorations = true;
return true;
};
// --- end event handlers
Minimap.prototype.prepareRender = function (ctx) {
// Nothing to read
};
Minimap.prototype.render = function (renderingCtx) {
var renderMinimap = this._options.renderMinimap;
if (renderMinimap === 0 /* None */) {
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');
}
var layout = MinimapLayout.create(this._options, renderingCtx.visibleRange.startLineNumber, renderingCtx.visibleRange.endLineNumber, renderingCtx.viewportHeight, (renderingCtx.viewportData.whitespaceViewportData.length > 0), this._context.model.getLineCount(), renderingCtx.scrollTop, renderingCtx.scrollHeight, this._lastRenderData ? this._lastRenderData.renderedLayout : null);
this._slider.setTop(layout.sliderTop);
this._slider.setHeight(layout.sliderHeight);
// Compute horizontal slider coordinates
var scrollLeftChars = renderingCtx.scrollLeft / this._options.typicalHalfwidthCharacterWidth;
var horizontalSliderLeft = Math.min(this._options.minimapWidth, Math.round(scrollLeftChars * getMinimapCharWidth(this._options.renderMinimap, this._options.fontScale) / this._options.pixelRatio));
this._sliderHorizontal.setLeft(horizontalSliderLeft);
this._sliderHorizontal.setWidth(this._options.minimapWidth - horizontalSliderLeft);
this._sliderHorizontal.setTop(0);
this._sliderHorizontal.setHeight(layout.sliderHeight);
this.renderDecorations(layout);
this._lastRenderData = this.renderLines(layout);
};
Minimap.prototype.renderDecorations = function (layout) {
if (this._renderDecorations) {
this._renderDecorations = false;
var decorations = this._context.model.getDecorationsInViewport(new core_range["a" /* Range */](layout.startLineNumber, 1, layout.endLineNumber, this._context.model.getLineMaxColumn(layout.endLineNumber)));
var _a = this._options, renderMinimap = _a.renderMinimap, canvasInnerWidth = _a.canvasInnerWidth, canvasInnerHeight = _a.canvasInnerHeight;
var lineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale);
var characterWidth = getMinimapCharWidth(renderMinimap, this._options.fontScale);
var tabSize = this._context.model.getOptions().tabSize;
var canvasContext = this._decorationsCanvas.domNode.getContext('2d');
canvasContext.clearRect(0, 0, canvasInnerWidth, canvasInnerHeight);
var lineOffsetMap = new Map();
for (var i = 0; i < this._selections.length; i++) {
var selection = this._selections[i];
for (var line = selection.startLineNumber; line <= selection.endLineNumber; line++) {
this.renderDecorationOnLine(canvasContext, lineOffsetMap, selection, this._selectionColor, layout, line, lineHeight, lineHeight, tabSize, characterWidth);
}
}
// Loop over decorations, ignoring those that don't have the minimap property set and rendering rectangles for each line the decoration spans
for (var i = 0; i < decorations.length; i++) {
var decoration = decorations[i];
if (!decoration.options.minimap) {
continue;
}
var decorationColor = decoration.options.minimap.getColor(this._context.theme);
for (var line = decoration.range.startLineNumber; line <= decoration.range.endLineNumber; line++) {
switch (decoration.options.minimap.position) {
case common_model["c" /* MinimapPosition */].Inline:
this.renderDecorationOnLine(canvasContext, lineOffsetMap, decoration.range, decorationColor, layout, line, lineHeight, lineHeight, tabSize, characterWidth);
continue;
case common_model["c" /* MinimapPosition */].Gutter:
var y = (line - layout.startLineNumber) * lineHeight;
var x = 2;
this.renderDecoration(canvasContext, decorationColor, x, y, GUTTER_DECORATION_WIDTH, lineHeight);
continue;
}
}
}
}
};
Minimap.prototype.renderDecorationOnLine = function (canvasContext, lineOffsetMap, decorationRange, decorationColor, layout, lineNumber, height, lineHeight, tabSize, charWidth) {
var y = (lineNumber - layout.startLineNumber) * lineHeight;
// Skip rendering the line if it's vertically outside our viewport
if (y + height < 0 || y > this._options.canvasInnerHeight) {
return;
}
// Cache line offset data so that it is only read once per line
var lineIndexToXOffset = lineOffsetMap.get(lineNumber);
var isFirstDecorationForLine = !lineIndexToXOffset;
if (!lineIndexToXOffset) {
var lineData = this._context.model.getLineContent(lineNumber);
lineIndexToXOffset = [editorOptions["f" /* MINIMAP_GUTTER_WIDTH */]];
for (var i = 1; i < lineData.length + 1; i++) {
var charCode = lineData.charCodeAt(i - 1);
var dx = charCode === 9 /* Tab */
? tabSize * charWidth
: strings["y" /* isFullWidthCharacter */](charCode)
? 2 * charWidth
: charWidth;
lineIndexToXOffset[i] = lineIndexToXOffset[i - 1] + dx;
}
lineOffsetMap.set(lineNumber, lineIndexToXOffset);
}
var startColumn = decorationRange.startColumn, endColumn = decorationRange.endColumn, startLineNumber = decorationRange.startLineNumber, endLineNumber = decorationRange.endLineNumber;
var x = startLineNumber === lineNumber ? lineIndexToXOffset[startColumn - 1] : editorOptions["f" /* MINIMAP_GUTTER_WIDTH */];
var endColumnForLine = endLineNumber > lineNumber ? lineIndexToXOffset.length - 1 : endColumn - 1;
if (endColumnForLine > 0) {
// If the decoration starts at the last character of the column and spans over it, ensure it has a width
var width = lineIndexToXOffset[endColumnForLine] - x || 2;
this.renderDecoration(canvasContext, decorationColor, x, y, width, height);
}
if (isFirstDecorationForLine) {
this.renderLineHighlight(canvasContext, decorationColor, y, height);
}
};
Minimap.prototype.renderLineHighlight = function (canvasContext, decorationColor, y, height) {
canvasContext.fillStyle = decorationColor && decorationColor.transparent(0.5).toString() || '';
canvasContext.fillRect(editorOptions["f" /* MINIMAP_GUTTER_WIDTH */], y, canvasContext.canvas.width, height);
};
Minimap.prototype.renderDecoration = function (canvasContext, decorationColor, x, y, width, height) {
canvasContext.fillStyle = decorationColor && decorationColor.toString() || '';
canvasContext.fillRect(x, y, width, height);
};
Minimap.prototype.renderLines = function (layout) {
var renderMinimap = this._options.renderMinimap;
var charRenderer = this._options.charRenderer();
var startLineNumber = layout.startLineNumber;
var endLineNumber = layout.endLineNumber;
var minimapLineHeight = getMinimapLineHeight(renderMinimap, this._options.fontScale);
// Check if nothing changed w.r.t. lines from last frame
if (this._lastRenderData && this._lastRenderData.linesEquals(layout)) {
var _lastData = this._lastRenderData._get();
// Nice!! Nothing changed from last frame
return new minimap_RenderData(layout, _lastData.imageData, _lastData.lines);
}
// Oh well!! We need to repaint some lines...
var imageData = this._getBuffer();
if (!imageData) {
// 0 width or 0 height canvas, nothing to do
return null;
}
// Render untouched lines by using last rendered data.
var _a = Minimap._renderUntouchedLines(imageData, startLineNumber, endLineNumber, minimapLineHeight, this._lastRenderData), _dirtyY1 = _a[0], _dirtyY2 = _a[1], needed = _a[2];
// Fetch rendering info from view model for rest of lines that need rendering.
var lineInfo = this._context.model.getMinimapLinesRenderingData(startLineNumber, endLineNumber, needed);
var tabSize = lineInfo.tabSize;
var background = this._tokensColorTracker.getColor(2 /* DefaultBackground */);
var useLighterFont = this._tokensColorTracker.backgroundIsLight();
// Render the rest of lines
var dy = 0;
var renderedLines = [];
for (var lineIndex = 0, lineCount = endLineNumber - startLineNumber + 1; lineIndex < lineCount; lineIndex++) {
if (needed[lineIndex]) {
Minimap._renderLine(imageData, background, useLighterFont, renderMinimap, this._tokensColorTracker, charRenderer, dy, tabSize, lineInfo.data[lineIndex], this._options.fontScale);
}
renderedLines[lineIndex] = new MinimapLine(dy);
dy += minimapLineHeight;
}
var dirtyY1 = (_dirtyY1 === -1 ? 0 : _dirtyY1);
var dirtyY2 = (_dirtyY2 === -1 ? imageData.height : _dirtyY2);
var dirtyHeight = dirtyY2 - dirtyY1;
// Finally, paint to the canvas
var ctx = this._canvas.domNode.getContext('2d');
ctx.putImageData(imageData, 0, 0, 0, dirtyY1, imageData.width, dirtyHeight);
// Save rendered data for reuse on next frame if possible
return new minimap_RenderData(layout, imageData, renderedLines);
};
Minimap._renderUntouchedLines = function (target, startLineNumber, endLineNumber, minimapLineHeight, lastRenderData) {
var needed = [];
if (!lastRenderData) {
for (var i = 0, len = endLineNumber - startLineNumber + 1; i < len; i++) {
needed[i] = true;
}
return [-1, -1, needed];
}
var _lastData = lastRenderData._get();
var lastTargetData = _lastData.imageData.data;
var lastStartLineNumber = _lastData.rendLineNumberStart;
var lastLines = _lastData.lines;
var lastLinesLength = lastLines.length;
var WIDTH = target.width;
var targetData = target.data;
var maxDestPixel = (endLineNumber - startLineNumber + 1) * minimapLineHeight * WIDTH * 4;
var dirtyPixel1 = -1; // the pixel offset up to which all the data is equal to the prev frame
var dirtyPixel2 = -1; // the pixel offset after which all the data is equal to the prev frame
var copySourceStart = -1;
var copySourceEnd = -1;
var copyDestStart = -1;
var copyDestEnd = -1;
var dest_dy = 0;
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var lineIndex = lineNumber - startLineNumber;
var lastLineIndex = lineNumber - lastStartLineNumber;
var source_dy = (lastLineIndex >= 0 && lastLineIndex < lastLinesLength ? lastLines[lastLineIndex].dy : -1);
if (source_dy === -1) {
needed[lineIndex] = true;
dest_dy += minimapLineHeight;
continue;
}
var sourceStart = source_dy * WIDTH * 4;
var sourceEnd = (source_dy + minimapLineHeight) * WIDTH * 4;
var destStart = dest_dy * WIDTH * 4;
var destEnd = (dest_dy + minimapLineHeight) * WIDTH * 4;
if (copySourceEnd === sourceStart && copyDestEnd === destStart) {
// contiguous zone => extend copy request
copySourceEnd = sourceEnd;
copyDestEnd = destEnd;
}
else {
if (copySourceStart !== -1) {
// flush existing copy request
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) {
// flush existing copy request
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;
}
}
var dirtyY1 = (dirtyPixel1 === -1 ? -1 : dirtyPixel1 / (WIDTH * 4));
var dirtyY2 = (dirtyPixel2 === -1 ? -1 : dirtyPixel2 / (WIDTH * 4));
return [dirtyY1, dirtyY2, needed];
};
Minimap._renderLine = function (target, backgroundColor, useLighterFont, renderMinimap, colorTracker, minimapCharRenderer, dy, tabSize, lineData, fontScale) {
var content = lineData.content;
var tokens = lineData.tokens;
var charWidth = getMinimapCharWidth(renderMinimap, fontScale);
var maxDx = target.width - charWidth;
var dx = editorOptions["f" /* MINIMAP_GUTTER_WIDTH */];
var charIndex = 0;
var tabsCharDelta = 0;
for (var tokenIndex = 0, tokensLen = tokens.getCount(); tokenIndex < tokensLen; tokenIndex++) {
var tokenEndIndex = tokens.getEndOffset(tokenIndex);
var tokenColorId = tokens.getForeground(tokenIndex);
var tokenColor = colorTracker.getColor(tokenColorId);
for (; charIndex < tokenEndIndex; charIndex++) {
if (dx > maxDx) {
// hit edge of minimap
return;
}
var charCode = content.charCodeAt(charIndex);
if (charCode === 9 /* Tab */) {
var insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
tabsCharDelta += insertSpacesCount - 1;
// No need to render anything since tab is invisible
dx += insertSpacesCount * charWidth;
}
else if (charCode === 32 /* Space */) {
// No need to render anything since space is invisible
dx += charWidth;
}
else {
// Render twice for a full width character
var count = strings["y" /* isFullWidthCharacter */](charCode) ? 2 : 1;
for (var i = 0; i < count; i++) {
if (renderMinimap === 2 /* Blocks */) {
minimapCharRenderer.blockRenderChar(target, dx, dy, tokenColor, backgroundColor, useLighterFont);
}
else { // RenderMinimap.Text
minimapCharRenderer.renderChar(target, dx, dy, charCode, tokenColor, backgroundColor, fontScale, useLighterFont);
}
dx += charWidth;
if (dx > maxDx) {
// hit edge of minimap
return;
}
}
}
}
}
};
return Minimap;
}(ViewPart));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var sliderBackground = theme.getColor(colorRegistry["Xb" /* scrollbarSliderBackground */]);
if (sliderBackground) {
var halfSliderBackground = sliderBackground.transparent(0.5);
collector.addRule(".monaco-editor .minimap-slider, .monaco-editor .minimap-slider .minimap-slider-horizontal { background: " + halfSliderBackground + "; }");
}
var sliderHoverBackground = theme.getColor(colorRegistry["Yb" /* scrollbarSliderHoverBackground */]);
if (sliderHoverBackground) {
var halfSliderHoverBackground = sliderHoverBackground.transparent(0.5);
collector.addRule(".monaco-editor .minimap-slider:hover, .monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: " + halfSliderHoverBackground + "; }");
}
var sliderActiveBackground = theme.getColor(colorRegistry["Wb" /* scrollbarSliderActiveBackground */]);
if (sliderActiveBackground) {
var halfSliderActiveBackground = sliderActiveBackground.transparent(0.5);
collector.addRule(".monaco-editor .minimap-slider.active, .monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: " + halfSliderActiveBackground + "; }");
}
var shadow = theme.getColor(colorRegistry["Vb" /* scrollbarShadow */]);
if (shadow) {
collector.addRule(".monaco-editor .minimap-shadow-visible { box-shadow: " + shadow + " -6px 0 6px -6px inset; }");
}
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.css
var overlayWidgets = __webpack_require__(634);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var overlayWidgets_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var overlayWidgets_ViewOverlayWidgets = /** @class */ (function (_super) {
overlayWidgets_extends(ViewOverlayWidgets, _super);
function ViewOverlayWidgets(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._widgets = {};
_this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
_this._minimapWidth = layoutInfo.minimapWidth;
_this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
_this._editorHeight = layoutInfo.height;
_this._editorWidth = layoutInfo.width;
_this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
viewPart_PartFingerprints.write(_this._domNode, 4 /* OverlayWidgets */);
_this._domNode.setClassName('overlayWidgets');
return _this;
}
ViewOverlayWidgets.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._widgets = {};
};
ViewOverlayWidgets.prototype.getDomNode = function () {
return this._domNode;
};
// ---- begin view event handlers
ViewOverlayWidgets.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._verticalScrollbarWidth = layoutInfo.verticalScrollbarWidth;
this._minimapWidth = layoutInfo.minimapWidth;
this._horizontalScrollbarHeight = layoutInfo.horizontalScrollbarHeight;
this._editorHeight = layoutInfo.height;
this._editorWidth = layoutInfo.width;
return true;
};
// ---- end view event handlers
ViewOverlayWidgets.prototype.addWidget = function (widget) {
var domNode = Object(fastDomNode["b" /* createFastDomNode */])(widget.getDomNode());
this._widgets[widget.getId()] = {
widget: widget,
preference: null,
domNode: domNode
};
// This is sync because a widget wants to be in the dom
domNode.setPosition('absolute');
domNode.setAttribute('widgetId', widget.getId());
this._domNode.appendChild(domNode);
this.setShouldRender();
};
ViewOverlayWidgets.prototype.setWidgetPosition = function (widget, preference) {
var widgetData = this._widgets[widget.getId()];
if (widgetData.preference === preference) {
return false;
}
widgetData.preference = preference;
this.setShouldRender();
return true;
};
ViewOverlayWidgets.prototype.removeWidget = function (widget) {
var widgetId = widget.getId();
if (this._widgets.hasOwnProperty(widgetId)) {
var widgetData = this._widgets[widgetId];
var domNode = widgetData.domNode.domNode;
delete this._widgets[widgetId];
domNode.parentNode.removeChild(domNode);
this.setShouldRender();
}
};
ViewOverlayWidgets.prototype._renderWidget = function (widgetData) {
var domNode = widgetData.domNode;
if (widgetData.preference === null) {
domNode.unsetTop();
return;
}
if (widgetData.preference === 0 /* TOP_RIGHT_CORNER */) {
domNode.setTop(0);
domNode.setRight((2 * this._verticalScrollbarWidth) + this._minimapWidth);
}
else if (widgetData.preference === 1 /* BOTTOM_RIGHT_CORNER */) {
var widgetHeight = domNode.domNode.clientHeight;
domNode.setTop((this._editorHeight - widgetHeight - 2 * this._horizontalScrollbarHeight));
domNode.setRight((2 * this._verticalScrollbarWidth) + this._minimapWidth);
}
else if (widgetData.preference === 2 /* TOP_CENTER */) {
domNode.setTop(0);
domNode.domNode.style.right = '50%';
}
};
ViewOverlayWidgets.prototype.prepareRender = function (ctx) {
// Nothing to read
};
ViewOverlayWidgets.prototype.render = function (ctx) {
this._domNode.setWidth(this._editorWidth);
var keys = Object.keys(this._widgets);
for (var i = 0, len = keys.length; i < len; i++) {
var widgetId = keys[i];
this._renderWidget(this._widgets[widgetId]);
}
};
return ViewOverlayWidgets;
}(ViewPart));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/color.js
var common_color = __webpack_require__(15);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var decorationsOverviewRuler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var decorationsOverviewRuler_Settings = /** @class */ (function () {
function Settings(config, theme) {
var options = config.options;
this.lineHeight = options.get(49 /* lineHeight */);
this.pixelRatio = options.get(105 /* pixelRatio */);
this.overviewRulerLanes = options.get(63 /* overviewRulerLanes */);
this.renderBorder = options.get(62 /* overviewRulerBorder */);
var borderColor = theme.getColor(editorColorRegistry["l" /* editorOverviewRulerBorder */]);
this.borderColor = borderColor ? borderColor.toString() : null;
this.hideCursor = options.get(42 /* hideCursorInOverviewRuler */);
var cursorColor = theme.getColor(editorColorRegistry["g" /* editorCursorForeground */]);
this.cursorColor = cursorColor ? cursorColor.transparent(0.7).toString() : null;
this.themeType = theme.type;
var minimapOpts = options.get(54 /* minimap */);
var minimapEnabled = minimapOpts.enabled;
var minimapSide = minimapOpts.side;
var backgroundColor = (minimapEnabled ? modes["B" /* TokenizationRegistry */].getDefaultBackground() : null);
if (backgroundColor === null || minimapSide === 'left') {
this.backgroundColor = null;
}
else {
this.backgroundColor = common_color["a" /* Color */].Format.CSS.formatHex(backgroundColor);
}
var layoutInfo = options.get(107 /* layoutInfo */);
var position = layoutInfo.overviewRuler;
this.top = position.top;
this.right = position.right;
this.domWidth = position.width;
this.domHeight = position.height;
if (this.overviewRulerLanes === 0) {
// overview ruler is off
this.canvasWidth = 0;
this.canvasHeight = 0;
}
else {
this.canvasWidth = (this.domWidth * this.pixelRatio) | 0;
this.canvasHeight = (this.domHeight * this.pixelRatio) | 0;
}
var _a = this._initLanes(1, this.canvasWidth, this.overviewRulerLanes), x = _a[0], w = _a[1];
this.x = x;
this.w = w;
}
Settings.prototype._initLanes = function (canvasLeftOffset, canvasWidth, laneCount) {
var remainingWidth = canvasWidth - canvasLeftOffset;
if (laneCount >= 3) {
var leftWidth = Math.floor(remainingWidth / 3);
var rightWidth = Math.floor(remainingWidth / 3);
var centerWidth = remainingWidth - leftWidth - rightWidth;
var leftOffset = canvasLeftOffset;
var centerOffset = leftOffset + leftWidth;
var rightOffset = leftOffset + leftWidth + centerWidth;
return [
[
0,
leftOffset,
centerOffset,
leftOffset,
rightOffset,
leftOffset,
centerOffset,
leftOffset,
], [
0,
leftWidth,
centerWidth,
leftWidth + centerWidth,
rightWidth,
leftWidth + centerWidth + rightWidth,
centerWidth + rightWidth,
leftWidth + centerWidth + rightWidth,
]
];
}
else if (laneCount === 2) {
var leftWidth = Math.floor(remainingWidth / 2);
var rightWidth = remainingWidth - leftWidth;
var leftOffset = canvasLeftOffset;
var rightOffset = leftOffset + leftWidth;
return [
[
0,
leftOffset,
leftOffset,
leftOffset,
rightOffset,
leftOffset,
leftOffset,
leftOffset,
], [
0,
leftWidth,
leftWidth,
leftWidth,
rightWidth,
leftWidth + rightWidth,
leftWidth + rightWidth,
leftWidth + rightWidth,
]
];
}
else {
var offset = canvasLeftOffset;
var width = remainingWidth;
return [
[
0,
offset,
offset,
offset,
offset,
offset,
offset,
offset,
], [
0,
width,
width,
width,
width,
width,
width,
width,
]
];
}
};
Settings.prototype.equals = function (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.cursorColor === other.cursorColor
&& this.themeType === other.themeType
&& 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);
};
return Settings;
}());
var decorationsOverviewRuler_DecorationsOverviewRuler = /** @class */ (function (_super) {
decorationsOverviewRuler_extends(DecorationsOverviewRuler, _super);
function DecorationsOverviewRuler(context) {
var _this = _super.call(this, context) || this;
_this._domNode = Object(fastDomNode["b" /* 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 = modes["B" /* TokenizationRegistry */].onDidChange(function (e) {
if (e.changedColorMap) {
_this._updateSettings(true);
}
});
_this._cursorPositions = [];
return _this;
}
DecorationsOverviewRuler.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._tokensColorTrackerListener.dispose();
};
DecorationsOverviewRuler.prototype._updateSettings = function (renderNow) {
var newSettings = new decorationsOverviewRuler_Settings(this._context.configuration, this._context.theme);
if (this._settings && this._settings.equals(newSettings)) {
// nothing to do
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
DecorationsOverviewRuler.prototype.onConfigurationChanged = function (e) {
return this._updateSettings(false);
};
DecorationsOverviewRuler.prototype.onCursorStateChanged = function (e) {
this._cursorPositions = [];
for (var i = 0, len = e.selections.length; i < len; i++) {
this._cursorPositions[i] = e.selections[i].getPosition();
}
this._cursorPositions.sort(core_position["a" /* Position */].compare);
return true;
};
DecorationsOverviewRuler.prototype.onDecorationsChanged = function (e) {
return true;
};
DecorationsOverviewRuler.prototype.onFlushed = function (e) {
return true;
};
DecorationsOverviewRuler.prototype.onScrollChanged = function (e) {
return e.scrollHeightChanged;
};
DecorationsOverviewRuler.prototype.onZonesChanged = function (e) {
return true;
};
DecorationsOverviewRuler.prototype.onThemeChanged = function (e) {
// invalidate color cache
this._context.model.invalidateOverviewRulerColorCache();
return this._updateSettings(false);
};
// ---- end view event handlers
DecorationsOverviewRuler.prototype.getDomNode = function () {
return this._domNode.domNode;
};
DecorationsOverviewRuler.prototype.prepareRender = function (ctx) {
// Nothing to read
};
DecorationsOverviewRuler.prototype.render = function (editorCtx) {
this._render();
};
DecorationsOverviewRuler.prototype._render = function () {
if (this._settings.overviewRulerLanes === 0) {
// overview ruler is off
this._domNode.setBackgroundColor(this._settings.backgroundColor ? this._settings.backgroundColor : '');
return;
}
var canvasWidth = this._settings.canvasWidth;
var canvasHeight = this._settings.canvasHeight;
var lineHeight = this._settings.lineHeight;
var viewLayout = this._context.viewLayout;
var outerHeight = this._context.viewLayout.getScrollHeight();
var heightRatio = canvasHeight / outerHeight;
var decorations = this._context.model.getAllOverviewRulerDecorations(this._context.theme);
var minDecorationHeight = (6 /* MIN_DECORATION_HEIGHT */ * this._settings.pixelRatio) | 0;
var halfMinDecorationHeight = (minDecorationHeight / 2) | 0;
var canvasCtx = this._domNode.domNode.getContext('2d');
if (this._settings.backgroundColor === null) {
canvasCtx.clearRect(0, 0, canvasWidth, canvasHeight);
}
else {
canvasCtx.fillStyle = this._settings.backgroundColor;
canvasCtx.fillRect(0, 0, canvasWidth, canvasHeight);
}
var x = this._settings.x;
var w = this._settings.w;
// Avoid flickering by always rendering the colors in the same order
// colors that don't use transparency will be sorted last (they start with #)
var colors = Object.keys(decorations);
colors.sort();
for (var cIndex = 0, cLen = colors.length; cIndex < cLen; cIndex++) {
var color = colors[cIndex];
var colorDecorations = decorations[color];
canvasCtx.fillStyle = color;
var prevLane = 0;
var prevY1 = 0;
var prevY2 = 0;
for (var i = 0, len = colorDecorations.length; i < len; i++) {
var lane = colorDecorations[3 * i];
var startLineNumber = colorDecorations[3 * i + 1];
var endLineNumber = colorDecorations[3 * i + 2];
var y1 = (viewLayout.getVerticalOffsetForLineNumber(startLineNumber) * heightRatio) | 0;
var y2 = ((viewLayout.getVerticalOffsetForLineNumber(endLineNumber) + lineHeight) * heightRatio) | 0;
var height = y2 - y1;
if (height < minDecorationHeight) {
var 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) {
// flush prev
if (i !== 0) {
canvasCtx.fillRect(x[prevLane], prevY1, w[prevLane], prevY2 - prevY1);
}
prevLane = lane;
prevY1 = y1;
prevY2 = y2;
}
else {
// merge into prev
if (y2 > prevY2) {
prevY2 = y2;
}
}
}
canvasCtx.fillRect(x[prevLane], prevY1, w[prevLane], prevY2 - prevY1);
}
// Draw cursors
if (!this._settings.hideCursor && this._settings.cursorColor) {
var cursorHeight = (2 * this._settings.pixelRatio) | 0;
var halfCursorHeight = (cursorHeight / 2) | 0;
var cursorX = this._settings.x[7 /* Full */];
var cursorW = this._settings.w[7 /* Full */];
canvasCtx.fillStyle = this._settings.cursorColor;
var prevY1 = -100;
var prevY2 = -100;
for (var i = 0, len = this._cursorPositions.length; i < len; i++) {
var cursor = this._cursorPositions[i];
var yCenter = (viewLayout.getVerticalOffsetForLineNumber(cursor.lineNumber) * heightRatio) | 0;
if (yCenter < halfCursorHeight) {
yCenter = halfCursorHeight;
}
else if (yCenter + halfCursorHeight > canvasHeight) {
yCenter = canvasHeight - halfCursorHeight;
}
var y1 = yCenter - halfCursorHeight;
var y2 = y1 + cursorHeight;
if (y1 > prevY2 + 1) {
// flush prev
if (i !== 0) {
canvasCtx.fillRect(cursorX, prevY1, cursorW, prevY2 - prevY1);
}
prevY1 = y1;
prevY2 = y2;
}
else {
// merge into prev
if (y2 > prevY2) {
prevY2 = y2;
}
}
}
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();
}
};
return DecorationsOverviewRuler;
}(ViewPart));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/overviewZoneManager.js
var overviewZoneManager = __webpack_require__(167);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var overviewRuler_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var overviewRuler_OverviewRuler = /** @class */ (function (_super) {
overviewRuler_extends(OverviewRuler, _super);
function OverviewRuler(context, cssClassName) {
var _this = _super.call(this) || this;
_this._context = context;
var options = _this._context.configuration.options;
_this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('canvas'));
_this._domNode.setClassName(cssClassName);
_this._domNode.setPosition('absolute');
_this._domNode.setLayerHinting(true);
_this._domNode.setContain('strict');
_this._zoneManager = new overviewZoneManager["b" /* OverviewZoneManager */](function (lineNumber) { return _this._context.viewLayout.getVerticalOffsetForLineNumber(lineNumber); });
_this._zoneManager.setDOMWidth(0);
_this._zoneManager.setDOMHeight(0);
_this._zoneManager.setOuterHeight(_this._context.viewLayout.getScrollHeight());
_this._zoneManager.setLineHeight(options.get(49 /* lineHeight */));
_this._zoneManager.setPixelRatio(options.get(105 /* pixelRatio */));
_this._context.addEventHandler(_this);
return _this;
}
OverviewRuler.prototype.dispose = function () {
this._context.removeEventHandler(this);
_super.prototype.dispose.call(this);
};
// ---- begin view event handlers
OverviewRuler.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
if (e.hasChanged(49 /* lineHeight */)) {
this._zoneManager.setLineHeight(options.get(49 /* lineHeight */));
this._render();
}
if (e.hasChanged(105 /* pixelRatio */)) {
this._zoneManager.setPixelRatio(options.get(105 /* 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;
};
OverviewRuler.prototype.onFlushed = function (e) {
this._render();
return true;
};
OverviewRuler.prototype.onScrollChanged = function (e) {
if (e.scrollHeightChanged) {
this._zoneManager.setOuterHeight(e.scrollHeight);
this._render();
}
return true;
};
OverviewRuler.prototype.onZonesChanged = function (e) {
this._render();
return true;
};
// ---- end view event handlers
OverviewRuler.prototype.getDomNode = function () {
return this._domNode.domNode;
};
OverviewRuler.prototype.setLayout = function (position) {
this._domNode.setTop(position.top);
this._domNode.setRight(position.right);
var 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();
}
};
OverviewRuler.prototype.setZones = function (zones) {
this._zoneManager.setZones(zones);
this._render();
};
OverviewRuler.prototype._render = function () {
if (this._zoneManager.getOuterHeight() === 0) {
return false;
}
var width = this._zoneManager.getCanvasWidth();
var height = this._zoneManager.getCanvasHeight();
var colorZones = this._zoneManager.resolveColorZones();
var id2Color = this._zoneManager.getId2Color();
var ctx = this._domNode.domNode.getContext('2d');
ctx.clearRect(0, 0, width, height);
if (colorZones.length > 0) {
this._renderOneLane(ctx, colorZones, id2Color, width);
}
return true;
};
OverviewRuler.prototype._renderOneLane = function (ctx, colorZones, id2Color, width) {
var currentColorId = 0;
var currentFrom = 0;
var currentTo = 0;
for (var _i = 0, colorZones_1 = colorZones; _i < colorZones_1.length; _i++) {
var zone = colorZones_1[_i];
var zoneColorId = zone.colorId;
var zoneFrom = zone.from;
var zoneTo = zone.to;
if (zoneColorId !== currentColorId) {
ctx.fillRect(0, currentFrom, width, 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, width, currentTo - currentFrom);
currentFrom = zoneFrom;
currentTo = zoneTo;
}
}
}
ctx.fillRect(0, currentFrom, width, currentTo - currentFrom);
};
return OverviewRuler;
}(ViewEventHandler));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.css
var rulers_rulers = __webpack_require__(635);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/rulers/rulers.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var rulers_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var rulers_Rulers = /** @class */ (function (_super) {
rulers_extends(Rulers, _super);
function Rulers(context) {
var _this = _super.call(this, context) || this;
_this.domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this.domNode.setAttribute('role', 'presentation');
_this.domNode.setAttribute('aria-hidden', 'true');
_this.domNode.setClassName('view-rulers');
_this._renderedRulers = [];
var options = _this._context.configuration.options;
_this._rulers = options.get(77 /* rulers */);
_this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
return _this;
}
Rulers.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
// --- begin event handlers
Rulers.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
this._rulers = options.get(77 /* rulers */);
this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
return true;
};
Rulers.prototype.onScrollChanged = function (e) {
return e.scrollHeightChanged;
};
// --- end event handlers
Rulers.prototype.prepareRender = function (ctx) {
// Nothing to read
};
Rulers.prototype._ensureRulersCount = function () {
var currentCount = this._renderedRulers.length;
var desiredCount = this._rulers.length;
if (currentCount === desiredCount) {
// Nothing to do
return;
}
if (currentCount < desiredCount) {
var tabSize = this._context.model.getOptions().tabSize;
var rulerWidth = tabSize;
var addCount = desiredCount - currentCount;
while (addCount > 0) {
var node = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
node.setClassName('view-ruler');
node.setWidth(rulerWidth);
this.domNode.appendChild(node);
this._renderedRulers.push(node);
addCount--;
}
return;
}
var removeCount = currentCount - desiredCount;
while (removeCount > 0) {
var node = this._renderedRulers.pop();
this.domNode.removeChild(node);
removeCount--;
}
};
Rulers.prototype.render = function (ctx) {
this._ensureRulersCount();
for (var i = 0, len = this._rulers.length; i < len; i++) {
var node = this._renderedRulers[i];
node.setHeight(Math.min(ctx.scrollHeight, 1000000));
node.setLeft(this._rulers[i] * this._typicalHalfwidthCharacterWidth);
}
};
return Rulers;
}(ViewPart));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var rulerColor = theme.getColor(editorColorRegistry["m" /* editorRuler */]);
if (rulerColor) {
collector.addRule(".monaco-editor .view-ruler { box-shadow: 1px 0 0 0 " + rulerColor + " inset; }");
}
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.css
var scrollDecoration_scrollDecoration = __webpack_require__(636);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var scrollDecoration_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var scrollDecoration_ScrollDecorationViewPart = /** @class */ (function (_super) {
scrollDecoration_extends(ScrollDecorationViewPart, _super);
function ScrollDecorationViewPart(context) {
var _this = _super.call(this, context) || this;
_this._scrollTop = 0;
_this._width = 0;
_this._updateWidth();
_this._shouldShow = false;
var options = _this._context.configuration.options;
var scrollbar = options.get(78 /* scrollbar */);
_this._useShadows = scrollbar.useShadows;
_this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this._domNode.setAttribute('role', 'presentation');
_this._domNode.setAttribute('aria-hidden', 'true');
return _this;
}
ScrollDecorationViewPart.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
ScrollDecorationViewPart.prototype._updateShouldShow = function () {
var newShouldShow = (this._useShadows && this._scrollTop > 0);
if (this._shouldShow !== newShouldShow) {
this._shouldShow = newShouldShow;
return true;
}
return false;
};
ScrollDecorationViewPart.prototype.getDomNode = function () {
return this._domNode;
};
ScrollDecorationViewPart.prototype._updateWidth = function () {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
if (layoutInfo.renderMinimap === 0 || (layoutInfo.minimapWidth > 0 && layoutInfo.minimapLeft === 0)) {
this._width = layoutInfo.width;
}
else {
this._width = layoutInfo.width - layoutInfo.minimapWidth - layoutInfo.verticalScrollbarWidth;
}
};
// --- begin event handlers
ScrollDecorationViewPart.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var scrollbar = options.get(78 /* scrollbar */);
this._useShadows = scrollbar.useShadows;
this._updateWidth();
this._updateShouldShow();
return true;
};
ScrollDecorationViewPart.prototype.onScrollChanged = function (e) {
this._scrollTop = e.scrollTop;
return this._updateShouldShow();
};
// --- end event handlers
ScrollDecorationViewPart.prototype.prepareRender = function (ctx) {
// Nothing to read
};
ScrollDecorationViewPart.prototype.render = function (ctx) {
this._domNode.setWidth(this._width);
this._domNode.setClassName(this._shouldShow ? 'scroll-decoration' : '');
};
return ScrollDecorationViewPart;
}(ViewPart));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var shadow = theme.getColor(colorRegistry["Vb" /* scrollbarShadow */]);
if (shadow) {
collector.addRule(".monaco-editor .scroll-decoration { box-shadow: " + shadow + " 0 6px 6px -6px inset; }");
}
});
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.css
var selections_selections = __webpack_require__(637);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/selections/selections.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var selections_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var HorizontalRangeWithStyle = /** @class */ (function () {
function HorizontalRangeWithStyle(other) {
this.left = other.left;
this.width = other.width;
this.startStyle = null;
this.endStyle = null;
}
return HorizontalRangeWithStyle;
}());
var LineVisibleRangesWithStyle = /** @class */ (function () {
function LineVisibleRangesWithStyle(lineNumber, ranges) {
this.lineNumber = lineNumber;
this.ranges = ranges;
}
return LineVisibleRangesWithStyle;
}());
function toStyledRange(item) {
return new HorizontalRangeWithStyle(item);
}
function toStyled(item) {
return new LineVisibleRangesWithStyle(item.lineNumber, item.ranges.map(toStyledRange));
}
// TODO@Alex: Remove this once IE11 fixes Bug #524217
// The problem in IE11 is that it does some sort of auto-zooming to accomodate for displays with different pixel density.
// Unfortunately, this auto-zooming is buggy around dealing with rounded borders
var isIEWithZoomingIssuesNearRoundedBorders = browser["f" /* isEdgeOrIE */];
var SelectionsOverlay = /** @class */ (function (_super) {
selections_extends(SelectionsOverlay, _super);
function SelectionsOverlay(context) {
var _this = _super.call(this) || this;
_this._previousFrameVisibleRangesWithStyle = [];
_this._context = context;
var options = _this._context.configuration.options;
_this._lineHeight = options.get(49 /* lineHeight */);
_this._roundedSelection = options.get(76 /* roundedSelection */);
_this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
_this._selections = [];
_this._renderResult = null;
_this._context.addEventHandler(_this);
return _this;
}
SelectionsOverlay.prototype.dispose = function () {
this._context.removeEventHandler(this);
this._renderResult = null;
_super.prototype.dispose.call(this);
};
// --- begin event handlers
SelectionsOverlay.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
this._lineHeight = options.get(49 /* lineHeight */);
this._roundedSelection = options.get(76 /* roundedSelection */);
this._typicalHalfwidthCharacterWidth = options.get(34 /* fontInfo */).typicalHalfwidthCharacterWidth;
return true;
};
SelectionsOverlay.prototype.onCursorStateChanged = function (e) {
this._selections = e.selections.slice(0);
return true;
};
SelectionsOverlay.prototype.onDecorationsChanged = function (e) {
// true for inline decorations that can end up relayouting text
return true; //e.inlineDecorationsChanged;
};
SelectionsOverlay.prototype.onFlushed = function (e) {
return true;
};
SelectionsOverlay.prototype.onLinesChanged = function (e) {
return true;
};
SelectionsOverlay.prototype.onLinesDeleted = function (e) {
return true;
};
SelectionsOverlay.prototype.onLinesInserted = function (e) {
return true;
};
SelectionsOverlay.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged;
};
SelectionsOverlay.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
SelectionsOverlay.prototype._visibleRangesHaveGaps = function (linesVisibleRanges) {
for (var i = 0, len = linesVisibleRanges.length; i < len; i++) {
var lineVisibleRanges = linesVisibleRanges[i];
if (lineVisibleRanges.ranges.length > 1) {
// There are two ranges on the same line
return true;
}
}
return false;
};
SelectionsOverlay.prototype._enrichVisibleRangesWithStyle = function (viewport, linesVisibleRanges, previousFrame) {
var epsilon = this._typicalHalfwidthCharacterWidth / 4;
var previousFrameTop = null;
var previousFrameBottom = null;
if (previousFrame && previousFrame.length > 0 && linesVisibleRanges.length > 0) {
var topLineNumber = linesVisibleRanges[0].lineNumber;
if (topLineNumber === viewport.startLineNumber) {
for (var i = 0; !previousFrameTop && i < previousFrame.length; i++) {
if (previousFrame[i].lineNumber === topLineNumber) {
previousFrameTop = previousFrame[i].ranges[0];
}
}
}
var bottomLineNumber = linesVisibleRanges[linesVisibleRanges.length - 1].lineNumber;
if (bottomLineNumber === viewport.endLineNumber) {
for (var 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 (var i = 0, len = linesVisibleRanges.length; i < len; i++) {
// We know for a fact that there is precisely one range on each line
var curLineRange = linesVisibleRanges[i].ranges[0];
var curLeft = curLineRange.left;
var curRight = curLineRange.left + curLineRange.width;
var startStyle = {
top: 0 /* EXTERN */,
bottom: 0 /* EXTERN */
};
var endStyle = {
top: 0 /* EXTERN */,
bottom: 0 /* EXTERN */
};
if (i > 0) {
// Look above
var prevLeft = linesVisibleRanges[i - 1].ranges[0].left;
var prevRight = linesVisibleRanges[i - 1].ranges[0].left + linesVisibleRanges[i - 1].ranges[0].width;
if (abs(curLeft - prevLeft) < epsilon) {
startStyle.top = 2 /* FLAT */;
}
else if (curLeft > prevLeft) {
startStyle.top = 1 /* INTERN */;
}
if (abs(curRight - prevRight) < epsilon) {
endStyle.top = 2 /* FLAT */;
}
else if (prevLeft < curRight && curRight < prevRight) {
endStyle.top = 1 /* INTERN */;
}
}
else if (previousFrameTop) {
// Accept some hick-ups near the viewport edges to save on repaints
startStyle.top = previousFrameTop.startStyle.top;
endStyle.top = previousFrameTop.endStyle.top;
}
if (i + 1 < len) {
// Look below
var nextLeft = linesVisibleRanges[i + 1].ranges[0].left;
var nextRight = linesVisibleRanges[i + 1].ranges[0].left + linesVisibleRanges[i + 1].ranges[0].width;
if (abs(curLeft - nextLeft) < epsilon) {
startStyle.bottom = 2 /* FLAT */;
}
else if (nextLeft < curLeft && curLeft < nextRight) {
startStyle.bottom = 1 /* INTERN */;
}
if (abs(curRight - nextRight) < epsilon) {
endStyle.bottom = 2 /* FLAT */;
}
else if (curRight < nextRight) {
endStyle.bottom = 1 /* INTERN */;
}
}
else if (previousFrameBottom) {
// Accept some hick-ups near the viewport edges to save on repaints
startStyle.bottom = previousFrameBottom.startStyle.bottom;
endStyle.bottom = previousFrameBottom.endStyle.bottom;
}
curLineRange.startStyle = startStyle;
curLineRange.endStyle = endStyle;
}
};
SelectionsOverlay.prototype._getVisibleRangesWithStyle = function (selection, ctx, previousFrame) {
var _linesVisibleRanges = ctx.linesVisibleRangesForRange(selection, true) || [];
var linesVisibleRanges = _linesVisibleRanges.map(toStyled);
var visibleRangesHaveGaps = this._visibleRangesHaveGaps(linesVisibleRanges);
if (!isIEWithZoomingIssuesNearRoundedBorders && !visibleRangesHaveGaps && this._roundedSelection) {
this._enrichVisibleRangesWithStyle(ctx.visibleRange, linesVisibleRanges, previousFrame);
}
// The visible ranges are sorted TOP-BOTTOM and LEFT-RIGHT
return linesVisibleRanges;
};
SelectionsOverlay.prototype._createSelectionPiece = function (top, height, className, left, width) {
return ('');
};
SelectionsOverlay.prototype._actualRenderOneSelection = function (output2, visibleStartLineNumber, hasMultipleSelections, visibleRanges) {
if (visibleRanges.length === 0) {
return;
}
var visibleRangesHaveStyle = !!visibleRanges[0].ranges[0].startStyle;
var fullLineHeight = (this._lineHeight).toString();
var reducedLineHeight = (this._lineHeight - 1).toString();
var firstLineNumber = visibleRanges[0].lineNumber;
var lastLineNumber = visibleRanges[visibleRanges.length - 1].lineNumber;
for (var i = 0, len = visibleRanges.length; i < len; i++) {
var lineVisibleRanges = visibleRanges[i];
var lineNumber = lineVisibleRanges.lineNumber;
var lineIndex = lineNumber - visibleStartLineNumber;
var lineHeight = hasMultipleSelections ? (lineNumber === lastLineNumber || lineNumber === firstLineNumber ? reducedLineHeight : fullLineHeight) : fullLineHeight;
var top_1 = hasMultipleSelections ? (lineNumber === firstLineNumber ? 1 : 0) : 0;
var innerCornerOutput = '';
var restOfSelectionOutput = '';
for (var j = 0, lenJ = lineVisibleRanges.ranges.length; j < lenJ; j++) {
var visibleRange = lineVisibleRanges.ranges[j];
if (visibleRangesHaveStyle) {
var startStyle = visibleRange.startStyle;
var endStyle = visibleRange.endStyle;
if (startStyle.top === 1 /* INTERN */ || startStyle.bottom === 1 /* INTERN */) {
// Reverse rounded corner to the left
// First comes the selection (blue layer)
innerCornerOutput += this._createSelectionPiece(top_1, lineHeight, SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left - SelectionsOverlay.ROUNDED_PIECE_WIDTH, SelectionsOverlay.ROUNDED_PIECE_WIDTH);
// Second comes the background (white layer) with inverse border radius
var className_1 = SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME;
if (startStyle.top === 1 /* INTERN */) {
className_1 += ' ' + SelectionsOverlay.SELECTION_TOP_RIGHT;
}
if (startStyle.bottom === 1 /* INTERN */) {
className_1 += ' ' + SelectionsOverlay.SELECTION_BOTTOM_RIGHT;
}
innerCornerOutput += this._createSelectionPiece(top_1, lineHeight, className_1, visibleRange.left - SelectionsOverlay.ROUNDED_PIECE_WIDTH, SelectionsOverlay.ROUNDED_PIECE_WIDTH);
}
if (endStyle.top === 1 /* INTERN */ || endStyle.bottom === 1 /* INTERN */) {
// Reverse rounded corner to the right
// First comes the selection (blue layer)
innerCornerOutput += this._createSelectionPiece(top_1, lineHeight, SelectionsOverlay.SELECTION_CLASS_NAME, visibleRange.left + visibleRange.width, SelectionsOverlay.ROUNDED_PIECE_WIDTH);
// Second comes the background (white layer) with inverse border radius
var className_2 = SelectionsOverlay.EDITOR_BACKGROUND_CLASS_NAME;
if (endStyle.top === 1 /* INTERN */) {
className_2 += ' ' + SelectionsOverlay.SELECTION_TOP_LEFT;
}
if (endStyle.bottom === 1 /* INTERN */) {
className_2 += ' ' + SelectionsOverlay.SELECTION_BOTTOM_LEFT;
}
innerCornerOutput += this._createSelectionPiece(top_1, lineHeight, className_2, visibleRange.left + visibleRange.width, SelectionsOverlay.ROUNDED_PIECE_WIDTH);
}
}
var className = SelectionsOverlay.SELECTION_CLASS_NAME;
if (visibleRangesHaveStyle) {
var startStyle = visibleRange.startStyle;
var endStyle = visibleRange.endStyle;
if (startStyle.top === 0 /* EXTERN */) {
className += ' ' + SelectionsOverlay.SELECTION_TOP_LEFT;
}
if (startStyle.bottom === 0 /* EXTERN */) {
className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_LEFT;
}
if (endStyle.top === 0 /* EXTERN */) {
className += ' ' + SelectionsOverlay.SELECTION_TOP_RIGHT;
}
if (endStyle.bottom === 0 /* EXTERN */) {
className += ' ' + SelectionsOverlay.SELECTION_BOTTOM_RIGHT;
}
}
restOfSelectionOutput += this._createSelectionPiece(top_1, lineHeight, className, visibleRange.left, visibleRange.width);
}
output2[lineIndex][0] += innerCornerOutput;
output2[lineIndex][1] += restOfSelectionOutput;
}
};
SelectionsOverlay.prototype.prepareRender = function (ctx) {
// Build HTML for inner corners separate from HTML for the rest of selections,
// as the inner corner HTML can interfere with that of other selections.
// In final render, make sure to place the inner corner HTML before the rest of selection HTML. See issue #77777.
var output = [];
var visibleStartLineNumber = ctx.visibleRange.startLineNumber;
var visibleEndLineNumber = ctx.visibleRange.endLineNumber;
for (var lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
var lineIndex = lineNumber - visibleStartLineNumber;
output[lineIndex] = ['', ''];
}
var thisFrameVisibleRangesWithStyle = [];
for (var i = 0, len = this._selections.length; i < len; i++) {
var selection = this._selections[i];
if (selection.isEmpty()) {
thisFrameVisibleRangesWithStyle[i] = null;
continue;
}
var 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(function (_a) {
var internalCorners = _a[0], restOfSelection = _a[1];
return internalCorners + restOfSelection;
});
};
SelectionsOverlay.prototype.render = function (startLineNumber, lineNumber) {
if (!this._renderResult) {
return '';
}
var 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;
return SelectionsOverlay;
}(DynamicViewOverlay));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var editorSelectionColor = theme.getColor(colorRegistry["K" /* editorSelectionBackground */]);
if (editorSelectionColor) {
collector.addRule(".monaco-editor .focused .selected-text { background-color: " + editorSelectionColor + "; }");
}
var editorInactiveSelectionColor = theme.getColor(colorRegistry["F" /* editorInactiveSelection */]);
if (editorInactiveSelectionColor) {
collector.addRule(".monaco-editor .selected-text { background-color: " + editorInactiveSelectionColor + "; }");
}
var editorSelectionForegroundColor = theme.getColor(colorRegistry["L" /* editorSelectionForeground */]);
if (editorSelectionForegroundColor) {
collector.addRule(".monaco-editor .view-line span.inline-selected-text { color: " + editorSelectionForegroundColor + "; }");
}
});
function abs(n) {
return n < 0 ? -n : n;
}
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.css
var viewCursors = __webpack_require__(638);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ViewCursorRenderData = /** @class */ (function () {
function ViewCursorRenderData(top, left, width, height, textContent, textContentClassName) {
this.top = top;
this.left = left;
this.width = width;
this.height = height;
this.textContent = textContent;
this.textContentClassName = textContentClassName;
}
return ViewCursorRenderData;
}());
var viewCursor_ViewCursor = /** @class */ (function () {
function ViewCursor(context) {
this._context = context;
var options = this._context.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
this._cursorStyle = options.get(18 /* cursorStyle */);
this._lineHeight = options.get(49 /* lineHeight */);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._lineCursorWidth = Math.min(options.get(21 /* cursorWidth */), this._typicalHalfwidthCharacterWidth);
this._isVisible = true;
// Create the dom node
this._domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
this._domNode.setClassName('cursor');
this._domNode.setHeight(this._lineHeight);
this._domNode.setTop(0);
this._domNode.setLeft(0);
config_configuration["a" /* Configuration */].applyFontInfo(this._domNode, fontInfo);
this._domNode.setDisplay('none');
this._position = new core_position["a" /* Position */](1, 1);
this._lastRenderedContent = '';
this._renderData = null;
}
ViewCursor.prototype.getDomNode = function () {
return this._domNode;
};
ViewCursor.prototype.getPosition = function () {
return this._position;
};
ViewCursor.prototype.show = function () {
if (!this._isVisible) {
this._domNode.setVisibility('inherit');
this._isVisible = true;
}
};
ViewCursor.prototype.hide = function () {
if (this._isVisible) {
this._domNode.setVisibility('hidden');
this._isVisible = false;
}
};
ViewCursor.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
this._cursorStyle = options.get(18 /* cursorStyle */);
this._lineHeight = options.get(49 /* lineHeight */);
this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;
this._lineCursorWidth = Math.min(options.get(21 /* cursorWidth */), this._typicalHalfwidthCharacterWidth);
config_configuration["a" /* Configuration */].applyFontInfo(this._domNode, fontInfo);
return true;
};
ViewCursor.prototype.onCursorPositionChanged = function (position) {
this._position = position;
return true;
};
ViewCursor.prototype._prepareRender = function (ctx) {
var textContent = '';
if (this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].Line || this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].LineThin) {
var visibleRange = ctx.visibleRangeForPosition(this._position);
if (!visibleRange || visibleRange.outsideRenderedLine) {
// Outside viewport
return null;
}
var width_1;
if (this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].Line) {
width_1 = dom["u" /* computeScreenAwareSize */](this._lineCursorWidth > 0 ? this._lineCursorWidth : 2);
if (width_1 > 2) {
var lineContent_1 = this._context.model.getLineContent(this._position.lineNumber);
var nextCharLength_1 = strings["E" /* nextCharLength */](lineContent_1, this._position.column - 1);
textContent = lineContent_1.substr(this._position.column - 1, nextCharLength_1);
}
}
else {
width_1 = dom["u" /* computeScreenAwareSize */](1);
}
var left = visibleRange.left;
if (width_1 >= 2 && left >= 1) {
// try to center cursor
left -= 1;
}
var top_1 = ctx.getVerticalOffsetForLineNumber(this._position.lineNumber) - ctx.bigNumbersDelta;
return new ViewCursorRenderData(top_1, left, width_1, this._lineHeight, textContent, '');
}
var lineContent = this._context.model.getLineContent(this._position.lineNumber);
var nextCharLength = strings["E" /* nextCharLength */](lineContent, this._position.column - 1);
var visibleRangeForCharacter = ctx.linesVisibleRangesForRange(new core_range["a" /* Range */](this._position.lineNumber, this._position.column, this._position.lineNumber, this._position.column + nextCharLength), false);
if (!visibleRangeForCharacter || visibleRangeForCharacter.length === 0) {
// Outside viewport
return null;
}
var firstVisibleRangeForCharacter = visibleRangeForCharacter[0];
if (firstVisibleRangeForCharacter.outsideRenderedLine || firstVisibleRangeForCharacter.ranges.length === 0) {
// Outside viewport
return null;
}
var range = firstVisibleRangeForCharacter.ranges[0];
var width = range.width < 1 ? this._typicalHalfwidthCharacterWidth : range.width;
var textContentClassName = '';
if (this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].Block) {
var lineData = this._context.model.getViewLineData(this._position.lineNumber);
textContent = lineContent.substr(this._position.column - 1, nextCharLength);
var tokenIndex = lineData.tokens.findTokenIndexAtOffset(this._position.column - 1);
textContentClassName = lineData.tokens.getClassName(tokenIndex);
}
var top = ctx.getVerticalOffsetForLineNumber(this._position.lineNumber) - ctx.bigNumbersDelta;
var height = this._lineHeight;
// Underline might interfere with clicking
if (this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].Underline || this._cursorStyle === editorOptions["g" /* TextEditorCursorStyle */].UnderlineThin) {
top += this._lineHeight - 2;
height = 2;
}
return new ViewCursorRenderData(top, range.left, width, height, textContent, textContentClassName);
};
ViewCursor.prototype.prepareRender = function (ctx) {
this._renderData = this._prepareRender(ctx);
};
ViewCursor.prototype.render = function (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._renderData.textContentClassName);
this._domNode.setDisplay('block');
this._domNode.setTop(this._renderData.top);
this._domNode.setLeft(this._renderData.left);
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
};
};
return ViewCursor;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewCursors_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var viewCursors_ViewCursors = /** @class */ (function (_super) {
viewCursors_extends(ViewCursors, _super);
function ViewCursors(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
_this._readOnly = options.get(68 /* readOnly */);
_this._cursorBlinking = options.get(16 /* cursorBlinking */);
_this._cursorStyle = options.get(18 /* cursorStyle */);
_this._cursorSmoothCaretAnimation = options.get(17 /* cursorSmoothCaretAnimation */);
_this._selectionIsEmpty = true;
_this._isVisible = false;
_this._primaryCursor = new viewCursor_ViewCursor(_this._context);
_this._secondaryCursors = [];
_this._renderData = [];
_this._domNode = Object(fastDomNode["b" /* 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 common_async["e" /* TimeoutTimer */]();
_this._cursorFlatBlinkInterval = new common_async["c" /* IntervalTimer */]();
_this._blinkingEnabled = false;
_this._editorHasFocus = false;
_this._updateBlinking();
return _this;
}
ViewCursors.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._startCursorBlinkAnimation.dispose();
this._cursorFlatBlinkInterval.dispose();
};
ViewCursors.prototype.getDomNode = function () {
return this._domNode;
};
// --- begin event handlers
ViewCursors.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
this._readOnly = options.get(68 /* readOnly */);
this._cursorBlinking = options.get(16 /* cursorBlinking */);
this._cursorStyle = options.get(18 /* cursorStyle */);
this._cursorSmoothCaretAnimation = options.get(17 /* cursorSmoothCaretAnimation */);
this._updateBlinking();
this._updateDomClassName();
this._primaryCursor.onConfigurationChanged(e);
for (var i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].onConfigurationChanged(e);
}
return true;
};
ViewCursors.prototype._onCursorPositionChanged = function (position, secondaryPositions) {
this._primaryCursor.onCursorPositionChanged(position);
this._updateBlinking();
if (this._secondaryCursors.length < secondaryPositions.length) {
// Create new cursors
var addCnt = secondaryPositions.length - this._secondaryCursors.length;
for (var i = 0; i < addCnt; i++) {
var newCursor = new viewCursor_ViewCursor(this._context);
this._domNode.domNode.insertBefore(newCursor.getDomNode().domNode, this._primaryCursor.getDomNode().domNode.nextSibling);
this._secondaryCursors.push(newCursor);
}
}
else if (this._secondaryCursors.length > secondaryPositions.length) {
// Remove some cursors
var removeCnt = this._secondaryCursors.length - secondaryPositions.length;
for (var i = 0; i < removeCnt; i++) {
this._domNode.removeChild(this._secondaryCursors[0].getDomNode());
this._secondaryCursors.splice(0, 1);
}
}
for (var i = 0; i < secondaryPositions.length; i++) {
this._secondaryCursors[i].onCursorPositionChanged(secondaryPositions[i]);
}
};
ViewCursors.prototype.onCursorStateChanged = function (e) {
var positions = [];
for (var i = 0, len = e.selections.length; i < len; i++) {
positions[i] = e.selections[i].getPosition();
}
this._onCursorPositionChanged(positions[0], positions.slice(1));
var selectionIsEmpty = e.selections[0].isEmpty();
if (this._selectionIsEmpty !== selectionIsEmpty) {
this._selectionIsEmpty = selectionIsEmpty;
this._updateDomClassName();
}
return true;
};
ViewCursors.prototype.onDecorationsChanged = function (e) {
// true for inline decorations that can end up relayouting text
return true;
};
ViewCursors.prototype.onFlushed = function (e) {
return true;
};
ViewCursors.prototype.onFocusChanged = function (e) {
this._editorHasFocus = e.isFocused;
this._updateBlinking();
return false;
};
ViewCursors.prototype.onLinesChanged = function (e) {
return true;
};
ViewCursors.prototype.onLinesDeleted = function (e) {
return true;
};
ViewCursors.prototype.onLinesInserted = function (e) {
return true;
};
ViewCursors.prototype.onScrollChanged = function (e) {
return true;
};
ViewCursors.prototype.onTokensChanged = function (e) {
var shouldRender = function (position) {
for (var 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 (var _i = 0, _a = this._secondaryCursors; _i < _a.length; _i++) {
var secondaryCursor = _a[_i];
if (shouldRender(secondaryCursor.getPosition())) {
return true;
}
}
return false;
};
ViewCursors.prototype.onZonesChanged = function (e) {
return true;
};
// --- end event handlers
// ---- blinking logic
ViewCursors.prototype._getCursorBlinking = function () {
if (!this._editorHasFocus) {
return 0 /* Hidden */;
}
if (this._readOnly) {
return 5 /* Solid */;
}
return this._cursorBlinking;
};
ViewCursors.prototype._updateBlinking = function () {
var _this = this;
this._startCursorBlinkAnimation.cancel();
this._cursorFlatBlinkInterval.cancel();
var blinkingStyle = this._getCursorBlinking();
// hidden and solid are special as they involve no animations
var isHidden = (blinkingStyle === 0 /* Hidden */);
var isSolid = (blinkingStyle === 5 /* Solid */);
if (isHidden) {
this._hide();
}
else {
this._show();
}
this._blinkingEnabled = false;
this._updateDomClassName();
if (!isHidden && !isSolid) {
if (blinkingStyle === 1 /* Blink */) {
// flat blinking is handled by JavaScript to save battery life due to Chromium step timing issue https://bugs.chromium.org/p/chromium/issues/detail?id=361587
this._cursorFlatBlinkInterval.cancelAndSet(function () {
if (_this._isVisible) {
_this._hide();
}
else {
_this._show();
}
}, ViewCursors.BLINK_INTERVAL);
}
else {
this._startCursorBlinkAnimation.setIfNotSet(function () {
_this._blinkingEnabled = true;
_this._updateDomClassName();
}, ViewCursors.BLINK_INTERVAL);
}
}
};
// --- end blinking logic
ViewCursors.prototype._updateDomClassName = function () {
this._domNode.setClassName(this._getClassName());
};
ViewCursors.prototype._getClassName = function () {
var result = 'cursors-layer';
if (!this._selectionIsEmpty) {
result += ' has-selection';
}
switch (this._cursorStyle) {
case editorOptions["g" /* TextEditorCursorStyle */].Line:
result += ' cursor-line-style';
break;
case editorOptions["g" /* TextEditorCursorStyle */].Block:
result += ' cursor-block-style';
break;
case editorOptions["g" /* TextEditorCursorStyle */].Underline:
result += ' cursor-underline-style';
break;
case editorOptions["g" /* TextEditorCursorStyle */].LineThin:
result += ' cursor-line-thin-style';
break;
case editorOptions["g" /* TextEditorCursorStyle */].BlockOutline:
result += ' cursor-block-outline-style';
break;
case editorOptions["g" /* TextEditorCursorStyle */].UnderlineThin:
result += ' cursor-underline-thin-style';
break;
default:
result += ' cursor-line-style';
}
if (this._blinkingEnabled) {
switch (this._getCursorBlinking()) {
case 1 /* Blink */:
result += ' cursor-blink';
break;
case 2 /* Smooth */:
result += ' cursor-smooth';
break;
case 3 /* Phase */:
result += ' cursor-phase';
break;
case 4 /* Expand */:
result += ' cursor-expand';
break;
case 5 /* Solid */:
result += ' cursor-solid';
break;
default:
result += ' cursor-solid';
}
}
else {
result += ' cursor-solid';
}
if (this._cursorSmoothCaretAnimation) {
result += ' cursor-smooth-caret-animation';
}
return result;
};
ViewCursors.prototype._show = function () {
this._primaryCursor.show();
for (var i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].show();
}
this._isVisible = true;
};
ViewCursors.prototype._hide = function () {
this._primaryCursor.hide();
for (var i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].hide();
}
this._isVisible = false;
};
// ---- IViewPart implementation
ViewCursors.prototype.prepareRender = function (ctx) {
this._primaryCursor.prepareRender(ctx);
for (var i = 0, len = this._secondaryCursors.length; i < len; i++) {
this._secondaryCursors[i].prepareRender(ctx);
}
};
ViewCursors.prototype.render = function (ctx) {
var renderData = [], renderDataLen = 0;
var primaryRenderData = this._primaryCursor.render(ctx);
if (primaryRenderData) {
renderData[renderDataLen++] = primaryRenderData;
}
for (var i = 0, len = this._secondaryCursors.length; i < len; i++) {
var secondaryRenderData = this._secondaryCursors[i].render(ctx);
if (secondaryRenderData) {
renderData[renderDataLen++] = secondaryRenderData;
}
}
this._renderData = renderData;
};
ViewCursors.prototype.getLastRenderData = function () {
return this._renderData;
};
ViewCursors.BLINK_INTERVAL = 500;
return ViewCursors;
}(ViewPart));
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var caret = theme.getColor(editorColorRegistry["g" /* editorCursorForeground */]);
if (caret) {
var caretBackground = theme.getColor(editorColorRegistry["f" /* editorCursorBackground */]);
if (!caretBackground) {
caretBackground = caret.opposite();
}
collector.addRule(".monaco-editor .cursor { background-color: " + caret + "; border-color: " + caret + "; color: " + caretBackground + "; }");
if (theme.type === 'hc') {
collector.addRule(".monaco-editor .cursors-layer.has-selection .cursor { border-left: 1px solid " + caretBackground + "; border-right: 1px solid " + caretBackground + "; }");
}
}
});
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/viewParts/viewZones/viewZones.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewZones_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var invalidFunc = function () { throw new Error("Invalid change accessor"); };
var viewZones_ViewZones = /** @class */ (function (_super) {
viewZones_extends(ViewZones, _super);
function ViewZones(context) {
var _this = _super.call(this, context) || this;
var options = _this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._lineHeight = options.get(49 /* lineHeight */);
_this._contentWidth = layoutInfo.contentWidth;
_this._contentLeft = layoutInfo.contentLeft;
_this.domNode = Object(fastDomNode["b" /* 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 = Object(fastDomNode["b" /* 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 = {};
return _this;
}
ViewZones.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this._zones = {};
};
// ---- begin view event handlers
ViewZones.prototype._recomputeWhitespacesProps = function () {
var _this = this;
var whitespaces = this._context.viewLayout.getWhitespaces();
var oldWhitespaces = new Map();
for (var _i = 0, whitespaces_1 = whitespaces; _i < whitespaces_1.length; _i++) {
var whitespace = whitespaces_1[_i];
oldWhitespaces.set(whitespace.id, whitespace);
}
return this._context.viewLayout.changeWhitespace(function (whitespaceAccessor) {
var hadAChange = false;
var keys = Object.keys(_this._zones);
for (var i = 0, len = keys.length; i < len; i++) {
var id = keys[i];
var zone = _this._zones[id];
var props = _this._computeWhitespaceProps(zone.delegate);
var 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;
});
};
ViewZones.prototype.onConfigurationChanged = function (e) {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this._lineHeight = options.get(49 /* lineHeight */);
this._contentWidth = layoutInfo.contentWidth;
this._contentLeft = layoutInfo.contentLeft;
if (e.hasChanged(49 /* lineHeight */)) {
this._recomputeWhitespacesProps();
}
return true;
};
ViewZones.prototype.onLineMappingChanged = function (e) {
var hadAChange = this._recomputeWhitespacesProps();
if (hadAChange) {
this._context.viewLayout.onHeightMaybeChanged();
}
return hadAChange;
};
ViewZones.prototype.onLinesDeleted = function (e) {
return true;
};
ViewZones.prototype.onScrollChanged = function (e) {
return e.scrollTopChanged || e.scrollWidthChanged;
};
ViewZones.prototype.onZonesChanged = function (e) {
return true;
};
ViewZones.prototype.onLinesInserted = function (e) {
return true;
};
// ---- end view event handlers
ViewZones.prototype._getZoneOrdinal = function (zone) {
if (typeof zone.afterColumn !== 'undefined') {
return zone.afterColumn;
}
return 10000;
};
ViewZones.prototype._computeWhitespaceProps = function (zone) {
if (zone.afterLineNumber === 0) {
return {
afterViewLineNumber: 0,
heightInPx: this._heightInPixels(zone),
minWidthInPx: this._minWidthInPixels(zone)
};
}
var zoneAfterModelPosition;
if (typeof zone.afterColumn !== 'undefined') {
zoneAfterModelPosition = this._context.model.validateModelPosition({
lineNumber: zone.afterLineNumber,
column: zone.afterColumn
});
}
else {
var validAfterLineNumber = this._context.model.validateModelPosition({
lineNumber: zone.afterLineNumber,
column: 1
}).lineNumber;
zoneAfterModelPosition = new core_position["a" /* Position */](validAfterLineNumber, this._context.model.getModelLineMaxColumn(validAfterLineNumber));
}
var zoneBeforeModelPosition;
if (zoneAfterModelPosition.column === this._context.model.getModelLineMaxColumn(zoneAfterModelPosition.lineNumber)) {
zoneBeforeModelPosition = this._context.model.validateModelPosition({
lineNumber: zoneAfterModelPosition.lineNumber + 1,
column: 1
});
}
else {
zoneBeforeModelPosition = this._context.model.validateModelPosition({
lineNumber: zoneAfterModelPosition.lineNumber,
column: zoneAfterModelPosition.column + 1
});
}
var viewPosition = this._context.model.coordinatesConverter.convertModelPositionToViewPosition(zoneAfterModelPosition);
var isVisible = this._context.model.coordinatesConverter.modelPositionIsVisible(zoneBeforeModelPosition);
return {
afterViewLineNumber: viewPosition.lineNumber,
heightInPx: (isVisible ? this._heightInPixels(zone) : 0),
minWidthInPx: this._minWidthInPixels(zone)
};
};
ViewZones.prototype.changeViewZones = function (callback) {
var _this = this;
return this._context.viewLayout.changeWhitespace(function (whitespaceAccessor) {
var zonesHaveChanged = false;
var changeAccessor = {
addZone: function (zone) {
zonesHaveChanged = true;
return _this._addZone(whitespaceAccessor, zone);
},
removeZone: function (id) {
if (!id) {
return;
}
zonesHaveChanged = _this._removeZone(whitespaceAccessor, id) || zonesHaveChanged;
},
layoutZone: function (id) {
if (!id) {
return;
}
zonesHaveChanged = _this._layoutZone(whitespaceAccessor, id) || zonesHaveChanged;
}
};
safeInvoke1Arg(callback, changeAccessor);
// Invalidate changeAccessor
changeAccessor.addZone = invalidFunc;
changeAccessor.removeZone = invalidFunc;
changeAccessor.layoutZone = invalidFunc;
return zonesHaveChanged;
});
};
ViewZones.prototype._addZone = function (whitespaceAccessor, zone) {
var props = this._computeWhitespaceProps(zone);
var whitespaceId = whitespaceAccessor.insertWhitespace(props.afterViewLineNumber, this._getZoneOrdinal(zone), props.heightInPx, props.minWidthInPx);
var myZone = {
whitespaceId: whitespaceId,
delegate: zone,
isVisible: false,
domNode: Object(fastDomNode["b" /* createFastDomNode */])(zone.domNode),
marginDomNode: zone.marginDomNode ? Object(fastDomNode["b" /* 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;
};
ViewZones.prototype._removeZone = function (whitespaceAccessor, id) {
if (this._zones.hasOwnProperty(id)) {
var 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;
};
ViewZones.prototype._layoutZone = function (whitespaceAccessor, id) {
if (this._zones.hasOwnProperty(id)) {
var zone = this._zones[id];
var props = this._computeWhitespaceProps(zone.delegate);
// const newOrdinal = this._getZoneOrdinal(zone.delegate);
whitespaceAccessor.changeOneWhitespace(zone.whitespaceId, props.afterViewLineNumber, props.heightInPx);
// TODO@Alex: change `newOrdinal` too
this._safeCallOnComputedHeight(zone.delegate, props.heightInPx);
this.setShouldRender();
return true;
}
return false;
};
ViewZones.prototype.shouldSuppressMouseDownOnViewZone = function (id) {
if (this._zones.hasOwnProperty(id)) {
var zone = this._zones[id];
return Boolean(zone.delegate.suppressMouseDown);
}
return false;
};
ViewZones.prototype._heightInPixels = function (zone) {
if (typeof zone.heightInPx === 'number') {
return zone.heightInPx;
}
if (typeof zone.heightInLines === 'number') {
return this._lineHeight * zone.heightInLines;
}
return this._lineHeight;
};
ViewZones.prototype._minWidthInPixels = function (zone) {
if (typeof zone.minWidthInPx === 'number') {
return zone.minWidthInPx;
}
return 0;
};
ViewZones.prototype._safeCallOnComputedHeight = function (zone, height) {
if (typeof zone.onComputedHeight === 'function') {
try {
zone.onComputedHeight(height);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
}
};
ViewZones.prototype._safeCallOnDomNodeTop = function (zone, top) {
if (typeof zone.onDomNodeTop === 'function') {
try {
zone.onDomNodeTop(top);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
}
};
ViewZones.prototype.prepareRender = function (ctx) {
// Nothing to read
};
ViewZones.prototype.render = function (ctx) {
var visibleWhitespaces = ctx.viewportData.whitespaceViewportData;
var visibleZones = {};
var hasVisibleZone = false;
for (var i = 0, len = visibleWhitespaces.length; i < len; i++) {
visibleZones[visibleWhitespaces[i].id] = visibleWhitespaces[i];
hasVisibleZone = true;
}
var keys = Object.keys(this._zones);
for (var i = 0, len = keys.length; i < len; i++) {
var id = keys[i];
var zone = this._zones[id];
var newTop = 0;
var newHeight = 0;
var newDisplay = 'none';
if (visibleZones.hasOwnProperty(id)) {
newTop = visibleZones[id].verticalOffset - ctx.bigNumbersDelta;
newHeight = visibleZones[id].height;
newDisplay = 'block';
// zone is visible
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(-1000000));
}
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);
}
};
return ViewZones;
}(ViewPart));
function safeInvoke1Arg(func, arg1) {
try {
return func(arg1);
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/viewContext.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ViewContext = /** @class */ (function () {
function ViewContext(configuration, theme, model, privateViewEventBus) {
this.configuration = configuration;
this.theme = theme;
this.model = model;
this.viewLayout = model.viewLayout;
this.privateViewEventBus = privateViewEventBus;
}
ViewContext.prototype.addEventHandler = function (eventHandler) {
this.privateViewEventBus.addEventHandler(eventHandler);
};
ViewContext.prototype.removeEventHandler = function (eventHandler) {
this.privateViewEventBus.removeEventHandler(eventHandler);
};
return ViewContext;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/view/viewEventDispatcher.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ViewEventDispatcher = /** @class */ (function () {
function ViewEventDispatcher(eventHandlerGateKeeper) {
this._eventHandlerGateKeeper = eventHandlerGateKeeper;
this._eventHandlers = [];
this._eventQueue = null;
this._isConsumingQueue = false;
}
ViewEventDispatcher.prototype.addEventHandler = function (eventHandler) {
for (var 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);
};
ViewEventDispatcher.prototype.removeEventHandler = function (eventHandler) {
for (var i = 0; i < this._eventHandlers.length; i++) {
if (this._eventHandlers[i] === eventHandler) {
this._eventHandlers.splice(i, 1);
break;
}
}
};
ViewEventDispatcher.prototype.emit = function (event) {
if (this._eventQueue) {
this._eventQueue.push(event);
}
else {
this._eventQueue = [event];
}
if (!this._isConsumingQueue) {
this.consumeQueue();
}
};
ViewEventDispatcher.prototype.emitMany = function (events) {
if (this._eventQueue) {
this._eventQueue = this._eventQueue.concat(events);
}
else {
this._eventQueue = events;
}
if (!this._isConsumingQueue) {
this.consumeQueue();
}
};
ViewEventDispatcher.prototype.consumeQueue = function () {
var _this = this;
this._eventHandlerGateKeeper(function () {
try {
_this._isConsumingQueue = true;
_this._doConsumeQueue();
}
finally {
_this._isConsumingQueue = false;
}
});
};
ViewEventDispatcher.prototype._doConsumeQueue = function () {
while (this._eventQueue) {
// Empty event queue, as events might come in while sending these off
var events = this._eventQueue;
this._eventQueue = null;
// Use a clone of the event handlers list, as they might remove themselves
var eventHandlers = this._eventHandlers.slice(0);
for (var i = 0, len = eventHandlers.length; i < len; i++) {
eventHandlers[i].handleEvents(events);
}
}
};
return ViewEventDispatcher;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLinesViewportData.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Contains all data needed to render at a specific viewport.
*/
var viewLinesViewportData_ViewportData = /** @class */ (function () {
function ViewportData(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.whitespaceViewportData = whitespaceViewportData;
this._model = model;
this.visibleRange = new core_range["a" /* Range */](partialData.startLineNumber, this._model.getLineMinColumn(partialData.startLineNumber), partialData.endLineNumber, this._model.getLineMaxColumn(partialData.endLineNumber));
}
ViewportData.prototype.getViewLineRenderingData = function (lineNumber) {
return this._model.getViewLineRenderingData(this.visibleRange, lineNumber);
};
ViewportData.prototype.getDecorationsInViewport = function () {
return this._model.getDecorationsInViewport(this.visibleRange);
};
return ViewportData;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/viewImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var viewImpl_View = /** @class */ (function (_super) {
viewImpl_extends(View, _super);
function View(commandDelegate, configuration, themeService, model, cursor, outgoingEvents) {
var _this = _super.call(this) || this;
_this._cursor = cursor;
_this._renderAnimationFrame = null;
_this.outgoingEvents = outgoingEvents;
var viewController = new viewController_ViewController(configuration, model, _this.outgoingEvents, commandDelegate);
// The event dispatcher will always go through _renderOnce before dispatching any events
_this.eventDispatcher = new ViewEventDispatcher(function (callback) { return _this._renderOnce(callback); });
// Ensure the view is the first event handler in order to update the layout
_this.eventDispatcher.addEventHandler(_this);
// The view context is passed on to most classes (basically to reduce param. counts in ctors)
_this._context = new ViewContext(configuration, themeService.getTheme(), model, _this.eventDispatcher);
_this._register(themeService.onThemeChange(function (theme) {
_this._context.theme = theme;
_this.eventDispatcher.emit(new ViewThemeChangedEvent());
_this.render(true, false);
}));
_this.viewParts = [];
// Keyboard handler
_this._textAreaHandler = new textAreaHandler_TextAreaHandler(_this._context, viewController, _this.createTextAreaHandlerHelper());
_this.viewParts.push(_this._textAreaHandler);
// These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)
_this.linesContent = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this.linesContent.setClassName('lines-content' + ' monaco-editor-background');
_this.linesContent.setPosition('absolute');
_this.domNode = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
_this.domNode.setClassName(_this.getEditorClassName());
_this.overflowGuardContainer = Object(fastDomNode["b" /* createFastDomNode */])(document.createElement('div'));
viewPart_PartFingerprints.write(_this.overflowGuardContainer, 3 /* OverflowGuard */);
_this.overflowGuardContainer.setClassName('overflow-guard');
_this._scrollbar = new editorScrollbar_EditorScrollbar(_this._context, _this.linesContent, _this.domNode, _this.overflowGuardContainer);
_this.viewParts.push(_this._scrollbar);
// View Lines
_this.viewLines = new viewLines_ViewLines(_this._context, _this.linesContent);
// View Zones
_this.viewZones = new viewZones_ViewZones(_this._context);
_this.viewParts.push(_this.viewZones);
// Decorations overview ruler
var decorationsOverviewRuler = new decorationsOverviewRuler_DecorationsOverviewRuler(_this._context);
_this.viewParts.push(decorationsOverviewRuler);
var scrollDecoration = new scrollDecoration_ScrollDecorationViewPart(_this._context);
_this.viewParts.push(scrollDecoration);
var contentViewOverlays = new ContentViewOverlays(_this._context);
_this.viewParts.push(contentViewOverlays);
contentViewOverlays.addDynamicOverlay(new CurrentLineHighlightOverlay(_this._context));
contentViewOverlays.addDynamicOverlay(new SelectionsOverlay(_this._context));
contentViewOverlays.addDynamicOverlay(new indentGuides_IndentGuidesOverlay(_this._context));
contentViewOverlays.addDynamicOverlay(new decorations_DecorationsOverlay(_this._context));
var marginViewOverlays = new viewOverlays_MarginViewOverlays(_this._context);
_this.viewParts.push(marginViewOverlays);
marginViewOverlays.addDynamicOverlay(new CurrentLineMarginHighlightOverlay(_this._context));
marginViewOverlays.addDynamicOverlay(new GlyphMarginOverlay(_this._context));
marginViewOverlays.addDynamicOverlay(new marginDecorations_MarginViewLineDecorationsOverlay(_this._context));
marginViewOverlays.addDynamicOverlay(new linesDecorations_LinesDecorationsOverlay(_this._context));
marginViewOverlays.addDynamicOverlay(new lineNumbers_LineNumbersOverlay(_this._context));
var margin = new margin_Margin(_this._context);
margin.getDomNode().appendChild(_this.viewZones.marginDomNode);
margin.getDomNode().appendChild(marginViewOverlays.getDomNode());
_this.viewParts.push(margin);
// Content widgets
_this.contentWidgets = new contentWidgets_ViewContentWidgets(_this._context, _this.domNode);
_this.viewParts.push(_this.contentWidgets);
_this.viewCursors = new viewCursors_ViewCursors(_this._context);
_this.viewParts.push(_this.viewCursors);
// Overlay widgets
_this.overlayWidgets = new overlayWidgets_ViewOverlayWidgets(_this._context);
_this.viewParts.push(_this.overlayWidgets);
var rulers = new rulers_Rulers(_this._context);
_this.viewParts.push(rulers);
var minimap = new minimap_Minimap(_this._context);
_this.viewParts.push(minimap);
// -------------- Wire dom nodes up
if (decorationsOverviewRuler) {
var 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.domNode.appendChild(_this.overflowGuardContainer);
_this.domNode.appendChild(_this.contentWidgets.overflowingContentWidgetsDomNode);
_this._applyLayout();
// Pointer handler
_this.pointerHandler = _this._register(new pointerHandler_PointerHandler(_this._context, viewController, _this.createPointerHandlerHelper()));
_this._register(model.addEventListener(function (events) {
_this.eventDispatcher.emitMany(events);
}));
_this._register(_this._cursor.addEventListener(function (events) {
_this.eventDispatcher.emitMany(events);
}));
return _this;
}
View.prototype._flushAccumulatedAndRenderNow = function () {
this._renderNow();
};
View.prototype.createPointerHandlerHelper = function () {
var _this = this;
return {
viewDomNode: this.domNode.domNode,
linesContentDomNode: this.linesContent.domNode,
focusTextArea: function () {
_this.focus();
},
getLastRenderData: function () {
var lastViewCursorsRenderData = _this.viewCursors.getLastRenderData() || [];
var lastTextareaPosition = _this._textAreaHandler.getLastRenderData();
return new PointerHandlerLastRenderData(lastViewCursorsRenderData, lastTextareaPosition);
},
shouldSuppressMouseDownOnViewZone: function (viewZoneId) {
return _this.viewZones.shouldSuppressMouseDownOnViewZone(viewZoneId);
},
shouldSuppressMouseDownOnWidget: function (widgetId) {
return _this.contentWidgets.shouldSuppressMouseDownOnWidget(widgetId);
},
getPositionFromDOMInfo: function (spanNode, offset) {
_this._flushAccumulatedAndRenderNow();
return _this.viewLines.getPositionFromDOMInfo(spanNode, offset);
},
visibleRangeForPosition: function (lineNumber, column) {
_this._flushAccumulatedAndRenderNow();
return _this.viewLines.visibleRangeForPosition(new core_position["a" /* Position */](lineNumber, column));
},
getLineWidth: function (lineNumber) {
_this._flushAccumulatedAndRenderNow();
return _this.viewLines.getLineWidth(lineNumber);
}
};
};
View.prototype.createTextAreaHandlerHelper = function () {
var _this = this;
return {
visibleRangeForPositionRelativeToEditor: function (lineNumber, column) {
_this._flushAccumulatedAndRenderNow();
return _this.viewLines.visibleRangeForPosition(new core_position["a" /* Position */](lineNumber, column));
}
};
};
View.prototype._applyLayout = function () {
var options = this._context.configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
this.domNode.setWidth(layoutInfo.width);
this.domNode.setHeight(layoutInfo.height);
this.overflowGuardContainer.setWidth(layoutInfo.width);
this.overflowGuardContainer.setHeight(layoutInfo.height);
this.linesContent.setWidth(1000000);
this.linesContent.setHeight(1000000);
};
View.prototype.getEditorClassName = function () {
var focused = this._textAreaHandler.isFocused() ? ' focused' : '';
return this._context.configuration.options.get(104 /* editorClassName */) + ' ' + Object(common_themeService["d" /* getThemeTypeSelector */])(this._context.theme.type) + focused;
};
// --- begin event handlers
View.prototype.onConfigurationChanged = function (e) {
this.domNode.setClassName(this.getEditorClassName());
this._applyLayout();
return false;
};
View.prototype.onContentSizeChanged = function (e) {
this.outgoingEvents.emitContentSizeChange(e);
return false;
};
View.prototype.onFocusChanged = function (e) {
this.domNode.setClassName(this.getEditorClassName());
this._context.model.setHasFocus(e.isFocused);
if (e.isFocused) {
this.outgoingEvents.emitViewFocusGained();
}
else {
this.outgoingEvents.emitViewFocusLost();
}
return false;
};
View.prototype.onScrollChanged = function (e) {
this.outgoingEvents.emitScrollChanged(e);
return false;
};
View.prototype.onThemeChanged = function (e) {
this.domNode.setClassName(this.getEditorClassName());
return false;
};
// --- end event handlers
View.prototype.dispose = function () {
if (this._renderAnimationFrame !== null) {
this._renderAnimationFrame.dispose();
this._renderAnimationFrame = null;
}
this.eventDispatcher.removeEventHandler(this);
this.outgoingEvents.dispose();
this.viewLines.dispose();
// Destroy view parts
for (var i = 0, len = this.viewParts.length; i < len; i++) {
this.viewParts[i].dispose();
}
this.viewParts = [];
_super.prototype.dispose.call(this);
};
View.prototype._renderOnce = function (callback) {
var r = safeInvokeNoArg(callback);
this._scheduleRender();
return r;
};
View.prototype._scheduleRender = function () {
if (this._renderAnimationFrame === null) {
this._renderAnimationFrame = dom["U" /* runAtThisOrScheduleAtNextAnimationFrame */](this._onRenderScheduled.bind(this), 100);
}
};
View.prototype._onRenderScheduled = function () {
this._renderAnimationFrame = null;
this._flushAccumulatedAndRenderNow();
};
View.prototype._renderNow = function () {
var _this = this;
safeInvokeNoArg(function () { return _this._actualRender(); });
};
View.prototype._getViewPartsToRender = function () {
var result = [], resultLen = 0;
for (var i = 0, len = this.viewParts.length; i < len; i++) {
var viewPart = this.viewParts[i];
if (viewPart.shouldRender()) {
result[resultLen++] = viewPart;
}
}
return result;
};
View.prototype._actualRender = function () {
if (!dom["M" /* isInDOM */](this.domNode.domNode)) {
return;
}
var viewPartsToRender = this._getViewPartsToRender();
if (!this.viewLines.shouldRender() && viewPartsToRender.length === 0) {
// Nothing to render
return;
}
var partialViewportData = this._context.viewLayout.getLinesViewportData();
this._context.model.setViewport(partialViewportData.startLineNumber, partialViewportData.endLineNumber, partialViewportData.centeredLineNumber);
var viewportData = new viewLinesViewportData_ViewportData(this._cursor.getViewSelections(), partialViewportData, this._context.viewLayout.getWhitespaceViewportData(), this._context.model);
if (this.contentWidgets.shouldRender()) {
// Give the content widgets a chance to set their max width before a possible synchronous layout
this.contentWidgets.onBeforeRender(viewportData);
}
if (this.viewLines.shouldRender()) {
this.viewLines.renderText(viewportData);
this.viewLines.onDidRender();
// Rendering of viewLines might cause scroll events to occur, so collect view parts to render again
viewPartsToRender = this._getViewPartsToRender();
}
var renderingContext = new RenderingContext(this._context.viewLayout, viewportData, this.viewLines);
// Render the rest of the parts
for (var i = 0, len = viewPartsToRender.length; i < len; i++) {
var viewPart = viewPartsToRender[i];
viewPart.prepareRender(renderingContext);
}
for (var i = 0, len = viewPartsToRender.length; i < len; i++) {
var viewPart = viewPartsToRender[i];
viewPart.render(renderingContext);
viewPart.onDidRender();
}
};
// --- BEGIN CodeEditor helpers
View.prototype.delegateVerticalScrollbarMouseDown = function (browserEvent) {
this._scrollbar.delegateVerticalScrollbarMouseDown(browserEvent);
};
View.prototype.restoreState = function (scrollPosition) {
this._context.viewLayout.setScrollPositionNow({ scrollTop: scrollPosition.scrollTop });
this._context.model.tokenizeViewport();
this._renderNow();
this.viewLines.updateLineWidths();
this._context.viewLayout.setScrollPositionNow({ scrollLeft: scrollPosition.scrollLeft });
};
View.prototype.getOffsetForColumn = function (modelLineNumber, modelColumn) {
var modelPosition = this._context.model.validateModelPosition({
lineNumber: modelLineNumber,
column: modelColumn
});
var viewPosition = this._context.model.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
this._flushAccumulatedAndRenderNow();
var visibleRange = this.viewLines.visibleRangeForPosition(new core_position["a" /* Position */](viewPosition.lineNumber, viewPosition.column));
if (!visibleRange) {
return -1;
}
return visibleRange.left;
};
View.prototype.getTargetAtClientPoint = function (clientX, clientY) {
var mouseTarget = this.pointerHandler.getTargetAtClientPoint(clientX, clientY);
if (!mouseTarget) {
return null;
}
return ViewOutgoingEvents.convertViewToModelMouseTarget(mouseTarget, this._context.model.coordinatesConverter);
};
View.prototype.createOverviewRuler = function (cssClassName) {
return new overviewRuler_OverviewRuler(this._context, cssClassName);
};
View.prototype.change = function (callback) {
var _this = this;
return this._renderOnce(function () {
var zonesHaveChanged = _this.viewZones.changeViewZones(callback);
if (zonesHaveChanged) {
_this._context.viewLayout.onHeightMaybeChanged();
_this._context.privateViewEventBus.emit(new ViewZonesChangedEvent());
}
return zonesHaveChanged;
});
};
View.prototype.render = function (now, everything) {
if (everything) {
// Force everything to render...
this.viewLines.forceShouldRender();
for (var i = 0, len = this.viewParts.length; i < len; i++) {
var viewPart = this.viewParts[i];
viewPart.forceShouldRender();
}
}
if (now) {
this._flushAccumulatedAndRenderNow();
}
else {
this._scheduleRender();
}
};
View.prototype.focus = function () {
this._textAreaHandler.focusTextArea();
};
View.prototype.isFocused = function () {
return this._textAreaHandler.isFocused();
};
View.prototype.setAriaOptions = function (options) {
this._textAreaHandler.setAriaOptions(options);
};
View.prototype.addContentWidget = function (widgetData) {
this.contentWidgets.addWidget(widgetData.widget);
this.layoutContentWidget(widgetData);
this._scheduleRender();
};
View.prototype.layoutContentWidget = function (widgetData) {
var newRange = widgetData.position ? widgetData.position.range || null : null;
if (newRange === null) {
var newPosition = widgetData.position ? widgetData.position.position : null;
if (newPosition !== null) {
newRange = new core_range["a" /* Range */](newPosition.lineNumber, newPosition.column, newPosition.lineNumber, newPosition.column);
}
}
var newPreference = widgetData.position ? widgetData.position.preference : null;
this.contentWidgets.setWidgetPosition(widgetData.widget, newRange, newPreference);
this._scheduleRender();
};
View.prototype.removeContentWidget = function (widgetData) {
this.contentWidgets.removeWidget(widgetData.widget);
this._scheduleRender();
};
View.prototype.addOverlayWidget = function (widgetData) {
this.overlayWidgets.addWidget(widgetData.widget);
this.layoutOverlayWidget(widgetData);
this._scheduleRender();
};
View.prototype.layoutOverlayWidget = function (widgetData) {
var newPreference = widgetData.position ? widgetData.position.preference : null;
var shouldRender = this.overlayWidgets.setWidgetPosition(widgetData.widget, newPreference);
if (shouldRender) {
this._scheduleRender();
}
};
View.prototype.removeOverlayWidget = function (widgetData) {
this.overlayWidgets.removeWidget(widgetData.widget);
this._scheduleRender();
};
return View;
}(ViewEventHandler));
function safeInvokeNoArg(func) {
try {
return func();
}
catch (e) {
Object(errors["e" /* onUnexpectedError */])(e);
}
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/oneCursor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var oneCursor_OneCursor = /** @class */ (function () {
function OneCursor(context) {
this._selTrackedRange = null;
this._trackSelection = true;
this._setState(context, new cursorCommon["f" /* SingleCursorState */](new core_range["a" /* Range */](1, 1, 1, 1), 0, new core_position["a" /* Position */](1, 1), 0), new cursorCommon["f" /* SingleCursorState */](new core_range["a" /* Range */](1, 1, 1, 1), 0, new core_position["a" /* Position */](1, 1), 0));
}
OneCursor.prototype.dispose = function (context) {
this._removeTrackedRange(context);
};
OneCursor.prototype.startTrackingSelection = function (context) {
this._trackSelection = true;
this._updateTrackedRange(context);
};
OneCursor.prototype.stopTrackingSelection = function (context) {
this._trackSelection = false;
this._removeTrackedRange(context);
};
OneCursor.prototype._updateTrackedRange = function (context) {
if (!this._trackSelection) {
// don't track the selection
return;
}
this._selTrackedRange = context.model._setTrackedRange(this._selTrackedRange, this.modelState.selection, 0 /* AlwaysGrowsWhenTypingAtEdges */);
};
OneCursor.prototype._removeTrackedRange = function (context) {
this._selTrackedRange = context.model._setTrackedRange(this._selTrackedRange, null, 0 /* AlwaysGrowsWhenTypingAtEdges */);
};
OneCursor.prototype.asCursorState = function () {
return new cursorCommon["d" /* CursorState */](this.modelState, this.viewState);
};
OneCursor.prototype.readSelectionFromMarkers = function (context) {
var range = context.model._getTrackedRange(this._selTrackedRange);
if (this.modelState.selection.getDirection() === 0 /* LTR */) {
return new core_selection["a" /* Selection */](range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
}
return new core_selection["a" /* Selection */](range.endLineNumber, range.endColumn, range.startLineNumber, range.startColumn);
};
OneCursor.prototype.ensureValidState = function (context) {
this._setState(context, this.modelState, this.viewState);
};
OneCursor.prototype.setState = function (context, modelState, viewState) {
this._setState(context, modelState, viewState);
};
OneCursor.prototype._setState = function (context, modelState, viewState) {
if (!modelState) {
if (!viewState) {
return;
}
// We only have the view state => compute the model state
var selectionStart = context.model.validateRange(context.convertViewRangeToModelRange(viewState.selectionStart));
var position = context.model.validatePosition(context.convertViewPositionToModelPosition(viewState.position.lineNumber, viewState.position.column));
modelState = new cursorCommon["f" /* SingleCursorState */](selectionStart, viewState.selectionStartLeftoverVisibleColumns, position, viewState.leftoverVisibleColumns);
}
else {
// Validate new model state
var selectionStart = context.model.validateRange(modelState.selectionStart);
var selectionStartLeftoverVisibleColumns = modelState.selectionStart.equalsRange(selectionStart) ? modelState.selectionStartLeftoverVisibleColumns : 0;
var position = context.model.validatePosition(modelState.position);
var leftoverVisibleColumns = modelState.position.equals(position) ? modelState.leftoverVisibleColumns : 0;
modelState = new cursorCommon["f" /* SingleCursorState */](selectionStart, selectionStartLeftoverVisibleColumns, position, leftoverVisibleColumns);
}
if (!viewState) {
// We only have the model state => compute the view state
var viewSelectionStart1 = context.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelState.selectionStart.startLineNumber, modelState.selectionStart.startColumn));
var viewSelectionStart2 = context.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelState.selectionStart.endLineNumber, modelState.selectionStart.endColumn));
var viewSelectionStart = new core_range["a" /* Range */](viewSelectionStart1.lineNumber, viewSelectionStart1.column, viewSelectionStart2.lineNumber, viewSelectionStart2.column);
var viewPosition = context.convertModelPositionToViewPosition(modelState.position);
viewState = new cursorCommon["f" /* SingleCursorState */](viewSelectionStart, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
}
else {
// Validate new view state
var viewSelectionStart = context.validateViewRange(viewState.selectionStart, modelState.selectionStart);
var viewPosition = context.validateViewPosition(viewState.position, modelState.position);
viewState = new cursorCommon["f" /* SingleCursorState */](viewSelectionStart, modelState.selectionStartLeftoverVisibleColumns, viewPosition, modelState.leftoverVisibleColumns);
}
this.modelState = modelState;
this.viewState = viewState;
this._updateTrackedRange(context);
};
return OneCursor;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorCollection.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var cursorCollection_CursorCollection = /** @class */ (function () {
function CursorCollection(context) {
this.context = context;
this.primaryCursor = new oneCursor_OneCursor(context);
this.secondaryCursors = [];
this.lastAddedCursorIndex = 0;
}
CursorCollection.prototype.dispose = function () {
this.primaryCursor.dispose(this.context);
this.killSecondaryCursors();
};
CursorCollection.prototype.startTrackingSelections = function () {
this.primaryCursor.startTrackingSelection(this.context);
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
this.secondaryCursors[i].startTrackingSelection(this.context);
}
};
CursorCollection.prototype.stopTrackingSelections = function () {
this.primaryCursor.stopTrackingSelection(this.context);
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
this.secondaryCursors[i].stopTrackingSelection(this.context);
}
};
CursorCollection.prototype.updateContext = function (context) {
this.context = context;
};
CursorCollection.prototype.ensureValidState = function () {
this.primaryCursor.ensureValidState(this.context);
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
this.secondaryCursors[i].ensureValidState(this.context);
}
};
CursorCollection.prototype.readSelectionFromMarkers = function () {
var result = [];
result[0] = this.primaryCursor.readSelectionFromMarkers(this.context);
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i].readSelectionFromMarkers(this.context);
}
return result;
};
CursorCollection.prototype.getAll = function () {
var result = [];
result[0] = this.primaryCursor.asCursorState();
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i].asCursorState();
}
return result;
};
CursorCollection.prototype.getViewPositions = function () {
var result = [];
result[0] = this.primaryCursor.viewState.position;
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i].viewState.position;
}
return result;
};
CursorCollection.prototype.getSelections = function () {
var result = [];
result[0] = this.primaryCursor.modelState.selection;
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i].modelState.selection;
}
return result;
};
CursorCollection.prototype.getViewSelections = function () {
var result = [];
result[0] = this.primaryCursor.viewState.selection;
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i].viewState.selection;
}
return result;
};
CursorCollection.prototype.setSelections = function (selections) {
this.setStates(cursorCommon["d" /* CursorState */].fromModelSelections(selections));
};
CursorCollection.prototype.getPrimaryCursor = function () {
return this.primaryCursor.asCursorState();
};
CursorCollection.prototype.setStates = function (states) {
if (states === null) {
return;
}
this.primaryCursor.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`.
*/
CursorCollection.prototype._setSecondaryStates = function (secondaryStates) {
var secondaryCursorsLength = this.secondaryCursors.length;
var secondaryStatesLength = secondaryStates.length;
if (secondaryCursorsLength < secondaryStatesLength) {
var createCnt = secondaryStatesLength - secondaryCursorsLength;
for (var i = 0; i < createCnt; i++) {
this._addSecondaryCursor();
}
}
else if (secondaryCursorsLength > secondaryStatesLength) {
var removeCnt = secondaryCursorsLength - secondaryStatesLength;
for (var i = 0; i < removeCnt; i++) {
this._removeSecondaryCursor(this.secondaryCursors.length - 1);
}
}
for (var i = 0; i < secondaryStatesLength; i++) {
this.secondaryCursors[i].setState(this.context, secondaryStates[i].modelState, secondaryStates[i].viewState);
}
};
CursorCollection.prototype.killSecondaryCursors = function () {
this._setSecondaryStates([]);
};
CursorCollection.prototype._addSecondaryCursor = function () {
this.secondaryCursors.push(new oneCursor_OneCursor(this.context));
this.lastAddedCursorIndex = this.secondaryCursors.length;
};
CursorCollection.prototype.getLastAddedCursorIndex = function () {
if (this.secondaryCursors.length === 0 || this.lastAddedCursorIndex === 0) {
return 0;
}
return this.lastAddedCursorIndex;
};
CursorCollection.prototype._removeSecondaryCursor = function (removeIndex) {
if (this.lastAddedCursorIndex >= removeIndex + 1) {
this.lastAddedCursorIndex--;
}
this.secondaryCursors[removeIndex].dispose(this.context);
this.secondaryCursors.splice(removeIndex, 1);
};
CursorCollection.prototype._getAll = function () {
var result = [];
result[0] = this.primaryCursor;
for (var i = 0, len = this.secondaryCursors.length; i < len; i++) {
result[i + 1] = this.secondaryCursors[i];
}
return result;
};
CursorCollection.prototype.normalize = function () {
if (this.secondaryCursors.length === 0) {
return;
}
var cursors = this._getAll();
var sortedCursors = [];
for (var i = 0, len = cursors.length; i < len; i++) {
sortedCursors.push({
index: i,
selection: cursors[i].modelState.selection,
});
}
sortedCursors.sort(function (a, b) {
if (a.selection.startLineNumber === b.selection.startLineNumber) {
return a.selection.startColumn - b.selection.startColumn;
}
return a.selection.startLineNumber - b.selection.startLineNumber;
});
for (var sortedCursorIndex = 0; sortedCursorIndex < sortedCursors.length - 1; sortedCursorIndex++) {
var current = sortedCursors[sortedCursorIndex];
var next = sortedCursors[sortedCursorIndex + 1];
var currentSelection = current.selection;
var nextSelection = next.selection;
if (!this.context.config.multiCursorMergeOverlapping) {
continue;
}
var shouldMergeCursors = void 0;
if (nextSelection.isEmpty() || currentSelection.isEmpty()) {
// Merge touching cursors if one of them is collapsed
shouldMergeCursors = nextSelection.getStartPosition().isBeforeOrEqual(currentSelection.getEndPosition());
}
else {
// Merge only overlapping cursors (i.e. allow touching ranges)
shouldMergeCursors = nextSelection.getStartPosition().isBefore(currentSelection.getEndPosition());
}
if (shouldMergeCursors) {
var winnerSortedCursorIndex = current.index < next.index ? sortedCursorIndex : sortedCursorIndex + 1;
var looserSortedCursorIndex = current.index < next.index ? sortedCursorIndex + 1 : sortedCursorIndex;
var looserIndex = sortedCursors[looserSortedCursorIndex].index;
var winnerIndex = sortedCursors[winnerSortedCursorIndex].index;
var looserSelection = sortedCursors[looserSortedCursorIndex].selection;
var winnerSelection = sortedCursors[winnerSortedCursorIndex].selection;
if (!looserSelection.equalsSelection(winnerSelection)) {
var resultingRange = looserSelection.plusRange(winnerSelection);
var looserSelectionIsLTR = (looserSelection.selectionStartLineNumber === looserSelection.startLineNumber && looserSelection.selectionStartColumn === looserSelection.startColumn);
var winnerSelectionIsLTR = (winnerSelection.selectionStartLineNumber === winnerSelection.startLineNumber && winnerSelection.selectionStartColumn === winnerSelection.startColumn);
// Give more importance to the last added cursor (think Ctrl-dragging + hitting another cursor)
var resultingSelectionIsLTR = void 0;
if (looserIndex === this.lastAddedCursorIndex) {
resultingSelectionIsLTR = looserSelectionIsLTR;
this.lastAddedCursorIndex = winnerIndex;
}
else {
// Winner takes it all
resultingSelectionIsLTR = winnerSelectionIsLTR;
}
var resultingSelection = void 0;
if (resultingSelectionIsLTR) {
resultingSelection = new core_selection["a" /* Selection */](resultingRange.startLineNumber, resultingRange.startColumn, resultingRange.endLineNumber, resultingRange.endColumn);
}
else {
resultingSelection = new core_selection["a" /* Selection */](resultingRange.endLineNumber, resultingRange.endColumn, resultingRange.startLineNumber, resultingRange.startColumn);
}
sortedCursors[winnerSortedCursorIndex].selection = resultingSelection;
var resultingState = cursorCommon["d" /* CursorState */].fromModelSelection(resultingSelection);
cursors[winnerIndex].setState(this.context, resultingState.modelState, resultingState.viewState);
}
for (var _i = 0, sortedCursors_1 = sortedCursors; _i < sortedCursors_1.length; _i++) {
var sortedCursor = sortedCursors_1[_i];
if (sortedCursor.index > looserIndex) {
sortedCursor.index--;
}
}
cursors.splice(looserIndex, 1);
sortedCursors.splice(looserSortedCursorIndex, 1);
this._removeSecondaryCursor(looserIndex - 1);
sortedCursorIndex--;
}
}
};
return CursorCollection;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorDeleteOperations.js
var cursorDeleteOperations = __webpack_require__(200);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursorTypeOperations.js + 1 modules
var cursorTypeOperations = __webpack_require__(106);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorCommon.js
var editorCommon = __webpack_require__(40);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/controller/cursor.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var cursor_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
function containsLineMappingChanged(events) {
for (var i = 0, len = events.length; i < len; i++) {
if (events[i].type === 8 /* ViewLineMappingChanged */) {
return true;
}
}
return false;
}
var CursorStateChangedEvent = /** @class */ (function () {
function CursorStateChangedEvent(selections, modelVersionId, oldSelections, oldModelVersionId, source, reason) {
this.selections = selections;
this.modelVersionId = modelVersionId;
this.oldSelections = oldSelections;
this.oldModelVersionId = oldModelVersionId;
this.source = source;
this.reason = reason;
}
return CursorStateChangedEvent;
}());
/**
* A snapshot of the cursor and the model state
*/
var CursorModelState = /** @class */ (function () {
function CursorModelState(model, cursor) {
this.modelVersionId = model.getVersionId();
this.cursorState = cursor.getAll();
}
CursorModelState.prototype.equals = function (other) {
if (!other) {
return false;
}
if (this.modelVersionId !== other.modelVersionId) {
return false;
}
if (this.cursorState.length !== other.cursorState.length) {
return false;
}
for (var i = 0, len = this.cursorState.length; i < len; i++) {
if (!this.cursorState[i].equals(other.cursorState[i])) {
return false;
}
}
return true;
};
return CursorModelState;
}());
var cursor_AutoClosedAction = /** @class */ (function () {
function AutoClosedAction(model, autoClosedCharactersDecorations, autoClosedEnclosingDecorations) {
this._model = model;
this._autoClosedCharactersDecorations = autoClosedCharactersDecorations;
this._autoClosedEnclosingDecorations = autoClosedEnclosingDecorations;
}
AutoClosedAction.getAllAutoClosedCharacters = function (autoClosedActions) {
var autoClosedCharacters = [];
for (var _i = 0, autoClosedActions_1 = autoClosedActions; _i < autoClosedActions_1.length; _i++) {
var autoClosedAction = autoClosedActions_1[_i];
autoClosedCharacters = autoClosedCharacters.concat(autoClosedAction.getAutoClosedCharactersRanges());
}
return autoClosedCharacters;
};
AutoClosedAction.prototype.dispose = function () {
this._autoClosedCharactersDecorations = this._model.deltaDecorations(this._autoClosedCharactersDecorations, []);
this._autoClosedEnclosingDecorations = this._model.deltaDecorations(this._autoClosedEnclosingDecorations, []);
};
AutoClosedAction.prototype.getAutoClosedCharactersRanges = function () {
var result = [];
for (var i = 0; i < this._autoClosedCharactersDecorations.length; i++) {
var decorationRange = this._model.getDecorationRange(this._autoClosedCharactersDecorations[i]);
if (decorationRange) {
result.push(decorationRange);
}
}
return result;
};
AutoClosedAction.prototype.isValid = function (selections) {
var enclosingRanges = [];
for (var i = 0; i < this._autoClosedEnclosingDecorations.length; i++) {
var decorationRange = this._model.getDecorationRange(this._autoClosedEnclosingDecorations[i]);
if (decorationRange) {
enclosingRanges.push(decorationRange);
if (decorationRange.startLineNumber !== decorationRange.endLineNumber) {
// Stop tracking if the range becomes multiline...
return false;
}
}
}
enclosingRanges.sort(core_range["a" /* Range */].compareRangesUsingStarts);
selections.sort(core_range["a" /* Range */].compareRangesUsingStarts);
for (var i = 0; i < selections.length; i++) {
if (i >= enclosingRanges.length) {
return false;
}
if (!enclosingRanges[i].strictContainsRange(selections[i])) {
return false;
}
}
return true;
};
return AutoClosedAction;
}());
var cursor_Cursor = /** @class */ (function (_super) {
cursor_extends(Cursor, _super);
function Cursor(configuration, model, viewModel) {
var _this = _super.call(this) || this;
_this._onDidReachMaxCursorCount = _this._register(new common_event["a" /* Emitter */]());
_this.onDidReachMaxCursorCount = _this._onDidReachMaxCursorCount.event;
_this._onDidAttemptReadOnlyEdit = _this._register(new common_event["a" /* Emitter */]());
_this.onDidAttemptReadOnlyEdit = _this._onDidAttemptReadOnlyEdit.event;
_this._onDidChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChange = _this._onDidChange.event;
_this._configuration = configuration;
_this._model = model;
_this._knownModelVersionId = _this._model.getVersionId();
_this._viewModel = viewModel;
_this.context = new cursorCommon["c" /* CursorContext */](_this._configuration, _this._model, _this._viewModel);
_this._cursors = new cursorCollection_CursorCollection(_this.context);
_this._isHandling = false;
_this._isDoingComposition = false;
_this._selectionsWhenCompositionStarted = null;
_this._columnSelectData = null;
_this._autoClosedActions = [];
_this._prevEditOperationType = 0 /* Other */;
_this._register(_this._model.onDidChangeRawContent(function (e) {
_this._knownModelVersionId = e.versionId;
if (_this._isHandling) {
return;
}
var hadFlushEvent = e.containsEvent(1 /* Flush */);
_this._onModelContentChanged(hadFlushEvent);
}));
_this._register(viewModel.addEventListener(function (events) {
if (!containsLineMappingChanged(events)) {
return;
}
if (_this._knownModelVersionId !== _this._model.getVersionId()) {
// There are model change events that I didn't yet receive.
//
// This can happen when editing the model, and the view model receives the change events first,
// and the view model emits line mapping changed events, all before the cursor gets a chance to
// recover from markers.
//
// The model change listener above will be called soon and we'll ensure a valid cursor state there.
return;
}
// Ensure valid state
_this.setStates('viewModel', 0 /* NotSet */, _this.getAll());
}));
var updateCursorContext = function () {
_this.context = new cursorCommon["c" /* CursorContext */](_this._configuration, _this._model, _this._viewModel);
_this._cursors.updateContext(_this.context);
};
_this._register(_this._model.onDidChangeLanguage(function (e) {
updateCursorContext();
}));
_this._register(_this._model.onDidChangeLanguageConfiguration(function () {
updateCursorContext();
}));
_this._register(_this._model.onDidChangeOptions(function () {
updateCursorContext();
}));
_this._register(_this._configuration.onDidChange(function (e) {
if (cursorCommon["b" /* CursorConfiguration */].shouldRecreate(e)) {
updateCursorContext();
}
}));
return _this;
}
Cursor.prototype.dispose = function () {
this._cursors.dispose();
this._autoClosedActions = Object(lifecycle["f" /* dispose */])(this._autoClosedActions);
_super.prototype.dispose.call(this);
};
Cursor.prototype._validateAutoClosedActions = function () {
if (this._autoClosedActions.length > 0) {
var selections = this._cursors.getSelections();
for (var i = 0; i < this._autoClosedActions.length; i++) {
var autoClosedAction = this._autoClosedActions[i];
if (!autoClosedAction.isValid(selections)) {
autoClosedAction.dispose();
this._autoClosedActions.splice(i, 1);
i--;
}
}
}
};
// ------ some getters/setters
Cursor.prototype.getPrimaryCursor = function () {
return this._cursors.getPrimaryCursor();
};
Cursor.prototype.getLastAddedCursorIndex = function () {
return this._cursors.getLastAddedCursorIndex();
};
Cursor.prototype.getAll = function () {
return this._cursors.getAll();
};
Cursor.prototype.setStates = function (source, reason, states) {
if (states !== null && states.length > Cursor.MAX_CURSOR_COUNT) {
states = states.slice(0, Cursor.MAX_CURSOR_COUNT);
this._onDidReachMaxCursorCount.fire(undefined);
}
var oldState = new CursorModelState(this._model, this);
this._cursors.setStates(states);
this._cursors.normalize();
this._columnSelectData = null;
this._validateAutoClosedActions();
this._emitStateChangedIfNecessary(source, reason, oldState);
};
Cursor.prototype.setColumnSelectData = function (columnSelectData) {
this._columnSelectData = columnSelectData;
};
Cursor.prototype.reveal = function (source, horizontal, target, scrollType) {
this._revealRange(source, target, 0 /* Simple */, horizontal, scrollType);
};
Cursor.prototype.revealRange = function (source, revealHorizontal, viewRange, verticalType, scrollType) {
this.emitCursorRevealRange(source, viewRange, verticalType, revealHorizontal, scrollType);
};
Cursor.prototype.scrollTo = function (desiredScrollTop) {
this._viewModel.viewLayout.setScrollPositionSmooth({
scrollTop: desiredScrollTop
});
};
Cursor.prototype.saveState = function () {
var result = [];
var selections = this._cursors.getSelections();
for (var i = 0, len = selections.length; i < len; i++) {
var selection = selections[i];
result.push({
inSelectionMode: !selection.isEmpty(),
selectionStart: {
lineNumber: selection.selectionStartLineNumber,
column: selection.selectionStartColumn,
},
position: {
lineNumber: selection.positionLineNumber,
column: selection.positionColumn,
}
});
}
return result;
};
Cursor.prototype.restoreState = function (states) {
var desiredSelections = [];
for (var i = 0, len = states.length; i < len; i++) {
var state = states[i];
var positionLineNumber = 1;
var positionColumn = 1;
// Avoid missing properties on the literal
if (state.position && state.position.lineNumber) {
positionLineNumber = state.position.lineNumber;
}
if (state.position && state.position.column) {
positionColumn = state.position.column;
}
var selectionStartLineNumber = positionLineNumber;
var selectionStartColumn = positionColumn;
// Avoid missing properties on the literal
if (state.selectionStart && state.selectionStart.lineNumber) {
selectionStartLineNumber = state.selectionStart.lineNumber;
}
if (state.selectionStart && state.selectionStart.column) {
selectionStartColumn = state.selectionStart.column;
}
desiredSelections.push({
selectionStartLineNumber: selectionStartLineNumber,
selectionStartColumn: selectionStartColumn,
positionLineNumber: positionLineNumber,
positionColumn: positionColumn
});
}
this.setStates('restoreState', 0 /* NotSet */, cursorCommon["d" /* CursorState */].fromModelSelections(desiredSelections));
this.reveal('restoreState', true, 0 /* Primary */, 1 /* Immediate */);
};
Cursor.prototype._onModelContentChanged = function (hadFlushEvent) {
this._prevEditOperationType = 0 /* Other */;
if (hadFlushEvent) {
// a model.setValue() was called
this._cursors.dispose();
this._cursors = new cursorCollection_CursorCollection(this.context);
this._validateAutoClosedActions();
this._emitStateChangedIfNecessary('model', 1 /* ContentFlush */, null);
}
else {
var selectionsFromMarkers = this._cursors.readSelectionFromMarkers();
this.setStates('modelChange', 2 /* RecoverFromMarkers */, cursorCommon["d" /* CursorState */].fromModelSelections(selectionsFromMarkers));
}
};
Cursor.prototype.getSelection = function () {
return this._cursors.getPrimaryCursor().modelState.selection;
};
Cursor.prototype.getColumnSelectData = function () {
if (this._columnSelectData) {
return this._columnSelectData;
}
var primaryCursor = this._cursors.getPrimaryCursor();
var primaryPos = primaryCursor.viewState.selectionStart.getStartPosition();
var viewLineNumber = primaryPos.lineNumber;
var viewVisualColumn = cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn2(this.context.config, this.context.viewModel, primaryPos);
return {
isReal: false,
fromViewLineNumber: viewLineNumber,
fromViewVisualColumn: viewVisualColumn,
toViewLineNumber: viewLineNumber,
toViewVisualColumn: viewVisualColumn,
};
};
Cursor.prototype.getSelections = function () {
return this._cursors.getSelections();
};
Cursor.prototype.getViewSelections = function () {
return this._cursors.getViewSelections();
};
Cursor.prototype.getPosition = function () {
return this._cursors.getPrimaryCursor().modelState.position;
};
Cursor.prototype.setSelections = function (source, selections) {
this.setStates(source, 0 /* NotSet */, cursorCommon["d" /* CursorState */].fromModelSelections(selections));
};
Cursor.prototype.getPrevEditOperationType = function () {
return this._prevEditOperationType;
};
Cursor.prototype.setPrevEditOperationType = function (type) {
this._prevEditOperationType = type;
};
// ------ auxiliary handling logic
Cursor.prototype._pushAutoClosedAction = function (autoClosedCharactersRanges, autoClosedEnclosingRanges) {
var autoClosedCharactersDeltaDecorations = [];
var autoClosedEnclosingDeltaDecorations = [];
for (var i = 0, len = autoClosedCharactersRanges.length; i < len; i++) {
autoClosedCharactersDeltaDecorations.push({
range: autoClosedCharactersRanges[i],
options: {
inlineClassName: 'auto-closed-character',
stickiness: 1 /* NeverGrowsWhenTypingAtEdges */
}
});
autoClosedEnclosingDeltaDecorations.push({
range: autoClosedEnclosingRanges[i],
options: {
stickiness: 1 /* NeverGrowsWhenTypingAtEdges */
}
});
}
var autoClosedCharactersDecorations = this._model.deltaDecorations([], autoClosedCharactersDeltaDecorations);
var autoClosedEnclosingDecorations = this._model.deltaDecorations([], autoClosedEnclosingDeltaDecorations);
this._autoClosedActions.push(new cursor_AutoClosedAction(this._model, autoClosedCharactersDecorations, autoClosedEnclosingDecorations));
};
Cursor.prototype._executeEditOperation = function (opResult) {
if (!opResult) {
// Nothing to execute
return;
}
if (opResult.shouldPushStackElementBefore) {
this._model.pushStackElement();
}
var result = cursor_CommandExecutor.executeCommands(this._model, this._cursors.getSelections(), opResult.commands);
if (result) {
// The commands were applied correctly
this._interpretCommandResult(result);
// Check for auto-closing closed characters
var autoClosedCharactersRanges = [];
var autoClosedEnclosingRanges = [];
for (var i = 0; i < opResult.commands.length; i++) {
var command = opResult.commands[i];
if (command instanceof cursorTypeOperations["b" /* 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();
}
};
Cursor.prototype._interpretCommandResult = function (cursorState) {
if (!cursorState || cursorState.length === 0) {
cursorState = this._cursors.readSelectionFromMarkers();
}
this._columnSelectData = null;
this._cursors.setSelections(cursorState);
this._cursors.normalize();
};
// -----------------------------------------------------------------------------------------------------------
// ----- emitting events
Cursor.prototype._emitStateChangedIfNecessary = function (source, reason, oldState) {
var newState = new CursorModelState(this._model, this);
if (newState.equals(oldState)) {
return false;
}
var selections = this._cursors.getSelections();
var viewSelections = this._cursors.getViewSelections();
// Let the view get the event first.
try {
var eventsCollector = this._beginEmit();
eventsCollector.emit(new ViewCursorStateChangedEvent(viewSelections, selections));
}
finally {
this._endEmit();
}
// Only after the view has been notified, let the rest of the world know...
if (!oldState
|| oldState.cursorState.length !== newState.cursorState.length
|| newState.cursorState.some(function (newCursorState, i) { return !newCursorState.modelState.equals(oldState.cursorState[i].modelState); })) {
var oldSelections = oldState ? oldState.cursorState.map(function (s) { return s.modelState.selection; }) : null;
var oldModelVersionId = oldState ? oldState.modelVersionId : 0;
this._onDidChange.fire(new CursorStateChangedEvent(selections, newState.modelVersionId, oldSelections, oldModelVersionId, source || 'keyboard', reason));
}
return true;
};
Cursor.prototype._revealRange = function (source, revealTarget, verticalType, revealHorizontal, scrollType) {
var viewPositions = this._cursors.getViewPositions();
var viewPosition = viewPositions[0];
if (revealTarget === 1 /* TopMost */) {
for (var i = 1; i < viewPositions.length; i++) {
if (viewPositions[i].isBefore(viewPosition)) {
viewPosition = viewPositions[i];
}
}
}
else if (revealTarget === 2 /* BottomMost */) {
for (var i = 1; i < viewPositions.length; i++) {
if (viewPosition.isBeforeOrEqual(viewPositions[i])) {
viewPosition = viewPositions[i];
}
}
}
else {
if (viewPositions.length > 1) {
// no revealing!
return;
}
}
var viewRange = new core_range["a" /* Range */](viewPosition.lineNumber, viewPosition.column, viewPosition.lineNumber, viewPosition.column);
this.emitCursorRevealRange(source, viewRange, verticalType, revealHorizontal, scrollType);
};
Cursor.prototype.emitCursorRevealRange = function (source, viewRange, verticalType, revealHorizontal, scrollType) {
try {
var eventsCollector = this._beginEmit();
eventsCollector.emit(new ViewRevealRangeRequestEvent(source, viewRange, verticalType, revealHorizontal, scrollType));
}
finally {
this._endEmit();
}
};
// -----------------------------------------------------------------------------------------------------------
// ----- handlers beyond this point
Cursor.prototype._findAutoClosingPairs = function (edits) {
if (!edits.length) {
return null;
}
var indices = [];
for (var i = 0, len = edits.length; i < len; i++) {
var edit = edits[i];
if (!edit.text || edit.text.indexOf('\n') >= 0) {
return null;
}
var m = edit.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);
if (!m) {
return null;
}
var closeChar = m[1];
var autoClosingPairsCandidates = this.context.config.autoClosingPairsClose2.get(closeChar);
if (!autoClosingPairsCandidates || autoClosingPairsCandidates.length !== 1) {
return null;
}
var openChar = autoClosingPairsCandidates[0].open;
var closeCharIndex = edit.text.length - m[2].length - 1;
var openCharIndex = edit.text.lastIndexOf(openChar, closeCharIndex - 1);
if (openCharIndex === -1) {
return null;
}
indices.push([openCharIndex, closeCharIndex]);
}
return indices;
};
Cursor.prototype.executeEdits = function (source, edits, cursorStateComputer) {
var _this = this;
var autoClosingIndices = null;
if (source === 'snippet') {
autoClosingIndices = this._findAutoClosingPairs(edits);
}
if (autoClosingIndices) {
edits[0]._isTracked = true;
}
var autoClosedCharactersRanges = [];
var autoClosedEnclosingRanges = [];
var selections = this._model.pushEditOperations(this.getSelections(), edits, function (undoEdits) {
if (autoClosingIndices) {
for (var i = 0, len = autoClosingIndices.length; i < len; i++) {
var _a = autoClosingIndices[i], openCharInnerIndex = _a[0], closeCharInnerIndex = _a[1];
var undoEdit = undoEdits[i];
var lineNumber = undoEdit.range.startLineNumber;
var openCharIndex = undoEdit.range.startColumn - 1 + openCharInnerIndex;
var closeCharIndex = undoEdit.range.startColumn - 1 + closeCharInnerIndex;
autoClosedCharactersRanges.push(new core_range["a" /* Range */](lineNumber, closeCharIndex + 1, lineNumber, closeCharIndex + 2));
autoClosedEnclosingRanges.push(new core_range["a" /* Range */](lineNumber, openCharIndex + 1, lineNumber, closeCharIndex + 2));
}
}
var selections = cursorStateComputer(undoEdits);
if (selections) {
// Don't recover the selection from markers because
// we know what it should be.
_this._isHandling = true;
}
return selections;
});
if (selections) {
this._isHandling = false;
this.setSelections(source, selections);
}
if (autoClosedCharactersRanges.length > 0) {
this._pushAutoClosedAction(autoClosedCharactersRanges, autoClosedEnclosingRanges);
}
};
Cursor.prototype.trigger = function (source, handlerId, payload) {
var H = editorCommon["b" /* Handler */];
if (handlerId === H.CompositionStart) {
this._isDoingComposition = true;
this._selectionsWhenCompositionStarted = this.getSelections().slice(0);
return;
}
if (handlerId === H.CompositionEnd) {
this._isDoingComposition = false;
}
if (this._configuration.options.get(68 /* readOnly */)) {
// All the remaining handlers will try to edit the model,
// but we cannot edit when read only...
this._onDidAttemptReadOnlyEdit.fire(undefined);
return;
}
var oldState = new CursorModelState(this._model, this);
var cursorChangeReason = 0 /* NotSet */;
if (handlerId !== H.Undo && handlerId !== H.Redo) {
// TODO@Alex: if the undo/redo stack contains non-null selections
// it would also be OK to stop tracking selections here
this._cursors.stopTrackingSelections();
}
// ensure valid state on all cursors
this._cursors.ensureValidState();
this._isHandling = true;
try {
switch (handlerId) {
case H.Type:
this._type(source, payload.text);
break;
case H.ReplacePreviousChar:
this._replacePreviousChar(payload.text, payload.replaceCharCnt);
break;
case H.Paste:
cursorChangeReason = 4 /* Paste */;
this._paste(payload.text, payload.pasteOnNewLine, payload.multicursorText || []);
break;
case H.Cut:
this._cut();
break;
case H.Undo:
cursorChangeReason = 5 /* Undo */;
this._interpretCommandResult(this._model.undo());
break;
case H.Redo:
cursorChangeReason = 6 /* Redo */;
this._interpretCommandResult(this._model.redo());
break;
case H.ExecuteCommand:
this._externalExecuteCommand(payload);
break;
case H.ExecuteCommands:
this._externalExecuteCommands(payload);
break;
case H.CompositionEnd:
this._interpretCompositionEnd(source);
break;
}
}
catch (err) {
Object(errors["e" /* onUnexpectedError */])(err);
}
this._isHandling = false;
if (handlerId !== H.Undo && handlerId !== H.Redo) {
this._cursors.startTrackingSelections();
}
this._validateAutoClosedActions();
if (this._emitStateChangedIfNecessary(source, cursorChangeReason, oldState)) {
this._revealRange(source, 0 /* Primary */, 0 /* Simple */, true, 0 /* Smooth */);
}
};
Cursor.prototype._interpretCompositionEnd = function (source) {
if (!this._isDoingComposition && source === 'keyboard') {
// composition finishes, let's check if we need to auto complete if necessary.
var autoClosedCharacters = cursor_AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
this._executeEditOperation(cursorTypeOperations["a" /* TypeOperations */].compositionEndWithInterceptors(this._prevEditOperationType, this.context.config, this.context.model, this._selectionsWhenCompositionStarted, this.getSelections(), autoClosedCharacters));
this._selectionsWhenCompositionStarted = null;
}
};
Cursor.prototype._type = function (source, text) {
if (!this._isDoingComposition && source === 'keyboard') {
// If this event is coming straight from the keyboard, look for electric characters and enter
var len = text.length;
var offset = 0;
while (offset < len) {
var charLength = strings["E" /* nextCharLength */](text, offset);
var chr = text.substr(offset, charLength);
// Here we must interpret each typed character individually
var autoClosedCharacters = cursor_AutoClosedAction.getAllAutoClosedCharacters(this._autoClosedActions);
this._executeEditOperation(cursorTypeOperations["a" /* TypeOperations */].typeWithInterceptors(this._prevEditOperationType, this.context.config, this.context.model, this.getSelections(), autoClosedCharacters, chr));
offset += charLength;
}
}
else {
this._executeEditOperation(cursorTypeOperations["a" /* TypeOperations */].typeWithoutInterceptors(this._prevEditOperationType, this.context.config, this.context.model, this.getSelections(), text));
}
};
Cursor.prototype._replacePreviousChar = function (text, replaceCharCnt) {
this._executeEditOperation(cursorTypeOperations["a" /* TypeOperations */].replacePreviousChar(this._prevEditOperationType, this.context.config, this.context.model, this.getSelections(), text, replaceCharCnt));
};
Cursor.prototype._paste = function (text, pasteOnNewLine, multicursorText) {
this._executeEditOperation(cursorTypeOperations["a" /* TypeOperations */].paste(this.context.config, this.context.model, this.getSelections(), text, pasteOnNewLine, multicursorText));
};
Cursor.prototype._cut = function () {
this._executeEditOperation(cursorDeleteOperations["a" /* DeleteOperations */].cut(this.context.config, this.context.model, this.getSelections()));
};
Cursor.prototype._externalExecuteCommand = function (command) {
this._cursors.killSecondaryCursors();
this._executeEditOperation(new cursorCommon["e" /* EditOperationResult */](0 /* Other */, [command], {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: false
}));
};
Cursor.prototype._externalExecuteCommands = function (commands) {
this._executeEditOperation(new cursorCommon["e" /* EditOperationResult */](0 /* Other */, commands, {
shouldPushStackElementBefore: false,
shouldPushStackElementAfter: false
}));
};
Cursor.MAX_CURSOR_COUNT = 10000;
return Cursor;
}(viewEvents_ViewEventEmitter));
var cursor_CommandExecutor = /** @class */ (function () {
function CommandExecutor() {
}
CommandExecutor.executeCommands = function (model, selectionsBefore, commands) {
var ctx = {
model: model,
selectionsBefore: selectionsBefore,
trackedRanges: [],
trackedRangesDirection: []
};
var result = this._innerExecuteCommands(ctx, commands);
for (var i = 0, len = ctx.trackedRanges.length; i < len; i++) {
ctx.model._setTrackedRange(ctx.trackedRanges[i], null, 0 /* AlwaysGrowsWhenTypingAtEdges */);
}
return result;
};
CommandExecutor._innerExecuteCommands = function (ctx, commands) {
if (this._arrayIsEmpty(commands)) {
return null;
}
var commandsData = this._getEditOperations(ctx, commands);
if (commandsData.operations.length === 0) {
return null;
}
var rawOperations = commandsData.operations;
var loserCursorsMap = this._getLoserCursorMap(rawOperations);
if (loserCursorsMap.hasOwnProperty('0')) {
// These commands are very messed up
console.warn('Ignoring commands');
return null;
}
// Remove operations belonging to losing cursors
var filteredOperations = [];
for (var i = 0, len = rawOperations.length; i < len; i++) {
if (!loserCursorsMap.hasOwnProperty(rawOperations[i].identifier.major.toString())) {
filteredOperations.push(rawOperations[i]);
}
}
// TODO@Alex: find a better way to do this.
// give the hint that edit operations are tracked to the model
if (commandsData.hadTrackedEditOperation && filteredOperations.length > 0) {
filteredOperations[0]._isTracked = true;
}
var selectionsAfter = ctx.model.pushEditOperations(ctx.selectionsBefore, filteredOperations, function (inverseEditOperations) {
var groupedInverseEditOperations = [];
for (var i = 0; i < ctx.selectionsBefore.length; i++) {
groupedInverseEditOperations[i] = [];
}
for (var _i = 0, inverseEditOperations_1 = inverseEditOperations; _i < inverseEditOperations_1.length; _i++) {
var op = inverseEditOperations_1[_i];
if (!op.identifier) {
// perhaps auto whitespace trim edits
continue;
}
groupedInverseEditOperations[op.identifier.major].push(op);
}
var minorBasedSorter = function (a, b) {
return a.identifier.minor - b.identifier.minor;
};
var cursorSelections = [];
var _loop_1 = function (i) {
if (groupedInverseEditOperations[i].length > 0) {
groupedInverseEditOperations[i].sort(minorBasedSorter);
cursorSelections[i] = commands[i].computeCursorState(ctx.model, {
getInverseEditOperations: function () {
return groupedInverseEditOperations[i];
},
getTrackedSelection: function (id) {
var idx = parseInt(id, 10);
var range = ctx.model._getTrackedRange(ctx.trackedRanges[idx]);
if (ctx.trackedRangesDirection[idx] === 0 /* LTR */) {
return new core_selection["a" /* Selection */](range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
}
return new core_selection["a" /* Selection */](range.endLineNumber, range.endColumn, range.startLineNumber, range.startColumn);
}
});
}
else {
cursorSelections[i] = ctx.selectionsBefore[i];
}
};
for (var i = 0; i < ctx.selectionsBefore.length; i++) {
_loop_1(i);
}
return cursorSelections;
});
if (!selectionsAfter) {
selectionsAfter = ctx.selectionsBefore;
}
// Extract losing cursors
var losingCursors = [];
for (var losingCursorIndex in loserCursorsMap) {
if (loserCursorsMap.hasOwnProperty(losingCursorIndex)) {
losingCursors.push(parseInt(losingCursorIndex, 10));
}
}
// Sort losing cursors descending
losingCursors.sort(function (a, b) {
return b - a;
});
// Remove losing cursors
for (var _i = 0, losingCursors_1 = losingCursors; _i < losingCursors_1.length; _i++) {
var losingCursor = losingCursors_1[_i];
selectionsAfter.splice(losingCursor, 1);
}
return selectionsAfter;
};
CommandExecutor._arrayIsEmpty = function (commands) {
for (var i = 0, len = commands.length; i < len; i++) {
if (commands[i]) {
return false;
}
}
return true;
};
CommandExecutor._getEditOperations = function (ctx, commands) {
var operations = [];
var hadTrackedEditOperation = false;
for (var i = 0, len = commands.length; i < len; i++) {
var command = commands[i];
if (command) {
var r = this._getEditOperationsFromCommand(ctx, i, command);
operations = operations.concat(r.operations);
hadTrackedEditOperation = hadTrackedEditOperation || r.hadTrackedEditOperation;
}
}
return {
operations: operations,
hadTrackedEditOperation: hadTrackedEditOperation
};
};
CommandExecutor._getEditOperationsFromCommand = function (ctx, majorIdentifier, command) {
// This method acts as a transaction, if the command fails
// everything it has done is ignored
var operations = [];
var operationMinor = 0;
var addEditOperation = function (selection, text, forceMoveMarkers) {
if (forceMoveMarkers === void 0) { forceMoveMarkers = false; }
if (selection.isEmpty() && text === '') {
// This command wants to add a no-op => no thank you
return;
}
operations.push({
identifier: {
major: majorIdentifier,
minor: operationMinor++
},
range: selection,
text: text,
forceMoveMarkers: forceMoveMarkers,
isAutoWhitespaceEdit: command.insertsAutoWhitespace
});
};
var hadTrackedEditOperation = false;
var addTrackedEditOperation = function (selection, text, forceMoveMarkers) {
hadTrackedEditOperation = true;
addEditOperation(selection, text, forceMoveMarkers);
};
var trackSelection = function (selection, trackPreviousOnEmpty) {
var stickiness;
if (selection.isEmpty()) {
if (typeof trackPreviousOnEmpty === 'boolean') {
if (trackPreviousOnEmpty) {
stickiness = 2 /* GrowsOnlyWhenTypingBefore */;
}
else {
stickiness = 3 /* GrowsOnlyWhenTypingAfter */;
}
}
else {
// Try to lock it with surrounding text
var maxLineColumn = ctx.model.getLineMaxColumn(selection.startLineNumber);
if (selection.startColumn === maxLineColumn) {
stickiness = 2 /* GrowsOnlyWhenTypingBefore */;
}
else {
stickiness = 3 /* GrowsOnlyWhenTypingAfter */;
}
}
}
else {
stickiness = 1 /* NeverGrowsWhenTypingAtEdges */;
}
var l = ctx.trackedRanges.length;
var id = ctx.model._setTrackedRange(null, selection, stickiness);
ctx.trackedRanges[l] = id;
ctx.trackedRangesDirection[l] = selection.getDirection();
return l.toString();
};
var editOperationBuilder = {
addEditOperation: addEditOperation,
addTrackedEditOperation: addTrackedEditOperation,
trackSelection: trackSelection
};
try {
command.getEditOperations(ctx.model, editOperationBuilder);
}
catch (e) {
// TODO@Alex use notification service if this should be user facing
// e.friendlyMessage = nls.localize('corrupt.commands', "Unexpected exception while executing command.");
Object(errors["e" /* onUnexpectedError */])(e);
return {
operations: [],
hadTrackedEditOperation: false
};
}
return {
operations: operations,
hadTrackedEditOperation: hadTrackedEditOperation
};
};
CommandExecutor._getLoserCursorMap = function (operations) {
// This is destructive on the array
operations = operations.slice(0);
// Sort operations with last one first
operations.sort(function (a, b) {
// Note the minus!
return -(core_range["a" /* Range */].compareRangesUsingEnds(a.range, b.range));
});
// Operations can not overlap!
var loserCursorsMap = {};
for (var i = 1; i < operations.length; i++) {
var previousOp = operations[i - 1];
var currentOp = operations[i];
if (previousOp.range.getStartPosition().isBefore(currentOp.range.getEndPosition())) {
var loserMajor = void 0;
if (previousOp.identifier.major > currentOp.identifier.major) {
// previousOp loses the battle
loserMajor = previousOp.identifier.major;
}
else {
loserMajor = currentOp.identifier.major;
}
loserCursorsMap[loserMajor.toString()] = true;
for (var 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;
};
return CommandExecutor;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorAction.js
var editorAction = __webpack_require__(236);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/editorContextKeys.js
var editorContextKeys = __webpack_require__(10);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/modes/textToHtmlTokenizer.js
var textToHtmlTokenizer = __webpack_require__(201);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/scrollable.js
var scrollable = __webpack_require__(235);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/linesLayout.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var PendingChanges = /** @class */ (function () {
function PendingChanges() {
this._hasPending = false;
this._inserts = [];
this._changes = [];
this._removes = [];
}
PendingChanges.prototype.insert = function (x) {
this._hasPending = true;
this._inserts.push(x);
};
PendingChanges.prototype.change = function (x) {
this._hasPending = true;
this._changes.push(x);
};
PendingChanges.prototype.remove = function (x) {
this._hasPending = true;
this._removes.push(x);
};
PendingChanges.prototype.mustCommit = function () {
return this._hasPending;
};
PendingChanges.prototype.commit = function (linesLayout) {
if (!this._hasPending) {
return;
}
var inserts = this._inserts;
var changes = this._changes;
var removes = this._removes;
this._hasPending = false;
this._inserts = [];
this._changes = [];
this._removes = [];
linesLayout._commitPendingChanges(inserts, changes, removes);
};
return PendingChanges;
}());
var EditorWhitespace = /** @class */ (function () {
function EditorWhitespace(id, afterLineNumber, ordinal, height, minWidth) {
this.id = id;
this.afterLineNumber = afterLineNumber;
this.ordinal = ordinal;
this.height = height;
this.minWidth = minWidth;
this.prefixSum = 0;
}
return EditorWhitespace;
}());
/**
* Layouting of objects that take vertical space (by having a height) and push down other objects.
*
* These objects are basically either text (lines) or spaces between those lines (whitespaces).
* This provides commodity operations for working with lines that contain whitespace that pushes lines lower (vertically).
*/
var linesLayout_LinesLayout = /** @class */ (function () {
function LinesLayout(lineCount, lineHeight) {
this._instanceId = strings["M" /* singleLetterHash */](++LinesLayout.INSTANCE_COUNT);
this._pendingChanges = new PendingChanges();
this._lastWhitespaceId = 0;
this._arr = [];
this._prefixSumValidIndex = -1;
this._minWidth = -1; /* marker for not being computed */
this._lineCount = lineCount;
this._lineHeight = lineHeight;
}
/**
* 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.
*/
LinesLayout.findInsertionIndex = function (arr, afterLineNumber, ordinal) {
var low = 0;
var high = arr.length;
while (low < high) {
var 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.
*/
LinesLayout.prototype.setLineHeight = function (lineHeight) {
this._checkPendingChanges();
this._lineHeight = lineHeight;
};
/**
* Set the number of lines.
*
* @param lineCount New number of lines.
*/
LinesLayout.prototype.onFlushed = function (lineCount) {
this._checkPendingChanges();
this._lineCount = lineCount;
};
LinesLayout.prototype.changeWhitespace = function (callback) {
var _this = this;
try {
var accessor = {
insertWhitespace: function (afterLineNumber, ordinal, heightInPx, minWidth) {
afterLineNumber = afterLineNumber | 0;
ordinal = ordinal | 0;
heightInPx = heightInPx | 0;
minWidth = minWidth | 0;
var id = _this._instanceId + (++_this._lastWhitespaceId);
_this._pendingChanges.insert(new EditorWhitespace(id, afterLineNumber, ordinal, heightInPx, minWidth));
return id;
},
changeOneWhitespace: function (id, newAfterLineNumber, newHeight) {
newAfterLineNumber = newAfterLineNumber | 0;
newHeight = newHeight | 0;
_this._pendingChanges.change({ id: id, newAfterLineNumber: newAfterLineNumber, newHeight: newHeight });
},
removeWhitespace: function (id) {
_this._pendingChanges.remove({ id: id });
}
};
return callback(accessor);
}
finally {
this._pendingChanges.commit(this);
}
};
LinesLayout.prototype._commitPendingChanges = function (inserts, changes, removes) {
if (inserts.length > 0 || removes.length > 0) {
this._minWidth = -1; /* marker for not being computed */
}
if (inserts.length + changes.length + removes.length <= 1) {
// when only one thing happened, handle it "delicately"
for (var _i = 0, inserts_1 = inserts; _i < inserts_1.length; _i++) {
var insert = inserts_1[_i];
this._insertWhitespace(insert);
}
for (var _a = 0, changes_1 = changes; _a < changes_1.length; _a++) {
var change = changes_1[_a];
this._changeOneWhitespace(change.id, change.newAfterLineNumber, change.newHeight);
}
for (var _b = 0, removes_1 = removes; _b < removes_1.length; _b++) {
var remove = removes_1[_b];
var index = this._findWhitespaceIndex(remove.id);
if (index === -1) {
continue;
}
this._removeWhitespace(index);
}
return;
}
// simply rebuild the entire datastructure
var toRemove = new Set();
for (var _c = 0, removes_2 = removes; _c < removes_2.length; _c++) {
var remove = removes_2[_c];
toRemove.add(remove.id);
}
var toChange = new Map();
for (var _d = 0, changes_2 = changes; _d < changes_2.length; _d++) {
var change = changes_2[_d];
toChange.set(change.id, change);
}
var applyRemoveAndChange = function (whitespaces) {
var result = [];
for (var _i = 0, whitespaces_1 = whitespaces; _i < whitespaces_1.length; _i++) {
var whitespace = whitespaces_1[_i];
if (toRemove.has(whitespace.id)) {
continue;
}
if (toChange.has(whitespace.id)) {
var change = toChange.get(whitespace.id);
whitespace.afterLineNumber = change.newAfterLineNumber;
whitespace.height = change.newHeight;
}
result.push(whitespace);
}
return result;
};
var result = applyRemoveAndChange(this._arr).concat(applyRemoveAndChange(inserts));
result.sort(function (a, b) {
if (a.afterLineNumber === b.afterLineNumber) {
return a.ordinal - b.ordinal;
}
return a.afterLineNumber - b.afterLineNumber;
});
this._arr = result;
this._prefixSumValidIndex = -1;
};
LinesLayout.prototype._checkPendingChanges = function () {
if (this._pendingChanges.mustCommit()) {
this._pendingChanges.commit(this);
}
};
LinesLayout.prototype._insertWhitespace = function (whitespace) {
var insertIndex = LinesLayout.findInsertionIndex(this._arr, whitespace.afterLineNumber, whitespace.ordinal);
this._arr.splice(insertIndex, 0, whitespace);
this._prefixSumValidIndex = Math.min(this._prefixSumValidIndex, insertIndex - 1);
};
LinesLayout.prototype._findWhitespaceIndex = function (id) {
var arr = this._arr;
for (var i = 0, len = arr.length; i < len; i++) {
if (arr[i].id === id) {
return i;
}
}
return -1;
};
LinesLayout.prototype._changeOneWhitespace = function (id, newAfterLineNumber, newHeight) {
var 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) {
// `afterLineNumber` changed for this whitespace
// Record old whitespace
var whitespace = this._arr[index];
// Since changing `afterLineNumber` can trigger a reordering, we're gonna remove this whitespace
this._removeWhitespace(index);
whitespace.afterLineNumber = newAfterLineNumber;
// And add it again
this._insertWhitespace(whitespace);
}
};
LinesLayout.prototype._removeWhitespace = function (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
*/
LinesLayout.prototype.onLinesDeleted = function (fromLineNumber, toLineNumber) {
this._checkPendingChanges();
fromLineNumber = fromLineNumber | 0;
toLineNumber = toLineNumber | 0;
this._lineCount -= (toLineNumber - fromLineNumber + 1);
for (var i = 0, len = this._arr.length; i < len; i++) {
var afterLineNumber = this._arr[i].afterLineNumber;
if (fromLineNumber <= afterLineNumber && afterLineNumber <= toLineNumber) {
// The line this whitespace was after has been deleted
// => move whitespace to before first deleted line
this._arr[i].afterLineNumber = fromLineNumber - 1;
}
else if (afterLineNumber > toLineNumber) {
// The line this whitespace was after has been moved up
// => move whitespace up
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.
*/
LinesLayout.prototype.onLinesInserted = function (fromLineNumber, toLineNumber) {
this._checkPendingChanges();
fromLineNumber = fromLineNumber | 0;
toLineNumber = toLineNumber | 0;
this._lineCount += (toLineNumber - fromLineNumber + 1);
for (var i = 0, len = this._arr.length; i < len; i++) {
var afterLineNumber = this._arr[i].afterLineNumber;
if (fromLineNumber <= afterLineNumber) {
this._arr[i].afterLineNumber += (toLineNumber - fromLineNumber + 1);
}
}
};
/**
* Get the sum of all the whitespaces.
*/
LinesLayout.prototype.getWhitespacesTotalHeight = function () {
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`.
*/
LinesLayout.prototype.getWhitespacesAccumulatedHeight = function (index) {
this._checkPendingChanges();
index = index | 0;
var startIndex = Math.max(0, this._prefixSumValidIndex + 1);
if (startIndex === 0) {
this._arr[0].prefixSum = this._arr[0].height;
startIndex++;
}
for (var 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.
*/
LinesLayout.prototype.getLinesTotalHeight = function () {
this._checkPendingChanges();
var linesHeight = this._lineHeight * this._lineCount;
var whitespacesHeight = this.getWhitespacesTotalHeight();
return linesHeight + whitespacesHeight;
};
/**
* Returns the accumulated height of whitespaces before the given line number.
*
* @param lineNumber The line number
*/
LinesLayout.prototype.getWhitespaceAccumulatedHeightBeforeLineNumber = function (lineNumber) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
var lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber);
if (lastWhitespaceBeforeLineNumber === -1) {
return 0;
}
return this.getWhitespacesAccumulatedHeight(lastWhitespaceBeforeLineNumber);
};
LinesLayout.prototype._findLastWhitespaceBeforeLineNumber = function (lineNumber) {
lineNumber = lineNumber | 0;
// Find the whitespace before line number
var arr = this._arr;
var low = 0;
var high = arr.length - 1;
while (low <= high) {
var delta = (high - low) | 0;
var halfDelta = (delta / 2) | 0;
var 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;
};
LinesLayout.prototype._findFirstWhitespaceAfterLineNumber = function (lineNumber) {
lineNumber = lineNumber | 0;
var lastWhitespaceBeforeLineNumber = this._findLastWhitespaceBeforeLineNumber(lineNumber);
var 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.
*/
LinesLayout.prototype.getFirstWhitespaceIndexAfterLineNumber = function (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`.
*/
LinesLayout.prototype.getVerticalOffsetForLineNumber = function (lineNumber) {
this._checkPendingChanges();
lineNumber = lineNumber | 0;
var previousLinesHeight;
if (lineNumber > 1) {
previousLinesHeight = this._lineHeight * (lineNumber - 1);
}
else {
previousLinesHeight = 0;
}
var previousWhitespacesHeight = this.getWhitespaceAccumulatedHeightBeforeLineNumber(lineNumber);
return previousLinesHeight + previousWhitespacesHeight;
};
/**
* The maximum min width for all whitespaces.
*/
LinesLayout.prototype.getWhitespaceMinWidth = function () {
this._checkPendingChanges();
if (this._minWidth === -1) {
var minWidth = 0;
for (var 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.
*/
LinesLayout.prototype.isAfterLines = function (verticalOffset) {
this._checkPendingChanges();
var totalHeight = this.getLinesTotalHeight();
return verticalOffset > totalHeight;
};
/**
* 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`.
*/
LinesLayout.prototype.getLineNumberAtOrAfterVerticalOffset = function (verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
if (verticalOffset < 0) {
return 1;
}
var linesCount = this._lineCount | 0;
var lineHeight = this._lineHeight;
var minLineNumber = 1;
var maxLineNumber = linesCount;
while (minLineNumber < maxLineNumber) {
var midLineNumber = ((minLineNumber + maxLineNumber) / 2) | 0;
var midLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(midLineNumber) | 0;
if (verticalOffset >= midLineNumberVerticalOffset + lineHeight) {
// vertical offset is after mid line number
minLineNumber = midLineNumber + 1;
}
else if (verticalOffset >= midLineNumberVerticalOffset) {
// Hit
return midLineNumber;
}
else {
// vertical offset is before mid line number, but mid line number could still be what we're searching for
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`.
*/
LinesLayout.prototype.getLinesViewportData = function (verticalOffset1, verticalOffset2) {
this._checkPendingChanges();
verticalOffset1 = verticalOffset1 | 0;
verticalOffset2 = verticalOffset2 | 0;
var lineHeight = this._lineHeight;
// Find first line number
// We don't live in a perfect world, so the line number might start before or after verticalOffset1
var startLineNumber = this.getLineNumberAtOrAfterVerticalOffset(verticalOffset1) | 0;
var startLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(startLineNumber) | 0;
var endLineNumber = this._lineCount | 0;
// Also keep track of what whitespace we've got
var whitespaceIndex = this.getFirstWhitespaceIndexAfterLineNumber(startLineNumber) | 0;
var whitespaceCount = this.getWhitespacesCount() | 0;
var currentWhitespaceHeight;
var currentWhitespaceAfterLineNumber;
if (whitespaceIndex === -1) {
whitespaceIndex = whitespaceCount;
currentWhitespaceAfterLineNumber = endLineNumber + 1;
currentWhitespaceHeight = 0;
}
else {
currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0;
currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0;
}
var currentVerticalOffset = startLineNumberVerticalOffset;
var currentLineRelativeOffset = currentVerticalOffset;
// IE (all versions) cannot handle units above about 1,533,908 px, so every 500k pixels bring numbers down
var STEP_SIZE = 500000;
var bigNumbersDelta = 0;
if (startLineNumberVerticalOffset >= STEP_SIZE) {
// Compute a delta that guarantees that lines are positioned at `lineHeight` increments
bigNumbersDelta = Math.floor(startLineNumberVerticalOffset / STEP_SIZE) * STEP_SIZE;
bigNumbersDelta = Math.floor(bigNumbersDelta / lineHeight) * lineHeight;
currentLineRelativeOffset -= bigNumbersDelta;
}
var linesOffsets = [];
var verticalCenter = verticalOffset1 + (verticalOffset2 - verticalOffset1) / 2;
var centeredLineNumber = -1;
// Figure out how far the lines go
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
if (centeredLineNumber === -1) {
var currentLineTop = currentVerticalOffset;
var currentLineBottom = currentVerticalOffset + lineHeight;
if ((currentLineTop <= verticalCenter && verticalCenter < currentLineBottom) || currentLineTop > verticalCenter) {
centeredLineNumber = lineNumber;
}
}
// Count current line height in the vertical offsets
currentVerticalOffset += lineHeight;
linesOffsets[lineNumber - startLineNumber] = currentLineRelativeOffset;
// Next line starts immediately after this one
currentLineRelativeOffset += lineHeight;
while (currentWhitespaceAfterLineNumber === lineNumber) {
// Push down next line with the height of the current whitespace
currentLineRelativeOffset += currentWhitespaceHeight;
// Count current whitespace in the vertical offsets
currentVerticalOffset += currentWhitespaceHeight;
whitespaceIndex++;
if (whitespaceIndex >= whitespaceCount) {
currentWhitespaceAfterLineNumber = endLineNumber + 1;
}
else {
currentWhitespaceAfterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex) | 0;
currentWhitespaceHeight = this.getHeightForWhitespaceIndex(whitespaceIndex) | 0;
}
}
if (currentVerticalOffset >= verticalOffset2) {
// We have covered the entire viewport area, time to stop
endLineNumber = lineNumber;
break;
}
}
if (centeredLineNumber === -1) {
centeredLineNumber = endLineNumber;
}
var endLineNumberVerticalOffset = this.getVerticalOffsetForLineNumber(endLineNumber) | 0;
var completelyVisibleStartLineNumber = startLineNumber;
var completelyVisibleEndLineNumber = endLineNumber;
if (completelyVisibleStartLineNumber < completelyVisibleEndLineNumber) {
if (startLineNumberVerticalOffset < verticalOffset1) {
completelyVisibleStartLineNumber++;
}
}
if (completelyVisibleStartLineNumber < completelyVisibleEndLineNumber) {
if (endLineNumberVerticalOffset + lineHeight > verticalOffset2) {
completelyVisibleEndLineNumber--;
}
}
return {
bigNumbersDelta: bigNumbersDelta,
startLineNumber: startLineNumber,
endLineNumber: endLineNumber,
relativeVerticalOffset: linesOffsets,
centeredLineNumber: centeredLineNumber,
completelyVisibleStartLineNumber: completelyVisibleStartLineNumber,
completelyVisibleEndLineNumber: completelyVisibleEndLineNumber
};
};
LinesLayout.prototype.getVerticalOffsetForWhitespaceIndex = function (whitespaceIndex) {
this._checkPendingChanges();
whitespaceIndex = whitespaceIndex | 0;
var afterLineNumber = this.getAfterLineNumberForWhitespaceIndex(whitespaceIndex);
var previousLinesHeight;
if (afterLineNumber >= 1) {
previousLinesHeight = this._lineHeight * afterLineNumber;
}
else {
previousLinesHeight = 0;
}
var previousWhitespacesHeight;
if (whitespaceIndex > 0) {
previousWhitespacesHeight = this.getWhitespacesAccumulatedHeight(whitespaceIndex - 1);
}
else {
previousWhitespacesHeight = 0;
}
return previousLinesHeight + previousWhitespacesHeight;
};
LinesLayout.prototype.getWhitespaceIndexAtOrAfterVerticallOffset = function (verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
var minWhitespaceIndex = 0;
var maxWhitespaceIndex = this.getWhitespacesCount() - 1;
if (maxWhitespaceIndex < 0) {
return -1;
}
// Special case: nothing to be found
var maxWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(maxWhitespaceIndex);
var maxWhitespaceHeight = this.getHeightForWhitespaceIndex(maxWhitespaceIndex);
if (verticalOffset >= maxWhitespaceVerticalOffset + maxWhitespaceHeight) {
return -1;
}
while (minWhitespaceIndex < maxWhitespaceIndex) {
var midWhitespaceIndex = Math.floor((minWhitespaceIndex + maxWhitespaceIndex) / 2);
var midWhitespaceVerticalOffset = this.getVerticalOffsetForWhitespaceIndex(midWhitespaceIndex);
var midWhitespaceHeight = this.getHeightForWhitespaceIndex(midWhitespaceIndex);
if (verticalOffset >= midWhitespaceVerticalOffset + midWhitespaceHeight) {
// vertical offset is after whitespace
minWhitespaceIndex = midWhitespaceIndex + 1;
}
else if (verticalOffset >= midWhitespaceVerticalOffset) {
// Hit
return midWhitespaceIndex;
}
else {
// vertical offset is before whitespace, but midWhitespaceIndex might still be what we're searching for
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.
*/
LinesLayout.prototype.getWhitespaceAtVerticalOffset = function (verticalOffset) {
this._checkPendingChanges();
verticalOffset = verticalOffset | 0;
var candidateIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset);
if (candidateIndex < 0) {
return null;
}
if (candidateIndex >= this.getWhitespacesCount()) {
return null;
}
var candidateTop = this.getVerticalOffsetForWhitespaceIndex(candidateIndex);
if (candidateTop > verticalOffset) {
return null;
}
var candidateHeight = this.getHeightForWhitespaceIndex(candidateIndex);
var candidateId = this.getIdForWhitespaceIndex(candidateIndex);
var 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.
*/
LinesLayout.prototype.getWhitespaceViewportData = function (verticalOffset1, verticalOffset2) {
this._checkPendingChanges();
verticalOffset1 = verticalOffset1 | 0;
verticalOffset2 = verticalOffset2 | 0;
var startIndex = this.getWhitespaceIndexAtOrAfterVerticallOffset(verticalOffset1);
var endIndex = this.getWhitespacesCount() - 1;
if (startIndex < 0) {
return [];
}
var result = [];
for (var i = startIndex; i <= endIndex; i++) {
var top_1 = this.getVerticalOffsetForWhitespaceIndex(i);
var height = this.getHeightForWhitespaceIndex(i);
if (top_1 >= verticalOffset2) {
break;
}
result.push({
id: this.getIdForWhitespaceIndex(i),
afterLineNumber: this.getAfterLineNumberForWhitespaceIndex(i),
verticalOffset: top_1,
height: height
});
}
return result;
};
/**
* Get all whitespaces.
*/
LinesLayout.prototype.getWhitespaces = function () {
this._checkPendingChanges();
return this._arr.slice(0);
};
/**
* The number of whitespaces.
*/
LinesLayout.prototype.getWhitespacesCount = function () {
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`.
*/
LinesLayout.prototype.getIdForWhitespaceIndex = function (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`.
*/
LinesLayout.prototype.getAfterLineNumberForWhitespaceIndex = function (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`.
*/
LinesLayout.prototype.getHeightForWhitespaceIndex = function (index) {
this._checkPendingChanges();
index = index | 0;
return this._arr[index].height;
};
LinesLayout.INSTANCE_COUNT = 0;
return LinesLayout;
}());
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModel.js
var viewModel_viewModel = __webpack_require__(62);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewLayout/viewLayout.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewLayout_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var SMOOTH_SCROLLING_TIME = 125;
var EditorScrollDimensions = /** @class */ (function () {
function EditorScrollDimensions(width, contentWidth, height, contentHeight) {
width = width | 0;
contentWidth = contentWidth | 0;
height = height | 0;
contentHeight = contentHeight | 0;
if (width < 0) {
width = 0;
}
if (contentWidth < 0) {
contentWidth = 0;
}
if (height < 0) {
height = 0;
}
if (contentHeight < 0) {
contentHeight = 0;
}
this.width = width;
this.contentWidth = contentWidth;
this.scrollWidth = Math.max(width, contentWidth);
this.height = height;
this.contentHeight = contentHeight;
this.scrollHeight = Math.max(height, contentHeight);
}
EditorScrollDimensions.prototype.equals = function (other) {
return (this.width === other.width
&& this.contentWidth === other.contentWidth
&& this.height === other.height
&& this.contentHeight === other.contentHeight);
};
return EditorScrollDimensions;
}());
var viewLayout_EditorScrollable = /** @class */ (function (_super) {
viewLayout_extends(EditorScrollable, _super);
function EditorScrollable(smoothScrollDuration, scheduleAtNextAnimationFrame) {
var _this = _super.call(this) || this;
_this._onDidContentSizeChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidContentSizeChange = _this._onDidContentSizeChange.event;
_this._dimensions = new EditorScrollDimensions(0, 0, 0, 0);
_this._scrollable = _this._register(new scrollable["a" /* Scrollable */](smoothScrollDuration, scheduleAtNextAnimationFrame));
_this.onDidScroll = _this._scrollable.onScroll;
return _this;
}
EditorScrollable.prototype.getScrollable = function () {
return this._scrollable;
};
EditorScrollable.prototype.setSmoothScrollDuration = function (smoothScrollDuration) {
this._scrollable.setSmoothScrollDuration(smoothScrollDuration);
};
EditorScrollable.prototype.validateScrollPosition = function (scrollPosition) {
return this._scrollable.validateScrollPosition(scrollPosition);
};
EditorScrollable.prototype.getScrollDimensions = function () {
return this._dimensions;
};
EditorScrollable.prototype.setScrollDimensions = function (dimensions) {
if (this._dimensions.equals(dimensions)) {
return;
}
var oldDimensions = this._dimensions;
this._dimensions = dimensions;
this._scrollable.setScrollDimensions({
width: dimensions.width,
scrollWidth: dimensions.scrollWidth,
height: dimensions.height,
scrollHeight: dimensions.scrollHeight
});
var contentWidthChanged = (oldDimensions.contentWidth !== dimensions.contentWidth);
var contentHeightChanged = (oldDimensions.contentHeight !== dimensions.contentHeight);
if (contentWidthChanged || contentHeightChanged) {
this._onDidContentSizeChange.fire({
contentWidth: dimensions.contentWidth,
contentHeight: dimensions.contentHeight,
contentWidthChanged: contentWidthChanged,
contentHeightChanged: contentHeightChanged
});
}
};
EditorScrollable.prototype.getFutureScrollPosition = function () {
return this._scrollable.getFutureScrollPosition();
};
EditorScrollable.prototype.getCurrentScrollPosition = function () {
return this._scrollable.getCurrentScrollPosition();
};
EditorScrollable.prototype.setScrollPositionNow = function (update) {
this._scrollable.setScrollPositionNow(update);
};
EditorScrollable.prototype.setScrollPositionSmooth = function (update) {
this._scrollable.setScrollPositionSmooth(update);
};
return EditorScrollable;
}(lifecycle["a" /* Disposable */]));
var viewLayout_ViewLayout = /** @class */ (function (_super) {
viewLayout_extends(ViewLayout, _super);
function ViewLayout(configuration, lineCount, scheduleAtNextAnimationFrame) {
var _this = _super.call(this) || this;
_this._configuration = configuration;
var options = _this._configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
_this._linesLayout = new linesLayout_LinesLayout(lineCount, options.get(49 /* lineHeight */));
_this._scrollable = _this._register(new viewLayout_EditorScrollable(0, scheduleAtNextAnimationFrame));
_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();
return _this;
}
ViewLayout.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
ViewLayout.prototype.getScrollable = function () {
return this._scrollable.getScrollable();
};
ViewLayout.prototype.onHeightMaybeChanged = function () {
this._updateHeight();
};
ViewLayout.prototype._configureSmoothScrollDuration = function () {
this._scrollable.setSmoothScrollDuration(this._configuration.options.get(87 /* smoothScrolling */) ? SMOOTH_SCROLLING_TIME : 0);
};
// ---- begin view event handlers
ViewLayout.prototype.onConfigurationChanged = function (e) {
var options = this._configuration.options;
if (e.hasChanged(49 /* lineHeight */)) {
this._linesLayout.setLineHeight(options.get(49 /* lineHeight */));
}
if (e.hasChanged(107 /* layoutInfo */)) {
var layoutInfo = options.get(107 /* layoutInfo */);
var width = layoutInfo.contentWidth;
var height = layoutInfo.height;
var scrollDimensions = this._scrollable.getScrollDimensions();
var scrollWidth = scrollDimensions.scrollWidth;
this._scrollable.setScrollDimensions(new EditorScrollDimensions(width, scrollDimensions.contentWidth, height, this._getContentHeight(width, height, scrollWidth)));
}
else {
this._updateHeight();
}
if (e.hasChanged(87 /* smoothScrolling */)) {
this._configureSmoothScrollDuration();
}
};
ViewLayout.prototype.onFlushed = function (lineCount) {
this._linesLayout.onFlushed(lineCount);
};
ViewLayout.prototype.onLinesDeleted = function (fromLineNumber, toLineNumber) {
this._linesLayout.onLinesDeleted(fromLineNumber, toLineNumber);
};
ViewLayout.prototype.onLinesInserted = function (fromLineNumber, toLineNumber) {
this._linesLayout.onLinesInserted(fromLineNumber, toLineNumber);
};
// ---- end view event handlers
ViewLayout.prototype._getHorizontalScrollbarHeight = function (width, scrollWidth) {
var options = this._configuration.options;
var scrollbar = options.get(78 /* scrollbar */);
if (scrollbar.horizontal === 2 /* Hidden */) {
// horizontal scrollbar not visible
return 0;
}
if (width >= scrollWidth) {
// horizontal scrollbar not visible
return 0;
}
return scrollbar.horizontalScrollbarSize;
};
ViewLayout.prototype._getContentHeight = function (width, height, scrollWidth) {
var options = this._configuration.options;
var result = this._linesLayout.getLinesTotalHeight();
if (options.get(80 /* scrollBeyondLastLine */)) {
result += height - options.get(49 /* lineHeight */);
}
else {
result += this._getHorizontalScrollbarHeight(width, scrollWidth);
}
return result;
};
ViewLayout.prototype._updateHeight = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
var width = scrollDimensions.width;
var height = scrollDimensions.height;
var scrollWidth = scrollDimensions.scrollWidth;
this._scrollable.setScrollDimensions(new EditorScrollDimensions(width, scrollDimensions.contentWidth, height, this._getContentHeight(width, height, scrollWidth)));
};
// ---- Layouting logic
ViewLayout.prototype.getCurrentViewport = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
var currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return new viewModel_viewModel["f" /* Viewport */](currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, scrollDimensions.width, scrollDimensions.height);
};
ViewLayout.prototype.getFutureViewport = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
var currentScrollPosition = this._scrollable.getFutureScrollPosition();
return new viewModel_viewModel["f" /* Viewport */](currentScrollPosition.scrollTop, currentScrollPosition.scrollLeft, scrollDimensions.width, scrollDimensions.height);
};
ViewLayout.prototype._computeContentWidth = function (maxLineWidth) {
var options = this._configuration.options;
var wrappingInfo = options.get(108 /* wrappingInfo */);
var fontInfo = options.get(34 /* fontInfo */);
if (wrappingInfo.isViewportWrapping) {
var layoutInfo = options.get(107 /* layoutInfo */);
var minimap = options.get(54 /* minimap */);
if (maxLineWidth > layoutInfo.contentWidth + fontInfo.typicalHalfwidthCharacterWidth) {
// This is a case where viewport wrapping is on, but the line extends above the viewport
if (minimap.enabled && minimap.side === 'right') {
// We need to accomodate the scrollbar width
return maxLineWidth + layoutInfo.verticalScrollbarWidth;
}
}
return maxLineWidth;
}
else {
var extraHorizontalSpace = options.get(79 /* scrollBeyondLastColumn */) * fontInfo.typicalHalfwidthCharacterWidth;
var whitespaceMinWidth = this._linesLayout.getWhitespaceMinWidth();
return Math.max(maxLineWidth + extraHorizontalSpace, whitespaceMinWidth);
}
};
ViewLayout.prototype.onMaxLineWidthChanged = function (maxLineWidth) {
var scrollDimensions = this._scrollable.getScrollDimensions();
// const newScrollWidth = ;
this._scrollable.setScrollDimensions(new EditorScrollDimensions(scrollDimensions.width, this._computeContentWidth(maxLineWidth), scrollDimensions.height, scrollDimensions.contentHeight));
// The height might depend on the fact that there is a horizontal scrollbar or not
this._updateHeight();
};
// ---- view state
ViewLayout.prototype.saveState = function () {
var currentScrollPosition = this._scrollable.getFutureScrollPosition();
var scrollTop = currentScrollPosition.scrollTop;
var firstLineNumberInViewport = this._linesLayout.getLineNumberAtOrAfterVerticalOffset(scrollTop);
var whitespaceAboveFirstLine = this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(firstLineNumberInViewport);
return {
scrollTop: scrollTop,
scrollTopWithoutViewZones: scrollTop - whitespaceAboveFirstLine,
scrollLeft: currentScrollPosition.scrollLeft
};
};
// ---- IVerticalLayoutProvider
ViewLayout.prototype.changeWhitespace = function (callback) {
return this._linesLayout.changeWhitespace(callback);
};
ViewLayout.prototype.getVerticalOffsetForLineNumber = function (lineNumber) {
return this._linesLayout.getVerticalOffsetForLineNumber(lineNumber);
};
ViewLayout.prototype.isAfterLines = function (verticalOffset) {
return this._linesLayout.isAfterLines(verticalOffset);
};
ViewLayout.prototype.getLineNumberAtVerticalOffset = function (verticalOffset) {
return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(verticalOffset);
};
ViewLayout.prototype.getWhitespaceAtVerticalOffset = function (verticalOffset) {
return this._linesLayout.getWhitespaceAtVerticalOffset(verticalOffset);
};
ViewLayout.prototype.getLinesViewportData = function () {
var visibleBox = this.getCurrentViewport();
return this._linesLayout.getLinesViewportData(visibleBox.top, visibleBox.top + visibleBox.height);
};
ViewLayout.prototype.getLinesViewportDataAtScrollTop = function (scrollTop) {
// do some minimal validations on scrollTop
var 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);
};
ViewLayout.prototype.getWhitespaceViewportData = function () {
var visibleBox = this.getCurrentViewport();
return this._linesLayout.getWhitespaceViewportData(visibleBox.top, visibleBox.top + visibleBox.height);
};
ViewLayout.prototype.getWhitespaces = function () {
return this._linesLayout.getWhitespaces();
};
// ---- IScrollingProvider
ViewLayout.prototype.getContentWidth = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.contentWidth;
};
ViewLayout.prototype.getScrollWidth = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.scrollWidth;
};
ViewLayout.prototype.getContentHeight = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.contentHeight;
};
ViewLayout.prototype.getScrollHeight = function () {
var scrollDimensions = this._scrollable.getScrollDimensions();
return scrollDimensions.scrollHeight;
};
ViewLayout.prototype.getCurrentScrollLeft = function () {
var currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return currentScrollPosition.scrollLeft;
};
ViewLayout.prototype.getCurrentScrollTop = function () {
var currentScrollPosition = this._scrollable.getCurrentScrollPosition();
return currentScrollPosition.scrollTop;
};
ViewLayout.prototype.validateScrollPosition = function (scrollPosition) {
return this._scrollable.validateScrollPosition(scrollPosition);
};
ViewLayout.prototype.setScrollPositionNow = function (position) {
this._scrollable.setScrollPositionNow(position);
};
ViewLayout.prototype.setScrollPositionSmooth = function (position) {
this._scrollable.setScrollPositionSmooth(position);
};
ViewLayout.prototype.deltaScrollNow = function (deltaScrollLeft, deltaScrollTop) {
var currentScrollPosition = this._scrollable.getCurrentScrollPosition();
this._scrollable.setScrollPositionNow({
scrollLeft: currentScrollPosition.scrollLeft + deltaScrollLeft,
scrollTop: currentScrollPosition.scrollTop + deltaScrollTop
});
};
return ViewLayout;
}(lifecycle["a" /* Disposable */]));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/model/textModel.js + 9 modules
var textModel = __webpack_require__(30);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/prefixSumComputer.js
var prefixSumComputer = __webpack_require__(232);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/splitLinesCollection.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var OutputPosition = /** @class */ (function () {
function OutputPosition(outputLineIndex, outputOffset) {
this.outputLineIndex = outputLineIndex;
this.outputOffset = outputOffset;
}
return OutputPosition;
}());
var LineBreakData = /** @class */ (function () {
function LineBreakData(breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength) {
this.breakOffsets = breakOffsets;
this.breakOffsetsVisibleColumn = breakOffsetsVisibleColumn;
this.wrappedTextIndentLength = wrappedTextIndentLength;
}
LineBreakData.getInputOffsetOfOutputPosition = function (breakOffsets, outputLineIndex, outputOffset) {
if (outputLineIndex === 0) {
return outputOffset;
}
else {
return breakOffsets[outputLineIndex - 1] + outputOffset;
}
};
LineBreakData.getOutputPositionOfInputOffset = function (breakOffsets, inputOffset) {
var low = 0;
var high = breakOffsets.length - 1;
var mid = 0;
var midStart = 0;
while (low <= high) {
mid = low + ((high - low) / 2) | 0;
var midStop = breakOffsets[mid];
midStart = mid > 0 ? breakOffsets[mid - 1] : 0;
if (inputOffset < midStart) {
high = mid - 1;
}
else if (inputOffset >= midStop) {
low = mid + 1;
}
else {
break;
}
}
return new OutputPosition(mid, inputOffset - midStart);
};
return LineBreakData;
}());
var CoordinatesConverter = /** @class */ (function () {
function CoordinatesConverter(lines) {
this._lines = lines;
}
// View -> Model conversion and related methods
CoordinatesConverter.prototype.convertViewPositionToModelPosition = function (viewPosition) {
return this._lines.convertViewPositionToModelPosition(viewPosition.lineNumber, viewPosition.column);
};
CoordinatesConverter.prototype.convertViewRangeToModelRange = function (viewRange) {
return this._lines.convertViewRangeToModelRange(viewRange);
};
CoordinatesConverter.prototype.validateViewPosition = function (viewPosition, expectedModelPosition) {
return this._lines.validateViewPosition(viewPosition.lineNumber, viewPosition.column, expectedModelPosition);
};
CoordinatesConverter.prototype.validateViewRange = function (viewRange, expectedModelRange) {
return this._lines.validateViewRange(viewRange, expectedModelRange);
};
// Model -> View conversion and related methods
CoordinatesConverter.prototype.convertModelPositionToViewPosition = function (modelPosition) {
return this._lines.convertModelPositionToViewPosition(modelPosition.lineNumber, modelPosition.column);
};
CoordinatesConverter.prototype.convertModelRangeToViewRange = function (modelRange) {
return this._lines.convertModelRangeToViewRange(modelRange);
};
CoordinatesConverter.prototype.modelPositionIsVisible = function (modelPosition) {
return this._lines.modelPositionIsVisible(modelPosition.lineNumber, modelPosition.column);
};
return CoordinatesConverter;
}());
var splitLinesCollection_LineNumberMapper = /** @class */ (function () {
function LineNumberMapper(viewLineCounts) {
this._counts = viewLineCounts;
this._isValid = false;
this._validEndIndex = -1;
this._modelToView = [];
this._viewToModel = [];
}
LineNumberMapper.prototype._invalidate = function (index) {
this._isValid = false;
this._validEndIndex = Math.min(this._validEndIndex, index - 1);
};
LineNumberMapper.prototype._ensureValid = function () {
if (this._isValid) {
return;
}
for (var i = this._validEndIndex + 1, len = this._counts.length; i < len; i++) {
var viewLineCount = this._counts[i];
var viewLinesAbove = (i > 0 ? this._modelToView[i - 1] : 0);
this._modelToView[i] = viewLinesAbove + viewLineCount;
for (var j = 0; j < viewLineCount; j++) {
this._viewToModel[viewLinesAbove + j] = i;
}
}
// trim things
this._modelToView.length = this._counts.length;
this._viewToModel.length = this._modelToView[this._modelToView.length - 1];
// mark as valid
this._isValid = true;
this._validEndIndex = this._counts.length - 1;
};
LineNumberMapper.prototype.changeValue = function (index, value) {
if (this._counts[index] === value) {
// no change
return;
}
this._counts[index] = value;
this._invalidate(index);
};
LineNumberMapper.prototype.removeValues = function (start, deleteCount) {
this._counts.splice(start, deleteCount);
this._invalidate(start);
};
LineNumberMapper.prototype.insertValues = function (insertIndex, insertArr) {
this._counts = arrays["a" /* arrayInsert */](this._counts, insertIndex, insertArr);
this._invalidate(insertIndex);
};
LineNumberMapper.prototype.getTotalValue = function () {
this._ensureValid();
return this._viewToModel.length;
};
LineNumberMapper.prototype.getAccumulatedValue = function (index) {
this._ensureValid();
return this._modelToView[index];
};
LineNumberMapper.prototype.getIndexOf = function (accumulatedValue) {
this._ensureValid();
var modelLineIndex = this._viewToModel[accumulatedValue];
var viewLinesAbove = (modelLineIndex > 0 ? this._modelToView[modelLineIndex - 1] : 0);
return new prefixSumComputer["b" /* PrefixSumIndexOfResult */](modelLineIndex, accumulatedValue - viewLinesAbove);
};
return LineNumberMapper;
}());
var splitLinesCollection_SplitLinesCollection = /** @class */ (function () {
function SplitLinesCollection(model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, fontInfo, tabSize, wrappingStrategy, wrappingColumn, wrappingIndent) {
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._constructLines(/*resetHiddenAreas*/ true, null);
}
SplitLinesCollection.prototype.dispose = function () {
this.hiddenAreasIds = this.model.deltaDecorations(this.hiddenAreasIds, []);
};
SplitLinesCollection.prototype.createCoordinatesConverter = function () {
return new CoordinatesConverter(this);
};
SplitLinesCollection.prototype._constructLines = function (resetHiddenAreas, previousLineBreaks) {
var _this = this;
this.lines = [];
if (resetHiddenAreas) {
this.hiddenAreasIds = [];
}
var linesContent = this.model.getLinesContent();
var lineCount = linesContent.length;
var lineBreaksComputer = this.createLineBreaksComputer();
for (var i = 0; i < lineCount; i++) {
lineBreaksComputer.addRequest(linesContent[i], previousLineBreaks ? previousLineBreaks[i] : null);
}
var linesBreaks = lineBreaksComputer.finalize();
var values = [];
var hiddenAreas = this.hiddenAreasIds.map(function (areaId) { return _this.model.getDecorationRange(areaId); }).sort(core_range["a" /* Range */].compareRangesUsingStarts);
var hiddenAreaStart = 1, hiddenAreaEnd = 0;
var hiddenAreaIdx = -1;
var nextLineNumberToUpdateHiddenArea = (hiddenAreaIdx + 1 < hiddenAreas.length) ? hiddenAreaEnd + 1 : lineCount + 2;
for (var i = 0; i < lineCount; i++) {
var lineNumber = i + 1;
if (lineNumber === nextLineNumberToUpdateHiddenArea) {
hiddenAreaIdx++;
hiddenAreaStart = hiddenAreas[hiddenAreaIdx].startLineNumber;
hiddenAreaEnd = hiddenAreas[hiddenAreaIdx].endLineNumber;
nextLineNumberToUpdateHiddenArea = (hiddenAreaIdx + 1 < hiddenAreas.length) ? hiddenAreaEnd + 1 : lineCount + 2;
}
var isInHiddenArea = (lineNumber >= hiddenAreaStart && lineNumber <= hiddenAreaEnd);
var line = createSplitLine(linesBreaks[i], !isInHiddenArea);
values[i] = line.getViewLineCount();
this.lines[i] = line;
}
this._validModelVersionId = this.model.getVersionId();
this.prefixSumComputer = new splitLinesCollection_LineNumberMapper(values);
};
SplitLinesCollection.prototype.getHiddenAreas = function () {
var _this = this;
return this.hiddenAreasIds.map(function (decId) {
return _this.model.getDecorationRange(decId);
});
};
SplitLinesCollection.prototype._reduceRanges = function (_ranges) {
var _this = this;
if (_ranges.length === 0) {
return [];
}
var ranges = _ranges.map(function (r) { return _this.model.validateRange(r); }).sort(core_range["a" /* Range */].compareRangesUsingStarts);
var result = [];
var currentRangeStart = ranges[0].startLineNumber;
var currentRangeEnd = ranges[0].endLineNumber;
for (var i = 1, len = ranges.length; i < len; i++) {
var range = ranges[i];
if (range.startLineNumber > currentRangeEnd + 1) {
result.push(new core_range["a" /* Range */](currentRangeStart, 1, currentRangeEnd, 1));
currentRangeStart = range.startLineNumber;
currentRangeEnd = range.endLineNumber;
}
else if (range.endLineNumber > currentRangeEnd) {
currentRangeEnd = range.endLineNumber;
}
}
result.push(new core_range["a" /* Range */](currentRangeStart, 1, currentRangeEnd, 1));
return result;
};
SplitLinesCollection.prototype.setHiddenAreas = function (_ranges) {
var _this = this;
var newRanges = this._reduceRanges(_ranges);
// BEGIN TODO@Martin: Please stop calling this method on each model change!
var oldRanges = this.hiddenAreasIds.map(function (areaId) { return _this.model.getDecorationRange(areaId); }).sort(core_range["a" /* Range */].compareRangesUsingStarts);
if (newRanges.length === oldRanges.length) {
var hasDifference = false;
for (var i = 0; i < newRanges.length; i++) {
if (!newRanges[i].equalsRange(oldRanges[i])) {
hasDifference = true;
break;
}
}
if (!hasDifference) {
return false;
}
}
// END TODO@Martin: Please stop calling this method on each model change!
var newDecorations = [];
for (var _i = 0, newRanges_1 = newRanges; _i < newRanges_1.length; _i++) {
var newRange = newRanges_1[_i];
newDecorations.push({
range: newRange,
options: textModel["a" /* ModelDecorationOptions */].EMPTY
});
}
this.hiddenAreasIds = this.model.deltaDecorations(this.hiddenAreasIds, newDecorations);
var hiddenAreas = newRanges;
var hiddenAreaStart = 1, hiddenAreaEnd = 0;
var hiddenAreaIdx = -1;
var nextLineNumberToUpdateHiddenArea = (hiddenAreaIdx + 1 < hiddenAreas.length) ? hiddenAreaEnd + 1 : this.lines.length + 2;
var hasVisibleLine = false;
for (var i = 0; i < this.lines.length; i++) {
var lineNumber = i + 1;
if (lineNumber === nextLineNumberToUpdateHiddenArea) {
hiddenAreaIdx++;
hiddenAreaStart = hiddenAreas[hiddenAreaIdx].startLineNumber;
hiddenAreaEnd = hiddenAreas[hiddenAreaIdx].endLineNumber;
nextLineNumberToUpdateHiddenArea = (hiddenAreaIdx + 1 < hiddenAreas.length) ? hiddenAreaEnd + 1 : this.lines.length + 2;
}
var lineChanged = false;
if (lineNumber >= hiddenAreaStart && lineNumber <= hiddenAreaEnd) {
// Line should be hidden
if (this.lines[i].isVisible()) {
this.lines[i] = this.lines[i].setVisible(false);
lineChanged = true;
}
}
else {
hasVisibleLine = true;
// Line should be visible
if (!this.lines[i].isVisible()) {
this.lines[i] = this.lines[i].setVisible(true);
lineChanged = true;
}
}
if (lineChanged) {
var newOutputLineCount = this.lines[i].getViewLineCount();
this.prefixSumComputer.changeValue(i, newOutputLineCount);
}
}
if (!hasVisibleLine) {
// Cannot have everything be hidden => reveal everything!
this.setHiddenAreas([]);
}
return true;
};
SplitLinesCollection.prototype.modelPositionIsVisible = function (modelLineNumber, _modelColumn) {
if (modelLineNumber < 1 || modelLineNumber > this.lines.length) {
// invalid arguments
return false;
}
return this.lines[modelLineNumber - 1].isVisible();
};
SplitLinesCollection.prototype.setTabSize = function (newTabSize) {
if (this.tabSize === newTabSize) {
return false;
}
this.tabSize = newTabSize;
this._constructLines(/*resetHiddenAreas*/ false, null);
return true;
};
SplitLinesCollection.prototype.setWrappingSettings = function (fontInfo, wrappingStrategy, wrappingColumn, wrappingIndent) {
var equalFontInfo = this.fontInfo.equals(fontInfo);
var equalWrappingStrategy = (this.wrappingStrategy === wrappingStrategy);
var equalWrappingColumn = (this.wrappingColumn === wrappingColumn);
var equalWrappingIndent = (this.wrappingIndent === wrappingIndent);
if (equalFontInfo && equalWrappingStrategy && equalWrappingColumn && equalWrappingIndent) {
return false;
}
var onlyWrappingColumnChanged = (equalFontInfo && equalWrappingStrategy && !equalWrappingColumn && equalWrappingIndent);
this.fontInfo = fontInfo;
this.wrappingStrategy = wrappingStrategy;
this.wrappingColumn = wrappingColumn;
this.wrappingIndent = wrappingIndent;
var previousLineBreaks = null;
if (onlyWrappingColumnChanged) {
previousLineBreaks = [];
for (var i = 0, len = this.lines.length; i < len; i++) {
previousLineBreaks[i] = this.lines[i].getLineBreakData();
}
}
this._constructLines(/*resetHiddenAreas*/ false, previousLineBreaks);
return true;
};
SplitLinesCollection.prototype.createLineBreaksComputer = function () {
var lineBreaksComputerFactory = (this.wrappingStrategy === 'advanced'
? this._domLineBreaksComputerFactory
: this._monospaceLineBreaksComputerFactory);
return lineBreaksComputerFactory.createLineBreaksComputer(this.fontInfo, this.tabSize, this.wrappingColumn, this.wrappingIndent);
};
SplitLinesCollection.prototype.onModelFlushed = function () {
this._constructLines(/*resetHiddenAreas*/ true, null);
};
SplitLinesCollection.prototype.onModelLinesDeleted = function (versionId, fromLineNumber, toLineNumber) {
if (versionId <= this._validModelVersionId) {
// Here we check for versionId in case the lines were reconstructed in the meantime.
// We don't want to apply stale change events on top of a newer read model state.
return null;
}
var outputFromLineNumber = (fromLineNumber === 1 ? 1 : this.prefixSumComputer.getAccumulatedValue(fromLineNumber - 2) + 1);
var outputToLineNumber = this.prefixSumComputer.getAccumulatedValue(toLineNumber - 1);
this.lines.splice(fromLineNumber - 1, toLineNumber - fromLineNumber + 1);
this.prefixSumComputer.removeValues(fromLineNumber - 1, toLineNumber - fromLineNumber + 1);
return new ViewLinesDeletedEvent(outputFromLineNumber, outputToLineNumber);
};
SplitLinesCollection.prototype.onModelLinesInserted = function (versionId, fromLineNumber, _toLineNumber, lineBreaks) {
if (versionId <= this._validModelVersionId) {
// Here we check for versionId in case the lines were reconstructed in the meantime.
// We don't want to apply stale change events on top of a newer read model state.
return null;
}
var hiddenAreas = this.getHiddenAreas();
var isInHiddenArea = false;
var testPosition = new core_position["a" /* Position */](fromLineNumber, 1);
for (var _i = 0, hiddenAreas_1 = hiddenAreas; _i < hiddenAreas_1.length; _i++) {
var hiddenArea = hiddenAreas_1[_i];
if (hiddenArea.containsPosition(testPosition)) {
isInHiddenArea = true;
break;
}
}
var outputFromLineNumber = (fromLineNumber === 1 ? 1 : this.prefixSumComputer.getAccumulatedValue(fromLineNumber - 2) + 1);
var totalOutputLineCount = 0;
var insertLines = [];
var insertPrefixSumValues = [];
for (var i = 0, len = lineBreaks.length; i < len; i++) {
var line = createSplitLine(lineBreaks[i], !isInHiddenArea);
insertLines.push(line);
var outputLineCount = line.getViewLineCount();
totalOutputLineCount += outputLineCount;
insertPrefixSumValues[i] = outputLineCount;
}
// TODO@Alex: use arrays.arrayInsert
this.lines = this.lines.slice(0, fromLineNumber - 1).concat(insertLines).concat(this.lines.slice(fromLineNumber - 1));
this.prefixSumComputer.insertValues(fromLineNumber - 1, insertPrefixSumValues);
return new ViewLinesInsertedEvent(outputFromLineNumber, outputFromLineNumber + totalOutputLineCount - 1);
};
SplitLinesCollection.prototype.onModelLineChanged = function (versionId, lineNumber, lineBreakData) {
if (versionId <= this._validModelVersionId) {
// Here we check for versionId in case the lines were reconstructed in the meantime.
// We don't want to apply stale change events on top of a newer read model state.
return [false, null, null, null];
}
var lineIndex = lineNumber - 1;
var oldOutputLineCount = this.lines[lineIndex].getViewLineCount();
var isVisible = this.lines[lineIndex].isVisible();
var line = createSplitLine(lineBreakData, isVisible);
this.lines[lineIndex] = line;
var newOutputLineCount = this.lines[lineIndex].getViewLineCount();
var lineMappingChanged = false;
var changeFrom = 0;
var changeTo = -1;
var insertFrom = 0;
var insertTo = -1;
var deleteFrom = 0;
var deleteTo = -1;
if (oldOutputLineCount > newOutputLineCount) {
changeFrom = (lineNumber === 1 ? 1 : this.prefixSumComputer.getAccumulatedValue(lineNumber - 2) + 1);
changeTo = changeFrom + newOutputLineCount - 1;
deleteFrom = changeTo + 1;
deleteTo = deleteFrom + (oldOutputLineCount - newOutputLineCount) - 1;
lineMappingChanged = true;
}
else if (oldOutputLineCount < newOutputLineCount) {
changeFrom = (lineNumber === 1 ? 1 : this.prefixSumComputer.getAccumulatedValue(lineNumber - 2) + 1);
changeTo = changeFrom + oldOutputLineCount - 1;
insertFrom = changeTo + 1;
insertTo = insertFrom + (newOutputLineCount - oldOutputLineCount) - 1;
lineMappingChanged = true;
}
else {
changeFrom = (lineNumber === 1 ? 1 : this.prefixSumComputer.getAccumulatedValue(lineNumber - 2) + 1);
changeTo = changeFrom + newOutputLineCount - 1;
}
this.prefixSumComputer.changeValue(lineIndex, newOutputLineCount);
var viewLinesChangedEvent = (changeFrom <= changeTo ? new ViewLinesChangedEvent(changeFrom, changeTo) : null);
var viewLinesInsertedEvent = (insertFrom <= insertTo ? new ViewLinesInsertedEvent(insertFrom, insertTo) : null);
var viewLinesDeletedEvent = (deleteFrom <= deleteTo ? new ViewLinesDeletedEvent(deleteFrom, deleteTo) : null);
return [lineMappingChanged, viewLinesChangedEvent, viewLinesInsertedEvent, viewLinesDeletedEvent];
};
SplitLinesCollection.prototype.acceptVersionId = function (versionId) {
this._validModelVersionId = versionId;
if (this.lines.length === 1 && !this.lines[0].isVisible()) {
// At least one line must be visible => reset hidden areas
this.setHiddenAreas([]);
}
};
SplitLinesCollection.prototype.getViewLineCount = function () {
return this.prefixSumComputer.getTotalValue();
};
SplitLinesCollection.prototype._toValidViewLineNumber = function (viewLineNumber) {
if (viewLineNumber < 1) {
return 1;
}
var viewLineCount = this.getViewLineCount();
if (viewLineNumber > viewLineCount) {
return viewLineCount;
}
return viewLineNumber | 0;
};
SplitLinesCollection.prototype.getActiveIndentGuide = function (viewLineNumber, minLineNumber, maxLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
minLineNumber = this._toValidViewLineNumber(minLineNumber);
maxLineNumber = this._toValidViewLineNumber(maxLineNumber);
var modelPosition = this.convertViewPositionToModelPosition(viewLineNumber, this.getViewLineMinColumn(viewLineNumber));
var modelMinPosition = this.convertViewPositionToModelPosition(minLineNumber, this.getViewLineMinColumn(minLineNumber));
var modelMaxPosition = this.convertViewPositionToModelPosition(maxLineNumber, this.getViewLineMinColumn(maxLineNumber));
var result = this.model.getActiveIndentGuide(modelPosition.lineNumber, modelMinPosition.lineNumber, modelMaxPosition.lineNumber);
var viewStartPosition = this.convertModelPositionToViewPosition(result.startLineNumber, 1);
var viewEndPosition = this.convertModelPositionToViewPosition(result.endLineNumber, this.model.getLineMaxColumn(result.endLineNumber));
return {
startLineNumber: viewStartPosition.lineNumber,
endLineNumber: viewEndPosition.lineNumber,
indent: result.indent
};
};
SplitLinesCollection.prototype.getViewLinesIndentGuides = function (viewStartLineNumber, viewEndLineNumber) {
viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber);
viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber);
var modelStart = this.convertViewPositionToModelPosition(viewStartLineNumber, this.getViewLineMinColumn(viewStartLineNumber));
var modelEnd = this.convertViewPositionToModelPosition(viewEndLineNumber, this.getViewLineMaxColumn(viewEndLineNumber));
var result = [];
var resultRepeatCount = [];
var resultRepeatOption = [];
var modelStartLineIndex = modelStart.lineNumber - 1;
var modelEndLineIndex = modelEnd.lineNumber - 1;
var reqStart = null;
for (var modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) {
var line = this.lines[modelLineIndex];
if (line.isVisible()) {
var viewLineStartIndex = line.getViewLineNumberOfModelPosition(0, modelLineIndex === modelStartLineIndex ? modelStart.column : 1);
var viewLineEndIndex = line.getViewLineNumberOfModelPosition(0, this.model.getLineMaxColumn(modelLineIndex + 1));
var count = viewLineEndIndex - viewLineStartIndex + 1;
var option = 0 /* BlockNone */;
if (count > 1 && line.getViewLineMinColumn(this.model, modelLineIndex + 1, viewLineEndIndex) === 1) {
// wrapped lines should block indent guides
option = (viewLineStartIndex === 0 ? 1 /* BlockSubsequent */ : 2 /* BlockAll */);
}
resultRepeatCount.push(count);
resultRepeatOption.push(option);
// merge into previous request
if (reqStart === null) {
reqStart = new core_position["a" /* Position */](modelLineIndex + 1, 0);
}
}
else {
// hit invisible line => flush request
if (reqStart !== null) {
result = result.concat(this.model.getLinesIndentGuides(reqStart.lineNumber, modelLineIndex));
reqStart = null;
}
}
}
if (reqStart !== null) {
result = result.concat(this.model.getLinesIndentGuides(reqStart.lineNumber, modelEnd.lineNumber));
reqStart = null;
}
var viewLineCount = viewEndLineNumber - viewStartLineNumber + 1;
var viewIndents = new Array(viewLineCount);
var currIndex = 0;
for (var i = 0, len = result.length; i < len; i++) {
var value = result[i];
var count = Math.min(viewLineCount - currIndex, resultRepeatCount[i]);
var option = resultRepeatOption[i];
var blockAtIndex = void 0;
if (option === 2 /* BlockAll */) {
blockAtIndex = 0;
}
else if (option === 1 /* BlockSubsequent */) {
blockAtIndex = 1;
}
else {
blockAtIndex = count;
}
for (var j = 0; j < count; j++) {
if (j === blockAtIndex) {
value = 0;
}
viewIndents[currIndex++] = value;
}
}
return viewIndents;
};
SplitLinesCollection.prototype.getViewLineContent = function (viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
return this.lines[lineIndex].getViewLineContent(this.model, lineIndex + 1, remainder);
};
SplitLinesCollection.prototype.getViewLineLength = function (viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
return this.lines[lineIndex].getViewLineLength(this.model, lineIndex + 1, remainder);
};
SplitLinesCollection.prototype.getViewLineMinColumn = function (viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
return this.lines[lineIndex].getViewLineMinColumn(this.model, lineIndex + 1, remainder);
};
SplitLinesCollection.prototype.getViewLineMaxColumn = function (viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
return this.lines[lineIndex].getViewLineMaxColumn(this.model, lineIndex + 1, remainder);
};
SplitLinesCollection.prototype.getViewLineData = function (viewLineNumber) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
return this.lines[lineIndex].getViewLineData(this.model, lineIndex + 1, remainder);
};
SplitLinesCollection.prototype.getViewLinesData = function (viewStartLineNumber, viewEndLineNumber, needed) {
viewStartLineNumber = this._toValidViewLineNumber(viewStartLineNumber);
viewEndLineNumber = this._toValidViewLineNumber(viewEndLineNumber);
var start = this.prefixSumComputer.getIndexOf(viewStartLineNumber - 1);
var viewLineNumber = viewStartLineNumber;
var startModelLineIndex = start.index;
var startRemainder = start.remainder;
var result = [];
for (var modelLineIndex = startModelLineIndex, len = this.model.getLineCount(); modelLineIndex < len; modelLineIndex++) {
var line = this.lines[modelLineIndex];
if (!line.isVisible()) {
continue;
}
var fromViewLineIndex = (modelLineIndex === startModelLineIndex ? startRemainder : 0);
var remainingViewLineCount = line.getViewLineCount() - fromViewLineIndex;
var lastLine = false;
if (viewLineNumber + remainingViewLineCount > viewEndLineNumber) {
lastLine = true;
remainingViewLineCount = viewEndLineNumber - viewLineNumber + 1;
}
var toViewLineIndex = fromViewLineIndex + remainingViewLineCount;
line.getViewLinesData(this.model, modelLineIndex + 1, fromViewLineIndex, toViewLineIndex, viewLineNumber - viewStartLineNumber, needed, result);
viewLineNumber += remainingViewLineCount;
if (lastLine) {
break;
}
}
return result;
};
SplitLinesCollection.prototype.validateViewPosition = function (viewLineNumber, viewColumn, expectedModelPosition) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
var line = this.lines[lineIndex];
var minColumn = line.getViewLineMinColumn(this.model, lineIndex + 1, remainder);
var maxColumn = line.getViewLineMaxColumn(this.model, lineIndex + 1, remainder);
if (viewColumn < minColumn) {
viewColumn = minColumn;
}
if (viewColumn > maxColumn) {
viewColumn = maxColumn;
}
var computedModelColumn = line.getModelColumnOfViewPosition(remainder, viewColumn);
var computedModelPosition = this.model.validatePosition(new core_position["a" /* Position */](lineIndex + 1, computedModelColumn));
if (computedModelPosition.equals(expectedModelPosition)) {
return new core_position["a" /* Position */](viewLineNumber, viewColumn);
}
return this.convertModelPositionToViewPosition(expectedModelPosition.lineNumber, expectedModelPosition.column);
};
SplitLinesCollection.prototype.validateViewRange = function (viewRange, expectedModelRange) {
var validViewStart = this.validateViewPosition(viewRange.startLineNumber, viewRange.startColumn, expectedModelRange.getStartPosition());
var validViewEnd = this.validateViewPosition(viewRange.endLineNumber, viewRange.endColumn, expectedModelRange.getEndPosition());
return new core_range["a" /* Range */](validViewStart.lineNumber, validViewStart.column, validViewEnd.lineNumber, validViewEnd.column);
};
SplitLinesCollection.prototype.convertViewPositionToModelPosition = function (viewLineNumber, viewColumn) {
viewLineNumber = this._toValidViewLineNumber(viewLineNumber);
var r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
var lineIndex = r.index;
var remainder = r.remainder;
var inputColumn = this.lines[lineIndex].getModelColumnOfViewPosition(remainder, viewColumn);
// console.log('out -> in ' + viewLineNumber + ',' + viewColumn + ' ===> ' + (lineIndex+1) + ',' + inputColumn);
return this.model.validatePosition(new core_position["a" /* Position */](lineIndex + 1, inputColumn));
};
SplitLinesCollection.prototype.convertViewRangeToModelRange = function (viewRange) {
var start = this.convertViewPositionToModelPosition(viewRange.startLineNumber, viewRange.startColumn);
var end = this.convertViewPositionToModelPosition(viewRange.endLineNumber, viewRange.endColumn);
return new core_range["a" /* Range */](start.lineNumber, start.column, end.lineNumber, end.column);
};
SplitLinesCollection.prototype.convertModelPositionToViewPosition = function (_modelLineNumber, _modelColumn) {
var validPosition = this.model.validatePosition(new core_position["a" /* Position */](_modelLineNumber, _modelColumn));
var inputLineNumber = validPosition.lineNumber;
var inputColumn = validPosition.column;
var lineIndex = inputLineNumber - 1, lineIndexChanged = false;
while (lineIndex > 0 && !this.lines[lineIndex].isVisible()) {
lineIndex--;
lineIndexChanged = true;
}
if (lineIndex === 0 && !this.lines[lineIndex].isVisible()) {
// Could not reach a real line
// console.log('in -> out ' + inputLineNumber + ',' + inputColumn + ' ===> ' + 1 + ',' + 1);
return new core_position["a" /* Position */](1, 1);
}
var deltaLineNumber = 1 + (lineIndex === 0 ? 0 : this.prefixSumComputer.getAccumulatedValue(lineIndex - 1));
var r;
if (lineIndexChanged) {
r = this.lines[lineIndex].getViewPositionOfModelPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1));
}
else {
r = this.lines[inputLineNumber - 1].getViewPositionOfModelPosition(deltaLineNumber, inputColumn);
}
// console.log('in -> out ' + inputLineNumber + ',' + inputColumn + ' ===> ' + r.lineNumber + ',' + r);
return r;
};
SplitLinesCollection.prototype.convertModelRangeToViewRange = function (modelRange) {
var start = this.convertModelPositionToViewPosition(modelRange.startLineNumber, modelRange.startColumn);
var end = this.convertModelPositionToViewPosition(modelRange.endLineNumber, modelRange.endColumn);
if (modelRange.startLineNumber === modelRange.endLineNumber && start.lineNumber !== end.lineNumber) {
// This is a single line range that ends up taking more lines due to wrapping
if (end.column === this.getViewLineMinColumn(end.lineNumber)) {
// the end column lands on the first column of the next line
return new core_range["a" /* Range */](start.lineNumber, start.column, end.lineNumber - 1, this.getViewLineMaxColumn(end.lineNumber - 1));
}
}
return new core_range["a" /* Range */](start.lineNumber, start.column, end.lineNumber, end.column);
};
SplitLinesCollection.prototype._getViewLineNumberForModelPosition = function (inputLineNumber, inputColumn) {
var lineIndex = inputLineNumber - 1;
if (this.lines[lineIndex].isVisible()) {
// this model line is visible
var deltaLineNumber_1 = 1 + (lineIndex === 0 ? 0 : this.prefixSumComputer.getAccumulatedValue(lineIndex - 1));
return this.lines[lineIndex].getViewLineNumberOfModelPosition(deltaLineNumber_1, inputColumn);
}
// this model line is not visible
while (lineIndex > 0 && !this.lines[lineIndex].isVisible()) {
lineIndex--;
}
if (lineIndex === 0 && !this.lines[lineIndex].isVisible()) {
// Could not reach a real line
return 1;
}
var deltaLineNumber = 1 + (lineIndex === 0 ? 0 : this.prefixSumComputer.getAccumulatedValue(lineIndex - 1));
return this.lines[lineIndex].getViewLineNumberOfModelPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1));
};
SplitLinesCollection.prototype.getAllOverviewRulerDecorations = function (ownerId, filterOutValidation, theme) {
var decorations = this.model.getOverviewRulerDecorations(ownerId, filterOutValidation);
var result = new OverviewRulerDecorations();
for (var _i = 0, decorations_1 = decorations; _i < decorations_1.length; _i++) {
var decoration = decorations_1[_i];
var opts = decoration.options.overviewRuler;
var lane = opts ? opts.position : 0;
if (lane === 0) {
continue;
}
var color = opts.getColor(theme);
var viewStartLineNumber = this._getViewLineNumberForModelPosition(decoration.range.startLineNumber, decoration.range.startColumn);
var viewEndLineNumber = this._getViewLineNumberForModelPosition(decoration.range.endLineNumber, decoration.range.endColumn);
result.accept(color, viewStartLineNumber, viewEndLineNumber, lane);
}
return result.result;
};
SplitLinesCollection.prototype.getDecorationsInRange = function (range, ownerId, filterOutValidation) {
var modelStart = this.convertViewPositionToModelPosition(range.startLineNumber, range.startColumn);
var modelEnd = this.convertViewPositionToModelPosition(range.endLineNumber, range.endColumn);
if (modelEnd.lineNumber - modelStart.lineNumber <= range.endLineNumber - range.startLineNumber) {
// most likely there are no hidden lines => fast path
// fetch decorations from column 1 to cover the case of wrapped lines that have whole line decorations at column 1
return this.model.getDecorationsInRange(new core_range["a" /* Range */](modelStart.lineNumber, 1, modelEnd.lineNumber, modelEnd.column), ownerId, filterOutValidation);
}
var result = [];
var modelStartLineIndex = modelStart.lineNumber - 1;
var modelEndLineIndex = modelEnd.lineNumber - 1;
var reqStart = null;
for (var modelLineIndex = modelStartLineIndex; modelLineIndex <= modelEndLineIndex; modelLineIndex++) {
var line = this.lines[modelLineIndex];
if (line.isVisible()) {
// merge into previous request
if (reqStart === null) {
reqStart = new core_position["a" /* Position */](modelLineIndex + 1, modelLineIndex === modelStartLineIndex ? modelStart.column : 1);
}
}
else {
// hit invisible line => flush request
if (reqStart !== null) {
var maxLineColumn = this.model.getLineMaxColumn(modelLineIndex);
result = result.concat(this.model.getDecorationsInRange(new core_range["a" /* Range */](reqStart.lineNumber, reqStart.column, modelLineIndex, maxLineColumn), ownerId, filterOutValidation));
reqStart = null;
}
}
}
if (reqStart !== null) {
result = result.concat(this.model.getDecorationsInRange(new core_range["a" /* Range */](reqStart.lineNumber, reqStart.column, modelEnd.lineNumber, modelEnd.column), ownerId, filterOutValidation));
reqStart = null;
}
result.sort(function (a, b) {
var res = core_range["a" /* Range */].compareRangesUsingStarts(a.range, b.range);
if (res === 0) {
if (a.id < b.id) {
return -1;
}
if (a.id > b.id) {
return 1;
}
return 0;
}
return res;
});
// Eliminate duplicate decorations that might have intersected our visible ranges multiple times
var finalResult = [], finalResultLen = 0;
var prevDecId = null;
for (var _i = 0, result_1 = result; _i < result_1.length; _i++) {
var dec = result_1[_i];
var decId = dec.id;
if (prevDecId === decId) {
// skip
continue;
}
prevDecId = decId;
finalResult[finalResultLen++] = dec;
}
return finalResult;
};
return SplitLinesCollection;
}());
var splitLinesCollection_VisibleIdentitySplitLine = /** @class */ (function () {
function VisibleIdentitySplitLine() {
}
VisibleIdentitySplitLine.prototype.isVisible = function () {
return true;
};
VisibleIdentitySplitLine.prototype.setVisible = function (isVisible) {
if (isVisible) {
return this;
}
return InvisibleIdentitySplitLine.INSTANCE;
};
VisibleIdentitySplitLine.prototype.getLineBreakData = function () {
return null;
};
VisibleIdentitySplitLine.prototype.getViewLineCount = function () {
return 1;
};
VisibleIdentitySplitLine.prototype.getViewLineContent = function (model, modelLineNumber, _outputLineIndex) {
return model.getLineContent(modelLineNumber);
};
VisibleIdentitySplitLine.prototype.getViewLineLength = function (model, modelLineNumber, _outputLineIndex) {
return model.getLineLength(modelLineNumber);
};
VisibleIdentitySplitLine.prototype.getViewLineMinColumn = function (model, modelLineNumber, _outputLineIndex) {
return model.getLineMinColumn(modelLineNumber);
};
VisibleIdentitySplitLine.prototype.getViewLineMaxColumn = function (model, modelLineNumber, _outputLineIndex) {
return model.getLineMaxColumn(modelLineNumber);
};
VisibleIdentitySplitLine.prototype.getViewLineData = function (model, modelLineNumber, _outputLineIndex) {
var lineTokens = model.getLineTokens(modelLineNumber);
var lineContent = lineTokens.getLineContent();
return new viewModel_viewModel["c" /* ViewLineData */](lineContent, false, 1, lineContent.length + 1, 0, lineTokens.inflate());
};
VisibleIdentitySplitLine.prototype.getViewLinesData = function (model, modelLineNumber, _fromOuputLineIndex, _toOutputLineIndex, globalStartIndex, needed, result) {
if (!needed[globalStartIndex]) {
result[globalStartIndex] = null;
return;
}
result[globalStartIndex] = this.getViewLineData(model, modelLineNumber, 0);
};
VisibleIdentitySplitLine.prototype.getModelColumnOfViewPosition = function (_outputLineIndex, outputColumn) {
return outputColumn;
};
VisibleIdentitySplitLine.prototype.getViewPositionOfModelPosition = function (deltaLineNumber, inputColumn) {
return new core_position["a" /* Position */](deltaLineNumber, inputColumn);
};
VisibleIdentitySplitLine.prototype.getViewLineNumberOfModelPosition = function (deltaLineNumber, _inputColumn) {
return deltaLineNumber;
};
VisibleIdentitySplitLine.INSTANCE = new VisibleIdentitySplitLine();
return VisibleIdentitySplitLine;
}());
var InvisibleIdentitySplitLine = /** @class */ (function () {
function InvisibleIdentitySplitLine() {
}
InvisibleIdentitySplitLine.prototype.isVisible = function () {
return false;
};
InvisibleIdentitySplitLine.prototype.setVisible = function (isVisible) {
if (!isVisible) {
return this;
}
return splitLinesCollection_VisibleIdentitySplitLine.INSTANCE;
};
InvisibleIdentitySplitLine.prototype.getLineBreakData = function () {
return null;
};
InvisibleIdentitySplitLine.prototype.getViewLineCount = function () {
return 0;
};
InvisibleIdentitySplitLine.prototype.getViewLineContent = function (_model, _modelLineNumber, _outputLineIndex) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLineLength = function (_model, _modelLineNumber, _outputLineIndex) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLineMinColumn = function (_model, _modelLineNumber, _outputLineIndex) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLineMaxColumn = function (_model, _modelLineNumber, _outputLineIndex) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLineData = function (_model, _modelLineNumber, _outputLineIndex) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLinesData = function (_model, _modelLineNumber, _fromOuputLineIndex, _toOutputLineIndex, _globalStartIndex, _needed, _result) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getModelColumnOfViewPosition = function (_outputLineIndex, _outputColumn) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewPositionOfModelPosition = function (_deltaLineNumber, _inputColumn) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.prototype.getViewLineNumberOfModelPosition = function (_deltaLineNumber, _inputColumn) {
throw new Error('Not supported');
};
InvisibleIdentitySplitLine.INSTANCE = new InvisibleIdentitySplitLine();
return InvisibleIdentitySplitLine;
}());
var splitLinesCollection_SplitLine = /** @class */ (function () {
function SplitLine(lineBreakData, isVisible) {
this._lineBreakData = lineBreakData;
this._isVisible = isVisible;
}
SplitLine.prototype.isVisible = function () {
return this._isVisible;
};
SplitLine.prototype.setVisible = function (isVisible) {
this._isVisible = isVisible;
return this;
};
SplitLine.prototype.getLineBreakData = function () {
return this._lineBreakData;
};
SplitLine.prototype.getViewLineCount = function () {
if (!this._isVisible) {
return 0;
}
return this._lineBreakData.breakOffsets.length;
};
SplitLine.prototype.getInputStartOffsetOfOutputLineIndex = function (outputLineIndex) {
return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex, 0);
};
SplitLine.prototype.getInputEndOffsetOfOutputLineIndex = function (model, modelLineNumber, outputLineIndex) {
if (outputLineIndex + 1 === this._lineBreakData.breakOffsets.length) {
return model.getLineMaxColumn(modelLineNumber) - 1;
}
return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex + 1, 0);
};
SplitLine.prototype.getViewLineContent = function (model, modelLineNumber, outputLineIndex) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var startOffset = this.getInputStartOffsetOfOutputLineIndex(outputLineIndex);
var endOffset = this.getInputEndOffsetOfOutputLineIndex(model, modelLineNumber, outputLineIndex);
var r = model.getValueInRange({
startLineNumber: modelLineNumber,
startColumn: startOffset + 1,
endLineNumber: modelLineNumber,
endColumn: endOffset + 1
});
if (outputLineIndex > 0) {
r = spaces(this._lineBreakData.wrappedTextIndentLength) + r;
}
return r;
};
SplitLine.prototype.getViewLineLength = function (model, modelLineNumber, outputLineIndex) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var startOffset = this.getInputStartOffsetOfOutputLineIndex(outputLineIndex);
var endOffset = this.getInputEndOffsetOfOutputLineIndex(model, modelLineNumber, outputLineIndex);
var r = endOffset - startOffset;
if (outputLineIndex > 0) {
r = this._lineBreakData.wrappedTextIndentLength + r;
}
return r;
};
SplitLine.prototype.getViewLineMinColumn = function (_model, _modelLineNumber, outputLineIndex) {
if (!this._isVisible) {
throw new Error('Not supported');
}
if (outputLineIndex > 0) {
return this._lineBreakData.wrappedTextIndentLength + 1;
}
return 1;
};
SplitLine.prototype.getViewLineMaxColumn = function (model, modelLineNumber, outputLineIndex) {
if (!this._isVisible) {
throw new Error('Not supported');
}
return this.getViewLineContent(model, modelLineNumber, outputLineIndex).length + 1;
};
SplitLine.prototype.getViewLineData = function (model, modelLineNumber, outputLineIndex) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var startOffset = this.getInputStartOffsetOfOutputLineIndex(outputLineIndex);
var endOffset = this.getInputEndOffsetOfOutputLineIndex(model, modelLineNumber, outputLineIndex);
var lineContent = model.getValueInRange({
startLineNumber: modelLineNumber,
startColumn: startOffset + 1,
endLineNumber: modelLineNumber,
endColumn: endOffset + 1
});
if (outputLineIndex > 0) {
lineContent = spaces(this._lineBreakData.wrappedTextIndentLength) + lineContent;
}
var minColumn = (outputLineIndex > 0 ? this._lineBreakData.wrappedTextIndentLength + 1 : 1);
var maxColumn = lineContent.length + 1;
var continuesWithWrappedLine = (outputLineIndex + 1 < this.getViewLineCount());
var deltaStartIndex = 0;
if (outputLineIndex > 0) {
deltaStartIndex = this._lineBreakData.wrappedTextIndentLength;
}
var lineTokens = model.getLineTokens(modelLineNumber);
var startVisibleColumn = (outputLineIndex === 0 ? 0 : this._lineBreakData.breakOffsetsVisibleColumn[outputLineIndex - 1]);
return new viewModel_viewModel["c" /* ViewLineData */](lineContent, continuesWithWrappedLine, minColumn, maxColumn, startVisibleColumn, lineTokens.sliceAndInflate(startOffset, endOffset, deltaStartIndex));
};
SplitLine.prototype.getViewLinesData = function (model, modelLineNumber, fromOuputLineIndex, toOutputLineIndex, globalStartIndex, needed, result) {
if (!this._isVisible) {
throw new Error('Not supported');
}
for (var outputLineIndex = fromOuputLineIndex; outputLineIndex < toOutputLineIndex; outputLineIndex++) {
var globalIndex = globalStartIndex + outputLineIndex - fromOuputLineIndex;
if (!needed[globalIndex]) {
result[globalIndex] = null;
continue;
}
result[globalIndex] = this.getViewLineData(model, modelLineNumber, outputLineIndex);
}
};
SplitLine.prototype.getModelColumnOfViewPosition = function (outputLineIndex, outputColumn) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var adjustedColumn = outputColumn - 1;
if (outputLineIndex > 0) {
if (adjustedColumn < this._lineBreakData.wrappedTextIndentLength) {
adjustedColumn = 0;
}
else {
adjustedColumn -= this._lineBreakData.wrappedTextIndentLength;
}
}
return LineBreakData.getInputOffsetOfOutputPosition(this._lineBreakData.breakOffsets, outputLineIndex, adjustedColumn) + 1;
};
SplitLine.prototype.getViewPositionOfModelPosition = function (deltaLineNumber, inputColumn) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var r = LineBreakData.getOutputPositionOfInputOffset(this._lineBreakData.breakOffsets, inputColumn - 1);
var outputLineIndex = r.outputLineIndex;
var outputColumn = r.outputOffset + 1;
if (outputLineIndex > 0) {
outputColumn += this._lineBreakData.wrappedTextIndentLength;
}
// console.log('in -> out ' + deltaLineNumber + ',' + inputColumn + ' ===> ' + (deltaLineNumber+outputLineIndex) + ',' + outputColumn);
return new core_position["a" /* Position */](deltaLineNumber + outputLineIndex, outputColumn);
};
SplitLine.prototype.getViewLineNumberOfModelPosition = function (deltaLineNumber, inputColumn) {
if (!this._isVisible) {
throw new Error('Not supported');
}
var r = LineBreakData.getOutputPositionOfInputOffset(this._lineBreakData.breakOffsets, inputColumn - 1);
return (deltaLineNumber + r.outputLineIndex);
};
return SplitLine;
}());
var _spaces = [''];
function spaces(count) {
if (count >= _spaces.length) {
for (var i = 1; i <= count; i++) {
_spaces[i] = _makeSpaces(i);
}
}
return _spaces[count];
}
function _makeSpaces(count) {
return new Array(count + 1).join(' ');
}
function createSplitLine(lineBreakData, isVisible) {
if (lineBreakData === null) {
// No mapping needed
if (isVisible) {
return splitLinesCollection_VisibleIdentitySplitLine.INSTANCE;
}
return InvisibleIdentitySplitLine.INSTANCE;
}
else {
return new splitLinesCollection_SplitLine(lineBreakData, isVisible);
}
}
var IdentityCoordinatesConverter = /** @class */ (function () {
function IdentityCoordinatesConverter(lines) {
this._lines = lines;
}
IdentityCoordinatesConverter.prototype._validPosition = function (pos) {
return this._lines.model.validatePosition(pos);
};
IdentityCoordinatesConverter.prototype._validRange = function (range) {
return this._lines.model.validateRange(range);
};
// View -> Model conversion and related methods
IdentityCoordinatesConverter.prototype.convertViewPositionToModelPosition = function (viewPosition) {
return this._validPosition(viewPosition);
};
IdentityCoordinatesConverter.prototype.convertViewRangeToModelRange = function (viewRange) {
return this._validRange(viewRange);
};
IdentityCoordinatesConverter.prototype.validateViewPosition = function (_viewPosition, expectedModelPosition) {
return this._validPosition(expectedModelPosition);
};
IdentityCoordinatesConverter.prototype.validateViewRange = function (_viewRange, expectedModelRange) {
return this._validRange(expectedModelRange);
};
// Model -> View conversion and related methods
IdentityCoordinatesConverter.prototype.convertModelPositionToViewPosition = function (modelPosition) {
return this._validPosition(modelPosition);
};
IdentityCoordinatesConverter.prototype.convertModelRangeToViewRange = function (modelRange) {
return this._validRange(modelRange);
};
IdentityCoordinatesConverter.prototype.modelPositionIsVisible = function (modelPosition) {
var lineCount = this._lines.model.getLineCount();
if (modelPosition.lineNumber < 1 || modelPosition.lineNumber > lineCount) {
// invalid arguments
return false;
}
return true;
};
return IdentityCoordinatesConverter;
}());
var splitLinesCollection_IdentityLinesCollection = /** @class */ (function () {
function IdentityLinesCollection(model) {
this.model = model;
}
IdentityLinesCollection.prototype.dispose = function () {
};
IdentityLinesCollection.prototype.createCoordinatesConverter = function () {
return new IdentityCoordinatesConverter(this);
};
IdentityLinesCollection.prototype.getHiddenAreas = function () {
return [];
};
IdentityLinesCollection.prototype.setHiddenAreas = function (_ranges) {
return false;
};
IdentityLinesCollection.prototype.setTabSize = function (_newTabSize) {
return false;
};
IdentityLinesCollection.prototype.setWrappingSettings = function (_fontInfo, _wrappingStrategy, _wrappingColumn, _wrappingIndent) {
return false;
};
IdentityLinesCollection.prototype.createLineBreaksComputer = function () {
var result = [];
return {
addRequest: function (lineText, previousLineBreakData) {
result.push(null);
},
finalize: function () {
return result;
}
};
};
IdentityLinesCollection.prototype.onModelFlushed = function () {
};
IdentityLinesCollection.prototype.onModelLinesDeleted = function (_versionId, fromLineNumber, toLineNumber) {
return new ViewLinesDeletedEvent(fromLineNumber, toLineNumber);
};
IdentityLinesCollection.prototype.onModelLinesInserted = function (_versionId, fromLineNumber, toLineNumber, lineBreaks) {
return new ViewLinesInsertedEvent(fromLineNumber, toLineNumber);
};
IdentityLinesCollection.prototype.onModelLineChanged = function (_versionId, lineNumber, lineBreakData) {
return [false, new ViewLinesChangedEvent(lineNumber, lineNumber), null, null];
};
IdentityLinesCollection.prototype.acceptVersionId = function (_versionId) {
};
IdentityLinesCollection.prototype.getViewLineCount = function () {
return this.model.getLineCount();
};
IdentityLinesCollection.prototype.getActiveIndentGuide = function (viewLineNumber, _minLineNumber, _maxLineNumber) {
return {
startLineNumber: viewLineNumber,
endLineNumber: viewLineNumber,
indent: 0
};
};
IdentityLinesCollection.prototype.getViewLinesIndentGuides = function (viewStartLineNumber, viewEndLineNumber) {
var viewLineCount = viewEndLineNumber - viewStartLineNumber + 1;
var result = new Array(viewLineCount);
for (var i = 0; i < viewLineCount; i++) {
result[i] = 0;
}
return result;
};
IdentityLinesCollection.prototype.getViewLineContent = function (viewLineNumber) {
return this.model.getLineContent(viewLineNumber);
};
IdentityLinesCollection.prototype.getViewLineLength = function (viewLineNumber) {
return this.model.getLineLength(viewLineNumber);
};
IdentityLinesCollection.prototype.getViewLineMinColumn = function (viewLineNumber) {
return this.model.getLineMinColumn(viewLineNumber);
};
IdentityLinesCollection.prototype.getViewLineMaxColumn = function (viewLineNumber) {
return this.model.getLineMaxColumn(viewLineNumber);
};
IdentityLinesCollection.prototype.getViewLineData = function (viewLineNumber) {
var lineTokens = this.model.getLineTokens(viewLineNumber);
var lineContent = lineTokens.getLineContent();
return new viewModel_viewModel["c" /* ViewLineData */](lineContent, false, 1, lineContent.length + 1, 0, lineTokens.inflate());
};
IdentityLinesCollection.prototype.getViewLinesData = function (viewStartLineNumber, viewEndLineNumber, needed) {
var lineCount = this.model.getLineCount();
viewStartLineNumber = Math.min(Math.max(1, viewStartLineNumber), lineCount);
viewEndLineNumber = Math.min(Math.max(1, viewEndLineNumber), lineCount);
var result = [];
for (var lineNumber = viewStartLineNumber; lineNumber <= viewEndLineNumber; lineNumber++) {
var idx = lineNumber - viewStartLineNumber;
if (!needed[idx]) {
result[idx] = null;
}
result[idx] = this.getViewLineData(lineNumber);
}
return result;
};
IdentityLinesCollection.prototype.getAllOverviewRulerDecorations = function (ownerId, filterOutValidation, theme) {
var decorations = this.model.getOverviewRulerDecorations(ownerId, filterOutValidation);
var result = new OverviewRulerDecorations();
for (var _i = 0, decorations_2 = decorations; _i < decorations_2.length; _i++) {
var decoration = decorations_2[_i];
var opts = decoration.options.overviewRuler;
var lane = opts ? opts.position : 0;
if (lane === 0) {
continue;
}
var color = opts.getColor(theme);
var viewStartLineNumber = decoration.range.startLineNumber;
var viewEndLineNumber = decoration.range.endLineNumber;
result.accept(color, viewStartLineNumber, viewEndLineNumber, lane);
}
return result.result;
};
IdentityLinesCollection.prototype.getDecorationsInRange = function (range, ownerId, filterOutValidation) {
return this.model.getDecorationsInRange(range, ownerId, filterOutValidation);
};
return IdentityLinesCollection;
}());
var OverviewRulerDecorations = /** @class */ (function () {
function OverviewRulerDecorations() {
this.result = Object.create(null);
}
OverviewRulerDecorations.prototype.accept = function (color, startLineNumber, endLineNumber, lane) {
var prev = this.result[color];
if (prev) {
var prevLane = prev[prev.length - 3];
var prevEndLineNumber = prev[prev.length - 1];
if (prevLane === lane && prevEndLineNumber + 1 >= startLineNumber) {
// merge into prev
if (endLineNumber > prevEndLineNumber) {
prev[prev.length - 1] = endLineNumber;
}
return;
}
// push
prev.push(lane, startLineNumber, endLineNumber);
}
else {
this.result[color] = [lane, startLineNumber, endLineNumber];
}
};
return OverviewRulerDecorations;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelDecorations.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewModelDecorations_ViewModelDecorations = /** @class */ (function () {
function ViewModelDecorations(editorId, model, configuration, linesCollection, coordinatesConverter) {
this.editorId = editorId;
this.model = model;
this.configuration = configuration;
this._linesCollection = linesCollection;
this._coordinatesConverter = coordinatesConverter;
this._decorationsCache = Object.create(null);
this._cachedModelDecorationsResolver = null;
this._cachedModelDecorationsResolverViewRange = null;
}
ViewModelDecorations.prototype._clearCachedModelDecorationsResolver = function () {
this._cachedModelDecorationsResolver = null;
this._cachedModelDecorationsResolverViewRange = null;
};
ViewModelDecorations.prototype.dispose = function () {
this._decorationsCache = Object.create(null);
this._clearCachedModelDecorationsResolver();
};
ViewModelDecorations.prototype.reset = function () {
this._decorationsCache = Object.create(null);
this._clearCachedModelDecorationsResolver();
};
ViewModelDecorations.prototype.onModelDecorationsChanged = function () {
this._decorationsCache = Object.create(null);
this._clearCachedModelDecorationsResolver();
};
ViewModelDecorations.prototype.onLineMappingChanged = function () {
this._decorationsCache = Object.create(null);
this._clearCachedModelDecorationsResolver();
};
ViewModelDecorations.prototype._getOrCreateViewModelDecoration = function (modelDecoration) {
var id = modelDecoration.id;
var r = this._decorationsCache[id];
if (!r) {
var modelRange = modelDecoration.range;
var options = modelDecoration.options;
var viewRange = void 0;
if (options.isWholeLine) {
var start = this._coordinatesConverter.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelRange.startLineNumber, 1));
var end = this._coordinatesConverter.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelRange.endLineNumber, this.model.getLineMaxColumn(modelRange.endLineNumber)));
viewRange = new core_range["a" /* Range */](start.lineNumber, start.column, end.lineNumber, end.column);
}
else {
viewRange = this._coordinatesConverter.convertModelRangeToViewRange(modelRange);
}
r = new viewModel_viewModel["e" /* ViewModelDecoration */](viewRange, options);
this._decorationsCache[id] = r;
}
return r;
};
ViewModelDecorations.prototype.getDecorationsViewportData = function (viewRange) {
var cacheIsValid = (this._cachedModelDecorationsResolver !== null);
cacheIsValid = cacheIsValid && (viewRange.equalsRange(this._cachedModelDecorationsResolverViewRange));
if (!cacheIsValid) {
this._cachedModelDecorationsResolver = this._getDecorationsViewportData(viewRange);
this._cachedModelDecorationsResolverViewRange = viewRange;
}
return this._cachedModelDecorationsResolver;
};
ViewModelDecorations.prototype._getDecorationsViewportData = function (viewportRange) {
var modelDecorations = this._linesCollection.getDecorationsInRange(viewportRange, this.editorId, Object(editorOptions["j" /* filterValidationDecorations */])(this.configuration.options));
var startLineNumber = viewportRange.startLineNumber;
var endLineNumber = viewportRange.endLineNumber;
var decorationsInViewport = [], decorationsInViewportLen = 0;
var inlineDecorations = [];
for (var j = startLineNumber; j <= endLineNumber; j++) {
inlineDecorations[j - startLineNumber] = [];
}
for (var i = 0, len = modelDecorations.length; i < len; i++) {
var modelDecoration = modelDecorations[i];
var decorationOptions = modelDecoration.options;
var viewModelDecoration = this._getOrCreateViewModelDecoration(modelDecoration);
var viewRange = viewModelDecoration.range;
decorationsInViewport[decorationsInViewportLen++] = viewModelDecoration;
if (decorationOptions.inlineClassName) {
var inlineDecoration = new viewModel_viewModel["a" /* InlineDecoration */](viewRange, decorationOptions.inlineClassName, decorationOptions.inlineClassNameAffectsLetterSpacing ? 3 /* RegularAffectingLetterSpacing */ : 0 /* Regular */);
var intersectedStartLineNumber = Math.max(startLineNumber, viewRange.startLineNumber);
var intersectedEndLineNumber = Math.min(endLineNumber, viewRange.endLineNumber);
for (var j = intersectedStartLineNumber; j <= intersectedEndLineNumber; j++) {
inlineDecorations[j - startLineNumber].push(inlineDecoration);
}
}
if (decorationOptions.beforeContentClassName) {
if (startLineNumber <= viewRange.startLineNumber && viewRange.startLineNumber <= endLineNumber) {
var inlineDecoration = new viewModel_viewModel["a" /* InlineDecoration */](new core_range["a" /* Range */](viewRange.startLineNumber, viewRange.startColumn, viewRange.startLineNumber, viewRange.startColumn), decorationOptions.beforeContentClassName, 1 /* Before */);
inlineDecorations[viewRange.startLineNumber - startLineNumber].push(inlineDecoration);
}
}
if (decorationOptions.afterContentClassName) {
if (startLineNumber <= viewRange.endLineNumber && viewRange.endLineNumber <= endLineNumber) {
var inlineDecoration = new viewModel_viewModel["a" /* InlineDecoration */](new core_range["a" /* Range */](viewRange.endLineNumber, viewRange.endColumn, viewRange.endLineNumber, viewRange.endColumn), decorationOptions.afterContentClassName, 2 /* After */);
inlineDecorations[viewRange.endLineNumber - startLineNumber].push(inlineDecoration);
}
}
}
return {
decorations: decorationsInViewport,
inlineDecorations: inlineDecorations
};
};
return ViewModelDecorations;
}());
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/viewModelImpl.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var viewModelImpl_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var USE_IDENTITY_LINES_COLLECTION = true;
var viewModelImpl_ViewModel = /** @class */ (function (_super) {
viewModelImpl_extends(ViewModel, _super);
function ViewModel(editorId, configuration, model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, scheduleAtNextAnimationFrame) {
var _this = _super.call(this) || this;
_this.editorId = editorId;
_this.configuration = configuration;
_this.model = model;
_this._tokenizeViewportSoon = _this._register(new common_async["d" /* RunOnceScheduler */](function () { return _this.tokenizeViewport(); }, 50));
_this.hasFocus = false;
_this.viewportStartLine = -1;
_this.viewportStartLineTrackedRange = null;
_this.viewportStartLineDelta = 0;
if (USE_IDENTITY_LINES_COLLECTION && _this.model.isTooLargeForTokenization()) {
_this.lines = new splitLinesCollection_IdentityLinesCollection(_this.model);
}
else {
var options = _this.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
var wrappingStrategy = options.get(103 /* wrappingStrategy */);
var wrappingInfo = options.get(108 /* wrappingInfo */);
var wrappingIndent = options.get(102 /* wrappingIndent */);
_this.lines = new splitLinesCollection_SplitLinesCollection(_this.model, domLineBreaksComputerFactory, monospaceLineBreaksComputerFactory, fontInfo, _this.model.getOptions().tabSize, wrappingStrategy, wrappingInfo.wrappingColumn, wrappingIndent);
}
_this.coordinatesConverter = _this.lines.createCoordinatesConverter();
_this.viewLayout = _this._register(new viewLayout_ViewLayout(_this.configuration, _this.getLineCount(), scheduleAtNextAnimationFrame));
_this._register(_this.viewLayout.onDidScroll(function (e) {
if (e.scrollTopChanged) {
_this._tokenizeViewportSoon.schedule();
}
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewScrollChangedEvent(e));
}
finally {
_this._endEmit();
}
}));
_this._register(_this.viewLayout.onDidContentSizeChange(function (e) {
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewContentSizeChangedEvent(e));
}
finally {
_this._endEmit();
}
}));
_this.decorations = new viewModelDecorations_ViewModelDecorations(_this.editorId, _this.model, _this.configuration, _this.lines, _this.coordinatesConverter);
_this._registerModelEvents();
_this._register(_this.configuration.onDidChange(function (e) {
try {
var eventsCollector = _this._beginEmit();
_this._onConfigurationChanged(eventsCollector, e);
}
finally {
_this._endEmit();
}
}));
_this._register(minimapTokensColorTracker_MinimapTokensColorTracker.getInstance().onDidChange(function () {
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewTokensColorsChangedEvent());
}
finally {
_this._endEmit();
}
}));
return _this;
}
ViewModel.prototype.dispose = function () {
// First remove listeners, as disposing the lines might end up sending
// model decoration changed events ... and we no longer care about them ...
_super.prototype.dispose.call(this);
this.decorations.dispose();
this.lines.dispose();
this.invalidateMinimapColorCache();
this.viewportStartLineTrackedRange = this.model._setTrackedRange(this.viewportStartLineTrackedRange, null, 1 /* NeverGrowsWhenTypingAtEdges */);
};
ViewModel.prototype.tokenizeViewport = function () {
var linesViewportData = this.viewLayout.getLinesViewportData();
var startPosition = this.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](linesViewportData.startLineNumber, 1));
var endPosition = this.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](linesViewportData.endLineNumber, 1));
this.model.tokenizeViewport(startPosition.lineNumber, endPosition.lineNumber);
};
ViewModel.prototype.setHasFocus = function (hasFocus) {
this.hasFocus = hasFocus;
};
ViewModel.prototype._onConfigurationChanged = function (eventsCollector, e) {
// We might need to restore the current centered view range, so save it (if available)
var previousViewportStartModelPosition = null;
if (this.viewportStartLine !== -1) {
var previousViewportStartViewPosition = new core_position["a" /* Position */](this.viewportStartLine, this.getLineMinColumn(this.viewportStartLine));
previousViewportStartModelPosition = this.coordinatesConverter.convertViewPositionToModelPosition(previousViewportStartViewPosition);
}
var restorePreviousViewportStart = false;
var options = this.configuration.options;
var fontInfo = options.get(34 /* fontInfo */);
var wrappingStrategy = options.get(103 /* wrappingStrategy */);
var wrappingInfo = options.get(108 /* wrappingInfo */);
var wrappingIndent = options.get(102 /* wrappingIndent */);
if (this.lines.setWrappingSettings(fontInfo, wrappingStrategy, wrappingInfo.wrappingColumn, wrappingIndent)) {
eventsCollector.emit(new ViewFlushedEvent());
eventsCollector.emit(new ViewLineMappingChangedEvent());
eventsCollector.emit(new ViewDecorationsChangedEvent());
this.decorations.onLineMappingChanged();
this.viewLayout.onFlushed(this.getLineCount());
if (this.viewLayout.getCurrentScrollTop() !== 0) {
// Never change the scroll position from 0 to something else...
restorePreviousViewportStart = true;
}
}
if (e.hasChanged(68 /* readOnly */)) {
// Must read again all decorations due to readOnly filtering
this.decorations.reset();
eventsCollector.emit(new ViewDecorationsChangedEvent());
}
eventsCollector.emit(new ViewConfigurationChangedEvent(e));
this.viewLayout.onConfigurationChanged(e);
if (restorePreviousViewportStart && previousViewportStartModelPosition) {
var viewPosition = this.coordinatesConverter.convertModelPositionToViewPosition(previousViewportStartModelPosition);
var viewPositionTop = this.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
this.viewLayout.setScrollPositionNow({ scrollTop: viewPositionTop + this.viewportStartLineDelta });
}
};
ViewModel.prototype._registerModelEvents = function () {
var _this = this;
this._register(this.model.onDidChangeRawContentFast(function (e) {
try {
var eventsCollector = _this._beginEmit();
var hadOtherModelChange = false;
var hadModelLineChangeThatChangedLineMapping = false;
var changes = e.changes;
var versionId = e.versionId;
// Do a first pass to compute line mappings, and a second pass to actually interpret them
var lineBreaksComputer = _this.lines.createLineBreaksComputer();
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
var change = changes_1[_i];
switch (change.changeType) {
case 4 /* LinesInserted */: {
for (var _a = 0, _b = change.detail; _a < _b.length; _a++) {
var line = _b[_a];
lineBreaksComputer.addRequest(line, null);
}
break;
}
case 2 /* LineChanged */: {
lineBreaksComputer.addRequest(change.detail, null);
break;
}
}
}
var lineBreaks = lineBreaksComputer.finalize();
var lineBreaksOffset = 0;
for (var _c = 0, changes_2 = changes; _c < changes_2.length; _c++) {
var change = changes_2[_c];
switch (change.changeType) {
case 1 /* Flush */: {
_this.lines.onModelFlushed();
eventsCollector.emit(new ViewFlushedEvent());
_this.decorations.reset();
_this.viewLayout.onFlushed(_this.getLineCount());
hadOtherModelChange = true;
break;
}
case 3 /* LinesDeleted */: {
var linesDeletedEvent = _this.lines.onModelLinesDeleted(versionId, change.fromLineNumber, change.toLineNumber);
if (linesDeletedEvent !== null) {
eventsCollector.emit(linesDeletedEvent);
_this.viewLayout.onLinesDeleted(linesDeletedEvent.fromLineNumber, linesDeletedEvent.toLineNumber);
}
hadOtherModelChange = true;
break;
}
case 4 /* LinesInserted */: {
var insertedLineBreaks = lineBreaks.slice(lineBreaksOffset, lineBreaksOffset + change.detail.length);
lineBreaksOffset += change.detail.length;
var linesInsertedEvent = _this.lines.onModelLinesInserted(versionId, change.fromLineNumber, change.toLineNumber, insertedLineBreaks);
if (linesInsertedEvent !== null) {
eventsCollector.emit(linesInsertedEvent);
_this.viewLayout.onLinesInserted(linesInsertedEvent.fromLineNumber, linesInsertedEvent.toLineNumber);
}
hadOtherModelChange = true;
break;
}
case 2 /* LineChanged */: {
var changedLineBreakData = lineBreaks[lineBreaksOffset];
lineBreaksOffset++;
var _d = _this.lines.onModelLineChanged(versionId, change.lineNumber, changedLineBreakData), lineMappingChanged = _d[0], linesChangedEvent = _d[1], linesInsertedEvent = _d[2], linesDeletedEvent = _d[3];
hadModelLineChangeThatChangedLineMapping = lineMappingChanged;
if (linesChangedEvent) {
eventsCollector.emit(linesChangedEvent);
}
if (linesInsertedEvent) {
eventsCollector.emit(linesInsertedEvent);
_this.viewLayout.onLinesInserted(linesInsertedEvent.fromLineNumber, linesInsertedEvent.toLineNumber);
}
if (linesDeletedEvent) {
eventsCollector.emit(linesDeletedEvent);
_this.viewLayout.onLinesDeleted(linesDeletedEvent.fromLineNumber, linesDeletedEvent.toLineNumber);
}
break;
}
case 5 /* EOLChanged */: {
// Nothing to do. The new version will be accepted below
break;
}
}
}
_this.lines.acceptVersionId(versionId);
_this.viewLayout.onHeightMaybeChanged();
if (!hadOtherModelChange && hadModelLineChangeThatChangedLineMapping) {
eventsCollector.emit(new ViewLineMappingChangedEvent());
eventsCollector.emit(new ViewDecorationsChangedEvent());
_this.decorations.onLineMappingChanged();
}
}
finally {
_this._endEmit();
}
// Update the configuration and reset the centered view line
_this.viewportStartLine = -1;
_this.configuration.setMaxLineNumber(_this.model.getLineCount());
// Recover viewport
if (!_this.hasFocus && _this.model.getAttachedEditorCount() >= 2 && _this.viewportStartLineTrackedRange) {
var modelRange = _this.model._getTrackedRange(_this.viewportStartLineTrackedRange);
if (modelRange) {
var viewPosition = _this.coordinatesConverter.convertModelPositionToViewPosition(modelRange.getStartPosition());
var viewPositionTop = _this.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
_this.viewLayout.setScrollPositionNow({ scrollTop: viewPositionTop + _this.viewportStartLineDelta });
}
}
}));
this._register(this.model.onDidChangeTokens(function (e) {
var viewRanges = [];
for (var j = 0, lenJ = e.ranges.length; j < lenJ; j++) {
var modelRange = e.ranges[j];
var viewStartLineNumber = _this.coordinatesConverter.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelRange.fromLineNumber, 1)).lineNumber;
var viewEndLineNumber = _this.coordinatesConverter.convertModelPositionToViewPosition(new core_position["a" /* Position */](modelRange.toLineNumber, _this.model.getLineMaxColumn(modelRange.toLineNumber))).lineNumber;
viewRanges[j] = {
fromLineNumber: viewStartLineNumber,
toLineNumber: viewEndLineNumber
};
}
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewTokensChangedEvent(viewRanges));
}
finally {
_this._endEmit();
}
if (e.tokenizationSupportChanged) {
_this._tokenizeViewportSoon.schedule();
}
}));
this._register(this.model.onDidChangeLanguageConfiguration(function (e) {
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewLanguageConfigurationEvent());
}
finally {
_this._endEmit();
}
}));
this._register(this.model.onDidChangeOptions(function (e) {
// A tab size change causes a line mapping changed event => all view parts will repaint OK, no further event needed here
if (_this.lines.setTabSize(_this.model.getOptions().tabSize)) {
_this.decorations.onLineMappingChanged();
_this.viewLayout.onFlushed(_this.getLineCount());
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewFlushedEvent());
eventsCollector.emit(new ViewLineMappingChangedEvent());
eventsCollector.emit(new ViewDecorationsChangedEvent());
}
finally {
_this._endEmit();
}
}
}));
this._register(this.model.onDidChangeDecorations(function (e) {
_this.decorations.onModelDecorationsChanged();
try {
var eventsCollector = _this._beginEmit();
eventsCollector.emit(new ViewDecorationsChangedEvent());
}
finally {
_this._endEmit();
}
}));
};
ViewModel.prototype.setHiddenAreas = function (ranges) {
try {
var eventsCollector = this._beginEmit();
var lineMappingChanged = this.lines.setHiddenAreas(ranges);
if (lineMappingChanged) {
eventsCollector.emit(new ViewFlushedEvent());
eventsCollector.emit(new ViewLineMappingChangedEvent());
eventsCollector.emit(new ViewDecorationsChangedEvent());
this.decorations.onLineMappingChanged();
this.viewLayout.onFlushed(this.getLineCount());
this.viewLayout.onHeightMaybeChanged();
}
}
finally {
this._endEmit();
}
};
ViewModel.prototype.getVisibleRanges = function () {
var visibleViewRange = this.getCompletelyVisibleViewRange();
var visibleRange = this.coordinatesConverter.convertViewRangeToModelRange(visibleViewRange);
var hiddenAreas = this.lines.getHiddenAreas();
if (hiddenAreas.length === 0) {
return [visibleRange];
}
var result = [], resultLen = 0;
var startLineNumber = visibleRange.startLineNumber;
var startColumn = visibleRange.startColumn;
var endLineNumber = visibleRange.endLineNumber;
var endColumn = visibleRange.endColumn;
for (var i = 0, len = hiddenAreas.length; i < len; i++) {
var hiddenStartLineNumber = hiddenAreas[i].startLineNumber;
var hiddenEndLineNumber = hiddenAreas[i].endLineNumber;
if (hiddenEndLineNumber < startLineNumber) {
continue;
}
if (hiddenStartLineNumber > endLineNumber) {
continue;
}
if (startLineNumber < hiddenStartLineNumber) {
result[resultLen++] = new core_range["a" /* 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 core_range["a" /* Range */](startLineNumber, startColumn, endLineNumber, endColumn);
}
return result;
};
ViewModel.prototype.getCompletelyVisibleViewRange = function () {
var partialData = this.viewLayout.getLinesViewportData();
var startViewLineNumber = partialData.completelyVisibleStartLineNumber;
var endViewLineNumber = partialData.completelyVisibleEndLineNumber;
return new core_range["a" /* Range */](startViewLineNumber, this.getLineMinColumn(startViewLineNumber), endViewLineNumber, this.getLineMaxColumn(endViewLineNumber));
};
ViewModel.prototype.getCompletelyVisibleViewRangeAtScrollTop = function (scrollTop) {
var partialData = this.viewLayout.getLinesViewportDataAtScrollTop(scrollTop);
var startViewLineNumber = partialData.completelyVisibleStartLineNumber;
var endViewLineNumber = partialData.completelyVisibleEndLineNumber;
return new core_range["a" /* Range */](startViewLineNumber, this.getLineMinColumn(startViewLineNumber), endViewLineNumber, this.getLineMaxColumn(endViewLineNumber));
};
ViewModel.prototype.saveState = function () {
var compatViewState = this.viewLayout.saveState();
var scrollTop = compatViewState.scrollTop;
var firstViewLineNumber = this.viewLayout.getLineNumberAtVerticalOffset(scrollTop);
var firstPosition = this.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](firstViewLineNumber, this.getLineMinColumn(firstViewLineNumber)));
var firstPositionDeltaTop = this.viewLayout.getVerticalOffsetForLineNumber(firstViewLineNumber) - scrollTop;
return {
scrollLeft: compatViewState.scrollLeft,
firstPosition: firstPosition,
firstPositionDeltaTop: firstPositionDeltaTop
};
};
ViewModel.prototype.reduceRestoreState = function (state) {
if (typeof state.firstPosition === 'undefined') {
// This is a view state serialized by an older version
return this._reduceRestoreStateCompatibility(state);
}
var modelPosition = this.model.validatePosition(state.firstPosition);
var viewPosition = this.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
var scrollTop = this.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber) - state.firstPositionDeltaTop;
return {
scrollLeft: state.scrollLeft,
scrollTop: scrollTop
};
};
ViewModel.prototype._reduceRestoreStateCompatibility = function (state) {
return {
scrollLeft: state.scrollLeft,
scrollTop: state.scrollTopWithoutViewZones
};
};
ViewModel.prototype.getTabSize = function () {
return this.model.getOptions().tabSize;
};
ViewModel.prototype.getOptions = function () {
return this.model.getOptions();
};
ViewModel.prototype.getLineCount = function () {
return this.lines.getViewLineCount();
};
/**
* Gives a hint that a lot of requests are about to come in for these line numbers.
*/
ViewModel.prototype.setViewport = function (startLineNumber, endLineNumber, centeredLineNumber) {
this.viewportStartLine = startLineNumber;
var position = this.coordinatesConverter.convertViewPositionToModelPosition(new core_position["a" /* Position */](startLineNumber, this.getLineMinColumn(startLineNumber)));
this.viewportStartLineTrackedRange = this.model._setTrackedRange(this.viewportStartLineTrackedRange, new core_range["a" /* Range */](position.lineNumber, position.column, position.lineNumber, position.column), 1 /* NeverGrowsWhenTypingAtEdges */);
var viewportStartLineTop = this.viewLayout.getVerticalOffsetForLineNumber(startLineNumber);
var scrollTop = this.viewLayout.getCurrentScrollTop();
this.viewportStartLineDelta = scrollTop - viewportStartLineTop;
};
ViewModel.prototype.getActiveIndentGuide = function (lineNumber, minLineNumber, maxLineNumber) {
return this.lines.getActiveIndentGuide(lineNumber, minLineNumber, maxLineNumber);
};
ViewModel.prototype.getLinesIndentGuides = function (startLineNumber, endLineNumber) {
return this.lines.getViewLinesIndentGuides(startLineNumber, endLineNumber);
};
ViewModel.prototype.getLineContent = function (lineNumber) {
return this.lines.getViewLineContent(lineNumber);
};
ViewModel.prototype.getLineLength = function (lineNumber) {
return this.lines.getViewLineLength(lineNumber);
};
ViewModel.prototype.getLineMinColumn = function (lineNumber) {
return this.lines.getViewLineMinColumn(lineNumber);
};
ViewModel.prototype.getLineMaxColumn = function (lineNumber) {
return this.lines.getViewLineMaxColumn(lineNumber);
};
ViewModel.prototype.getLineFirstNonWhitespaceColumn = function (lineNumber) {
var result = strings["q" /* firstNonWhitespaceIndex */](this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
};
ViewModel.prototype.getLineLastNonWhitespaceColumn = function (lineNumber) {
var result = strings["D" /* lastNonWhitespaceIndex */](this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
};
ViewModel.prototype.getDecorationsInViewport = function (visibleRange) {
return this.decorations.getDecorationsViewportData(visibleRange).decorations;
};
ViewModel.prototype.getViewLineRenderingData = function (visibleRange, lineNumber) {
var mightContainRTL = this.model.mightContainRTL();
var mightContainNonBasicASCII = this.model.mightContainNonBasicASCII();
var tabSize = this.getTabSize();
var lineData = this.lines.getViewLineData(lineNumber);
var allInlineDecorations = this.decorations.getDecorationsViewportData(visibleRange).inlineDecorations;
var inlineDecorations = allInlineDecorations[lineNumber - visibleRange.startLineNumber];
return new viewModel_viewModel["d" /* ViewLineRenderingData */](lineData.minColumn, lineData.maxColumn, lineData.content, lineData.continuesWithWrappedLine, mightContainRTL, mightContainNonBasicASCII, lineData.tokens, inlineDecorations, tabSize, lineData.startVisibleColumn);
};
ViewModel.prototype.getViewLineData = function (lineNumber) {
return this.lines.getViewLineData(lineNumber);
};
ViewModel.prototype.getMinimapLinesRenderingData = function (startLineNumber, endLineNumber, needed) {
var result = this.lines.getViewLinesData(startLineNumber, endLineNumber, needed);
return new viewModel_viewModel["b" /* MinimapLinesRenderingData */](this.getTabSize(), result);
};
ViewModel.prototype.getAllOverviewRulerDecorations = function (theme) {
return this.lines.getAllOverviewRulerDecorations(this.editorId, Object(editorOptions["j" /* filterValidationDecorations */])(this.configuration.options), theme);
};
ViewModel.prototype.invalidateOverviewRulerColorCache = function () {
var decorations = this.model.getOverviewRulerDecorations();
for (var _i = 0, decorations_1 = decorations; _i < decorations_1.length; _i++) {
var decoration = decorations_1[_i];
var opts = decoration.options.overviewRuler;
if (opts) {
opts.invalidateCachedColor();
}
}
};
ViewModel.prototype.invalidateMinimapColorCache = function () {
var decorations = this.model.getAllDecorations();
for (var _i = 0, decorations_2 = decorations; _i < decorations_2.length; _i++) {
var decoration = decorations_2[_i];
var opts = decoration.options.minimap;
if (opts) {
opts.invalidateCachedColor();
}
}
};
ViewModel.prototype.getValueInRange = function (range, eol) {
var modelRange = this.coordinatesConverter.convertViewRangeToModelRange(range);
return this.model.getValueInRange(modelRange, eol);
};
ViewModel.prototype.getModelLineMaxColumn = function (modelLineNumber) {
return this.model.getLineMaxColumn(modelLineNumber);
};
ViewModel.prototype.validateModelPosition = function (position) {
return this.model.validatePosition(position);
};
ViewModel.prototype.validateModelRange = function (range) {
return this.model.validateRange(range);
};
ViewModel.prototype.deduceModelPositionRelativeToViewPosition = function (viewAnchorPosition, deltaOffset, lineFeedCnt) {
var modelAnchor = this.coordinatesConverter.convertViewPositionToModelPosition(viewAnchorPosition);
if (this.model.getEOL().length === 2) {
// This model uses CRLF, so the delta must take that into account
if (deltaOffset < 0) {
deltaOffset -= lineFeedCnt;
}
else {
deltaOffset += lineFeedCnt;
}
}
var modelAnchorOffset = this.model.getOffsetAt(modelAnchor);
var resultOffset = modelAnchorOffset + deltaOffset;
return this.model.getPositionAt(resultOffset);
};
ViewModel.prototype.getEOL = function () {
return this.model.getEOL();
};
ViewModel.prototype.getPlainTextToCopy = function (modelRanges, emptySelectionClipboard, forceCRLF) {
var newLineCharacter = forceCRLF ? '\r\n' : this.model.getEOL();
modelRanges = modelRanges.slice(0);
modelRanges.sort(core_range["a" /* Range */].compareRangesUsingStarts);
var hasEmptyRange = false;
var hasNonEmptyRange = false;
for (var _i = 0, modelRanges_1 = modelRanges; _i < modelRanges_1.length; _i++) {
var range = modelRanges_1[_i];
if (range.isEmpty()) {
hasEmptyRange = true;
}
else {
hasNonEmptyRange = true;
}
}
if (!hasNonEmptyRange) {
// all ranges are empty
if (!emptySelectionClipboard) {
return '';
}
var modelLineNumbers = modelRanges.map(function (r) { return r.startLineNumber; });
var result_1 = '';
for (var i = 0; i < modelLineNumbers.length; i++) {
if (i > 0 && modelLineNumbers[i - 1] === modelLineNumbers[i]) {
continue;
}
result_1 += this.model.getLineContent(modelLineNumbers[i]) + newLineCharacter;
}
return result_1;
}
if (hasEmptyRange && emptySelectionClipboard) {
// mixed empty selections and non-empty selections
var result_2 = [];
var prevModelLineNumber = 0;
for (var _a = 0, modelRanges_2 = modelRanges; _a < modelRanges_2.length; _a++) {
var modelRange = modelRanges_2[_a];
var modelLineNumber = modelRange.startLineNumber;
if (modelRange.isEmpty()) {
if (modelLineNumber !== prevModelLineNumber) {
result_2.push(this.model.getLineContent(modelLineNumber));
}
}
else {
result_2.push(this.model.getValueInRange(modelRange, forceCRLF ? 2 /* CRLF */ : 0 /* TextDefined */));
}
prevModelLineNumber = modelLineNumber;
}
return result_2.length === 1 ? result_2[0] : result_2;
}
var result = [];
for (var _b = 0, modelRanges_3 = modelRanges; _b < modelRanges_3.length; _b++) {
var modelRange = modelRanges_3[_b];
if (!modelRange.isEmpty()) {
result.push(this.model.getValueInRange(modelRange, forceCRLF ? 2 /* CRLF */ : 0 /* TextDefined */));
}
}
return result.length === 1 ? result[0] : result;
};
ViewModel.prototype.getRichTextToCopy = function (modelRanges, emptySelectionClipboard) {
var languageId = this.model.getLanguageIdentifier();
if (languageId.id === 1 /* PlainText */) {
return null;
}
if (modelRanges.length !== 1) {
// no multiple selection support at this time
return null;
}
var range = modelRanges[0];
if (range.isEmpty()) {
if (!emptySelectionClipboard) {
// nothing to copy
return null;
}
var lineNumber = range.startLineNumber;
range = new core_range["a" /* Range */](lineNumber, this.model.getLineMinColumn(lineNumber), lineNumber, this.model.getLineMaxColumn(lineNumber));
}
var fontInfo = this.configuration.options.get(34 /* fontInfo */);
var colorMap = this._getColorMap();
var fontFamily = fontInfo.fontFamily === editorOptions["b" /* EDITOR_FONT_DEFAULTS */].fontFamily ? fontInfo.fontFamily : "'" + fontInfo.fontFamily + "', " + editorOptions["b" /* EDITOR_FONT_DEFAULTS */].fontFamily;
return {
mode: languageId.language,
html: ("
"
+ this._getHTMLToCopy(range, colorMap)
+ '
')
};
};
ViewModel.prototype._getHTMLToCopy = function (modelRange, colorMap) {
var startLineNumber = modelRange.startLineNumber;
var startColumn = modelRange.startColumn;
var endLineNumber = modelRange.endLineNumber;
var endColumn = modelRange.endColumn;
var tabSize = this.getTabSize();
var result = '';
for (var lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) {
var lineTokens = this.model.getLineTokens(lineNumber);
var lineContent = lineTokens.getLineContent();
var startOffset = (lineNumber === startLineNumber ? startColumn - 1 : 0);
var endOffset = (lineNumber === endLineNumber ? endColumn - 1 : lineContent.length);
if (lineContent === '') {
result += ' ';
}
else {
result += Object(textToHtmlTokenizer["a" /* tokenizeLineToHTML */])(lineContent, lineTokens.inflate(), colorMap, startOffset, endOffset, tabSize, platform["h" /* isWindows */]);
}
}
return result;
};
ViewModel.prototype._getColorMap = function () {
var colorMap = modes["B" /* TokenizationRegistry */].getColorMap();
var result = ['#000000'];
if (colorMap) {
for (var i = 1, len = colorMap.length; i < len; i++) {
result[i] = common_color["a" /* Color */].Format.CSS.formatHex(colorMap[i]);
}
}
return result;
};
return ViewModel;
}(viewEvents_ViewEventEmitter));
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/commands/common/commands.js
var common_commands = __webpack_require__(28);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/contextkey/common/contextkey.js
var contextkey = __webpack_require__(13);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/instantiation.js
var instantiation = __webpack_require__(22);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js
var serviceCollection = __webpack_require__(134);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/notification/common/notification.js
var notification = __webpack_require__(49);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/platform/accessibility/common/accessibility.js
var accessibility = __webpack_require__(72);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/base/common/types.js
var types = __webpack_require__(21);
// EXTERNAL MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/core/characterClassifier.js
var characterClassifier = __webpack_require__(103);
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var monospaceLineBreaksComputer_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var WrappingCharacterClassifier = /** @class */ (function (_super) {
monospaceLineBreaksComputer_extends(WrappingCharacterClassifier, _super);
function WrappingCharacterClassifier(BREAK_BEFORE, BREAK_AFTER) {
var _this = _super.call(this, 0 /* NONE */) || this;
for (var i = 0; i < BREAK_BEFORE.length; i++) {
_this.set(BREAK_BEFORE.charCodeAt(i), 1 /* BREAK_BEFORE */);
}
for (var i = 0; i < BREAK_AFTER.length; i++) {
_this.set(BREAK_AFTER.charCodeAt(i), 2 /* BREAK_AFTER */);
}
return _this;
}
WrappingCharacterClassifier.prototype.get = function (charCode) {
if (charCode >= 0 && charCode < 256) {
return this._asciiMap[charCode];
}
else {
// Initialize CharacterClass.BREAK_IDEOGRAPHIC for these Unicode ranges:
// 1. CJK Unified Ideographs (0x4E00 -- 0x9FFF)
// 2. CJK Unified Ideographs Extension A (0x3400 -- 0x4DBF)
// 3. Hiragana and Katakana (0x3040 -- 0x30FF)
if ((charCode >= 0x3040 && charCode <= 0x30FF)
|| (charCode >= 0x3400 && charCode <= 0x4DBF)
|| (charCode >= 0x4E00 && charCode <= 0x9FFF)) {
return 3 /* BREAK_IDEOGRAPHIC */;
}
return (this._map.get(charCode) || this._defaultValue);
}
};
return WrappingCharacterClassifier;
}(characterClassifier["a" /* CharacterClassifier */]));
var arrPool1 = [];
var arrPool2 = [];
var MonospaceLineBreaksComputerFactory = /** @class */ (function () {
function MonospaceLineBreaksComputerFactory(breakBeforeChars, breakAfterChars) {
this.classifier = new WrappingCharacterClassifier(breakBeforeChars, breakAfterChars);
}
MonospaceLineBreaksComputerFactory.create = function (options) {
return new MonospaceLineBreaksComputerFactory(options.get(99 /* wordWrapBreakBeforeCharacters */), options.get(98 /* wordWrapBreakAfterCharacters */));
};
MonospaceLineBreaksComputerFactory.prototype.createLineBreaksComputer = function (fontInfo, tabSize, wrappingColumn, wrappingIndent) {
var _this = this;
tabSize = tabSize | 0; //@perf
wrappingColumn = +wrappingColumn; //@perf
var requests = [];
var previousBreakingData = [];
return {
addRequest: function (lineText, previousLineBreakData) {
requests.push(lineText);
previousBreakingData.push(previousLineBreakData);
},
finalize: function () {
var columnsForFullWidthChar = fontInfo.typicalFullwidthCharacterWidth / fontInfo.typicalHalfwidthCharacterWidth; //@perf
var result = [];
for (var i = 0, len = requests.length; i < len; i++) {
var previousLineBreakData = previousBreakingData[i];
if (previousLineBreakData) {
result[i] = createLineBreaksFromPreviousLineBreaks(_this.classifier, previousLineBreakData, requests[i], tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent);
}
else {
result[i] = createLineBreaks(_this.classifier, requests[i], tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent);
}
}
arrPool1.length = 0;
arrPool2.length = 0;
return result;
}
};
};
return MonospaceLineBreaksComputerFactory;
}());
function createLineBreaksFromPreviousLineBreaks(classifier, previousBreakingData, lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent) {
if (firstLineBreakColumn === -1) {
return null;
}
var len = lineText.length;
if (len <= 1) {
return null;
}
var prevBreakingOffsets = previousBreakingData.breakOffsets;
var prevBreakingOffsetsVisibleColumn = previousBreakingData.breakOffsetsVisibleColumn;
var wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent);
var wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength;
var breakingOffsets = arrPool1;
var breakingOffsetsVisibleColumn = arrPool2;
var breakingOffsetsCount = 0;
var breakingColumn = firstLineBreakColumn;
var prevLen = prevBreakingOffsets.length;
var prevIndex = 0;
if (prevIndex >= 0) {
var bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn);
while (prevIndex + 1 < prevLen) {
var distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn);
if (distance >= bestDistance) {
break;
}
bestDistance = distance;
prevIndex++;
}
}
while (prevIndex < prevLen) {
// Allow for prevIndex to be -1 (for the case where we hit a tab when walking backwards from the first break)
var prevBreakOffset = prevIndex < 0 ? 0 : prevBreakingOffsets[prevIndex];
var prevBreakoffsetVisibleColumn = prevIndex < 0 ? 0 : prevBreakingOffsetsVisibleColumn[prevIndex];
var breakOffset = 0;
var breakOffsetVisibleColumn = 0;
var forcedBreakOffset = 0;
var forcedBreakOffsetVisibleColumn = 0;
// initially, we search as much as possible to the right (if it fits)
if (prevBreakoffsetVisibleColumn <= breakingColumn) {
var visibleColumn = prevBreakoffsetVisibleColumn;
var prevCharCode = lineText.charCodeAt(prevBreakOffset - 1);
var prevCharCodeClass = classifier.get(prevCharCode);
var entireLineFits = true;
for (var i = prevBreakOffset; i < len; i++) {
var charStartOffset = i;
var charCode = lineText.charCodeAt(i);
var charCodeClass = void 0;
var charWidth = void 0;
if (strings["z" /* isHighSurrogate */](charCode)) {
// A surrogate pair must always be considered as a single unit, so it is never to be broken
i++;
charCodeClass = 0 /* NONE */;
charWidth = 2;
}
else {
charCodeClass = classifier.get(charCode);
charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar);
}
if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
}
visibleColumn += charWidth;
// check if adding character at `i` will go over the breaking column
if (visibleColumn > breakingColumn) {
// We need to break at least before character at `i`:
forcedBreakOffset = charStartOffset;
forcedBreakOffsetVisibleColumn = visibleColumn - charWidth;
if (visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) {
// Cannot break at `breakOffset` => reset it if it was set
breakOffset = 0;
}
entireLineFits = false;
break;
}
prevCharCode = charCode;
prevCharCodeClass = charCodeClass;
}
if (entireLineFits) {
// there is no more need to break => stop the outer loop!
if (breakingOffsetsCount > 0) {
// Add last segment
breakingOffsets[breakingOffsetsCount] = prevBreakingOffsets[prevBreakingOffsets.length - 1];
breakingOffsetsVisibleColumn[breakingOffsetsCount] = prevBreakingOffsetsVisibleColumn[prevBreakingOffsets.length - 1];
breakingOffsetsCount++;
}
break;
}
}
if (breakOffset === 0) {
// must search left
var visibleColumn = prevBreakoffsetVisibleColumn;
var charCode = lineText.charCodeAt(prevBreakOffset);
var charCodeClass = classifier.get(charCode);
var hitATabCharacter = false;
for (var i = prevBreakOffset - 1; i >= 0; i--) {
var charStartOffset = i + 1;
var prevCharCode = lineText.charCodeAt(i);
if (prevCharCode === 9 /* Tab */) {
// cannot determine the width of a tab when going backwards, so we must go forwards
hitATabCharacter = true;
break;
}
var prevCharCodeClass = void 0;
var prevCharWidth = void 0;
if (strings["A" /* isLowSurrogate */](prevCharCode)) {
// A surrogate pair must always be considered as a single unit, so it is never to be broken
i--;
prevCharCodeClass = 0 /* NONE */;
prevCharWidth = 2;
}
else {
prevCharCodeClass = classifier.get(prevCharCode);
prevCharWidth = (strings["y" /* isFullWidthCharacter */](prevCharCode) ? columnsForFullWidthChar : 1);
}
if (visibleColumn <= breakingColumn) {
if (forcedBreakOffset === 0) {
forcedBreakOffset = charStartOffset;
forcedBreakOffsetVisibleColumn = visibleColumn;
}
if (visibleColumn <= breakingColumn - wrappedLineBreakColumn) {
// went too far!
break;
}
if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
break;
}
}
visibleColumn -= prevCharWidth;
charCode = prevCharCode;
charCodeClass = prevCharCodeClass;
}
if (breakOffset !== 0) {
var remainingWidthOfNextLine = wrappedLineBreakColumn - (forcedBreakOffsetVisibleColumn - breakOffsetVisibleColumn);
if (remainingWidthOfNextLine <= tabSize) {
var charCodeAtForcedBreakOffset = lineText.charCodeAt(forcedBreakOffset);
var charWidth = void 0;
if (strings["z" /* isHighSurrogate */](charCodeAtForcedBreakOffset)) {
// A surrogate pair must always be considered as a single unit, so it is never to be broken
charWidth = 2;
}
else {
charWidth = computeCharWidth(charCodeAtForcedBreakOffset, forcedBreakOffsetVisibleColumn, tabSize, columnsForFullWidthChar);
}
if (remainingWidthOfNextLine - charWidth < 0) {
// it is not worth it to break at breakOffset, it just introduces an extra needless line!
breakOffset = 0;
}
}
}
if (hitATabCharacter) {
// cannot determine the width of a tab when going backwards, so we must go forwards from the previous break
prevIndex--;
continue;
}
}
if (breakOffset === 0) {
// Could not find a good breaking point
breakOffset = forcedBreakOffset;
breakOffsetVisibleColumn = forcedBreakOffsetVisibleColumn;
}
breakingOffsets[breakingOffsetsCount] = breakOffset;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn;
breakingOffsetsCount++;
breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn;
while (prevIndex < 0 || (prevIndex < prevLen && prevBreakingOffsetsVisibleColumn[prevIndex] < breakOffsetVisibleColumn)) {
prevIndex++;
}
var bestDistance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex] - breakingColumn);
while (prevIndex + 1 < prevLen) {
var distance = Math.abs(prevBreakingOffsetsVisibleColumn[prevIndex + 1] - breakingColumn);
if (distance >= bestDistance) {
break;
}
bestDistance = distance;
prevIndex++;
}
}
if (breakingOffsetsCount === 0) {
return null;
}
// Doing here some object reuse which ends up helping a huge deal with GC pauses!
breakingOffsets.length = breakingOffsetsCount;
breakingOffsetsVisibleColumn.length = breakingOffsetsCount;
arrPool1 = previousBreakingData.breakOffsets;
arrPool2 = previousBreakingData.breakOffsetsVisibleColumn;
previousBreakingData.breakOffsets = breakingOffsets;
previousBreakingData.breakOffsetsVisibleColumn = breakingOffsetsVisibleColumn;
previousBreakingData.wrappedTextIndentLength = wrappedTextIndentLength;
return previousBreakingData;
}
function createLineBreaks(classifier, lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent) {
if (firstLineBreakColumn === -1) {
return null;
}
var len = lineText.length;
if (len <= 1) {
return null;
}
var wrappedTextIndentLength = computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent);
var wrappedLineBreakColumn = firstLineBreakColumn - wrappedTextIndentLength;
var breakingOffsets = [];
var breakingOffsetsVisibleColumn = [];
var breakingOffsetsCount = 0;
var breakOffset = 0;
var breakOffsetVisibleColumn = 0;
var breakingColumn = firstLineBreakColumn;
var prevCharCode = lineText.charCodeAt(0);
var prevCharCodeClass = classifier.get(prevCharCode);
var visibleColumn = computeCharWidth(prevCharCode, 0, tabSize, columnsForFullWidthChar);
var startOffset = 1;
if (strings["z" /* isHighSurrogate */](prevCharCode)) {
// A surrogate pair must always be considered as a single unit, so it is never to be broken
visibleColumn += 1;
prevCharCode = lineText.charCodeAt(1);
prevCharCodeClass = classifier.get(prevCharCode);
startOffset++;
}
for (var i = startOffset; i < len; i++) {
var charStartOffset = i;
var charCode = lineText.charCodeAt(i);
var charCodeClass = void 0;
var charWidth = void 0;
if (strings["z" /* isHighSurrogate */](charCode)) {
// A surrogate pair must always be considered as a single unit, so it is never to be broken
i++;
charCodeClass = 0 /* NONE */;
charWidth = 2;
}
else {
charCodeClass = classifier.get(charCode);
charWidth = computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar);
}
if (canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass)) {
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn;
}
visibleColumn += charWidth;
// check if adding character at `i` will go over the breaking column
if (visibleColumn > breakingColumn) {
// We need to break at least before character at `i`:
if (breakOffset === 0 || visibleColumn - breakOffsetVisibleColumn > wrappedLineBreakColumn) {
// Cannot break at `breakOffset`, must break at `i`
breakOffset = charStartOffset;
breakOffsetVisibleColumn = visibleColumn - charWidth;
}
breakingOffsets[breakingOffsetsCount] = breakOffset;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = breakOffsetVisibleColumn;
breakingOffsetsCount++;
breakingColumn = breakOffsetVisibleColumn + wrappedLineBreakColumn;
breakOffset = 0;
}
prevCharCode = charCode;
prevCharCodeClass = charCodeClass;
}
if (breakingOffsetsCount === 0) {
return null;
}
// Add last segment
breakingOffsets[breakingOffsetsCount] = len;
breakingOffsetsVisibleColumn[breakingOffsetsCount] = visibleColumn;
return new LineBreakData(breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
}
function computeCharWidth(charCode, visibleColumn, tabSize, columnsForFullWidthChar) {
if (charCode === 9 /* Tab */) {
return (tabSize - (visibleColumn % tabSize));
}
if (strings["y" /* isFullWidthCharacter */](charCode)) {
return columnsForFullWidthChar;
}
return 1;
}
function tabCharacterWidth(visibleColumn, tabSize) {
return (tabSize - (visibleColumn % tabSize));
}
/**
* Kinsoku Shori : Don't break after a leading character, like an open bracket
* Kinsoku Shori : Don't break before a trailing character, like a period
*/
function canBreak(prevCharCode, prevCharCodeClass, charCode, charCodeClass) {
return (charCode !== 32 /* Space */
&& ((prevCharCodeClass === 2 /* BREAK_AFTER */)
|| (prevCharCodeClass === 3 /* BREAK_IDEOGRAPHIC */ && charCodeClass !== 2 /* BREAK_AFTER */)
|| (charCodeClass === 1 /* BREAK_BEFORE */)
|| (charCodeClass === 3 /* BREAK_IDEOGRAPHIC */ && prevCharCodeClass !== 1 /* BREAK_BEFORE */)));
}
function computeWrappedTextIndentLength(lineText, tabSize, firstLineBreakColumn, columnsForFullWidthChar, wrappingIndent) {
var wrappedTextIndentLength = 0;
if (wrappingIndent !== 0 /* None */) {
var firstNonWhitespaceIndex = strings["q" /* firstNonWhitespaceIndex */](lineText);
if (firstNonWhitespaceIndex !== -1) {
// Track existing indent
for (var i = 0; i < firstNonWhitespaceIndex; i++) {
var charWidth = (lineText.charCodeAt(i) === 9 /* Tab */ ? tabCharacterWidth(wrappedTextIndentLength, tabSize) : 1);
wrappedTextIndentLength += charWidth;
}
// Increase indent of continuation lines, if desired
var numberOfAdditionalTabs = (wrappingIndent === 3 /* DeepIndent */ ? 2 : wrappingIndent === 2 /* Indent */ ? 1 : 0);
for (var i = 0; i < numberOfAdditionalTabs; i++) {
var charWidth = tabCharacterWidth(wrappedTextIndentLength, tabSize);
wrappedTextIndentLength += charWidth;
}
// Force sticking to beginning of line if no character would fit except for the indentation
if (wrappedTextIndentLength + columnsForFullWidthChar > firstLineBreakColumn) {
wrappedTextIndentLength = 0;
}
}
}
return wrappedTextIndentLength;
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/view/domLineBreaksComputer.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var DOMLineBreaksComputerFactory = /** @class */ (function () {
function DOMLineBreaksComputerFactory() {
}
DOMLineBreaksComputerFactory.create = function () {
return new DOMLineBreaksComputerFactory();
};
DOMLineBreaksComputerFactory.prototype.createLineBreaksComputer = function (fontInfo, tabSize, wrappingColumn, wrappingIndent) {
tabSize = tabSize | 0; //@perf
wrappingColumn = +wrappingColumn; //@perf
var requests = [];
return {
addRequest: function (lineText, previousLineBreakData) {
requests.push(lineText);
},
finalize: function () {
return domLineBreaksComputer_createLineBreaks(requests, fontInfo, tabSize, wrappingColumn, wrappingIndent);
}
};
};
return DOMLineBreaksComputerFactory;
}());
function domLineBreaksComputer_createLineBreaks(requests, fontInfo, tabSize, firstLineBreakColumn, wrappingIndent) {
if (firstLineBreakColumn === -1) {
var result_1 = [];
for (var i = 0, len = requests.length; i < len; i++) {
result_1[i] = null;
}
return result_1;
}
var overallWidth = Math.round(firstLineBreakColumn * fontInfo.typicalHalfwidthCharacterWidth);
// Cannot respect WrappingIndent.Indent and WrappingIndent.DeepIndent because that would require
// two dom layouts, in order to first set the width of the first line, and then set the width of the wrapped lines
if (wrappingIndent === 2 /* Indent */ || wrappingIndent === 3 /* DeepIndent */) {
wrappingIndent = 1 /* Same */;
}
var containerDomNode = document.createElement('div');
config_configuration["a" /* Configuration */].applyFontInfoSlow(containerDomNode, fontInfo);
var sb = Object(stringBuilder["a" /* createStringBuilder */])(10000);
var firstNonWhitespaceIndices = [];
var wrappedTextIndentLengths = [];
var renderLineContents = [];
var allCharOffsets = [];
var allVisibleColumns = [];
for (var i = 0; i < requests.length; i++) {
var lineContent = requests[i];
var firstNonWhitespaceIndex = 0;
var wrappedTextIndentLength = 0;
var width = overallWidth;
if (wrappingIndent !== 0 /* None */) {
firstNonWhitespaceIndex = strings["q" /* firstNonWhitespaceIndex */](lineContent);
if (firstNonWhitespaceIndex === -1) {
// all whitespace line
firstNonWhitespaceIndex = 0;
}
else {
// Track existing indent
for (var i_1 = 0; i_1 < firstNonWhitespaceIndex; i_1++) {
var charWidth = (lineContent.charCodeAt(i_1) === 9 /* Tab */
? (tabSize - (wrappedTextIndentLength % tabSize))
: 1);
wrappedTextIndentLength += charWidth;
}
var indentWidth = Math.ceil(fontInfo.spaceWidth * wrappedTextIndentLength);
// Force sticking to beginning of line if no character would fit except for the indentation
if (indentWidth + fontInfo.typicalFullwidthCharacterWidth > overallWidth) {
firstNonWhitespaceIndex = 0;
wrappedTextIndentLength = 0;
}
else {
width = overallWidth - indentWidth;
}
}
}
var renderLineContent = lineContent.substr(firstNonWhitespaceIndex);
var tmp = renderLine(renderLineContent, wrappedTextIndentLength, tabSize, width, sb);
firstNonWhitespaceIndices[i] = firstNonWhitespaceIndex;
wrappedTextIndentLengths[i] = wrappedTextIndentLength;
renderLineContents[i] = renderLineContent;
allCharOffsets[i] = tmp[0];
allVisibleColumns[i] = tmp[1];
}
containerDomNode.innerHTML = sb.build();
containerDomNode.style.position = 'absolute';
containerDomNode.style.top = '10000';
containerDomNode.style.wordWrap = 'break-word';
document.body.appendChild(containerDomNode);
var range = document.createRange();
var lineDomNodes = Array.prototype.slice.call(containerDomNode.children, 0);
var result = [];
for (var i = 0; i < requests.length; i++) {
var lineDomNode = lineDomNodes[i];
var breakOffsets = readLineBreaks(range, lineDomNode, renderLineContents[i], allCharOffsets[i]);
if (breakOffsets === null) {
result[i] = null;
continue;
}
var firstNonWhitespaceIndex = firstNonWhitespaceIndices[i];
var wrappedTextIndentLength = wrappedTextIndentLengths[i];
var visibleColumns = allVisibleColumns[i];
var breakOffsetsVisibleColumn = [];
for (var j = 0, len = breakOffsets.length; j < len; j++) {
breakOffsetsVisibleColumn[j] = visibleColumns[breakOffsets[j]];
}
if (firstNonWhitespaceIndex !== 0) {
// All break offsets are relative to the renderLineContent, make them absolute again
for (var j = 0, len = breakOffsets.length; j < len; j++) {
breakOffsets[j] += firstNonWhitespaceIndex;
}
}
result[i] = new LineBreakData(breakOffsets, breakOffsetsVisibleColumn, wrappedTextIndentLength);
}
document.body.removeChild(containerDomNode);
return result;
}
function renderLine(lineContent, initialVisibleColumn, tabSize, width, sb) {
sb.appendASCIIString('
');
// if (containsRTL) {
// sb.appendASCIIString('" dir="ltr');
// }
var len = lineContent.length;
var visibleColumn = initialVisibleColumn;
var charOffset = 0;
var charOffsets = [];
var visibleColumns = [];
var nextCharCode = (0 < len ? lineContent.charCodeAt(0) : 0 /* Null */);
for (var charIndex = 0; charIndex < len; charIndex++) {
charOffsets[charIndex] = charOffset;
visibleColumns[charIndex] = visibleColumn;
var charCode = nextCharCode;
nextCharCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* Null */);
var producedCharacters = 1;
var charWidth = 1;
switch (charCode) {
case 9 /* Tab */:
producedCharacters = (tabSize - (visibleColumn % tabSize));
charWidth = producedCharacters;
for (var space = 1; space <= producedCharacters; space++) {
if (space < producedCharacters) {
sb.write1(0xA0); //
}
else {
sb.appendASCII(32 /* Space */);
}
}
break;
case 32 /* Space */:
if (nextCharCode === 32 /* Space */) {
sb.write1(0xA0); //
}
else {
sb.appendASCII(32 /* Space */);
}
break;
case 60 /* LessThan */:
sb.appendASCIIString('<');
break;
case 62 /* GreaterThan */:
sb.appendASCIIString('>');
break;
case 38 /* Ampersand */:
sb.appendASCIIString('&');
break;
case 0 /* Null */:
sb.appendASCIIString('�');
break;
case 65279 /* UTF8_BOM */:
case 8232 /* LINE_SEPARATOR_2028 */:
sb.write1(0xFFFD);
break;
default:
if (strings["y" /* isFullWidthCharacter */](charCode)) {
charWidth++;
}
// if (renderControlCharacters && charCode < 32) {
// sb.write1(9216 + charCode);
// } else {
sb.write1(charCode);
// }
}
charOffset += producedCharacters;
visibleColumn += charWidth;
}
charOffsets[lineContent.length] = charOffset;
visibleColumns[lineContent.length] = visibleColumn;
sb.appendASCIIString('
');
return [charOffsets, visibleColumns];
}
function readLineBreaks(range, lineDomNode, lineContent, charOffsets) {
if (lineContent.length <= 1) {
return null;
}
var textContentNode = lineDomNode.firstChild;
var breakOffsets = [];
discoverBreaks(range, textContentNode, charOffsets, 0, null, lineContent.length - 1, null, breakOffsets);
if (breakOffsets.length === 0) {
return null;
}
breakOffsets.push(lineContent.length);
return breakOffsets;
}
function discoverBreaks(range, textContentNode, charOffsets, low, lowRects, high, highRects, result) {
if (low === high) {
return;
}
lowRects = lowRects || readClientRect(range, textContentNode, charOffsets[low], charOffsets[low + 1]);
highRects = highRects || readClientRect(range, textContentNode, charOffsets[high], charOffsets[high + 1]);
if (Math.abs(lowRects[0].top - highRects[0].top) <= 0.1) {
// same line
return;
}
// there is at least one line break between these two offsets
if (low + 1 === high) {
// the two characters are adjacent, so the line break must be exactly between them
result.push(high);
return;
}
var mid = low + ((high - low) / 2) | 0;
var midRects = readClientRect(range, textContentNode, charOffsets[mid], charOffsets[mid + 1]);
discoverBreaks(range, textContentNode, charOffsets, low, lowRects, mid, midRects, result);
discoverBreaks(range, textContentNode, charOffsets, mid, midRects, high, highRects, result);
}
function readClientRect(range, textContentNode, startOffset, endOffset) {
range.setStart(textContentNode, startOffset);
range.setEnd(textContentNode, endOffset);
return range.getClientRects();
}
// CONCATENATED MODULE: ./node_modules/monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var codeEditorWidget_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (undefined && undefined.__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;
};
var __param = (undefined && undefined.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var EDITOR_ID = 0;
var codeEditorWidget_ModelData = /** @class */ (function () {
function ModelData(model, viewModel, cursor, view, hasRealView, listenersToRemove) {
this.model = model;
this.viewModel = viewModel;
this.cursor = cursor;
this.view = view;
this.hasRealView = hasRealView;
this.listenersToRemove = listenersToRemove;
}
ModelData.prototype.dispose = function () {
Object(lifecycle["f" /* dispose */])(this.listenersToRemove);
this.model.onBeforeDetached();
if (this.hasRealView) {
this.view.dispose();
}
this.cursor.dispose();
this.viewModel.dispose();
};
return ModelData;
}());
var codeEditorWidget_CodeEditorWidget = /** @class */ (function (_super) {
codeEditorWidget_extends(CodeEditorWidget, _super);
function CodeEditorWidget(domElement, options, codeEditorWidgetOptions, instantiationService, codeEditorService, commandService, contextKeyService, themeService, notificationService, accessibilityService) {
var _this = _super.call(this) || this;
//#region Eventing
_this._onDidDispose = _this._register(new common_event["a" /* Emitter */]());
_this.onDidDispose = _this._onDidDispose.event;
_this._onDidChangeModelContent = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModelContent = _this._onDidChangeModelContent.event;
_this._onDidChangeModelLanguage = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModelLanguage = _this._onDidChangeModelLanguage.event;
_this._onDidChangeModelLanguageConfiguration = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModelLanguageConfiguration = _this._onDidChangeModelLanguageConfiguration.event;
_this._onDidChangeModelOptions = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModelOptions = _this._onDidChangeModelOptions.event;
_this._onDidChangeModelDecorations = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModelDecorations = _this._onDidChangeModelDecorations.event;
_this._onDidChangeConfiguration = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeConfiguration = _this._onDidChangeConfiguration.event;
_this._onDidChangeModel = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeModel = _this._onDidChangeModel.event;
_this._onDidChangeCursorPosition = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeCursorPosition = _this._onDidChangeCursorPosition.event;
_this._onDidChangeCursorSelection = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeCursorSelection = _this._onDidChangeCursorSelection.event;
_this._onDidAttemptReadOnlyEdit = _this._register(new common_event["a" /* Emitter */]());
_this.onDidAttemptReadOnlyEdit = _this._onDidAttemptReadOnlyEdit.event;
_this._onDidLayoutChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidLayoutChange = _this._onDidLayoutChange.event;
_this._editorTextFocus = _this._register(new codeEditorWidget_BooleanEventEmitter());
_this.onDidFocusEditorText = _this._editorTextFocus.onDidChangeToTrue;
_this.onDidBlurEditorText = _this._editorTextFocus.onDidChangeToFalse;
_this._editorWidgetFocus = _this._register(new codeEditorWidget_BooleanEventEmitter());
_this.onDidFocusEditorWidget = _this._editorWidgetFocus.onDidChangeToTrue;
_this.onDidBlurEditorWidget = _this._editorWidgetFocus.onDidChangeToFalse;
_this._onWillType = _this._register(new common_event["a" /* Emitter */]());
_this.onWillType = _this._onWillType.event;
_this._onDidType = _this._register(new common_event["a" /* Emitter */]());
_this.onDidType = _this._onDidType.event;
_this._onDidCompositionStart = _this._register(new common_event["a" /* Emitter */]());
_this.onDidCompositionStart = _this._onDidCompositionStart.event;
_this._onDidCompositionEnd = _this._register(new common_event["a" /* Emitter */]());
_this.onDidCompositionEnd = _this._onDidCompositionEnd.event;
_this._onDidPaste = _this._register(new common_event["a" /* Emitter */]());
_this.onDidPaste = _this._onDidPaste.event;
_this._onMouseUp = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseUp = _this._onMouseUp.event;
_this._onMouseDown = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseDown = _this._onMouseDown.event;
_this._onMouseDrag = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseDrag = _this._onMouseDrag.event;
_this._onMouseDrop = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseDrop = _this._onMouseDrop.event;
_this._onContextMenu = _this._register(new common_event["a" /* Emitter */]());
_this.onContextMenu = _this._onContextMenu.event;
_this._onMouseMove = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseMove = _this._onMouseMove.event;
_this._onMouseLeave = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseLeave = _this._onMouseLeave.event;
_this._onMouseWheel = _this._register(new common_event["a" /* Emitter */]());
_this.onMouseWheel = _this._onMouseWheel.event;
_this._onKeyUp = _this._register(new common_event["a" /* Emitter */]());
_this.onKeyUp = _this._onKeyUp.event;
_this._onKeyDown = _this._register(new common_event["a" /* Emitter */]());
_this.onKeyDown = _this._onKeyDown.event;
_this._onDidContentSizeChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidContentSizeChange = _this._onDidContentSizeChange.event;
_this._onDidScrollChange = _this._register(new common_event["a" /* Emitter */]());
_this.onDidScrollChange = _this._onDidScrollChange.event;
_this._onDidChangeViewZones = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeViewZones = _this._onDidChangeViewZones.event;
_this._domElement = domElement;
_this._id = (++EDITOR_ID);
_this._decorationTypeKeysToIds = {};
_this._decorationTypeSubtypes = {};
_this.isSimpleWidget = codeEditorWidgetOptions.isSimpleWidget || false;
_this._telemetryData = codeEditorWidgetOptions.telemetryData;
options = options || {};
_this._configuration = _this._register(_this._createConfiguration(options, accessibilityService));
_this._register(_this._configuration.onDidChange(function (e) {
_this._onDidChangeConfiguration.fire(e);
var options = _this._configuration.options;
if (e.hasChanged(107 /* layoutInfo */)) {
var layoutInfo = options.get(107 /* 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 codeEditorWidget_EditorContextKeysManager(_this, _this._contextKeyService));
_this._register(new codeEditorWidget_EditorModeContext(_this, _this._contextKeyService));
_this._instantiationService = instantiationService.createChild(new serviceCollection["a" /* ServiceCollection */]([contextkey["c" /* IContextKeyService */], _this._contextKeyService]));
_this._modelData = null;
_this._contributions = {};
_this._actions = {};
_this._focusTracker = new codeEditorWidget_CodeEditorWidgetFocusTracker(domElement);
_this._focusTracker.onChange(function () {
_this._editorWidgetFocus.setValue(_this._focusTracker.hasFocus());
});
_this._contentWidgets = {};
_this._overlayWidgets = {};
var contributions;
if (Array.isArray(codeEditorWidgetOptions.contributions)) {
contributions = codeEditorWidgetOptions.contributions;
}
else {
contributions = editorExtensions["d" /* EditorExtensionsRegistry */].getEditorContributions();
}
for (var _i = 0, contributions_1 = contributions; _i < contributions_1.length; _i++) {
var desc = contributions_1[_i];
try {
var contribution = _this._instantiationService.createInstance(desc.ctor, _this);
_this._contributions[desc.id] = contribution;
}
catch (err) {
Object(errors["e" /* onUnexpectedError */])(err);
}
}
editorExtensions["d" /* EditorExtensionsRegistry */].getEditorActions().forEach(function (action) {
var internalAction = new editorAction["a" /* InternalEditorAction */](action.id, action.label, action.alias, Object(types["n" /* withNullAsUndefined */])(action.precondition), function () {
return _this._instantiationService.invokeFunction(function (accessor) {
return Promise.resolve(action.runEditorCommand(accessor, _this, null));
});
}, _this._contextKeyService);
_this._actions[internalAction.id] = internalAction;
});
_this._codeEditorService.addCodeEditor(_this);
return _this;
}
CodeEditorWidget.prototype._createConfiguration = function (options, accessibilityService) {
return new config_configuration["a" /* Configuration */](this.isSimpleWidget, options, this._domElement, accessibilityService);
};
CodeEditorWidget.prototype.getId = function () {
return this.getEditorType() + ':' + this._id;
};
CodeEditorWidget.prototype.getEditorType = function () {
return editorCommon["a" /* EditorType */].ICodeEditor;
};
CodeEditorWidget.prototype.dispose = function () {
this._codeEditorService.removeCodeEditor(this);
this._focusTracker.dispose();
var keys = Object.keys(this._contributions);
for (var i = 0, len = keys.length; i < len; i++) {
var contributionId = keys[i];
this._contributions[contributionId].dispose();
}
this._removeDecorationTypes();
this._postDetachModelCleanup(this._detachModel());
this._onDidDispose.fire();
_super.prototype.dispose.call(this);
};
CodeEditorWidget.prototype.invokeWithinContext = function (fn) {
return this._instantiationService.invokeFunction(fn);
};
CodeEditorWidget.prototype.updateOptions = function (newOptions) {
this._configuration.updateOptions(newOptions);
};
CodeEditorWidget.prototype.getOptions = function () {
return this._configuration.options;
};
CodeEditorWidget.prototype.getOption = function (id) {
return this._configuration.options.get(id);
};
CodeEditorWidget.prototype.getRawOptions = function () {
return this._configuration.getRawOptions();
};
CodeEditorWidget.prototype.getValue = function (options) {
if (options === void 0) { options = null; }
if (!this._modelData) {
return '';
}
var preserveBOM = (options && options.preserveBOM) ? true : false;
var eolPreference = 0 /* TextDefined */;
if (options && options.lineEnding && options.lineEnding === '\n') {
eolPreference = 1 /* LF */;
}
else if (options && options.lineEnding && options.lineEnding === '\r\n') {
eolPreference = 2 /* CRLF */;
}
return this._modelData.model.getValue(eolPreference, preserveBOM);
};
CodeEditorWidget.prototype.setValue = function (newValue) {
if (!this._modelData) {
return;
}
this._modelData.model.setValue(newValue);
};
CodeEditorWidget.prototype.getModel = function () {
if (!this._modelData) {
return null;
}
return this._modelData.model;
};
CodeEditorWidget.prototype.setModel = function (_model) {
if (_model === void 0) { _model = null; }
var model = _model;
if (this._modelData === null && model === null) {
// Current model is the new model
return;
}
if (this._modelData && this._modelData.model === model) {
// Current model is the new model
return;
}
var hasTextFocus = this.hasTextFocus();
var detachedModel = this._detachModel();
this._attachModel(model);
if (hasTextFocus && this.hasModel()) {
this.focus();
}
var e = {
oldModelUrl: detachedModel ? detachedModel.uri : null,
newModelUrl: model ? model.uri : null
};
this._removeDecorationTypes();
this._onDidChangeModel.fire(e);
this._postDetachModelCleanup(detachedModel);
};
CodeEditorWidget.prototype._removeDecorationTypes = function () {
this._decorationTypeKeysToIds = {};
if (this._decorationTypeSubtypes) {
for (var decorationType in this._decorationTypeSubtypes) {
var subTypes = this._decorationTypeSubtypes[decorationType];
for (var subType in subTypes) {
this._removeDecorationType(decorationType + '-' + subType);
}
}
this._decorationTypeSubtypes = {};
}
};
CodeEditorWidget.prototype.getVisibleRanges = function () {
if (!this._modelData) {
return [];
}
return this._modelData.viewModel.getVisibleRanges();
};
CodeEditorWidget.prototype.getWhitespaces = function () {
if (!this._modelData) {
return [];
}
return this._modelData.viewModel.viewLayout.getWhitespaces();
};
CodeEditorWidget._getVerticalOffsetForPosition = function (modelData, modelLineNumber, modelColumn) {
var modelPosition = modelData.model.validatePosition({
lineNumber: modelLineNumber,
column: modelColumn
});
var viewPosition = modelData.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelPosition);
return modelData.viewModel.viewLayout.getVerticalOffsetForLineNumber(viewPosition.lineNumber);
};
CodeEditorWidget.prototype.getTopForLineNumber = function (lineNumber) {
if (!this._modelData) {
return -1;
}
return CodeEditorWidget._getVerticalOffsetForPosition(this._modelData, lineNumber, 1);
};
CodeEditorWidget.prototype.getTopForPosition = function (lineNumber, column) {
if (!this._modelData) {
return -1;
}
return CodeEditorWidget._getVerticalOffsetForPosition(this._modelData, lineNumber, column);
};
CodeEditorWidget.prototype.setHiddenAreas = function (ranges) {
if (this._modelData) {
this._modelData.viewModel.setHiddenAreas(ranges.map(function (r) { return core_range["a" /* Range */].lift(r); }));
}
};
CodeEditorWidget.prototype.getVisibleColumnFromPosition = function (rawPosition) {
if (!this._modelData) {
return rawPosition.column;
}
var position = this._modelData.model.validatePosition(rawPosition);
var tabSize = this._modelData.model.getOptions().tabSize;
return cursorCommon["a" /* CursorColumns */].visibleColumnFromColumn(this._modelData.model.getLineContent(position.lineNumber), position.column, tabSize) + 1;
};
CodeEditorWidget.prototype.getPosition = function () {
if (!this._modelData) {
return null;
}
return this._modelData.cursor.getPosition();
};
CodeEditorWidget.prototype.setPosition = function (position) {
if (!this._modelData) {
return;
}
if (!core_position["a" /* Position */].isIPosition(position)) {
throw new Error('Invalid arguments');
}
this._modelData.cursor.setSelections('api', [{
selectionStartLineNumber: position.lineNumber,
selectionStartColumn: position.column,
positionLineNumber: position.lineNumber,
positionColumn: position.column
}]);
};
CodeEditorWidget.prototype._sendRevealRange = function (modelRange, verticalType, revealHorizontal, scrollType) {
if (!this._modelData) {
return;
}
if (!core_range["a" /* Range */].isIRange(modelRange)) {
throw new Error('Invalid arguments');
}
var validatedModelRange = this._modelData.model.validateRange(modelRange);
var viewRange = this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(validatedModelRange);
this._modelData.cursor.emitCursorRevealRange('api', viewRange, verticalType, revealHorizontal, scrollType);
};
CodeEditorWidget.prototype.revealLine = function (lineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLine(lineNumber, 0 /* Simple */, scrollType);
};
CodeEditorWidget.prototype.revealLineInCenter = function (lineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLine(lineNumber, 1 /* Center */, scrollType);
};
CodeEditorWidget.prototype.revealLineInCenterIfOutsideViewport = function (lineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLine(lineNumber, 2 /* CenterIfOutsideViewport */, scrollType);
};
CodeEditorWidget.prototype._revealLine = function (lineNumber, revealType, scrollType) {
if (typeof lineNumber !== 'number') {
throw new Error('Invalid arguments');
}
this._sendRevealRange(new core_range["a" /* Range */](lineNumber, 1, lineNumber, 1), revealType, false, scrollType);
};
CodeEditorWidget.prototype.revealPosition = function (position, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealPosition(position, 0 /* Simple */, true, scrollType);
};
CodeEditorWidget.prototype.revealPositionInCenter = function (position, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealPosition(position, 1 /* Center */, true, scrollType);
};
CodeEditorWidget.prototype.revealPositionInCenterIfOutsideViewport = function (position, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealPosition(position, 2 /* CenterIfOutsideViewport */, true, scrollType);
};
CodeEditorWidget.prototype._revealPosition = function (position, verticalType, revealHorizontal, scrollType) {
if (!core_position["a" /* Position */].isIPosition(position)) {
throw new Error('Invalid arguments');
}
this._sendRevealRange(new core_range["a" /* Range */](position.lineNumber, position.column, position.lineNumber, position.column), verticalType, revealHorizontal, scrollType);
};
CodeEditorWidget.prototype.getSelection = function () {
if (!this._modelData) {
return null;
}
return this._modelData.cursor.getSelection();
};
CodeEditorWidget.prototype.getSelections = function () {
if (!this._modelData) {
return null;
}
return this._modelData.cursor.getSelections();
};
CodeEditorWidget.prototype.setSelection = function (something) {
var isSelection = core_selection["a" /* Selection */].isISelection(something);
var isRange = core_range["a" /* Range */].isIRange(something);
if (!isSelection && !isRange) {
throw new Error('Invalid arguments');
}
if (isSelection) {
this._setSelectionImpl(something);
}
else if (isRange) {
// act as if it was an IRange
var selection = {
selectionStartLineNumber: something.startLineNumber,
selectionStartColumn: something.startColumn,
positionLineNumber: something.endLineNumber,
positionColumn: something.endColumn
};
this._setSelectionImpl(selection);
}
};
CodeEditorWidget.prototype._setSelectionImpl = function (sel) {
if (!this._modelData) {
return;
}
var selection = new core_selection["a" /* Selection */](sel.selectionStartLineNumber, sel.selectionStartColumn, sel.positionLineNumber, sel.positionColumn);
this._modelData.cursor.setSelections('api', [selection]);
};
CodeEditorWidget.prototype.revealLines = function (startLineNumber, endLineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLines(startLineNumber, endLineNumber, 0 /* Simple */, scrollType);
};
CodeEditorWidget.prototype.revealLinesInCenter = function (startLineNumber, endLineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLines(startLineNumber, endLineNumber, 1 /* Center */, scrollType);
};
CodeEditorWidget.prototype.revealLinesInCenterIfOutsideViewport = function (startLineNumber, endLineNumber, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealLines(startLineNumber, endLineNumber, 2 /* CenterIfOutsideViewport */, scrollType);
};
CodeEditorWidget.prototype._revealLines = function (startLineNumber, endLineNumber, verticalType, scrollType) {
if (typeof startLineNumber !== 'number' || typeof endLineNumber !== 'number') {
throw new Error('Invalid arguments');
}
this._sendRevealRange(new core_range["a" /* Range */](startLineNumber, 1, endLineNumber, 1), verticalType, false, scrollType);
};
CodeEditorWidget.prototype.revealRange = function (range, scrollType, revealVerticalInCenter, revealHorizontal) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
if (revealVerticalInCenter === void 0) { revealVerticalInCenter = false; }
if (revealHorizontal === void 0) { revealHorizontal = true; }
this._revealRange(range, revealVerticalInCenter ? 1 /* Center */ : 0 /* Simple */, revealHorizontal, scrollType);
};
CodeEditorWidget.prototype.revealRangeInCenter = function (range, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealRange(range, 1 /* Center */, true, scrollType);
};
CodeEditorWidget.prototype.revealRangeInCenterIfOutsideViewport = function (range, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealRange(range, 2 /* CenterIfOutsideViewport */, true, scrollType);
};
CodeEditorWidget.prototype.revealRangeAtTop = function (range, scrollType) {
if (scrollType === void 0) { scrollType = 0 /* Smooth */; }
this._revealRange(range, 3 /* Top */, true, scrollType);
};
CodeEditorWidget.prototype._revealRange = function (range, verticalType, revealHorizontal, scrollType) {
if (!core_range["a" /* Range */].isIRange(range)) {
throw new Error('Invalid arguments');
}
this._sendRevealRange(core_range["a" /* Range */].lift(range), verticalType, revealHorizontal, scrollType);
};
CodeEditorWidget.prototype.setSelections = function (ranges, source) {
if (source === void 0) { source = 'api'; }
if (!this._modelData) {
return;
}
if (!ranges || ranges.length === 0) {
throw new Error('Invalid arguments');
}
for (var i = 0, len = ranges.length; i < len; i++) {
if (!core_selection["a" /* Selection */].isISelection(ranges[i])) {
throw new Error('Invalid arguments');
}
}
this._modelData.cursor.setSelections(source, ranges);
};
CodeEditorWidget.prototype.getContentWidth = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getContentWidth();
};
CodeEditorWidget.prototype.getScrollWidth = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getScrollWidth();
};
CodeEditorWidget.prototype.getScrollLeft = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getCurrentScrollLeft();
};
CodeEditorWidget.prototype.getContentHeight = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getContentHeight();
};
CodeEditorWidget.prototype.getScrollHeight = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getScrollHeight();
};
CodeEditorWidget.prototype.getScrollTop = function () {
if (!this._modelData) {
return -1;
}
return this._modelData.viewModel.viewLayout.getCurrentScrollTop();
};
CodeEditorWidget.prototype.setScrollLeft = function (newScrollLeft) {
if (!this._modelData) {
return;
}
if (typeof newScrollLeft !== 'number') {
throw new Error('Invalid arguments');
}
this._modelData.viewModel.viewLayout.setScrollPositionNow({
scrollLeft: newScrollLeft
});
};
CodeEditorWidget.prototype.setScrollTop = function (newScrollTop) {
if (!this._modelData) {
return;
}
if (typeof newScrollTop !== 'number') {
throw new Error('Invalid arguments');
}
this._modelData.viewModel.viewLayout.setScrollPositionNow({
scrollTop: newScrollTop
});
};
CodeEditorWidget.prototype.setScrollPosition = function (position) {
if (!this._modelData) {
return;
}
this._modelData.viewModel.viewLayout.setScrollPositionNow(position);
};
CodeEditorWidget.prototype.saveViewState = function () {
if (!this._modelData) {
return null;
}
var contributionsState = {};
var keys = Object.keys(this._contributions);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var id = keys_1[_i];
var contribution = this._contributions[id];
if (typeof contribution.saveViewState === 'function') {
contributionsState[id] = contribution.saveViewState();
}
}
var cursorState = this._modelData.cursor.saveState();
var viewState = this._modelData.viewModel.saveState();
return {
cursorState: cursorState,
viewState: viewState,
contributionsState: contributionsState
};
};
CodeEditorWidget.prototype.restoreViewState = function (s) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
var codeEditorState = s;
if (codeEditorState && codeEditorState.cursorState && codeEditorState.viewState) {
var cursorState = codeEditorState.cursorState;
if (Array.isArray(cursorState)) {
this._modelData.cursor.restoreState(cursorState);
}
else {
// Backwards compatibility
this._modelData.cursor.restoreState([cursorState]);
}
var contributionsState = codeEditorState.contributionsState || {};
var keys = Object.keys(this._contributions);
for (var i = 0, len = keys.length; i < len; i++) {
var id = keys[i];
var contribution = this._contributions[id];
if (typeof contribution.restoreViewState === 'function') {
contribution.restoreViewState(contributionsState[id]);
}
}
var reducedState = this._modelData.viewModel.reduceRestoreState(codeEditorState.viewState);
this._modelData.view.restoreState(reducedState);
}
};
CodeEditorWidget.prototype.getContribution = function (id) {
return (this._contributions[id] || null);
};
CodeEditorWidget.prototype.getActions = function () {
var result = [];
var keys = Object.keys(this._actions);
for (var i = 0, len = keys.length; i < len; i++) {
var id = keys[i];
result.push(this._actions[id]);
}
return result;
};
CodeEditorWidget.prototype.getSupportedActions = function () {
var result = this.getActions();
result = result.filter(function (action) { return action.isSupported(); });
return result;
};
CodeEditorWidget.prototype.getAction = function (id) {
return this._actions[id] || null;
};
CodeEditorWidget.prototype.trigger = function (source, handlerId, payload) {
payload = payload || {};
// Special case for typing
if (handlerId === editorCommon["b" /* Handler */].Type) {
if (!this._modelData || typeof payload.text !== 'string' || payload.text.length === 0) {
// nothing to do
return;
}
if (source === 'keyboard') {
this._onWillType.fire(payload.text);
}
this._modelData.cursor.trigger(source, handlerId, payload);
if (source === 'keyboard') {
this._onDidType.fire(payload.text);
}
return;
}
// Special case for pasting
if (handlerId === editorCommon["b" /* Handler */].Paste) {
if (!this._modelData || typeof payload.text !== 'string' || payload.text.length === 0) {
// nothing to do
return;
}
var startPosition = this._modelData.cursor.getSelection().getStartPosition();
this._modelData.cursor.trigger(source, handlerId, payload);
var endPosition = this._modelData.cursor.getSelection().getStartPosition();
if (source === 'keyboard') {
this._onDidPaste.fire({
range: new core_range["a" /* Range */](startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column),
mode: payload.mode
});
}
return;
}
var action = this.getAction(handlerId);
if (action) {
Promise.resolve(action.run()).then(undefined, errors["e" /* onUnexpectedError */]);
return;
}
if (!this._modelData) {
return;
}
if (this._triggerEditorCommand(source, handlerId, payload)) {
return;
}
this._modelData.cursor.trigger(source, handlerId, payload);
if (handlerId === editorCommon["b" /* Handler */].CompositionStart) {
this._onDidCompositionStart.fire();
}
if (handlerId === editorCommon["b" /* Handler */].CompositionEnd) {
this._onDidCompositionEnd.fire();
}
};
CodeEditorWidget.prototype._triggerEditorCommand = function (source, handlerId, payload) {
var _this = this;
var command = editorExtensions["d" /* EditorExtensionsRegistry */].getEditorCommand(handlerId);
if (command) {
payload = payload || {};
payload.source = source;
this._instantiationService.invokeFunction(function (accessor) {
Promise.resolve(command.runEditorCommand(accessor, _this, payload)).then(undefined, errors["e" /* onUnexpectedError */]);
});
return true;
}
return false;
};
CodeEditorWidget.prototype._getCursors = function () {
if (!this._modelData) {
return null;
}
return this._modelData.cursor;
};
CodeEditorWidget.prototype.pushUndoStop = function () {
if (!this._modelData) {
return false;
}
if (this._configuration.options.get(68 /* readOnly */)) {
// read only editor => sorry!
return false;
}
this._modelData.model.pushStackElement();
return true;
};
CodeEditorWidget.prototype.executeEdits = function (source, edits, endCursorState) {
if (!this._modelData) {
return false;
}
if (this._configuration.options.get(68 /* readOnly */)) {
// read only editor => sorry!
return false;
}
var cursorStateComputer;
if (!endCursorState) {
cursorStateComputer = function () { return null; };
}
else if (Array.isArray(endCursorState)) {
cursorStateComputer = function () { return endCursorState; };
}
else {
cursorStateComputer = endCursorState;
}
this._modelData.cursor.executeEdits(source, edits, cursorStateComputer);
return true;
};
CodeEditorWidget.prototype.executeCommand = function (source, command) {
if (!this._modelData) {
return;
}
this._modelData.cursor.trigger(source, editorCommon["b" /* Handler */].ExecuteCommand, command);
};
CodeEditorWidget.prototype.executeCommands = function (source, commands) {
if (!this._modelData) {
return;
}
this._modelData.cursor.trigger(source, editorCommon["b" /* Handler */].ExecuteCommands, commands);
};
CodeEditorWidget.prototype.changeDecorations = function (callback) {
if (!this._modelData) {
// callback will not be called
return null;
}
return this._modelData.model.changeDecorations(callback, this._id);
};
CodeEditorWidget.prototype.getLineDecorations = function (lineNumber) {
if (!this._modelData) {
return null;
}
return this._modelData.model.getLineDecorations(lineNumber, this._id, Object(editorOptions["j" /* filterValidationDecorations */])(this._configuration.options));
};
CodeEditorWidget.prototype.deltaDecorations = function (oldDecorations, newDecorations) {
if (!this._modelData) {
return [];
}
if (oldDecorations.length === 0 && newDecorations.length === 0) {
return oldDecorations;
}
return this._modelData.model.deltaDecorations(oldDecorations, newDecorations, this._id);
};
CodeEditorWidget.prototype.removeDecorations = function (decorationTypeKey) {
// remove decorations for type and sub type
var oldDecorationsIds = this._decorationTypeKeysToIds[decorationTypeKey];
if (oldDecorationsIds) {
this.deltaDecorations(oldDecorationsIds, []);
}
if (this._decorationTypeKeysToIds.hasOwnProperty(decorationTypeKey)) {
delete this._decorationTypeKeysToIds[decorationTypeKey];
}
if (this._decorationTypeSubtypes.hasOwnProperty(decorationTypeKey)) {
delete this._decorationTypeSubtypes[decorationTypeKey];
}
};
CodeEditorWidget.prototype.getLayoutInfo = function () {
var options = this._configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
return layoutInfo;
};
CodeEditorWidget.prototype.createOverviewRuler = function (cssClassName) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.createOverviewRuler(cssClassName);
};
CodeEditorWidget.prototype.getContainerDomNode = function () {
return this._domElement;
};
CodeEditorWidget.prototype.getDomNode = function () {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.domNode.domNode;
};
CodeEditorWidget.prototype.delegateVerticalScrollbarMouseDown = function (browserEvent) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.delegateVerticalScrollbarMouseDown(browserEvent);
};
CodeEditorWidget.prototype.layout = function (dimension) {
this._configuration.observeReferenceElement(dimension);
this.render();
};
CodeEditorWidget.prototype.focus = function () {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.focus();
};
CodeEditorWidget.prototype.hasTextFocus = function () {
if (!this._modelData || !this._modelData.hasRealView) {
return false;
}
return this._modelData.view.isFocused();
};
CodeEditorWidget.prototype.hasWidgetFocus = function () {
return this._focusTracker && this._focusTracker.hasFocus();
};
CodeEditorWidget.prototype.addContentWidget = function (widget) {
var widgetData = {
widget: widget,
position: widget.getPosition()
};
if (this._contentWidgets.hasOwnProperty(widget.getId())) {
console.warn('Overwriting a content widget with the same id.');
}
this._contentWidgets[widget.getId()] = widgetData;
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.addContentWidget(widgetData);
}
};
CodeEditorWidget.prototype.layoutContentWidget = function (widget) {
var widgetId = widget.getId();
if (this._contentWidgets.hasOwnProperty(widgetId)) {
var widgetData = this._contentWidgets[widgetId];
widgetData.position = widget.getPosition();
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.layoutContentWidget(widgetData);
}
}
};
CodeEditorWidget.prototype.removeContentWidget = function (widget) {
var widgetId = widget.getId();
if (this._contentWidgets.hasOwnProperty(widgetId)) {
var widgetData = this._contentWidgets[widgetId];
delete this._contentWidgets[widgetId];
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.removeContentWidget(widgetData);
}
}
};
CodeEditorWidget.prototype.addOverlayWidget = function (widget) {
var widgetData = {
widget: 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);
}
};
CodeEditorWidget.prototype.layoutOverlayWidget = function (widget) {
var widgetId = widget.getId();
if (this._overlayWidgets.hasOwnProperty(widgetId)) {
var widgetData = this._overlayWidgets[widgetId];
widgetData.position = widget.getPosition();
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.layoutOverlayWidget(widgetData);
}
}
};
CodeEditorWidget.prototype.removeOverlayWidget = function (widget) {
var widgetId = widget.getId();
if (this._overlayWidgets.hasOwnProperty(widgetId)) {
var widgetData = this._overlayWidgets[widgetId];
delete this._overlayWidgets[widgetId];
if (this._modelData && this._modelData.hasRealView) {
this._modelData.view.removeOverlayWidget(widgetData);
}
}
};
CodeEditorWidget.prototype.changeViewZones = function (callback) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
var hasChanges = this._modelData.view.change(callback);
if (hasChanges) {
this._onDidChangeViewZones.fire();
}
};
CodeEditorWidget.prototype.getTargetAtClientPoint = function (clientX, clientY) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
return this._modelData.view.getTargetAtClientPoint(clientX, clientY);
};
CodeEditorWidget.prototype.getScrolledVisiblePosition = function (rawPosition) {
if (!this._modelData || !this._modelData.hasRealView) {
return null;
}
var position = this._modelData.model.validatePosition(rawPosition);
var options = this._configuration.options;
var layoutInfo = options.get(107 /* layoutInfo */);
var top = CodeEditorWidget._getVerticalOffsetForPosition(this._modelData, position.lineNumber, position.column) - this.getScrollTop();
var left = this._modelData.view.getOffsetForColumn(position.lineNumber, position.column) + layoutInfo.glyphMarginWidth + layoutInfo.lineNumbersWidth + layoutInfo.decorationsWidth - this.getScrollLeft();
return {
top: top,
left: left,
height: options.get(49 /* lineHeight */)
};
};
CodeEditorWidget.prototype.getOffsetForColumn = function (lineNumber, column) {
if (!this._modelData || !this._modelData.hasRealView) {
return -1;
}
return this._modelData.view.getOffsetForColumn(lineNumber, column);
};
CodeEditorWidget.prototype.render = function (forceRedraw) {
if (forceRedraw === void 0) { forceRedraw = false; }
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.render(true, forceRedraw);
};
CodeEditorWidget.prototype.setAriaOptions = function (options) {
if (!this._modelData || !this._modelData.hasRealView) {
return;
}
this._modelData.view.setAriaOptions(options);
};
CodeEditorWidget.prototype.applyFontInfo = function (target) {
config_configuration["a" /* Configuration */].applyFontInfoSlow(target, this._configuration.options.get(34 /* fontInfo */));
};
CodeEditorWidget.prototype._attachModel = function (model) {
var _this = this;
if (!model) {
this._modelData = null;
return;
}
var listenersToRemove = [];
this._domElement.setAttribute('data-mode-id', model.getLanguageIdentifier().language);
this._configuration.setIsDominatedByLongLines(model.isDominatedByLongLines());
this._configuration.setMaxLineNumber(model.getLineCount());
model.onBeforeAttached();
var viewModel = new viewModelImpl_ViewModel(this._id, this._configuration, model, DOMLineBreaksComputerFactory.create(), MonospaceLineBreaksComputerFactory.create(this._configuration.options), function (callback) { return dom["W" /* scheduleAtNextAnimationFrame */](callback); });
listenersToRemove.push(model.onDidChangeDecorations(function (e) { return _this._onDidChangeModelDecorations.fire(e); }));
listenersToRemove.push(model.onDidChangeLanguage(function (e) {
_this._domElement.setAttribute('data-mode-id', model.getLanguageIdentifier().language);
_this._onDidChangeModelLanguage.fire(e);
}));
listenersToRemove.push(model.onDidChangeLanguageConfiguration(function (e) { return _this._onDidChangeModelLanguageConfiguration.fire(e); }));
listenersToRemove.push(model.onDidChangeContent(function (e) { return _this._onDidChangeModelContent.fire(e); }));
listenersToRemove.push(model.onDidChangeOptions(function (e) { return _this._onDidChangeModelOptions.fire(e); }));
// Someone might destroy the model from under the editor, so prevent any exceptions by setting a null model
listenersToRemove.push(model.onWillDispose(function () { return _this.setModel(null); }));
var cursor = new cursor_Cursor(this._configuration, model, viewModel);
listenersToRemove.push(cursor.onDidReachMaxCursorCount(function () {
_this._notificationService.warn(nls["a" /* localize */]('cursors.maximum', "The number of cursors has been limited to {0}.", cursor_Cursor.MAX_CURSOR_COUNT));
}));
listenersToRemove.push(cursor.onDidAttemptReadOnlyEdit(function () {
_this._onDidAttemptReadOnlyEdit.fire(undefined);
}));
listenersToRemove.push(cursor.onDidChange(function (e) {
var positions = [];
for (var i = 0, len = e.selections.length; i < len; i++) {
positions[i] = e.selections[i].getPosition();
}
var e1 = {
position: positions[0],
secondaryPositions: positions.slice(1),
reason: e.reason,
source: e.source
};
_this._onDidChangeCursorPosition.fire(e1);
var 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);
}));
var _a = this._createView(viewModel, cursor), view = _a[0], hasRealView = _a[1];
if (hasRealView) {
this._domElement.appendChild(view.domNode.domNode);
var keys = Object.keys(this._contentWidgets);
for (var i = 0, len = keys.length; i < len; i++) {
var widgetId = keys[i];
view.addContentWidget(this._contentWidgets[widgetId]);
}
keys = Object.keys(this._overlayWidgets);
for (var i = 0, len = keys.length; i < len; i++) {
var widgetId = keys[i];
view.addOverlayWidget(this._overlayWidgets[widgetId]);
}
view.render(false, true);
view.domNode.domNode.setAttribute('data-uri', model.uri.toString());
}
this._modelData = new codeEditorWidget_ModelData(model, viewModel, cursor, view, hasRealView, listenersToRemove);
};
CodeEditorWidget.prototype._createView = function (viewModel, cursor) {
var _this = this;
var commandDelegate;
if (this.isSimpleWidget) {
commandDelegate = {
executeEditorCommand: function (editorCommand, args) {
editorCommand.runCoreEditorCommand(cursor, args);
},
paste: function (source, text, pasteOnNewLine, multicursorText, mode) {
_this.trigger(source, editorCommon["b" /* Handler */].Paste, { text: text, pasteOnNewLine: pasteOnNewLine, multicursorText: multicursorText, mode: mode });
},
type: function (source, text) {
_this.trigger(source, editorCommon["b" /* Handler */].Type, { text: text });
},
replacePreviousChar: function (source, text, replaceCharCnt) {
_this.trigger(source, editorCommon["b" /* Handler */].ReplacePreviousChar, { text: text, replaceCharCnt: replaceCharCnt });
},
compositionStart: function (source) {
_this.trigger(source, editorCommon["b" /* Handler */].CompositionStart, undefined);
},
compositionEnd: function (source) {
_this.trigger(source, editorCommon["b" /* Handler */].CompositionEnd, undefined);
},
cut: function (source) {
_this.trigger(source, editorCommon["b" /* Handler */].Cut, undefined);
}
};
}
else {
commandDelegate = {
executeEditorCommand: function (editorCommand, args) {
editorCommand.runCoreEditorCommand(cursor, args);
},
paste: function (source, text, pasteOnNewLine, multicursorText, mode) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].Paste, {
text: text,
pasteOnNewLine: pasteOnNewLine,
multicursorText: multicursorText,
mode: mode
});
},
type: function (source, text) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].Type, {
text: text
});
},
replacePreviousChar: function (source, text, replaceCharCnt) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].ReplacePreviousChar, {
text: text,
replaceCharCnt: replaceCharCnt
});
},
compositionStart: function (source) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].CompositionStart, {});
},
compositionEnd: function (source) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].CompositionEnd, {});
},
cut: function (source) {
_this._commandService.executeCommand(editorCommon["b" /* Handler */].Cut, {});
}
};
}
var viewOutgoingEvents = new ViewOutgoingEvents(viewModel);
viewOutgoingEvents.onDidContentSizeChange = function (e) { return _this._onDidContentSizeChange.fire(e); };
viewOutgoingEvents.onDidScroll = function (e) { return _this._onDidScrollChange.fire(e); };
viewOutgoingEvents.onDidGainFocus = function () { return _this._editorTextFocus.setValue(true); };
viewOutgoingEvents.onDidLoseFocus = function () { return _this._editorTextFocus.setValue(false); };
viewOutgoingEvents.onContextMenu = function (e) { return _this._onContextMenu.fire(e); };
viewOutgoingEvents.onMouseDown = function (e) { return _this._onMouseDown.fire(e); };
viewOutgoingEvents.onMouseUp = function (e) { return _this._onMouseUp.fire(e); };
viewOutgoingEvents.onMouseDrag = function (e) { return _this._onMouseDrag.fire(e); };
viewOutgoingEvents.onMouseDrop = function (e) { return _this._onMouseDrop.fire(e); };
viewOutgoingEvents.onKeyUp = function (e) { return _this._onKeyUp.fire(e); };
viewOutgoingEvents.onMouseMove = function (e) { return _this._onMouseMove.fire(e); };
viewOutgoingEvents.onMouseLeave = function (e) { return _this._onMouseLeave.fire(e); };
viewOutgoingEvents.onMouseWheel = function (e) { return _this._onMouseWheel.fire(e); };
viewOutgoingEvents.onKeyDown = function (e) { return _this._onKeyDown.fire(e); };
var view = new viewImpl_View(commandDelegate, this._configuration, this._themeService, viewModel, cursor, viewOutgoingEvents);
return [view, true];
};
CodeEditorWidget.prototype._postDetachModelCleanup = function (detachedModel) {
if (detachedModel) {
detachedModel.removeAllDecorationsWithOwnerId(this._id);
}
};
CodeEditorWidget.prototype._detachModel = function () {
if (!this._modelData) {
return null;
}
var model = this._modelData.model;
var 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.removeChild(removeDomNode);
}
return model;
};
CodeEditorWidget.prototype._removeDecorationType = function (key) {
this._codeEditorService.removeDecorationType(key);
};
CodeEditorWidget.prototype.hasModel = function () {
return (this._modelData !== null);
};
CodeEditorWidget = __decorate([
__param(3, instantiation["a" /* IInstantiationService */]),
__param(4, services_codeEditorService["a" /* ICodeEditorService */]),
__param(5, common_commands["b" /* ICommandService */]),
__param(6, contextkey["c" /* IContextKeyService */]),
__param(7, common_themeService["c" /* IThemeService */]),
__param(8, notification["a" /* INotificationService */]),
__param(9, accessibility["b" /* IAccessibilityService */])
], CodeEditorWidget);
return CodeEditorWidget;
}(lifecycle["a" /* Disposable */]));
var codeEditorWidget_BooleanEventEmitter = /** @class */ (function (_super) {
codeEditorWidget_extends(BooleanEventEmitter, _super);
function BooleanEventEmitter() {
var _this = _super.call(this) || this;
_this._onDidChangeToTrue = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeToTrue = _this._onDidChangeToTrue.event;
_this._onDidChangeToFalse = _this._register(new common_event["a" /* Emitter */]());
_this.onDidChangeToFalse = _this._onDidChangeToFalse.event;
_this._value = 0 /* NotSet */;
return _this;
}
BooleanEventEmitter.prototype.setValue = function (_value) {
var value = (_value ? 2 /* True */ : 1 /* False */);
if (this._value === value) {
return;
}
this._value = value;
if (this._value === 2 /* True */) {
this._onDidChangeToTrue.fire();
}
else if (this._value === 1 /* False */) {
this._onDidChangeToFalse.fire();
}
};
return BooleanEventEmitter;
}(lifecycle["a" /* Disposable */]));
var codeEditorWidget_EditorContextKeysManager = /** @class */ (function (_super) {
codeEditorWidget_extends(EditorContextKeysManager, _super);
function EditorContextKeysManager(editor, contextKeyService) {
var _this = _super.call(this) || this;
_this._editor = editor;
contextKeyService.createKey('editorId', editor.getId());
_this._editorSimpleInput = editorContextKeys["a" /* EditorContextKeys */].editorSimpleInput.bindTo(contextKeyService);
_this._editorFocus = editorContextKeys["a" /* EditorContextKeys */].focus.bindTo(contextKeyService);
_this._textInputFocus = editorContextKeys["a" /* EditorContextKeys */].textInputFocus.bindTo(contextKeyService);
_this._editorTextFocus = editorContextKeys["a" /* EditorContextKeys */].editorTextFocus.bindTo(contextKeyService);
_this._editorTabMovesFocus = editorContextKeys["a" /* EditorContextKeys */].tabMovesFocus.bindTo(contextKeyService);
_this._editorReadonly = editorContextKeys["a" /* EditorContextKeys */].readOnly.bindTo(contextKeyService);
_this._hasMultipleSelections = editorContextKeys["a" /* EditorContextKeys */].hasMultipleSelections.bindTo(contextKeyService);
_this._hasNonEmptySelection = editorContextKeys["a" /* EditorContextKeys */].hasNonEmptySelection.bindTo(contextKeyService);
_this._canUndo = editorContextKeys["a" /* EditorContextKeys */].canUndo.bindTo(contextKeyService);
_this._canRedo = editorContextKeys["a" /* EditorContextKeys */].canRedo.bindTo(contextKeyService);
_this._register(_this._editor.onDidChangeConfiguration(function () { return _this._updateFromConfig(); }));
_this._register(_this._editor.onDidChangeCursorSelection(function () { return _this._updateFromSelection(); }));
_this._register(_this._editor.onDidFocusEditorWidget(function () { return _this._updateFromFocus(); }));
_this._register(_this._editor.onDidBlurEditorWidget(function () { return _this._updateFromFocus(); }));
_this._register(_this._editor.onDidFocusEditorText(function () { return _this._updateFromFocus(); }));
_this._register(_this._editor.onDidBlurEditorText(function () { return _this._updateFromFocus(); }));
_this._register(_this._editor.onDidChangeModel(function () { return _this._updateFromModel(); }));
_this._register(_this._editor.onDidChangeConfiguration(function () { return _this._updateFromModel(); }));
_this._updateFromConfig();
_this._updateFromSelection();
_this._updateFromFocus();
_this._updateFromModel();
_this._editorSimpleInput.set(_this._editor.isSimpleWidget);
return _this;
}
EditorContextKeysManager.prototype._updateFromConfig = function () {
var options = this._editor.getOptions();
this._editorTabMovesFocus.set(options.get(106 /* tabFocusMode */));
this._editorReadonly.set(options.get(68 /* readOnly */));
};
EditorContextKeysManager.prototype._updateFromSelection = function () {
var selections = this._editor.getSelections();
if (!selections) {
this._hasMultipleSelections.reset();
this._hasNonEmptySelection.reset();
}
else {
this._hasMultipleSelections.set(selections.length > 1);
this._hasNonEmptySelection.set(selections.some(function (s) { return !s.isEmpty(); }));
}
};
EditorContextKeysManager.prototype._updateFromFocus = function () {
this._editorFocus.set(this._editor.hasWidgetFocus() && !this._editor.isSimpleWidget);
this._editorTextFocus.set(this._editor.hasTextFocus() && !this._editor.isSimpleWidget);
this._textInputFocus.set(this._editor.hasTextFocus());
};
EditorContextKeysManager.prototype._updateFromModel = function () {
var model = this._editor.getModel();
this._canUndo.set(Boolean(model && model.canUndo()));
this._canRedo.set(Boolean(model && model.canRedo()));
};
return EditorContextKeysManager;
}(lifecycle["a" /* Disposable */]));
var codeEditorWidget_EditorModeContext = /** @class */ (function (_super) {
codeEditorWidget_extends(EditorModeContext, _super);
function EditorModeContext(_editor, _contextKeyService) {
var _this = _super.call(this) || this;
_this._editor = _editor;
_this._contextKeyService = _contextKeyService;
_this._langId = editorContextKeys["a" /* EditorContextKeys */].languageId.bindTo(_contextKeyService);
_this._hasCompletionItemProvider = editorContextKeys["a" /* EditorContextKeys */].hasCompletionItemProvider.bindTo(_contextKeyService);
_this._hasCodeActionsProvider = editorContextKeys["a" /* EditorContextKeys */].hasCodeActionsProvider.bindTo(_contextKeyService);
_this._hasCodeLensProvider = editorContextKeys["a" /* EditorContextKeys */].hasCodeLensProvider.bindTo(_contextKeyService);
_this._hasDefinitionProvider = editorContextKeys["a" /* EditorContextKeys */].hasDefinitionProvider.bindTo(_contextKeyService);
_this._hasDeclarationProvider = editorContextKeys["a" /* EditorContextKeys */].hasDeclarationProvider.bindTo(_contextKeyService);
_this._hasImplementationProvider = editorContextKeys["a" /* EditorContextKeys */].hasImplementationProvider.bindTo(_contextKeyService);
_this._hasTypeDefinitionProvider = editorContextKeys["a" /* EditorContextKeys */].hasTypeDefinitionProvider.bindTo(_contextKeyService);
_this._hasHoverProvider = editorContextKeys["a" /* EditorContextKeys */].hasHoverProvider.bindTo(_contextKeyService);
_this._hasDocumentHighlightProvider = editorContextKeys["a" /* EditorContextKeys */].hasDocumentHighlightProvider.bindTo(_contextKeyService);
_this._hasDocumentSymbolProvider = editorContextKeys["a" /* EditorContextKeys */].hasDocumentSymbolProvider.bindTo(_contextKeyService);
_this._hasReferenceProvider = editorContextKeys["a" /* EditorContextKeys */].hasReferenceProvider.bindTo(_contextKeyService);
_this._hasRenameProvider = editorContextKeys["a" /* EditorContextKeys */].hasRenameProvider.bindTo(_contextKeyService);
_this._hasSignatureHelpProvider = editorContextKeys["a" /* EditorContextKeys */].hasSignatureHelpProvider.bindTo(_contextKeyService);
_this._hasDocumentFormattingProvider = editorContextKeys["a" /* EditorContextKeys */].hasDocumentFormattingProvider.bindTo(_contextKeyService);
_this._hasDocumentSelectionFormattingProvider = editorContextKeys["a" /* EditorContextKeys */].hasDocumentSelectionFormattingProvider.bindTo(_contextKeyService);
_this._hasMultipleDocumentFormattingProvider = editorContextKeys["a" /* EditorContextKeys */].hasMultipleDocumentFormattingProvider.bindTo(_contextKeyService);
_this._hasMultipleDocumentSelectionFormattingProvider = editorContextKeys["a" /* EditorContextKeys */].hasMultipleDocumentSelectionFormattingProvider.bindTo(_contextKeyService);
_this._isInWalkThrough = editorContextKeys["a" /* EditorContextKeys */].isInEmbeddedEditor.bindTo(_contextKeyService);
var update = function () { return _this._update(); };
// update when model/mode changes
_this._register(_editor.onDidChangeModel(update));
_this._register(_editor.onDidChangeModelLanguage(update));
// update when registries change
_this._register(modes["d" /* CompletionProviderRegistry */].onDidChange(update));
_this._register(modes["a" /* CodeActionProviderRegistry */].onDidChange(update));
_this._register(modes["b" /* CodeLensProviderRegistry */].onDidChange(update));
_this._register(modes["f" /* DefinitionProviderRegistry */].onDidChange(update));
_this._register(modes["e" /* DeclarationProviderRegistry */].onDidChange(update));
_this._register(modes["q" /* ImplementationProviderRegistry */].onDidChange(update));
_this._register(modes["C" /* TypeDefinitionProviderRegistry */].onDidChange(update));
_this._register(modes["p" /* HoverProviderRegistry */].onDidChange(update));
_this._register(modes["i" /* DocumentHighlightProviderRegistry */].onDidChange(update));
_this._register(modes["m" /* DocumentSymbolProviderRegistry */].onDidChange(update));
_this._register(modes["u" /* ReferenceProviderRegistry */].onDidChange(update));
_this._register(modes["v" /* RenameProviderRegistry */].onDidChange(update));
_this._register(modes["g" /* DocumentFormattingEditProviderRegistry */].onDidChange(update));
_this._register(modes["j" /* DocumentRangeFormattingEditProviderRegistry */].onDidChange(update));
_this._register(modes["x" /* SignatureHelpProviderRegistry */].onDidChange(update));
update();
return _this;
}
EditorModeContext.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
EditorModeContext.prototype.reset = function () {
var _this = this;
this._contextKeyService.bufferChangeEvents(function () {
_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._isInWalkThrough.reset();
});
};
EditorModeContext.prototype._update = function () {
var _this = this;
var model = this._editor.getModel();
if (!model) {
this.reset();
return;
}
this._contextKeyService.bufferChangeEvents(function () {
_this._langId.set(model.getLanguageIdentifier().language);
_this._hasCompletionItemProvider.set(modes["d" /* CompletionProviderRegistry */].has(model));
_this._hasCodeActionsProvider.set(modes["a" /* CodeActionProviderRegistry */].has(model));
_this._hasCodeLensProvider.set(modes["b" /* CodeLensProviderRegistry */].has(model));
_this._hasDefinitionProvider.set(modes["f" /* DefinitionProviderRegistry */].has(model));
_this._hasDeclarationProvider.set(modes["e" /* DeclarationProviderRegistry */].has(model));
_this._hasImplementationProvider.set(modes["q" /* ImplementationProviderRegistry */].has(model));
_this._hasTypeDefinitionProvider.set(modes["C" /* TypeDefinitionProviderRegistry */].has(model));
_this._hasHoverProvider.set(modes["p" /* HoverProviderRegistry */].has(model));
_this._hasDocumentHighlightProvider.set(modes["i" /* DocumentHighlightProviderRegistry */].has(model));
_this._hasDocumentSymbolProvider.set(modes["m" /* DocumentSymbolProviderRegistry */].has(model));
_this._hasReferenceProvider.set(modes["u" /* ReferenceProviderRegistry */].has(model));
_this._hasRenameProvider.set(modes["v" /* RenameProviderRegistry */].has(model));
_this._hasSignatureHelpProvider.set(modes["x" /* SignatureHelpProviderRegistry */].has(model));
_this._hasDocumentFormattingProvider.set(modes["g" /* DocumentFormattingEditProviderRegistry */].has(model) || modes["j" /* DocumentRangeFormattingEditProviderRegistry */].has(model));
_this._hasDocumentSelectionFormattingProvider.set(modes["j" /* DocumentRangeFormattingEditProviderRegistry */].has(model));
_this._hasMultipleDocumentFormattingProvider.set(modes["g" /* DocumentFormattingEditProviderRegistry */].all(model).length + modes["j" /* DocumentRangeFormattingEditProviderRegistry */].all(model).length > 1);
_this._hasMultipleDocumentSelectionFormattingProvider.set(modes["j" /* DocumentRangeFormattingEditProviderRegistry */].all(model).length > 1);
_this._isInWalkThrough.set(model.uri.scheme === network["b" /* Schemas */].walkThroughSnippet);
});
};
return EditorModeContext;
}(lifecycle["a" /* Disposable */]));
var codeEditorWidget_CodeEditorWidgetFocusTracker = /** @class */ (function (_super) {
codeEditorWidget_extends(CodeEditorWidgetFocusTracker, _super);
function CodeEditorWidgetFocusTracker(domElement) {
var _this = _super.call(this) || this;
_this._onChange = _this._register(new common_event["a" /* Emitter */]());
_this.onChange = _this._onChange.event;
_this._hasFocus = false;
_this._domFocusTracker = _this._register(dom["Z" /* trackFocus */](domElement));
_this._register(_this._domFocusTracker.onDidFocus(function () {
_this._hasFocus = true;
_this._onChange.fire(undefined);
}));
_this._register(_this._domFocusTracker.onDidBlur(function () {
_this._hasFocus = false;
_this._onChange.fire(undefined);
}));
return _this;
}
CodeEditorWidgetFocusTracker.prototype.hasFocus = function () {
return this._hasFocus;
};
return CodeEditorWidgetFocusTracker;
}(lifecycle["a" /* Disposable */]));
var squigglyStart = encodeURIComponent("");
function getSquigglySVGData(color) {
return squigglyStart + encodeURIComponent(color.toString()) + squigglyEnd;
}
var dotdotdotStart = encodeURIComponent("");
function getDotDotDotSVGData(color) {
return dotdotdotStart + encodeURIComponent(color.toString()) + dotdotdotEnd;
}
Object(common_themeService["e" /* registerThemingParticipant */])(function (theme, collector) {
var errorBorderColor = theme.getColor(colorRegistry["p" /* editorErrorBorder */]);
if (errorBorderColor) {
collector.addRule(".monaco-editor ." + "squiggly-error" /* EditorErrorDecoration */ + " { border-bottom: 4px double " + errorBorderColor + "; }");
}
var errorForeground = theme.getColor(colorRegistry["q" /* editorErrorForeground */]);
if (errorForeground) {
collector.addRule(".monaco-editor ." + "squiggly-error" /* EditorErrorDecoration */ + " { background: url(\"data:image/svg+xml," + getSquigglySVGData(errorForeground) + "\") repeat-x bottom left; }");
}
var warningBorderColor = theme.getColor(colorRegistry["O" /* editorWarningBorder */]);
if (warningBorderColor) {
collector.addRule(".monaco-editor ." + "squiggly-warning" /* EditorWarningDecoration */ + " { border-bottom: 4px double " + warningBorderColor + "; }");
}
var warningForeground = theme.getColor(colorRegistry["P" /* editorWarningForeground */]);
if (warningForeground) {
collector.addRule(".monaco-editor ." + "squiggly-warning" /* EditorWarningDecoration */ + " { background: url(\"data:image/svg+xml," + getSquigglySVGData(warningForeground) + "\") repeat-x bottom left; }");
}
var infoBorderColor = theme.getColor(colorRegistry["G" /* editorInfoBorder */]);
if (infoBorderColor) {
collector.addRule(".monaco-editor ." + "squiggly-info" /* EditorInfoDecoration */ + " { border-bottom: 4px double " + infoBorderColor + "; }");
}
var infoForeground = theme.getColor(colorRegistry["H" /* editorInfoForeground */]);
if (infoForeground) {
collector.addRule(".monaco-editor ." + "squiggly-info" /* EditorInfoDecoration */ + " { background: url(\"data:image/svg+xml," + getSquigglySVGData(infoForeground) + "\") repeat-x bottom left; }");
}
var hintBorderColor = theme.getColor(colorRegistry["y" /* editorHintBorder */]);
if (hintBorderColor) {
collector.addRule(".monaco-editor ." + "squiggly-hint" /* EditorHintDecoration */ + " { border-bottom: 2px dotted " + hintBorderColor + "; }");
}
var hintForeground = theme.getColor(colorRegistry["z" /* editorHintForeground */]);
if (hintForeground) {
collector.addRule(".monaco-editor ." + "squiggly-hint" /* EditorHintDecoration */ + " { background: url(\"data:image/svg+xml," + getDotDotDotSVGData(hintForeground) + "\") no-repeat bottom left; }");
}
var unnecessaryForeground = theme.getColor(editorColorRegistry["o" /* editorUnnecessaryCodeOpacity */]);
if (unnecessaryForeground) {
collector.addRule(".monaco-editor.showUnused ." + "squiggly-inline-unnecessary" /* EditorUnnecessaryInlineDecoration */ + " { opacity: " + unnecessaryForeground.rgba.a + "; }");
}
var unnecessaryBorder = theme.getColor(editorColorRegistry["n" /* editorUnnecessaryCodeBorder */]);
if (unnecessaryBorder) {
collector.addRule(".monaco-editor.showUnused ." + "squiggly-unnecessary" /* EditorUnnecessaryDecoration */ + " { border-bottom: 2px dashed " + unnecessaryBorder + "; }");
}
var deprecatedForeground = theme.getColor(colorRegistry["x" /* editorForeground */]) || 'inherit';
collector.addRule(".monaco-editor ." + "squiggly-inline-deprecated" /* EditorDeprecatedInlineDecoration */ + " { text-decoration: line-through; text-decoration-color: " + deprecatedForeground + "}");
});
/***/ }),
/* 165 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IClipboardService; });
/* harmony import */ var _instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var IClipboardService = Object(_instantiation_common_instantiation_js__WEBPACK_IMPORTED_MODULE_0__[/* createDecorator */ "c"])('clipboardService');
/***/ }),
/* 166 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
/***/ }),
/* 167 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ColorZone */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OverviewRulerZone; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return OverviewZoneManager; });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ColorZone = /** @class */ (function () {
function ColorZone(from, to, colorId) {
this.from = from | 0;
this.to = to | 0;
this.colorId = colorId | 0;
}
ColorZone.compare = function (a, b) {
if (a.colorId === b.colorId) {
if (a.from === b.from) {
return a.to - b.to;
}
return a.from - b.from;
}
return a.colorId - b.colorId;
};
return ColorZone;
}());
/**
* A zone in the overview ruler
*/
var OverviewRulerZone = /** @class */ (function () {
function OverviewRulerZone(startLineNumber, endLineNumber, color) {
this.startLineNumber = startLineNumber;
this.endLineNumber = endLineNumber;
this.color = color;
this._colorZone = null;
}
OverviewRulerZone.compare = function (a, b) {
if (a.color === b.color) {
if (a.startLineNumber === b.startLineNumber) {
return a.endLineNumber - b.endLineNumber;
}
return a.startLineNumber - b.startLineNumber;
}
return a.color < b.color ? -1 : 1;
};
OverviewRulerZone.prototype.setColorZone = function (colorZone) {
this._colorZone = colorZone;
};
OverviewRulerZone.prototype.getColorZones = function () {
return this._colorZone;
};
return OverviewRulerZone;
}());
var OverviewZoneManager = /** @class */ (function () {
function OverviewZoneManager(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 = Object.create(null);
this._id2Color = [];
}
OverviewZoneManager.prototype.getId2Color = function () {
return this._id2Color;
};
OverviewZoneManager.prototype.setZones = function (newZones) {
this._zones = newZones;
this._zones.sort(OverviewRulerZone.compare);
};
OverviewZoneManager.prototype.setLineHeight = function (lineHeight) {
if (this._lineHeight === lineHeight) {
return false;
}
this._lineHeight = lineHeight;
this._colorZonesInvalid = true;
return true;
};
OverviewZoneManager.prototype.setPixelRatio = function (pixelRatio) {
this._pixelRatio = pixelRatio;
this._colorZonesInvalid = true;
};
OverviewZoneManager.prototype.getDOMWidth = function () {
return this._domWidth;
};
OverviewZoneManager.prototype.getCanvasWidth = function () {
return this._domWidth * this._pixelRatio;
};
OverviewZoneManager.prototype.setDOMWidth = function (width) {
if (this._domWidth === width) {
return false;
}
this._domWidth = width;
this._colorZonesInvalid = true;
return true;
};
OverviewZoneManager.prototype.getDOMHeight = function () {
return this._domHeight;
};
OverviewZoneManager.prototype.getCanvasHeight = function () {
return this._domHeight * this._pixelRatio;
};
OverviewZoneManager.prototype.setDOMHeight = function (height) {
if (this._domHeight === height) {
return false;
}
this._domHeight = height;
this._colorZonesInvalid = true;
return true;
};
OverviewZoneManager.prototype.getOuterHeight = function () {
return this._outerHeight;
};
OverviewZoneManager.prototype.setOuterHeight = function (outerHeight) {
if (this._outerHeight === outerHeight) {
return false;
}
this._outerHeight = outerHeight;
this._colorZonesInvalid = true;
return true;
};
OverviewZoneManager.prototype.resolveColorZones = function () {
var colorZonesInvalid = this._colorZonesInvalid;
var lineHeight = Math.floor(this._lineHeight); // @perf
var totalHeight = Math.floor(this.getCanvasHeight()); // @perf
var outerHeight = Math.floor(this._outerHeight); // @perf
var heightRatio = totalHeight / outerHeight;
var halfMinimumHeight = Math.floor(4 /* MINIMUM_HEIGHT */ * this._pixelRatio / 2);
var allColorZones = [];
for (var i = 0, len = this._zones.length; i < len; i++) {
var zone = this._zones[i];
if (!colorZonesInvalid) {
var colorZone_1 = zone.getColorZones();
if (colorZone_1) {
allColorZones.push(colorZone_1);
continue;
}
}
var y1 = Math.floor(heightRatio * (this._getVerticalOffsetForLine(zone.startLineNumber)));
var y2 = Math.floor(heightRatio * (this._getVerticalOffsetForLine(zone.endLineNumber) + lineHeight));
var ycenter = Math.floor((y1 + y2) / 2);
var halfHeight = (y2 - ycenter);
if (halfHeight < halfMinimumHeight) {
halfHeight = halfMinimumHeight;
}
if (ycenter - halfHeight < 0) {
ycenter = halfHeight;
}
if (ycenter + halfHeight > totalHeight) {
ycenter = totalHeight - halfHeight;
}
var color = zone.color;
var colorId = this._color2Id[color];
if (!colorId) {
colorId = (++this._lastAssignedId);
this._color2Id[color] = colorId;
this._id2Color[colorId] = color;
}
var colorZone = new ColorZone(ycenter - halfHeight, ycenter + halfHeight, colorId);
zone.setColorZone(colorZone);
allColorZones.push(colorZone);
}
this._colorZonesInvalid = false;
allColorZones.sort(ColorZone.compare);
return allColorZones;
};
return OverviewZoneManager;
}());
/***/ }),
/* 168 */
/***/ (function(module, exports) {
// Exports
module.exports = {
"sidebar": "sidebar_1kLs",
"sidebarLogo": "sidebarLogo_3ono",
"menu": "menu_w2sC",
"sidebarMenuIcon": "sidebarMenuIcon_2vk4",
"sidebarMenuCloseIcon": "sidebarMenuCloseIcon_1JRa"
};
/***/ }),
/* 169 */
/***/ (function(module, exports) {
// Exports
module.exports = {
"codeBlock": "codeBlock_222H",
"hasTitle": "hasTitle_1PmY",
"title": "title_1twf",
"codeBlockLines": "codeBlockLines_3zpG",
"copyButton": "copyButton_ujp3",
"playgroundButton": "playgroundButton_3DKR"
};
/***/ }),
/* 170 */
/***/ (function(module, exports) {
function override(source1, source2) {
var target = {};
var key1;
var key2;
var item;
for (key1 in source1) {
item = source1[key1];
if (Array.isArray(item)) {
target[key1] = item.slice(0);
} else if (typeof item == 'object' && item !== null) {
target[key1] = override(item, {});
} else {
target[key1] = item;
}
}
for (key2 in source2) {
item = source2[key2];
if (key2 in target && Array.isArray(item)) {
target[key2] = item.slice(0);
} else if (key2 in target && typeof item == 'object' && item !== null) {
target[key2] = override(target[key2], item);
} else {
target[key2] = item;
}
}
return target;
}
module.exports = override;
/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {
var Hack = __webpack_require__(247);
var Marker = __webpack_require__(100);
var Token = __webpack_require__(70);
var Match = {
ASTERISK: '*',
BACKSLASH: '\\',
BANG: '!',
BANG_SUFFIX_PATTERN: /!\w+$/,
IMPORTANT_TOKEN: '!important',
IMPORTANT_TOKEN_PATTERN: new RegExp('!important$', 'i'),
IMPORTANT_WORD: 'important',
IMPORTANT_WORD_PATTERN: new RegExp('important$', 'i'),
SUFFIX_BANG_PATTERN: /!$/,
UNDERSCORE: '_',
VARIABLE_REFERENCE_PATTERN: /var\(--.+\)$/
};
function wrapAll(properties, includeVariable, skipProperties) {
var wrapped = [];
var single;
var property;
var i;
for (i = properties.length - 1; i >= 0; i--) {
property = properties[i];
if (property[0] != Token.PROPERTY) {
continue;
}
if (!includeVariable && someVariableReferences(property)) {
continue;
}
if (skipProperties && skipProperties.indexOf(property[1][1]) > -1) {
continue;
}
single = wrapSingle(property);
single.all = properties;
single.position = i;
wrapped.unshift(single);
}
return wrapped;
}
function someVariableReferences(property) {
var i, l;
var value;
// skipping `property` and property name tokens
for (i = 2, l = property.length; i < l; i++) {
value = property[i];
if (value[0] != Token.PROPERTY_VALUE) {
continue;
}
if (isVariableReference(value[1])) {
return true;
}
}
return false;
}
function isVariableReference(value) {
return Match.VARIABLE_REFERENCE_PATTERN.test(value);
}
function isMultiplex(property) {
var value;
var i, l;
for (i = 3, l = property.length; i < l; i++) {
value = property[i];
if (value[0] == Token.PROPERTY_VALUE && (value[1] == Marker.COMMA || value[1] == Marker.FORWARD_SLASH)) {
return true;
}
}
return false;
}
function hackFrom(property) {
var match = false;
var name = property[1][1];
var lastValue = property[property.length - 1];
if (name[0] == Match.UNDERSCORE) {
match = [Hack.UNDERSCORE];
} else if (name[0] == Match.ASTERISK) {
match = [Hack.ASTERISK];
} else if (lastValue[1][0] == Match.BANG && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN)) {
match = [Hack.BANG];
} else if (lastValue[1].indexOf(Match.BANG) > 0 && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN) && Match.BANG_SUFFIX_PATTERN.test(lastValue[1])) {
match = [Hack.BANG];
} else if (lastValue[1].indexOf(Match.BACKSLASH) > 0 && lastValue[1].indexOf(Match.BACKSLASH) == lastValue[1].length - Match.BACKSLASH.length - 1) {
match = [Hack.BACKSLASH, lastValue[1].substring(lastValue[1].indexOf(Match.BACKSLASH) + 1)];
} else if (lastValue[1].indexOf(Match.BACKSLASH) === 0 && lastValue[1].length == 2) {
match = [Hack.BACKSLASH, lastValue[1].substring(1)];
}
return match;
}
function isImportant(property) {
if (property.length < 3)
return false;
var lastValue = property[property.length - 1];
if (Match.IMPORTANT_TOKEN_PATTERN.test(lastValue[1])) {
return true;
} else if (Match.IMPORTANT_WORD_PATTERN.test(lastValue[1]) && Match.SUFFIX_BANG_PATTERN.test(property[property.length - 2][1])) {
return true;
}
return false;
}
function stripImportant(property) {
var lastValue = property[property.length - 1];
var oneButLastValue = property[property.length - 2];
if (Match.IMPORTANT_TOKEN_PATTERN.test(lastValue[1])) {
lastValue[1] = lastValue[1].replace(Match.IMPORTANT_TOKEN_PATTERN, '');
} else {
lastValue[1] = lastValue[1].replace(Match.IMPORTANT_WORD_PATTERN, '');
oneButLastValue[1] = oneButLastValue[1].replace(Match.SUFFIX_BANG_PATTERN, '');
}
if (lastValue[1].length === 0) {
property.pop();
}
if (oneButLastValue[1].length === 0) {
property.pop();
}
}
function stripPrefixHack(property) {
property[1][1] = property[1][1].substring(1);
}
function stripSuffixHack(property, hackFrom) {
var lastValue = property[property.length - 1];
lastValue[1] = lastValue[1]
.substring(0, lastValue[1].indexOf(hackFrom[0] == Hack.BACKSLASH ? Match.BACKSLASH : Match.BANG))
.trim();
if (lastValue[1].length === 0) {
property.pop();
}
}
function wrapSingle(property) {
var importantProperty = isImportant(property);
if (importantProperty) {
stripImportant(property);
}
var whichHack = hackFrom(property);
if (whichHack[0] == Hack.ASTERISK || whichHack[0] == Hack.UNDERSCORE) {
stripPrefixHack(property);
} else if (whichHack[0] == Hack.BACKSLASH || whichHack[0] == Hack.BANG) {
stripSuffixHack(property, whichHack);
}
return {
block: property[2] && property[2][0] == Token.PROPERTY_BLOCK,
components: [],
dirty: false,
hack: whichHack,
important: importantProperty,
name: property[1][1],
multiplex: property.length > 3 ? isMultiplex(property) : false,
position: 0,
shorthand: false,
unused: false,
value: property.slice(2)
};
}
module.exports = {
all: wrapAll,
single: wrapSingle
};
/***/ }),
/* 172 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(173);
var createDesc = __webpack_require__(215);
module.exports = __webpack_require__(162) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 173 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(174);
var IE8_DOM_DEFINE = __webpack_require__(324);
var toPrimitive = __webpack_require__(263);
var dP = Object.defineProperty;
exports.f = __webpack_require__(162) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 174 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(161);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 175 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(328);
var defined = __webpack_require__(262);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 177 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export BrowserRouter */
/* unused harmony export HashRouter */
/* unused harmony export Link */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavLink; });
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(116);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["f"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["g"]; });
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(136);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(126);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(42);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(166);
/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(117);
/**
* The public API for a that uses HTML5 history.
*/
var BrowserRouter =
/*#__PURE__*/
function (_React$Component) {
Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(BrowserRouter, _React$Component);
function BrowserRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createBrowserHistory */ "a"])(_this.props);
return _this;
}
var _proto = BrowserRouter.prototype;
_proto.render = function render() {
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "b"], {
history: this.history,
children: this.props.children
});
};
return BrowserRouter;
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
if (false) {}
/**
* The public API for a that uses window.location.hash.
*/
var HashRouter =
/*#__PURE__*/
function (_React$Component) {
Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(HashRouter, _React$Component);
function HashRouter() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createHashHistory */ "b"])(_this.props);
return _this;
}
var _proto = HashRouter.prototype;
_proto.render = function render() {
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* Router */ "b"], {
history: this.history,
children: this.props.children
});
};
return HashRouter;
}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component);
if (false) {}
var resolveToLocation = function resolveToLocation(to, currentLocation) {
return typeof to === "function" ? to(currentLocation) : to;
};
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
return typeof to === "string" ? Object(history__WEBPACK_IMPORTED_MODULE_3__[/* createLocation */ "c"])(to, null, null, currentLocation) : to;
};
var forwardRefShim = function forwardRefShim(C) {
return C;
};
var forwardRef = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
if (typeof forwardRef === "undefined") {
forwardRef = forwardRefShim;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
var innerRef = _ref.innerRef,
navigate = _ref.navigate,
_onClick = _ref.onClick,
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["innerRef", "navigate", "onClick"]);
var target = rest.target;
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
onClick: function onClick(event) {
try {
if (_onClick) _onClick(event);
} catch (ex) {
event.preventDefault();
throw ex;
}
if (!event.defaultPrevented && // onClick prevented default
event.button === 0 && ( // ignore everything but left clicks
!target || target === "_self") && // let browser handle "target=_blank" etc.
!isModifiedEvent(event) // ignore clicks with modifier keys
) {
event.preventDefault();
navigate();
}
}
}); // React 15 compat
if (forwardRefShim !== forwardRef) {
props.ref = forwardedRef || innerRef;
} else {
props.ref = innerRef;
}
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement("a", props);
});
if (false) {}
/**
* The public API for rendering a history-aware .
*/
var Link = forwardRef(function (_ref2, forwardedRef) {
var _ref2$component = _ref2.component,
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
replace = _ref2.replace,
to = _ref2.to,
innerRef = _ref2.innerRef,
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref2, ["component", "replace", "to", "innerRef"]);
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
var history = context.history;
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
var href = location ? history.createHref(location) : "";
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, rest, {
href: href,
navigate: function navigate() {
var location = resolveToLocation(to, context.location);
var method = replace ? history.replace : history.push;
method(location);
}
}); // React 15 compat
if (forwardRefShim !== forwardRef) {
props.ref = forwardedRef || innerRef;
} else {
props.innerRef = innerRef;
}
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(component, props);
});
});
if (false) { var refType, toType; }
var forwardRefShim$1 = function forwardRefShim(C) {
return C;
};
var forwardRef$1 = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef;
if (typeof forwardRef$1 === "undefined") {
forwardRef$1 = forwardRefShim$1;
}
function joinClassnames() {
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
classnames[_key] = arguments[_key];
}
return classnames.filter(function (i) {
return i;
}).join(" ");
}
/**
* A wrapper that knows if it's "active" or not.
*/
var NavLink = forwardRef$1(function (_ref, forwardedRef) {
var _ref$ariaCurrent = _ref["aria-current"],
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
_ref$activeClassName = _ref.activeClassName,
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
activeStyle = _ref.activeStyle,
classNameProp = _ref.className,
exact = _ref.exact,
isActiveProp = _ref.isActive,
locationProp = _ref.location,
strict = _ref.strict,
styleProp = _ref.style,
to = _ref.to,
innerRef = _ref.innerRef,
rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "strict", "style", "to", "innerRef"]);
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__[/* __RouterContext */ "e"].Consumer, null, function (context) {
!context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(false) : void 0;
var currentLocation = locationProp || context.location;
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
var match = escapedPath ? Object(react_router__WEBPACK_IMPORTED_MODULE_0__[/* matchPath */ "f"])(currentLocation.pathname, {
path: escapedPath,
exact: exact,
strict: strict
}) : null;
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
var style = isActive ? Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({}, styleProp, {}, activeStyle) : styleProp;
var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])({
"aria-current": isActive && ariaCurrent || null,
className: className,
style: style,
to: toLocation
}, rest); // React 15 compat
if (forwardRefShim$1 !== forwardRef$1) {
props.ref = forwardedRef || innerRef;
} else {
props.innerRef = innerRef;
}
return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Link, props);
});
});
if (false) { var ariaCurrentType; }
//# sourceMappingURL=react-router-dom.js.map
/***/ }),
/* 178 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/**
* Prism: Lightweight, robust, elegant syntax highlighting
* MIT license http://www.opensource.org/licenses/mit-license.php/
* @author Lea Verou http://lea.verou.me
*/
/**
* prism-react-renderer:
* This file has been modified to remove:
* - globals and window dependency
* - worker support
* - highlightAll and other element dependent methods
* - _.hooks helpers
* - UMD/node-specific hacks
* It has also been run through prettier
*/
var Prism = function () {
var uniqueId = 0;
var _ = {
util: {
encode: function (tokens) {
if (tokens instanceof Token) {
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
} else if (_.util.type(tokens) === "Array") {
return tokens.map(_.util.encode);
} else {
return tokens.replace(/&/g, "&").replace(/ text.length) {
// Something went terribly wrong, ABORT, ABORT!
return;
}
if (str instanceof Token) {
continue;
}
if (greedy && i != strarr.length - 1) {
pattern.lastIndex = pos;
var match = pattern.exec(text);
if (!match) {
break;
}
var from = match.index + (lookbehind ? match[1].length : 0),
to = match.index + match[0].length,
k = i,
p = pos;
for (var len = strarr.length; k < len && (p < to || !strarr[k].type && !strarr[k - 1].greedy); ++k) {
p += strarr[k].length; // Move the index i to the element in strarr that is closest to from
if (from >= p) {
++i;
pos = p;
}
} // If strarr[i] is a Token, then the match starts inside another Token, which is invalid
if (strarr[i] instanceof Token) {
continue;
} // Number of tokens to delete and replace with the new match
delNum = k - i;
str = text.slice(pos, p);
match.index -= pos;
} else {
pattern.lastIndex = 0;
var match = pattern.exec(str),
delNum = 1;
}
if (!match) {
if (oneshot) {
break;
}
continue;
}
if (lookbehind) {
lookbehindLength = match[1] ? match[1].length : 0;
}
var from = match.index + lookbehindLength,
match = match[0].slice(lookbehindLength),
to = from + match.length,
before = str.slice(0, from),
after = str.slice(to);
var args = [i, delNum];
if (before) {
++i;
pos += before.length;
args.push(before);
}
var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy);
args.push(wrapped);
if (after) {
args.push(after);
}
Array.prototype.splice.apply(strarr, args);
if (delNum != 1) {
_.matchGrammar(text, strarr, grammar, i, pos, true, token);
}
if (oneshot) {
break;
}
}
}
}
},
hooks: {
add: function () {}
},
tokenize: function (text, grammar, language) {
var strarr = [text];
var rest = grammar.rest;
if (rest) {
for (var token in rest) {
grammar[token] = rest[token];
}
delete grammar.rest;
}
_.matchGrammar(text, strarr, grammar, 0, 0, false);
return strarr;
}
};
var Token = _.Token = function (type, content, alias, matchedStr, greedy) {
this.type = type;
this.content = content;
this.alias = alias; // Copy of the full string this token was created from
this.length = (matchedStr || "").length | 0;
this.greedy = !!greedy;
};
Token.stringify = function (o, language, parent) {
if (typeof o == "string") {
return o;
}
if (_.util.type(o) === "Array") {
return o.map(function (element) {
return Token.stringify(element, language, o);
}).join("");
}
var env = {
type: o.type,
content: Token.stringify(o.content, language, parent),
tag: "span",
classes: ["token", o.type],
attributes: {},
language: language,
parent: parent
};
if (o.alias) {
var aliases = _.util.type(o.alias) === "Array" ? o.alias : [o.alias];
Array.prototype.push.apply(env.classes, aliases);
}
var attributes = Object.keys(env.attributes).map(function (name) {
return name + '="' + (env.attributes[name] || "").replace(/"/g, """) + '"';
}).join(" ");
return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + (attributes ? " " + attributes : "") + ">" + env.content + "";
};
return _;
}();
/* This content is auto-generated to include some prismjs language components: */
/* "prismjs/components/prism-markup" */
Prism.languages.markup = {
'comment': //,
'prolog': /<\?[\s\S]+?\?>/,
'doctype': //i,
'cdata': //i,
'tag': {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
greedy: true,
inside: {
'tag': {
pattern: /^<\/?[^\s>\/]+/i,
inside: {
'punctuation': /^<\/?/,
'namespace': /^[^\s>\/:]+:/
}
},
'attr-value': {
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
inside: {
'punctuation': [/^=/, {
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}]
}
},
'punctuation': /\/?>/,
'attr-name': {
pattern: /[^\s>\/]+/,
inside: {
'namespace': /^[^\s>\/:]+:/
}
}
}
},
'entity': /&#?[\da-z]{1,8};/i
};
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity']; // Plugin to make entity title show the real entity, idea by Roman Komarov
Prism.hooks.add('wrap', function (env) {
if (env.type === 'entity') {
env.attributes['title'] = env.content.replace(/&/, '&');
}
});
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
/**
* Adds an inlined language to markup.
*
* An example of an inlined language is CSS with `